From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Soren Brinkmann <soren.brinkmann@xilinx.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Michal Simek <michal.simek@xilinx.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Alessandro Rubini <rubini@unipv.it>,
Heiko Stuebner <heiko@sntech.de>,
linux-rockchip@lists.infradead.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH 2/7] pinctrl: pinconf-generic: Infer map type from DT property
Date: Wed, 05 Nov 2014 15:56:29 +0200 [thread overview]
Message-ID: <21124316.ibhe1N9UZS@avalon> (raw)
In-Reply-To: <1415041531-15520-3-git-send-email-soren.brinkmann@xilinx.com>
Hi Soren,
Thank you for the patch.
On Monday 03 November 2014 11:05:26 Soren Brinkmann wrote:
> With the new 'groups' property, the DT parser can infer the map type
> from the fact whether 'pins' or 'groups' is used to specify the pin
> group to work on.
> To maintain backwards compatibitliy with current usage of the DT
> binding, this is only done when an invalid map type is passed to the
> parsing function.
The Renesas PFC implements similar bindings with using the vendor-specific
properties "renesas,pins" and "renesas,groups" (bindings and implementation
available at Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
and drivers/pinctrl/sh-pfc/pinctrl.c respectively).
The Renesas implementation is a bit more generic in that it allows both pins
and groups to be specified in a single subnode. Do you think that feature
would make sense for pinconf-generic as well ?
> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
> ---
> Changes since RFC v2:
> - none
> ---
> drivers/pinctrl/pinconf-generic.c | 17 ++++++++++++++---
> include/linux/pinctrl/pinconf-generic.h | 7 +++++++
> 2 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/pinconf-generic.c
> b/drivers/pinctrl/pinconf-generic.c index f78b416d7984..1e782a0d6e48 100644
> --- a/drivers/pinctrl/pinconf-generic.c
> +++ b/drivers/pinctrl/pinconf-generic.c
> @@ -264,6 +264,7 @@ int pinconf_generic_dt_subnode_to_map(struct pinctrl_dev
> *pctldev, unsigned reserve;
> struct property *prop;
> const char *group;
> + const char *dt_pin_specifier = "pins";
>
> ret = of_property_read_string(np, "function", &function);
> if (ret < 0) {
> @@ -284,10 +285,20 @@ int pinconf_generic_dt_subnode_to_map(struct
> pinctrl_dev *pctldev, reserve++;
> if (num_configs)
> reserve++;
> +
> ret = of_property_count_strings(np, "pins");
> if (ret < 0) {
> - dev_err(dev, "could not parse property pins\n");
> - goto exit;
> + ret = of_property_count_strings(np, "groups");
> + if (ret < 0) {
> + dev_err(dev, "could not parse property pins/groups\n");
> + goto exit;
> + }
> + if (type == PIN_MAP_TYPE_INVALID)
> + type = PIN_MAP_TYPE_CONFIGS_GROUP;
> + dt_pin_specifier = "groups";
> + } else {
> + if (type == PIN_MAP_TYPE_INVALID)
> + type = PIN_MAP_TYPE_CONFIGS_PIN;
> }
> reserve *= ret;
>
> @@ -296,7 +307,7 @@ int pinconf_generic_dt_subnode_to_map(struct pinctrl_dev
> *pctldev, if (ret < 0)
> goto exit;
>
> - of_property_for_each_string(np, "pins", prop, group) {
> + of_property_for_each_string(np, dt_pin_specifier, prop, group) {
> if (function) {
> ret = pinctrl_utils_add_map_mux(pctldev, map,
> reserved_maps, num_maps, group,
> diff --git a/include/linux/pinctrl/pinconf-generic.h
> b/include/linux/pinctrl/pinconf-generic.h index d578a60eff23..b6dedfbfce69
> 100644
> --- a/include/linux/pinctrl/pinconf-generic.h
> +++ b/include/linux/pinctrl/pinconf-generic.h
> @@ -174,6 +174,13 @@ static inline int pinconf_generic_dt_node_to_map_pin(
> PIN_MAP_TYPE_CONFIGS_PIN);
> }
>
> +static inline int pinconf_generic_dt_node_to_map_all(
> + struct pinctrl_dev *pctldev, struct device_node *np_config,
> + struct pinctrl_map **map, unsigned *num_maps)
> +{
> + return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps,
> + PIN_MAP_TYPE_INVALID);
> +}
> #endif
>
> #endif /* CONFIG_GENERIC_PINCONF */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-11-05 18:00 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 19:05 [PATCH 0/7] Pinctrl support for Zynq Soren Brinkmann
2014-11-03 19:05 ` [PATCH 1/7] pinctrl: pinconf-generic: Declare dt_params/conf_items const Soren Brinkmann
2014-11-11 12:00 ` Linus Walleij
2014-11-03 19:05 ` [PATCH 2/7] pinctrl: pinconf-generic: Infer map type from DT property Soren Brinkmann
2014-11-05 13:56 ` Laurent Pinchart [this message]
2014-11-05 18:09 ` Sören Brinkmann
2014-11-05 18:17 ` Laurent Pinchart
2014-11-11 12:29 ` Linus Walleij
2014-11-12 18:43 ` Sören Brinkmann
2014-11-11 12:47 ` Linus Walleij
2014-11-12 18:46 ` Sören Brinkmann
2014-11-12 19:38 ` Sören Brinkmann
2014-11-03 19:05 ` [PATCH 3/7] pinctrl: pinconf-generic: Allow driver to specify DT params Soren Brinkmann
2014-11-03 19:12 ` Geert Uytterhoeven
2014-11-11 14:53 ` Linus Walleij
2014-11-18 8:50 ` Ivan T. Ivanov
2014-11-18 17:25 ` Sören Brinkmann
2014-11-19 7:49 ` Ivan T. Ivanov
2014-11-19 15:35 ` Sören Brinkmann
2014-11-20 8:06 ` Ivan T. Ivanov
2014-11-20 16:22 ` Sören Brinkmann
2014-11-21 7:35 ` Ivan T. Ivanov
2014-11-22 16:06 ` Sören Brinkmann
2014-11-24 8:52 ` Ivan T. Ivanov
2014-11-27 17:53 ` Sören Brinkmann
2014-11-03 19:05 ` [PATCH 4/7] pinctrl: zynq: Document DT binding Soren Brinkmann
2014-11-05 3:35 ` Andreas Färber
2014-11-05 17:07 ` Sören Brinkmann
2014-11-11 15:00 ` Linus Walleij
2014-11-12 18:53 ` Sören Brinkmann
2014-11-27 13:10 ` Linus Walleij
2014-11-03 19:05 ` [PATCH 5/7] pinctrl: Add driver for Zynq Soren Brinkmann
2014-11-05 3:24 ` Andreas Färber
2014-11-05 17:10 ` Sören Brinkmann
2014-11-05 5:12 ` Andreas Färber
2014-11-05 17:14 ` Sören Brinkmann
2014-11-03 19:05 ` [PATCH 6/7] ARM: zynq: Enable pinctrl Soren Brinkmann
2014-11-03 19:05 ` [PATCH 7/7] ARM: zynq: DT: Add pinctrl information Soren Brinkmann
2014-11-05 5:56 ` [PATCH 0/7] Pinctrl support for Zynq Andreas Färber
2014-11-05 17:03 ` Sören Brinkmann
2014-11-06 3:51 ` Andreas Färber
2014-11-06 4:13 ` Sören Brinkmann
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=21124316.ibhe1N9UZS@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=heiko@sntech.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-sh@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=rubini@unipv.it \
--cc=soren.brinkmann@xilinx.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;
as well as URLs for NNTP newsgroup(s).