mirror of
https://github.com/torvalds/linux.git
synced 2024-12-13 06:32:50 +00:00
pinctrl: baytrail: Add GPIO <-> pin mapping ranges via callback
When IRQ chip is instantiated via GPIO library flow, the few functions, in particular the ACPI event registration mechanism, on some of ACPI based platforms expect that the pin ranges are initialized to that point. Add GPIO <-> pin mapping ranges via callback in the GPIO library flow. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
b30b736a2b
commit
ed3c156462
@ -1507,6 +1507,19 @@ static void byt_gpio_irq_init_hw(struct byt_gpio *vg)
|
||||
}
|
||||
}
|
||||
|
||||
static int byt_gpio_add_pin_ranges(struct gpio_chip *chip)
|
||||
{
|
||||
struct byt_gpio *vg = gpiochip_get_data(chip);
|
||||
struct device *dev = &vg->pdev->dev;
|
||||
int ret;
|
||||
|
||||
ret = gpiochip_add_pin_range(chip, dev_name(dev), 0, 0, vg->soc_data->npins);
|
||||
if (ret)
|
||||
dev_err(dev, "failed to add GPIO pin range\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int byt_gpio_probe(struct byt_gpio *vg)
|
||||
{
|
||||
struct gpio_chip *gc;
|
||||
@ -1519,6 +1532,7 @@ static int byt_gpio_probe(struct byt_gpio *vg)
|
||||
gc->label = dev_name(&vg->pdev->dev);
|
||||
gc->base = -1;
|
||||
gc->can_sleep = false;
|
||||
gc->add_pin_ranges = byt_gpio_add_pin_ranges;
|
||||
gc->parent = &vg->pdev->dev;
|
||||
gc->ngpio = vg->soc_data->npins;
|
||||
gc->irq.init_valid_mask = byt_init_irq_valid_mask;
|
||||
@ -1535,13 +1549,6 @@ static int byt_gpio_probe(struct byt_gpio *vg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = gpiochip_add_pin_range(&vg->chip, dev_name(&vg->pdev->dev),
|
||||
0, 0, vg->soc_data->npins);
|
||||
if (ret) {
|
||||
dev_err(&vg->pdev->dev, "failed to add GPIO pin range\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set up interrupts */
|
||||
irq_rc = platform_get_resource(vg->pdev, IORESOURCE_IRQ, 0);
|
||||
if (irq_rc && irq_rc->start) {
|
||||
|
Loading…
Reference in New Issue
Block a user