summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorBasavaraj Natikar <Basavaraj.Natikar@amd.com>2021-08-02 19:33:39 +0530
committerJiri Kosina <jkosina@suse.cz>2021-08-20 14:48:49 +0200
commitac15e9196f35d88b4d94bbcf3a5294ebb5622eb0 (patch)
treed763158b4c2f19b57d4ee040c0878dd197bca5d9 /drivers/hid
parent173709f50e98df4c49c2776834605a2f7ed3e681 (diff)
downloadlwn-ac15e9196f35d88b4d94bbcf3a5294ebb5622eb0.tar.gz
lwn-ac15e9196f35d88b4d94bbcf3a5294ebb5622eb0.zip
HID: amd_sfh: Move hid probe after sensor is enabled
Earlier platforms don’t have sensor status checking mechanism. Sensors are always enabled without checking sensor status. Hence invoke hid probe only after the sensor is enabled by checking sensor status. Reviewed-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/amd-sfh-hid/amd_sfh_client.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
index b7b66a1eb971..4982ccf9dc25 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
@@ -207,14 +207,21 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
rc = get_report_descriptor(cl_idx, cl_data->report_descr[i]);
if (rc)
return rc;
- rc = amdtp_hid_probe(cl_data->cur_hid_dev, cl_data);
- if (rc)
- return rc;
privdata->mp2_ops->start(privdata, info);
status = amd_sfh_wait_for_response
(privdata, cl_data->sensor_idx[i], SENSOR_ENABLED);
- if (status == SENSOR_ENABLED)
+ if (status == SENSOR_ENABLED) {
cl_data->sensor_sts[i] = SENSOR_ENABLED;
+ rc = amdtp_hid_probe(cl_data->cur_hid_dev, cl_data);
+ if (rc) {
+ privdata->mp2_ops->stop(privdata, cl_data->sensor_idx[i]);
+ status = amd_sfh_wait_for_response
+ (privdata, cl_data->sensor_idx[i], SENSOR_DISABLED);
+ if (status != SENSOR_ENABLED)
+ cl_data->sensor_sts[i] = SENSOR_DISABLED;
+ goto cleanup;
+ }
+ }
}
schedule_delayed_work(&cl_data->work_buffer, msecs_to_jiffies(AMD_SFH_IDLE_LOOP));
return 0;