From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77DAAC28D13 for ; Mon, 22 Aug 2022 10:19:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E0EC8410C; Mon, 22 Aug 2022 12:19:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="duDrYgLs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8609684355; Mon, 22 Aug 2022 12:19:43 +0200 (CEST) Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EBD5883FE9 for ; Mon, 22 Aug 2022 12:19:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@amarulasolutions.com Received: by mail-pg1-x52f.google.com with SMTP id s206so8977590pgs.3 for ; Mon, 22 Aug 2022 03:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=rVcxQptiyx72Tje/ACVx26/fRiflByrQvrEYzQmpP/4=; b=duDrYgLsPkSR6AvM+frS+Ufcb5DUnZCPQMkjKhHHMqyZMgE62fnaz5OpHy+ASKZQDy Iez+7rydKRyeOA3Yga1GIPAma3cQ3IL5wVpTvT/eeask5pIytgjrZqhFvAsI0BufiAkM tRVyld3hz5K96MoAnqAs8rmn9m4LcuE0alSnE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=rVcxQptiyx72Tje/ACVx26/fRiflByrQvrEYzQmpP/4=; b=j40FKHQ/9wFGLSffgRGeDMyANs0uPl5VUS1IvcZnpE/jhO5tszpxSdZ7hb6R8SddcY RIy3hr/coOVqLccDIe/rl276p/dSU2Oi3zG4lSq6ewJJmgYzzbQ98YXsatwH5LkGIGPe nakuBjY4cV31lV0adIuOr7vJqkhHmhBeLnZEQ9g4ZSED5dCGJo8hYaqikhdoOQU8xVC0 IoCwcPAiE9zZh2NcL2wwJHwpCXOI2S+tcRHJv+r1+iQSUWy8lN8nYns6bBdOiUj6UxMY WxsqcQHg3RHSF3ZSzUub0YskR2Gtb3f9djwqSUVs8TNcpGxSjbQegas4uA6kfNBzuial y3cg== X-Gm-Message-State: ACgBeo2yOl1I8KN2BSONiGETGiOrGUcMcXiUP9m/KmgQncBmVuHcLRGr vUvEktVjdkjfWLNm1X5Hy0mDikn168Zqy8ooOlVobw== X-Google-Smtp-Source: AA6agR4skga0JCDLZnusPgP2BwsXTe2wva4TP1yF3d3WGF5ZTRw2D0uHbFRP/iPTTd86iB6/n89O9przZi184R4kcwM= X-Received: by 2002:a63:f5d:0:b0:41d:54a1:ede0 with SMTP id 29-20020a630f5d000000b0041d54a1ede0mr16642040pgp.74.1661163578082; Mon, 22 Aug 2022 03:19:38 -0700 (PDT) MIME-Version: 1.0 References: <20220620034948.646319-1-heiko.thiery@gmail.com> In-Reply-To: From: Michael Nazzareno Trimarchi Date: Mon, 22 Aug 2022 12:19:25 +0200 Message-ID: Subject: Re: [PATCH] pmic: pca9450: permit config on all bucks and LDOs To: Jaehoon Chung Cc: Heiko Thiery , u-boot@lists.denx.de, Marek Vasut , Fabio Estevam Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Heiko On Tue, Jul 26, 2022 at 10:20 AM Jaehoon Chung wrote: > > On 6/20/22 12:49, Heiko Thiery wrote: > > In order to have the possibility to configure the regulators at system > > startup through DM support, all LDOs and bucks must be able to be > > changeable. Currently there is a limitation to change the values when > > the output is enabled. Since the driver is based on the ROHM BD71837 and a > > comment that describes a limitation about switching while the output is > > enabled can also be found there, the limitation probably comes from this type. > > > > Signed-off-by: Heiko Thiery > > Reviewed-by: Fabio Estevam > > Reviewed-by: Jaehoon Chung > I think that this can be valid even for bd71837. Are you agree? Michael > Best Regards, > Jaehoon Chung > > > --- > > drivers/power/regulator/pca9450.c | 42 ++++++++++--------------------- > > 1 file changed, 13 insertions(+), 29 deletions(-) > > > > diff --git a/drivers/power/regulator/pca9450.c b/drivers/power/regulator/pca9450.c > > index 23badaa332..fe1869397c 100644 > > --- a/drivers/power/regulator/pca9450.c > > +++ b/drivers/power/regulator/pca9450.c > > @@ -44,7 +44,6 @@ struct pca9450_vrange { > > * @ranges: pointer to ranges of regulator voltages and matching register > > * values > > * @numranges: number of voltage ranges pointed by ranges > > - * @dvs: whether the voltage can be changed when regulator is enabled > > */ > > struct pca9450_plat { > > const char *name; > > @@ -54,7 +53,6 @@ struct pca9450_plat { > > u8 volt_mask; > > struct pca9450_vrange *ranges; > > unsigned int numranges; > > - bool dvs; > > }; > > > > #define PCA_RANGE(_min, _vstep, _sel_low, _sel_hi) \ > > @@ -63,11 +61,11 @@ struct pca9450_plat { > > .min_sel = (_sel_low), .max_sel = (_sel_hi), \ > > } > > > > -#define PCA_DATA(_name, enreg, enmask, vreg, vmask, _range, _dvs) \ > > +#define PCA_DATA(_name, enreg, enmask, vreg, vmask, _range) \ > > { \ > > .name = (_name), .enable_reg = (enreg), .enablemask = (enmask), \ > > .volt_reg = (vreg), .volt_mask = (vmask), .ranges = (_range), \ > > - .numranges = ARRAY_SIZE(_range), .dvs = (_dvs), \ > > + .numranges = ARRAY_SIZE(_range) \ > > } > > > > static struct pca9450_vrange pca9450_buck123_vranges[] = { > > @@ -107,39 +105,39 @@ static struct pca9450_plat pca9450_reg_data[] = { > > /* Bucks 1-3 which support dynamic voltage scaling */ > > PCA_DATA("BUCK1", PCA9450_BUCK1CTRL, HW_STATE_CONTROL, > > PCA9450_BUCK1OUT_DVS0, PCA9450_DVS_BUCK_RUN_MASK, > > - pca9450_buck123_vranges, true), > > + pca9450_buck123_vranges), > > PCA_DATA("BUCK2", PCA9450_BUCK2CTRL, HW_STATE_CONTROL, > > PCA9450_BUCK2OUT_DVS0, PCA9450_DVS_BUCK_RUN_MASK, > > - pca9450_buck123_vranges, true), > > + pca9450_buck123_vranges), > > PCA_DATA("BUCK3", PCA9450_BUCK3CTRL, HW_STATE_CONTROL, > > PCA9450_BUCK3OUT_DVS0, PCA9450_DVS_BUCK_RUN_MASK, > > - pca9450_buck123_vranges, true), > > + pca9450_buck123_vranges), > > /* Bucks 4-6 which do not support dynamic voltage scaling */ > > PCA_DATA("BUCK4", PCA9450_BUCK4CTRL, HW_STATE_CONTROL, > > PCA9450_BUCK4OUT, PCA9450_DVS_BUCK_RUN_MASK, > > - pca9450_buck456_vranges, false), > > + pca9450_buck456_vranges), > > PCA_DATA("BUCK5", PCA9450_BUCK5CTRL, HW_STATE_CONTROL, > > PCA9450_BUCK5OUT, PCA9450_DVS_BUCK_RUN_MASK, > > - pca9450_buck456_vranges, false), > > + pca9450_buck456_vranges), > > PCA_DATA("BUCK6", PCA9450_BUCK6CTRL, HW_STATE_CONTROL, > > PCA9450_BUCK6OUT, PCA9450_DVS_BUCK_RUN_MASK, > > - pca9450_buck456_vranges, false), > > + pca9450_buck456_vranges), > > /* LDOs */ > > PCA_DATA("LDO1", PCA9450_LDO1CTRL, HW_STATE_CONTROL, > > PCA9450_LDO1CTRL, PCA9450_LDO12_MASK, > > - pca9450_ldo1_vranges, false), > > + pca9450_ldo1_vranges), > > PCA_DATA("LDO2", PCA9450_LDO2CTRL, HW_STATE_CONTROL, > > PCA9450_LDO2CTRL, PCA9450_LDO12_MASK, > > - pca9450_ldo2_vranges, false), > > + pca9450_ldo2_vranges), > > PCA_DATA("LDO3", PCA9450_LDO3CTRL, HW_STATE_CONTROL, > > PCA9450_LDO3CTRL, PCA9450_LDO34_MASK, > > - pca9450_ldo34_vranges, false), > > + pca9450_ldo34_vranges), > > PCA_DATA("LDO4", PCA9450_LDO4CTRL, HW_STATE_CONTROL, > > PCA9450_LDO4CTRL, PCA9450_LDO34_MASK, > > - pca9450_ldo34_vranges, false), > > + pca9450_ldo34_vranges), > > PCA_DATA("LDO5", PCA9450_LDO5CTRL_H, HW_STATE_CONTROL, > > PCA9450_LDO5CTRL_H, PCA9450_LDO5_MASK, > > - pca9450_ldo5_vranges, false), > > + pca9450_ldo5_vranges), > > }; > > > > static int vrange_find_value(struct pca9450_vrange *r, unsigned int sel, > > @@ -246,20 +244,6 @@ static int pca9450_set_value(struct udevice *dev, int uvolt) > > unsigned int sel; > > int i, found = 0; > > > > - /* > > - * An under/overshooting may occur if voltage is changed for other > > - * regulators but buck 1,2,3 or 4 when regulator is enabled. Prevent > > - * change to protect the HW > > - */ > > - if (!plat->dvs) > > - if (pca9450_get_enable(dev)) { > > - /* If the value is already set, skip the warning. */ > > - if (pca9450_get_value(dev) == uvolt) > > - return 0; > > - pr_err("Only DVS bucks can be changed when enabled\n"); > > - return -EINVAL; > > - } > > - > > for (i = 0; i < plat->numranges; i++) { > > struct pca9450_vrange *r = &plat->ranges[i]; > > > -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com