summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorTimur Tabi <timur@codeaurora.org>2017-03-06 17:32:02 -0600
committerLinus Walleij <linus.walleij@linaro.org>2017-03-16 16:39:04 +0100
commita9ee6bd44cc808ab1ec5d9a54899addd777e8342 (patch)
treee4c1e8f2397750f0d629f67205ae8c2f63b221bf /drivers/pinctrl
parent728d3f5afd991a44b4ec9d019d8556d8cb68db3f (diff)
downloadtalos-obmc-linux-a9ee6bd44cc808ab1ec5d9a54899addd777e8342.tar.gz
talos-obmc-linux-a9ee6bd44cc808ab1ec5d9a54899addd777e8342.zip
pinctrl: qcom: qdf2xxx: add names to the gpios
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> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/qcom/pinctrl-qdf2xxx.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c
index f448534edf46..bb3ce5c3e18b 100644
--- a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c
+++ b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c
@@ -35,10 +35,14 @@ static struct msm_pinctrl_soc_data qdf2xxx_pinctrl;
/* 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;
OpenPOWER on IntegriCloud