Lines Matching +full:vddo +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0-only
179 return ret < 0 ? ret : -EIO; in zinitix_read_data()
183 return ret < 0 ? ret : -EIO; in zinitix_read_data()
195 return ret < 0 ? ret : -EIO; in zinitix_write_u16()
207 return ret < 0 ? ret : -EIO; in zinitix_write_cmd()
214 struct i2c_client *client = bt541->client; in zinitix_get_u16_reg()
227 struct i2c_client *client = bt541->client; in zinitix_init_touch()
234 dev_err(&client->dev, "Failed to write reset command\n"); in zinitix_init_touch()
242 if (!bt541->have_versioninfo) { in zinitix_init_touch()
243 bt541->chip_revision = zinitix_get_u16_reg(bt541, in zinitix_init_touch()
245 bt541->firmware_version = zinitix_get_u16_reg(bt541, in zinitix_init_touch()
247 bt541->regdata_version = zinitix_get_u16_reg(bt541, in zinitix_init_touch()
249 bt541->have_versioninfo = true; in zinitix_init_touch()
251 dev_dbg(&client->dev, in zinitix_init_touch()
253 bt541->chip_revision, bt541->firmware_version, in zinitix_init_touch()
254 bt541->regdata_version); in zinitix_init_touch()
260 switch (bt541->chip_revision & ZINITIX_CHIP_BTX0X_MASK) { in zinitix_init_touch()
262 bt541->icon_status_reg = ZINITIX_BT4X2_ICON_STATUS_REG; in zinitix_init_touch()
266 bt541->icon_status_reg = ZINITIX_BT4X3_ICON_STATUS_REG; in zinitix_init_touch()
270 bt541->icon_status_reg = ZINITIX_BT4X4_ICON_STATUS_REG; in zinitix_init_touch()
274 bt541->icon_status_reg = ZINITIX_BT5XX_ICON_STATUS_REG; in zinitix_init_touch()
281 dev_err(&client->dev, in zinitix_init_touch()
288 bt541->prop.max_x); in zinitix_init_touch()
293 bt541->prop.max_y); in zinitix_init_touch()
303 bt541->num_keycodes); in zinitix_init_touch()
308 bt541->zinitix_mode); in zinitix_init_touch()
313 bt541->zinitix_mode); in zinitix_init_touch()
318 if (bt541->num_keycodes) in zinitix_init_touch()
336 struct device *dev = &bt541->client->dev; in zinitix_init_regulators()
341 * so check if "vddo" is present and in that case use these names. in zinitix_init_regulators()
342 * Else use the proper supply names on the component. in zinitix_init_regulators()
344 if (of_property_present(dev->of_node, "vddo-supply")) { in zinitix_init_regulators()
345 bt541->supplies[0].supply = "vdd"; in zinitix_init_regulators()
346 bt541->supplies[1].supply = "vddo"; in zinitix_init_regulators()
348 /* Else use the proper supply names */ in zinitix_init_regulators()
349 bt541->supplies[0].supply = "vcca"; in zinitix_init_regulators()
350 bt541->supplies[1].supply = "vdd"; in zinitix_init_regulators()
353 ARRAY_SIZE(bt541->supplies), in zinitix_init_regulators()
354 bt541->supplies); in zinitix_init_regulators()
366 struct i2c_client *client = bt541->client; in zinitix_send_power_on_sequence()
370 dev_err(&client->dev, in zinitix_send_power_on_sequence()
378 dev_err(&client->dev, in zinitix_send_power_on_sequence()
386 dev_err(&client->dev, in zinitix_send_power_on_sequence()
394 dev_err(&client->dev, in zinitix_send_power_on_sequence()
408 if (unlikely(!(p->sub_status & in zinitix_report_finger()
410 dev_dbg(&bt541->client->dev, "unknown finger event %#02x\n", in zinitix_report_finger()
411 p->sub_status); in zinitix_report_finger()
415 x = le16_to_cpu(p->x); in zinitix_report_finger()
416 y = le16_to_cpu(p->y); in zinitix_report_finger()
418 input_mt_slot(bt541->input_dev, slot); in zinitix_report_finger()
419 if (input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER, in zinitix_report_finger()
420 !(p->sub_status & SUB_BIT_UP))) { in zinitix_report_finger()
421 touchscreen_report_pos(bt541->input_dev, in zinitix_report_finger()
422 &bt541->prop, x, y, true); in zinitix_report_finger()
423 input_report_abs(bt541->input_dev, in zinitix_report_finger()
424 ABS_MT_TOUCH_MAJOR, p->width); in zinitix_report_finger()
425 dev_dbg(&bt541->client->dev, "finger %d %s (%u, %u)\n", in zinitix_report_finger()
426 slot, p->sub_status & SUB_BIT_DOWN ? "down" : "move", in zinitix_report_finger()
429 dev_dbg(&bt541->client->dev, "finger %d up (%u, %u)\n", in zinitix_report_finger()
438 for (i = 0; i < bt541->num_keycodes; i++) in zinitix_report_keys()
439 input_report_key(bt541->input_dev, in zinitix_report_keys()
440 bt541->keycodes[i], icon_events & BIT(i)); in zinitix_report_keys()
446 struct i2c_client *client = bt541->client; in zinitix_ts_irq_handler()
455 error = zinitix_read_data(bt541->client, ZINITIX_POINT_STATUS_REG, in zinitix_ts_irq_handler()
458 dev_err(&client->dev, "Failed to read in touchpoint struct\n"); in zinitix_ts_irq_handler()
463 error = zinitix_read_data(bt541->client, bt541->icon_status_reg, in zinitix_ts_irq_handler()
466 dev_err(&client->dev, "Failed to read icon events\n"); in zinitix_ts_irq_handler()
478 if (p->sub_status & SUB_BIT_EXIST) in zinitix_ts_irq_handler()
482 input_mt_sync_frame(bt541->input_dev); in zinitix_ts_irq_handler()
483 input_sync(bt541->input_dev); in zinitix_ts_irq_handler()
486 zinitix_write_cmd(bt541->client, ZINITIX_CLEAR_INT_STATUS_CMD); in zinitix_ts_irq_handler()
494 error = regulator_bulk_enable(ARRAY_SIZE(bt541->supplies), in zinitix_start()
495 bt541->supplies); in zinitix_start()
497 dev_err(&bt541->client->dev, in zinitix_start()
506 dev_err(&bt541->client->dev, in zinitix_start()
507 "Error while sending power-on sequence: %d\n", error); in zinitix_start()
513 dev_err(&bt541->client->dev, in zinitix_start()
518 enable_irq(bt541->client->irq); in zinitix_start()
527 disable_irq(bt541->client->irq); in zinitix_stop()
529 error = regulator_bulk_disable(ARRAY_SIZE(bt541->supplies), in zinitix_stop()
530 bt541->supplies); in zinitix_stop()
532 dev_err(&bt541->client->dev, in zinitix_stop()
560 input_dev = devm_input_allocate_device(&bt541->client->dev); in zinitix_init_input_dev()
562 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
564 return -ENOMEM; in zinitix_init_input_dev()
568 bt541->input_dev = input_dev; in zinitix_init_input_dev()
570 input_dev->name = "Zinitix Capacitive TouchScreen"; in zinitix_init_input_dev()
571 input_dev->phys = "input/ts"; in zinitix_init_input_dev()
572 input_dev->id.bustype = BUS_I2C; in zinitix_init_input_dev()
573 input_dev->open = zinitix_input_open; in zinitix_init_input_dev()
574 input_dev->close = zinitix_input_close; in zinitix_init_input_dev()
576 if (bt541->num_keycodes) { in zinitix_init_input_dev()
577 input_dev->keycode = bt541->keycodes; in zinitix_init_input_dev()
578 input_dev->keycodemax = bt541->num_keycodes; in zinitix_init_input_dev()
579 input_dev->keycodesize = sizeof(bt541->keycodes[0]); in zinitix_init_input_dev()
580 for (i = 0; i < bt541->num_keycodes; i++) in zinitix_init_input_dev()
581 input_set_capability(input_dev, EV_KEY, bt541->keycodes[i]); in zinitix_init_input_dev()
589 touchscreen_parse_properties(input_dev, true, &bt541->prop); in zinitix_init_input_dev()
590 if (!bt541->prop.max_x || !bt541->prop.max_y) { in zinitix_init_input_dev()
591 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
592 "Touchscreen-size-x and/or touchscreen-size-y not set in dts\n"); in zinitix_init_input_dev()
593 return -EINVAL; in zinitix_init_input_dev()
599 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
606 dev_err(&bt541->client->dev, in zinitix_init_input_dev()
619 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { in zinitix_ts_probe()
620 dev_err(&client->dev, in zinitix_ts_probe()
622 return -ENXIO; in zinitix_ts_probe()
625 bt541 = devm_kzalloc(&client->dev, sizeof(*bt541), GFP_KERNEL); in zinitix_ts_probe()
627 return -ENOMEM; in zinitix_ts_probe()
629 bt541->client = client; in zinitix_ts_probe()
634 dev_err(&client->dev, in zinitix_ts_probe()
639 error = devm_request_threaded_irq(&client->dev, client->irq, in zinitix_ts_probe()
642 client->name, bt541); in zinitix_ts_probe()
644 dev_err(&client->dev, "Failed to request IRQ: %d\n", error); in zinitix_ts_probe()
648 if (device_property_present(&client->dev, "linux,keycodes")) { in zinitix_ts_probe()
649 bt541->num_keycodes = device_property_count_u32(&client->dev, in zinitix_ts_probe()
651 if (bt541->num_keycodes < 0) { in zinitix_ts_probe()
652 dev_err(&client->dev, "Failed to count keys (%d)\n", in zinitix_ts_probe()
653 bt541->num_keycodes); in zinitix_ts_probe()
654 return bt541->num_keycodes; in zinitix_ts_probe()
655 } else if (bt541->num_keycodes > ARRAY_SIZE(bt541->keycodes)) { in zinitix_ts_probe()
656 dev_err(&client->dev, "Too many keys defined (%d)\n", in zinitix_ts_probe()
657 bt541->num_keycodes); in zinitix_ts_probe()
658 return -EINVAL; in zinitix_ts_probe()
661 error = device_property_read_u32_array(&client->dev, in zinitix_ts_probe()
663 bt541->keycodes, in zinitix_ts_probe()
664 bt541->num_keycodes); in zinitix_ts_probe()
666 dev_err(&client->dev, in zinitix_ts_probe()
675 dev_err(&client->dev, in zinitix_ts_probe()
680 error = device_property_read_u32(&client->dev, "zinitix,mode", in zinitix_ts_probe()
681 &bt541->zinitix_mode); in zinitix_ts_probe()
684 bt541->zinitix_mode = DEFAULT_TOUCH_POINT_MODE; in zinitix_ts_probe()
687 if (bt541->zinitix_mode != 2) { in zinitix_ts_probe()
692 dev_err(&client->dev, in zinitix_ts_probe()
694 bt541->zinitix_mode); in zinitix_ts_probe()
695 return -EINVAL; in zinitix_ts_probe()
706 mutex_lock(&bt541->input_dev->mutex); in zinitix_suspend()
708 if (input_device_enabled(bt541->input_dev)) in zinitix_suspend()
711 mutex_unlock(&bt541->input_dev->mutex); in zinitix_suspend()
722 mutex_lock(&bt541->input_dev->mutex); in zinitix_resume()
724 if (input_device_enabled(bt541->input_dev)) in zinitix_resume()
727 mutex_unlock(&bt541->input_dev->mutex); in zinitix_resume()
758 .name = "Zinitix-TS",