Received: by 10.223.185.111 with SMTP id b44csp74769wrg; Fri, 9 Mar 2018 01:11:30 -0800 (PST) X-Google-Smtp-Source: AG47ELu00hjr+3NvGdNqX+xX7puUtpjFMzx5daMw3nf98brhGcNyGyhe/yHrcYWOrDsETLD7PNCW X-Received: by 2002:a17:902:9882:: with SMTP id s2-v6mr27642998plp.196.1520586690653; Fri, 09 Mar 2018 01:11:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520586690; cv=none; d=google.com; s=arc-20160816; b=y1gXMcZxhtrrUQ4qhLv3+n17q5EMUqxyqgWd8Y/r6JMBINcT8uJevqQNDVPRMI/KTx FSws9jlfE7RNM82N1gZqmQIJhk4CTk4yu1RqssJcnZatOn8gbMUMvxiwTKaC6M4KngpU h8mhQEf6OfFAA2UxQSRgtCFl1cMRBM+mhUZbYD/Zt6k5kkZdeUzeFAk6qBsVk9R1obEk +5XO7DwfF4ouMmSOpMSnDva+q1LeNAieI0vjbf5DL6AVsLk9zZY/83VUXJNFBR3DtOg9 pXWlZwAQhM+sPOsT5sCNE0N1ODqL+0NPsna6L5rjMiYC27/yDoZRn/XvtwBr/GQmZw0A 0gZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=eHAlFIsHyTKBDEE4V3rRMJjrYNBC7TXaoBS/rq3rA/Q=; b=U9r6cTT4YAibpVRlta7lRy7vQLIPHkeK2E0oEk9gl1rMr7hCQcSAxhwaJ8ZcY2gpDs 8mzsmHEbKMFuBkO5N9PEg8lT5iEBkbP4upfQvuJH3E+CETgrWnVCbMDRhyfaOnPgE8sx Go8J6ME6NJ4wL/cGa1bimUfsKpVqLLhStb+Lj9SC+s1zB8kps2KKfoNLMlfqyE1jyS6l QRY20GF1kJuEeJaofplINWKM/zI4ZDdft/lchOOVPMGqQpvW/75J9vde8JhpX8FxFRB/ 4RDCTPduG1a9z4+p/aZim4YTwAA4GqMDTj1uNCE5fwMRipCf7GRvK4rZMR/Nx7n/Md62 YQMQ== 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 bi12-v6si526182plb.547.2018.03.09.01.11.16; Fri, 09 Mar 2018 01:11:30 -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 S1751483AbeCIJJs (ORCPT + 99 others); Fri, 9 Mar 2018 04:09:48 -0500 Received: from mga01.intel.com ([192.55.52.88]:13306 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbeCIJJp (ORCPT ); Fri, 9 Mar 2018 04:09:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2018 01:09:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,444,1515484800"; d="scan'208";a="23791815" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.164]) ([10.237.72.164]) by orsmga008.jf.intel.com with ESMTP; 09 Mar 2018 01:09:42 -0800 Subject: Re: [PATCH 2/3] usb: xhci: tegra: Add runtime PM support To: Thierry Reding , Jon Hunter Cc: Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <1518626085-29102-1-git-send-email-jonathanh@nvidia.com> <1518626085-29102-2-git-send-email-jonathanh@nvidia.com> <54bd00b7-2835-a253-0399-370e8c8203b8@linux.intel.com> <20180309083629.GA13877@ulmo> From: Mathias Nyman Message-ID: <1fff9fc1-2ad2-dba1-cb1d-d531254984ce@intel.com> Date: Fri, 9 Mar 2018 11:13:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180309083629.GA13877@ulmo> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09.03.2018 10:36, Thierry Reding wrote: > On Thu, Mar 08, 2018 at 09:31:07PM +0000, Jon Hunter wrote: >> >> On 01/03/18 14:18, Mathias Nyman wrote: >>> On 14.02.2018 18:34, Jon Hunter wrote: >>>> Add runtime PM support to the Tegra XHCI driver and move the function >>>> calls to enable/disable the clocks, regulators and PHY into the runtime >>>> PM callbacks. >>>> >>>> Signed-off-by: Jon Hunter >>>> --- >>>>   drivers/usb/host/xhci-tegra.c | 80 >>>> ++++++++++++++++++++++++++++++------------- >>>>   1 file changed, 56 insertions(+), 24 deletions(-) >>>> >>>> diff --git a/drivers/usb/host/xhci-tegra.c >>>> b/drivers/usb/host/xhci-tegra.c >>>> index 02b0b24faa58..42aa67858b53 100644 >>>> --- a/drivers/usb/host/xhci-tegra.c >>>> +++ b/drivers/usb/host/xhci-tegra.c >>>> @@ -18,6 +18,7 @@ >>>>   #include >>>>   #include >>>>   #include >>>> +#include >>>>   #include >>>>   #include >>>>   #include >>>> @@ -1067,22 +1068,12 @@ static int tegra_xusb_probe(struct >>>> platform_device *pdev) >>>>        */ >>>>       platform_set_drvdata(pdev, tegra); >>>>   -    err = tegra_xusb_clk_enable(tegra); >>>> -    if (err) { >>>> -        dev_err(&pdev->dev, "failed to enable clocks: %d\n", err); >>>> -        goto put_usb2; >>>> -    } >>>> - >>>> -    err = regulator_bulk_enable(tegra->soc->num_supplies, >>>> tegra->supplies); >>>> -    if (err) { >>>> -        dev_err(&pdev->dev, "failed to enable regulators: %d\n", err); >>>> -        goto disable_clk; >>>> -    } >>>> +    pm_runtime_enable(&pdev->dev); >>>>   -    err = tegra_xusb_phy_enable(tegra); >>>> +    err = pm_runtime_get_sync(&pdev->dev); >>>>       if (err < 0) { >>> >>> Does this mean that if runtime PM is disabled then clocks and regulator >>> will never be enabled >>> for Tegra xhci? >>> >>> How about keeping the clock and regualtor enabling in probe, and instead >>> add something like: >>> >>> pm_runtime_set_active(&pdev->dev); >>> pm_runtime_enable(&pdev->dev); >>> pm_runtime_get_noresume(&pdev->dev); >> >> For 64-bit Tegra there is a dependency on CONFIG_PM, but for 32-bit >> AFAIK there is not and so yes we should handle the case when PM_RUNTIME >> is disabled. >> >> Typically we do something like ... >> >> pm_runtime_enable(&pdev->dev); >> if (!pm_runtime_enabled(&pdev->dev)) >> ret = tegra_xusb_runtime_resume(&pdev->dev); >> else >> ret = pm_runtime_get_sync(&pdev->dev); >> >> That way we can keep the regulator and clock stuff in the handler. I >> will update this series. > > Is there any good reason why we don't depend on PM for 32-bit as well? > I'm not aware of any differences in drivers that are 32-bit specific for > Tegra, and I'm not even sure the !PM case gets any testing at all. And > even if, do we really still want to support that? > > I don't see any advantage these days for having it disabled. I don't know much about Tegra, but I'd still like to turn this question around: Is there any reason why clks and regulators can't initially be turned on in probe, and then let runtime PM handle them later if PM is supported? Shouldn't this work in all cases, and it avoids creating new dependencies? Thanks Mathias