From nobody Thu Sep 18 01:49:59 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 023E9C4332F for ; Tue, 13 Dec 2022 18:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236541AbiLMS2U (ORCPT ); Tue, 13 Dec 2022 13:28:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236495AbiLMS2D (ORCPT ); Tue, 13 Dec 2022 13:28:03 -0500 Received: from relay01.th.seeweb.it (relay01.th.seeweb.it [IPv6:2001:4b7a:2000:18::162]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20FF61FCF5 for ; Tue, 13 Dec 2022 10:28:02 -0800 (PST) Received: from TimeMachine.lan (adsl-d248.84-47-10.t-com.sk [84.47.10.248]) by m-r1.th.seeweb.it (Postfix) with ESMTPA id 2EB11202DF; Tue, 13 Dec 2022 19:28:00 +0100 (CET) From: Martin Botka To: martin.botka1@gmail.com Cc: Konrad Dybcio , AngeloGioacchino Del Regno , Marijn Suijten , Jami Kettunen , Paul Bouchara , Jan Trmal , Tom , Martin Botka , Lee Jones , Rob Herring , Krzysztof Kozlowski , Chen-Yu Tsai , Liam Girdwood , Mark Brown , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/3] regulator: axp20x: Add support for AXP1530 variant Date: Tue, 13 Dec 2022 19:27:42 +0100 Message-Id: <20221213182743.3087889-4-martin.botka@somainline.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221213182743.3087889-1-martin.botka@somainline.org> References: <20221213182743.3087889-1-martin.botka@somainline.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" AXP1530 has a few regulators that are controlled via I2C Bus. Add support for them. Signed-off-by: Martin Botka --- drivers/regulator/axp20x-regulator.c | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20= x-regulator.c index d260c442b788..9420839ff4f9 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c @@ -1001,6 +1001,40 @@ static const struct regulator_desc axp813_regulators= [] =3D { AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_DC1SW_MASK), }; =20 +static const struct linear_range axp1530_dcdc1_ranges[] =3D { + REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000), + REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x57, 20000), + REGULATOR_LINEAR_RANGE(1600000, 0x58, 0x6A, 100000), +}; + +static const struct linear_range axp1530_dcdc2_ranges[] =3D { + REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000), + REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x57, 20000), +}; + +static const struct linear_range axp1530_dcdc3_ranges[] =3D { + REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000), + REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x66, 20000), +}; + +static const struct regulator_desc axp1530_regulators[] =3D { + AXP_DESC_RANGES(AXP1530, DCDC1, "dcdc1", "vin1", axp1530_dcdc1_ranges, + 0x6B, AXP1530_DCDC1_CONRTOL, 0x7f, AXP1530_OUTPUT_CONTROL, + BIT(0)), + AXP_DESC_RANGES(AXP1530, DCDC2, "dcdc2", "vin2", axp1530_dcdc2_ranges, + 0x58, AXP1530_DCDC2_CONRTOL, 0x7f, AXP1530_OUTPUT_CONTROL, + BIT(1)), + AXP_DESC_RANGES(AXP1530, DCDC3, "dcdc3", "vin3", axp1530_dcdc3_ranges, + 0x58, AXP1530_DCDC3_CONRTOL, 0x7f, AXP1530_OUTPUT_CONTROL, + BIT(2)), + AXP_DESC(AXP1530, LDO1, "ldo1", "ldo1in", 500, 3500, 100, + AXP1530_ALDO1_CONRTOL, 0x1f, AXP1530_OUTPUT_CONTROL, + BIT(3)), + AXP_DESC(AXP1530, LDO2, "ldo2", "ldo2in", 500, 3500, 100, + AXP1530_DLDO1_CONRTOL, 0x1f, AXP1530_OUTPUT_CONTROL, + BIT(4)), +}; + static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) { struct axp20x_dev *axp20x =3D dev_get_drvdata(pdev->dev.parent); @@ -1040,6 +1074,12 @@ static int axp20x_set_dcdc_freq(struct platform_devi= ce *pdev, u32 dcdcfreq) def =3D 3000; step =3D 150; break; + case AXP1530_ID: + /* + * Do not set the DCDC frequency on AXP1530 + */ + return 0; + break; default: dev_err(&pdev->dev, "Setting DCDC frequency for unsupported AXP variant\n"); @@ -1220,6 +1260,10 @@ static int axp20x_regulator_probe(struct platform_de= vice *pdev) bool drivevbus =3D false; =20 switch (axp20x->variant) { + case AXP1530_ID: + regulators =3D axp1530_regulators; + nregulators =3D AXP1530_REG_ID_MAX; + break; case AXP202_ID: case AXP209_ID: regulators =3D axp20x_regulators; --=20 2.38.1