Lines Matching refs:elo

51 struct elo {  struct
65 static void elo_process_data_10(struct elo *elo, unsigned char data) in elo_process_data_10() argument
67 struct input_dev *dev = elo->dev; in elo_process_data_10()
69 elo->data[elo->idx] = data; in elo_process_data_10()
71 switch (elo->idx++) { in elo_process_data_10()
73 elo->csum = 0xaa; in elo_process_data_10()
75 dev_dbg(&elo->serio->dev, in elo_process_data_10()
77 elo->idx = 0; in elo_process_data_10()
82 elo->idx = 0; in elo_process_data_10()
83 if (data != elo->csum) { in elo_process_data_10()
84 dev_dbg(&elo->serio->dev, in elo_process_data_10()
86 data, elo->csum); in elo_process_data_10()
89 if (elo->data[1] != elo->expected_packet) { in elo_process_data_10()
90 if (elo->data[1] != ELO10_TOUCH_PACKET) in elo_process_data_10()
91 dev_dbg(&elo->serio->dev, in elo_process_data_10()
93 elo->data[1]); in elo_process_data_10()
96 if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) { in elo_process_data_10()
97 input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]); in elo_process_data_10()
98 input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]); in elo_process_data_10()
99 if (elo->data[2] & ELO10_PRESSURE) in elo_process_data_10()
101 (elo->data[8] << 8) | elo->data[7]); in elo_process_data_10()
102 input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH); in elo_process_data_10()
104 } else if (elo->data[1] == ELO10_ACK_PACKET) { in elo_process_data_10()
105 if (elo->data[2] == '0') in elo_process_data_10()
106 elo->expected_packet = ELO10_TOUCH_PACKET; in elo_process_data_10()
107 complete(&elo->cmd_done); in elo_process_data_10()
109 memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN); in elo_process_data_10()
110 elo->expected_packet = ELO10_ACK_PACKET; in elo_process_data_10()
114 elo->csum += data; in elo_process_data_10()
117 static void elo_process_data_6(struct elo *elo, unsigned char data) in elo_process_data_6() argument
119 struct input_dev *dev = elo->dev; in elo_process_data_6()
121 elo->data[elo->idx] = data; in elo_process_data_6()
123 switch (elo->idx++) { in elo_process_data_6()
127 elo->idx = 0; in elo_process_data_6()
132 elo->idx = 0; in elo_process_data_6()
137 elo->idx = 0; in elo_process_data_6()
142 elo->idx = 0; in elo_process_data_6()
146 input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f)); in elo_process_data_6()
147 input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f)); in elo_process_data_6()
149 if (elo->id == 2) { in elo_process_data_6()
152 elo->idx = 0; in elo_process_data_6()
160 elo->idx = 0; in elo_process_data_6()
166 input_report_abs(dev, ABS_PRESSURE, elo->data[5]); in elo_process_data_6()
167 input_report_key(dev, BTN_TOUCH, !!elo->data[5]); in elo_process_data_6()
170 elo->idx = 0; in elo_process_data_6()
175 static void elo_process_data_3(struct elo *elo, unsigned char data) in elo_process_data_3() argument
177 struct input_dev *dev = elo->dev; in elo_process_data_3()
179 elo->data[elo->idx] = data; in elo_process_data_3()
181 switch (elo->idx++) { in elo_process_data_3()
185 elo->idx = 0; in elo_process_data_3()
188 input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80)); in elo_process_data_3()
189 input_report_abs(dev, ABS_X, elo->data[1]); in elo_process_data_3()
190 input_report_abs(dev, ABS_Y, elo->data[2]); in elo_process_data_3()
192 elo->idx = 0; in elo_process_data_3()
200 struct elo *elo = serio_get_drvdata(serio); in elo_interrupt() local
202 switch (elo->id) { in elo_interrupt()
204 elo_process_data_10(elo, data); in elo_interrupt()
209 elo_process_data_6(elo, data); in elo_interrupt()
213 elo_process_data_3(elo, data); in elo_interrupt()
220 static int elo_command_10(struct elo *elo, unsigned char *packet) in elo_command_10() argument
226 mutex_lock(&elo->cmd_mutex); in elo_command_10()
228 serio_pause_rx(elo->serio); in elo_command_10()
229 elo->expected_packet = toupper(packet[0]); in elo_command_10()
230 init_completion(&elo->cmd_done); in elo_command_10()
231 serio_continue_rx(elo->serio); in elo_command_10()
233 if (serio_write(elo->serio, ELO10_LEAD_BYTE)) in elo_command_10()
238 if (serio_write(elo->serio, packet[i])) in elo_command_10()
242 if (serio_write(elo->serio, csum)) in elo_command_10()
245 wait_for_completion_timeout(&elo->cmd_done, HZ); in elo_command_10()
247 if (elo->expected_packet == ELO10_TOUCH_PACKET) { in elo_command_10()
249 memcpy(packet, elo->response, ELO10_PACKET_LEN); in elo_command_10()
254 mutex_unlock(&elo->cmd_mutex); in elo_command_10()
258 static int elo_setup_10(struct elo *elo) in elo_setup_10() argument
261 struct input_dev *dev = elo->dev; in elo_setup_10()
264 if (elo_command_10(elo, packet)) in elo_setup_10()
274 dev_info(&elo->serio->dev, in elo_setup_10()
288 struct elo *elo = serio_get_drvdata(serio); in elo_disconnect() local
290 input_get_device(elo->dev); in elo_disconnect()
291 input_unregister_device(elo->dev); in elo_disconnect()
294 input_put_device(elo->dev); in elo_disconnect()
295 kfree(elo); in elo_disconnect()
306 struct elo *elo; in elo_connect() local
310 elo = kzalloc(sizeof(struct elo), GFP_KERNEL); in elo_connect()
312 if (!elo || !input_dev) { in elo_connect()
317 elo->serio = serio; in elo_connect()
318 elo->id = serio->id.id; in elo_connect()
319 elo->dev = input_dev; in elo_connect()
320 elo->expected_packet = ELO10_TOUCH_PACKET; in elo_connect()
321 mutex_init(&elo->cmd_mutex); in elo_connect()
322 init_completion(&elo->cmd_done); in elo_connect()
323 snprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys); in elo_connect()
326 input_dev->phys = elo->phys; in elo_connect()
329 input_dev->id.product = elo->id; in elo_connect()
336 serio_set_drvdata(serio, elo); in elo_connect()
341 switch (elo->id) { in elo_connect()
344 if (elo_setup_10(elo)) { in elo_connect()
366 err = input_register_device(elo->dev); in elo_connect()
375 kfree(elo); in elo_connect()