Skip to content

Commit

Permalink
pinctrl: qcom: spmi-gpio: Fix the GPIO strength mapping
Browse files Browse the repository at this point in the history
The SPMI based PMICs have the HIGH and LOW GPIO output strength mappings
interchanged, fix them.

Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Link: https://lore.kernel.org/r/20220912210624.4527-3-quic_amelende@quicinc.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Anjelique Melendez authored and Linus Walleij committed Sep 19, 2022
1 parent 4af95d0 commit 723e846
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -439,7 +442,17 @@ static int pmic_gpio_config_get(struct pinctrl_dev *pctldev,
arg = pad->pullup;
break;
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;
case PMIC_GPIO_CONF_ATEST:
arg = pad->atest;
Expand Down Expand Up @@ -526,7 +539,17 @@ 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;
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;
case PMIC_GPIO_CONF_ATEST:
if (!pad->lv_mv_type || arg > 4)
Expand Down

0 comments on commit 723e846

Please sign in to comment.