Lines Matching +full:vcc33 +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0
3 * Driver for Elan touchscreens that use the i2c-hid protocol.
18 #include "i2c-hid.h"
31 struct regulator *vcc33; member
44 gpiod_set_value_cansleep(ihid_elan->reset_gpio, 1); in elan_i2c_hid_power_up()
46 if (ihid_elan->vcc33) { in elan_i2c_hid_power_up()
47 ret = regulator_enable(ihid_elan->vcc33); in elan_i2c_hid_power_up()
52 ret = regulator_enable(ihid_elan->vccio); in elan_i2c_hid_power_up()
56 if (ihid_elan->chip_data->post_power_delay_ms) in elan_i2c_hid_power_up()
57 msleep(ihid_elan->chip_data->post_power_delay_ms); in elan_i2c_hid_power_up()
59 gpiod_set_value_cansleep(ihid_elan->reset_gpio, 0); in elan_i2c_hid_power_up()
60 if (ihid_elan->chip_data->post_gpio_reset_on_delay_ms) in elan_i2c_hid_power_up()
61 msleep(ihid_elan->chip_data->post_gpio_reset_on_delay_ms); in elan_i2c_hid_power_up()
66 if (ihid_elan->vcc33) in elan_i2c_hid_power_up()
67 regulator_disable(ihid_elan->vcc33); in elan_i2c_hid_power_up()
69 if (ihid_elan->no_reset_on_power_off) in elan_i2c_hid_power_up()
70 gpiod_set_value_cansleep(ihid_elan->reset_gpio, 0); in elan_i2c_hid_power_up()
82 * deasserted regardless of the state of the (shared) power supply to in elan_i2c_hid_power_down()
83 * avoid wasting power when the supply is left on. in elan_i2c_hid_power_down()
85 if (!ihid_elan->no_reset_on_power_off) in elan_i2c_hid_power_down()
86 gpiod_set_value_cansleep(ihid_elan->reset_gpio, 1); in elan_i2c_hid_power_down()
88 if (ihid_elan->chip_data->post_gpio_reset_off_delay_ms) in elan_i2c_hid_power_down()
89 msleep(ihid_elan->chip_data->post_gpio_reset_off_delay_ms); in elan_i2c_hid_power_down()
91 regulator_disable(ihid_elan->vccio); in elan_i2c_hid_power_down()
92 if (ihid_elan->vcc33) in elan_i2c_hid_power_down()
93 regulator_disable(ihid_elan->vcc33); in elan_i2c_hid_power_down()
101 ihid_elan = devm_kzalloc(&client->dev, sizeof(*ihid_elan), GFP_KERNEL); in i2c_hid_of_elan_probe()
103 return -ENOMEM; in i2c_hid_of_elan_probe()
105 ihid_elan->ops.power_up = elan_i2c_hid_power_up; in i2c_hid_of_elan_probe()
106 ihid_elan->ops.power_down = elan_i2c_hid_power_down; in i2c_hid_of_elan_probe()
109 ihid_elan->reset_gpio = in i2c_hid_of_elan_probe()
110 devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); in i2c_hid_of_elan_probe()
111 if (IS_ERR(ihid_elan->reset_gpio)) in i2c_hid_of_elan_probe()
112 return PTR_ERR(ihid_elan->reset_gpio); in i2c_hid_of_elan_probe()
114 ihid_elan->no_reset_on_power_off = of_property_read_bool(client->dev.of_node, in i2c_hid_of_elan_probe()
115 "no-reset-on-power-off"); in i2c_hid_of_elan_probe()
117 ihid_elan->vccio = devm_regulator_get(&client->dev, "vccio"); in i2c_hid_of_elan_probe()
118 if (IS_ERR(ihid_elan->vccio)) { in i2c_hid_of_elan_probe()
119 ret = PTR_ERR(ihid_elan->vccio); in i2c_hid_of_elan_probe()
123 ihid_elan->chip_data = device_get_match_data(&client->dev); in i2c_hid_of_elan_probe()
125 if (ihid_elan->chip_data->main_supply_name) { in i2c_hid_of_elan_probe()
126 ihid_elan->vcc33 = devm_regulator_get(&client->dev, in i2c_hid_of_elan_probe()
127 ihid_elan->chip_data->main_supply_name); in i2c_hid_of_elan_probe()
128 if (IS_ERR(ihid_elan->vcc33)) { in i2c_hid_of_elan_probe()
129 ret = PTR_ERR(ihid_elan->vcc33); in i2c_hid_of_elan_probe()
134 ret = i2c_hid_core_probe(client, &ihid_elan->ops, in i2c_hid_of_elan_probe()
135 ihid_elan->chip_data->hid_descriptor_address, 0); in i2c_hid_of_elan_probe()
142 if (ihid_elan->no_reset_on_power_off) in i2c_hid_of_elan_probe()
143 gpiod_set_value_cansleep(ihid_elan->reset_gpio, 0); in i2c_hid_of_elan_probe()
152 .main_supply_name = "vcc33",
159 .main_supply_name = "vcc33",
179 .main_supply_name = "vcc33",
205 MODULE_DESCRIPTION("Elan i2c-hid touchscreen driver");