Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3463936ybf; Tue, 3 Mar 2020 06:31:14 -0800 (PST) X-Google-Smtp-Source: ADFU+vv1kBYohQh0KWU8WP6A7LxJZ792aJ/QqoSyBRf92BS+m+eScMkA448Xjf/5Iec9j0GhZoBY X-Received: by 2002:a05:6830:18ce:: with SMTP id v14mr3479471ote.36.1583245874687; Tue, 03 Mar 2020 06:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583245874; cv=none; d=google.com; s=arc-20160816; b=QcjPMKh+LkaOlOeD4Qo3bjMhyBeAtwzlLNNYSGiMjCqL9gcKQqp78cu83CWedi0wKH qmcnUlP3DIiP/iZTAlVyeq3rzOJ6nC7pJySVp5DEY2zAelmbbS2iepOZLyvqjxtoz03n y4/8PXuDqKB3lgMVL77DpeUXUpYLjnKgehLQdaoDP0UwyZ7FtpEoUSvfx+GgwA4el4EH BReG2y8nbHE13tUMJ+Qdc6SQfgXxtxhS3U8r3IX/5Goe3h8vnkc6A/Meq4oHGvk9eG8o cciDuFGcPy9kC2ixv8cyZ6bUc7SMDbCPePKKv0xIhUr7RkgCrRbDYOsoyG5rU8yLsICV unSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=NTh6e3hNV5dSo21fP9zOW9w7yEIX6gJXjKmvkNl80p0=; b=W+mUoLAR+2yoJBL8x1vU/GtGn5arkkLenCXCvrmx2pPsiKawk4SH6c0lUPZUfHbVHa btJ9XXLl8f7ruF2nZr2aneSjf9Ipg8bFIwVCVGEXshAzT1JgdfmUQC2kMzZC+7tQ5pKQ 9lxuxDbwcqC84wKE9q87ExQQJmzowhY3B1EBs7Awsr5W8eFfdBGD31vFQOVJPzVf/Mme 6DCIAPyxHIuZ/clMTh2y54LCFKg8YA27/4QTtGrnm/Ipcn7jXZnsE/qFJJI+VSUCiUH4 vNZhttdMNBz9mX/sw1ZJ+Gz3yqy5vcGerDIHYq18hylIUbKDXbuiBt1VhZTjauWA53cT Ykqw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si7498954oic.153.2020.03.03.06.31.01; Tue, 03 Mar 2020 06:31:14 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729138AbgCCOam (ORCPT + 99 others); Tue, 3 Mar 2020 09:30:42 -0500 Received: from inva021.nxp.com ([92.121.34.21]:57390 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728113AbgCCOam (ORCPT ); Tue, 3 Mar 2020 09:30:42 -0500 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 5893E201402; Tue, 3 Mar 2020 15:30:40 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id CC786201257; Tue, 3 Mar 2020 15:30:37 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 61239402F3; Tue, 3 Mar 2020 22:30:34 +0800 (SGT) From: Anson Huang To: lgirdwood@gmail.com, broonie@kernel.org, linux-kernel@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH] regulator: anatop: Drop min dropout for bypass mode Date: Tue, 3 Mar 2020 22:24:36 +0800 Message-Id: <1583245476-8009-1-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some of anatop regulators support bypass mode, and in bypass mode, minimum dropout is NOT required, the input voltage will be equal to the output voltage. The minimum dropout value is ONLY necessary for LDO enabled mode, so drop the minimum dropout for bypass mode to avoid unexpected high voltage output from PMIC supplies. Signed-off-by: Anson Huang --- drivers/regulator/anatop-regulator.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index ca92b3d..1a775d9 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -22,6 +22,7 @@ #define LDO_POWER_GATE 0x00 #define LDO_FET_FULL_ON 0x1f +#define LDO_MIN_DROPOUT_UV 125000 struct anatop_regulator { u32 delay_reg; int delay_bit_shift; @@ -128,6 +129,10 @@ static int anatop_regmap_set_bypass(struct regulator_dev *reg, bool enable) sel = enable ? LDO_FET_FULL_ON : anatop_reg->sel; anatop_reg->bypass = enable; + if (anatop_reg->bypass) + anatop_reg->rdesc.min_dropout_uV = 0; + else + anatop_reg->rdesc.min_dropout_uV = LDO_MIN_DROPOUT_UV; return regulator_set_voltage_sel_regmap(reg, sel); } @@ -246,7 +251,7 @@ static int anatop_regulator_probe(struct platform_device *pdev) rdesc->linear_min_sel = min_bit_val; rdesc->vsel_reg = control_reg; rdesc->vsel_mask = ((1 << vol_bit_width) - 1) << vol_bit_shift; - rdesc->min_dropout_uV = 125000; + rdesc->min_dropout_uV = LDO_MIN_DROPOUT_UV; config.dev = &pdev->dev; config.init_data = initdata; @@ -268,6 +273,7 @@ static int anatop_regulator_probe(struct platform_device *pdev) if (sreg->sel == LDO_FET_FULL_ON) { sreg->sel = 0; sreg->bypass = true; + rdesc->min_dropout_uV = 0; } /* -- 2.7.4