summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn@kryo.se>2014-02-04 19:55:31 -0800
committerLinus Walleij <linus.walleij@linaro.org>2014-02-11 09:35:18 +0100
commited118a5fd951bd2def8249ee251842c4f81fe4bd (patch)
tree2acf44f60afbb3555ea4ebce93ff3bb0dbcd8298 /drivers/pinctrl
parent58ffe7a02583bd19bb83c8bc7e277705625316a2 (diff)
downloadblackbird-op-linux-ed118a5fd951bd2def8249ee251842c4f81fe4bd.tar.gz
blackbird-op-linux-ed118a5fd951bd2def8249ee251842c4f81fe4bd.zip
pinctrl-msm: Support output-{high,low} configuration
Add support for configuring pins as output with value as from the pinconf-generic interface. Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-msm.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-msm.c b/drivers/pinctrl/pinctrl-msm.c
index ef2bf3126da6..2cfb1d4e4395 100644
--- a/drivers/pinctrl/pinctrl-msm.c
+++ b/drivers/pinctrl/pinctrl-msm.c
@@ -228,6 +228,11 @@ static int msm_config_reg(struct msm_pinctrl *pctrl,
*bit = g->drv_bit;
*mask = 7;
break;
+ case PIN_CONFIG_OUTPUT:
+ *reg = g->ctl_reg;
+ *bit = g->oe_bit;
+ *mask = 1;
+ break;
default:
dev_err(pctrl->dev, "Invalid config param %04x\n", param);
return -ENOTSUPP;
@@ -301,6 +306,14 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev,
case PIN_CONFIG_DRIVE_STRENGTH:
arg = msm_regval_to_drive[arg];
break;
+ case PIN_CONFIG_OUTPUT:
+ /* Pin is not output */
+ if (!arg)
+ return -EINVAL;
+
+ val = readl(pctrl->regs + g->io_reg);
+ arg = !!(val & BIT(g->in_bit));
+ break;
default:
dev_err(pctrl->dev, "Unsupported config parameter: %x\n",
param);
@@ -357,6 +370,20 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev,
else
arg = msm_drive_to_regval[arg];
break;
+ case PIN_CONFIG_OUTPUT:
+ /* set output value */
+ spin_lock_irqsave(&pctrl->lock, flags);
+ val = readl(pctrl->regs + g->io_reg);
+ if (arg)
+ val |= BIT(g->out_bit);
+ else
+ val &= ~BIT(g->out_bit);
+ writel(val, pctrl->regs + g->io_reg);
+ spin_unlock_irqrestore(&pctrl->lock, flags);
+
+ /* enable output */
+ arg = 1;
+ break;
default:
dev_err(pctrl->dev, "Unsupported config parameter: %x\n",
param);
OpenPOWER on IntegriCloud