Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6093845imu; Wed, 30 Jan 2019 08:42:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN7bqmOni+HCaL6mIcsK4/E5q8ZxLJJoaDCk4Bs5nQPy7n6B38ERNFVbHhpHX4ecL0vucde1 X-Received: by 2002:a62:c42:: with SMTP id u63mr30680804pfi.73.1548866520098; Wed, 30 Jan 2019 08:42:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548866520; cv=none; d=google.com; s=arc-20160816; b=rBM77FoIHRp6MD1zATzU13LsU+l/JiysPajkzxemPrP8DDS4aSousXvuqqMt5ZbI43 8YoSmaVqoF/r7TAgoT6b/Rppv6nRIGrp2/FLY+fdzNcFxt4NnodwmY9Rqz9aBTCee6JH fLa1m57fDGeHQJWCv43NqBYbB5ne/zEMfnsEX5w0mkEX3mLNzXjReC0N1HVhIifoE8z9 BT28zd2FbGjLzx9ouh7wX9bT11b82vD6f9Fn60M0bdta9UZLYGeoOwXXfdZOubTDayC7 inUN9Wbn+k0tyQ0QCDdihDBow8c+eZnr8BVuVa/vYU66+A6xXIItKtGZMPIVhaxiwG27 Hc+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=YrAJovyqlEzgjagOWfitMzVDP6Z5+Ip3tllUMpUMW9I=; b=zLGb67lShMgTp6MVdJpAZw8YOwy4jtB/Ba22Gm7jZyjXM4GfYlZ4fu4bRq1VxMKtst 349HW0RpeAeQD5w3SNFaG/e6Dpnz0WMK0WlF8Xy5CQJbxw6+/HuqpWyGL3nXSF7vSSmy hD+Ykpir7yPVFN3eYGYhK3HnL6IEQjA5uQVrXKHEGs0LkVSt0yz1IDFYF6CsNCqAmK5I BwA2SkFpebLvtcnQVhFVHxXPhzPI6mLGlf6ftGMjjm1CI8KeykzxAF2+0RsotMQZbZEK /VtncBnVGlqVAhJW3u5k4YCYJE6kl1D1y5uVCQT7w/kDE9wsfGVRge+amqqPlwbXS5wp jBuQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si1877013pff.171.2019.01.30.08.41.45; Wed, 30 Jan 2019 08:42:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732321AbfA3Qkq (ORCPT + 99 others); Wed, 30 Jan 2019 11:40:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:60626 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732089AbfA3Qkp (ORCPT ); Wed, 30 Jan 2019 11:40:45 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0F2FFAF82; Wed, 30 Jan 2019 16:40:43 +0000 (UTC) Date: Wed, 30 Jan 2019 17:40:42 +0100 Message-ID: From: Takashi Iwai To: "Jon Hunter" Cc: , "Sameer Pujar" , , , , , , , , Subject: Re: [PATCH v2] ALSA: hda/tegra: enable clock during probe In-Reply-To: References: <1548414418-5785-1-git-send-email-spujar@nvidia.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 30 Jan 2019 13:45:49 +0100, Jon Hunter wrote: > > > On 25/01/2019 11:06, Sameer Pujar wrote: > > If CONFIG_PM is disabled or runtime PM calls are forbidden, the clocks > > will not be ON. This could cause issue during probe, where hda init > > setup is done. This patch enables clocks unconditionally during probe. > > > > Along with above, follwoing changes are done. > > * enable runtime PM before exiting from probe work. This helps to avoid > > usage of pm_runtime_get_sync/pm_runtime_put() in probe work. > > * hda_tegra_disable_clocks() is moved out of CONFIG_PM_SLEEP check. > > * runtime PM callbacks moved out of CONFIG_PM check > > > > Signed-off-by: Sameer Pujar > > Reviewed-by: Ravindra Lokhande > > Reviewed-by: Jon Hunter > > --- > > sound/pci/hda/hda_tegra.c | 26 +++++++++++++++++--------- > > 1 file changed, 17 insertions(+), 9 deletions(-) > > > > diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c > > index c8d18dc..ba6175f 100644 > > --- a/sound/pci/hda/hda_tegra.c > > +++ b/sound/pci/hda/hda_tegra.c > > @@ -219,7 +219,6 @@ static int hda_tegra_enable_clocks(struct hda_tegra *data) > > return rc; > > } > > > > -#ifdef CONFIG_PM_SLEEP > > static void hda_tegra_disable_clocks(struct hda_tegra *data) > > { > > clk_disable_unprepare(data->hda2hdmi_clk); > > @@ -227,6 +226,7 @@ static void hda_tegra_disable_clocks(struct hda_tegra *data) > > clk_disable_unprepare(data->hda_clk); > > } > > > > +#ifdef CONFIG_PM_SLEEP > > /* > > * power management > > */ > > @@ -257,7 +257,6 @@ static int hda_tegra_resume(struct device *dev) > > } > > #endif /* CONFIG_PM_SLEEP */ > > > > -#ifdef CONFIG_PM > > static int hda_tegra_runtime_suspend(struct device *dev) > > { > > struct snd_card *card = dev_get_drvdata(dev); > > @@ -283,7 +282,7 @@ static int hda_tegra_runtime_resume(struct device *dev) > > int rc; > > > > rc = hda_tegra_enable_clocks(hda); > > - if (rc != 0) > > + if (rc) > > return rc; > > if (chip && chip->running) { > > hda_tegra_init(hda); > > @@ -292,7 +291,6 @@ static int hda_tegra_runtime_resume(struct device *dev) > > > > return 0; > > } > > -#endif /* CONFIG_PM */ > > > > static const struct dev_pm_ops hda_tegra_pm = { > > SET_SYSTEM_SLEEP_PM_OPS(hda_tegra_suspend, hda_tegra_resume) > > @@ -551,9 +549,9 @@ static int hda_tegra_probe(struct platform_device *pdev) > > > > dev_set_drvdata(&pdev->dev, card); > > > > - pm_runtime_enable(hda->dev); > > - if (!azx_has_pm_runtime(chip)) > > - pm_runtime_forbid(hda->dev); > > + err = hda_tegra_enable_clocks(hda); > > + if (err) > > + goto out_free; > > We also need to think about power-domains here. Enabling the clocks > might not be enough as the appropriate power-domain needs to be enabled. > For 64-bit Tegra runtime-pm will handle the power-domains (assuming they > are populated in device-tree). So I still think it is better we call > pm_runtime_get_sync() at some point rather than just replying on > enabling the clocks. If I understand correctly the code, the pm domain is already activated at calling driver's probe callback. thanks, Takashi