Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3299787ybz; Mon, 27 Apr 2020 13:34:39 -0700 (PDT) X-Google-Smtp-Source: APiQypJaYUJT5ua7uyULP+99gSKDMRR+jQNRIa2t+ZMI+seqh+bQaGoz8/zPLWRHY9C2HkGnte0j X-Received: by 2002:a17:906:1292:: with SMTP id k18mr21339823ejb.132.1588019679612; Mon, 27 Apr 2020 13:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588019679; cv=none; d=google.com; s=arc-20160816; b=tyL/WygzVmFz9Ct9IE9CjB3gFadPdIAqFMpCuBJXXxTdDGIp5d1YGIyb9uidelRgVe xK6tLW5BK6HaWbDg3GF5IhrObMMsLgjkjqeexUlR+0HYrG/jkbSih04c3fTtLpRot9BH FV6jS07Wv6+3hTueDRYeu9YYNdP35qfIi7+UJSwvgvSQWxDE0ecMnr6DGmefyBQBz4PI x3PYr2QsRyQxByhgcH9NcOcVqdHCzMc3N8ZH9vRWP68ft0xNvR9w45h4JKaA4DAjb2dQ dk2ywCJm6BAzaE3BP+HSIxEN810IiGuRRXt4qNRFE69jmh3+5o/GqGnkiVwp/i63KalG 0atw== 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:dmarc-filter :dkim-signature; bh=kNapMrLPfWyqq3saA7ayYBf3t2HHIt3ns1o+JIh4q4U=; b=vSkMJ+RCsY5z/+6zRS0mSarMC9WVIL7MFp9V6N2RbNh5k+eRwjtKr9hU8OqveLL02S 7lwRCmqFZg5za5B76bUKGRYFHaLz9GAHRhN6TfTPVUCt1Kd+Pa64w2CS+0TW9YXXX0B6 0PeuzsE7IFrhBxrGnY60+SOoGbrq5Ey0qIIX7bQNfAEXZcghfWvzK5Z0kcQXorMBD8F2 mEWArGZvGKMLz1/a+5mkM2dMltsZDXV+eXZ88Aw25pTWdofb/Xr6k154B8MchluImUQN F2RTZER8G47TbY1w+pNScwO+pOXwMU3K/0vaZ37vElrBrBhutNUuSxYEp8wab1fjyhdv D/9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=qnXdkfkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w25si365857edq.368.2020.04.27.13.34.16; Mon, 27 Apr 2020 13:34:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=qnXdkfkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726741AbgD0UcT (ORCPT + 99 others); Mon, 27 Apr 2020 16:32:19 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:19878 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726676AbgD0UcT (ORCPT ); Mon, 27 Apr 2020 16:32:19 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588019538; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=kNapMrLPfWyqq3saA7ayYBf3t2HHIt3ns1o+JIh4q4U=; b=qnXdkfkfZOFa3nvemiYARZmiIdcTAUMBrs10zuLH6On6bXGj+VWUyV7vl17CDmSr5qhQvyV7 11Bl68HoEJGVJKUPQDh7fsSGJTj/JfqGcIzdzG9SWWqrooEto1nMhqELyEoT3asllByApzhP FtVj3fJdIE0J+LnbH0Fyd//kMqY= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea7413d.7f0d1ef71030-smtp-out-n03; Mon, 27 Apr 2020 20:31:57 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id BEBEFC4478F; Mon, 27 Apr 2020 20:31:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [10.110.78.22] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wcheng) by smtp.codeaurora.org (Postfix) with ESMTPSA id C2DA4C433D2; Mon, 27 Apr 2020 20:31:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C2DA4C433D2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=wcheng@codeaurora.org Subject: Re: [PATCH] phy: qcom-snps: Add runtime suspend and resume handlers To: Vinod Koul Cc: agross@kernel.org, bjorn.andersson@linaro.org, kishon@ti.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <1587662818-4461-1-git-send-email-wcheng@codeaurora.org> <20200427165919.GR56386@vkoul-mobl.Dlink> From: Wesley Cheng Message-ID: <4ce39b01-ddf3-7a5b-9ac4-659ff4362fcd@codeaurora.org> Date: Mon, 27 Apr 2020 13:31:55 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200427165919.GR56386@vkoul-mobl.Dlink> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/27/2020 9:59 AM, Vinod Koul wrote: > On 23-04-20, 10:26, Wesley Cheng wrote: > >> +static int qcom_snps_hsphy_suspend(struct qcom_snps_hsphy *hsphy) >> +{ >> + if (hsphy->suspended) >> + return 0; >> + >> + dev_dbg(&hsphy->phy->dev, "Suspend QCOM SNPS PHY, mode = %d \n", hsphy->mode); >> + >> + if (hsphy->mode == PHY_MODE_USB_HOST) { >> + /* Enable auto-resume to meet remote wakeup timing */ >> + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL2, >> + USB2_AUTO_RESUME, USB2_AUTO_RESUME); >> + usleep_range(500, 1000); >> + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL2, >> + 0, USB2_AUTO_RESUME); > > Kernel has a coding guideline where we try to "stick" to 80 char limit > and is sometimes okay like debug logs. Above is not okay. Please fix it > and run ./scripts/checkpatch.pl --strict on your patch and fix all > errors. Warning and checks at your discretion using common sense. When > in doubt do ask :) > Hi Vinod, Thanks for the input. I do run the checkpatch script before sending patches, and addressing the errors. However, seems this was tagged as a warning instead. Will keep in mind to address as many warnings as I can as well. >> + } >> + >> + clk_disable_unprepare(hsphy->cfg_ahb_clk); >> + hsphy->suspended = true; > > why do you need to track this? > More for debug purposes in case the RPM state becomes out of sync with the expected PHY state. We've seen some situations during PM suspend/resume testing where our RPM routines aren't executed, as PM will disable RPM briefly. It would be nice to be able to catch these situations after collecting our crash dumps. >> + >> + return 0; >> +} >> + >> +static int qcom_snps_hsphy_resume(struct qcom_snps_hsphy *hsphy) >> +{ >> + int ret = 0; > > superfluous init.. > Agreed. >> static int qcom_snps_hsphy_probe(struct platform_device *pdev) >> { >> struct device *dev = &pdev->dev; >> @@ -251,6 +333,14 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev) >> return ret; >> } >> >> + pm_runtime_set_active(dev); >> + pm_runtime_enable(dev); > > would it not make sense to enable this after pjy in initialized? > Not sure we want to put this in the phy_init() callback, as we can't guarantee how the driver registering the PHY will use it. It'll put the requirement of having to call phy_exit() for every phy_init() sequence, in order to avoid unbalanced disable_depth warnings from the RPM driver. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project