| From 32201cfd929daf5e2319de8940f546006dd51c53 Mon Sep 17 00:00:00 2001 |
| From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= |
| <niklas.soderlund+renesas@ragnatech.se> |
| Date: Sat, 12 Nov 2016 17:04:24 +0100 |
| Subject: [PATCH] pinctrl: sh-pfc: Do not unconditionally support |
| PIN_CONFIG_BIAS_DISABLE |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| commit 5d7400c4acbf7fe633a976a89ee845f7333de3e4 upstream. |
| |
| 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() is implemented but the pin is not handled by |
| the get_bias() implementation. In that case the output will state that |
| "input bias disabled" indicating that this pin has bias control |
| support. |
| |
| Make support for PIN_CONFIG_BIAS_DISABLE depend on that the pin either |
| supports 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 their particular implementation of {set,get}_bias() is called with a |
| pin it does not know about. |
| |
| Signed-off-by: Niklas Sรถderlund <niklas.soderlund+renesas@ragnatech.se> |
| Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
| Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c |
| index e208ee04a9f4..f44e35b7a019 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; |
| -- |
| 2.10.1 |
| |