From: Stephen Warren <swarren@nvidia.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Linus Walleij <linus.walleij@stericsson.com>,
<B29396@freescale.com>, <s.hauer@pengutronix.de>,
<dongas86@gmail.com>, <shawn.guo@linaro.org>,
<thomas.abraham@linaro.org>, <tony@atomide.com>,
<linux-kernel@vger.kernel.org>,
Stephen Warren <swarren@nvidia.com>
Subject: [PATCH 1/3] pinctrl: Introduce PINCTRL_STATE_DEFAULT define, and use it
Date: Thu, 23 Feb 2012 17:04:38 -0700 [thread overview]
Message-ID: <1330041880-12406-1-git-send-email-swarren@nvidia.com> (raw)
This provides a single centralized name for the default state.
Update PIN_MAP_* macros to use this state name, instead of requiring the
user to pass a state name in.
Update documentation and mapping tables to use this.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
These 3 patches are small cleanup/fixes triggered by review comments from
the 20-long series I posted a few days ago.
These patches are based on the 4-long series that I posted yesterday.
Documentation/pinctrl.txt | 8 ++++----
arch/arm/mach-u300/core.c | 6 +++---
include/linux/pinctrl/machine.h | 13 ++++++++-----
include/linux/pinctrl/pinctrl.h | 2 ++
4 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
index fa9163a..8bf46bc 100644
--- a/Documentation/pinctrl.txt
+++ b/Documentation/pinctrl.txt
@@ -814,7 +814,7 @@ it even more compact which assumes you want to use pinctrl-foo and position
0 for mapping, for example:
static struct pinctrl_map __initdata mapping[] = {
- PIN_MAP("I2CMAP", "pinctrl-foo", "i2c0", "foo-i2c.0"),
+ PIN_MAP(PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0", "foo-i2c.0"),
};
@@ -930,7 +930,7 @@ foo_probe()
/* Allocate a state holder named "state" etc */
struct pinctrl p;
- p = pinctrl_get(&device, NULL);
+ p = pinctrl_get(&device, PINCTRL_STATE_DEFAULT);
if IS_ERR(p)
return PTR_ERR(p);
pinctrl_enable(p);
@@ -988,7 +988,7 @@ This is enabled by simply setting the .dev_name field in the map to the name
of the pin controller itself, like this:
{
- .name = "POWERMAP"
+ .name = PINCTRL_STATE_DEFAULT,
.ctrl_dev_name = "pinctrl-foo",
.function = "power_func",
.dev_name = "pinctrl-foo",
@@ -998,7 +998,7 @@ Since it may be common to request the core to hog a few always-applicable
mux settings on the primary pin controller, there is a convenience macro for
this:
-PIN_MAP_PRIMARY_SYS_HOG("POWERMAP", "pinctrl-foo", "power_func")
+PIN_MAP_SYS_HOG("pinctrl-foo", "power_func")
This gives the exact same result as the above construction.
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index d66bc97..2388dc2 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -1554,9 +1554,9 @@ static struct platform_device pinmux_device = {
/* Pinmux settings */
static struct pinctrl_map __initdata u300_pinmux_map[] = {
/* anonymous maps for chip power and EMIFs */
- PIN_MAP_SYS_HOG("POWER", "pinmux-u300", "power"),
- PIN_MAP_SYS_HOG("EMIF0", "pinmux-u300", "emif0"),
- PIN_MAP_SYS_HOG("EMIF1", "pinmux-u300", "emif1"),
+ PIN_MAP_SYS_HOG("pinmux-u300", "power"),
+ PIN_MAP_SYS_HOG("pinmux-u300", "emif0"),
+ PIN_MAP_SYS_HOG("pinmux-u300", "emif1"),
/* per-device maps for MMC/SD, SPI and UART */
PIN_MAP("MMCSD", "pinmux-u300", "mmc0", "mmci"),
PIN_MAP("SPI", "pinmux-u300", "spi0", "pl022"),
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index 400f192..4743f84 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -12,6 +12,8 @@
#ifndef __LINUX_PINCTRL_MACHINE_H
#define __LINUX_PINCTRL_MACHINE_H
+#include "pinctrl.h"
+
/**
* struct pinctrl_map - boards/machines shall provide this map for devices
* @name: the name of this specific map entry for the particular machine.
@@ -49,17 +51,18 @@ struct pinctrl_map {
* Convenience macro to map a system function onto a certain pinctrl device,
* to be hogged by the pin control core until the system shuts down.
*/
-#define PIN_MAP_SYS_HOG(a, b, c) \
- { .name = a, .ctrl_dev_name = b, .dev_name = b, .function = c, }
+#define PIN_MAP_SYS_HOG(a, b) \
+ { .name = PINCTRL_STATE_DEFAULT, .ctrl_dev_name = a, .dev_name = a, \
+ .function = b, }
/*
* Convenience macro to map a system function onto a certain pinctrl device
* using a specified group, to be hogged by the pin control core until the
* system shuts down.
*/
-#define PIN_MAP_SYS_HOG_GROUP(a, b, c, d) \
- { .name = a, .ctrl_dev_name = b, .dev_name = b, .function = c, \
- .group = d, }
+#define PIN_MAP_SYS_HOG_GROUP(a, b, c) \
+ { .name = PINCTRL_STATE_DEFAULT, .ctrl_dev_name = a, .dev_name = a, \
+ .function = b, .group = c, }
#ifdef CONFIG_PINMUX
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 8bd22ee..411fe23 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -19,6 +19,8 @@
#include <linux/list.h>
#include <linux/seq_file.h>
+#define PINCTRL_STATE_DEFAULT "default"
+
struct pinctrl_dev;
struct pinmux_ops;
struct pinconf_ops;
--
1.7.0.4
next reply other threads:[~2012-02-24 0:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-24 0:04 Stephen Warren [this message]
2012-02-24 0:04 ` [PATCH 2/3] pinctrl: Re-order struct pinctrl_map Stephen Warren
2012-02-24 3:31 ` Dong Aisheng
2012-02-24 6:14 ` Linus Walleij
2012-02-24 0:04 ` [PATCH 3/3] pinctrl: Move pinctrl-maps debugfs file to top-level Stephen Warren
2012-02-24 3:47 ` Dong Aisheng
2012-02-24 6:18 ` Linus Walleij
2012-02-24 3:24 ` [PATCH 1/3] pinctrl: Introduce PINCTRL_STATE_DEFAULT define, and use it Dong Aisheng
2012-02-24 5:26 ` Stephen Warren
2012-02-24 7:09 ` Dong Aisheng
2012-02-24 17:32 ` Stephen Warren
2012-02-25 4:16 ` Dong Aisheng
2012-02-24 6:09 ` Linus Walleij
2012-02-24 17:09 ` Stephen Warren
2012-02-24 19:20 ` Stephen Warren
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=1330041880-12406-1-git-send-email-swarren@nvidia.com \
--to=swarren@nvidia.com \
--cc=B29396@freescale.com \
--cc=dongas86@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawn.guo@linaro.org \
--cc=thomas.abraham@linaro.org \
--cc=tony@atomide.com \
/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
all inboxes | Powered by JetHome®