Commit graph

6667 commits

Author SHA1 Message Date
Jiri Slaby (SUSE)
7b2c2f1eb3 gpio: Use dev_fwnode() where applicable across drivers
irq_domain_create_simple() takes fwnode as the first argument. It can be
extracted from the struct device using dev_fwnode() helper instead of
using of_node with of_fwnode_handle().

So use the dev_fwnode() helper where applicable.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250611104348.192092-6-jirislaby@kernel.org
[Bartosz: tweaked the commit message]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-06-16 09:42:24 +02:00
David Lechner
0a99f2d8ff gpio: virtuser: use gpiod_multi_set_value_cansleep()
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
gpiod_set_array_value_cansleep().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20250611-gpio-virtuser-use-gpiod_multi_set_value_cansleep-v1-1-43b4adf6c807@baylibre.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-06-16 09:29:42 +02:00
Binbin Zhou
72f3795700 gpio: loongson-64bit: Correct Loongson-7A2000 ACPI GPIO access mode
According to the description of the Loongson-7A2000 ACPI GPIO register in
the manual, its access mode should be BIT_CTRL_MODE, otherwise there maybe
some unpredictable behavior.

Cc: stable@vger.kernel.org
Fixes: 44fe79020b ("gpio: loongson-64bit: Add more gpio chip support")
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://lore.kernel.org/r/20250610115926.347845-1-zhoubinbin@loongson.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-06-11 14:33:26 +02:00
Bartosz Golaszewski
97a7ea2b8f gpio: TODO: add a task for removing MMIO-specific fields from gpio_chip
Currently for CONFIG_GPIO_GENERIC=y each struct gpio_chip object
contains the fields relevant only for gpio-mmio users. It's not an
insignificant number either as it's several pointers and integers.

It makes sense to remove these fields from struct gpio_chip into a
dedicated structure but this is not trivial due to how the bgpio_init()
function is implemented.

Add a task for tracking this rework.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250527111353.71540-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-06-10 11:41:01 +02:00
Andy Shevchenko
6595ea2761 gpiolib: Move GPIO_DYNAMIC_* constants to its only user
There is no need to export GPIO_DYNAMIC_* constants, especially via
legacy header which is subject to remove. Move the mentioned constants
to its only user, i.e. gpiolib.c.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250531195801.3632110-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-06-10 10:08:34 +02:00
Andy Shevchenko
a558931338 gpiolib: Remove unused devm_gpio_request()
Remove devm_gpio_request() due to lack of users.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250531212331.3635269-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-06-10 10:06:41 +02:00
Mario Limonciello
9ab29ed505 gpiolib: acpi: Add a quirk for Acer Nitro V15
It is reported that on Acer Nitro V15 suspend only works properly if the
keyboard backlight is turned off. In looking through the issue Acer Nitro
V15 has a GPIO (#8) specified in _AEI but it has no matching notify device
in _EVT. The values for GPIO #8 change as keyboard backlight is turned on
and off.

This makes it seem that GPIO #8 is actually supposed to be solely for
keyboard backlight.  Turning off the interrupt for this GPIO fixes the issue.
Add a quirk that does just that.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4169
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Mika Westerberg <westeri@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-06-09 23:09:24 +03:00
Linus Torvalds
aacc73ceeb gpio updates for v6.16-rc1
GPIO core:
 - use more lock guards where applicable
 - refactor GPIO ACPI code and shrink it in the process by 8%
 - move GPIO ACPI quirks into a separate file
 - remove unneeded #ifdef
 - convert GPIO devres helpers to using devm_add_action() where applicable
   which shrinks and simplifies the code
 - refactor GPIO descriptor validation in GPIO consumer interfaces
 - don't allow setting values on input lines in the GPIO core which will
   take off the burden from GPIO drivers of checking this down the line
 - provide gpiod_is_equal() as a way of safely comparing two GPIO
   descriptors (the only current user is in regulator core)
 
 New drivers:
 - add the GPIO module for the max77759 multifunction device
 - add the GPIO driver for the VeriSilicon BLZP1600 GPIO controller
 - add the GPIO driver for the Spacemit K1 SoC
 
 Driver improvements:
 - convert more drivers to using the new GPIO line value setter callbacks
 - convert more drivers to making the irq_chip immutable as is recommended
   by the interrupt subsystem
 - extend build testing coverage by enabling more modules to be built with
   COMPILE_TEST=y
 - extend the gpio-aggregator module with a configfs interface that makes
   the setup easier for user-space than the existing driver-level sysfs
   attributes and also adds more advanced configuration features (such as
   referring to aggregated lines by their original names or modifying
   their names as exposed by the aggregated chip)
 - add a missing mutex_destroy() in gpio-imx-scu
 - add an OF polarity quirk for s5m8767
 - allow building gpio-vf610 as a loadable module
 - make gpio-mxc not hardcode its GPIO base number with GPIO SYSFS
   interface disabled (another small step towards getting rid of the global
   GPIO numberspace)
 - add support for level-triggered interrupts to gpio-pca953x
 - don't double-check the ngpios property in gpio-ds4520 as GPIO core
   already does it
 - don't double-check the number of GPIOs in gpio-imx-scu as GPIO core
   already does it
 - remove unused callbacks from gpio-max3191x
 
 DT bindings:
 - add device-tree bindings for max77759, spacemit,k1 and blzp1600 (new
   drivers added this cycle)
 - document more properties for gpio-vf610 and gpio-tegra186
 - document a new pca95xx variant
 - fix style of examples in several GPIO DT-binding documents
 
 Misc:
 - TODO list updates
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmg0NtQACgkQEacuoBRx
 13Iolg/+P8fe1hTek+UgdKm/EAQ1Mn3oijNE1Ix15VD8Iqacu+URyB2SJMFcg27n
 S/tsuwogQeQmdgXPfYDJkQmiZEyln/ytWf5W2lNwYhGfGujVa8h1FueB7Wb8Zs7G
 PNMnobyAIGivodJfvikDEyczMuxhkOH04ZOT7UpTSPI47BSGsujX/1vgmRQLid1Z
 3wFDJ0yDhVcuxit/VC+LzFpHIV0MiRzGpvHzYid5jjEaGSiRMpHixf27VJGc0gG1
 IJLkhNkwZ3InisWVGvqdRg/FUNErRYKYQSARb4AjCU+/y1H0SWdB0R6sZDTZpP+e
 YqAc8FW31Lw1L7PWBLRTaVS3KT868tdXDCsArNzfBbb3u/WikO2GY/AXuzveZatp
 pHwyPA0JS9QvxaTXU9yjCpGqdNfjbrmU5OkZxTTe+Nyz84fUfiURiE8g4Rl6riy4
 fNzaywRBmVZlEECWSWGzyNw9ZEYDRPZ1ZHmOA+8FWE+/XKJIsVf8w3x2QIC5b/HO
 hYKH4mar8oiEYJFZqoko3iQURJq+AD9wILCNpws5bSsi//VyyNT0mZV/q5hj7+Xx
 pqeEGDInvycN5fDWWJlkN1lj5dDyHZi4uus05mYI9Ec+eX3XNWRUHXUskbpzdgCs
 XepjP9kFQmMSL7y4z2d7tLd7gFup/uGny7o/KyMsIPDw7qVL5rY=
 =PQqp
 -----END PGP SIGNATURE-----

Merge tag 'gpio-updates-for-v6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio updates from Bartosz Golaszewski:
 "We have three new drivers, some refactoring in the GPIO core, lots of
  various changes across many drivers, new configfs interface for the
  virtual gpio-aggregator module and DT-bindings updates.

  The treewide conversion of GPIO drivers to using the new value setter
  callbacks is ongoing with another round of GPIO drivers updated. You
  will also see these commits coming in from other subsystems as with
  the relevant changes merged into mainline last cycle, I've started
  converting GPIO providers located elsewhere than drivers/gpio/.

  GPIO core:
   - use more lock guards where applicable
   - refactor GPIO ACPI code and shrink it in the process by 8%
   - move GPIO ACPI quirks into a separate file
   - remove unneeded #ifdef
   - convert GPIO devres helpers to using devm_add_action() where
     applicable which shrinks and simplifies the code
   - refactor GPIO descriptor validation in GPIO consumer interfaces
   - don't allow setting values on input lines in the GPIO core which
     will take off the burden from GPIO drivers of checking this down
     the line
   - provide gpiod_is_equal() as a way of safely comparing two GPIO
     descriptors (the only current user is in regulator core)

  New drivers:
   - add the GPIO module for the max77759 multifunction device
   - add the GPIO driver for the VeriSilicon BLZP1600 GPIO controller
   - add the GPIO driver for the Spacemit K1 SoC

  Driver improvements:
   - convert more drivers to using the new GPIO line value setter
     callbacks
   - convert more drivers to making the irq_chip immutable as is
     recommended by the interrupt subsystem
   - extend build testing coverage by enabling more modules to be built
     with COMPILE_TEST=y
   - extend the gpio-aggregator module with a configfs interface that
     makes the setup easier for user-space than the existing
     driver-level sysfs attributes and also adds more advanced
     configuration features (such as referring to aggregated lines by
     their original names or modifying their names as exposed by the
     aggregated chip)
   - add a missing mutex_destroy() in gpio-imx-scu
   - add an OF polarity quirk for s5m8767
   - allow building gpio-vf610 as a loadable module
   - make gpio-mxc not hardcode its GPIO base number with GPIO SYSFS
     interface disabled (another small step towards getting rid of the
     global GPIO numberspace)
   - add support for level-triggered interrupts to gpio-pca953x
   - don't double-check the ngpios property in gpio-ds4520 as GPIO core
     already does it
   - don't double-check the number of GPIOs in gpio-imx-scu as GPIO core
     already does it
   - remove unused callbacks from gpio-max3191x

  DT bindings:
   - add device-tree bindings for max77759, spacemit,k1 and blzp1600
     (new drivers added this cycle)
   - document more properties for gpio-vf610 and gpio-tegra186
   - document a new pca95xx variant
   - fix style of examples in several GPIO DT-binding documents

  Misc:
   - TODO list updates"

* tag 'gpio-updates-for-v6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (123 commits)
  gpio: timberdale: select GPIOLIB_IRQCHIP
  gpio: lpc18xx: select GPIOLIB_IRQCHIP
  gpio: grgpio: select GPIOLIB_IRQCHIP
  gpio: bcm-kona: select GPIOLIB_IRQCHIP
  dt-bindings: gpio: vf610: add ngpios and gpio-reserved-ranges
  gpio: davinci: select GPIOLIB_IRQCHIP
  gpiolib-acpi: Update file references in the Documentation and MAINTAINERS
  gpiolib: acpi: Move quirks to a separate file
  gpiolib: acpi: Add acpi_gpio_need_run_edge_events_on_boot() getter
  gpiolib: acpi: Handle deferred list via new API
  gpiolib: acpi: Make sure we fill struct acpi_gpio_info
  gpiolib: acpi: Switch to use enum in acpi_gpio_in_ignore_list()
  gpiolib: acpi: Use temporary variable for struct acpi_gpio_info
  gpiolib: remove unneeded #ifdef
  gpio: mpc8xxx: select GPIOLIB_IRQCHIP
  gpio: pxa: select GPIOLIB_IRQCHIP
  gpio: pxa: Make irq_chip immutable
  gpio: timberdale: Make irq_chip immutable
  gpio: xgene-sb: Make irq_chip immutable
  gpio: davinci: Make irq_chip immutable
  ...
2025-05-27 15:22:01 -07:00
Linus Torvalds
2bd1bea5fa A set of cleanups for the generic interrupt subsystem:
- Consolidate on one set of functions for the interrupt domain code to
     get rid of pointlessly duplicated code with only marginal different
     semantics.
 
   - Update the documentation accordingly and consolidate the coding style
     of the irqdomain header.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmgzd+MTHHRnbHhAbGlu
 dXRyb25peC5kZQAKCRCmGPVMDXSYodTRD/0RmG5tngCbEJmTw6lPDQzRZH4OO3ja
 yRYlyBipemoRmvJRGjV4uHqN2QPrdOuoqMuyBO1aWcMdkpww5bAHcbgSFrlGM1lW
 kqtaxVMbufPiLQSGYe7OQf478CE1ykoBd5Va8whFKrtA73qEUdEMfWT0stspg780
 7BlmQOemL91p7Ytf03FbDdo8tZ5Xu9uXGAulwY9FZsFtsCNyvhl7nOv5Sk8ZQtGO
 xHRCeunjZLWR+IaK59hdakvQybXwSnjT6jODp96nlyKABEKSPShGSPFDWd3g9px7
 4911QwgnvTbcrsk6YmQEmPIOgXZzypjbnjpJr8tFpTbkVIy+6chi5cBJzXoqsUaM
 ylTwFcUQNvcP8yF447qb+nyPFKM5xsC07W0UpZMuJUDmhhPRtDm5pK0jpsif96GP
 l4aMsWe65PUmXHQqLdE89RJXAa8XQ2qspKVtNKq9DmEVgTviQ09Z9SSQIx4U0yIx
 w+YPde8kH2+O+YtMUn/MmfHhUP4MKya7j5zd8Bnv8wLBi7XGPPA5EKKh9I0dz9m+
 X94lweNXyH+Q8U9mt2cQf8VG8Yzgk0eeC0sliJIlybwRgEgRcQbVWw0VvZUA1ySa
 VBlaj3SinO90FEQ0CctT51ss2mUJ/XsGCnxpiGZXfqIZzFbyD1YfZQnXJH0H67DI
 CqdHw22I27Mu/A==
 =9nLp
 -----END PGP SIGNATURE-----

Merge tag 'irq-cleanups-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq cleanups from Thomas Gleixner:
 "A set of cleanups for the generic interrupt subsystem:

   - Consolidate on one set of functions for the interrupt domain code
     to get rid of pointlessly duplicated code with only marginal
     different semantics.

   - Update the documentation accordingly and consolidate the coding
     style of the irqdomain header"

* tag 'irq-cleanups-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits)
  irqdomain: Consolidate coding style
  irqdomain: Fix kernel-doc and add it to Documentation
  Documentation: irqdomain: Update it
  Documentation: irq-domain.rst: Simple improvements
  Documentation: irq/concepts: Minor improvements
  Documentation: irq/concepts: Add commas and reflow
  irqdomain: Improve kernel-docs of functions
  irqdomain: Make struct irq_domain_info variables const
  irqdomain: Use irq_domain_instantiate()'s return value as initializers
  irqdomain: Drop irq_linear_revmap()
  pinctrl: keembay: Switch to irq_find_mapping()
  irqchip/armada-370-xp: Switch to irq_find_mapping()
  gpu: ipu-v3: Switch to irq_find_mapping()
  gpio: idt3243x: Switch to irq_find_mapping()
  sh: Switch to irq_find_mapping()
  powerpc: Switch to irq_find_mapping()
  irqdomain: Drop irq_domain_add_*() functions
  powerpc: Switch irq_domain_add_nomap() to use fwnode
  thermal: Switch to irq_domain_create_linear()
  soc: Switch to irq_domain_create_*()
  ...
2025-05-27 08:07:32 -07:00
Linus Torvalds
c0f182c979 Update for interrupt chip drivers:
- Convert the generic interrupt chip to lock guards to remove copy &
     pasta boilerplate code and gotos.
 
   - A new driver fot the interrupt controller in the EcoNet EN751221 MIPS SoC.
 
   - Extend the SG2042-MSI driver to support the new SG2044 SoC
 
   - Updates and cleanups for the (ancient) VT8500 driver
 
   - Improve the scalability of the ARM GICV4.1 ITS driver by utilizing node
     local copies a VM's interrupt translation table when possible. This
     results in a 12% reduction of VM IPI latency in certain workloads.
 
   - The usual cleanups and improvements all over the place
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmgzfSwTHHRnbHhAbGlu
 dXRyb25peC5kZQAKCRCmGPVMDXSYoc4lD/0U24B8okpp2PxVVZOtNzWgl7kcAQSJ
 2U834ep1DhqJPNW0JjT+5Lb55NfAEN/uCuirjLZDsKYNNel4LXhAY951BCJMytYX
 ebH/J7wGjEphRogxn9QTGGC/mguThwFnOiqOLq4aU0Sq/oRH6Uj+P6hMod7ym9bn
 P+bZv9WWhLQQ3x/RimcauReCEDW6pW2soQV+zhN+xTxTW+R1zRcksz1x4+b/B7Vk
 ZH6KFBpZJyC34T0aXOJFhrEo01z2iZWifgmX1zz2ZgZjeUklFxtW9vGqBRS0mU2P
 9bW/qXDsSdOStyfuXbG7Q3s2z9s5Voj9okgBiA5DUD3DuplVHG/3x8do8ZHrvMoV
 k59ORecx29g0nBaVMjT13gH1XfaqI3W52qff6yksqqByh+5urhGXeYzvQ07M9ldm
 eUA8NxNad+6Gir6AcMN+COA+W8oOP17gvoSuFlUhdM/MZvPP0Gb8GkNk3o2Kfil/
 JjvcHJHCAZv6x1L7jhFhAmTUvR9ibmMJDmXJM2tIHvS1HrHNfKAIyxy00GAVg7TN
 f5Iv0+vqB7C6PHzMYIIQpZ3hrJL2GR6jdToPdAWIfr5BzugglDIRUlhEIsxhSXQn
 WMmoif5bKS8wxQRyP2F3FPv+eKYT2XVlVri3LHBkqKbkJW/sqJWHHFGIdaDrwVhX
 vZlmkT07PD3jbQ==
 =OS2H
 -----END PGP SIGNATURE-----

Merge tag 'irq-drivers-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq controller updates from Thomas Gleixner:
 "Update for interrupt chip drivers:

   - Convert the generic interrupt chip to lock guards to remove copy &
     pasta boilerplate code and gotos.

   - A new driver fot the interrupt controller in the EcoNet EN751221
     MIPS SoC.

   - Extend the SG2042-MSI driver to support the new SG2044 SoC

   - Updates and cleanups for the (ancient) VT8500 driver

   - Improve the scalability of the ARM GICV4.1 ITS driver by utilizing
     node local copies a VM's interrupt translation table when possible.
     This results in a 12% reduction of VM IPI latency in certain
     workloads.

   - The usual cleanups and improvements all over the place"

* tag 'irq-drivers-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (25 commits)
  irqchip/irq-pruss-intc: Simplify chained interrupt handler setup
  irqchip/gic-v4.1: Use local 4_1 ITS to generate VSGI
  irqchip/econet-en751221: Switch to of_fwnode_handle()
  irqchip/irq-vt8500: Switch to irq_domain_create_*()
  irqchip/econet-en751221: Switch to irq_domain_create_linear()
  irqchip/irq-vt8500: Use fewer global variables and add error handling
  irqchip/irq-vt8500: Use a dedicated chained handler function
  irqchip/irq-vt8500: Don't require 8 interrupts from a chained controller
  irqchip/irq-vt8500: Drop redundant copy of the device node pointer
  irqchip/irq-vt8500: Split up ack/mask functions
  irqchip/sg2042-msi: Fix wrong type cast in sg2044_msi_irq_ack()
  irqchip/sg2042-msi: Add the Sophgo SG2044 MSI interrupt controller
  irqchip/sg2042-msi: Introduce configurable chipinfo for SG2042
  irqchip/sg2042-msi: Rename functions and data structures to be SG2042 agnostic
  dt-bindings: interrupt-controller: Add Sophgo SG2044 MSI controller
  genirq/generic-chip: Fix incorrect lock guard conversions
  genirq/generic-chip: Remove unused lock wrappers
  irqchip: Convert generic irqchip locking to guards
  gpio: mvebu: Convert generic irqchip locking to guard()
  ARM: orion/gpio:: Convert generic irqchip locking to guard()
  ...
2025-05-27 08:00:46 -07:00
Linus Torvalds
b1819ae85e This concerns a crash in the Qualcomm pin controller GPIO
portions when using hogs.
 
 First patch hits into the gpiolib making gpiochip_line_is_valid()
 NULL-tolerant.
 
 Second patch fixes the actual problem.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAmgu4YIACgkQQRCzN7AZ
 XXPjKw/+JsvFeihW6JedAcfeV0NvUzra80cx9ArJMul48v+CR+vpZr0XsdDzH7tn
 19zNqi5jA57uzGruuoI+KR8BxXHYS3bUuzy68zpHgKy4UzJ5pt0ehm3ArbGcA0Nq
 7MCUs9WP3BuOWfwrb1bdeWbFlk9ApO8drqrREmcnZrJRPSBwjG9lkNZwrDz1pUaQ
 Nj/45cq2LQiXY52y2znovDQsnhD6omECeT0hbZ33pNyjmr+cWyIHlZXWrDSADHF8
 nLGgFx/8NpIkBE9vx3+Ch5iHyAO9qCrEFmsaOMJlqIme5eYBuu8noJQUrGVAYRVT
 HA9bsIzDO6ko2ZhWpzr3/0tiJ7IlRPHy9C/9BNnDaH1STwhEtpnBCJkaEiXxb8JD
 oNY9b9NDn3VN8lHMlxjDSryYsgrlcyJ9m6G4SHqa62UHvwp4osScb24Y03O4wxTz
 xSuokmeO2KGHiEdZwHrObrAYSBBxMAq4aENehZbLxy5GswAawhiwJcIoWez9AyNA
 xWkkKwX+YPlB8yFGJREHcON07dhnGHU99HBavYj+RBGeZFl2U7f22s7u8MnM+3Ul
 7kAWwRjwLVTEPTWbAQ7W+GLSAShwkPGSEqZEKvPLXGh9Bg6+UjEx2NCa02Kicpi9
 l5+2rL/xZw10vHFZnXuwwD2wzMe2mgc5VRZFquOXror18exM744=
 =EGi8
 -----END PGP SIGNATURE-----

Merge tag 'pinctrl-v6.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control fixes from Linus Walleij:
 "This deals with a crash in the Qualcomm pin controller GPIO
  parts when using hogs.

  The first patch to gpiolib makes gpiochip_line_is_valid()
  NULL-tolerant.

  The second patch fixes the actual problem"

* tag 'pinctrl-v6.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  pinctrl: qcom: switch to devm_register_sys_off_handler()
  gpiolib: don't crash on enabling GPIO HOG pins
2025-05-22 09:08:54 -07:00
Peng Fan
8b8ef30909 gpio: timberdale: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.

Fixes: 2993d2dd8f ("gpio: timberdale: Make irq_chip immutable")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250522-gpio-fix-v1-4-98ceae7c4c3c@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-22 10:00:08 +02:00
Peng Fan
01e4397d0c gpio: lpc18xx: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.

Fixes: 289e42df13 ("gpio: lpc18xx: Make irq_chip immutable")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250522-gpio-fix-v1-3-98ceae7c4c3c@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-22 10:00:08 +02:00
Peng Fan
3dff3563cc gpio: grgpio: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.

Fixes: a30be40bf1 ("gpio: grgpio: Make irq_chip immutable")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250522-gpio-fix-v1-2-98ceae7c4c3c@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-22 10:00:08 +02:00
Peng Fan
86fabf1b17 gpio: bcm-kona: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.

Fixes: 7b04f98027 ("gpio: bcm-kona: make irq_chip immutable")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250522-gpio-fix-v1-1-98ceae7c4c3c@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-22 10:00:08 +02:00
Peng Fan
4347566404 gpio: davinci: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.

Fixes: 3f50bb3124 ("gpio: davinci: Make irq_chip immutable")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505210606.PudPm5pC-lkp@intel.com/
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250521072048.1053190-1-peng.fan@oss.nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-21 12:11:54 +02:00
Bartosz Golaszewski
0f45b538ba intel-gpio for v6.16-1
* Split GPIO ACPI quirks to its own file
 * Refactored GPIO ACPI library to shrink the code
 
 The following is an automated git shortlog grouped by driver:
 
 gpiolib:
  -  acpi: Update file references in the Documentation and MAINTAINERS
  -  acpi: Move quirks to a separate file
  -  acpi: Add acpi_gpio_need_run_edge_events_on_boot() getter
  -  acpi: Handle deferred list via new API
  -  acpi: Make sure we fill struct acpi_gpio_info
  -  acpi: Switch to use enum in acpi_gpio_in_ignore_list()
  -  acpi: Use temporary variable for struct acpi_gpio_info
  -  acpi: Deduplicate some code in __acpi_find_gpio()
  -  acpi: Reuse struct acpi_gpio_params in struct acpi_gpio_lookup
  -  acpi: Rename par to params for better readability
  -  acpi: Reduce memory footprint for struct acpi_gpio_params
  -  acpi: Remove index parameter from acpi_gpio_property_lookup()
  -  acpi: Improve struct acpi_gpio_info memory footprint
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEqaflIX74DDDzMJJtb7wzTHR8rCgFAmgtn20ACgkQb7wzTHR8
 rChZig//SRA4VGnOF6nZfP985YZ9YjwdPibnxmkWBvyOodpJl3I1iiex1XrbX1MI
 DxfQGDe8OhXWM6LL/569BCdSy5jHVpFGxISueIzz7gQ7WhzeWpC4/zO8wlW4InTy
 xI/GScxqp65Rs0rLy+7OL3OEMSGJZbDLLZuadQnEAVfxRP5jCPDhBQyQBRdrQJyR
 T+exFet5J6eMFvigpVcjCR3/Mlyp8Af/tgagtbL638/kOkfa2cgyMPTVO7Nmunrt
 lLyAZVXytHN7DyhrIxh+H90U38oObix8rNOEXC2wdZMFjan75wOsq/+FxcrJPhzR
 k2FsyVzM5ggcvWcR9gHXxwczSNu6g8wAzn20ibPfbdsVyNiKIyw+0mX8/JUN4mCS
 Nc3xLxPM7cuve09Z6aAm8M1tPpOqrb0ATgv2kjV+yid7SLIEBgeJLru8Js+vjC0V
 Cj+0jtlgUKiaNAo0g0Sp5JrARnJz95bNVTqVYqkcK5fqaFHR9OfI1Zd56Cgi1PBL
 N2xqjlYHwm5QuKaXsq/5/81AmBjlHLkTLSlGo2w3ZRjHyFLVINRBGypZuKYFvZJ1
 tZAgvK4r3GoBC6iJ+aXPy0ggr/oRbL0lIBTa/Za+rDij+rDhRCn1XwLcZ63tEry5
 eJaTazj7lt1v1TXTgJRqqD2W0frSc5Ir7xipG5jcAjPnONPYo0s=
 =WChc
 -----END PGP SIGNATURE-----

Merge tag 'intel-gpio-v6.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel into gpio/for-next

intel-gpio for v6.16-1

* Split GPIO ACPI quirks to its own file
* Refactored GPIO ACPI library to shrink the code

The following is an automated git shortlog grouped by driver:

gpiolib:
 -  acpi: Update file references in the Documentation and MAINTAINERS
 -  acpi: Move quirks to a separate file
 -  acpi: Add acpi_gpio_need_run_edge_events_on_boot() getter
 -  acpi: Handle deferred list via new API
 -  acpi: Make sure we fill struct acpi_gpio_info
 -  acpi: Switch to use enum in acpi_gpio_in_ignore_list()
 -  acpi: Use temporary variable for struct acpi_gpio_info
 -  acpi: Deduplicate some code in __acpi_find_gpio()
 -  acpi: Reuse struct acpi_gpio_params in struct acpi_gpio_lookup
 -  acpi: Rename par to params for better readability
 -  acpi: Reduce memory footprint for struct acpi_gpio_params
 -  acpi: Remove index parameter from acpi_gpio_property_lookup()
 -  acpi: Improve struct acpi_gpio_info memory footprint
2025-05-21 12:04:30 +02:00
Andy Shevchenko
92dc572852 gpiolib: acpi: Move quirks to a separate file
The gpiolib-acpi.c is huge enough even without DMI quirks.
Move them to a separate file for a better maintenance.

No functional change intended.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-05-21 12:25:24 +03:00
Andy Shevchenko
5666a8777a gpiolib: acpi: Add acpi_gpio_need_run_edge_events_on_boot() getter
Add acpi_gpio_need_run_edge_events_on_boot() getter which moves
towards isolating the GPIO ACPI and quirk APIs. It will helps
splitting them completely in the next changes.

No functional changes.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-05-21 12:25:24 +03:00
Andy Shevchenko
a594877663 gpiolib: acpi: Handle deferred list via new API
Introduce a new API and handle deferred list via it which moves
towards isolating the GPIO ACPI and quirk APIs. It will helps
splitting them completely in the next changes.

No functional changes.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-05-21 12:25:23 +03:00
Andy Shevchenko
b24fd5bc8e gpiolib: acpi: Switch to use enum in acpi_gpio_in_ignore_list()
Switch to use enum instead of pointers in acpi_gpio_in_ignore_list()
which moves towards isolating the GPIO ACPI and quirk APIs. It will
helps splitting them completely in the next changes.

No functional changes.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-05-21 12:25:23 +03:00
Andy Shevchenko
7c010d4633 gpiolib: acpi: Make sure we fill struct acpi_gpio_info
The previous refactoring missed the filling of the struct acpi_gpio_info
and that's how the lot of the code got eliminated. Restore those pieces
by passing the pointer all down in the call stack.

With this, the code grows by ~6%, but in conjunction with the previous
refactoring it still gives -387 bytes

add/remove: 2/0 grow/shrink: 5/1 up/down: 852/-35 (817)
Function                                     old     new   delta
acpi_dev_gpio_irq_wake_get_by                129     695    +566
acpi_find_gpio                               216     354    +138
acpi_find_gpio.__UNIQUE_ID_ddebug504           -      56     +56
acpi_dev_gpio_irq_wake_get_by.__UNIQUE_ID_ddebug506       -      56     +56
acpi_populate_gpio_lookup                    536     548     +12
acpi_gpio_property_lookup                    414     426     +12
acpi_get_gpiod_by_index                      307     319     +12
__acpi_find_gpio                             638     603     -35
Total: Before=14154, After=14971, chg +5.77%

As a positive side effect, it improves memory footprint for
struct acpi_gpio_lookup. `pahole` difference before and after:

-       /* size: 64, cachelines: 1, members: 4 */
-       /* member types with holes: 1, total: 1 */

+       /* size: 32, cachelines: 1, members: 4 */

Reported-by: Kees Bakker <kees@ijzerbout.nl>
Closes: https://lore.kernel.org/r/9715c8dd-38df-48fd-a9d1-7a78163dc989@ijzerbout.nl
Fixes: 8b4f52ef7a ("gpiolib: acpi: Deduplicate some code in __acpi_find_gpio()")
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-05-21 12:25:23 +03:00
Andy Shevchenko
f89a915e68 gpiolib: acpi: Use temporary variable for struct acpi_gpio_info
Use temporary variable to access the struct acpi_gpio_info members.
This will help further changes to be cleaner. No functional change
intended.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-05-21 12:25:23 +03:00
Dmitry Baryshkov
fdf6cab17f gpiolib: don't crash on enabling GPIO HOG pins
On Qualcomm platforms if the board uses GPIO hogs msm_pinmux_request()
calls gpiochip_line_is_valid(). After commit 8015443e24 ("gpio: Hide
valid_mask from direct assignments") gpiochip_line_is_valid() uses
gc->gpiodev, which is NULL when GPIO hog pins are being processed.
Thus after this commit using GPIO hogs causes the following crash. In
order to fix this, verify that gc->gpiodev is not NULL.

Note: it is not possible to reorder calls (e.g. by calling
msm_gpio_init() before pinctrl registration or by splitting
pinctrl_register() into _and_init() and pinctrl_enable() and calling the
latter function after msm_gpio_init()) because GPIO chip registration
would fail with EPROBE_DEFER if pinctrl is not enabled at the time of
registration.

pc : gpiochip_line_is_valid+0x4/0x28
lr : msm_pinmux_request+0x24/0x40
sp : ffff8000808eb870
x29: ffff8000808eb870 x28: 0000000000000000 x27: 0000000000000000
x26: 0000000000000000 x25: ffff726240f9d040 x24: 0000000000000000
x23: ffff7262438c0510 x22: 0000000000000080 x21: ffff726243ea7000
x20: ffffab13f2c4e698 x19: 0000000000000080 x18: 00000000ffffffff
x17: ffff726242ba6000 x16: 0000000000000100 x15: 0000000000000028
x14: 0000000000000000 x13: 0000000000002948 x12: 0000000000000003
x11: 0000000000000078 x10: 0000000000002948 x9 : ffffab13f50eb5e8
x8 : 0000000003ecb21b x7 : 000000000000002d x6 : 0000000000000b68
x5 : 0000007fffffffff x4 : ffffab13f52f84a8 x3 : ffff8000808eb804
x2 : ffffab13f1de8190 x1 : 0000000000000080 x0 : 0000000000000000
Call trace:
 gpiochip_line_is_valid+0x4/0x28 (P)
 pin_request+0x208/0x2c0
 pinmux_enable_setting+0xa0/0x2e0
 pinctrl_commit_state+0x150/0x26c
 pinctrl_enable+0x6c/0x2a4
 pinctrl_register+0x3c/0xb0
 devm_pinctrl_register+0x58/0xa0
 msm_pinctrl_probe+0x2a8/0x584
 sdm845_pinctrl_probe+0x20/0x88
 platform_probe+0x68/0xc0
 really_probe+0xbc/0x298
 __driver_probe_device+0x78/0x12c
 driver_probe_device+0x3c/0x160
 __device_attach_driver+0xb8/0x138
 bus_for_each_drv+0x84/0xe0
 __device_attach+0x9c/0x188
 device_initial_probe+0x14/0x20
 bus_probe_device+0xac/0xb0
 deferred_probe_work_func+0x8c/0xc8
 process_one_work+0x208/0x5e8
 worker_thread+0x1b4/0x35c
 kthread+0x144/0x220
 ret_from_fork+0x10/0x20
Code: b5fffba0 17fffff2 9432ec27 f9400400 (f9428800)

Fixes: 8015443e24 ("gpio: Hide valid_mask from direct assignments")
Reported-by: Doug Anderson <dianders@chromium.org>
Closes: https://lore.kernel.org/r/CAD=FV=Vg8_ZOLgLoC4WhFPzhVsxXFC19NrF38W6cW_W_3nFjbw@mail.gmail.com
Tested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/20250513-pinctrl-msm-fix-v2-1-249999af0fc1@oss.qualcomm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-05-20 23:41:29 +02:00
Bartosz Golaszewski
274fd5fe91 gpiolib: remove unneeded #ifdef
We are already within another `#ifdef CONFIG_GPIOLIB_IRQCHIP` in
gpiochip_to_irq() so there's no need for another guard. Remove it.

Acked-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250519-gpio-irq-kconfig-fixes-v1-3-fe6ba1c6116d@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-20 08:45:27 +02:00
Bartosz Golaszewski
8da238b15c gpio: mpc8xxx: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.

Fixes: 7688a54d5b ("gpio: mpc8xxx: Make irq_chip immutable")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505180309.1nosQMkI-lkp@intel.com/
Acked-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250519-gpio-irq-kconfig-fixes-v1-2-fe6ba1c6116d@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-20 08:45:27 +02:00
Bartosz Golaszewski
e2d9a7ead8 gpio: pxa: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.

Fixes: 20117cf426 ("gpio: pxa: Make irq_chip immutable")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505181429.mzyIatOU-lkp@intel.com/
Acked-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250519-gpio-irq-kconfig-fixes-v1-1-fe6ba1c6116d@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-20 08:45:27 +02:00
Jiri Slaby (SUSE)
30b6692ced gpio: idt3243x: Switch to irq_find_mapping()
irq_linear_revmap() is deprecated, so remove all its uses and supersede
them by an identical call to irq_find_mapping().

[ tglx: Fix up subject prefix ]

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/all/20250319092951.37667-44-jirislaby@kernel.org
2025-05-16 21:06:12 +02:00
Jiri Slaby (SUSE)
9cf19f061c gpio: Switch to irq_domain_create_*()
irq_domain_add_*() interfaces are going away as being obsolete now.
Switch to the preferred irq_domain_create_*() ones. Those differ in the
node parameter: They take more generic struct fwnode_handle instead of
struct device_node. Therefore, of_fwnode_handle() is added around the
original parameter.

Note some of the users can likely use dev->fwnode directly instead of
indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not
guaranteed to be set for all, so this has to be investigated on case to
case basis (by people who can actually test with the HW).

[ tglx: Fix up subject prefix ]

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250319092951.37667-18-jirislaby@kernel.org
2025-05-16 21:06:09 +02:00
Peng Fan
20117cf426 gpio: pxa: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"

Constify pxa_muxed_gpio_chip, flag the irq_chip as IRQCHIP_IMMUTABLE,
add the new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-9-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:02:22 +02:00
Peng Fan
2993d2dd8f gpio: timberdale: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"

Constify timbgpio_irqchip, flag the irq_chip as IRQCHIP_IMMUTABLE,
add the new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-8-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:02:22 +02:00
Peng Fan
580b3264cb gpio: xgene-sb: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"

Constify xgene_gpio_sb_irq_chip, flag the irq_chip as IRQCHIP_IMMUTABLE,
add the new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-7-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:02:22 +02:00
Peng Fan
3f50bb3124 gpio: davinci: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"

Constify gpio_irqchip, flag the irq_chip as IRQCHIP_IMMUTABLE, add the
new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-6-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:02:22 +02:00
Peng Fan
62be72bdb0 gpio: davinci: Update irq chip data
Use "struct davinci_gpio_controller *chips" as irq chip data to prepare
for immutable irq chip, then it will be easy to get gpio_chip pointer in
irq mask/unmask.

No functional change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-5-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:02:22 +02:00
Peng Fan
7688a54d5b gpio: mpc8xxx: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"

Flag the irq_chip as IRQCHIP_IMMUTABLE, add the new helper functions,
and call the appropriate gpiolib functions.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-4-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:02:22 +02:00
Peng Fan
289e42df13 gpio: lpc18xx: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"

Constify lpc18xx_gpio_pin_ic, flag the irq_chip as IRQCHIP_IMMUTABLE,
add the new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-3-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:02:22 +02:00
Peng Fan
a30be40bf1 gpio: grgpio: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"

Constify grgpio_irq_chip, flag the irq_chip as IRQCHIP_IMMUTABLE, add the
new helper functions, and call the appropriate gpiolib functions.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-2-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:02:22 +02:00
Peng Fan
7b04f98027 gpio: bcm-kona: make irq_chip immutable
The gpiolib is moving to make irq_chip immutable, otherwise
there is warning: "not an immutable chip, please consider fixing it!"

The bcm_gpio_irq_chip already has irq hooks configured correctly,
bcm_kona_gpio_irq_mask/bcm_kona_gpio_irq_unmask calls gpiochip_disable_irq/
gpiochip_enable_irq, and bcm_kona_gpio_irq_reqres/irq_release_resources
calls gpiochip_reqres_irq/gpiochip_relres_irq.

So just need to  flag it as IRQCHIP_IMMUTABLE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-1-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:02:22 +02:00
Ahmad Fatoum
833c086f22 gpio: TODO: add item about GPIO drivers reading struct gpio_chip::base
drivers/pinctrl/pinctrl-at91.c uses struct gpio_chip::base to find out
which bit to set in a register:

  dev_dbg(npct->dev, "enable pin %u as GPIO\n", offset);

  mask = 1 << (offset - chip->base);

This adds a non-obvious dependency on the global numberspace from the
GPIO driver itself, even if all consumers use the descriptor API.

More such instances may exist and will need to be fixed in the quest for
removal of the global numberspace, so add a reminder about it to the
TODO list.

Link: https://lore.kernel.org/all/1d00c056-3d61-4c22-bedd-3bae0bf1ddc4@pengutronix.de/
Suggested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.kernel.org/r/20250507-gpio-chip-base-readback-v1-1-ade56e38480b@pengutronix.de
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 17:00:22 +02:00
Ahmad Fatoum
0a45c1a002 gpio: mxc: configure dynamic GPIO base for CONFIG_GPIO_SYSFS=n
i.MX GPIO numbering has been deterministic since commit 7e6086d9e5
("gpio/mxc: specify gpio base for device tree probe"), a year after
device tree support was first added back in 2011.

Reverting to dynamically allocated GPIO base now would break most
systems making use of the sysfs API. These systems will be eventually
broken by the removal of the sysfs API, but that would result in GPIO
scripts not working instead of essentially toggling at random according
to probe order, which would happen if we unconditionally set base to -1.

Yet, the warning is annoying and has resulted in many rejected attempts
to remove it over the years[1][2][3].

As the i.MX GPIO driver is device tree only, GPIO_SYSFS is the only
consumer of the deterministic GPIO numbering. Let's therefore restrict the
static base and the warning that comes with it to configurations
with CONFIG_GPIO_SYSFS enabled.

[1]: https://lore.kernel.org/all/20230226205319.1013332-1-dario.binacchi@amarulasolutions.com/
[2]: https://lore.kernel.org/all/20230506085928.933737-2-haibo.chen@nxp.com/
[3]: https://lore.kernel.org/all/20241121145515.3087855-1-catalin.popescu@leica-geosystems.com/

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250507-b4-imx-gpio-base-warning-v2-1-d43d09e2c6bf@pengutronix.de
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-15 16:57:25 +02:00
Bartosz Golaszewski
d3f960365b gpio: ml-ioh: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-12-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:35 +02:00
Bartosz Golaszewski
51227589e8 gpio: mc33880: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-11-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:35 +02:00
Bartosz Golaszewski
dff5a31dcb gpio: mb86s7x: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-10-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:35 +02:00
Bartosz Golaszewski
8f9da4401b gpio: max77620: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-9-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:35 +02:00
Bartosz Golaszewski
66a6d0e5a7 gpio: max732x: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-8-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:35 +02:00
Bartosz Golaszewski
1938913798 gpio: max730x: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-7-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:34 +02:00
Bartosz Golaszewski
75e80b69e1 gpio: max3191x: remove unused callbacks
This driver is input-only and as such doesn't need to define empty set()
and direction_output() callbacks. Remove them.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-6-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:34 +02:00
Bartosz Golaszewski
2e6b7f5ffe gpio: madera: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-5-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:34 +02:00
Bartosz Golaszewski
1a7b6b536d gpio: lpc32xx: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-4-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:34 +02:00
Bartosz Golaszewski
4f71abfef9 gpio: lpc18xx: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-3-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-05-13 15:15:34 +02:00