From: "Manjunathappa, Prakash" <prakash.pm@ti.com>
To: linus.walleij@linaro.org
Cc: nsekhar@ti.com, grant.likely@linaro.org, rob.herring@calxeda.com,
linux@arm.linux.org.uk, rob@landley.net, tony@atomide.com,
prabhakar.csengg@gmail.com, peter.ujfalusi@ti.com,
devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
davinci-linux-open-source@linux.davincidsp.com, "Manjunathappa,
Prakash" <prakash.pm@ti.com>
Subject: [PATCH 2/3] pinctrl: pinctrl-single: pin names for pinctrl-single.bits
Date: Tue, 21 May 2013 19:38:01 +0530 [thread overview]
Message-ID: <1369145282-14419-4-git-send-email-prakash.pm@ti.com> (raw)
In-Reply-To: <1369145282-14419-1-git-send-email-prakash.pm@ti.com>
Take care to name pin names as
register-offset.bit-pos-of-pin-in-register in case configuring multiple
pins in register.
Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
---
drivers/pinctrl/pinctrl-single.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 9a1ea65..2899c86 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -30,7 +30,7 @@
#define DRIVER_NAME "pinctrl-single"
#define PCS_MUX_PINS_NAME "pinctrl-single,pins"
#define PCS_MUX_BITS_NAME "pinctrl-single,bits"
-#define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 1)
+#define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 3)
#define PCS_OFF_DISABLED ~0U
/**
@@ -744,7 +744,8 @@ static const struct pinconf_ops pcs_pinconf_ops = {
* @pcs: pcs driver instance
* @offset: register offset from base
*/
-static int pcs_add_pin(struct pcs_device *pcs, unsigned offset)
+static int pcs_add_pin(struct pcs_device *pcs, unsigned offset,
+ unsigned pin_pos)
{
struct pinctrl_pin_desc *pin;
struct pcs_name *pn;
@@ -759,8 +760,8 @@ static int pcs_add_pin(struct pcs_device *pcs, unsigned offset)
pin = &pcs->pins.pa[i];
pn = &pcs->names[i];
- sprintf(pn->name, "%lx",
- (unsigned long)pcs->res->start + offset);
+ sprintf(pn->name, "%lx.%d",
+ (unsigned long)pcs->res->start + offset, pin_pos);
pin->name = pn->name;
pin->number = i;
pcs->pins.cur++;
@@ -780,12 +781,14 @@ static int pcs_add_pin(struct pcs_device *pcs, unsigned offset)
static int pcs_allocate_pin_table(struct pcs_device *pcs)
{
int mux_bytes, nr_pins, i;
+ int num_pins_in_register = 0;
mux_bytes = pcs->width / BITS_PER_BYTE;
if (pcs->bits_per_mux) {
pcs->bits_per_pin = fls(pcs->fmask);
nr_pins = (pcs->size * BITS_PER_BYTE) / pcs->bits_per_pin;
+ num_pins_in_register = pcs->width / pcs->bits_per_pin;
} else {
nr_pins = pcs->size / mux_bytes;
}
@@ -810,14 +813,16 @@ static int pcs_allocate_pin_table(struct pcs_device *pcs)
unsigned offset;
int res;
int byte_num;
+ int pin_pos = 0;
if (pcs->bits_per_mux) {
byte_num = (pcs->bits_per_pin * i) / BITS_PER_BYTE;
offset = (byte_num / mux_bytes) * mux_bytes;
+ pin_pos = i % num_pins_in_register;
} else {
offset = i * mux_bytes;
}
- res = pcs_add_pin(pcs, offset);
+ res = pcs_add_pin(pcs, offset, pin_pos);
if (res < 0) {
dev_err(pcs->dev, "error adding pins: %i\n", res);
return res;
--
1.7.4.1
next prev parent reply other threads:[~2013-05-21 14:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-21 14:07 [PATCH 0/3] pinctrl: pinctrl-single: Add full fledge support to configure multiple pins of different modules Manjunathappa, Prakash
[not found] ` <1369145282-14419-1-git-send-email-prakash.pm-l0cyMroinI0@public.gmane.org>
2013-05-21 14:08 ` [PATCH 1/3] pinctrl: pinctrl-single: enhance " Manjunathappa, Prakash
2013-06-05 5:24 ` Haojian Zhuang
2013-06-05 22:01 ` Tony Lindgren
2013-06-07 9:20 ` Linus Walleij
2013-05-24 9:03 ` [PATCH 0/3] pinctrl: pinctrl-single: Add full fledge support " Linus Walleij
[not found] ` <CACRpkdZEsRaaE9dJLDNMzJZSLZ35pqS6XVj5KgCzJGG5nnvPQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-26 16:11 ` Haojian Zhuang
2013-05-21 14:08 ` Manjunathappa, Prakash [this message]
2013-06-05 5:25 ` [PATCH 2/3] pinctrl: pinctrl-single: pin names for pinctrl-single.bits Haojian Zhuang
2013-06-05 22:02 ` Tony Lindgren
2013-06-07 11:14 ` Linus Walleij
2013-05-21 14:08 ` [PATCH 3/3] ARM: davinci: da850: adopt to pinctrl-single driver to configure multiple pins Manjunathappa, Prakash
[not found] ` <1369145282-14419-5-git-send-email-prakash.pm-l0cyMroinI0@public.gmane.org>
2013-06-24 11:48 ` Manjunathappa, Prakash
[not found] ` <A73F36158E33644199EB82C5EC81C7BC3EA911E0-yXqyApvAXouIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-06-24 14:52 ` Sekhar Nori
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=1369145282-14419-4-git-send-email-prakash.pm@ti.com \
--to=prakash.pm@ti.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nsekhar@ti.com \
--cc=peter.ujfalusi@ti.com \
--cc=prabhakar.csengg@gmail.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--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;
as well as URLs for NNTP newsgroup(s).