Skip to content

Commit 0cc2eff

Browse files
superm1Jiri Kosina
authored andcommitted
HID: amd_sfh: Fix SRA sensor when it's the only sensor
On systems that only have an SRA sensor connected to SFH the sensor doesn't get enabled due to a bad optimization condition of breaking the sensor walk loop. This optimization is unnecessary in the first place because if there is only one device then the loop only runs once. Drop the condition and explicitly mark sensor as enabled. Reported-by: Yijun Shen <Yijun.Shen@dell.com> Tested-By: Yijun Shen <Yijun_Shen@Dell.com> Fixes: d1c444b ("HID: amd_sfh: Add support to export device operating states") Cc: stable@vger.kernel.org Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 6bf8ab7 commit 0cc2eff

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
134134
for (i = 0; i < cl_data->num_hid_devices; i++) {
135135
cl_data->sensor_sts[i] = SENSOR_DISABLED;
136136

137-
if (cl_data->num_hid_devices == 1 && cl_data->sensor_idx[0] == SRA_IDX)
138-
break;
139-
140137
if (cl_data->sensor_idx[i] == SRA_IDX) {
141138
info.sensor_idx = cl_data->sensor_idx[i];
142139
writel(0, privdata->mmio + amd_get_p2c_val(privdata, 0));
@@ -145,8 +142,10 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
145142
(privdata, cl_data->sensor_idx[i], ENABLE_SENSOR);
146143

147144
cl_data->sensor_sts[i] = (status == 0) ? SENSOR_ENABLED : SENSOR_DISABLED;
148-
if (cl_data->sensor_sts[i] == SENSOR_ENABLED)
145+
if (cl_data->sensor_sts[i] == SENSOR_ENABLED) {
146+
cl_data->is_any_sensor_enabled = true;
149147
privdata->dev_en.is_sra_present = true;
148+
}
150149
continue;
151150
}
152151

0 commit comments

Comments
 (0)