Hi Andy, On Mon, Mar 08, 2021 at 12:05:48AM +0200, Andy Shevchenko wrote: > @@ -226,11 +226,12 @@ static int tsc2007_get_pendown_state_gpio(struct device *dev) > struct i2c_client *client = to_i2c_client(dev); > struct tsc2007 *ts = i2c_get_clientdata(client); > > - return !gpio_get_value(ts->gpio); > + return !gpiod_get_value(ts->gpiod); This is not correct. gpio_get_value() is raw polarity vs gpiod_get_value() using logical active/inactive, and tsc2007 GPIO lines are active low. The negation must be dropped after switching to GPIOD API. > } > > static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts) > { > + struct device *dev = &client->dev; > struct device_node *np = client->dev.of_node; > u32 val32; > u64 val64; > @@ -266,13 +267,11 @@ static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts) > return -EINVAL; > } > > - ts->gpio = of_get_gpio(np, 0); > - if (gpio_is_valid(ts->gpio)) > - ts->get_pendown_state = tsc2007_get_pendown_state_gpio; > - else > - dev_warn(&client->dev, > - "GPIO not specified in DT (of_get_gpio returned %d)\n", > - ts->gpio); > + ts->gpiod = devm_gpiod_get_optional(dev, NULL, GPIOD_IN); GPIO is definitely not optional in DT case, at least in the way the driver written right now. > + if (IS_ERR(ts->gpiod)) > + return PTR_ERR(ts->gpiod); > + > + ts->get_pendown_state = tsc2007_get_pendown_state_gpio; > > return 0; > } > -- > 2.30.1 > Thanks. -- Dmitry