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 1C5F5C43334 for ; Mon, 20 Jun 2022 03:50:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C8D738438D; Mon, 20 Jun 2022 05:50:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GvJKkldL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6E0E284347; Mon, 20 Jun 2022 05:50:08 +0200 (CEST) Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (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 3AE3B843FB for ; Mon, 20 Jun 2022 05:50:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heiko.thiery@gmail.com Received: by mail-ej1-x633.google.com with SMTP id h23so18550726ejj.12 for ; Sun, 19 Jun 2022 20:50:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/6ooglLkG1Jnu8oiplAWSje6p2JvQdYCxag+sZGwTQ8=; b=GvJKkldLkuxbxYLfRv6ho+6cDZCns8SFwkYfFtX3smgBW81ThHkCD9FQPCo4MEMRWx c8gdsosSd2urEIskqI9NEMj/rAPoNtwlB58h/ntCzaDg/AtBpdsGaNqm971hNY8yguhB 7hMGxevlcCuJRsHRVQ+0SMz76/RXZ+CmYD/56xx2gdNddeSCdQNYg7ut2JJ9EgIjWplM 4T199wPh5uElC1jECAcygQ+bUejaFaZyCaq9T+YzkEdkoW65iR2Qjn4v759v/14K/zcy s62NkaM4rOpOxuP2LcKoHMS/cqFylnwx6YQ/TUfpBBQEjUFZx+wM5ykWZwe/t6dgRCtU zgBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/6ooglLkG1Jnu8oiplAWSje6p2JvQdYCxag+sZGwTQ8=; b=PULyJo79Dxe6ZjUEdVtof+Oe4iQfl/j0G2JX2zuSZaRr+9AKTkcpJZ4QphtPcRENm/ QqJ+Qj9R7fdmgd2u/DKs0reP/FIyAKaO5Th4HfPUEuItOTUjrZbgM5GL+3fnpAmtSvG3 t0jJeCAUlXmfpipg/seurbikvx/kAcwifB+FKMn/A5Cz8SWleHzm8dzckp/qCGVBKrSX 57b2cbm8Mqnbz5jVDwuqjpbxO1xamvBzw7WczNPqVRx0QXP0JB2SVUIaeDqqdrtWrrHY HBwiV4gjExtGiT5/iXQGDLMeuYot7xGFL5nnjZNgpltrgM3c0+XndQIIHtSu8/uOiiw8 jwkg== X-Gm-Message-State: AJIora8eSULy4A+7Ne8ANLOYAwOTm+iWWyRWQefXR0uLFXBY46AlVsO5 l43+GG2JnQK9sbX1pbiXEbFiDU3Ss4M= X-Google-Smtp-Source: AGRyM1tUJQ61TsPocwErfz+VWfPrnxOLkUDEkvUjxsPfKCBjqTuFvplVUXHqCfcapHBSQb56Zk0gVQ== X-Received: by 2002:a17:906:5344:b0:712:3c7e:cf58 with SMTP id j4-20020a170906534400b007123c7ecf58mr19604973ejo.679.1655697005516; Sun, 19 Jun 2022 20:50:05 -0700 (PDT) Received: from hthiery.fritz.box ([2a02:810b:5a40:2a43:8e16:45ff:fe22:ad85]) by smtp.gmail.com with ESMTPSA id h16-20020a17090791d000b006fe98c7c7a9sm5211502ejz.85.2022.06.19.20.50.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 20:50:05 -0700 (PDT) From: Heiko Thiery To: u-boot@lists.denx.de Cc: Jaehoon Chung , Heiko Thiery , Marek Vasut , Fabio Estevam , Michael Nazzareno Trimarchi Subject: [PATCH] pmic: pca9450: permit config on all bucks and LDOs Date: Mon, 20 Jun 2022 05:49:49 +0200 Message-Id: <20220620034948.646319-1-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.5 at phobos.denx.de X-Virus-Status: Clean 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 --- 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]; -- 2.30.2