From: "Heiko Stübner" <heiko@sntech.de>
To: Ulf Hansson <ulf.hansson@linaro.org>,
Kever Yang <kever.yang@rock-chips.com>,
Robin Murphy <robin.murphy@arm.com>
Cc: linux-rockchip@lists.infradead.org,
Jaehoon Chung <jh80.chung@samsung.com>,
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: Fri, 04 Oct 2024 22:42:07 +0200 [thread overview]
Message-ID: <1846973.TLkxdtWsSY@diego> (raw)
In-Reply-To: <69d06c04-cc8c-4435-a622-33d5dcd1fa24@arm.com>
Am Freitag, 4. Oktober 2024, 19:34:33 CEST schrieb Robin Murphy:
> On 02/10/2024 10:55 pm, Ulf Hansson wrote:
> > On Sat, 14 Sept 2024 at 13:52, Heiko Stübner <heiko@sntech.de> wrote:
> >>
> >> 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?
> >
> > Good point! A better option is to use a polling based mechanism - and
> > we have MMC_CAP_NEEDS_POLL for exactly that.
> >
> > Moreover, on DT based platforms one can even use the "broken-cd"
> > property to indicate this.
>
> Except that goes further than is needed here, since it would fall back
> entirely to software-based polling for card presence. In this case the
> CD function is not broken in terms of actually detecting a card, it just
> doesn't work to wake the controller up from suspend because it can't
> fire its own interrupt while powered off. In principle all we should
> require here is to periodically resume/suspend the device, to provide a
> window for the interrupt to work and normal operation to take over if
> appropriate.
>
> Of course the really clever way would be for suspend to switch the pin
> into GPIO mode, and set the GPIO interrupt as a wakeup to trigger resume
> and switch it back again, but perhaps that's a bit tricky without
> explicit pinctrl states in the DT :/
and then the question really becomes, why move away from cd-gpios at all.
WARNING: multiple messages have this Message-ID (diff)
From: "Heiko Stübner" <heiko@sntech.de>
To: Ulf Hansson <ulf.hansson@linaro.org>,
Kever Yang <kever.yang@rock-chips.com>,
Robin Murphy <robin.murphy@arm.com>
Cc: linux-rockchip@lists.infradead.org,
Jaehoon Chung <jh80.chung@samsung.com>,
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: Fri, 04 Oct 2024 22:42:07 +0200 [thread overview]
Message-ID: <1846973.TLkxdtWsSY@diego> (raw)
In-Reply-To: <69d06c04-cc8c-4435-a622-33d5dcd1fa24@arm.com>
Am Freitag, 4. Oktober 2024, 19:34:33 CEST schrieb Robin Murphy:
> On 02/10/2024 10:55 pm, Ulf Hansson wrote:
> > On Sat, 14 Sept 2024 at 13:52, Heiko Stübner <heiko@sntech.de> wrote:
> >>
> >> 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?
> >
> > Good point! A better option is to use a polling based mechanism - and
> > we have MMC_CAP_NEEDS_POLL for exactly that.
> >
> > Moreover, on DT based platforms one can even use the "broken-cd"
> > property to indicate this.
>
> Except that goes further than is needed here, since it would fall back
> entirely to software-based polling for card presence. In this case the
> CD function is not broken in terms of actually detecting a card, it just
> doesn't work to wake the controller up from suspend because it can't
> fire its own interrupt while powered off. In principle all we should
> require here is to periodically resume/suspend the device, to provide a
> window for the interrupt to work and normal operation to take over if
> appropriate.
>
> Of course the really clever way would be for suspend to switch the pin
> into GPIO mode, and set the GPIO interrupt as a wakeup to trigger resume
> and switch it back again, but perhaps that's a bit tricky without
> explicit pinctrl states in the DT :/
and then the question really becomes, why move away from cd-gpios at all.
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2024-10-04 20:59 UTC|newest]
Thread overview: 18+ 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-12 7:26 ` Kever Yang
2024-09-14 11:20 ` FUKAUMI Naoki
2024-09-14 11:20 ` FUKAUMI Naoki
2024-09-14 11:52 ` Heiko Stübner
2024-09-14 11:52 ` Heiko Stübner
2024-10-02 21:55 ` Ulf Hansson
2024-10-02 21:55 ` Ulf Hansson
2024-10-04 17:34 ` Robin Murphy
2024-10-04 17:34 ` Robin Murphy
2024-10-04 20:42 ` Heiko Stübner [this message]
2024-10-04 20:42 ` Heiko Stübner
2024-10-07 9:49 ` Ulf Hansson
2024-10-07 9:49 ` Ulf Hansson
2024-11-01 7:59 ` Kever Yang
2024-11-01 7:59 ` Kever Yang
2024-11-01 11:04 ` Ulf Hansson
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=1846973.TLkxdtWsSY@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=robin.murphy@arm.com \
--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 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.