summaryrefslogtreecommitdiffstats
path: root/drivers/hid/amd-sfh-hid
AgeCommit message (Collapse)AuthorFilesLines
2021-03-08AMD_SFH: Add DMI quirk table for BIOS-es which don't set the activestatus bitsHans de Goede1-0/+24
Some BIOS-es do not initialize the activestatus bits of the AMD_P2C_MSG3 register. This cause the AMD_SFH driver to not register any sensors even though the laptops in question do have sensors. Add a DMI quirk-table for specifying sensor-mask overrides based on DMI match, to make the sensors work OOTB on these laptop models. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199715 BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1651886 Fixes: 4f567b9f8141 ("SFH: PCIe driver to add support of AMD sensor fusion hub") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Sandeep Singh <sandeep.singh@amd.com Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-03-08AMD_SFH: Add sensor_mask module parameterHans de Goede1-3/+11
Add a sensor_mask module parameter which can be used to override the sensor-mask read from the activestatus bits of the AMD_P2C_MSG3 registers. Some BIOS-es do not program the activestatus bits, leading to the AMD-SFH driver not registering any HID devices even though the laptop in question does actually have sensors. While at it also fix the wrong indentation of the MAGNO_EN define. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199715 BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1651886 Fixes: 4f567b9f8141 ("SFH: PCIe driver to add support of AMD sensor fusion hub") Suggested-by: Richard Neumann <mail@richard-neumann.de> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Sandeep Singh <sandeep.singh@amd.com Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-03-08AMD_SFH: Removed unused activecontrolstatus member from the amd_mp2_dev structHans de Goede2-3/+4
This value is only used once inside amd_mp2_get_sensor_num(), so there is no need to store this in the amd_mp2_dev struct, amd_mp2_get_sensor_num() can simple use a local variable for this. Fixes: 4f567b9f8141 ("SFH: PCIe driver to add support of AMD sensor fusion hub") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Sandeep Singh <sandeep.singh@amd.com Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-01-04HID: sfh: fix address space confusionArnd Bergmann4-7/+7
The new driver uses a phys_addr_t to store a DMA address, which does not work when the two are different size: drivers/hid/amd-sfh-hid/amd_sfh_client.c:157:11: error: incompatible pointer types passing 'phys_addr_t *' (aka 'unsigned int *') to parameter of type 'dma_addr_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types] &cl_data->sensor_phys_addr[i], ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/dma-mapping.h:393:15: note: passing argument to parameter 'dma_handle' here dma_addr_t *dma_handle, gfp_t gfp) ^ Change both the type and the variable name to dma_addr for consistency. Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-11-12SFH: fix error return check for -ERESTARTSYSColin Ian King1-3/+3
Currently the check for the error return code -ERESTARTSYS is dead code and never executed because a previous check for ret < 0 is catching this and returning -ETIMEDOUT instead. Fix this by checking for -ERESTARTSYS before the more generic negative error code. Addresses-Coverity: ("Logically dead code") Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Sandeep Singh <sandeep.singh@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-10-29AMD_SFH: Fix for incorrect Sensor indexSandeep Singh2-17/+3
It appears like the accelerometer/magnetometer and gyroscope indices were interchanged in the patch series which got into for-5.11/amd-sfh-hid until Mandoli/Richard reported to us. Ideally sensor indices should be 0,1,2 for the accelerometer, Gyroscope, Magnetometer respectively, but this interchanged possibly could be because i was using a test MP2 firmware on my machine. This patch fixes the earlier commit with the right sensor indices and also removing unused structures _hid_report_descriptor, _hid_device_descriptor as reported by Richard. Fixes: 4f567b9f8141 ("SFH: PCIe driver to add support of AMD sensor fusion hub 4f567b9f8141") Reported-by: Mandoli <lipheng@hanmail.net> Reported-by: Richard Neumann <mail@richard-neumann.de> Signed-off-by: Sandeep Singh <sandeep.singh@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-10-22SFH: Create HID report to Enable support of AMD sensor fusion Hub (SFH)Sandeep Singh3-0/+990
Communication between HID devices and HID core is mostly done via HID reports. HID reports are formed based on the data received from the PCI layer into the HID report descriptors. Co-developed-by: Nehal Shah <Nehal-bakulchandra.Shah@amd.com> Signed-off-by: Nehal Shah <Nehal-bakulchandra.Shah@amd.com> Signed-off-by: Sandeep Singh <sandeep.singh@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-10-22SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)Sandeep Singh3-0/+487
To support AMD Sensor Fusion Hub (SFH) via the HID client's we need to register the client with the HID framework. Here we mostly address on how to register the client with the framework and define the interfaces for communication. Co-developed-by: Nehal Shah <Nehal-bakulchandra.Shah@amd.com> Signed-off-by: Nehal Shah <Nehal-bakulchandra.Shah@amd.com> Signed-off-by: Sandeep Singh <sandeep.singh@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-10-22SFH: PCIe driver to add support of AMD sensor fusion hubSandeep Singh4-0/+262
AMD SFH (Sensor Fusion Hub) is a solution running on MP2 (which is ARM core connected to x86 for processing sensor data). AMD SFH uses HID over PCI bus to form the HID descriptors and talks to HID clients like the monitor-sensor/iio-proxy. MP2 which is exposed as a PCI device to the x86, uses mailboxes to talk to MP2 firmware to send/receive commands. Co-developed-by: Nehal Shah <Nehal-bakulchandra.Shah@amd.com> Signed-off-by: Nehal Shah <Nehal-bakulchandra.Shah@amd.com> Signed-off-by: Sandeep Singh <sandeep.singh@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>