| From de0a4a93bb5f0b3e7f10dd83e501041c1c9b69ed Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Thu, 28 Jan 2021 13:12:19 +0100 |
| Subject: AMD_SFH: Add DMI quirk table for BIOS-es which don't set the |
| activestatus bits |
| |
| From: Hans de Goede <hdegoede@redhat.com> |
| |
| [ Upstream commit 25615e454a0ec198254f17d2ed79b607cb755d0e ] |
| |
| 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> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 24 ++++++++++++++++++++++++ |
| 1 file changed, 24 insertions(+) |
| |
| diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c |
| index ab0a9443e252..ddecc84fd6f0 100644 |
| --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c |
| +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c |
| @@ -10,6 +10,7 @@ |
| #include <linux/bitops.h> |
| #include <linux/delay.h> |
| #include <linux/dma-mapping.h> |
| +#include <linux/dmi.h> |
| #include <linux/interrupt.h> |
| #include <linux/io-64-nonatomic-lo-hi.h> |
| #include <linux/module.h> |
| @@ -77,11 +78,34 @@ void amd_stop_all_sensors(struct amd_mp2_dev *privdata) |
| writel(cmd_base.ul, privdata->mmio + AMD_C2P_MSG0); |
| } |
| |
| +static const struct dmi_system_id dmi_sensor_mask_overrides[] = { |
| + { |
| + .matches = { |
| + DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY x360 Convertible 13-ag0xxx"), |
| + }, |
| + .driver_data = (void *)(ACEL_EN | MAGNO_EN), |
| + }, |
| + { |
| + .matches = { |
| + DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY x360 Convertible 15-cp0xxx"), |
| + }, |
| + .driver_data = (void *)(ACEL_EN | MAGNO_EN), |
| + }, |
| + { } |
| +}; |
| + |
| int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id) |
| { |
| int activestatus, num_of_sensors = 0; |
| + const struct dmi_system_id *dmi_id; |
| u32 activecontrolstatus; |
| |
| + if (sensor_mask_override == -1) { |
| + dmi_id = dmi_first_match(dmi_sensor_mask_overrides); |
| + if (dmi_id) |
| + sensor_mask_override = (long)dmi_id->driver_data; |
| + } |
| + |
| if (sensor_mask_override >= 0) { |
| activestatus = sensor_mask_override; |
| } else { |
| -- |
| 2.30.2 |
| |