summaryrefslogtreecommitdiffstats
path: root/drivers/hid/amd-sfh-hid
Commit message (Collapse)AuthorAgeFilesLines
* HID: amd_sfh: Add light chromaticity for SFH1.1Basavaraj Natikar2023-09-242-1/+6
| | | | | | | | | | | In most cases, ambient color sensors also support the x and y light colors, which represent the coordinates on the CIE 1931 chromaticity diagram. Thus, add light chromaticity x and y for SFH1.1. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Link: https://lore.kernel.org/r/20230919081054.2050714-10-Basavaraj.Natikar@amd.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* HID: amd_sfh: Add light chromaticity supportBasavaraj Natikar2023-09-243-1/+20
| | | | | | | | | | | In most cases, ambient color sensors also support the x and y light colors, which represent the coordinates on the CIE 1931 chromaticity diagram. Thus, add light chromaticity x and y. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Link: https://lore.kernel.org/r/20230919081054.2050714-9-Basavaraj.Natikar@amd.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* HID: amd_sfh: Add support for SFH1.1 light color temperatureBasavaraj Natikar2023-09-242-0/+19
| | | | | | | | | | In most cases, ambient color sensors also support light color temperature. As a result, add support of light color temperature for SFH1.1. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Link: https://lore.kernel.org/r/20230919081054.2050714-6-Basavaraj.Natikar@amd.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* HID: amd_sfh: Add support for light color temperatureBasavaraj Natikar2023-09-243-0/+12
| | | | | | | | | | In most cases, ambient color sensors also support light color temperature. As a result, add support of light color temperature. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Link: https://lore.kernel.org/r/20230919081054.2050714-5-Basavaraj.Natikar@amd.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* HID: amd_sfh: Fix for shift-out-of-boundsBasavaraj Natikar2023-07-101-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shift operation of 'exp' and 'shift' variables exceeds the maximum number of shift values in the u32 range leading to UBSAN shift-out-of-bounds. ... [ 6.120512] UBSAN: shift-out-of-bounds in drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c:149:50 [ 6.120598] shift exponent 104 is too large for 64-bit type 'long unsigned int' [ 6.120659] CPU: 4 PID: 96 Comm: kworker/4:1 Not tainted 6.4.0amd_1-next-20230519-dirty #10 [ 6.120665] Hardware name: AMD Birman-PHX/Birman-PHX, BIOS SFH_with_HPD_SEN.FD 04/05/2023 [ 6.120667] Workqueue: events amd_sfh_work_buffer [amd_sfh] [ 6.120687] Call Trace: [ 6.120690] <TASK> [ 6.120694] dump_stack_lvl+0x48/0x70 [ 6.120704] dump_stack+0x10/0x20 [ 6.120707] ubsan_epilogue+0x9/0x40 [ 6.120716] __ubsan_handle_shift_out_of_bounds+0x10f/0x170 [ 6.120720] ? psi_group_change+0x25f/0x4b0 [ 6.120729] float_to_int.cold+0x18/0xba [amd_sfh] [ 6.120739] get_input_rep+0x57/0x340 [amd_sfh] [ 6.120748] ? __schedule+0xba7/0x1b60 [ 6.120756] ? __pfx_get_input_rep+0x10/0x10 [amd_sfh] [ 6.120764] amd_sfh_work_buffer+0x91/0x180 [amd_sfh] [ 6.120772] process_one_work+0x229/0x430 [ 6.120780] worker_thread+0x4a/0x3c0 [ 6.120784] ? __pfx_worker_thread+0x10/0x10 [ 6.120788] kthread+0xf7/0x130 [ 6.120792] ? __pfx_kthread+0x10/0x10 [ 6.120795] ret_from_fork+0x29/0x50 [ 6.120804] </TASK> ... Fix this by adding the condition to validate shift ranges. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Cc: stable@vger.kernel.org Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Link: https://lore.kernel.org/r/20230707065722.9036-3-Basavaraj.Natikar@amd.com Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
* HID: amd_sfh: Rename the float32 variableBasavaraj Natikar2023-07-101-6/+6
| | | | | | | | | | | | As float32 is also used in other places as a data type, it is necessary to rename the float32 variable in order to avoid confusion. Cc: stable@vger.kernel.org Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Link: https://lore.kernel.org/r/20230707065722.9036-2-Basavaraj.Natikar@amd.com Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
* HID: amd_sfh: Split sensor and HID initialization for SFH1.1Basavaraj Natikar2023-05-231-5/+5
| | | | | | | | | | Sensors are enabled independently of HID device initialization. Sensor initialization should be kept separate in this case, while HID devices should be initialized according to the sensor state. Hence split sensor initialization and HID initialization for SFH1.1 into separate blocks. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Remove duplicate cleanup for SFH1.1Basavaraj Natikar2023-05-231-13/+1
| | | | | | | | A duplicate cleanup is performed that is not necessary. As a result, remove duplicate cleanup and use common cleanup. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Split sensor and HID initializationBasavaraj Natikar2023-05-231-6/+10
| | | | | | | | | | Sensors are enabled independently of HID device initialization. Sensor initialization should be kept separate in this case, while HID devices should be initialized according to the sensor state. Hence split sensor initialization and HID initialization into separate blocks. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Remove duplicate cleanupBasavaraj Natikar2023-05-231-23/+4
| | | | | | | | A number of duplicate cleanups are performed that are not necessary. As a result, remove duplicate cleanups and use common cleanup. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Remove unnecessary logBasavaraj Natikar2023-05-231-4/+0
| | | | | | | | There is a duplicate log message that is not necessary. Hence remove unnecessary log message. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Fix max supported HID devicesBasavaraj Natikar2023-04-251-1/+1
| | | | | | | | | | | | | | | | | commit 4bd763568dbd ("HID: amd_sfh: Support for additional light sensor") adds additional sensor devices, but forgets to add the number of HID devices to match. Thus, the number of HID devices does not match the actual number of sensors. In order to prevent corruption and system hangs when more than the allowed number of HID devices are accessed, the number of HID devices is increased accordingly. Fixes: 4bd763568dbd ("HID: amd_sfh: Support for additional light sensor") Link: https://bugzilla.kernel.org/show_bug.cgi?id=217354 Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Link: https://lore.kernel.org/r/20230424160406.2579888-1-Basavaraj.Natikar@amd.com Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* HID: amd_sfh: Support for additional light sensorBasavaraj Natikar2023-04-134-0/+10
| | | | | | | | There is support for additional light sensors in the SFH firmware. As a result, add support for additional light sensors. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Handle "no sensors" enabled for SFH1.1Basavaraj Natikar2023-04-131-0/+11
| | | | | | | | | | | Based on num_hid_devices, each sensor device is initialized. If "no sensors" is initialized, amd_sfh work initialization and scheduling doesn’t make sense and returns EOPNOTSUPP to stop driver probe. Hence, add a check for "no sensors" enabled to handle the special case. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Increase sensor command timeout for SFH1.1Basavaraj Natikar2023-04-131-2/+2
| | | | | | | | | | The initialization of SFH1.1 sensors may take some time. Hence, increase sensor command timeouts in order to obtain status responses within a maximum timeout. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Correct the stop all commandBasavaraj Natikar2023-04-131-1/+3
| | | | | | | | | | Misinterpreted the stop all command in SHF1.1 firmware. Therefore, it is necessary to update the stop all command accordingly to disable all sensors. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Add support for shutdown operationBasavaraj Natikar2023-04-131-0/+9
| | | | | | | | | | As soon as the system is booted after shutdown, the sensors may remain in a weird state and fail to initialize. Therefore, all sensors should be turned off during shutdown. Fixes: 4f567b9f8141 ("SFH: PCIe driver to add support of AMD sensor fusion hub") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Fix illuminance valueBasavaraj Natikar2023-04-132-2/+2
| | | | | | | | | | Illuminance value is actually 32 bits, but is incorrectly trancated to 16 bits. Hence convert to integer illuminace accordingly to reflect correct values. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Correct the sensor enable and disable commandBasavaraj Natikar2023-04-131-0/+2
| | | | | | | | | | In order to start or stop sensors, the firmware command needs to be changed to add an additional default subcommand value. For this reason, add a subcommand value to enable or disable sensors accordingly. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Correct the structure fieldsBasavaraj Natikar2023-04-131-3/+3
| | | | | | | | | Misinterpreted sfh_cmd_base structure member fields. Therefore, adjust the structure member fields accordingly to reflect functionality. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* Merge branch 'for-6.3/hid-bpf' into for-linusBenjamin Tissoires2023-02-221-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial support of HID-BPF (Benjamin Tissoires) The history is a little long for this series, as it was intended to be sent for v6.2. However some last minute issues forced us to postpone it to v6.3. Conflicts: * drivers/hid/i2c-hid/Kconfig: commit bf7660dab30d ("HID: stop drivers from selecting CONFIG_HID") conflicts with commit 2afac81dd165 ("HID: fix I2C_HID not selected when I2C_HID_OF_ELAN is") the resolution is simple enough: just drop the "default" and "select" lines as the new commit from Arnd is doing
| * HID: stop drivers from selecting CONFIG_HIDArnd Bergmann2023-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a mix of drivers using either 'depends on HID' or 'select HID', which causes both circular dependencies and missed dependencies for a 'select': WARNING: unment direct dependencies for HID Depends on [m]: HID_SUPPORT [=y] && INPUT [=m] Selected by [y]: - AMD_SFH_HID [=y] && HID_SUPPORT [=y] && (X86_64 || COMPILE_TEST [=y]) && PCI [=y] Selected by [m]: - I2C_HID_CORE [=m] && HID_SUPPORT [=y] WARNING: unmet direct dependencies detected for INPUT_FF_MEMLESS Depends on [m]: INPUT [=m] Selected by [y]: - DRAGONRISE_FF [=y] && HID_SUPPORT [=y] && HID [=y] && HID_DRAGONRISE [=y] - HID_MICROSOFT [=y] && HID_SUPPORT [=y] && HID [=y] - GREENASIA_FF [=y] && HID_SUPPORT [=y] && HID [=y] && HID_GREENASIA [=y] Selected by [m]: - INPUT_ARIZONA_HAPTICS [=m] && INPUT [=m] && INPUT_MISC [=y] && MFD_ARIZONA [=y] && SND_SOC [=m] - INPUT_PM8XXX_VIBRATOR [=m] && INPUT [=m] && INPUT_MISC [=y] && (MFD_PM8XXX [=m] || MFD_SPMI_PMIC [=n]) - INPUT_MAX8997_HAPTIC [=m] && INPUT [=m] && INPUT_MISC [=y] && PWM [=y] && MFD_MAX8997 [=y] - INPUT_GPIO_VIBRA [=m] && INPUT [=m] && INPUT_MISC [=y] && (GPIOLIB [=y] || COMPILE_TEST [=y]) - INPUT_REGULATOR_HAPTIC [=m] && INPUT [=m] && INPUT_MISC [=y] && REGULATOR [=y] - INPUT_TWL6040_VIBRA [=m] && INPUT [=m] && INPUT_MISC [=y] && TWL6040_CORE [=y] - INPUT_PWM_VIBRA [=m] && INPUT [=m] && INPUT_MISC [=y] && PWM [=y] - INPUT_DRV260X_HAPTICS [=m] && INPUT_MISC [=y] && INPUT [=m] && I2C [=y] && (GPIOLIB [=y] || COMPILE_TEST [=y]) - INPUT_DRV2665_HAPTICS [=m] && INPUT_MISC [=y] && INPUT [=m] && I2C [=y] - INPUT_DRV2667_HAPTICS [=m] && INPUT_MISC [=y] && INPUT [=m] && I2C [=y] - INPUT_SC27XX_VIBRA [=m] && INPUT [=m] && INPUT_MISC [=y] && (MFD_SC27XX_PMIC [=y] || COMPILE_TEST [=y]) - HID_MAYFLASH [=m] && HID_SUPPORT [=y] && HID [=y] Avoid this by changing all HID client drivers to use 'depends on HID'. For I2C_HID, this requires a larger rework of the Kconfig description, but it hopefully becomes easier to understand without the complex I2C_HID_CORE definition. Fixes: 25621bcc8976 ("HID: Kconfig: split HID support and hid-core compilation") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: Kconfig: split HID support and hid-core compilationBenjamin Tissoires2022-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we step into drivers/hid/ based on the value of CONFIG_HID. However, that value is a tristate, meaning that it can be a module. As per the documentation, if we jump into the subdirectory by following an obj-m, we can not compile anything inside that subdirectory in vmlinux. It is considered as a bug. To make things more friendly to HID-BPF, split HID (the HID core parameter) from HID_SUPPORT (do we want any kind of HID support in the system?), and make this new config a boolean. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | Merge branch 'for-6.3/hid-core' into for-linusBenjamin Tissoires2023-02-221-1/+1
|\ \ | | | | | | | | | | | | | | | | | | - constify hid_ll_driver (Thomas Weißschuh) - map standard Battery System Charging to upower (José Expósito) - couple of assorted fixes and new handling of HID usages (Jingyuan Liang & Ronald Tschalär)
| * | HID: amd_sfh: Constify lowlevel HID driverThomas Weißschuh2023-02-061-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | Since commit 52d225346904 ("HID: Make lowlevel driver structs const") the lowlevel HID drivers are only exposed as const. Take advantage of this to constify the underlying structure, too. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230130-hid-const-ll-driver-v1-1-3fc282b3b1d0@weissschuh.net Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* | HID: amd_sfh: if no sensors are enabled, clean upMario Limonciello2023-02-062-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was reported that commit b300667b33b2 ("HID: amd_sfh: Disable the interrupt for all command") had caused increased resume time on HP Envy x360. Before this commit 3 sensors were reported, but they were not actually functional. After this commit the sensors are no longer reported, but also the resume time increased. To avoid this problem explicitly look for the number of disabled sensors. If all the sensors are disabled, clean everything up. Fixes: b300667b33b2 ("HID: amd_sfh: Disable the interrupt for all command") Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2115 Reported-by: Xaver Hugl <xaver.hugl@gmail.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Link: https://lore.kernel.org/r/20230203220850.13924-1-mario.limonciello@amd.com Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* | HID: amd_sfh: Fix warning unwind gotoBasavaraj Natikar2023-01-062-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Return directly instead of using existing goto will not cleanup previously allocated resources. Hence replace return with goto to fix warning unwind goto which cleanups previously allocated resources. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: amd_sfh: Add missing check for dma_alloc_coherentJiasheng Jiang2022-12-201-0/+4
|/ | | | | | | | | | | Add check for the return value of the dma_alloc_coherent since it may return NULL pointer if allocation fails. Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20221220024921.21992-1-jiasheng@iscas.ac.cn
* HID: amd_sfh: Handle condition of "no sensors" for SFH1.1Basavaraj Natikar2022-09-301-0/+2
| | | | | | | | | | | | Based on num_hid_devices, each sensor device registers to HID. If "no sensors" then amd_sfh work initialization and scheduling doesn’t make sense and return ENODEV to stop driver probe. Hence add a check for num_hid_devices to handle special case in the situation of "no sensors" for SFH1.1. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Change dev_err to dev_dbg for additional debug infoBasavaraj Natikar2022-09-301-3/+3
| | | | | | | | | | | Users should only be notified at most one time on systems doesn't have any sensors connected or non-supported systems. Check the return code and don't display error messages in those conditions. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: AMD_SFH: Add a DMI quirk entry for ChromebooksAkihiko Odaki2022-08-251-0/+18
| | | | | | | | | | | | | | Google Chromebooks use Chrome OS Embedded Controller Sensor Hub instead of Sensor Hub Fusion and leaves MP2 uninitialized, which disables all functionalities, even including the registers necessary for feature detections. The behavior was observed with Lenovo ThinkPad C13 Yoga. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Suggested-by: Mario Limonciello <mario.limonciello@amd.com> Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* Merge branch 'for-5.20/amd-sfh' into for-linusJiri Kosina2022-08-0214-143/+1103
|\ | | | | | | - support for AMD SOCs using SFH1.1 memory access (Basavaraj Natikar)
| * HID: amd_sfh: Handle condition of "no sensors"Basavaraj Natikar2022-07-231-0/+2
| | | | | | | | | | | | | | | | | | Add a check for num_hid_devices to handle special case the situation of "no sensors". Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Fix implicit declaration error on i386Basavaraj Natikar2022-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | Add depended header file to fix error on i386 due to implicit declaration of function ‘writeq’. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Implement SFH1.1 functionalityBasavaraj Natikar2022-07-218-0/+895
| | | | | | | | | | | | | | | | | | | | Newer AMD SOCs use SFH1.1 memory access with new PCI-id. Hence add new sfh1_1 sub directory to implement SFH1.1 functionality by defining new PCI id, interface functions, descriptor functions and handlers which invokes sfh1.1. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Move interrupt handling to common interfaceBasavaraj Natikar2022-07-213-8/+10
| | | | | | | | | | | | | | | | Interrupt handling can be used in multiple files to support all AMD SOCs. Hence move interrupt handling to common interface. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Move amd_sfh_work to common interfaceBasavaraj Natikar2022-07-212-2/+4
| | | | | | | | | | | | | | | | amd_sfh_work can be used in multiple files to support all AMD SOCs. Hence move amd_sfh_work to common interface. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Move global functions to staticBasavaraj Natikar2022-07-213-12/+5
| | | | | | | | | | | | | | | | Move global functions declared from header files and make them as static functions wherever applicable. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Add remove operation in amd_mp2_opsBasavaraj Natikar2022-07-212-1/+4
| | | | | | | | | | | | | | | | Add remove operation as part of amd_mp2_ops structure to support all AMD SOCs and use wherever applicable. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Add PM operations in amd_mp2_opsBasavaraj Natikar2022-07-213-39/+58
| | | | | | | | | | | | | | | | Add PM operations as part of amd_mp2_ops structure to support all AMD SOCs and use wherever applicable. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Add descriptor operations in amd_mp2_opsBasavaraj Natikar2022-07-217-25/+42
| | | | | | | | | | | | | | | | Add dynamic descriptor operations as part of amd_mp2_ops structure to support all AMD SOCs and use wherever applicable. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Move request_list variable to client dataBasavaraj Natikar2022-07-212-5/+8
| | | | | | | | | | | | | | | | request_list variable can be used in multiple files to support all AMD SOCs. Hence move request_list variable to client data. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Move request_list struct to header fileBasavaraj Natikar2022-07-212-10/+9
| | | | | | | | | | | | | | | | request_list structure can be used in multiple files to support all AMD SOCs. Hence move request_list structure to header file. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Move common macros and structuresBasavaraj Natikar2022-07-212-41/+60
| | | | | | | | | | | | | | | | Introduce common macros and structures to support multiple generations of AMD SOCs, move them to amd_sfh_common.h. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: amd_sfh: Add NULL check for hid deviceBasavaraj Natikar2022-07-211-4/+8
| | | | | | | | | | | | | | | | | | On removal of hid device during SFH set report may cause NULL pointer exception. Hence add NULL check for hid device before accessing. Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: amd_sfh: Don't show client init failed as error when discovery failsMario Limonciello2022-05-271-1/+2
|/ | | | | | | | | | | | | | | | When sensor discovery fails, this means that the system doesn't have any sensors connected and a user should only be notified at most one time. A message is already displayed at WARN level of "failed to discover, sensors not enabled". It's pointless to show that the client init failed at ERR level for the same condition. Check the return code and don't display this message in those conditions. Fixes: b5d7f43e97da ("HID: amd_sfh: Add support for sensor discovery") Reported-by: David Chang <David.Chang@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Move bus declaration outside of amd-sfhBasavaraj Natikar2022-05-111-1/+0
| | | | | | | | | This should allow external drivers to reference this bus ID reservation and detect data coming from amd-sfh. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Add physical location to HID deviceBasavaraj Natikar2022-05-111-0/+5
| | | | | | | | | | | | | | | | when HID device is loaded a wrong string is shown as physical location is not declared. ``` hid-generic 0020:1022:0001.0009: hidraw4: <UNKNOWN> HID v0.00 Device [hid-amdtp 1022:0001] on ``` Hence use amd sfh driver name or device name which is connected to the HID device. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Modify the hid nameBasavaraj Natikar2022-05-111-1/+1
| | | | | | | | | Modifying the amd-sfh hid name to meaningful name. Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: amd_sfh: Modify the bus nameBasavaraj Natikar2022-05-112-2/+2
| | | | | | | | | Modifying the amd-sfh bus name to meaningful name. Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>