mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
58ffe7a025
commit
ed118a5fd9
|
@ -228,6 +228,11 @@ static int msm_config_reg(struct msm_pinctrl *pctrl,
|
||||||
*bit = g->drv_bit;
|
*bit = g->drv_bit;
|
||||||
*mask = 7;
|
*mask = 7;
|
||||||
break;
|
break;
|
||||||
|
case PIN_CONFIG_OUTPUT:
|
||||||
|
*reg = g->ctl_reg;
|
||||||
|
*bit = g->oe_bit;
|
||||||
|
*mask = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(pctrl->dev, "Invalid config param %04x\n", param);
|
dev_err(pctrl->dev, "Invalid config param %04x\n", param);
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
|
@ -301,6 +306,14 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev,
|
||||||
case PIN_CONFIG_DRIVE_STRENGTH:
|
case PIN_CONFIG_DRIVE_STRENGTH:
|
||||||
arg = msm_regval_to_drive[arg];
|
arg = msm_regval_to_drive[arg];
|
||||||
break;
|
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:
|
default:
|
||||||
dev_err(pctrl->dev, "Unsupported config parameter: %x\n",
|
dev_err(pctrl->dev, "Unsupported config parameter: %x\n",
|
||||||
param);
|
param);
|
||||||
|
@ -357,6 +370,20 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev,
|
||||||
else
|
else
|
||||||
arg = msm_drive_to_regval[arg];
|
arg = msm_drive_to_regval[arg];
|
||||||
break;
|
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:
|
default:
|
||||||
dev_err(pctrl->dev, "Unsupported config parameter: %x\n",
|
dev_err(pctrl->dev, "Unsupported config parameter: %x\n",
|
||||||
param);
|
param);
|
||||||
|
|
Loading…
Reference in New Issue