Lines Matching refs:lp
46 static short read_state(struct kp_data *lp)
50 i2c_smbus_write_byte(lp->client, 240);
51 x = 0xF & (~(i2c_smbus_read_byte(lp->client) >> 4));
53 i2c_smbus_write_byte(lp->client, 15);
54 y = 0xF & (~i2c_smbus_read_byte(lp->client));
66 struct kp_data *lp = dev_id;
67 unsigned char nextstate = read_state(lp);
69 if (lp->laststate != nextstate) {
70 int key_down = nextstate < ARRAY_SIZE(lp->btncode);
72 lp->btncode[nextstate] : lp->btncode[lp->laststate];
74 input_report_key(lp->idev, keycode, key_down);
75 input_sync(lp->idev);
77 lp->laststate = nextstate;
87 struct kp_data *lp;
94 lp = kzalloc(sizeof(*lp), GFP_KERNEL);
95 if (!lp)
105 lp->idev = idev;
106 lp->client = client;
109 idev->keycode = lp->btncode;
110 idev->keycodesize = sizeof(lp->btncode[0]);
111 idev->keycodemax = ARRAY_SIZE(lp->btncode);
114 if (lp->btncode[i] <= KEY_MAX) {
115 lp->btncode[i] = pcf8574_kp_btncode[i];
116 __set_bit(lp->btncode[i], idev->keybit);
121 sprintf(lp->name, DRV_NAME);
122 sprintf(lp->phys, "kp_data/input0");
124 idev->name = lp->name;
125 idev->phys = lp->phys;
131 lp->laststate = read_state(lp);
135 DRV_NAME, lp);
147 i2c_set_clientdata(client, lp);
151 free_irq(client->irq, lp);
155 kfree(lp);
162 struct kp_data *lp = i2c_get_clientdata(client);
164 free_irq(client->irq, lp);
166 input_unregister_device(lp->idev);
167 kfree(lp);