mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									d2a47176a8
								
							
						
					
					
						commit
						03dbaa04a2
					
				
					 3 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -2652,8 +2652,11 @@ void mmc_stop_host(struct mmc_host *host)
 | 
				
			||||||
	host->removed = 1;
 | 
						host->removed = 1;
 | 
				
			||||||
	spin_unlock_irqrestore(&host->lock, flags);
 | 
						spin_unlock_irqrestore(&host->lock, flags);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	if (host->slot.cd_irq >= 0)
 | 
						if (host->slot.cd_irq >= 0) {
 | 
				
			||||||
 | 
							if (host->slot.cd_wake_enabled)
 | 
				
			||||||
 | 
								disable_irq_wake(host->slot.cd_irq);
 | 
				
			||||||
		disable_irq(host->slot.cd_irq);
 | 
							disable_irq(host->slot.cd_irq);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	host->rescan_disable = 1;
 | 
						host->rescan_disable = 1;
 | 
				
			||||||
	cancel_delayed_work_sync(&host->detect);
 | 
						cancel_delayed_work_sync(&host->detect);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -151,6 +151,8 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (irq < 0)
 | 
						if (irq < 0)
 | 
				
			||||||
		host->caps |= MMC_CAP_NEEDS_POLL;
 | 
							host->caps |= MMC_CAP_NEEDS_POLL;
 | 
				
			||||||
 | 
						else if ((host->caps & MMC_CAP_CD_WAKE) && !enable_irq_wake(irq))
 | 
				
			||||||
 | 
							host->slot.cd_wake_enabled = true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(mmc_gpiod_request_cd_irq);
 | 
					EXPORT_SYMBOL(mmc_gpiod_request_cd_irq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -185,6 +185,7 @@ struct mmc_async_req {
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct mmc_slot {
 | 
					struct mmc_slot {
 | 
				
			||||||
	int cd_irq;
 | 
						int cd_irq;
 | 
				
			||||||
 | 
						bool cd_wake_enabled;
 | 
				
			||||||
	void *handler_priv;
 | 
						void *handler_priv;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -275,6 +276,7 @@ struct mmc_host {
 | 
				
			||||||
#define MMC_CAP_DRIVER_TYPE_A	(1 << 23)	/* Host supports Driver Type A */
 | 
					#define MMC_CAP_DRIVER_TYPE_A	(1 << 23)	/* Host supports Driver Type A */
 | 
				
			||||||
#define MMC_CAP_DRIVER_TYPE_C	(1 << 24)	/* Host supports Driver Type C */
 | 
					#define MMC_CAP_DRIVER_TYPE_C	(1 << 24)	/* Host supports Driver Type C */
 | 
				
			||||||
#define MMC_CAP_DRIVER_TYPE_D	(1 << 25)	/* Host supports Driver Type D */
 | 
					#define MMC_CAP_DRIVER_TYPE_D	(1 << 25)	/* Host supports Driver Type D */
 | 
				
			||||||
 | 
					#define MMC_CAP_CD_WAKE		(1 << 28)	/* Enable card detect wake */
 | 
				
			||||||
#define MMC_CAP_CMD_DURING_TFR	(1 << 29)	/* Commands during data transfer */
 | 
					#define MMC_CAP_CMD_DURING_TFR	(1 << 29)	/* Commands during data transfer */
 | 
				
			||||||
#define MMC_CAP_CMD23		(1 << 30)	/* CMD23 supported. */
 | 
					#define MMC_CAP_CMD23		(1 << 30)	/* CMD23 supported. */
 | 
				
			||||||
#define MMC_CAP_HW_RESET	(1 << 31)	/* Hardware reset */
 | 
					#define MMC_CAP_HW_RESET	(1 << 31)	/* Hardware reset */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue