@@ -238,8 +238,6 @@ setup or driver probe/teardown code, so this is an easy constraint.)::
## gpio_free_array()
gpio_free()
- gpio_set_debounce()
-
Claiming and Releasing GPIOs
@@ -219,7 +219,6 @@ GPIO 值的命令需要等待其信息排到队首才发送命令,再获得其
## gpio_free_array()
gpio_free()
- gpio_set_debounce()
@@ -226,7 +226,6 @@ GPIO 值的命令需要等待其信息排到隊首才發送命令,再獲得其
## gpio_free_array()
gpio_free()
- gpio_set_debounce()
@@ -25,8 +25,8 @@
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/of.h>
-#include <linux/of_gpio.h>
#include <linux/of_device.h>
+#include <linux/gpio/consumer.h>
#include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
@@ -999,7 +999,6 @@ static int ads7846_setup_pendown(struct spi_device *spi,
if (pdata->get_pendown_state) {
ts->get_pendown_state = pdata->get_pendown_state;
} else if (gpio_is_valid(pdata->gpio_pendown)) {
-
err = devm_gpio_request_one(&spi->dev, pdata->gpio_pendown,
GPIOF_IN, "ads7846_pendown");
if (err) {
@@ -1010,14 +1009,21 @@ static int ads7846_setup_pendown(struct spi_device *spi,
}
ts->gpio_pendown = pdata->gpio_pendown;
-
- if (pdata->gpio_pendown_debounce)
- gpio_set_debounce(pdata->gpio_pendown,
- pdata->gpio_pendown_debounce);
} else {
- dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
- return -EINVAL;
+ struct gpio_desc *desc;
+
+ desc = devm_gpiod_get(&spi->dev, "pendown", GPIOD_IN);
+ if (IS_ERR(desc)) {
+ dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
+ return PTR_ERR(desc);
+ }
+ gpiod_set_consumer_name(desc, "ads7846_pendown");
+
+ ts->gpio_pendown = desc_to_gpio(desc);
}
+ if (pdata->gpio_pendown_debounce)
+ gpiod_set_debounce(gpio_to_desc(ts->gpio_pendown),
+ pdata->gpio_pendown_debounce);
return 0;
}
@@ -1194,7 +1200,7 @@ static const struct ads7846_platform_data *ads7846_probe_dt(struct device *dev)
pdata->wakeup = of_property_read_bool(node, "wakeup-source") ||
of_property_read_bool(node, "linux,wakeup");
- pdata->gpio_pendown = of_get_named_gpio(dev->of_node, "pendown-gpio", 0);
+ pdata->gpio_pendown = -ENOENT;
return pdata;
}
@@ -100,11 +100,6 @@ static inline int gpio_direction_output(unsigned gpio, int value)
return gpiod_direction_output_raw(gpio_to_desc(gpio), value);
}
-static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
-{
- return gpiod_set_debounce(gpio_to_desc(gpio), debounce);
-}
-
static inline int gpio_get_value_cansleep(unsigned gpio)
{
return gpiod_get_raw_value_cansleep(gpio_to_desc(gpio));
@@ -215,11 +210,6 @@ static inline int gpio_direction_output(unsigned gpio, int value)
return -ENOSYS;
}
-static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
-{
- return -ENOSYS;
-}
-
static inline int gpio_get_value(unsigned gpio)
{
/* GPIO can never have been requested or set as {in,out}put */