lkml.org 
[lkml]   [2015]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/6] pinctrl: st: Introduce a 'get pin function' call
Date
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.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/pinctrl/pinctrl-st.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index 9e5ec00..5362e45 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,
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)
{
--
1.9.1


\
 
 \ /
  Last update: 2015-03-18 12:01    [W:0.083 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site