From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758450AbcDEMoy (ORCPT ); Tue, 5 Apr 2016 08:44:54 -0400 Received: from mga01.intel.com ([192.55.52.88]:28290 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754316AbcDEMow (ORCPT ); Tue, 5 Apr 2016 08:44:52 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,444,1455004800"; d="scan'208";a="925793494" Subject: Re: [PATCH] sdhci: wakeup from runtime PM To: Ludovic Desroches , ulf.hansson@linaro.org References: <1458921903-11133-1-git-send-email-ludovic.desroches@atmel.com> Cc: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-pm@vger.kernel.org, nicolas.ferre@atmel.com From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <5703B241.6030007@intel.com> Date: Tue, 5 Apr 2016 15:40:33 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1458921903-11133-1-git-send-email-ludovic.desroches@atmel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/03/16 18:05, Ludovic Desroches wrote: > Hi, > > When not using the SDHCI controller, it is logical to save power by suspending > it. The issue is that SDHCI assumes that the controller is completely disabled. > It means the only way to wake up on a card event is to have a gpio for the card > detection (so two pins for the same signal). A possible workaround is to use > polling but the controller will be resumed/suspended between each attempts. > > We have already discussed a long time about this and it seems we don't agree. > In my opinion, even if I can't disable all clocks, I should use runtime PM > to save some power. > > I propose two patches, one which is a draft to try to solve it at sdhci level > and one at sdhci-of-at91 level. > > Concerning the first one, I don't understand why we need to reject irqs if > runtime_suspended is true. The interrupt handler might be called because the interrupt is shared i.e. the interrupt is for a different device. In that case the host controller might be off and the registers inaccessible. In that case we cannot even look at the interrupt register to determine if we were expecting the interrupt. > Only SDHCI_INT_CARD_INT irq is enabled so why we > should have other IRQs than this one? In the case of SDIO Card interrupt, it is delivered via the host controller, so we have to assume the registers are accessible if we are runtime-suspended with the SDIO IRQ enabled. > > Since you were not in favour of allowing to wakeup on SDHCI_INT_CARD_INSERT or > SDHCI_INT_CARD_REMOVE, I assume you won't take it so I > solved my issue only by modifying my driver. I don't mind allowing card detect interrupts while runtime suspended, but we need a flag so that: - runtime suspend leaves the insert/remove interrupts enabled - irq handler knows it can access registers - irq thread handler knows to runtime resume before doing anything else But it seems like you need to persuade Ulf first.