From nobody Thu Dec 18 15:24:24 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 BEC2BEE49A6 for ; Mon, 21 Aug 2023 16:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236654AbjHUQ3S (ORCPT ); Mon, 21 Aug 2023 12:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236644AbjHUQ3R (ORCPT ); Mon, 21 Aug 2023 12:29:17 -0400 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 969A4FD; Mon, 21 Aug 2023 09:29:15 -0700 (PDT) Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 37LEGgWE010872; Mon, 21 Aug 2023 12:28:54 -0400 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3skvcqc7xy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Aug 2023 12:28:53 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 37LGSqkD055702 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Aug 2023 12:28:52 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 21 Aug 2023 12:28:51 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 21 Aug 2023 12:28:51 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 21 Aug 2023 12:28:51 -0400 Received: from HYB-a2JJhsYKAxD.ad.analog.com (HYB-a2JJhsYKAxD.ad.analog.com [10.25.72.79]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 37LGSQsp012468; Mon, 21 Aug 2023 12:28:38 -0400 From: Gokhan Celik To: CC: Gokhan Celik , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Gokhan Celik , , Subject: [PATCH 1/2] drivers: regulator: Add MAX77503 regulator driver Date: Mon, 21 Aug 2023 19:28:21 +0300 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: SvH2lX2qulJ1nb4aTtsJmFyHDYjlHc1P X-Proofpoint-GUID: SvH2lX2qulJ1nb4aTtsJmFyHDYjlHc1P X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-21_04,2023-08-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 impostorscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 clxscore=1015 adultscore=0 bulkscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2306200000 definitions=main-2308210153 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add MAX77503 buck converter driver. Signed-off-by: Gokhan Celik --- drivers/regulator/Kconfig | 10 ++ drivers/regulator/Makefile | 1 + drivers/regulator/max77503-regulator.c | 137 +++++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 drivers/regulator/max77503-regulator.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 823f8e6e4801..dbd2053774e9 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -556,6 +556,16 @@ config REGULATOR_MAX597X The MAX5970/5978 is a smart switch with no output regulation, but fault protection and voltage and current monitoring capabilities. =20 +config REGULATOR_MAX77503 + tristate "Analog Devices MAX77503 Regulator" + depends on I2C + select REGMAP_I2C + help + This driver controls a Analog Devices MAX77503 14V input, 1.5A + high-efficiency buck converter via I2C bus. + Say M here if you want to include support for the regulator as a + module. + config REGULATOR_MAX77541 tristate "Analog Devices MAX77541/77540 Regulator" depends on MFD_MAX77541 diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 15e0d614ff66..b5b724699b51 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -68,6 +68,7 @@ obj-$(CONFIG_REGULATOR_LTC3676) +=3D ltc3676.o obj-$(CONFIG_REGULATOR_MAX14577) +=3D max14577-regulator.o obj-$(CONFIG_REGULATOR_MAX1586) +=3D max1586.o obj-$(CONFIG_REGULATOR_MAX597X) +=3D max597x-regulator.o +obj-$(CONFIG_REGULATOR_MAX77503) +=3D max77503-regulator.o obj-$(CONFIG_REGULATOR_MAX77541) +=3D max77541-regulator.o obj-$(CONFIG_REGULATOR_MAX77620) +=3D max77620-regulator.o obj-$(CONFIG_REGULATOR_MAX77650) +=3D max77650-regulator.o diff --git a/drivers/regulator/max77503-regulator.c b/drivers/regulator/max= 77503-regulator.c new file mode 100644 index 000000000000..4a6ba4dd2acd --- /dev/null +++ b/drivers/regulator/max77503-regulator.c @@ -0,0 +1,137 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2023 Analog Devices, Inc. + * ADI regulator driver for MAX77503. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define MAX77503_REG_CFG 0x00 +#define MAX77503_REG_VOUT 0x01 + +#define MAX77503_BIT_EN BIT(0) +#define MAX77503_BIT_CURR_LIM BIT(3) +#define MAX77503_BIT_ADEN BIT(6) + +#define MAX77503_BITS_SOFT_START GENMASK(5, 4) +#define MAX77503_BITS_MX_VOUT GENMASK(7, 0) + +#define MAX77503_AD_ENABLED 0x1 +#define MAX77503_AD_DISABLED 0x0 + +struct max77503_dev { + struct device *dev; + struct device_node *of_node; + struct regulator_desc desc; + struct regulator_dev *rdev; + struct regmap *regmap; +}; + +static const struct regmap_config max77503_regmap_config =3D { + .reg_bits =3D 8, + .val_bits =3D 8, + .max_register =3D 0x2, +}; + +static const struct regulator_ops max77503_buck_ops =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_ascend, + .is_enabled =3D regulator_is_enabled_regmap, + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .get_current_limit =3D regulator_get_current_limit_regmap, + .set_current_limit =3D regulator_set_current_limit_regmap, + .set_active_discharge =3D regulator_set_active_discharge_regmap, + .set_soft_start =3D regulator_set_soft_start_regmap, +}; + +static const struct linear_range max77503_buck_ranges[] =3D { + REGULATOR_LINEAR_RANGE(800000, 0x00, 0x54, 50000) +}; + +static const unsigned int max77503_current_limit_table[] =3D { + 500000, 2000000 +}; + +static const struct regulator_desc max77503_regulators_desc =3D { + .name =3D "max77503", + .enable_reg =3D MAX77503_REG_CFG, + .enable_mask =3D MAX77503_BIT_EN, + .ops =3D &max77503_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D max77503_buck_ranges, + .n_linear_ranges =3D ARRAY_SIZE(max77503_buck_ranges), + .vsel_reg =3D MAX77503_REG_VOUT, + .vsel_mask =3D MAX77503_BITS_MX_VOUT, + .soft_start_reg =3D MAX77503_REG_CFG, + .soft_start_mask =3D MAX77503_BITS_SOFT_START, + .active_discharge_reg =3D MAX77503_REG_CFG, + .active_discharge_mask =3D MAX77503_BIT_ADEN, + .active_discharge_off =3D MAX77503_AD_DISABLED, + .active_discharge_on =3D MAX77503_AD_ENABLED, + .csel_reg =3D MAX77503_REG_CFG, + .csel_mask =3D MAX77503_BIT_CURR_LIM, + .curr_table =3D max77503_current_limit_table, + .n_current_limits =3D ARRAY_SIZE(max77503_current_limit_table), + .owner =3D THIS_MODULE, +}; + +static int max77503_regulator_probe(struct i2c_client *client) +{ + struct device *dev =3D &client->dev; + struct regulator_config config =3D {}; + struct regulator_dev *rdev; + + config.dev =3D dev; + config.of_node =3D dev->of_node; + config.regmap =3D devm_regmap_init_i2c(client, &max77503_regmap_config); + if (IS_ERR(config.regmap)) { + dev_err(dev, "Failed to init regmap"); + return PTR_ERR(config.regmap); + } + + rdev =3D devm_regulator_register(dev, &max77503_regulators_desc, &config); + if (IS_ERR(rdev)) { + dev_err(dev, "Failed to register regulator MAX77503"); + return PTR_ERR(rdev); + } + + return 0; +} + +static const struct of_device_id of_max77503_match_tbl[] =3D { + { .compatible =3D "adi,max77503", }, + { } +}; + +MODULE_DEVICE_TABLE(of, of_max77503_match_tbl); + +static const struct i2c_device_id max77503_regulator_id[] =3D { + {"max77503"}, + { } +}; + +MODULE_DEVICE_TABLE(i2c, max77503_regulator_id); + +static struct i2c_driver max77503_regulator_driver =3D { + .driver =3D { + .name =3D "max77503", + .of_match_table =3D of_max77503_match_tbl + }, + .probe =3D max77503_regulator_probe, + .id_table =3D max77503_regulator_id, +}; + +module_i2c_driver(max77503_regulator_driver); + +MODULE_AUTHOR("Gokhan Celik "); +MODULE_DESCRIPTION("MAX77503 regulator driver"); +MODULE_LICENSE("GPL"); --=20 2.34.1 From nobody Thu Dec 18 15:24:24 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 9481EEE49A8 for ; Mon, 21 Aug 2023 16:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236650AbjHUQ3O (ORCPT ); Mon, 21 Aug 2023 12:29:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236640AbjHUQ3N (ORCPT ); Mon, 21 Aug 2023 12:29:13 -0400 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0964D3; Mon, 21 Aug 2023 09:29:11 -0700 (PDT) Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 37LEAtoO010730; Mon, 21 Aug 2023 12:28:56 -0400 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3skvcqc7y5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Aug 2023 12:28:56 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 37LGStRR055705 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Aug 2023 12:28:55 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 21 Aug 2023 12:28:54 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 21 Aug 2023 12:28:54 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 21 Aug 2023 12:28:54 -0400 Received: from HYB-a2JJhsYKAxD.ad.analog.com (HYB-a2JJhsYKAxD.ad.analog.com [10.25.72.79]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 37LGSQsq012468; Mon, 21 Aug 2023 12:28:42 -0400 From: Gokhan Celik To: CC: Gokhan Celik , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Gokhan Celik , , Subject: [PATCH 2/2] dt-bindings: regulator: Add MAX77503 regulator bindings Date: Mon, 21 Aug 2023 19:28:22 +0300 Message-ID: <50b983f2eb74aab5947cf7721770983b51ffd949.1692634090.git.gokhan.celik@analog.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: 4c98y7WqKRxjrQheiDzBQHOjJnzqXdNW X-Proofpoint-GUID: 4c98y7WqKRxjrQheiDzBQHOjJnzqXdNW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-21_04,2023-08-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 impostorscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 clxscore=1015 adultscore=0 bulkscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2306200000 definitions=main-2308210153 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add bindings for MAX77503 buck converter. Signed-off-by: Gokhan Celik --- .../regulator/adi,max77503-regulator.yaml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/adi,max7750= 3-regulator.yaml diff --git a/Documentation/devicetree/bindings/regulator/adi,max77503-regul= ator.yaml b/Documentation/devicetree/bindings/regulator/adi,max77503-regula= tor.yaml new file mode 100644 index 000000000000..0d351225e107 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/adi,max77503-regulator.ya= ml @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright (c) 2023 Analog Devices, Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/adi,max77503-regulator.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices MAX77503 Buck Converter + +maintainers: + - Gokhan Celik + +description: Analog Devices MAX77503 Buck Converter + +properties: + compatible: + enum: + - adi,max77503 + + reg: + description: I2C address of the device + items: + - enum: [0x1e, 0x24, 0x37] + + regulator: + type: object + $ref: regulator.yaml# + additionalProperties: false + description: | + Buck regulator + + properties: + regulator-name: true + regulator-always-on: true + regulator-boot-on: true + regulator-min-microvolt: + minimum: 800000 + regulator-max-microvolt: + maximum: 5000000 + +additionalProperties: false + +required: + - compatible + - reg + +examples: + - | + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + max77503@1e { + compatible =3D "adi,max77503"; + reg =3D <0x1e>; + regulator{ + regulator-name =3D "max777503-regulator"; + regulator-min-microvolt =3D <800000>; + regulator-max-microvolt =3D <5000000>; + regulator-boot-on; + }; + }; + }; + --=20 2.34.1