git.openpandora.org
/
pandora-u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0708bdd
)
gpio: msm: return correct value return for special output pins
author
Neil Armstrong
<neil.armstrong@linaro.org>
Tue, 1 Apr 2025 07:45:20 +0000
(09:45 +0200)
committer
Caleb Connolly
<caleb.connolly@linaro.org>
Fri, 11 Apr 2025 13:24:54 +0000
(15:24 +0200)
When a special pin is output only, the current code would return 0,
but if the pin is output only we can get the output value.
Try to return the output value and in all the other cases return
an error instead of 0.
Fixes:
f9bb539460d
("gpio: msm: add support for special pins")
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link:
https://lore.kernel.org/r/20250401-topic-sm8x50-msm-gpio-special-fixes-v1-2-a1148a02bb16@linaro.org
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
drivers/gpio/msm_gpio.c
patch
|
blob
|
history
diff --git
a/drivers/gpio/msm_gpio.c
b/drivers/gpio/msm_gpio.c
index
f208eec
..
54afd44
100644
(file)
--- a/
drivers/gpio/msm_gpio.c
+++ b/
drivers/gpio/msm_gpio.c
@@
-172,12
+172,19
@@
static int msm_gpio_get_value_special(struct msm_gpio_bank *priv, unsigned int g
const struct msm_special_pin_data *data;
if (!priv->pin_data->special_pins_data)
- return
0
;
+ return
-EINVAL
;
data = &priv->pin_data->special_pins_data[offset];
- if (!data->io_reg || data->in_bit >= 31)
- return 0;
+ if (!data->io_reg)
+ return -EINVAL;
+
+ if (data->in_bit >= 31) {
+ if (data->out_bit >= 31)
+ return -EINVAL;
+
+ return !!(readl(priv->base + data->io_reg) >> data->out_bit);
+ }
return !!(readl(priv->base + data->io_reg) >> data->in_bit);
}