Skip to content

Commit 4635c0e

Browse files
QSchulzlinusw
authored andcommitted
pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback
Before the split of gpio and pinctrl sections in their own driver, rockchip_set_mux was called in pinmux_ops.gpio_set_direction for configuring a pin in its GPIO function. This is essential for cases where pinctrl is "bypassed" by gpio consumers otherwise the GPIO function is not configured for the pin and it does not work. Such was the case for the sysfs/libgpiod userspace GPIO handling. Let's re-implement the pinmux_ops.gpio_set_direction callback so that the gpio subsystem can request from the pinctrl driver to put the pin in its GPIO function. Fixes: 9ce9a02 ("pinctrl/rockchip: drop the gpio related codes") Cc: [email protected] Reviewed-by: Heiko Stuebner <[email protected]> Signed-off-by: Quentin Schulz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent ee6cac3 commit 4635c0e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/pinctrl/pinctrl-rockchip.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,11 +2665,24 @@ static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
26652665
return 0;
26662666
}
26672667

2668+
static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
2669+
struct pinctrl_gpio_range *range,
2670+
unsigned offset,
2671+
bool input)
2672+
{
2673+
struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
2674+
struct rockchip_pin_bank *bank;
2675+
2676+
bank = pin_to_bank(info, offset);
2677+
return rockchip_set_mux(bank, offset - bank->pin_base, RK_FUNC_GPIO);
2678+
}
2679+
26682680
static const struct pinmux_ops rockchip_pmx_ops = {
26692681
.get_functions_count = rockchip_pmx_get_funcs_count,
26702682
.get_function_name = rockchip_pmx_get_func_name,
26712683
.get_function_groups = rockchip_pmx_get_groups,
26722684
.set_mux = rockchip_pmx_set,
2685+
.gpio_set_direction = rockchip_pmx_gpio_set_direction,
26732686
};
26742687

26752688
/*

0 commit comments

Comments
 (0)