Re: [PATCH v1 5/5] gpio: pca953x: Override GpioInt() pin for Intel Galileo Gen 2

Andy Shevchenko
2020-05-25T09:31:52Z

On Mon, May 25, 2020 at 12:20:28PM +0300, Mika Westerberg wrote:
> On Thu, May 21, 2020 at 12:19:16AM +0300, Andy Shevchenko wrote:
> > ACPI table on Intel Galileo Gen 2 has wrong pin number for IRQ resource
> > of one of the I²C GPIO expanders. ACPI GPIO library provides a special
> > quirk which we may use in this case. With help of it, override GpioInt()
> > pin for the affected platform.

...

> > +static const struct acpi_gpio_params pca953x_interrupt_gpios = { 0, 0, true };
> > +
> > +static const struct acpi_gpio_mapping pca953x_acpi_interrupt_gpios[] = {
> > + { "interrupt-gpios", &pca953x_interrupt_gpios, 1, ACPI_GPIO_QUIRK_FORCE_PIN, 1 },
> > + { }
> > +};
> > +
> > +static int pca953x_acpi_interrupt_get_irq(struct device *dev)
> > +{
> > + struct gpio_desc *desc;
> > +
> > + if (devm_acpi_dev_add_driver_gpios(dev, pca953x_acpi_interrupt_gpios))
> > + dev_warn(dev, "can't add GPIO ACPI mapping\n");
> > +
> > + desc = devm_gpiod_get(dev, "interrupt", GPIOD_IN);
> > + if (IS_ERR(desc))
> > + return PTR_ERR(desc);
> > +
> > + return gpiod_to_irq(desc);
> > +}
> > +
> > +static const struct dmi_system_id pca953x_dmi_acpi_interrupt_info[] = {
> > + {
> > + .ident = "Intel Galileo Gen 2",
> > + .matches = {
> > + DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"),
> > + },
> > + },
> > + {}
>
> Since you do everything already in this driver, I think we can live
> without adding ACPI_GPIO_QUIRK_FORCE_PIN to the core code at all.

Hmm... I don't see how (perhaps need morning coffee). Any pointers?

--
With Best Regards,
Andy Shevchenko