@@ -203,6 +203,7 @@ struct gsl_ts {
203203 int flag_irq_is_disable ;
204204 spinlock_t irq_lock ;
205205 struct tp_device tp ;
206+ struct work_struct download_fw_work ;
206207};
207208
208209#if GSL_DEBUG
@@ -443,22 +444,18 @@ static void clr_reg(struct i2c_client *client)
443444static int init_chip (struct i2c_client * client )
444445{
445446 int rc ;
447+ struct gsl_ts * ts = i2c_get_clientdata (client );
446448
447449 gsl3673_shutdown_low ();
448450 msleep (20 );
449451 gsl3673_shutdown_high ();
450452 msleep (20 );
451453 rc = test_i2c (client );
452454 if (rc < 0 ) {
453- print_info ( "------ GSL3673 test_i2c error------ \n" );
455+ dev_err ( & client -> dev , " GSL3673 test_i2c error! \n" );
454456 return rc ;
455457 }
456- clr_reg (client );
457- reset_chip (client );
458- gsl_load_fw (client );
459- startup_chip (client );
460- reset_chip (client );
461- startup_chip (client );
458+ schedule_work (& ts -> download_fw_work );
462459 return 0 ;
463460}
464461
@@ -515,10 +512,10 @@ static int gsl_config_read_proc(struct seq_file *m, void *v)
515512 gsl_ts_read (gsl_client , gsl_data_proc [0 ], temp_data , 4 );
516513 gsl_ts_read (gsl_client , gsl_data_proc [0 ], temp_data , 4 );
517514 seq_printf (m , "offset : {0x%02x,0x" , gsl_data_proc [0 ]);
518- seq_printf (m , "%02x " , temp_data [3 ]);
519- seq_printf (m , "%02x " , temp_data [2 ]);
520- seq_printf (m , "%02x " , temp_data [1 ]);
521- seq_printf (m , "%02x };\n" , temp_data [0 ]);
515+ seq_printf (m , "%02d " , temp_data [3 ]);
516+ seq_printf (m , "%02d " , temp_data [2 ]);
517+ seq_printf (m , "%02d " , temp_data [1 ]);
518+ seq_printf (m , "%02d };\n" , temp_data [0 ]);
522519 }
523520 }
524521 return 0 ;
@@ -534,7 +531,7 @@ static ssize_t gsl_config_write_proc(struct file *file, const char *buffer,
534531 int tmp1 = 0 ;
535532
536533 if (count > 512 ) {
537- print_info ("size not match [%d:%ld ]\n" , CONFIG_LEN , count );
534+ print_info ("size not match [%d:%zd ]\n" , CONFIG_LEN , count );
538535 return - EFAULT ;
539536 }
540537 path_buf = kzalloc (count , GFP_KERNEL );
@@ -1109,6 +1106,18 @@ static int gsl_ts_late_resume(struct tp_device *tp_d)
11091106 return rc ;
11101107}
11111108
1109+ static void gsl_download_fw_work (struct work_struct * work )
1110+ {
1111+ struct gsl_ts * ts = container_of (work , struct gsl_ts , download_fw_work );
1112+
1113+ clr_reg (ts -> client );
1114+ reset_chip (ts -> client );
1115+ gsl_load_fw (ts -> client );
1116+ startup_chip (ts -> client );
1117+ reset_chip (ts -> client );
1118+ startup_chip (ts -> client );
1119+ }
1120+
11121121static int gsl_ts_probe (struct i2c_client * client ,
11131122 const struct i2c_device_id * id )
11141123{
@@ -1141,12 +1150,12 @@ static int gsl_ts_probe(struct i2c_client *client,
11411150#ifdef GSLX680_COMPATIBLE
11421151 judge_chip_type (client );
11431152#endif
1153+ INIT_WORK (& ts -> download_fw_work , gsl_download_fw_work );
11441154 rc = init_chip (ts -> client );
11451155 if (rc < 0 ) {
11461156 dev_err (& client -> dev , "gsl_probe: init_chip failed\n" );
11471157 goto error_init_chip_fail ;
11481158 }
1149- check_mem_data (ts -> client );
11501159 spin_lock_init (& ts -> irq_lock );
11511160 client -> irq = gpio_to_irq (ts -> irq );
11521161 rc = devm_request_irq (& client -> dev , client -> irq , gsl_ts_irq ,
@@ -1167,6 +1176,7 @@ static int gsl_ts_probe(struct i2c_client *client,
11671176#endif
11681177 return 0 ;
11691178error_init_chip_fail :
1179+ cancel_work_sync (& ts -> download_fw_work );
11701180error_mutex_destroy :
11711181 tp_unregister_fb (& ts -> tp );
11721182 return rc ;
@@ -1183,6 +1193,7 @@ static int gsl_ts_remove(struct i2c_client *client)
11831193 device_init_wakeup (& client -> dev , 0 );
11841194 cancel_work_sync (& ts -> work );
11851195 destroy_workqueue (ts -> wq );
1196+ cancel_work_sync (& ts -> download_fw_work );
11861197 return 0 ;
11871198}
11881199
0 commit comments