From patchwork Tue Dec 13 18:27:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Botka X-Patchwork-Id: 32911 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp291900wrn; Tue, 13 Dec 2022 10:31:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf6L+fE/3biITpYpy8ievlrK0kV8BVbpVylnJkXV65TLXTgYVltpYtcMrGwZEAPPSX7VqEzE X-Received: by 2002:a05:6a00:a93:b0:56b:6c05:3da6 with SMTP id b19-20020a056a000a9300b0056b6c053da6mr27312948pfl.8.1670956266029; Tue, 13 Dec 2022 10:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670956266; cv=none; d=google.com; s=arc-20160816; b=f6cWXnqLNpklQkg56iKE6N/zxzJYr9TOJNpapv5edGdUOZjdOyPAijBn5ghB13y0zf Nth3KsmmfRxldtFUjy048mxCK1d3ppEdOhxX9L3WsWuuQb/582fdiv1CEv7EwKLxMR1G ZaafPmKr+aQbY/0Y2jYXt+s2Ns0K/JCQHxkd5C1wYZJz40b4aCcJ2yr3yH0kf8LdmwPl zR3aIhqWA696Q2VivIjfkyuPmpR9D43DzSP9wwbT+SwWVbp/Si7WCgOX/Q7RfI38t0By DMTO4nSjeB4sfsP667lPXwcbApu5YNvtRwI8G3R1SW3k6qL6Poa4W0RuSVdT8ee+WUZN QF3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=KIOVap3fWl/6AHYfMObbBhxstjJgOhGuPhH97J5r18w=; b=KNTXZ0Bd9TV646M+eRNFloTxAE7OLh2wzYOB904WhhD9mEqC2TaJ6RYMybN0Uyr8/I y61JOjDkhn4qrvmDqWqXdVB45RwDx7W2u82FqvRTK4SCus64p/ONUxhwBjWOL1VgQMSW QG2MOME+gEHVQwDJhEHxSxaoiqPFvsNp2EcriT7x/uq5aMKau/Otg4vJFAnAVipXUOGO EAkJivZ6+AMTC6/9aWqrVtoh4WpsXkoA03eaEAtlPiW0jSOy7z/Xl6BuKPc2DllQZZLV 8RiTTmYgA2mKsFp/1wN8hzRlygEYYJZqJnAj7rdkOqEWlKlSjN90f4kElhPNKOxkNAZf Zo2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw15-20020a056a00450f00b00563ab8e5e83si12947992pfb.370.2022.12.13.10.30.53; Tue, 13 Dec 2022 10:31:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236528AbiLMS2L (ORCPT + 99 others); Tue, 13 Dec 2022 13:28:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236526AbiLMS2C (ORCPT ); Tue, 13 Dec 2022 13:28:02 -0500 Received: from relay02.th.seeweb.it (relay02.th.seeweb.it [IPv6:2001:4b7a:2000:18::163]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EABB201AD for ; Tue, 13 Dec 2022 10:28:00 -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 4D88D201D3; Tue, 13 Dec 2022 19:27:58 +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 1/1] dt-bindings: mfd: x-powers,axp152: Document the AXP1530 variant Date: Tue, 13 Dec 2022 19:27:40 +0100 Message-Id: <20221213182743.3087889-2-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 X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752124637797557660?= X-GMAIL-MSGID: =?utf-8?q?1752124637797557660?= AXP1530 is a PMIC used on board BIQU CB1 SoM Signed-off-by: Martin Botka Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml index b7a8747d5fa0..7559a13a071c 100644 --- a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml +++ b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml @@ -84,6 +84,7 @@ properties: oneOf: - enum: - x-powers,axp152 + - x-powers,axp1530 - x-powers,axp202 - x-powers,axp209 - x-powers,axp221 From patchwork Tue Dec 13 18:27:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Botka X-Patchwork-Id: 32912 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp292113wrn; Tue, 13 Dec 2022 10:31:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf7pVvu5ZbObLSTPxRk6KX0bsp/ZDg5tKRdhoki4xBBdChmUQJJE9LEKdkizSTbEq/cWT61s X-Received: by 2002:a05:6300:811c:b0:a9:d33f:e59c with SMTP id bs28-20020a056300811c00b000a9d33fe59cmr22911819pzc.22.1670956285007; Tue, 13 Dec 2022 10:31:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670956284; cv=none; d=google.com; s=arc-20160816; b=HBgrXef7YBP6oJkkSJHV6/6yUxE01Un0ptPZWdu02RP9O0RhviIX1pqiGjxJpxePdU MjtfBsATjJItWT/yhFgQQcYvXmV0FU+ZP4HOd1LmMzvUS7/p0WwpVqRmCvNOubil3cCJ xW4RflRRw7jk20m4njNxjyzeWcB5thZYpk0WWv65AKSTAFci6T+gh11MEC9cgCOo7fva XwJp03FOfv8225WeW37v7uYXIRsDSEagh8FaePR1KS8k1orUYvYG13MhoaRLkQWrolA0 JkmpYGDArFKWWsU7adTUdmKnRCoGE0KZnZ9fZc0ogbxk02y1dQFbBNldVce8rz9bdXHZ nwfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jd201npy1mqzwsSntH2tmaTR7sBu5QtQoV8DvRj1jaE=; b=FDsfnBRgezPXIg97P/p/i9ynt9L2j3xD81q7PhfTLFtUkQfqlDH2V1l6LnhhO9rn8h NcX7TRCxWAx6mkeFk3LpikjiYNccuAMbDWJCAkeqjpDXFZRtuF+F8GywtHrYfxEgh92L iqXZtky1qbqFIWy1XrLvSOp3s/V+ZHZ8OwZXvl577DGKXLqZYbuoD5oi/yIRxdw6jAl5 X7W+5XDOT0PW8CDhXFlqi7BXlWA8E0h99JwJAHdg4TsgZlTIhhPoCNlcIljPXdtS+P09 n5DdT0tMHkcDHrOKnpB5whXNZ+3wccO3ESPDk7ZohQmfT+Ec7glYQsjh41dJhnfmN/5n /iRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s193-20020a632cca000000b00476f101ef48si13659745pgs.7.2022.12.13.10.31.12; Tue, 13 Dec 2022 10:31:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236538AbiLMS2P (ORCPT + 99 others); Tue, 13 Dec 2022 13:28:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbiLMS2D (ORCPT ); Tue, 13 Dec 2022 13:28:03 -0500 Received: from relay01.th.seeweb.it (relay01.th.seeweb.it [5.144.164.162]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 506DB2098C for ; Tue, 13 Dec 2022 10:28:01 -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 46F9520214; Tue, 13 Dec 2022 19:27:59 +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 2/3] mfd: ax20x: Add suppport for AXP1530 PMIC Date: Tue, 13 Dec 2022 19:27:41 +0100 Message-Id: <20221213182743.3087889-3-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 X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752124657832501063?= X-GMAIL-MSGID: =?utf-8?q?1752124657832501063?= AXP1530 is a PMIC chip produced by X-Powers and an be connected via I2C bus. Where AXP313A seems to be closely related so the same driver can be used and seen it only paired with H616 SoC. Signed-off-by: Martin Botka --- drivers/mfd/axp20x-i2c.c | 2 ++ drivers/mfd/axp20x.c | 62 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/axp20x.h | 34 +++++++++++++++++++++ 3 files changed, 98 insertions(+) diff --git a/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c index 8fd6727dc30a..49c4acee3927 100644 --- a/drivers/mfd/axp20x-i2c.c +++ b/drivers/mfd/axp20x-i2c.c @@ -66,6 +66,7 @@ static const struct of_device_id axp20x_i2c_of_match[] = { { .compatible = "x-powers,axp223", .data = (void *)AXP223_ID }, { .compatible = "x-powers,axp803", .data = (void *)AXP803_ID }, { .compatible = "x-powers,axp806", .data = (void *)AXP806_ID }, + { .compatible = "x-powers,axp1530", .data = (void *)AXP1530_ID}, { }, }; MODULE_DEVICE_TABLE(of, axp20x_i2c_of_match); @@ -79,6 +80,7 @@ static const struct i2c_device_id axp20x_i2c_id[] = { { "axp223", 0 }, { "axp803", 0 }, { "axp806", 0 }, + { "axp1530", 0 }, { }, }; MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id); diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 880c41fa7021..d80bf25cfd72 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -43,6 +43,7 @@ static const char * const axp20x_model_names[] = { "AXP806", "AXP809", "AXP813", + "AXP1530", }; static const struct regmap_range axp152_writeable_ranges[] = { @@ -168,6 +169,24 @@ static const struct regmap_access_table axp806_volatile_table = { .n_yes_ranges = ARRAY_SIZE(axp806_volatile_ranges), }; +static const struct regmap_range axp1530_writeable_ranges[] = { + regmap_reg_range(AXP1530_ON_INDICATE, AXP1530_FREQUENCY), +}; + +static const struct regmap_range axp1530_volatile_ranges[] = { + regmap_reg_range(AXP1530_ON_INDICATE, AXP1530_FREQUENCY), +}; + +static const struct regmap_access_table axp1530_writeable_table = { + .yes_ranges = axp1530_writeable_ranges, + .n_yes_ranges = ARRAY_SIZE(axp1530_writeable_ranges), +}; + +static const struct regmap_access_table axp1530_volatile_table = { + .yes_ranges = axp1530_volatile_ranges, + .n_yes_ranges = ARRAY_SIZE(axp1530_volatile_ranges), +}; + static const struct resource axp152_pek_resources[] = { DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_RIS_EDGE, "PEK_DBR"), DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_FAL_EDGE, "PEK_DBF"), @@ -281,6 +300,15 @@ static const struct regmap_config axp806_regmap_config = { .cache_type = REGCACHE_RBTREE, }; +static const struct regmap_config axp1530_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .wr_table = &axp1530_writeable_table, + .volatile_table = &axp1530_volatile_table, + .max_register = AXP1530_FREQUENCY, + .cache_type = REGCACHE_RBTREE, +}; + #define INIT_REGMAP_IRQ(_variant, _irq, _off, _mask) \ [_variant##_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) } @@ -502,6 +530,16 @@ static const struct regmap_irq axp809_regmap_irqs[] = { INIT_REGMAP_IRQ(AXP809, GPIO0_INPUT, 4, 0), }; +static const struct regmap_irq axp1530_regmap_irqs[] = { + INIT_REGMAP_IRQ(AXP1530, KEY_L2H_EN, 0, 7), + INIT_REGMAP_IRQ(AXP1530, KEY_H2L_EN, 0, 6), + INIT_REGMAP_IRQ(AXP1530, POKSIRQ_EN, 0, 5), + INIT_REGMAP_IRQ(AXP1530, POKLIRQ_EN, 0, 4), + INIT_REGMAP_IRQ(AXP1530, DCDC3_UNDER, 0, 3), + INIT_REGMAP_IRQ(AXP1530, DCDC2_UNDER, 0, 2), + INIT_REGMAP_IRQ(AXP1530, TEMP_OVER, 0, 0), +}; + static const struct regmap_irq_chip axp152_regmap_irq_chip = { .name = "axp152_irq_chip", .status_base = AXP152_IRQ1_STATE, @@ -588,6 +626,18 @@ static const struct regmap_irq_chip axp809_regmap_irq_chip = { .num_regs = 5, }; +static const struct regmap_irq_chip axp1530_regmap_irq_chip = { + .name = "axp1530_irq_chip", + .status_base = AXP1530_IRQ_STATUS1, + .ack_base = AXP1530_IRQ_STATUS1, + .mask_base = AXP1530_IRQ_ENABLE1, + .mask_invert = true, + .init_ack_masked = true, + .irqs = axp1530_regmap_irqs, + .num_irqs = ARRAY_SIZE(axp1530_regmap_irqs), + .num_regs = 1, +}; + static const struct mfd_cell axp20x_cells[] = { { .name = "axp20x-gpio", @@ -832,6 +882,12 @@ static const struct mfd_cell axp813_cells[] = { }, }; +static struct mfd_cell axp1530_cells[] = { + { + .name = "axp20x-regulator", + }, +}; + static struct axp20x_dev *axp20x_pm_power_off; static void axp20x_power_off(void) { @@ -942,6 +998,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x) */ axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; break; + case AXP1530_ID: + axp20x->nr_cells = ARRAY_SIZE(axp1530_cells); + axp20x->cells = axp1530_cells; + axp20x->regmap_cfg = &axp1530_regmap_config; + axp20x->regmap_irq_chip = &axp1530_regmap_irq_chip; + break; default: dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant); return -EINVAL; diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index 9ab0e2fca7ea..75dcc2411940 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h @@ -21,6 +21,7 @@ enum axp20x_variants { AXP806_ID, AXP809_ID, AXP813_ID, + AXP1530_ID, NR_AXP20X_VARIANTS, }; @@ -128,6 +129,18 @@ enum axp20x_variants { #define AXP803_DCDC6_V_OUT 0x25 #define AXP803_DCDC_FREQ_CTRL 0x3b +#define AXP1530_ON_INDICATE 0x00 +#define AXP1530_OUTPUT_CONTROL 0x10 +#define AXP1530_DCDC1_CONRTOL 0x13 +#define AXP1530_DCDC2_CONRTOL 0x14 +#define AXP1530_DCDC3_CONRTOL 0x15 +#define AXP1530_ALDO1_CONRTOL 0x16 +#define AXP1530_DLDO1_CONRTOL 0x17 +#define AXP1530_OUTOUT_MONITOR 0x1D +#define AXP1530_IRQ_ENABLE1 0x20 +#define AXP1530_IRQ_STATUS1 0x21 +#define AXP1530_FREQUENCY 0x87 + /* Other DCDC regulator control registers are the same as AXP803 */ #define AXP813_DCDC7_V_OUT 0x26 @@ -419,6 +432,16 @@ enum { AXP813_REG_ID_MAX, }; +enum +{ + AXP1530_DCDC1 = 0, + AXP1530_DCDC2, + AXP1530_DCDC3, + AXP1530_LDO1, + AXP1530_LDO2, + AXP1530_REG_ID_MAX, +}; + /* IRQs */ enum { AXP152_IRQ_LDO0IN_CONNECT = 1, @@ -632,6 +655,17 @@ enum axp809_irqs { AXP809_IRQ_GPIO0_INPUT, }; +enum axp1530_irqs +{ + AXP1530_IRQ_TEMP_OVER, + AXP1530_IRQ_DCDC2_UNDER = 2, + AXP1530_IRQ_DCDC3_UNDER, + AXP1530_IRQ_POKLIRQ_EN, + AXP1530_IRQ_POKSIRQ_EN, + AXP1530_IRQ_KEY_L2H_EN, + AXP1530_IRQ_KEY_H2L_EN, +}; + struct axp20x_dev { struct device *dev; int irq; From patchwork Tue Dec 13 18:27:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Botka X-Patchwork-Id: 32913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp292877wrn; Tue, 13 Dec 2022 10:32:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5rioINtMAQQQKg5svVCz9jFS8S2KD3eM8J7kMhilRHUqib/2s6JucmPXWIdDxrm3EPCKsA X-Received: by 2002:a05:6a21:3a44:b0:9d:efbe:2082 with SMTP id zu4-20020a056a213a4400b0009defbe2082mr28561209pzb.56.1670956365003; Tue, 13 Dec 2022 10:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670956364; cv=none; d=google.com; s=arc-20160816; b=xv/GzkAboUIfZ6pHkBm9o5qxDWDMrSYtEh/TPNzX0e5JWEqhGigTtdKz5GzvmxO3NW AIQpuW0PdTU5xwrwDeH3312NNLBHCsBww6JwJO7xfBiyoA9lrt9/lDOUq+2OOrHc58dE gY9jlAGqDaozBe8itCVZiXj6Z4K8y8RxcgFf9pMS4AiAbQaJo6KufwLw7bBRjBVeTfjo HPXVLqw0Pk/kiom4u3r5p62Kra8K0z8LRU3BRIgwiNKh6YzGymCpRVRSOmYkU9OEuUTT swLgA0QUMSWE2ef5A6OkT7k8DmR5WPJU6DKzOUG5AiuqJ/AE43tZBdIj67out2hMi5Gm M1Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1B5sDFz+wrus+pIfXf+e8TdjnHgNct1lMrTiaXhPVYQ=; b=JxQO9O1jkasWs9tHpeqZthcnrGCyVyyBmCF1h0zJV4arBedPiZXSs7uOmTnOzekf2g EeYk7vDMNzx8/U3nii9SJdwULjVTGK7WiiAiMMz5EIRXrYznRsByhNom434Uq9LgXgPY 1Jf/wE2Gu78IddmcphfY4HWhAlKOyP9qgXREphhiYZPd8WAHT8PfuwmKX5gQsY4xmulG j4ycmsG/Mo4/ZHYXztFWf9VzY6VwH6YAox1my5B9eiiCsRbMQp2Hi8DT6jCo9lw0PVGD AEtQMZyMce7HdVtjj/M7CzO1n0HXy0U95NRRUb4vNeBMcbwB9BeHzPZ6q0t72PQiMc0J 7MTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020a631d50000000b0047872d46782si1680025pgm.408.2022.12.13.10.32.31; Tue, 13 Dec 2022 10:32:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236325AbiLMS2S (ORCPT + 99 others); Tue, 13 Dec 2022 13:28:18 -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 X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,RCVD_IN_SORBS_HTTP, RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752124741398334063?= X-GMAIL-MSGID: =?utf-8?q?1752124741398334063?= 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/axp20x-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[] = { AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_DC1SW_MASK), }; +static const struct linear_range axp1530_dcdc1_ranges[] = { + 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[] = { + REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000), + REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x57, 20000), +}; + +static const struct linear_range axp1530_dcdc3_ranges[] = { + REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000), + REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x66, 20000), +}; + +static const struct regulator_desc axp1530_regulators[] = { + 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 = dev_get_drvdata(pdev->dev.parent); @@ -1040,6 +1074,12 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) def = 3000; step = 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_device *pdev) bool drivevbus = false; switch (axp20x->variant) { + case AXP1530_ID: + regulators = axp1530_regulators; + nregulators = AXP1530_REG_ID_MAX; + break; case AXP202_ID: case AXP209_ID: regulators = axp20x_regulators;