Received: by 10.213.65.68 with SMTP id h4csp1108689imn; Mon, 26 Mar 2018 00:22:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELtskrpdvTgY1oOAd7zswSb+tGzpauI876R8jcYWLi0SHgwjcPmz/xxYk52cKwRoj8umAMCn X-Received: by 2002:a17:902:d886:: with SMTP id b6-v6mr34482256plz.70.1522048945058; Mon, 26 Mar 2018 00:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522048945; cv=none; d=google.com; s=arc-20160816; b=MyN5VkAaoGViH4RztQrVjrB0L16U0ZjIoC+ocRyteQX9OLoaWlAsZVaPegmH999h16 0gVPZwnZmPq7fEK5l/MHx9XcR+qFsCK3kbMttr6l1d/HJJ2kXynYiYIlvU5lylKipKYB wQzYeQZjrgIT4vtxd1rZ7EJf6lJ1F0wBYpWExmmSlm+xoBZd2y8cEsMSl36nHX8JF9SH whlHaJPug9EDHc9KK+mJ7qjHIjccx/S0I1l6YHsMdmqLDKddTO/BCTXQ23syYvTGk31W /N9EQoc/Tb2FEQoSh0fLsAykEYNdH9bO8zO6WdqMW/rDP4uuz7ml7I6ZPFvwLzv/Mg3p AlBg== 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:arc-authentication-results; bh=0/TqP4vDylSajmNIoiQSAV1k/qyRbfXQxg/l67TspbY=; b=n4VKuRcOG0Q7EaRnFPaXvk9J4mUWZOln4d9r7tbya2uYiQuG9TvNjHYep1qxcPtV4c z8daDt3o2wDJUUjHIxNrEKYEOiM2y8IjSYSO5TsJaVwNTkG7fY4i7KKS0I3x5v0YCPoM QEuBQ6T+OBp5sL4wuGl+1giehLC42Ui8Ew+jaRdTlZ6aqMFWWdJhxBCU8QhA4ge+paUo FlFnLD6x6szWbR4RFMDWVPvqLMuS3XbxNeR/AY2IbzOCKvAg0bwfAjI9JtR6EBmgDwbN 3sap9mQIfFHMfXPRmdObdGOJyu0f+qVoj0EuNlONYvLUAa1sorjFvzSbDf5dqXo7c1mF t/eQ== 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 r1si11564190pff.24.2018.03.26.00.22.10; Mon, 26 Mar 2018 00:22:25 -0700 (PDT) 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 S1751148AbeCZHVS (ORCPT + 99 others); Mon, 26 Mar 2018 03:21:18 -0400 Received: from mga07.intel.com ([134.134.136.100]:11339 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042AbeCZHVQ (ORCPT ); Mon, 26 Mar 2018 03:21:16 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2018 00:21:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,364,1517904000"; d="scan'208";a="40621498" Received: from subhransu-desktop.iind.intel.com (HELO subhransu-desktop) ([10.223.96.100]) by fmsmga004.fm.intel.com with ESMTP; 26 Mar 2018 00:21:13 -0700 Date: Mon, 26 Mar 2018 12:33:55 +0530 From: "Subhransu S. Prusty" To: Anshuman Gupta Cc: "Rafael J. Wysocki" , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Linux Kernel Mailing List , Linux PM Subject: Re: [PATCH] [sound] hdac-codec runtime suspended at PM:Suspend. Message-ID: <20180326070349.GA14895@subhransu-desktop> References: <1520853467-31653-1-git-send-email-anshuman.gupta@intel.com> <5aa8fbe9.4251620a.c3daa.3711SMTPIN_ADDED_BROKEN@mx.google.com> <20180314153714.GA11459@anshuman.gupta@intel.com> <20180315104237.GB13659@subhransu-desktop> <20180315153230.GA16531@anshuman.gupta@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180315153230.GA16531@anshuman.gupta@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 15, 2018 at 09:02:30PM +0530, Anshuman Gupta wrote: > On Thu, Mar 15, 2018 at 04:12:44PM +0530, Subhransu S. Prusty wrote: > > On Wed, Mar 14, 2018 at 09:07:14PM +0530, Anshuman Gupta wrote: > > > On Wed, Mar 14, 2018 at 11:53:58AM +0100, Rafael J. Wysocki wrote: > > > > On Wed, Mar 14, 2018 at 11:38 AM, Anshuman Gupta > > > > wrote: > > > > > On Mon, Mar 12, 2018 at 12:26:53PM +0100, Rafael J. Wysocki wrote: > > > > >> On Mon, Mar 12, 2018 at 12:17 PM, Anshuman Gupta > > > > >> wrote: > > > > >> > > > > > >> > + if (pm_runtime_status_suspended(dev)) > > > > >> > + return; > > > > >> > > > > >> That, again, is somewhat fragile from the concurrency perspective. > > > > >> > > > > > > > > And here you want to avoid the below if the device is still suspended. > > > Yes, if we do not avoid the code below, complete callback takes about > > > 3 seconds due to snd_hdac_codec_read timed out because hdac controller > > > would be in runtime suspend state. > > > > > > > > Why is the below code located in the ->complete callback anyway? > > > > Shouldn't it be there in the ->resume one? > > > > > > > Yes even i am also having same doubt, why these power down and power up > > > sequences are part of prepare and complete callback. > > > Adding driver author "Subhransu S. Prusty" to provide more inputs on this. > > > > This driver needs a late resume as it receives a jack notification from the > > i915 driver and the skl controller driver resume may not have happened and > > in turn hda controller may not ready. This ensures a synchronization for > > jack event during resume from S3. > Let me give you insight of the issue, this driver blocks the direct complete > of hda controller PCI 00:1f.3, sometimes it takes 280ms to resume hda controller > from S3 and s2idle. So it does not make sense to suspend/resume hda controller > when it is already in runtime suspend. I get it now. I think this patch needs rework to address both the issues. > > > > I think this patch defeats the purpose. > Here in this case PCI driver may kick the direct complete for hda controller > https://elixir.bootlin.com/linux/latest/source/drivers/pci/pci-driver.c#L691 > But hdac hdmi codec driver is blocking it. > So i think it will be ok to keep this codec and hda controller in runtime > suspend while entering S3 or s2idle, both can resume by runtime PM as well, > will it brake any audio functionality? There was some PM and jack detection issues (I don't recollect now) because of which this was added. This was due to the gfx display power and hda controller synchronization. The rework may be required in both hdac_hdmi and skylake drivers. Regards, Subhransu > > > > Regards, > > Subhransu > > > > > > >> > /* Power up afg */ > > > > >> > snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, > > > > >> > AC_PWRST_D0); > > > > >> > -- > > > > >> > 2.7.4 > > > > > > -- > > > Thanks, > > > Anshuman > > > > -- > > -- > Thanks, > Anshuman --