Commit 723e8462 authored by Anjelique Melendez's avatar Anjelique Melendez Committed by Linus Walleij

pinctrl: qcom: spmi-gpio: Fix the GPIO strength mapping

The SPMI based PMICs have the HIGH and LOW GPIO output strength mappings
interchanged, fix them.
Signed-off-by: default avatarAnjelique Melendez <quic_amelende@quicinc.com>
Link: https://lore.kernel.org/r/20220912210624.4527-3-quic_amelende@quicinc.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 4af95d09
...@@ -101,6 +101,9 @@ ...@@ -101,6 +101,9 @@
#define PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS 1 #define PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS 1
#define PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS 2 #define PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS 2
#define PMIC_GPIO_OUT_STRENGTH_LOW 1
#define PMIC_GPIO_OUT_STRENGTH_HIGH 3
/* PMIC_GPIO_REG_EN_CTL */ /* PMIC_GPIO_REG_EN_CTL */
#define PMIC_GPIO_REG_MASTER_EN_SHIFT 7 #define PMIC_GPIO_REG_MASTER_EN_SHIFT 7
...@@ -439,7 +442,17 @@ static int pmic_gpio_config_get(struct pinctrl_dev *pctldev, ...@@ -439,7 +442,17 @@ static int pmic_gpio_config_get(struct pinctrl_dev *pctldev,
arg = pad->pullup; arg = pad->pullup;
break; break;
case PMIC_GPIO_CONF_STRENGTH: case PMIC_GPIO_CONF_STRENGTH:
arg = pad->strength; switch (pad->strength) {
case PMIC_GPIO_OUT_STRENGTH_HIGH:
arg = PMIC_GPIO_STRENGTH_HIGH;
break;
case PMIC_GPIO_OUT_STRENGTH_LOW:
arg = PMIC_GPIO_STRENGTH_LOW;
break;
default:
arg = pad->strength;
break;
}
break; break;
case PMIC_GPIO_CONF_ATEST: case PMIC_GPIO_CONF_ATEST:
arg = pad->atest; arg = pad->atest;
...@@ -526,7 +539,17 @@ static int pmic_gpio_config_set(struct pinctrl_dev *pctldev, unsigned int pin, ...@@ -526,7 +539,17 @@ static int pmic_gpio_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
case PMIC_GPIO_CONF_STRENGTH: case PMIC_GPIO_CONF_STRENGTH:
if (arg > PMIC_GPIO_STRENGTH_LOW) if (arg > PMIC_GPIO_STRENGTH_LOW)
return -EINVAL; return -EINVAL;
pad->strength = arg; switch (arg) {
case PMIC_GPIO_STRENGTH_HIGH:
pad->strength = PMIC_GPIO_OUT_STRENGTH_HIGH;
break;
case PMIC_GPIO_STRENGTH_LOW:
pad->strength = PMIC_GPIO_OUT_STRENGTH_LOW;
break;
default:
pad->strength = arg;
break;
}
break; break;
case PMIC_GPIO_CONF_ATEST: case PMIC_GPIO_CONF_ATEST:
if (!pad->lv_mv_type || arg > 4) if (!pad->lv_mv_type || arg > 4)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment