Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3874305ima; Mon, 4 Feb 2019 06:39:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IYGgQe31/K+I44aMTyWB0NKF3UFD6oKRhuQyTvPE6lrc4vaqUGlFA1iPVeDesgHa8O4fTD+ X-Received: by 2002:a63:ef47:: with SMTP id c7mr13397376pgk.386.1549291149883; Mon, 04 Feb 2019 06:39:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549291149; cv=none; d=google.com; s=arc-20160816; b=cCS0LCwzn5cqIGzHYBnfEhLMlpatKeMbT77BWMnmh2pN+/nhoexOZw2lM+ehLsNJTP OOASDMxdIosestXkZbBl2861wjCPWotpzAwVanJnfz/AP+GZGzfuiSlBHZIi6h6A0v1x vOuaw/q+I0kTnc1eZwYYJd3LoW5fiNkuhVsBwRD/+RH+qRmWrhZfHs4xrCkO0G1HjPPZ i0AYjO8Yomhw1QAtGck5PRg12Nn1FDdNPnx2v4EsZ2/VSkAmakQ9tGZTPC8UDicPUh59 X9WD0tLxbKfi5A26w8s0JFMQMk5VulZiuWYCJAlSuMQrUWRIxhUb2VaHfhqQE01YU42+ 5Imw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=t2ThYZw12DdCfl3exIo5bV0QEutxsm9Hf0K2r5TPG7I=; b=T8jL5b+wLL8iTcruYBQtLYJIfQuXURrVfURw2vMIlrScxP96L59TBUhLO/D3mOv8+T sqRvRdP7lpAedqy+X+3LKb9Es8cFkBS90dd7PvyJp3SwyFhDSmiFwCVaPwwziHYIc4X/ nGEoQ733N6E9WNLvRnP29ucQGsU7trJN0Jr6JeJDTlETLCiMHMMai/F3vbcVJiYRQoud V0x6Tte5t8NVDwTbyDE8JqPoxNkVuvKWOHSyCQ9nJMfLsAd47D+q9dIGjdCfPKijI8eh x0E9ihqCVOwgrxv88cfepTA1IdUDBhlLjbICmbEkGu9xakNWGMEdoDkbYsB4H/q9hhaF aSow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kHOfiVML; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si205308pgg.2.2019.02.04.06.38.53; Mon, 04 Feb 2019 06:39:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kHOfiVML; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729155AbfBDOA3 (ORCPT + 99 others); Mon, 4 Feb 2019 09:00:29 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44463 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbfBDOA2 (ORCPT ); Mon, 4 Feb 2019 09:00:28 -0500 Received: by mail-wr1-f66.google.com with SMTP id z5so14440753wrt.11; Mon, 04 Feb 2019 06:00:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=t2ThYZw12DdCfl3exIo5bV0QEutxsm9Hf0K2r5TPG7I=; b=kHOfiVMLm13XvBHQ7rpSVRkihNlQrTJq1OLBbQ5727BCp3xX1R4QLe8vUnFeRWPdxf Ayi2knw2aNlaVTXJlF6ZIYLGexOTL79wHpZwQQvVplOVV6SWllpXIBiFaLyC+ox2RTpz BKF7v+/Gp7M6fWqajsKXbDb0XQtV9nJs8HZ0tAgRVARzIGZCJnLzn2Q2sub2cGuTds8d uBjcUNj/jLoYh9cuOLQGWmB4WwmxMDp6f3edhxhmCl9awFg5J8/yOeksw9Ut/BcHMyr3 cCiDaM4yWLt7MX0AijbenaKc9/BHcElhP/JrR9PZLdnX6J6sP5sF3a04WfWfAEElZEdv p89Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=t2ThYZw12DdCfl3exIo5bV0QEutxsm9Hf0K2r5TPG7I=; b=e8TOWGFwLiWgWbdf/ce4cgkXMbVsKDup7LSKUPC6LII1YrUpooccCkaIXvcYvafiDw 1G+clrWJvHBtBXUjhB754eypqGE3P8XMe66VtAetwWxa8oRjqcwcJHZDdD2xdbI61IHa EwH8xCn9w5uh8Yq41+7MhgGRfbcuBfq0dSlQF6/VucsxKYumk8mQs4UPYOWDqFudvjZL wxzc04GqeSKDKg3dI70vQs+kuZVWmA3YIfyfcShVEC9NkkT4lOmGkEi+/1RE820uwKPE /jOJ9rLDPb/BvZeWsvKqTXtcP6fhbZ1TgE01/S5rhndSFsOP5Ben+wKghXjInaLPHiXY z5iA== X-Gm-Message-State: AJcUuketA9oZwaaXxgNUBvfH7XvjVAJHljJQEByWjPQJY+12Uwn4j0v3 TtyQloOSIgD3D9Hpewc8Bls= X-Received: by 2002:a5d:42ce:: with SMTP id t14mr49857820wrr.51.1549288826144; Mon, 04 Feb 2019 06:00:26 -0800 (PST) Received: from localhost (pD9E51040.dip0.t-ipconnect.de. [217.229.16.64]) by smtp.gmail.com with ESMTPSA id b13sm4433455wmj.42.2019.02.04.06.00.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Feb 2019 06:00:24 -0800 (PST) Date: Mon, 4 Feb 2019 15:00:24 +0100 From: Thierry Reding To: Dmitry Osipenko Cc: Jon Hunter , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Takashi Iwai , Pierre-Louis Bossart , Sameer Pujar , Jaroslav Kysela , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , mkumard@nvidia.com, rlokhande@nvidia.com, sharadg@nvidia.com, Linux Kernel Mailing List , linux-tegra@vger.kernel.org, Linux PM Subject: Re: [PATCH v2] ALSA: hda/tegra: enable clock during probe Message-ID: <20190204140024.GJ10412@ulmo> References: <1548414418-5785-1-git-send-email-spujar@nvidia.com> <20190131143024.GO23438@ulmo> <2034694.JE9CgBysmF@aspire.rjw.lan> <20190204084555.GF19087@ulmo> <07d58962-4c49-0575-2f95-4c885998bb52@nvidia.com> <20190204110510.GA10412@ulmo> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="M9pltayyoy9lWEMH" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --M9pltayyoy9lWEMH Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 04, 2019 at 03:03:49PM +0300, Dmitry Osipenko wrote: > 04.02.2019 14:05, Thierry Reding =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > On Mon, Feb 04, 2019 at 09:53:32AM +0000, Jon Hunter wrote: > >> > >> > >> On 04/02/2019 08:45, Thierry Reding wrote: > >> > >> ... > >> > >>> The idea was, as I was saying below, to reuse dev_pm_ops even if > >>> !CONFIG_PM. So pm_runtime_enable() could be something like this: > >>> > >>> pm_runtime_enable(dev) > >>> { > >>> if (!CONFIG_PM) > >>> if (dev->pm_ops->resume) > >>> dev->pm_ops->resume(dev); > >>> > >>> ... > >>> } > >>> > >>> But that's admittedly somewhat of a stretch. This could of course be > >>> made somewhat nicer by adding an explicit variant, say: > >>> > >>> pm_runtime_enable_foo(dev) > >>> { > >>> if (!CONFIG_PM && dev->pm_ops->resume) > >>> return dev->pm_ops->resume(dev); > >>> > >>> return 0; > >>> } > >>> > >>> Maybe the fact that I couldn't come up with a good name is a good > >>> indication that this is a bad idea... > >> > >> How about some new APIs called ... > >> > >> pm_runtime_enable_get() > >> pm_runtime_enable_get_sync() > >> pm_runtime_put_disable() (implies a put_sync) > >> > >> ... and in these APIs we add ... > >> > >> pm_runtime_enable_get(dev) > >> { > >> if (!CONFIG_PM && dev->pm_ops->resume) > >> return dev->pm_ops->resume(dev); > >> > >> pm_runtime_enable(dev); > >> return pm_runtime_get(dev); > >> } > >=20 > > Yeah, those sound sensible. I'm still a bit torn between this and just > > enforcing PM. At least on the display side I think we already require PM > > and with all the power domain work that you did we'd be much better off > > if we could just get rid of the !PM workarounds. > >=20 > >>>>> This would be somewhat tricky because drivers > >>>>> usually use SET_RUNTIME_PM_OPS to populate the struct dev_pm_ops and > >>>>> that would result in an empty structure if !CONFIG_PM, but we could > >>>>> probably work around that by adding a __SET_RUNTIME_PM_OPS that wou= ld > >>>>> never be compiled out for this kind of case. Or such drivers could = even > >>>>> manually set .runtime_suspend and .runtime_resume to make sure they= 're > >>>>> always populated. > >>>>> > >>>>> Another way out of this would be to make sure we never run into the= case > >>>>> where runtime PM is disabled. If we always "select PM" on Tegra, th= en PM > >>>>> should always be available. But is it guaranteed that runtime PM fo= r the > >>>>> devices is functional in that case? From a cursory look at the code= it > >>>>> would seem that way. > >>>> > >>>> If you select PM, then all of the requisite code should be there. > >>> > >>> We do this on 64-bit ARM, but there had been some pushback when we had > >>> proposed to do the same thing on 32-bit ARM. I think there were two > >>> concerns: > >>> > >>> 1) select PM would force the setting for all platforms on multi- > >>> platforms builds > >>> > >>> 2) prevents anyone from disabling PM for debugging purposes > >>> > >>> 1) no longer seems to be valid because Rockchip already selects PM > >>> unconditionally. I'm not sure if 2) is valid anymore either. I haven't > >>> run a build with !PM in a very long time and I wouldn't be surprised = if > >>> that was completely broken. > >>> > >>> Maybe we need to try this again since a couple of years have elapsed = and > >>> runtime PM support on Tegra is much more mature at this point. > >>> > >>>> Alternatively, you can make the driver depend on PM. > >>> > >>> That's probably the easiest way out, but to be honest I think I'd pre= fer > >>> to just enforce PM and keep things simple. > >>> > >>> Jon, any objections? > >> > >> None, but seems overkill just for this case. > >=20 > > But that's precisely the point. It's not just about this case. We've > > already got some drivers where we do a similar dance just to be able to > > support the, let's admit it, exotic case where somebody turns off PM. I > > think supporting !PM might have made sense at a point where we had no > > support for power management at all. But I think we've come a long way > > since then, and while we may still have some ways to go in some areas, > > we do fairly decent runtime PM most of the time, to the point where I no > > longer see any benefits in !PM. >=20 > I'm requesting PM_DEBUG_ALWAYS_ON option then! Disabling PM is a > useful debug feature, it can't just go away.=20 What is it about disabling PM that you consider useful? I can understand why you'd want that option if power management is broken, but as far as I can tell, power management on Tegra is in pretty good state, and it's more likely that !PM would actually be broken (though I haven't built a configuration like that in a couple of years, so I'm speculating). We already can't disable PM on 64-bit ARM, so I don't understand why 32-bit ARM should be treated any differently. Thierry --M9pltayyoy9lWEMH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlxYRXcACgkQ3SOs138+ s6FlpQ//UOawJntTH01fvpWxtT+xE2r9X/bkdovL967txQYT2KESKadF0D//T9UZ x4IPwVpk+xEl844VSUP7TjV0HgDQb4j+sqP8i3Ak3vGNxlwqNLD+HrK/QO9ttcPi RZbs3J3bskasuVXkqLh6IY+bqzIFrs+az1LSvEY5yfUlYm9LDKjP2gWPHK9tx6yy ZqWc3lhzKEJvkjdBl71aOqLw5LWdpa0RFCnrsdXIGC75YafuRH1VhXoW8utgGsEZ jB8OOhPG7cQjRFooNllMQd1foYUSChdLtI8DNHXRX0BQAh3fSnZaHdQRy0parRf8 BHpV2fMC/BnWdsCzZDLfQ0BQnDR/X7+dnv1ZoTe6BGPXliu7NQYazq57uB0z9wYH +DbD4VfTpm1zvsKf+1LQHJ1ege91QbhP8UZe9HFrsK0AC+VS5SylFtXM3hnBD9+j 71AeTsYXev3/yYEPNzQFd6uxthgBcDBVIIprpVMBXBmshG1dWRhSVT+QA1c0TjwP MbwAOYO2/fXr+eRtcwkJafB9qHj3tHP9aFP3K3r8rm78Y83F39GxZTgL9nAfRsp1 bVAONCzJ7AH6YuqoxaiBVnDiPdF4/WULmVWnpIujV4xHxJRuNZWai0o+6xdMSrxb AHsjHqn8/SnKdcdJsSShlDRxawwKJMqEVoWe/42/eVEcwDNCqzk= =3kWN -----END PGP SIGNATURE----- --M9pltayyoy9lWEMH--