提交 c2a4bf47 编写于 作者: L Lee Jones 提交者: Linus Walleij

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: NMaxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: NLee Jones <lee.jones@linaro.org>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 e4c02dce
......@@ -460,6 +460,20 @@ static void st_pctl_set_function(struct st_pio_control *pc,
regmap_field_write(alt, val);
}
static unsigned int st_pctl_get_pin_function(struct st_pio_control *pc, int pin)
{
struct regmap_field *alt = pc->alt;
unsigned int val;
int offset = pin * 4;
if (!alt)
return 0;
regmap_field_read(alt, &val);
return (val >> offset) & 0xf;
}
static unsigned long st_pinconf_delay_to_bit(unsigned int delay,
const struct st_pctl_data *data, unsigned long config)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册