mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 03:35:32 -04:00
HID: i2c-hid: goodix: Add mainboard-vddio-supply
As talked about in the patch ("dt-bindings: HID: i2c-hid: goodix: Add
mainboard-vddio-supply") we may need to power up a 1.8V rail on the
host associated with touchscreen IO. Let's add support in the driver
for it.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20230206184744.6.Ic234b931025d1f920ce9e06fff294643943a65ad@changeid
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
This commit is contained in:
committed by
Benjamin Tissoires
parent
1d18c1f3b7
commit
eb16f59e8e
@@ -26,6 +26,7 @@ struct i2c_hid_of_goodix {
|
|||||||
struct i2chid_ops ops;
|
struct i2chid_ops ops;
|
||||||
|
|
||||||
struct regulator *vdd;
|
struct regulator *vdd;
|
||||||
|
struct regulator *vddio;
|
||||||
struct gpio_desc *reset_gpio;
|
struct gpio_desc *reset_gpio;
|
||||||
const struct goodix_i2c_hid_timing_data *timings;
|
const struct goodix_i2c_hid_timing_data *timings;
|
||||||
};
|
};
|
||||||
@@ -40,6 +41,10 @@ static int goodix_i2c_hid_power_up(struct i2chid_ops *ops)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ret = regulator_enable(ihid_goodix->vddio);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (ihid_goodix->timings->post_power_delay_ms)
|
if (ihid_goodix->timings->post_power_delay_ms)
|
||||||
msleep(ihid_goodix->timings->post_power_delay_ms);
|
msleep(ihid_goodix->timings->post_power_delay_ms);
|
||||||
|
|
||||||
@@ -56,6 +61,7 @@ static void goodix_i2c_hid_power_down(struct i2chid_ops *ops)
|
|||||||
container_of(ops, struct i2c_hid_of_goodix, ops);
|
container_of(ops, struct i2c_hid_of_goodix, ops);
|
||||||
|
|
||||||
gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1);
|
gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1);
|
||||||
|
regulator_disable(ihid_goodix->vddio);
|
||||||
regulator_disable(ihid_goodix->vdd);
|
regulator_disable(ihid_goodix->vdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,6 +87,10 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client)
|
|||||||
if (IS_ERR(ihid_goodix->vdd))
|
if (IS_ERR(ihid_goodix->vdd))
|
||||||
return PTR_ERR(ihid_goodix->vdd);
|
return PTR_ERR(ihid_goodix->vdd);
|
||||||
|
|
||||||
|
ihid_goodix->vddio = devm_regulator_get(&client->dev, "mainboard-vddio");
|
||||||
|
if (IS_ERR(ihid_goodix->vddio))
|
||||||
|
return PTR_ERR(ihid_goodix->vddio);
|
||||||
|
|
||||||
ihid_goodix->timings = device_get_match_data(&client->dev);
|
ihid_goodix->timings = device_get_match_data(&client->dev);
|
||||||
|
|
||||||
return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0);
|
return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user