From: "Heiko Stübner" <heiko@sntech.de>
To: Kever Yang <kever.yang@rock-chips.com>
Cc: linux-rockchip@lists.infradead.org,
Kever Yang <kever.yang@rock-chips.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc: dw_mmc: rockchip: Keep controller working for card detect
Date: Sat, 14 Sep 2024 13:52:32 +0200 [thread overview]
Message-ID: <4920950.GXAFRqVoOG@diego> (raw)
In-Reply-To: <20240912152538.1.I858c2a0bf83606c8b59ba1ab6944978a398d2ac5@changeid>
Am Donnerstag, 12. September 2024, 09:26:14 CEST schrieb Kever Yang:
> In order to make the SD card hotplug working we need the card detect
> function logic inside the controller always working. The runtime PM will
> gate the clock and the power domain, which stops controller working when
> no data transfer happen.
>
> So lets skip enable runtime PM when the card needs to detected by the
> controller and the card is removable.
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
So for the change itself this looks good, i.e. it fixes an issue for baords relying
on the on-chip-card-detect.
But for boards doing that, the controller will be running _all the time_
even if there is never any card inserted.
So relying on the on-soc card-detect will effectively increase the power-
consumption of the board - even it it'll never use any sd-card?
> ---
>
> drivers/mmc/host/dw_mmc-rockchip.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
> index b07190ba4b7a..df91205f9cd3 100644
> --- a/drivers/mmc/host/dw_mmc-rockchip.c
> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
> @@ -345,28 +345,39 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev)
> const struct dw_mci_drv_data *drv_data;
> const struct of_device_id *match;
> int ret;
> + bool use_rpm = true;
>
> if (!pdev->dev.of_node)
> return -ENODEV;
>
> + if (!device_property_read_bool(&pdev->dev, "non-removable") &&
It would be nice to add a comment here about the fact that this will
disable power-management for the controller.
Also shouldn't non-removable already work, making the case above not
necessary?
Thanks
Heiko
> + !device_property_read_bool(&pdev->dev, "cd-gpios"))
> + use_rpm = false;
> +
> match = of_match_node(dw_mci_rockchip_match, pdev->dev.of_node);
> drv_data = match->data;
>
> pm_runtime_get_noresume(&pdev->dev);
> pm_runtime_set_active(&pdev->dev);
> - pm_runtime_enable(&pdev->dev);
> - pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
> - pm_runtime_use_autosuspend(&pdev->dev);
> +
> + if (use_rpm) {
> + pm_runtime_enable(&pdev->dev);
> + pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
> + pm_runtime_use_autosuspend(&pdev->dev);
> + }
>
> ret = dw_mci_pltfm_register(pdev, drv_data);
> if (ret) {
> - pm_runtime_disable(&pdev->dev);
> - pm_runtime_set_suspended(&pdev->dev);
> + if (use_rpm) {
> + pm_runtime_disable(&pdev->dev);
> + pm_runtime_set_suspended(&pdev->dev);
> + }
> pm_runtime_put_noidle(&pdev->dev);
> return ret;
> }
>
> - pm_runtime_put_autosuspend(&pdev->dev);
> + if (use_rpm)
> + pm_runtime_put_autosuspend(&pdev->dev);
>
> return 0;
> }
>
next prev parent reply other threads:[~2024-09-14 11:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 7:26 [PATCH] mmc: dw_mmc: rockchip: Keep controller working for card detect Kever Yang
2024-09-14 11:20 ` FUKAUMI Naoki
2024-09-14 11:52 ` Heiko Stübner [this message]
2024-10-02 21:55 ` Ulf Hansson
2024-10-04 17:34 ` Robin Murphy
2024-10-04 20:42 ` Heiko Stübner
2024-10-07 9:49 ` Ulf Hansson
2024-11-01 7:59 ` Kever Yang
2024-11-01 11:04 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4920950.GXAFRqVoOG@diego \
--to=heiko@sntech.de \
--cc=jh80.chung@samsung.com \
--cc=kever.yang@rock-chips.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).