return bcm2835_gpio_get_bit(pc, GPLEV0, offset);
}
- static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
- unsigned offset, int value)
- {
- return pinctrl_gpio_direction_output(chip->base + offset);
- }
-
static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
- struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev);
+ struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->parent);
bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset);
}
+ static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
+ unsigned offset, int value)
+ {
+ bcm2835_gpio_set(chip, offset, value);
+ return pinctrl_gpio_direction_output(chip->base + offset);
+ }
+
static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
- struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev);
+ struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->parent);
return irq_linear_revmap(pc->irq_domain, offset);
}
unsigned int reg_addr;
unsigned int bit;
unsigned int read_val = 0;
- struct mtk_pinctrl *pctl = dev_get_drvdata(chip->dev);
+ struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent);
- if (mtk_gpio_get_direction(chip, offset))
- reg_addr = mtk_get_port(pctl, offset) +
- pctl->devdata->dout_offset;
- else
- reg_addr = mtk_get_port(pctl, offset) +
- pctl->devdata->din_offset;
+ reg_addr = mtk_get_port(pctl, offset) +
+ pctl->devdata->din_offset;
bit = BIT(offset & 0xf);
regmap_read(pctl->regmap1, reg_addr, &read_val);