diff options
author | Lee Jones <lee.jones@linaro.org> | 2015-03-18 13:21:15 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-03-25 11:35:10 -0400 |
commit | c2a4bf47089823bb76d2498eebda922ecf99546d (patch) | |
tree | 2156c819cb6af78e12b7cee8a13d780a2fc0bdbf /drivers/pinctrl | |
parent | e4c02dced975cbb3e7cb097a0895ce0143b3386a (diff) |
pinctrl: st: Introduce a 'get pin function' call
This call fetches the numerical function value a specified pin is
currently operating in. Function zero is more often than not the
GPIO function. Greater than zero values represent an alternative
function. You'd need to either look those up in the Device Tree
sources or the Programmer's Manual.
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-st.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 9e5ec00084bb..5362e45e8cd5 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c | |||
@@ -460,6 +460,20 @@ static void st_pctl_set_function(struct st_pio_control *pc, | |||
460 | regmap_field_write(alt, val); | 460 | regmap_field_write(alt, val); |
461 | } | 461 | } |
462 | 462 | ||
463 | static unsigned int st_pctl_get_pin_function(struct st_pio_control *pc, int pin) | ||
464 | { | ||
465 | struct regmap_field *alt = pc->alt; | ||
466 | unsigned int val; | ||
467 | int offset = pin * 4; | ||
468 | |||
469 | if (!alt) | ||
470 | return 0; | ||
471 | |||
472 | regmap_field_read(alt, &val); | ||
473 | |||
474 | return (val >> offset) & 0xf; | ||
475 | } | ||
476 | |||
463 | static unsigned long st_pinconf_delay_to_bit(unsigned int delay, | 477 | static unsigned long st_pinconf_delay_to_bit(unsigned int delay, |
464 | const struct st_pctl_data *data, unsigned long config) | 478 | const struct st_pctl_data *data, unsigned long config) |
465 | { | 479 | { |