Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp360409ybl; Wed, 22 Jan 2020 23:27:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwPEccRB3PeCuTcCfBYp/97H9mClxmHufcxXkD6ZpbtF3MwSTW0qWpmxaFAS+L+OMlnNGf1 X-Received: by 2002:aca:1b08:: with SMTP id b8mr9699571oib.62.1579764442616; Wed, 22 Jan 2020 23:27:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579764442; cv=none; d=google.com; s=arc-20160816; b=ok8KuFNRP5GkQD2KLDsKWl4XJaYhHMbMUD30v7wATZyOnxWO6ZdbqVWxv95pskJdm0 RK6yxSOTA6JWR6XLfi+bxUn/LpDDkbEQz0nek3HFAmbmfa19F2K1+w+vlzEbX/0XptQy KTg5n3+VwEIFrCbF1x5iGlRmcK+dgauedVd+1q1KiKBaDrN5qm8nxmBobx3ykfi//Q86 Yivc0UBNGI5zIaALa/e/BJRR6jb4p1cKStiFHhXq0clwRSJ/u6H2N17vJZbmPc4j/SpB 2sAC83QhAU9APVs51rN0fJKA/QSkAMsPzHQA05TCRpWC1oRNNTi4SOJEzc4ekUbm/0YX /+2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=jlECrQqzMHz44LBdbWGV4n3B2pcNbtodfLvTBcDva38=; b=x7vXIlTRxEOx7pQsXpReQWYCuFnXgFnoi9W7AQGw3RIIc+lN9FDa4t6vPBCGeaMq12 TWy9bOdcJdTMyEUbhAtcuUt5ssB/QYq/UIEGMKgYzRns2rjqunnzUreunH4a4cC7EBiy BUEvtN38YJFDqHlIsZfhIst+q8EWJpj8s2hmV6ZetzjU66hqrNU7doOZ1p8ge86ea+Ex 1u0/9btFGOgQlSXWCitKVvZkqAEoFV/h+hr36UdnPlBoWW59W4SvUEt4e4O4Ab+Hs0t+ l31nr4cKFCO5q+2GR9TM4ktMG/RGUfX4YImkcm+mFgsM/QNuebD+rad1N85WB9JsU677 Oe6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=vkO7nBje; 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 i20si721223otk.270.2020.01.22.23.27.10; Wed, 22 Jan 2020 23:27:22 -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=vkO7nBje; 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 S1726811AbgAWH0J (ORCPT + 99 others); Thu, 23 Jan 2020 02:26:09 -0500 Received: from mail25.static.mailgun.info ([104.130.122.25]:15242 "EHLO mail25.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbgAWH0I (ORCPT ); Thu, 23 Jan 2020 02:26:08 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1579764367; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=jlECrQqzMHz44LBdbWGV4n3B2pcNbtodfLvTBcDva38=; b=vkO7nBjeQ0exqso0S1jNdNrB/Va2QomrA1Z4z3S8FNah3AtBmaR0xIS2wkgVApADYIP3Ee7S YLfoF7s8NXp4ZNXqDCI8i0pp614Vnh0CmO0FuvDvG8vt8mjq9vrf0Nro7thgsDP43C4tuyGd t3e0t37evzsG1P9/pCfpAcUXu54= 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 5e294a8d.7f05fd58fc70-smtp-out-n01; Thu, 23 Jan 2020 07:26:05 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id AB229C447A1; Thu, 23 Jan 2020 07:26:05 +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 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5D27BC433CB; Thu, 23 Jan 2020 07:26:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5D27BC433CB 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=cang@codeaurora.org From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Venkat Gopalakrishnan , Tomas Winkler , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 2/8] scsi: ufs: set load before setting voltage in regulators Date: Wed, 22 Jan 2020 23:25:43 -0800 Message-Id: <1579764349-15578-3-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1579764349-15578-1-git-send-email-cang@codeaurora.org> References: <1579764349-15578-1-git-send-email-cang@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project