* [PATCH] pinctrl: qcom: qdf2xxx: add names to the gpios
@ 2017-03-06 23:32 Timur Tabi
2017-03-15 9:40 ` Linus Walleij
2017-03-16 5:50 ` Bjorn Andersson
0 siblings, 2 replies; 4+ messages in thread
From: Timur Tabi @ 2017-03-06 23:32 UTC (permalink / raw)
To: Stephen Boyd, Linus Walleij, linux-gpio, linux-arm-kernel
The sysfs and debugfs entries for pin control drivers work better when
the individual pins are given real names, even if they are all just
"gpio0", "gpio1", etc.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
drivers/pinctrl/qcom/pinctrl-qdf2xxx.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c
index f448534..bb3ce5c 100644
--- a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c
+++ b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c
@@ -35,10 +35,14 @@
/* A reasonable limit to the number of GPIOS */
#define MAX_GPIOS 256
+/* maximum size of each gpio name (enough room for "gpioXXX" + null) */
+#define NAME_SIZE 8
+
static int qdf2xxx_pinctrl_probe(struct platform_device *pdev)
{
struct pinctrl_pin_desc *pins;
struct msm_pingroup *groups;
+ char (*names)[NAME_SIZE];
unsigned int i;
u32 num_gpios;
int ret;
@@ -59,15 +63,21 @@ static int qdf2xxx_pinctrl_probe(struct platform_device *pdev)
sizeof(struct pinctrl_pin_desc), GFP_KERNEL);
groups = devm_kcalloc(&pdev->dev, num_gpios,
sizeof(struct msm_pingroup), GFP_KERNEL);
+ names = devm_kcalloc(&pdev->dev, num_gpios, NAME_SIZE, GFP_KERNEL);
- if (!pins || !groups)
+ if (!pins || !groups || !names)
return -ENOMEM;
for (i = 0; i < num_gpios; i++) {
+ snprintf(names[i], NAME_SIZE, "gpio%u", i);
+
pins[i].number = i;
+ pins[i].name = names[i];
- groups[i].npins = 1,
+ groups[i].npins = 1;
+ groups[i].name = names[i];
groups[i].pins = &pins[i].number;
+
groups[i].ctl_reg = 0x10000 * i;
groups[i].io_reg = 0x04 + 0x10000 * i;
groups[i].intr_cfg_reg = 0x08 + 0x10000 * i;
--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: qcom: qdf2xxx: add names to the gpios
2017-03-06 23:32 [PATCH] pinctrl: qcom: qdf2xxx: add names to the gpios Timur Tabi
@ 2017-03-15 9:40 ` Linus Walleij
2017-03-15 10:33 ` Timur Tabi
2017-03-16 5:50 ` Bjorn Andersson
1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2017-03-15 9:40 UTC (permalink / raw)
To: Timur Tabi, Bjorn Andersson
Cc: Stephen Boyd, linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
On Tue, Mar 7, 2017 at 12:32 AM, Timur Tabi <timur@codeaurora.org> wrote:
> The sysfs and debugfs entries for pin control drivers work better when
> the individual pins are given real names, even if they are all just
> "gpio0", "gpio1", etc.
>
> Signed-off-by: Timur Tabi <timur@codeaurora.org>
Patch tentatively applied (looks right to me), unless Björn has concerns.
Is this a problem in other qcom pinctrl drivers?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: qcom: qdf2xxx: add names to the gpios
2017-03-15 9:40 ` Linus Walleij
@ 2017-03-15 10:33 ` Timur Tabi
0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2017-03-15 10:33 UTC (permalink / raw)
To: Linus Walleij, Bjorn Andersson
Cc: Stephen Boyd, linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Linus Walleij wrote:
> Patch tentatively applied (looks right to me), unless Björn has concerns.
>
> Is this a problem in other qcom pinctrl drivers?
Not any of the ones that use pinctrl-msm, because they all use the static
arrays, whereas my driver (because it's for ACPI), creates a dynamic array.
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: qcom: qdf2xxx: add names to the gpios
2017-03-06 23:32 [PATCH] pinctrl: qcom: qdf2xxx: add names to the gpios Timur Tabi
2017-03-15 9:40 ` Linus Walleij
@ 2017-03-16 5:50 ` Bjorn Andersson
1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2017-03-16 5:50 UTC (permalink / raw)
To: Timur Tabi
Cc: open list:PIN CONTROL SUBSYSTEM, Linus Walleij, Stephen Boyd,
LAKML
On Mon, Mar 6, 2017 at 3:32 PM, Timur Tabi <timur@codeaurora.org> wrote:
> The sysfs and debugfs entries for pin control drivers work better when
> the individual pins are given real names, even if they are all just
> "gpio0", "gpio1", etc.
>
Yeah, you do want "name" for those to play nice.
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-16 5:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-06 23:32 [PATCH] pinctrl: qcom: qdf2xxx: add names to the gpios Timur Tabi
2017-03-15 9:40 ` Linus Walleij
2017-03-15 10:33 ` Timur Tabi
2017-03-16 5:50 ` Bjorn Andersson
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).