sh-pfc: Use pinmux identifiers in the pin muxing API
The PFC core exposes a sh_pfc_config_gpio() function that configures
pinmuxing for a given GPIO (either a real GPIO or a function GPIO).
Handling of real and function GPIOs belong to the GPIO layer, move the
GPIO number to mark translation to the caller and rename the function to
sh_pfc_config_mux().
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index 454c965..3ad938f 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -135,23 +135,21 @@
static int gpio_function_request(struct gpio_chip *gc, unsigned offset)
{
struct sh_pfc *pfc = gpio_to_pfc(gc);
- unsigned int gpio = gc->base + offset;
+ unsigned int mark = pfc->info->func_gpios[offset].enum_id;
unsigned long flags;
int ret = -EINVAL;
pr_notice_once("Use of GPIO API for function requests is deprecated, convert to pinctrl\n");
- if (pfc->info->func_gpios[offset].enum_id == 0)
+ if (mark == 0)
return ret;
spin_lock_irqsave(&pfc->lock, flags);
- if (sh_pfc_config_gpio(pfc, gpio, PINMUX_TYPE_FUNCTION,
- GPIO_CFG_DRYRUN))
+ if (sh_pfc_config_mux(pfc, mark, PINMUX_TYPE_FUNCTION, GPIO_CFG_DRYRUN))
goto done;
- if (sh_pfc_config_gpio(pfc, gpio, PINMUX_TYPE_FUNCTION,
- GPIO_CFG_REQ))
+ if (sh_pfc_config_mux(pfc, mark, PINMUX_TYPE_FUNCTION, GPIO_CFG_REQ))
goto done;
ret = 0;
@@ -164,12 +162,12 @@
static void gpio_function_free(struct gpio_chip *gc, unsigned offset)
{
struct sh_pfc *pfc = gpio_to_pfc(gc);
- unsigned int gpio = gc->base + offset;
+ unsigned int mark = pfc->info->func_gpios[offset].enum_id;
unsigned long flags;
spin_lock_irqsave(&pfc->lock, flags);
- sh_pfc_config_gpio(pfc, gpio, PINMUX_TYPE_FUNCTION, GPIO_CFG_FREE);
+ sh_pfc_config_mux(pfc, mark, PINMUX_TYPE_FUNCTION, GPIO_CFG_FREE);
spin_unlock_irqrestore(&pfc->lock, flags);
}