lkml.org 
[lkml]   [2020]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V1] mmc: sdhci-msm: Set IO pins in low power state during suspend
Hi,

On Wed, Jul 08, 2020 at 06:41:20PM +0530, Veerabhadrarao Badiganti wrote:
> Configure SDHC IO pins with low power configuration when the driver
> is in suspend state.
>
> Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
> ---
> drivers/mmc/host/sdhci-msm.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 392d41d57a6e..efd2bae1430c 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -15,6 +15,7 @@
> #include <linux/iopoll.h>
> #include <linux/regulator/consumer.h>
> #include <linux/interconnect.h>
> +#include <linux/pinctrl/consumer.h>
>
> #include "sdhci-pltfm.h"
> #include "cqhci.h"
> @@ -1352,6 +1353,19 @@ static void sdhci_msm_set_uhs_signaling(struct sdhci_host *host,
> sdhci_msm_hs400(host, &mmc->ios);
> }
>
> +static int sdhci_msm_set_pincfg(struct sdhci_msm_host *msm_host, bool level)
> +{
> + struct platform_device *pdev = msm_host->pdev;
> + int ret;
> +
> + if (level)
> + ret = pinctrl_pm_select_default_state(&pdev->dev);
> + else
> + ret = pinctrl_pm_select_sleep_state(&pdev->dev);
> +
> + return ret;
> +}
> +
> static int sdhci_msm_set_vmmc(struct mmc_host *mmc)
> {
> if (IS_ERR(mmc->supply.vmmc))
> @@ -1596,6 +1610,9 @@ static void sdhci_msm_handle_pwr_irq(struct sdhci_host *host, int irq)
> ret = sdhci_msm_set_vqmmc(msm_host, mmc,
> pwr_state & REQ_BUS_ON);
> if (!ret)
> + ret = sdhci_msm_set_pincfg(msm_host,
> + pwr_state & REQ_BUS_ON);
> + if (!ret)
> irq_ack |= CORE_PWRCTL_BUS_SUCCESS;
> else
> irq_ack |= CORE_PWRCTL_BUS_FAIL;

I happened to have a debug patch in my tree which logs when regulators
are enabled/disabled, with this patch I see the SD card regulator
toggling constantly after returning from the first system suspend.

I added more logs:

[ 1156.085819] DBG: sdhci_msm_set_pincfg: level = 0 (ret: 0)
[ 1156.248936] DBG: sdhci_msm_set_pincfg: level = 1 (ret: 0)
[ 1156.301989] DBG: sdhci_msm_set_pincfg: level = 0 (ret: 0)
[ 1156.462383] DBG: sdhci_msm_set_pincfg: level = 1 (ret: 0)
[ 1156.525988] DBG: sdhci_msm_set_pincfg: level = 0 (ret: 0)
[ 1156.670372] DBG: sdhci_msm_set_pincfg: level = 1 (ret: 0)
[ 1156.717935] DBG: sdhci_msm_set_pincfg: level = 0 (ret: 0)
[ 1156.878122] DBG: sdhci_msm_set_pincfg: level = 1 (ret: 0)
[ 1156.928134] DBG: sdhci_msm_set_pincfg: level = 0 (ret: 0)

This is on an SC7180 platform. It doesn't run an upstream kernel though,
but v5.4 with plenty of upstream patches.

\
 
 \ /
  Last update: 2020-07-10 02:53    [W:0.050 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site