File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -227,6 +227,17 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
227227 dev_dbg (dev , "sid 0x%x status 0x%x\n" ,
228228 cl_data -> sensor_idx [i ], cl_data -> sensor_sts [i ]);
229229 }
230+ if (privdata -> mp2_ops -> discovery_status &&
231+ privdata -> mp2_ops -> discovery_status (privdata ) == 0 ) {
232+ amd_sfh_hid_client_deinit (privdata );
233+ for (i = 0 ; i < cl_data -> num_hid_devices ; i ++ ) {
234+ devm_kfree (dev , cl_data -> feature_report [i ]);
235+ devm_kfree (dev , in_data -> input_report [i ]);
236+ devm_kfree (dev , cl_data -> report_descr [i ]);
237+ }
238+ dev_warn (dev , "Failed to discover, sensors not enabled\n" );
239+ return - EOPNOTSUPP ;
240+ }
230241 schedule_delayed_work (& cl_data -> work_buffer , msecs_to_jiffies (AMD_SFH_IDLE_LOOP ));
231242 return 0 ;
232243
Original file line number Diff line number Diff line change @@ -130,6 +130,12 @@ static int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata)
130130 return 0 ;
131131}
132132
133+ static int amd_sfh_dis_sts_v2 (struct amd_mp2_dev * privdata )
134+ {
135+ return (readl (privdata -> mmio + AMD_P2C_MSG (1 )) &
136+ SENSOR_DISCOVERY_STATUS_MASK ) >> SENSOR_DISCOVERY_STATUS_SHIFT ;
137+ }
138+
133139void amd_start_sensor (struct amd_mp2_dev * privdata , struct amd_mp2_sensor_info info )
134140{
135141 union sfh_cmd_param cmd_param ;
@@ -245,6 +251,7 @@ static const struct amd_mp2_ops amd_sfh_ops_v2 = {
245251 .response = amd_sfh_wait_response_v2 ,
246252 .clear_intr = amd_sfh_clear_intr_v2 ,
247253 .init_intr = amd_sfh_irq_init_v2 ,
254+ .discovery_status = amd_sfh_dis_sts_v2 ,
248255};
249256
250257static const struct amd_mp2_ops amd_sfh_ops = {
Original file line number Diff line number Diff line change 3939
4040#define AMD_SFH_IDLE_LOOP 200
4141
42+ #define SENSOR_DISCOVERY_STATUS_MASK GENMASK(5, 3)
43+ #define SENSOR_DISCOVERY_STATUS_SHIFT 3
44+
4245/* SFH Command register */
4346union sfh_cmd_base {
4447 u32 ul ;
@@ -143,5 +146,6 @@ struct amd_mp2_ops {
143146 int (* response )(struct amd_mp2_dev * mp2 , u8 sid , u32 sensor_sts );
144147 void (* clear_intr )(struct amd_mp2_dev * privdata );
145148 int (* init_intr )(struct amd_mp2_dev * privdata );
149+ int (* discovery_status )(struct amd_mp2_dev * privdata );
146150};
147151#endif
You can’t perform that action at this time.
0 commit comments