* [PATCH v2 1/2] pinctrl: show pin name when request pins
@ 2012-04-17 7:00 Dong Aisheng
2012-04-17 7:00 ` [PATCH v2 2/2] pinctrl: show pin name for pingroups in sysfs Dong Aisheng
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Dong Aisheng @ 2012-04-17 7:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Dong Aisheng <dong.aisheng@linaro.org>
Pin name is more useful to users.
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
No changes since v1.
After change, when call pinctrl_get_*, the debug information becomes :
pinctrl-imx 20e0000.iomuxc: request pin 305 (MX6Q_PAD_SD4_CMD) for 219c000.usdhc
pinctrl-imx 20e0000.iomuxc: request pin 306 (MX6Q_PAD_SD4_CLK) for 219c000.usdhc
---
drivers/pinctrl/pinmux.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index c494c37..fa0357b 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -88,8 +88,6 @@ static int pin_request(struct pinctrl_dev *pctldev,
const struct pinmux_ops *ops = pctldev->desc->pmxops;
int status = -EINVAL;
- dev_dbg(pctldev->dev, "request pin %d for %s\n", pin, owner);
-
desc = pin_desc_get(pctldev, pin);
if (desc == NULL) {
dev_err(pctldev->dev,
@@ -97,6 +95,9 @@ static int pin_request(struct pinctrl_dev *pctldev,
goto out;
}
+ dev_dbg(pctldev->dev, "request pin %d (%s) for %s\n",
+ pin, desc->name, owner);
+
if (gpio_range) {
/* There's no need to support multiple GPIO requests */
if (desc->gpio_owner) {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] pinctrl: show pin name for pingroups in sysfs
2012-04-17 7:00 [PATCH v2 1/2] pinctrl: show pin name when request pins Dong Aisheng
@ 2012-04-17 7:00 ` Dong Aisheng
2012-04-17 19:55 ` Stephen Warren
2012-04-18 11:41 ` Linus Walleij
2012-04-17 19:53 ` [PATCH v2 1/2] pinctrl: show pin name when request pins Stephen Warren
2012-04-18 11:38 ` Linus Walleij
2 siblings, 2 replies; 6+ messages in thread
From: Dong Aisheng @ 2012-04-17 7:00 UTC (permalink / raw)
To: linux-arm-kernel
From: Dong Aisheng <dong.aisheng@linaro.org>
Pin name is more useful to users.
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
Changes v1->v2:
1) add WARN_ON if no pin name found.
2) separate pin request change in another patch
After change, when cat pingroups in sysfs, it becomes:
root at freescale /sys/kernel/debug/pinctrl/20e0000.iomuxc$ cat pingroups
registered pin groups:
group: uart4grp-1
pin 219 (MX6Q_PAD_KEY_ROW0)
pin 218 (MX6Q_PAD_KEY_COL0)
group: usdhc4grp-1
pin 305 (MX6Q_PAD_SD4_CMD)
pin 306 (MX6Q_PAD_SD4_CLK)
pin 315 (MX6Q_PAD_SD4_DAT0)
pin 316 (MX6Q_PAD_SD4_DAT1)
pin 317 (MX6Q_PAD_SD4_DAT2)
pin 318 (MX6Q_PAD_SD4_DAT3)
pin 319 (MX6Q_PAD_SD4_DAT4)
pin 320 (MX6Q_PAD_SD4_DAT5)
pin 321 (MX6Q_PAD_SD4_DAT6)
pin 322 (MX6Q_PAD_SD4_DAT7)
---
drivers/pinctrl/core.c | 32 ++++++++++++++++++++++++++++----
drivers/pinctrl/core.h | 1 +
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 59027ab..3530e58 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -125,6 +125,25 @@ int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name)
}
/**
+ * pin_get_name_from_id() - look up a pin name from a pin id
+ * @pctldev: the pin control device to lookup the pin on
+ * @name: the name of the pin to look up
+ */
+const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin)
+{
+ const struct pin_desc *desc;
+
+ desc = pin_desc_get(pctldev, pin);
+ if (desc == NULL) {
+ dev_err(pctldev->dev, "failed to get pin(%d) name\n",
+ pin);
+ return NULL;
+ }
+
+ return desc->name;
+}
+
+/**
* pin_is_valid() - check if pin exists on controller
* @pctldev: the pin control device to check the pin on
* @pin: pin to check, use the local pin controller index number
@@ -955,6 +974,7 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
const unsigned *pins;
unsigned num_pins;
const char *gname = ops->get_group_name(pctldev, selector);
+ const char *pname;
int ret;
int i;
@@ -964,10 +984,14 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
seq_printf(s, "%s [ERROR GETTING PINS]\n",
gname);
else {
- seq_printf(s, "group: %s, pins = [ ", gname);
- for (i = 0; i < num_pins; i++)
- seq_printf(s, "%d ", pins[i]);
- seq_puts(s, "]\n");
+ seq_printf(s, "group: %s\n", gname);
+ for (i = 0; i < num_pins; i++) {
+ pname = pin_get_name(pctldev, pins[i]);
+ if (WARN_ON(!pname))
+ return -EINVAL;
+ seq_printf(s, "pin %d (%s)\n", pins[i], pname);
+ }
+ seq_puts(s, "\n");
}
selector++;
}
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index 98ae808..1f40ff6 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -148,6 +148,7 @@ struct pin_desc {
struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
+const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin);
int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
const char *pin_group);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] pinctrl: show pin name when request pins
2012-04-17 7:00 [PATCH v2 1/2] pinctrl: show pin name when request pins Dong Aisheng
2012-04-17 7:00 ` [PATCH v2 2/2] pinctrl: show pin name for pingroups in sysfs Dong Aisheng
@ 2012-04-17 19:53 ` Stephen Warren
2012-04-18 11:38 ` Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2012-04-17 19:53 UTC (permalink / raw)
To: linux-arm-kernel
On 04/17/2012 01:00 AM, Dong Aisheng wrote:
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Pin name is more useful to users.
>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] pinctrl: show pin name for pingroups in sysfs
2012-04-17 7:00 ` [PATCH v2 2/2] pinctrl: show pin name for pingroups in sysfs Dong Aisheng
@ 2012-04-17 19:55 ` Stephen Warren
2012-04-18 11:41 ` Linus Walleij
1 sibling, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2012-04-17 19:55 UTC (permalink / raw)
To: linux-arm-kernel
On 04/17/2012 01:00 AM, Dong Aisheng wrote:
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Pin name is more useful to users.
...
> @@ -964,10 +984,14 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
> seq_printf(s, "%s [ERROR GETTING PINS]\n",
> gname);
> else {
> - seq_printf(s, "group: %s, pins = [ ", gname);
> - for (i = 0; i < num_pins; i++)
> - seq_printf(s, "%d ", pins[i]);
> - seq_puts(s, "]\n");
> + seq_printf(s, "group: %s\n", gname);
> + for (i = 0; i < num_pins; i++) {
> + pname = pin_get_name(pctldev, pins[i]);
> + if (WARN_ON(!pname))
> + return -EINVAL;
The main issue I had here was that the loop should continue rather than
erroring out. Still, I suppose this condition "can't" happen, so perhaps
that isn't such a big deal after all. So:
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
> + seq_printf(s, "pin %d (%s)\n", pins[i], pname);
> + }
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] pinctrl: show pin name when request pins
2012-04-17 7:00 [PATCH v2 1/2] pinctrl: show pin name when request pins Dong Aisheng
2012-04-17 7:00 ` [PATCH v2 2/2] pinctrl: show pin name for pingroups in sysfs Dong Aisheng
2012-04-17 19:53 ` [PATCH v2 1/2] pinctrl: show pin name when request pins Stephen Warren
@ 2012-04-18 11:38 ` Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2012-04-18 11:38 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 17, 2012 at 9:00 AM, Dong Aisheng <b29396@freescale.com> wrote:
> From: Dong Aisheng <dong.aisheng@linaro.org>
>
> Pin name is more useful to users.
>
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Thanks, applied with Stephen's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] pinctrl: show pin name for pingroups in sysfs
2012-04-17 7:00 ` [PATCH v2 2/2] pinctrl: show pin name for pingroups in sysfs Dong Aisheng
2012-04-17 19:55 ` Stephen Warren
@ 2012-04-18 11:41 ` Linus Walleij
1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2012-04-18 11:41 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 17, 2012 at 9:00 AM, Dong Aisheng <b29396@freescale.com> wrote:
> After change, when cat pingroups in sysfs, it becomes:
> root at freescale /sys/kernel/debug/pinctrl/20e0000.iomuxc$ cat pingroups
> registered pin groups:
> group: uart4grp-1
> pin 219 (MX6Q_PAD_KEY_ROW0)
> pin 218 (MX6Q_PAD_KEY_COL0)
>
> group: usdhc4grp-1
> pin 305 (MX6Q_PAD_SD4_CMD)
> pin 306 (MX6Q_PAD_SD4_CLK)
> pin 315 (MX6Q_PAD_SD4_DAT0)
> pin 316 (MX6Q_PAD_SD4_DAT1)
> pin 317 (MX6Q_PAD_SD4_DAT2)
> pin 318 (MX6Q_PAD_SD4_DAT3)
> pin 319 (MX6Q_PAD_SD4_DAT4)
> pin 320 (MX6Q_PAD_SD4_DAT5)
> pin 321 (MX6Q_PAD_SD4_DAT6)
> pin 322 (MX6Q_PAD_SD4_DAT7)
Applied with this bit copied into the commit message and Stepgen's ACK.
Thanks!
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-04-18 11:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-17 7:00 [PATCH v2 1/2] pinctrl: show pin name when request pins Dong Aisheng
2012-04-17 7:00 ` [PATCH v2 2/2] pinctrl: show pin name for pingroups in sysfs Dong Aisheng
2012-04-17 19:55 ` Stephen Warren
2012-04-18 11:41 ` Linus Walleij
2012-04-17 19:53 ` [PATCH v2 1/2] pinctrl: show pin name when request pins Stephen Warren
2012-04-18 11:38 ` Linus Walleij
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).