]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpio: idio-16: Define fixed direction of the GPIO lines
authorWilliam Breathitt Gray <wbg@kernel.org>
Fri, 31 Oct 2025 09:33:19 +0000 (18:33 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 2 Nov 2025 13:15:22 +0000 (22:15 +0900)
[ Upstream commit 2ba5772e530f73eb847fb96ce6c4017894869552 ]

The direction of the IDIO-16 GPIO lines is fixed with the first 16 lines
as output and the remaining 16 lines as input. Set the gpio_config
fixed_direction_output member to represent the fixed direction of the
GPIO lines.

Fixes: db02247827ef ("gpio: idio-16: Migrate to the regmap API")
Reported-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Closes: https://lore.kernel.org/r/9b0375fd-235f-4ee1-a7fa-daca296ef6bf@nutanix.com
Suggested-by: Michael Walle <mwalle@kernel.org>
Cc: stable@vger.kernel.org # ae495810cffe: gpio: regmap: add the .fixed_direction_output configuration parameter
Cc: stable@vger.kernel.org
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20251020-fix-gpio-idio-16-regmap-v2-3-ebeb50e93c33@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpio/gpio-idio-16.c

index 2c9512589297217176c0450e6eab8adad4d3fe87..f7e557c2c9cd445030921308718a65e52d2f9dc3 100644 (file)
@@ -3,6 +3,7 @@
  * GPIO library for the ACCES IDIO-16 family
  * Copyright (C) 2022 William Breathitt Gray
  */
+#include <linux/bitmap.h>
 #include <linux/bits.h>
 #include <linux/device.h>
 #include <linux/err.h>
@@ -106,6 +107,7 @@ int devm_idio_16_regmap_register(struct device *const dev,
        struct idio_16_data *data;
        struct regmap_irq_chip *chip;
        struct regmap_irq_chip_data *chip_data;
+       DECLARE_BITMAP(fixed_direction_output, IDIO_16_NGPIO);
 
        if (!config->parent)
                return -EINVAL;
@@ -163,6 +165,9 @@ int devm_idio_16_regmap_register(struct device *const dev,
        gpio_config.irq_domain = regmap_irq_get_domain(chip_data);
        gpio_config.reg_mask_xlate = idio_16_reg_mask_xlate;
 
+       bitmap_from_u64(fixed_direction_output, GENMASK_U64(15, 0));
+       gpio_config.fixed_direction_output = fixed_direction_output;
+
        return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &gpio_config));
 }
 EXPORT_SYMBOL_GPL(devm_idio_16_regmap_register);