From: james.hogan@imgtec.com (James Hogan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] pinctrl: add function to parse generic pinconfig properties from a dt node
Date: Wed, 12 Jun 2013 15:55:12 +0100 [thread overview]
Message-ID: <51B88BD0.805@imgtec.com> (raw)
In-Reply-To: <201306102140.29918.heiko@sntech.de>
Hi Heiko,
On 10/06/13 20:40, Heiko St?bner wrote:
> pinconf_generic_parse_dt_config() takes a node as input and generates an
> array of generic pinconfig values from the properties of this node.
>
> As I couldn't find a mechanism to count the number of properties of a node
> the function uses internally an array to accept one of parameter and copies
> the real present options to a smaller variable at its end.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
<snip>
> @@ -139,3 +140,83 @@ void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
> }
> EXPORT_SYMBOL_GPL(pinconf_generic_dump_config);
> #endif
> +
> +#ifdef CONFIG_OF
> +struct pinconf_generic_dt_params {
> + const char * const property;
> + enum pin_config_param param;
> + u32 default_value;
> +};
> +
> +static struct pinconf_generic_dt_params dt_params[] = {
> + { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 },
> + { "bias-high-impedance", PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0 },
> + { "bias-bus-hold", PIN_CONFIG_BIAS_BUS_HOLD, 0 },
> + { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 0 },
> + { "bias-pull-down", PIN_CONFIG_BIAS_PULL_DOWN, 0 },
> + { "bias-pull-pin-default", PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, 0 },
> + { "drive-push-pull", PIN_CONFIG_DRIVE_PUSH_PULL, 0 },
> + { "drive-open-drain", PIN_CONFIG_DRIVE_OPEN_DRAIN, 0 },
> + { "drive-open-source", PIN_CONFIG_DRIVE_OPEN_SOURCE, 0 },
> + { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 0 },
> + { "input-schmitt-enable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 1 },
> + { "input-schmitt-disable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 0 },
> + { "input-schmitt", PIN_CONFIG_INPUT_SCHMITT, 0 },
> + { "input-debounce", PIN_CONFIG_INPUT_DEBOUNCE, 0 },
> + { "power-source", PIN_CONFIG_POWER_SOURCE, 0 },
> + { "slew-rate", PIN_CONFIG_SLEW_RATE, 0 },
> + { "low-power-mode", PIN_CONFIG_LOW_POWER_MODE, 0 },
> + { "output-low", PIN_CONFIG_OUTPUT, 0, },
> + { "output-high", PIN_CONFIG_OUTPUT, 1, },
shouldn't half of these default to 1 instead of 0? i.e. it's much nicer
for the lone flag "bias-pull-up" to enable pull up rather than disable
it (you even do this in the DT example in the bindings doc).
Otherwise the patch looks good to me (though I haven't tried it yet).
Cheers
James
WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com>
To: "Heiko Stübner" <heiko@sntech.de>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Patrice Chotard <patrice.chotard.st@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] pinctrl: add function to parse generic pinconfig properties from a dt node
Date: Wed, 12 Jun 2013 15:55:12 +0100 [thread overview]
Message-ID: <51B88BD0.805@imgtec.com> (raw)
In-Reply-To: <201306102140.29918.heiko@sntech.de>
Hi Heiko,
On 10/06/13 20:40, Heiko Stübner wrote:
> pinconf_generic_parse_dt_config() takes a node as input and generates an
> array of generic pinconfig values from the properties of this node.
>
> As I couldn't find a mechanism to count the number of properties of a node
> the function uses internally an array to accept one of parameter and copies
> the real present options to a smaller variable at its end.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
<snip>
> @@ -139,3 +140,83 @@ void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
> }
> EXPORT_SYMBOL_GPL(pinconf_generic_dump_config);
> #endif
> +
> +#ifdef CONFIG_OF
> +struct pinconf_generic_dt_params {
> + const char * const property;
> + enum pin_config_param param;
> + u32 default_value;
> +};
> +
> +static struct pinconf_generic_dt_params dt_params[] = {
> + { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 },
> + { "bias-high-impedance", PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0 },
> + { "bias-bus-hold", PIN_CONFIG_BIAS_BUS_HOLD, 0 },
> + { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 0 },
> + { "bias-pull-down", PIN_CONFIG_BIAS_PULL_DOWN, 0 },
> + { "bias-pull-pin-default", PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, 0 },
> + { "drive-push-pull", PIN_CONFIG_DRIVE_PUSH_PULL, 0 },
> + { "drive-open-drain", PIN_CONFIG_DRIVE_OPEN_DRAIN, 0 },
> + { "drive-open-source", PIN_CONFIG_DRIVE_OPEN_SOURCE, 0 },
> + { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 0 },
> + { "input-schmitt-enable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 1 },
> + { "input-schmitt-disable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 0 },
> + { "input-schmitt", PIN_CONFIG_INPUT_SCHMITT, 0 },
> + { "input-debounce", PIN_CONFIG_INPUT_DEBOUNCE, 0 },
> + { "power-source", PIN_CONFIG_POWER_SOURCE, 0 },
> + { "slew-rate", PIN_CONFIG_SLEW_RATE, 0 },
> + { "low-power-mode", PIN_CONFIG_LOW_POWER_MODE, 0 },
> + { "output-low", PIN_CONFIG_OUTPUT, 0, },
> + { "output-high", PIN_CONFIG_OUTPUT, 1, },
shouldn't half of these default to 1 instead of 0? i.e. it's much nicer
for the lone flag "bias-pull-up" to enable pull up rather than disable
it (you even do this in the DT example in the bindings doc).
Otherwise the patch looks good to me (though I haven't tried it yet).
Cheers
James
next prev parent reply other threads:[~2013-06-12 14:55 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-10 19:39 [PATCH v2 0/2] pinctrl: common handling of generic pinconfig props in dt Heiko Stübner
2013-06-10 19:39 ` Heiko Stübner
2013-06-10 19:40 ` [PATCH 1/2] pinctrl: add function to parse generic pinconfig properties from a dt node Heiko Stübner
2013-06-10 19:40 ` Heiko Stübner
2013-06-11 8:48 ` Linus Walleij
2013-06-11 8:48 ` Linus Walleij
2013-06-12 14:55 ` James Hogan [this message]
2013-06-12 14:55 ` James Hogan
2013-06-12 22:22 ` Heiko Stübner
2013-06-12 22:22 ` Heiko Stübner
2013-06-13 8:11 ` Linus Walleij
2013-06-13 8:11 ` Linus Walleij
2013-06-13 14:35 ` Heiko Stübner
2013-06-13 14:35 ` Heiko Stübner
2013-06-13 15:23 ` Heiko Stübner
2013-06-13 15:23 ` Heiko Stübner
2013-06-13 15:36 ` Linus Walleij
2013-06-13 15:36 ` Linus Walleij
2013-06-13 23:53 ` Laurent Pinchart
2013-06-13 23:53 ` Laurent Pinchart
2013-06-14 9:18 ` Heiko Stübner
2013-06-14 9:18 ` Heiko Stübner
2013-06-14 14:52 ` Laurent Pinchart
2013-06-14 14:52 ` Laurent Pinchart
2013-06-16 10:39 ` Linus Walleij
2013-06-16 10:39 ` Linus Walleij
2013-06-13 15:31 ` Linus Walleij
2013-06-13 15:31 ` Linus Walleij
2013-06-14 0:27 ` Laurent Pinchart
2013-06-14 0:27 ` Laurent Pinchart
2013-06-14 7:34 ` Heiko Stübner
2013-06-14 7:34 ` Heiko Stübner
2013-06-14 14:46 ` Laurent Pinchart
2013-06-14 14:46 ` Laurent Pinchart
2013-06-10 19:42 ` [PATCH 2/2] pinctrl: add pinctrl driver for Rockchip SoCs Heiko Stübner
2013-06-10 19:42 ` Heiko Stübner
2013-06-10 20:16 ` [PATCH 2/2 v3] " Heiko Stübner
2013-06-10 20:16 ` Heiko Stübner
2013-06-11 8:53 ` Linus Walleij
2013-06-11 8:53 ` Linus Walleij
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=51B88BD0.805@imgtec.com \
--to=james.hogan@imgtec.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.