mbox series

[V2,0/2] mmc: Add wakeup functionality support for sdio cards

Message ID 20220526121215.25947-1-quic_sartgarg@quicinc.com
Headers show
Series mmc: Add wakeup functionality support for sdio cards | expand

Message

Sarthak Garg May 26, 2022, 12:12 p.m. UTC
Changes since V1:
	- Define a new vendor ops to let vendor enable wakeup capability
	  as per their needs.

Sarthak Garg (2):
  mmc: core: Define a new vendor ops to enable wakeup capability
  mmc: sdhci-msm: Add wakeup functionality to sdio cards

 drivers/mmc/core/bus.c       |  3 +++
 drivers/mmc/host/sdhci-msm.c | 14 ++++++++++++++
 include/linux/mmc/host.h     |  7 +++++++
 3 files changed, 24 insertions(+)

Comments

Adrian Hunter May 27, 2022, 9:22 a.m. UTC | #1
On 26/05/22 15:12, Sarthak Garg wrote:
> Define a new vendor ops to let vendor initialize card as wakeup source

Did you consider using the existing ->init_card() op?

> and enable wakeup capability specially for SDIO cards which supports
> waking host from system suspend through external dedicated pins.
> 
> Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
> ---
>  drivers/mmc/core/bus.c   | 3 +++
>  include/linux/mmc/host.h | 7 +++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index 58a60afa650b..6192a52288fd 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -364,6 +364,9 @@ int mmc_add_card(struct mmc_card *card)
>  #endif
>  	card->dev.of_node = mmc_of_find_child_device(card->host, 0);
>  
> +	if (card->host->ops->card_init_wakeup)
> +		card->host->ops->card_init_wakeup(card);
> +
>  	device_enable_async_suspend(&card->dev);
>  
>  	ret = device_add(&card->dev);
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index c193c50ccd78..3bd4374a64b8 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -193,6 +193,13 @@ struct mmc_host_ops {
>  
>  	/* Initialize an SD express card, mandatory for MMC_CAP2_SD_EXP. */
>  	int	(*init_sd_express)(struct mmc_host *host, struct mmc_ios *ios);
> +
> +	/*
> +	 * Optional for vendor to initialize card as wakeup source and
> +	 * enable wakeup capability specially for SDIO cards which supports
> +	 * waking host from suspend through external dedicated pins.
> +	 */
> +	void    (*card_init_wakeup)(struct mmc_card *card);
>  };
>  
>  struct mmc_cqe_ops {
Ulf Hansson June 14, 2022, 11:12 p.m. UTC | #2
On Thu, 26 May 2022 at 05:13, Sarthak Garg <quic_sartgarg@quicinc.com> wrote:
>
> Changes since V1:
>         - Define a new vendor ops to let vendor enable wakeup capability
>           as per their needs.
>
> Sarthak Garg (2):
>   mmc: core: Define a new vendor ops to enable wakeup capability
>   mmc: sdhci-msm: Add wakeup functionality to sdio cards
>
>  drivers/mmc/core/bus.c       |  3 +++
>  drivers/mmc/host/sdhci-msm.c | 14 ++++++++++++++
>  include/linux/mmc/host.h     |  7 +++++++
>  3 files changed, 24 insertions(+)
>

Hi Sarthak,

I don't think this is the right solution.

Please have a look at another series [1], which is currently under
review and it's adding support for SDIO wakeup. I think you should be
able to get influenced from that, to understand how you should
implement this.

Kind regards
Uffe

[1]
https://www.spinics.net/lists/linux-mmc/msg70506.html