i2c_get_clientdata和to_i2c_client 的使用获取平台设备



struct mxt224_data {
struct i2c_client *client;
struct input_dev *input_dev;
struct early_suspend early_suspend;
u8 family_id;
u32 finger_mask;
int gpio_read_done;
struct object_t *objects;
u8 objects_len;
u8 tsp_version;
const u8 *power_cfg;
const u8 *noise_suppression_cfg_ta;
const u8 *noise_suppression_cfg;
const u8 *noise_suppression_cfg_t46_ta;
const u8 *noise_suppression_cfg_t46;


u8 finger_type;
u16 msg_proc;
u16 cmd_proc;
u16 msg_object_size;
u32 x_dropbits:2;
u32 y_dropbits:2;
void (*power_on)(void);
void (*power_off)(void);
//void (*register_cb)(void*);
void (*read_ta_status)(void*);
int num_fingers;
struct finger_info fingers[MXT224_MAX_MT_FINGERS];
struct timer_list autocal_timer;
};

static struct workqueue_struct *cal_check_wq;
static struct work_struct cal_check_work;


#define CLEAR_MEDIAN_FILTER_ERROR


#ifdef CLEAR_MEDIAN_FILTER_ERROR
typedef enum
{
ERR_RTN_CONDITION_T9,
ERR_RTN_CONDITION_T48,
ERR_RTN_CONDITION_IDLE,
ERR_RTN_CONDITION_MAX
}ERR_RTN_CONTIOIN;


ERR_RTN_CONTIOIN gErrCondition = ERR_RTN_CONDITION_IDLE;


static t48_median_config_t noise_median = {0}; //110927 gumi noise


#endif


struct mxt224_data *copy_data;
extern struct class *sec_class;


static int mxt224_suspend(struct device *dev)

{
struct i2c_client *client = to_i2c_client(dev);    从dev 获取 i2c client .  
struct mxt224_data *data = i2c_get_clientdata(client);   从i2c client 获取平台设备 data


    //cal_check_work_queue
    int ret;
    ret = cancel_work_sync(&cal_check_work);




mxt224_enabled = 0;
touch_is_pressed = 0;
Doing_calibration_falg = 0;
return mxt224_internal_suspend(data);
}

你可能感兴趣的:(i2c_get_clientdata和to_i2c_client 的使用获取平台设备)