Skip to content

Commit 952f7d1

Browse files
jwrdegoedeJiri Kosina
authored andcommitted
AMD_SFH: Add sensor_mask module parameter
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: 4f567b9 ("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>
1 parent a9e54f4 commit 952f7d1

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/hid/amd-sfh-hid/amd_sfh_pcie.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222

2323
#define ACEL_EN BIT(0)
2424
#define GYRO_EN BIT(1)
25-
#define MAGNO_EN BIT(2)
25+
#define MAGNO_EN BIT(2)
2626
#define ALS_EN BIT(19)
2727

28+
static int sensor_mask_override = -1;
29+
module_param_named(sensor_mask, sensor_mask_override, int, 0444);
30+
MODULE_PARM_DESC(sensor_mask, "override the detected sensors mask");
31+
2832
void amd_start_sensor(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info info)
2933
{
3034
union sfh_cmd_param cmd_param;
@@ -78,8 +82,12 @@ int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id)
7882
int activestatus, num_of_sensors = 0;
7983
u32 activecontrolstatus;
8084

81-
activecontrolstatus = readl(privdata->mmio + AMD_P2C_MSG3);
82-
activestatus = activecontrolstatus >> 4;
85+
if (sensor_mask_override >= 0) {
86+
activestatus = sensor_mask_override;
87+
} else {
88+
activecontrolstatus = readl(privdata->mmio + AMD_P2C_MSG3);
89+
activestatus = activecontrolstatus >> 4;
90+
}
8391

8492
if (ACEL_EN & activestatus)
8593
sensor_id[num_of_sensors++] = accel_idx;

0 commit comments

Comments
 (0)