@@ -8,6 +8,7 @@ obj-$(CONFIG_AMD_SFH_HID) += amd_sfh.o
amd_sfh-objs := amd_sfh_hid.o
amd_sfh-objs += amd_sfh_client.o
amd_sfh-objs += amd_sfh_pcie.o
+amd_sfh-objs += amd_sfh_quirks.o
amd_sfh-objs += hid_descriptor/amd_sfh_hid_desc.o
ccflags-y += -I $(srctree)/$(src)/
@@ -74,6 +74,9 @@ int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id)
privdata->activecontrolstatus = readl(privdata->mmio + AMD_P2C_MSG3);
activestatus = privdata->activecontrolstatus >> 4;
+ if (!activestatus)
+ activestatus = amd_sfh_quirks_get_sensor_mask(privdata->pdev);
+
if (ACCEL_MASK & activestatus)
sensor_id[num_of_sensors++] = accel_idx;
@@ -90,4 +90,5 @@ void amd_stop_all_sensors(struct amd_mp2_dev *privdata);
int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id);
int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata);
int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata);
+int amd_sfh_quirks_get_sensor_mask(struct pci_dev *pci_dev);
#endif
new file mode 100644
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+/*
+ * AMD Sensor Fusion Hub quirks
+ *
+ * Authors: Richard Neumann <mail@richard-neumann.de>
+ */
+
+#include <linux/dmi.h>
+#include <linux/pci.h>
+
+#include "amd_sfh_pcie.h"
+
+/**
+ * DMI match for HP ENVY x360 convertibles, which do not
+ * have information about the sensor mask in the P2C registers.
+ */
+static const struct dmi_system_id hp_envy_x360[] = {
+ {
+ .ident = "HP ENVY x360 Convertible 13-ag0xxx",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP"),
+ DMI_MATCH(DMI_BOARD_NAME, "8496"),
+ DMI_MATCH(DMI_BOARD_VERSION, "92.48"),
+ },
+ },
+ {
+ .ident = "HP ENVY x360 Convertible 15-cp0xxx",
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
+ DMI_MATCH(DMI_BOARD_NAME, "8497"),
+ DMI_MATCH(DMI_BOARD_VERSION, "92.48"),
+ },
+ },
+ { }
+};
+
+/**
+ * Returns the sensor mask for hardware, on which the
+ * sensor mask is not written into the P2C registers.
+ *
+ * Returns an appropriate sensor mask or zero per default.
+ */
+int amd_sfh_quirks_get_sensor_mask(struct pci_dev *pci_dev)
+{
+ const struct dmi_system_id *system;
+
+ system = dmi_first_match(hp_envy_x360);
+ if (system) {
+ pci_info(pci_dev, "Detected %s.\n", system->ident);
+ return ACCEL_MASK + MAGNO_MASK;
+ }
+
+ pci_warn(pci_dev, "No quirks available for this hardware.\n");
+ return 0;
+}