Lines Matching +full:power +full:- +full:supplies

1 // SPDX-License-Identifier: GPL-2.0-only
147 struct regulator_bulk_data supplies[2]; member
160 return ret < 0 ? ret : -EIO; in zinitix_read_data()
164 return ret < 0 ? ret : -EIO; in zinitix_read_data()
176 return ret < 0 ? ret : -EIO; in zinitix_write_u16()
188 return ret < 0 ? ret : -EIO; in zinitix_write_cmd()
195 struct i2c_client *client = bt541->client; in zinitix_init_touch()
201 dev_err(&client->dev, "Failed to write reset command\n"); in zinitix_init_touch()
207 dev_err(&client->dev, 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()
255 struct device *dev = &bt541->client->dev; in zinitix_init_regulators()
263 if (of_property_present(dev->of_node, "vddo-supply")) { in zinitix_init_regulators()
264 bt541->supplies[0].supply = "vdd"; in zinitix_init_regulators()
265 bt541->supplies[1].supply = "vddo"; in zinitix_init_regulators()
268 bt541->supplies[0].supply = "vcca"; in zinitix_init_regulators()
269 bt541->supplies[1].supply = "vdd"; in zinitix_init_regulators()
272 ARRAY_SIZE(bt541->supplies), in zinitix_init_regulators()
273 bt541->supplies); in zinitix_init_regulators()
285 struct i2c_client *client = bt541->client; in zinitix_send_power_on_sequence()
289 dev_err(&client->dev, in zinitix_send_power_on_sequence()
290 "Failed to send power sequence(vendor cmd enable)\n"); in zinitix_send_power_on_sequence()
297 dev_err(&client->dev, in zinitix_send_power_on_sequence()
298 "Failed to send power sequence (intn clear)\n"); in zinitix_send_power_on_sequence()
305 dev_err(&client->dev, in zinitix_send_power_on_sequence()
306 "Failed to send power sequence (nvm init)\n"); in zinitix_send_power_on_sequence()
313 dev_err(&client->dev, in zinitix_send_power_on_sequence()
314 "Failed to send power sequence (program start)\n"); in zinitix_send_power_on_sequence()
327 if (unlikely(!(p->sub_status & in zinitix_report_finger()
329 dev_dbg(&bt541->client->dev, "unknown finger event %#02x\n", in zinitix_report_finger()
330 p->sub_status); in zinitix_report_finger()
334 x = le16_to_cpu(p->x); in zinitix_report_finger()
335 y = le16_to_cpu(p->y); in zinitix_report_finger()
337 input_mt_slot(bt541->input_dev, slot); in zinitix_report_finger()
338 if (input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER, in zinitix_report_finger()
339 !(p->sub_status & SUB_BIT_UP))) { in zinitix_report_finger()
340 touchscreen_report_pos(bt541->input_dev, in zinitix_report_finger()
341 &bt541->prop, x, y, true); in zinitix_report_finger()
342 input_report_abs(bt541->input_dev, in zinitix_report_finger()
343 ABS_MT_TOUCH_MAJOR, p->width); in zinitix_report_finger()
344 dev_dbg(&bt541->client->dev, "finger %d %s (%u, %u)\n", in zinitix_report_finger()
345 slot, p->sub_status & SUB_BIT_DOWN ? "down" : "move", in zinitix_report_finger()
348 dev_dbg(&bt541->client->dev, "finger %d up (%u, %u)\n", in zinitix_report_finger()
356 struct i2c_client *client = bt541->client; in zinitix_ts_irq_handler()
364 error = zinitix_read_data(bt541->client, ZINITIX_POINT_STATUS_REG, in zinitix_ts_irq_handler()
367 dev_err(&client->dev, "Failed to read in touchpoint struct\n"); in zinitix_ts_irq_handler()
376 if (p->sub_status & SUB_BIT_EXIST) in zinitix_ts_irq_handler()
380 input_mt_sync_frame(bt541->input_dev); in zinitix_ts_irq_handler()
381 input_sync(bt541->input_dev); in zinitix_ts_irq_handler()
384 zinitix_write_cmd(bt541->client, ZINITIX_CLEAR_INT_STATUS_CMD); in zinitix_ts_irq_handler()
392 error = regulator_bulk_enable(ARRAY_SIZE(bt541->supplies), in zinitix_start()
393 bt541->supplies); in zinitix_start()
395 dev_err(&bt541->client->dev, in zinitix_start()
404 dev_err(&bt541->client->dev, in zinitix_start()
405 "Error while sending power-on sequence: %d\n", error); in zinitix_start()
411 dev_err(&bt541->client->dev, in zinitix_start()
416 enable_irq(bt541->client->irq); in zinitix_start()
425 disable_irq(bt541->client->irq); in zinitix_stop()
427 error = regulator_bulk_disable(ARRAY_SIZE(bt541->supplies), in zinitix_stop()
428 bt541->supplies); in zinitix_stop()
430 dev_err(&bt541->client->dev, in zinitix_stop()
457 input_dev = devm_input_allocate_device(&bt541->client->dev); in zinitix_init_input_dev()
459 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
461 return -ENOMEM; in zinitix_init_input_dev()
465 bt541->input_dev = input_dev; in zinitix_init_input_dev()
467 input_dev->name = "Zinitix Capacitive TouchScreen"; in zinitix_init_input_dev()
468 input_dev->phys = "input/ts"; in zinitix_init_input_dev()
469 input_dev->id.bustype = BUS_I2C; in zinitix_init_input_dev()
470 input_dev->open = zinitix_input_open; in zinitix_init_input_dev()
471 input_dev->close = zinitix_input_close; in zinitix_init_input_dev()
478 touchscreen_parse_properties(input_dev, true, &bt541->prop); in zinitix_init_input_dev()
479 if (!bt541->prop.max_x || !bt541->prop.max_y) { in zinitix_init_input_dev()
480 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
481 "Touchscreen-size-x and/or touchscreen-size-y not set in dts\n"); in zinitix_init_input_dev()
482 return -EINVAL; in zinitix_init_input_dev()
488 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
495 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
508 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { in zinitix_ts_probe()
509 dev_err(&client->dev, in zinitix_ts_probe()
511 return -ENXIO; in zinitix_ts_probe()
514 bt541 = devm_kzalloc(&client->dev, sizeof(*bt541), GFP_KERNEL); in zinitix_ts_probe()
516 return -ENOMEM; in zinitix_ts_probe()
518 bt541->client = client; in zinitix_ts_probe()
523 dev_err(&client->dev, in zinitix_ts_probe()
528 error = devm_request_threaded_irq(&client->dev, client->irq, in zinitix_ts_probe()
531 client->name, bt541); in zinitix_ts_probe()
533 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in zinitix_ts_probe()
539 dev_err(&client->dev, in zinitix_ts_probe()
544 error = device_property_read_u32(&client->dev, "zinitix,mode", in zinitix_ts_probe()
545 &bt541->zinitix_mode); in zinitix_ts_probe()
548 bt541->zinitix_mode = DEFAULT_TOUCH_POINT_MODE; in zinitix_ts_probe()
551 if (bt541->zinitix_mode != 2) { in zinitix_ts_probe()
556 dev_err(&client->dev, in zinitix_ts_probe()
558 bt541->zinitix_mode); in zinitix_ts_probe()
559 return -EINVAL; in zinitix_ts_probe()
570 mutex_lock(&bt541->input_dev->mutex); in zinitix_suspend()
572 if (input_device_enabled(bt541->input_dev)) in zinitix_suspend()
575 mutex_unlock(&bt541->input_dev->mutex); in zinitix_suspend()
586 mutex_lock(&bt541->input_dev->mutex); in zinitix_resume()
588 if (input_device_enabled(bt541->input_dev)) in zinitix_resume()
591 mutex_unlock(&bt541->input_dev->mutex); in zinitix_resume()
622 .name = "Zinitix-TS",