aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan T. Ivanov <ivan.ivanov@linaro.org>2015-04-09 11:18:36 -0400
committerLinus Walleij <linus.walleij@linaro.org>2015-04-28 08:51:45 -0400
commit24a66618d63548e1012bf65ed30a3c031f410ca2 (patch)
tree57b8dc804e41f821fe51fb1ac45b287e397f0dab
parent982df6aec06479c844f46f7a5cc960151f8fc005 (diff)
pinctrl: qcom-spmi-gpio: Fix input value report
Read input buffer when input is enabled, not when it is disabled. Also fix interpretation of the pmic_gpio_read() return code, negative value means an error. Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/qcom/pinctrl-spmi-gpio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index 4b21aac43216..e8b74c69222e 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -466,12 +466,13 @@ static void pmic_gpio_config_dbg_show(struct pinctrl_dev *pctldev,
466 seq_puts(s, " ---"); 466 seq_puts(s, " ---");
467 } else { 467 } else {
468 468
469 if (!pad->input_enabled) { 469 if (pad->input_enabled) {
470 ret = pmic_gpio_read(state, pad, PMIC_MPP_REG_RT_STS); 470 ret = pmic_gpio_read(state, pad, PMIC_MPP_REG_RT_STS);
471 if (!ret) { 471 if (ret < 0)
472 ret &= PMIC_MPP_REG_RT_STS_VAL_MASK; 472 return;
473 pad->out_value = ret; 473
474 } 474 ret &= PMIC_MPP_REG_RT_STS_VAL_MASK;
475 pad->out_value = ret;
475 } 476 }
476 477
477 seq_printf(s, " %-4s", pad->output_enabled ? "out" : "in"); 478 seq_printf(s, " %-4s", pad->output_enabled ? "out" : "in");