Lines Matching full:bt541
193 static int zinitix_init_touch(struct bt541_ts_data *bt541) in zinitix_init_touch() argument
195 struct i2c_client *client = bt541->client; in zinitix_init_touch()
214 bt541->prop.max_x); in zinitix_init_touch()
219 bt541->prop.max_y); in zinitix_init_touch()
229 bt541->zinitix_mode); in zinitix_init_touch()
234 bt541->zinitix_mode); in zinitix_init_touch()
253 static int zinitix_init_regulators(struct bt541_ts_data *bt541) in zinitix_init_regulators() argument
255 struct i2c_client *client = bt541->client; in zinitix_init_regulators()
258 bt541->supplies[0].supply = "vdd"; in zinitix_init_regulators()
259 bt541->supplies[1].supply = "vddo"; in zinitix_init_regulators()
261 ARRAY_SIZE(bt541->supplies), in zinitix_init_regulators()
262 bt541->supplies); in zinitix_init_regulators()
271 static int zinitix_send_power_on_sequence(struct bt541_ts_data *bt541) in zinitix_send_power_on_sequence() argument
274 struct i2c_client *client = bt541->client; in zinitix_send_power_on_sequence()
311 static void zinitix_report_finger(struct bt541_ts_data *bt541, int slot, in zinitix_report_finger() argument
318 dev_dbg(&bt541->client->dev, "unknown finger event %#02x\n", in zinitix_report_finger()
326 input_mt_slot(bt541->input_dev, slot); in zinitix_report_finger()
327 if (input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER, in zinitix_report_finger()
329 touchscreen_report_pos(bt541->input_dev, in zinitix_report_finger()
330 &bt541->prop, x, y, true); in zinitix_report_finger()
331 input_report_abs(bt541->input_dev, in zinitix_report_finger()
333 dev_dbg(&bt541->client->dev, "finger %d %s (%u, %u)\n", in zinitix_report_finger()
337 dev_dbg(&bt541->client->dev, "finger %d up (%u, %u)\n", in zinitix_report_finger()
344 struct bt541_ts_data *bt541 = bt541_handler; in zinitix_ts_irq_handler() local
345 struct i2c_client *client = bt541->client; in zinitix_ts_irq_handler()
353 error = zinitix_read_data(bt541->client, BT541_POINT_STATUS_REG, in zinitix_ts_irq_handler()
366 zinitix_report_finger(bt541, i, p); in zinitix_ts_irq_handler()
369 input_mt_sync_frame(bt541->input_dev); in zinitix_ts_irq_handler()
370 input_sync(bt541->input_dev); in zinitix_ts_irq_handler()
373 zinitix_write_cmd(bt541->client, BT541_CLEAR_INT_STATUS_CMD); in zinitix_ts_irq_handler()
377 static int zinitix_start(struct bt541_ts_data *bt541) in zinitix_start() argument
381 error = regulator_bulk_enable(ARRAY_SIZE(bt541->supplies), in zinitix_start()
382 bt541->supplies); in zinitix_start()
384 dev_err(&bt541->client->dev, in zinitix_start()
391 error = zinitix_send_power_on_sequence(bt541); in zinitix_start()
393 dev_err(&bt541->client->dev, in zinitix_start()
398 error = zinitix_init_touch(bt541); in zinitix_start()
400 dev_err(&bt541->client->dev, in zinitix_start()
405 enable_irq(bt541->client->irq); in zinitix_start()
410 static int zinitix_stop(struct bt541_ts_data *bt541) in zinitix_stop() argument
414 disable_irq(bt541->client->irq); in zinitix_stop()
416 error = regulator_bulk_disable(ARRAY_SIZE(bt541->supplies), in zinitix_stop()
417 bt541->supplies); in zinitix_stop()
419 dev_err(&bt541->client->dev, in zinitix_stop()
429 struct bt541_ts_data *bt541 = input_get_drvdata(dev); in zinitix_input_open() local
431 return zinitix_start(bt541); in zinitix_input_open()
436 struct bt541_ts_data *bt541 = input_get_drvdata(dev); in zinitix_input_close() local
438 zinitix_stop(bt541); in zinitix_input_close()
441 static int zinitix_init_input_dev(struct bt541_ts_data *bt541) in zinitix_init_input_dev() argument
446 input_dev = devm_input_allocate_device(&bt541->client->dev); in zinitix_init_input_dev()
448 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
453 input_set_drvdata(input_dev, bt541); in zinitix_init_input_dev()
454 bt541->input_dev = input_dev; in zinitix_init_input_dev()
467 touchscreen_parse_properties(input_dev, true, &bt541->prop); in zinitix_init_input_dev()
468 if (!bt541->prop.max_x || !bt541->prop.max_y) { in zinitix_init_input_dev()
469 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
477 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
484 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
494 struct bt541_ts_data *bt541; in zinitix_ts_probe() local
503 bt541 = devm_kzalloc(&client->dev, sizeof(*bt541), GFP_KERNEL); in zinitix_ts_probe()
504 if (!bt541) in zinitix_ts_probe()
507 bt541->client = client; in zinitix_ts_probe()
508 i2c_set_clientdata(client, bt541); in zinitix_ts_probe()
510 error = zinitix_init_regulators(bt541); in zinitix_ts_probe()
520 client->name, bt541); in zinitix_ts_probe()
526 error = zinitix_init_input_dev(bt541); in zinitix_ts_probe()
534 &bt541->zinitix_mode); in zinitix_ts_probe()
537 bt541->zinitix_mode = DEFAULT_TOUCH_POINT_MODE; in zinitix_ts_probe()
540 if (bt541->zinitix_mode != 2) { in zinitix_ts_probe()
547 bt541->zinitix_mode); in zinitix_ts_probe()
559 struct bt541_ts_data *bt541 = i2c_get_clientdata(client); in zinitix_suspend() local
561 mutex_lock(&bt541->input_dev->mutex); in zinitix_suspend()
563 if (bt541->input_dev->users) in zinitix_suspend()
564 zinitix_stop(bt541); in zinitix_suspend()
566 mutex_unlock(&bt541->input_dev->mutex); in zinitix_suspend()
574 struct bt541_ts_data *bt541 = i2c_get_clientdata(client); in zinitix_resume() local
577 mutex_lock(&bt541->input_dev->mutex); in zinitix_resume()
579 if (bt541->input_dev->users) in zinitix_resume()
580 ret = zinitix_start(bt541); in zinitix_resume()
582 mutex_unlock(&bt541->input_dev->mutex); in zinitix_resume()
591 { .compatible = "zinitix,bt541" },