diff mbox

[1/2] pinctrl: sh-pfc: Do not unconditionally support PIN_CONFIG_BIAS_DISABLE

Message ID 20161103153421.15527-2-niklas.soderlund+renesas@ragnatech.se
State New
Headers show

Commit Message

Niklas Söderlund Nov. 3, 2016, 3:34 p.m. UTC
Always stating PIN_CONFIG_BIAS_DISABLE is supported gives untrue output
when examining /sys/kernel/debug/pinctrl/e6060000.pfc/pinconf-pins if
the operation get_bias() are implemented but the pin are not handled by
the get_bias() implementation. In that case the output will state that
"input bias disabled" indicating that this pin have bias control
support.

Make support for PIN_CONFIG_BIAS_DISABLE depend on that the pin either
support SH_PFC_PIN_CFG_PULL_UP or SH_PFC_PIN_CFG_PULL_DOWN. This also
solves the issue where SoC specific implementations print error messages
if there particular implementation of {set,get}_bias() is called with a
pin it do not know about.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/pinctrl/sh-pfc/pinctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Nov. 3, 2016, 4:55 p.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Thursday 03 Nov 2016 16:34:20 Niklas Söderlund wrote:
> Always stating PIN_CONFIG_BIAS_DISABLE is supported gives untrue output
> when examining /sys/kernel/debug/pinctrl/e6060000.pfc/pinconf-pins if
> the operation get_bias() are implemented but the pin are not handled by
> the get_bias() implementation. In that case the output will state that
> "input bias disabled" indicating that this pin have bias control
> support.
> 
> Make support for PIN_CONFIG_BIAS_DISABLE depend on that the pin either
> support SH_PFC_PIN_CFG_PULL_UP or SH_PFC_PIN_CFG_PULL_DOWN. This also
> solves the issue where SoC specific implementations print error messages
> if there particular implementation of {set,get}_bias() is called with a
> pin it do not know about.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/pinctrl/sh-pfc/pinctrl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c
> b/drivers/pinctrl/sh-pfc/pinctrl.c index c577258..fcacfa7 100644
> --- a/drivers/pinctrl/sh-pfc/pinctrl.c
> +++ b/drivers/pinctrl/sh-pfc/pinctrl.c
> @@ -570,7 +570,8 @@ static bool sh_pfc_pinconf_validate(struct sh_pfc *pfc,
> unsigned int _pin,
> 
>  	switch (param) {
>  	case PIN_CONFIG_BIAS_DISABLE:
> -		return true;
> +		return pin->configs &
> +			(SH_PFC_PIN_CFG_PULL_UP | SH_PFC_PIN_CFG_PULL_DOWN);
> 
>  	case PIN_CONFIG_BIAS_PULL_UP:
>  		return pin->configs & SH_PFC_PIN_CFG_PULL_UP;
Geert Uytterhoeven Nov. 7, 2016, 10:33 a.m. UTC | #2
On Thu, Nov 3, 2016 at 4:34 PM, Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> Always stating PIN_CONFIG_BIAS_DISABLE is supported gives untrue output
> when examining /sys/kernel/debug/pinctrl/e6060000.pfc/pinconf-pins if
> the operation get_bias() are implemented but the pin are not handled by

is implemented
is not handled

> the get_bias() implementation. In that case the output will state that
> "input bias disabled" indicating that this pin have bias control

has

> support.
>
> Make support for PIN_CONFIG_BIAS_DISABLE depend on that the pin either
> support SH_PFC_PIN_CFG_PULL_UP or SH_PFC_PIN_CFG_PULL_DOWN. This also

supports

> solves the issue where SoC specific implementations print error messages
> if there particular implementation of {set,get}_bias() is called with a

their

> pin it do not know about.

does

> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
index c577258..fcacfa7 100644
--- a/drivers/pinctrl/sh-pfc/pinctrl.c
+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
@@ -570,7 +570,8 @@  static bool sh_pfc_pinconf_validate(struct sh_pfc *pfc, unsigned int _pin,
 
 	switch (param) {
 	case PIN_CONFIG_BIAS_DISABLE:
-		return true;
+		return pin->configs &
+			(SH_PFC_PIN_CFG_PULL_UP | SH_PFC_PIN_CFG_PULL_DOWN);
 
 	case PIN_CONFIG_BIAS_PULL_UP:
 		return pin->configs & SH_PFC_PIN_CFG_PULL_UP;