Skip to content

Commit 077e3e3

Browse files
basuamdJiri Kosina
authored andcommitted
HID: amd_sfh: Handle "no sensors" in PM operations
Resume or suspend each sensor device based on the num_hid_devices. Therefore, add a check to handle the special case where no sensors are present. Fixes: 93ce5e0 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 6856f07 commit 077e3e3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ static void amd_sfh_resume(struct amd_mp2_dev *mp2)
227227
struct amd_mp2_sensor_info info;
228228
int i, status;
229229

230+
if (!cl_data->is_any_sensor_enabled) {
231+
amd_sfh_clear_intr(mp2);
232+
return;
233+
}
234+
230235
for (i = 0; i < cl_data->num_hid_devices; i++) {
231236
if (cl_data->sensor_sts[i] == SENSOR_DISABLED) {
232237
info.sensor_idx = cl_data->sensor_idx[i];
@@ -252,6 +257,11 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2)
252257
struct amdtp_cl_data *cl_data = mp2->cl_data;
253258
int i, status;
254259

260+
if (!cl_data->is_any_sensor_enabled) {
261+
amd_sfh_clear_intr(mp2);
262+
return;
263+
}
264+
255265
for (i = 0; i < cl_data->num_hid_devices; i++) {
256266
if (cl_data->sensor_idx[i] != HPD_IDX &&
257267
cl_data->sensor_sts[i] == SENSOR_ENABLED) {

0 commit comments

Comments
 (0)