On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported due to the design of gpio / interrupt controller. Therefore provide an option to specify the cd interrupt e.g. by device tree. The host controller can store the interrupt in cd_irq for use by mmc_gpiod_request_cd_irq(). Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx> --- drivers/mmc/core/slot-gpio.c | 2 +- include/linux/mmc/host.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index dd2a4b6ab..69c22a997 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host) * IRQ number is already used by another unit and cannot be shared. */ if (!(host->caps & MMC_CAP_NEEDS_POLL)) - irq = gpiod_to_irq(ctx->cd_gpio); + irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio); if (irq >= 0) { if (!ctx->cd_gpio_isr) diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 8fdd3cf97..e998e919e 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -470,6 +470,7 @@ struct mmc_host { struct delayed_work detect; int detect_change; /* card detect flag */ + int cd_irq; /* for use by mmc_gpiod_request_cd_irq */ struct mmc_slot slot; const struct mmc_bus_ops *bus_ops; /* current bus driver */ -- 2.39.1