From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DCDC9CF8853 for ; Fri, 4 Oct 2024 17:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9ZfM8/v/OHKn2ZUucbLSngfy1+ZMbJwMpehuOTBQlYc=; b=z7ESlR1C9jxyCY9CWGSIc+Af3Q /7YMA/JBW0WbUdSYGmInhNnTKb5qcMKnUzVH0vE6mTnEfU1g1nunDBOZmTqseZCC98k6CwDjTHQAu hjHGP4sUTa+4PU3/pP21vQnlIqw56CWG3F2n/iSVYRqLufRPb+KGM9tn/2Wik2rLUT1D/to/0x8UD /b0mIXKbCRqAcsAcsfo4/MKK5It4EARngXYr2Wo6nXQBQL9iEfJotkxUqLaTX65+jM/GB75OLS6kw oyYoESTYFLvNfId4q5LSAXw5JVKS/V49yN3++kENQq36iYx7JgMxlPbfORytyLlsF7w/fitqTnL0p dXdLM6Zg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swmEe-0000000DYBY-3VDq; Fri, 04 Oct 2024 17:37:01 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swmCj-0000000DXbJ-3CE8; Fri, 04 Oct 2024 17:35:04 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 94FCA339; Fri, 4 Oct 2024 10:35:28 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BD75C3F640; Fri, 4 Oct 2024 10:34:57 -0700 (PDT) Message-ID: <69d06c04-cc8c-4435-a622-33d5dcd1fa24@arm.com> Date: Fri, 4 Oct 2024 18:34:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mmc: dw_mmc: rockchip: Keep controller working for card detect To: Ulf Hansson , Kever Yang , =?UTF-8?Q?Heiko_St=C3=BCbner?= Cc: linux-rockchip@lists.infradead.org, Jaehoon Chung , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org References: <20240912152538.1.I858c2a0bf83606c8b59ba1ab6944978a398d2ac5@changeid> <4920950.GXAFRqVoOG@diego> From: Robin Murphy Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241004_103502_153246_EB95B247 X-CRM114-Status: GOOD ( 17.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 02/10/2024 10:55 pm, Ulf Hansson wrote: > On Sat, 14 Sept 2024 at 13:52, Heiko Stübner 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 >> >> 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 :/ Thanks, Robin. > > [...] > > Kind regards > Uffe > > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip