Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp376491ybl; Wed, 22 Jan 2020 23:51:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxXDiU/0OZOct1dq/2NWgm07F2t7dE5YCZEiZD3rrGJqmuXWZrqr30AvGQsfPfhhdl52ELC X-Received: by 2002:a9d:6758:: with SMTP id w24mr10806740otm.155.1579765878355; Wed, 22 Jan 2020 23:51:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579765878; cv=none; d=google.com; s=arc-20160816; b=0bZp/FB5lkenpOzm2/7h2vNbjeTACvaTd7du+0LcDqa/WPm5va1L97InUYEbHSo3pv UhG84tuBILxPcAeJ/VVyfWHM8FwnOlEi6R1r6Cgw9Rmk2T7utNsYdy4Yo2Vnk+OLxdQl ZrCWOm+cgqoPXLK2oAE7CiwCL2bKj+0D5d2H7kHpQzyMeGyLBTVsvUNKczh5d8k/gVq+ zw2DFSPFMnsTFhXrs4VUdmCABSIP+bJNMipJgWs1aKOp/ZzIOjRJf4azAnvTgXnL1moc /7GKQpNlPKN+ZCJnf3seXu1A0yB5o3BOGdKp2H6Dz2/TJWd6xwtDaJUAUSkxvz4ViJhS PSgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=WYCodPgSQbxsvqvCCjKLZcm4QATIvQ6uhvXA/IjZoVE=; b=zwcsm6+rWbgceYNHgGe+TurXgg0ICB50dOCkk6JLBstP7438ZFaCo3gPQgI6ZSFeQr THgdj+fIAow634H44GzjjLCVnl3gCvg0f+X9HyNfTdWxMjACOt6poH09iBedOb3B9N2t 5XmcKqKmNoVKgWu/2eq0pwG3E9hk/TjLoSDpicGPHbWiFmXvVs++K8wBCDf1X5YMBiBF ZKrXSFRAJHb2A7wr9BS0LWRD9SMYRebPlcg8OGAbePM4IIk9mXOPG9Ky3p6GOiEXXrVc lRpNIlnRfuy8kz+TnaGllqAy6EBzMp5EanIRNg+g8jbSKRdFNX/G6kaUclQ7iBiGf0F5 GzhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=u0uzKue8; 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 q6si718977oth.26.2020.01.22.23.51.05; Wed, 22 Jan 2020 23:51:18 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=u0uzKue8; 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 S1726141AbgAWHuM (ORCPT + 99 others); Thu, 23 Jan 2020 02:50:12 -0500 Received: from mail25.static.mailgun.info ([104.130.122.25]:47154 "EHLO mail25.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgAWHuL (ORCPT ); Thu, 23 Jan 2020 02:50:11 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1579765811; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=WYCodPgSQbxsvqvCCjKLZcm4QATIvQ6uhvXA/IjZoVE=; b=u0uzKue88peISJd/QAYJNw4239NeSpts4YtLp424GXD+XUMWjVLSbp0LQClvQocWw2PEHjWJ GS/S5ayUk7jbW6PJFaI+DrNmhs47FhxeEaRwvs3awUur2VLG0u1Tq7e/sOG7MbzNBGqal91q FD98pFW2SxUOpY8gD9AVHWc98yk= X-Mailgun-Sending-Ip: 104.130.122.25 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 5e29502c.7fe6e4bbe180-smtp-out-n02; Thu, 23 Jan 2020 07:50:04 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 74932C447A2; Thu, 23 Jan 2020 07:50:02 +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 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hongwus) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9629FC43383; Thu, 23 Jan 2020 07:50:01 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 23 Jan 2020 15:50:01 +0800 From: hongwus@codeaurora.org To: Can Guo Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Venkat Gopalakrishnan , Tomas Winkler , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/8] scsi: ufs: set load before setting voltage in regulators In-Reply-To: <1579764349-15578-3-git-send-email-cang@codeaurora.org> References: <1579764349-15578-1-git-send-email-cang@codeaurora.org> <1579764349-15578-3-git-send-email-cang@codeaurora.org> Message-ID: <5e18c16a6f01043ccf4756ea7677441b@codeaurora.org> X-Sender: hongwus@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Can, It makes sense that set the load before enable regulator or set voltage. Just avoid voltage drop. On 2020-01-23 15:25, Can Guo wrote: > From: Asutosh Das > > This sequence change is required to avoid dips in voltage > during boot-up. > > Apparently, this dip is caused because in the original > sequence, the regulators are initialized in lpm mode. > And then when the load is set to high, and more current > is drawn, than is allowed in lpm, the dip is seen. > > Signed-off-by: Asutosh Das > Signed-off-by: Can Guo > --- > drivers/scsi/ufs/ufshcd.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index c2de29f..c386c2d 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -7225,6 +7225,11 @@ static int ufshcd_config_vreg(struct device > *dev, > name = vreg->name; > > if (regulator_count_voltages(reg) > 0) { > + uA_load = on ? vreg->max_uA : 0; > + ret = ufshcd_config_vreg_load(dev, vreg, uA_load); > + if (ret) > + goto out; > + > if (vreg->min_uV && vreg->max_uV) { > min_uV = on ? vreg->min_uV : 0; > ret = regulator_set_voltage(reg, min_uV, vreg->max_uV); > @@ -7235,11 +7240,6 @@ static int ufshcd_config_vreg(struct device > *dev, > goto out; > } > } > - > - uA_load = on ? vreg->max_uA : 0; > - ret = ufshcd_config_vreg_load(dev, vreg, uA_load); > - if (ret) > - goto out; > } > out: > return ret; Reviewed-by: Hongwu Su