Lines Matching +full:i2c +full:- +full:hid

1 // SPDX-License-Identifier: GPL-2.0
3 * Driver for Goodix touchscreens that use the i2c-hid protocol.
11 #include <linux/i2c.h>
18 #include "i2c-hid.h"
42 * We assert reset GPIO here (instead of during power-down) to ensure in goodix_i2c_hid_power_up()
46 if (ihid_goodix->no_reset_during_suspend) in goodix_i2c_hid_power_up()
47 gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1); in goodix_i2c_hid_power_up()
49 ret = regulator_enable(ihid_goodix->vdd); in goodix_i2c_hid_power_up()
53 ret = regulator_enable(ihid_goodix->vddio); in goodix_i2c_hid_power_up()
57 if (ihid_goodix->timings->post_power_delay_ms) in goodix_i2c_hid_power_up()
58 msleep(ihid_goodix->timings->post_power_delay_ms); in goodix_i2c_hid_power_up()
60 gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 0); in goodix_i2c_hid_power_up()
61 if (ihid_goodix->timings->post_gpio_reset_delay_ms) in goodix_i2c_hid_power_up()
62 msleep(ihid_goodix->timings->post_gpio_reset_delay_ms); in goodix_i2c_hid_power_up()
72 if (!ihid_goodix->no_reset_during_suspend) in goodix_i2c_hid_power_down()
73 gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1); in goodix_i2c_hid_power_down()
75 regulator_disable(ihid_goodix->vddio); in goodix_i2c_hid_power_down()
76 regulator_disable(ihid_goodix->vdd); in goodix_i2c_hid_power_down()
83 ihid_goodix = devm_kzalloc(&client->dev, sizeof(*ihid_goodix), in i2c_hid_of_goodix_probe()
86 return -ENOMEM; in i2c_hid_of_goodix_probe()
88 ihid_goodix->ops.power_up = goodix_i2c_hid_power_up; in i2c_hid_of_goodix_probe()
89 ihid_goodix->ops.power_down = goodix_i2c_hid_power_down; in i2c_hid_of_goodix_probe()
92 ihid_goodix->reset_gpio = in i2c_hid_of_goodix_probe()
93 devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); in i2c_hid_of_goodix_probe()
94 if (IS_ERR(ihid_goodix->reset_gpio)) in i2c_hid_of_goodix_probe()
95 return PTR_ERR(ihid_goodix->reset_gpio); in i2c_hid_of_goodix_probe()
97 ihid_goodix->vdd = devm_regulator_get(&client->dev, "vdd"); in i2c_hid_of_goodix_probe()
98 if (IS_ERR(ihid_goodix->vdd)) in i2c_hid_of_goodix_probe()
99 return PTR_ERR(ihid_goodix->vdd); in i2c_hid_of_goodix_probe()
101 ihid_goodix->vddio = devm_regulator_get(&client->dev, "mainboard-vddio"); in i2c_hid_of_goodix_probe()
102 if (IS_ERR(ihid_goodix->vddio)) in i2c_hid_of_goodix_probe()
103 return PTR_ERR(ihid_goodix->vddio); in i2c_hid_of_goodix_probe()
105 ihid_goodix->no_reset_during_suspend = in i2c_hid_of_goodix_probe()
106 of_property_read_bool(client->dev.of_node, "goodix,no-reset-during-suspend"); in i2c_hid_of_goodix_probe()
108 ihid_goodix->timings = device_get_match_data(&client->dev); in i2c_hid_of_goodix_probe()
110 return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0); in i2c_hid_of_goodix_probe()
138 MODULE_DESCRIPTION("Goodix i2c-hid touchscreen driver");