diff options
-rw-r--r-- | recipes-kernel/linux/linux-at91-4.9/linux-4.9-at91_gpio_set_single_ended.patch | 90 |
1 files changed, 79 insertions, 11 deletions
diff --git a/recipes-kernel/linux/linux-at91-4.9/linux-4.9-at91_gpio_set_single_ended.patch b/recipes-kernel/linux/linux-at91-4.9/linux-4.9-at91_gpio_set_single_ended.patch index 25da603..c9ed24d 100644 --- a/recipes-kernel/linux/linux-at91-4.9/linux-4.9-at91_gpio_set_single_ended.patch +++ b/recipes-kernel/linux/linux-at91-4.9/linux-4.9-at91_gpio_set_single_ended.patch @@ -1,6 +1,6 @@ diff -Naru linux-4.9.orig/drivers/gpio/gpiolib.c linux-4.9/drivers/gpio/gpiolib.c --- linux-4.9.orig/drivers/gpio/gpiolib.c 2018-12-11 10:11:06.000000000 -0600 -+++ linux-4.9/drivers/gpio/gpiolib.c 2018-12-12 10:20:01.690638477 -0600 ++++ linux-4.9/drivers/gpio/gpiolib.c 2018-12-12 18:33:20.445762213 -0600 @@ -478,6 +478,8 @@ set_bit(FLAG_OPEN_DRAIN, &desc->flags); if (lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE) @@ -36,13 +36,10 @@ diff -Naru linux-4.9.orig/drivers/gpio/gpiolib.c linux-4.9/drivers/gpio/gpiolib. clear_bit(FLAG_IS_HOGGED, &desc->flags); ret = true; } -@@ -2256,6 +2263,17 @@ - if (!ret) - goto set_output_value; - } -+ /* Emulate open source by not actively driving the line low */ -+ if (!value) -+ return gpiod_direction_input(desc); +@@ -2259,6 +2266,17 @@ + /* Emulate open source by not actively driving the line low */ + if (!value) + return gpiod_direction_input(desc); + } + else if (test_bit(FLAG_PULLUP, &desc->flags)) { + if (gc->set_single_ended) { @@ -51,9 +48,47 @@ diff -Naru linux-4.9.orig/drivers/gpio/gpiolib.c linux-4.9/drivers/gpio/gpiolib. + if (!ret) + goto set_output_value; + } - /* Emulate open source by not actively driving the line low */ - if (!value) - return gpiod_direction_input(desc); ++ /* Emulate open source by not actively driving the line low */ ++ if (!value) ++ return gpiod_direction_input(desc); + } else { + /* Make sure to disable open drain/source hardware, if any */ + if (gc->set_single_ended) +@@ -3164,6 +3182,8 @@ + set_bit(FLAG_OPEN_DRAIN, &desc->flags); + if (lflags & GPIO_OPEN_SOURCE) + set_bit(FLAG_OPEN_SOURCE, &desc->flags); ++ if (lflags & GPIO_PULLUP) ++ set_bit(FLAG_PULLUP, &desc->flags); + + /* No particular flag request, return here... */ + if (!(dflags & GPIOD_FLAGS_BIT_DIR_SET)) { +@@ -3266,6 +3286,7 @@ + struct gpio_desc *desc = ERR_PTR(-ENODEV); + bool active_low = false; + bool single_ended = false; ++ bool pullup = false; + int ret; + + if (!fwnode) +@@ -3279,6 +3300,7 @@ + if (!IS_ERR(desc)) { + active_low = flags & OF_GPIO_ACTIVE_LOW; + single_ended = flags & OF_GPIO_SINGLE_ENDED; ++ pullup = flags & OF_GPIO_PULLUP; + } + } else if (is_acpi_node(fwnode)) { + struct acpi_gpio_info info; +@@ -3304,7 +3326,8 @@ + else + set_bit(FLAG_OPEN_SOURCE, &desc->flags); + } +- ++ if(pullup) ++ set_bit(FLAG_PULLUP, &desc->flags); + return desc; + } + EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod); diff -Naru linux-4.9.orig/drivers/gpio/gpiolib.h linux-4.9/drivers/gpio/gpiolib.h --- linux-4.9.orig/drivers/gpio/gpiolib.h 2018-12-11 12:10:06.937000782 -0600 +++ linux-4.9/drivers/gpio/gpiolib.h 2018-12-11 12:11:30.324998313 -0600 @@ -110,6 +145,17 @@ diff -Naru linux-4.9.orig/drivers/pinctrl/pinctrl-at91.c linux-4.9/drivers/pinct .dbg_show = at91_gpio_dbg_show, .can_sleep = false, .ngpio = MAX_NB_GPIO_PER_BANK, +diff -Naru linux-4.9.orig/include/dt-bindings/gpio/gpio.h linux-4.9/include/dt-bindings/gpio/gpio.h +--- linux-4.9.orig/include/dt-bindings/gpio/gpio.h 2018-12-12 10:50:50.000000000 -0600 ++++ linux-4.9/include/dt-bindings/gpio/gpio.h 2018-12-12 18:45:10.857741181 -0600 +@@ -17,6 +17,7 @@ + #define GPIO_PUSH_PULL 0 + #define GPIO_SINGLE_ENDED 2 + ++#define GPIO_PULLUP 3 + /* + * Open Drain/Collector is the combination of single-ended active low, + * Open Source/Emitter is the combination of single-ended active high. diff -Naru linux-4.9.orig/include/linux/gpio/driver.h linux-4.9/include/linux/gpio/driver.h --- linux-4.9.orig/include/linux/gpio/driver.h 2018-12-11 10:11:20.000000000 -0600 +++ linux-4.9/include/linux/gpio/driver.h 2018-12-11 17:47:56.188400715 -0600 @@ -127,6 +173,28 @@ diff -Naru linux-4.9.orig/include/linux/gpio/driver.h linux-4.9/include/linux/gp }; /** +diff -Naru linux-4.9.orig/include/linux/gpio/machine.h linux-4.9/include/linux/gpio/machine.h +--- linux-4.9.orig/include/linux/gpio/machine.h 2018-12-12 10:50:50.000000000 -0600 ++++ linux-4.9/include/linux/gpio/machine.h 2018-12-12 18:25:12.265776665 -0600 +@@ -9,6 +9,7 @@ + GPIO_ACTIVE_LOW = (1 << 0), + GPIO_OPEN_DRAIN = (1 << 1), + GPIO_OPEN_SOURCE = (1 << 2), ++ GPIO_PULLUP = (1 << 3), + }; + + /** +diff -Naru linux-4.9.orig/include/linux/of_gpio.h linux-4.9/include/linux/of_gpio.h +--- linux-4.9.orig/include/linux/of_gpio.h 2018-12-12 18:40:24.109749670 -0600 ++++ linux-4.9/include/linux/of_gpio.h 2018-12-12 18:35:55.000000000 -0600 +@@ -30,6 +30,7 @@ + enum of_gpio_flags { + OF_GPIO_ACTIVE_LOW = 0x1, + OF_GPIO_SINGLE_ENDED = 0x2, ++ OF_GPIO_PULLUP = 0x2, + }; + + #ifdef CONFIG_OF_GPIO diff -Naru linux-4.9.orig/include/uapi/linux/gpio.h linux-4.9/include/uapi/linux/gpio.h --- linux-4.9.orig/include/uapi/linux/gpio.h 2018-12-11 10:11:21.000000000 -0600 +++ linux-4.9/include/uapi/linux/gpio.h 2018-12-11 12:21:03.884981333 -0600 |