From: haojian.zhuang@gmail.com (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 03/10] pinctrl: append method of lookup pinctrl map
Date: Thu, 15 Nov 2012 16:36:32 +0800 [thread overview]
Message-ID: <1352968600-15345-4-git-send-email-haojian.zhuang@gmail.com> (raw)
In-Reply-To: <1352968600-15345-1-git-send-email-haojian.zhuang@gmail.com>
pinctrl driver gets pinctrl map if both group and map type is specified.
In pinctrl-single driver, each pin group is defined in DT file. The pinconf
information is also defined in each pin group.
pinctrl-single driver could store those mask/shift/value information
into pinctrl map. pinconf_get()/pinconf_set() and
pinconf_group_get()/pinconf_group_set() could get those information from
pinctrl map.
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
---
drivers/pinctrl/core.c | 24 ++++++++++++++++++++++++
include/linux/pinctrl/consumer.h | 4 ++++
2 files changed, 28 insertions(+)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 2e39c04..0d36270 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -839,6 +839,30 @@ int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
}
EXPORT_SYMBOL_GPL(pinctrl_select_state);
+const struct pinctrl_map *pinctrl_lookup_map(struct pinctrl *p,
+ const char *name, unsigned type)
+{
+ struct pinctrl_maps *maps_node;
+ struct pinctrl_map const *map;
+ int i;
+
+ for_each_maps(maps_node, i, map) {
+ /* Map must be for this device */
+ if (strcmp(map->ctrl_dev_name, dev_name(p->dev)))
+ continue;
+ if (map->type != type)
+ continue;
+ if (map->type == PIN_MAP_TYPE_MUX_GROUP)
+ if (!strcmp(map->data.mux.group, name))
+ return map;
+ if (map->type == PIN_MAP_TYPE_CONFIGS_GROUP)
+ if (!strcmp(map->data.configs.group_or_pin, name))
+ return map;
+ }
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(pinctrl_lookup_map);
+
static void devm_pinctrl_release(struct device *dev, void *res)
{
pinctrl_put(*(struct pinctrl **)res);
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 4aad3ce..2687515 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -36,6 +36,10 @@ extern struct pinctrl_state * __must_check pinctrl_lookup_state(
struct pinctrl *p,
const char *name);
extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
+extern const struct pinctrl_map * __must_check pinctrl_lookup_map(
+ struct pinctrl *p,
+ const char *name,
+ unsigned type);
extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
extern void devm_pinctrl_put(struct pinctrl *p);
--
1.7.10.4
next prev parent reply other threads:[~2012-11-15 8:36 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-15 8:36 [PATCH v5 0/10] use pinctrl-single in arch mmp Haojian Zhuang
2012-11-15 8:36 ` [PATCH v5 01/10] ARM: mmp: select pinctrl driver Haojian Zhuang
2012-11-15 8:36 ` [PATCH v5 02/10] pinctrl: single: support gpio request and free Haojian Zhuang
2012-11-17 0:44 ` Tony Lindgren
2012-11-20 14:44 ` Linus Walleij
2012-11-15 8:36 ` Haojian Zhuang [this message]
2012-11-17 0:46 ` [PATCH v5 03/10] pinctrl: append method of lookup pinctrl map Tony Lindgren
2012-11-17 15:17 ` Haojian Zhuang
2012-11-15 8:36 ` [PATCH v5 04/10] pinctrl: generic: add input schmitt disable parameter Haojian Zhuang
2012-11-20 14:42 ` Linus Walleij
2012-11-15 8:36 ` [PATCH v5 05/10] pinctrl: single: support pinconf generic Haojian Zhuang
2012-11-17 0:43 ` Tony Lindgren
2012-11-18 4:51 ` Haojian Zhuang
2012-11-18 14:23 ` Haojian Zhuang
2012-11-22 0:08 ` Tony Lindgren
2012-11-22 0:08 ` Tony Lindgren
2012-11-15 8:36 ` [PATCH v5 06/10] ARM: dts: support pinctrl single in pxa910 Haojian Zhuang
2012-11-15 8:36 ` [PATCH v5 07/10] document: devicetree: bind pinconf with pin single Haojian Zhuang
2012-11-26 19:08 ` Stephen Warren
2012-11-15 8:36 ` [PATCH v5 08/10] tty: pxa: configure pin Haojian Zhuang
2012-11-15 8:36 ` [PATCH v5 09/10] i2c: pxa: use devm_kzalloc Haojian Zhuang
2012-11-15 8:36 ` [PATCH v5 10/10] i2c: pxa: configure pinmux Haojian Zhuang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352968600-15345-4-git-send-email-haojian.zhuang@gmail.com \
--to=haojian.zhuang@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).