All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] mmc: Add wakeup functionality support for sdio cards
@ 2022-05-26 12:12 Sarthak Garg
  2022-05-26 12:12 ` [PATCH V2 1/2] mmc: core: Define a new vendor ops to enable wakeup capability Sarthak Garg
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sarthak Garg @ 2022-05-26 12:12 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson
  Cc: linux-mmc, linux-kernel, linux-arm-msm, quic_kamasali,
	quic_rampraka, quic_pragalla, quic_sayalil, Sarthak Garg

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(+)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2 1/2] mmc: core: Define a new vendor ops to enable wakeup capability
  2022-05-26 12:12 [PATCH V2 0/2] mmc: Add wakeup functionality support for sdio cards Sarthak Garg
@ 2022-05-26 12:12 ` Sarthak Garg
  2022-05-27  9:22   ` Adrian Hunter
  2022-05-26 12:12 ` [PATCH V2 2/2] mmc: sdhci-msm: Add wakeup functionality to sdio cards Sarthak Garg
  2022-06-14 23:12 ` [PATCH V2 0/2] mmc: Add wakeup functionality support for " Ulf Hansson
  2 siblings, 1 reply; 5+ messages in thread
From: Sarthak Garg @ 2022-05-26 12:12 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson
  Cc: linux-mmc, linux-kernel, linux-arm-msm, quic_kamasali,
	quic_rampraka, quic_pragalla, quic_sayalil, Sarthak Garg,
	Uwe Kleine-König, Thorsten Scherer, Sergey Shtylyov,
	Dmitry Torokhov, lizhe

Define a new vendor ops to let vendor initialize card as wakeup source
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 {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH V2 2/2] mmc: sdhci-msm: Add wakeup functionality to sdio cards
  2022-05-26 12:12 [PATCH V2 0/2] mmc: Add wakeup functionality support for sdio cards Sarthak Garg
  2022-05-26 12:12 ` [PATCH V2 1/2] mmc: core: Define a new vendor ops to enable wakeup capability Sarthak Garg
@ 2022-05-26 12:12 ` Sarthak Garg
  2022-06-14 23:12 ` [PATCH V2 0/2] mmc: Add wakeup functionality support for " Ulf Hansson
  2 siblings, 0 replies; 5+ messages in thread
From: Sarthak Garg @ 2022-05-26 12:12 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson
  Cc: linux-mmc, linux-kernel, linux-arm-msm, quic_kamasali,
	quic_rampraka, quic_pragalla, quic_sayalil, Sarthak Garg,
	Andy Gross, Bjorn Andersson

This patch initializes wakeup source if the detected card
is a sdio card and enables the wakeup capability.

Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
---
 drivers/mmc/host/sdhci-msm.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index e395411fb6fd..3bfc506e5c45 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -2376,6 +2376,18 @@ static int sdhci_msm_start_signal_voltage_switch(struct mmc_host *mmc,
 	return -EAGAIN;
 }
 
+static void sdhci_msm_card_init_wakeup(struct mmc_card *card)
+{
+	int ret;
+
+	if (mmc_card_sdio(card)) {
+		ret = device_init_wakeup(&card->dev, true);
+		if (ret)
+			pr_err("%s: %s: failed to init wakeup: %d\n",
+				mmc_hostname(card->host), __func__, ret);
+	}
+}
+
 #define DRIVER_NAME "sdhci_msm"
 #define SDHCI_MSM_DUMP(f, x...) \
 	pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
@@ -2794,6 +2806,8 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	host->mmc_host_ops.start_signal_voltage_switch =
 		sdhci_msm_start_signal_voltage_switch;
 	host->mmc_host_ops.execute_tuning = sdhci_msm_execute_tuning;
+	host->mmc_host_ops.card_init_wakeup = sdhci_msm_card_init_wakeup;
+
 	if (of_property_read_bool(node, "supports-cqe"))
 		ret = sdhci_msm_cqe_add_host(host, pdev);
 	else
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V2 1/2] mmc: core: Define a new vendor ops to enable wakeup capability
  2022-05-26 12:12 ` [PATCH V2 1/2] mmc: core: Define a new vendor ops to enable wakeup capability Sarthak Garg
@ 2022-05-27  9:22   ` Adrian Hunter
  0 siblings, 0 replies; 5+ messages in thread
From: Adrian Hunter @ 2022-05-27  9:22 UTC (permalink / raw)
  To: Sarthak Garg, ulf.hansson
  Cc: linux-mmc, linux-kernel, linux-arm-msm, quic_kamasali,
	quic_rampraka, quic_pragalla, quic_sayalil,
	Uwe Kleine-König, Thorsten Scherer, Sergey Shtylyov,
	Dmitry Torokhov, lizhe

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 {


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2 0/2] mmc: Add wakeup functionality support for sdio cards
  2022-05-26 12:12 [PATCH V2 0/2] mmc: Add wakeup functionality support for sdio cards Sarthak Garg
  2022-05-26 12:12 ` [PATCH V2 1/2] mmc: core: Define a new vendor ops to enable wakeup capability Sarthak Garg
  2022-05-26 12:12 ` [PATCH V2 2/2] mmc: sdhci-msm: Add wakeup functionality to sdio cards Sarthak Garg
@ 2022-06-14 23:12 ` Ulf Hansson
  2 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2022-06-14 23:12 UTC (permalink / raw)
  To: Sarthak Garg
  Cc: adrian.hunter, linux-mmc, linux-kernel, linux-arm-msm,
	quic_kamasali, quic_rampraka, quic_pragalla, quic_sayalil

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-14 23:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 12:12 [PATCH V2 0/2] mmc: Add wakeup functionality support for sdio cards Sarthak Garg
2022-05-26 12:12 ` [PATCH V2 1/2] mmc: core: Define a new vendor ops to enable wakeup capability Sarthak Garg
2022-05-27  9:22   ` Adrian Hunter
2022-05-26 12:12 ` [PATCH V2 2/2] mmc: sdhci-msm: Add wakeup functionality to sdio cards Sarthak Garg
2022-06-14 23:12 ` [PATCH V2 0/2] mmc: Add wakeup functionality support for " Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.