Lines Matching refs:msg2638
93 static void msg2138_report_keys(struct msg2638_ts_data *msg2638, u8 keys) in msg2138_report_keys() argument
101 for (i = 0; i < msg2638->num_keycodes; ++i) in msg2138_report_keys()
102 input_report_key(msg2638->input_dev, msg2638->keycodes[i], in msg2138_report_keys()
108 struct msg2638_ts_data *msg2638 = msg2638_handler; in msg2138_ts_irq_handler() local
109 struct i2c_client *client = msg2638->client; in msg2138_ts_irq_handler()
110 struct input_dev *input = msg2638->input_dev; in msg2138_ts_irq_handler()
145 msg2138_report_keys(msg2638, p1->x_low); in msg2138_ts_irq_handler()
154 touchscreen_report_pos(input, &msg2638->prop, x, y, true); in msg2138_ts_irq_handler()
173 touchscreen_report_pos(input, &msg2638->prop, x, y, true); in msg2138_ts_irq_handler()
176 input_mt_sync_frame(msg2638->input_dev); in msg2138_ts_irq_handler()
177 input_sync(msg2638->input_dev); in msg2138_ts_irq_handler()
185 struct msg2638_ts_data *msg2638 = msg2638_handler; in msg2638_ts_irq_handler() local
186 struct i2c_client *client = msg2638->client; in msg2638_ts_irq_handler()
187 struct input_dev *input = msg2638->input_dev; in msg2638_ts_irq_handler()
220 for (i = 0; i < msg2638->max_fingers; i++) { in msg2638_ts_irq_handler()
232 touchscreen_report_pos(input, &msg2638->prop, x, y, true); in msg2638_ts_irq_handler()
235 input_mt_sync_frame(msg2638->input_dev); in msg2638_ts_irq_handler()
236 input_sync(msg2638->input_dev); in msg2638_ts_irq_handler()
242 static void msg2638_reset(struct msg2638_ts_data *msg2638) in msg2638_reset() argument
244 gpiod_set_value_cansleep(msg2638->reset_gpiod, 1); in msg2638_reset()
246 gpiod_set_value_cansleep(msg2638->reset_gpiod, 0); in msg2638_reset()
250 static int msg2638_start(struct msg2638_ts_data *msg2638) in msg2638_start() argument
254 error = regulator_bulk_enable(ARRAY_SIZE(msg2638->supplies), in msg2638_start()
255 msg2638->supplies); in msg2638_start()
257 dev_err(&msg2638->client->dev, in msg2638_start()
264 msg2638_reset(msg2638); in msg2638_start()
266 enable_irq(msg2638->client->irq); in msg2638_start()
271 static int msg2638_stop(struct msg2638_ts_data *msg2638) in msg2638_stop() argument
275 disable_irq(msg2638->client->irq); in msg2638_stop()
277 error = regulator_bulk_disable(ARRAY_SIZE(msg2638->supplies), in msg2638_stop()
278 msg2638->supplies); in msg2638_stop()
280 dev_err(&msg2638->client->dev, in msg2638_stop()
290 struct msg2638_ts_data *msg2638 = input_get_drvdata(dev); in msg2638_input_open() local
292 return msg2638_start(msg2638); in msg2638_input_open()
297 struct msg2638_ts_data *msg2638 = input_get_drvdata(dev); in msg2638_input_close() local
299 msg2638_stop(msg2638); in msg2638_input_close()
302 static int msg2638_init_input_dev(struct msg2638_ts_data *msg2638) in msg2638_init_input_dev() argument
304 struct device *dev = &msg2638->client->dev; in msg2638_init_input_dev()
315 input_set_drvdata(input_dev, msg2638); in msg2638_init_input_dev()
316 msg2638->input_dev = input_dev; in msg2638_init_input_dev()
324 if (msg2638->num_keycodes) { in msg2638_init_input_dev()
325 input_dev->keycode = msg2638->keycodes; in msg2638_init_input_dev()
326 input_dev->keycodemax = msg2638->num_keycodes; in msg2638_init_input_dev()
327 input_dev->keycodesize = sizeof(msg2638->keycodes[0]); in msg2638_init_input_dev()
328 for (i = 0; i < msg2638->num_keycodes; i++) in msg2638_init_input_dev()
330 EV_KEY, msg2638->keycodes[i]); in msg2638_init_input_dev()
336 touchscreen_parse_properties(input_dev, true, &msg2638->prop); in msg2638_init_input_dev()
337 if (!msg2638->prop.max_x || !msg2638->prop.max_y) { in msg2638_init_input_dev()
342 error = input_mt_init_slots(input_dev, msg2638->max_fingers, in msg2638_init_input_dev()
362 struct msg2638_ts_data *msg2638; in msg2638_ts_probe() local
370 msg2638 = devm_kzalloc(dev, sizeof(*msg2638), GFP_KERNEL); in msg2638_ts_probe()
371 if (!msg2638) in msg2638_ts_probe()
374 msg2638->client = client; in msg2638_ts_probe()
375 i2c_set_clientdata(client, msg2638); in msg2638_ts_probe()
383 msg2638->max_fingers = chip_data->max_fingers; in msg2638_ts_probe()
385 msg2638->supplies[0].supply = "vdd"; in msg2638_ts_probe()
386 msg2638->supplies[1].supply = "vddio"; in msg2638_ts_probe()
387 error = devm_regulator_bulk_get(dev, ARRAY_SIZE(msg2638->supplies), in msg2638_ts_probe()
388 msg2638->supplies); in msg2638_ts_probe()
394 msg2638->reset_gpiod = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in msg2638_ts_probe()
395 if (IS_ERR(msg2638->reset_gpiod)) { in msg2638_ts_probe()
396 error = PTR_ERR(msg2638->reset_gpiod); in msg2638_ts_probe()
401 msg2638->num_keycodes = device_property_count_u32(dev, in msg2638_ts_probe()
403 if (msg2638->num_keycodes == -EINVAL) { in msg2638_ts_probe()
404 msg2638->num_keycodes = 0; in msg2638_ts_probe()
405 } else if (msg2638->num_keycodes < 0) { in msg2638_ts_probe()
407 msg2638->num_keycodes); in msg2638_ts_probe()
408 return msg2638->num_keycodes; in msg2638_ts_probe()
409 } else if (msg2638->num_keycodes > ARRAY_SIZE(msg2638->keycodes)) { in msg2638_ts_probe()
411 msg2638->num_keycodes, ARRAY_SIZE(msg2638->keycodes)); in msg2638_ts_probe()
412 msg2638->num_keycodes = ARRAY_SIZE(msg2638->keycodes); in msg2638_ts_probe()
415 if (msg2638->num_keycodes > 0) { in msg2638_ts_probe()
417 msg2638->keycodes, in msg2638_ts_probe()
418 msg2638->num_keycodes); in msg2638_ts_probe()
429 client->name, msg2638); in msg2638_ts_probe()
435 error = msg2638_init_input_dev(msg2638); in msg2638_ts_probe()
447 struct msg2638_ts_data *msg2638 = i2c_get_clientdata(client); in msg2638_suspend() local
449 mutex_lock(&msg2638->input_dev->mutex); in msg2638_suspend()
451 if (input_device_enabled(msg2638->input_dev)) in msg2638_suspend()
452 msg2638_stop(msg2638); in msg2638_suspend()
454 mutex_unlock(&msg2638->input_dev->mutex); in msg2638_suspend()
462 struct msg2638_ts_data *msg2638 = i2c_get_clientdata(client); in msg2638_resume() local
465 mutex_lock(&msg2638->input_dev->mutex); in msg2638_resume()
467 if (input_device_enabled(msg2638->input_dev)) in msg2638_resume()
468 ret = msg2638_start(msg2638); in msg2638_resume()
470 mutex_unlock(&msg2638->input_dev->mutex); in msg2638_resume()