[PATCH 0/2] gpio/pinctrl: spacemit: Add GPIO pin configuration support for K1

Junhui Liu posted 2 patches 3 weeks, 5 days ago
drivers/gpio/gpio-spacemit-k1.c       |  1 +
drivers/pinctrl/spacemit/pinctrl-k1.c | 21 ++++++++++++---------
2 files changed, 13 insertions(+), 9 deletions(-)
[PATCH 0/2] gpio/pinctrl: spacemit: Add GPIO pin configuration support for K1
Posted by Junhui Liu 3 weeks, 5 days ago
This add GPIO pin configuration support for the Spacemit K1 SoC. Some
use cases require configuring pin attributes like pull-up/down when using
GPIO lines.

A practical example is the SD card detection pin on the Banana Pi BPI-F3
board. Since it lacks an external pull-up circuit, the pin must be
configured with an internal pull-up to function correctly. Such
configurations can be specified directly in the devicetree:

    cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;

To address this, add the set_config() callback to the gpio-spacemit-k1
driver to enable pin configuration through pinctrl, and modify the
pinctrl driver to return -ENOTSUPP instead of -EINVAL for unsupported
parameters, allowing the GPIO subsystem to gracefully handle them.

---
Junhui Liu (2):
      pinctrl: spacemit: return -ENOTSUPP for unsupported pin configurations
      gpio: spacemit-k1: Add set_config callback support

 drivers/gpio/gpio-spacemit-k1.c       |  1 +
 drivers/pinctrl/spacemit/pinctrl-k1.c | 21 ++++++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)
---
base-commit: b29fb8829bff243512bb8c8908fd39406f9fd4c3
change-id: 20260312-k1-gpio-set-config-f0873e92ebac

Best regards,
-- 
Junhui Liu <junhui.liu@pigmoral.tech>
Re: [PATCH 0/2] gpio/pinctrl: spacemit: Add GPIO pin configuration support for K1
Posted by Linus Walleij 2 weeks, 5 days ago
Thank Junhui,

On Thu, Mar 12, 2026 at 9:43 AM Junhui Liu <junhui.liu@pigmoral.tech> wrote:

> This add GPIO pin configuration support for the Spacemit K1 SoC. Some
> use cases require configuring pin attributes like pull-up/down when using
> GPIO lines.
>
> A practical example is the SD card detection pin on the Banana Pi BPI-F3
> board. Since it lacks an external pull-up circuit, the pin must be
> configured with an internal pull-up to function correctly. Such
> configurations can be specified directly in the devicetree:
>
>     cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
>
> To address this, add the set_config() callback to the gpio-spacemit-k1
> driver to enable pin configuration through pinctrl, and modify the
> pinctrl driver to return -ENOTSUPP instead of -EINVAL for unsupported
> parameters, allowing the GPIO subsystem to gracefully handle them.
>
> ---
> Junhui Liu (2):
>       pinctrl: spacemit: return -ENOTSUPP for unsupported pin configurations
>       gpio: spacemit-k1: Add set_config callback support

Both patches applied to the pinctrl tree.

Yours,
Linus Walleij
Re: [PATCH 0/2] gpio/pinctrl: spacemit: Add GPIO pin configuration support for K1
Posted by Yixun Lan 3 weeks, 5 days ago
Hi Junhui, 

On 16:42 Thu 12 Mar     , Junhui Liu wrote:
> This add GPIO pin configuration support for the Spacemit K1 SoC. Some
> use cases require configuring pin attributes like pull-up/down when using
> GPIO lines.
> 
> A practical example is the SD card detection pin on the Banana Pi BPI-F3
> board. Since it lacks an external pull-up circuit, the pin must be
> configured with an internal pull-up to function correctly. Such
> configurations can be specified directly in the devicetree:
> 
>     cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> 
> To address this, add the set_config() callback to the gpio-spacemit-k1
> driver to enable pin configuration through pinctrl, and modify the
> pinctrl driver to return -ENOTSUPP instead of -EINVAL for unsupported
> parameters, allowing the GPIO subsystem to gracefully handle them.
> 
Thanks for working on this, for the series

Reviewed-by: Yixun Lan <dlan@kernel.org>

> ---
> Junhui Liu (2):
>       pinctrl: spacemit: return -ENOTSUPP for unsupported pin configurations
>       gpio: spacemit-k1: Add set_config callback support
> 
>  drivers/gpio/gpio-spacemit-k1.c       |  1 +
>  drivers/pinctrl/spacemit/pinctrl-k1.c | 21 ++++++++++++---------
>  2 files changed, 13 insertions(+), 9 deletions(-)
> ---
> base-commit: b29fb8829bff243512bb8c8908fd39406f9fd4c3
> change-id: 20260312-k1-gpio-set-config-f0873e92ebac
> 
> Best regards,
> -- 
> Junhui Liu <junhui.liu@pigmoral.tech>
> 

-- 
Yixun Lan (dlan)