Re: [PATCH v9 2/3] mmc: core: Add support for SDIO wakeup interrupt
From: Ulf Hansson
Date: Fri Apr 01 2022 - 08:42:55 EST
On Tue, 29 Mar 2022 at 05:29, Axe Yang <axe.yang@xxxxxxxxxxxx> wrote:
>
> If wakeup-source flag is set in host dts node, parse EAI information
> from SDIO CCCR interrupt externsion segment for in-band wakeup. If
> async interrupt is supported by SDIO card then enable it and set
> enable_async_irq flag in sdio_cccr structure to 1. The parse flow is
> implemented in sdio_read_cccr().
>
> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
> Signed-off-by: Axe Yang <axe.yang@xxxxxxxxxxxx>
> ---
> drivers/mmc/core/sdio.c | 17 +++++++++++++++++
> include/linux/mmc/card.h | 8 +++++++-
> include/linux/mmc/sdio.h | 5 +++++
> 3 files changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 25799accf8a0..4898c5e9a299 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -226,6 +226,23 @@ static int sdio_read_cccr(struct mmc_card *card, u32 ocr)
> card->sw_caps.sd3_drv_type |= SD_DRIVER_TYPE_C;
> if (data & SDIO_DRIVE_SDTD)
> card->sw_caps.sd3_drv_type |= SD_DRIVER_TYPE_D;
> +
> + if (card->host->pm_caps & MMC_PM_WAKE_SDIO_IRQ) {
After a second thought, I think we can just skip this check. The
MMC_PM_WAKE_SDIO_IRQ indicates that the host supports SDIO IRQs as
*system wakeups*.
But, in fact, I think we want this feature to be enabled to allow
waking up for runtime_suspend (RPM_SUSPENDED) too.
> + ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTERRUPT_EXT, 0,
> + &data);
> + if (ret)
> + goto out;
> +
> + if (data & SDIO_INTERRUPT_EXT_SAI) {
> + data |= SDIO_INTERRUPT_EXT_EAI;
> + ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_INTERRUPT_EXT,
> + data, NULL);
> + if (ret)
> + goto out;
> +
> + card->cccr.enable_async_irq = 1;
> + }
> + }
> }
[...]
Other than the above, this looks good to me!
Kind regards
Uffe