Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: slot-gpio: Add support to enable irq wake on cd_irq

Add host capability MMC_CAP_CD_WAKE to enable irq wake on the card detect
irq.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Adrian Hunter and committed by
Ulf Hansson
03dbaa04 d2a47176

+8 -1
+4 -1
drivers/mmc/core/core.c
··· 2652 2652 host->removed = 1; 2653 2653 spin_unlock_irqrestore(&host->lock, flags); 2654 2654 #endif 2655 - if (host->slot.cd_irq >= 0) 2655 + if (host->slot.cd_irq >= 0) { 2656 + if (host->slot.cd_wake_enabled) 2657 + disable_irq_wake(host->slot.cd_irq); 2656 2658 disable_irq(host->slot.cd_irq); 2659 + } 2657 2660 2658 2661 host->rescan_disable = 1; 2659 2662 cancel_delayed_work_sync(&host->detect);
+2
drivers/mmc/core/slot-gpio.c
··· 151 151 152 152 if (irq < 0) 153 153 host->caps |= MMC_CAP_NEEDS_POLL; 154 + else if ((host->caps & MMC_CAP_CD_WAKE) && !enable_irq_wake(irq)) 155 + host->slot.cd_wake_enabled = true; 154 156 } 155 157 EXPORT_SYMBOL(mmc_gpiod_request_cd_irq); 156 158
+2
include/linux/mmc/host.h
··· 185 185 */ 186 186 struct mmc_slot { 187 187 int cd_irq; 188 + bool cd_wake_enabled; 188 189 void *handler_priv; 189 190 }; 190 191 ··· 276 275 #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ 277 276 #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ 278 277 #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ 278 + #define MMC_CAP_CD_WAKE (1 << 28) /* Enable card detect wake */ 279 279 #define MMC_CAP_CMD_DURING_TFR (1 << 29) /* Commands during data transfer */ 280 280 #define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */ 281 281 #define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */