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 @@
#define PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS 1
#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 */
#define PMIC_GPIO_REG_MASTER_EN_SHIFT 7
......@@ -439,8 +442,18 @@ static int pmic_gpio_config_get(struct pinctrl_dev *pctldev,
arg = pad->pullup;
break;
case PMIC_GPIO_CONF_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;
case PMIC_GPIO_CONF_ATEST:
arg = pad->atest;
break;
......@@ -526,8 +539,18 @@ static int pmic_gpio_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
case PMIC_GPIO_CONF_STRENGTH:
if (arg > PMIC_GPIO_STRENGTH_LOW)
return -EINVAL;
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;
case PMIC_GPIO_CONF_ATEST:
if (!pad->lv_mv_type || arg > 4)
return -EINVAL;
......
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