Skip to content

fix gpio-sysfs/libgpiod for rockchip

Quentin Schulz linux-arm-kernel linux-gpio linux-rockchip lkml stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- fix missing header; reported by kernel test robot <[email protected]>

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2pinctrl: rockchip: add pinmux_ops.gpio_set_direction callbackdrivers/pinctrl/pinctrl-rockchip.c+13 -00 replies
2/2gpio: rockchip: request GPIO mux to pinctrl when setting directiondrivers/gpio/gpio-rockchip.c+7 -00 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchHeiko Stuebner
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] fix gpio-sysfs/libgpiod for rockchip

From: Quentin Schulz <[email protected]>

Since the split of gpio and pinctrl in their own driver, gpio-sysfs and libgpiod userspace GPIO handling has been broken because the pins aren't put into their GPIO function anymore since pinctrl subsystem is "bypassed" when requesting GPIOs from userspace.

This fixes it by making the gpio driver actually request from the pinctrl subsystem to put the pin in its GPIO function when the GPIO direction is set in userspace.

I discovered the issue because we have a GPIO the user needs to control from userspace to flash FW on an on-board STM32 that is actually on the same pin as one used by the flash controller. Considering the storage medium tried by the BOOTROM is emmc->nor->nand->sdmmc, booting from emmc didn't show the issue because the default function for pins is GPIO and the flash controller pins didn't need to be muxed by the BOOTROM. However, if there's nothing on emmc, the BOOTROM does the pinmux for SPI controller and puts the pins in their flash mode and therefore the handling of that pin as a GPIO from userspace was not possible, but only when booting on something else than eMMC.

This restores the behavior as seen in v5.14 and earlier.

v2:
- fix missing header; reported by kernel test robot <[email protected]>

Cheers,
Quentin

Quentin Schulz (2):
pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback
gpio: rockchip: request GPIO mux to pinctrl when setting direction

 drivers/gpio/gpio-rockchip.c       |  7 +++++++
 drivers/pinctrl/pinctrl-rockchip.c | 13 +++++++++++++
 2 files changed, 20 insertions(+)
Signature · 1 line
2.37.3