static int gsl_ts_read(struct i2c_client *client, u8 addr, u8 *pdata, unsigned int datalen) { int ret = 0; if (datalen > 126) { printk("%s too big datalen = %d!\n", __func__, datalen); return -1; } ret = gsl_read_interface(client,addr,pdata,datalen); return ret; }
static int gsl_test_i2c(struct i2c_client *client) { u8 read_buf[4]= {0}; int ret; int i; for(i=0;i<5;i++){ ret = gsl_read_interface(client,0xfc,read_buf,4); if(ret > 0){ break; } msleep(20); } return (ret<0)?-1:1; }
static int gsl_read_MorePage(struct i2c_client *client,u32 addr,u8 *buf,u32 num) { u8 tmp_buf[4]; int i; int err; u32 temp1=addr; for(i=0;i<num/128;i++){ temp1 = addr+i*0x80; tmp_buf[3]=(u8)((temp1/0x80)>>24); tmp_buf[2]=(u8)((temp1/0x80)>>16); tmp_buf[1]=(u8)((temp1/0x80)>>8); tmp_buf[0]=(u8)((temp1/0x80)); gsl_write_interface(client,0xf0,tmp_buf,4); err = gsl_read_interface(client,temp1%0x80,&buf[i*128],128); } if(i*128 < num){ temp1=addr+i*0x80; tmp_buf[3]=(u8)((temp1/0x80)>>24); tmp_buf[2]=(u8)((temp1/0x80)>>16); tmp_buf[1]=(u8)((temp1/0x80)>>8); tmp_buf[0]=(u8)((temp1/0x80)); gsl_write_interface(client,0xf0,tmp_buf,4); err=gsl_read_interface(client,temp1%0x80,&buf[i*128],(num-i*0x80)); }
static void check_mem_data(void) { u8 buf[4] = {0}; delay_ms(30); gsl_read_interface(0xb0,read_buf,4); }