struct pinctrl_dev *pctrl;
struct irq_domain *domain;
struct gpio_chip chip;
- unsigned irq;
+ int irq;
spinlock_t lock;
static int msm_config_reg(struct msm_pinctrl *pctrl,
const struct msm_pingroup *g,
unsigned param,
- unsigned *reg,
+ s16 *reg,
unsigned *mask,
unsigned *bit)
{
unsigned mask;
unsigned arg;
unsigned bit;
- unsigned reg;
+ s16 reg;
int ret;
u32 val;
unsigned mask;
unsigned arg;
unsigned bit;
- unsigned reg;
+ s16 reg;
int ret;
u32 val;
int i;
break;
case PIN_CONFIG_DRIVE_STRENGTH:
/* Check for invalid values */
- if (arg > ARRAY_SIZE(msm_drive_to_regval))
+ if (arg >= ARRAY_SIZE(msm_drive_to_regval))
arg = -1;
else
arg = msm_drive_to_regval[arg];
unsigned long flags;
u32 val;
- if (WARN_ON(offset >= pctrl->soc->ngroups))
- return -EINVAL;
-
g = &pctrl->soc->groups[offset];
-
- if (WARN_ON(g->oe_bit < 0))
+ if (WARN_ON(g->io_reg < 0))
return -EINVAL;
spin_lock_irqsave(&pctrl->lock, flags);
unsigned long flags;
u32 val;
- if (WARN_ON(offset >= pctrl->soc->ngroups))
- return -EINVAL;
-
g = &pctrl->soc->groups[offset];
-
- if (WARN_ON(g->oe_bit < 0))
+ if (WARN_ON(g->io_reg < 0))
return -EINVAL;
spin_lock_irqsave(&pctrl->lock, flags);
struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip);
u32 val;
- if (WARN_ON(offset >= pctrl->soc->ngroups))
- return -EINVAL;
-
g = &pctrl->soc->groups[offset];
+ if (WARN_ON(g->io_reg < 0))
+ return -EINVAL;
val = readl(pctrl->regs + g->io_reg);
return !!(val & BIT(g->in_bit));
unsigned long flags;
u32 val;
- if (WARN_ON(offset >= pctrl->soc->ngroups))
- return;
-
g = &pctrl->soc->groups[offset];
+ if (WARN_ON(g->io_reg < 0))
+ return;
spin_lock_irqsave(&pctrl->lock, flags);
u32 val;
pctrl = irq_data_get_irq_chip_data(d);
- if (!pctrl)
- return;
-
- if (WARN_ON(d->hwirq >= pctrl->soc->ngroups))
- return;
-
g = &pctrl->soc->groups[d->hwirq];
+ if (WARN_ON(g->intr_cfg_reg < 0))
+ return;
spin_lock_irqsave(&pctrl->lock, flags);
u32 val;
pctrl = irq_data_get_irq_chip_data(d);
- if (!pctrl)
- return;
-
- if (WARN_ON(d->hwirq >= pctrl->soc->ngroups))
- return;
-
g = &pctrl->soc->groups[d->hwirq];
+ if (WARN_ON(g->intr_status_reg < 0))
+ return;
spin_lock_irqsave(&pctrl->lock, flags);
u32 val;
pctrl = irq_data_get_irq_chip_data(d);
- if (!pctrl)
- return;
-
- if (WARN_ON(d->hwirq >= pctrl->soc->ngroups))
- return;
-
g = &pctrl->soc->groups[d->hwirq];
+ if (WARN_ON(g->intr_status_reg < 0))
+ return;
spin_lock_irqsave(&pctrl->lock, flags);
u32 val;
pctrl = irq_data_get_irq_chip_data(d);
- if (!pctrl)
- return -EINVAL;
-
- if (WARN_ON(d->hwirq >= pctrl->soc->ngroups))
- return -EINVAL;
-
g = &pctrl->soc->groups[d->hwirq];
+ if (WARN_ON(g->intr_cfg_reg < 0))
+ return -EINVAL;
spin_lock_irqsave(&pctrl->lock, flags);
unsigned ngpio;
pctrl = irq_data_get_irq_chip_data(d);
- if (!pctrl)
- return -EINVAL;
-
ngpio = pctrl->chip.ngpio;
spin_lock_irqsave(&pctrl->lock, flags);
if (IS_ERR(pctrl->regs))
return PTR_ERR(pctrl->regs);
- pctrl->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+ pctrl->irq = platform_get_irq(pdev, 0);
if (pctrl->irq < 0) {
dev_err(&pdev->dev, "No interrupt defined for msmgpio\n");
return pctrl->irq;
struct msm_pinctrl *pctrl = platform_get_drvdata(pdev);
int ret;
+ ret = gpiochip_remove(&pctrl->chip);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to remove gpiochip\n");
+ return ret;
+ }
+
irq_set_chained_handler(pctrl->irq, NULL);
irq_domain_remove(pctrl->domain);
- ret = gpiochip_remove(&pctrl->chip);
pinctrl_unregister(pctrl->pctrl);
return 0;