From nobody Sat Jun 13 04:48:47 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 778BD388E72; Sun, 10 May 2026 16:45:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778431532; cv=none; b=ask/m3y5UBQ4W59J5myg3C1hW8xlNYs5oCfVpAickYM+WWuWhAfTan2UIOM8hufpZkkQOkR+RbFjSitXSWw53t6evdw+pRasRNPjvzUWC5CpxdmEugCF6ABW8zVCvijssSSAkjMdat7Os/R2BGjuYXlvazyviVBlyqM4elufyHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778431532; c=relaxed/simple; bh=nr2PNmnoE55WAs+wO5a7ozSbaw9DnvmevSQ4RFVMUvc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cMa7TLJqMBxIKgZctwaBZw5D7xdKYG7kxZ996WnLv564C4zoPNf2dwfwd5gdRAiYwIZPOHiRXYIdXi+/6XbsItvG560A/iip8HN1/C6NNfX+L2H0yv7Pk72AjYoIhMPAL7Gu3wGhFCQl9lOTHd7rBYNsdrUfEZgBNXqwGGf0ARg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V/TqtAfw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="V/TqtAfw" Received: by smtp.kernel.org (Postfix) with ESMTPS id 2FD39C2BCF7; Sun, 10 May 2026 16:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778431532; bh=nr2PNmnoE55WAs+wO5a7ozSbaw9DnvmevSQ4RFVMUvc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=V/TqtAfwYPtp6hyYBBznqHlWUTL0ZMLwuAh0GVRdD9GhS46Y9Hoy7beFN16JMN8Rr rpQ7h558YRQmVJ91KQRi+wL9MbATmPmDuohhKB9Yv4M3I0UeRFGAdWLdZMn3aiMDDb UcX/ftW9YjysQ4Opsw03keHZ1atRS4m47vOB0uHSNezd/Kj+LedNergrzsswaN13RT tRpGhtpWHEiGLJEc7TpGiPT1sqcKKdSVHSRkpmCRHusFsx3VgoudpCNir+4Ck6abA2 0p35lA9YDsyx0x8+bJQWhzHZMnv3lUibYeKxHu1zHL+VaLD9na+789QFmmg8waJx57 rVFYqGP8313Ag== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D53BCD3427; Sun, 10 May 2026 16:45:32 +0000 (UTC) From: Alexandre Hamamdjian via B4 Relay Date: Sun, 10 May 2026 23:45:26 +0700 Subject: [PATCH 1/2] dt-bindings: regulator: add SGMicro SGM3804 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260510-sgm3804-v1-1-e5e8799e0aa0@gmail.com> References: <20260510-sgm3804-v1-0-e5e8799e0aa0@gmail.com> In-Reply-To: <20260510-sgm3804-v1-0-e5e8799e0aa0@gmail.com> To: Philippe Simons , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Alexandre Hamamdjian X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778431530; l=3403; i=azkali.limited@gmail.com; s=20260510; h=from:subject:message-id; bh=XWCit0ZA8mWCGZuR1y+fa+IVWSjOU74cPNIGW9a/Ktg=; b=q+S2dD3+5X5wiS4eT8yx5WrFzrWAMjwfyP7tLlbhkN/NMfC15a/0lX3B7erDP9wzJsLsBfzJG Ozp7cAjPws9A7AaLohjX6+5Wqx02KVdZCtwcR2VTSzhH2YuQfljTisV X-Developer-Key: i=azkali.limited@gmail.com; a=ed25519; pk=I0Z0IdCdQJqNGX+FQUnXhrHg950u3cM6Xzz3YT6JOyQ= X-Endpoint-Received: by B4 Relay for azkali.limited@gmail.com/20260510 with auth_id=774 X-Original-From: Alexandre Hamamdjian Reply-To: azkali.limited@gmail.com From: Alexandre Hamamdjian The SGMicro SGM3804 is an I2C-controlled positive and negative output charge-pump regulator. It is commonly used to provide the AVDD and AVEE supplies for display panels, and exposes two reset GPIOs to sequence the positive and negative output rails independently. Document the binding for the new compatible "sgmicro,sgm3804" so it can be referenced by board device trees and the matching driver, and add a MAINTAINERS entry covering both the binding and the upcoming driver. Co-developed-by: Philippe Simons Signed-off-by: Philippe Simons Signed-off-by: Alexandre Hamamdjian --- .../bindings/regulator/sgmicro,sgm3804.yaml | 60 ++++++++++++++++++= ++++ MAINTAINERS | 7 +++ 2 files changed, 67 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/sgmicro,sgm3804.ya= ml b/Documentation/devicetree/bindings/regulator/sgmicro,sgm3804.yaml new file mode 100644 index 000000000000..f1de17bd5395 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/sgmicro,sgm3804.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/sgmicro,sgm3804.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SGMicro SGM3804 I2C charge-pump regulator + +maintainers: + - Alexandre Hamamdjian + - Philippe Simons + +description: + The SGM3804 is an I2C-controlled positive and negative output charge-pump + regulator typically used to provide the AVDD and AVEE supplies for displ= ay + panels. Two reset GPIOs are used to sequence the positive and negative + outputs independently. + +allOf: + - $ref: regulator.yaml# + +properties: + compatible: + const: sgmicro,sgm3804 + + reg: + maxItems: 1 + + reset-gpios: + minItems: 1 + maxItems: 2 + description: + Reset/enable GPIOs for the positive (index 0) and, optionally, the + negative (index 1) output rails. + +required: + - compatible + - reg + - reset-gpios + +unevaluatedProperties: false + +examples: + - | + #include + + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + regulator@3e { + compatible =3D "sgmicro,sgm3804"; + reg =3D <0x3e>; + reset-gpios =3D <&tlmm 10 GPIO_ACTIVE_HIGH>, + <&tlmm 11 GPIO_ACTIVE_HIGH>; + regulator-name =3D "panel-avdd"; + regulator-min-microvolt =3D <5000000>; + regulator-max-microvolt =3D <5000000>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index f877e5aaf2c7..394216175d2e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24391,6 +24391,13 @@ M: Steve Wahl S: Maintained F: drivers/misc/sgi-xp/ =20 +SGMICRO SGM3804 REGULATOR DRIVER +M: Alexandre Hamamdjian +M: Philippe Simons +S: Maintained +F: Documentation/devicetree/bindings/regulator/sgmicro,sgm3804.yaml +F: drivers/regulator/sgm3804-regulator.c + SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS M: D. Wythe M: Dust Li --=20 2.54.0 From nobody Sat Jun 13 04:48:47 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 779E83932DC; Sun, 10 May 2026 16:45:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778431532; cv=none; b=hdy9NTV5VLNqXP4+rbNXq3O7O+LS2cKxypyZfNASAjfXI9D65H1WeOqxpU4JV0OQ0KDGz3fEQmpl/IhGEGUFkfnIx+L2YIEt1TtRtvgEqEijsvVEsE8BkPVOImlxHYrhZVGQd+xgCIYU4+zbORE4COPv4RbeP9398cowNgWdlms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778431532; c=relaxed/simple; bh=C/b9UkKCbj8jWttvXi9T57BjZscwnF6nIS3MnQPWZMk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dQ25St0Rn1PGqAaGhaSpk4OIhGfL38o4aM6kJsXbBVDENsKiYvvdIJzFA1NOI2o7Mt3W9IsID68p6jadlIOoqN27ILOr3xM9hyLoE09NJIh9r+i7on/807qixrDNL7FH2AIKzbOwcyBZxDnQ+g91w0u06yuEMCGEs83aslKz/kM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FdUWX6+A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FdUWX6+A" Received: by smtp.kernel.org (Postfix) with ESMTPS id 3ADC4C2BCC7; Sun, 10 May 2026 16:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778431532; bh=C/b9UkKCbj8jWttvXi9T57BjZscwnF6nIS3MnQPWZMk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=FdUWX6+AI8fEIHmea2zbUSZLnUyUEeYLmg1rhd7vxtgS2wfd8AHcK/yPNeOQiBfMG LTfewUYvvPW4DZRcQZ3lSdRkpWBe7eg7lCRoIdXE+6oyMjQCQrADQVX9puxMZNFtF1 PFILaXN7iMKg73p1kqV+bYY5mAZXOke7H4jWYiOq/k/BTJQxxsxlF5BLkw3fmTFpjC 5StSuEtFNsA4cJ3Vsi7DJG1pjWiYfyfuBMzIjZXI/pU6zphGRif1dNGm7oVr8XfAI8 ksnXMKc9Yi4K9wmXv8ykPEH0lAfXnnJvgNKJmlr3pII0EHszb9MaQrbKsXIh4GqMyo Qd3WjxsMqcr/A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32587CD37B2; Sun, 10 May 2026 16:45:32 +0000 (UTC) From: Alexandre Hamamdjian via B4 Relay Date: Sun, 10 May 2026 23:45:27 +0700 Subject: [PATCH 2/2] regulator: sgm3804: add SGMicro SGM3804 charge-pump regulator driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260510-sgm3804-v1-2-e5e8799e0aa0@gmail.com> References: <20260510-sgm3804-v1-0-e5e8799e0aa0@gmail.com> In-Reply-To: <20260510-sgm3804-v1-0-e5e8799e0aa0@gmail.com> To: Philippe Simons , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Alexandre Hamamdjian X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778431530; l=7075; i=azkali.limited@gmail.com; s=20260510; h=from:subject:message-id; bh=E41RJwBDNAULV6SEI17A9O0P6Si0eY2vOQkwOD/TtCE=; b=H38fPMAp6FRQn5M9M13oPGUVbVK+VvGLJ7jaWnpqj//Ua9Yvn78n3WJzMESAS1ovSac0bVNhy Nj4WHOlRjIhAVe8W7O7tGOp6Wv/hFr+Q9YkOaCSJ19Aheot4KLhBcjC X-Developer-Key: i=azkali.limited@gmail.com; a=ed25519; pk=I0Z0IdCdQJqNGX+FQUnXhrHg950u3cM6Xzz3YT6JOyQ= X-Endpoint-Received: by B4 Relay for azkali.limited@gmail.com/20260510 with auth_id=774 X-Original-From: Alexandre Hamamdjian Reply-To: azkali.limited@gmail.com From: Alexandre Hamamdjian Add a driver for the SGMicro SGM3804, an I2C-controlled positive and negative output charge-pump regulator. The chip is typically used to generate the AVDD/AVEE rails of display panels, and is for example present on the Ayaneo Pocket DS handheld where it powers the panel. The driver exposes a single 5V regulator and uses two reset GPIOs to sequence the positive and negative outputs. Initialisation values for the charge-pump configuration registers are written on enable, and the GPIOs are dropped on disable. Co-developed-by: Philippe Simons Signed-off-by: Philippe Simons Signed-off-by: Alexandre Hamamdjian --- drivers/regulator/Kconfig | 11 +++ drivers/regulator/Makefile | 1 + drivers/regulator/sgm3804-regulator.c | 164 ++++++++++++++++++++++++++++++= ++++ 3 files changed, 176 insertions(+) diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index d71dac9436e3..e1adb0bda75d 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1490,6 +1490,17 @@ config REGULATOR_SC2731 This driver provides support for the voltage regulators on the SC2731 PMIC. =20 +config REGULATOR_SGM3804 + tristate "SGMicro sgm3804 voltage regulator" + depends on I2C && OF + help + This driver supports the SGMicro SGM3804 I2C-controlled positive + and negative output charge-pump regulator, commonly used to supply + AVDD/AVEE rails to display panels. Two reset GPIOs are used to + sequence the positive and negative outputs. + + Say M here to build the driver as a module called sgm3804-regulator. + config REGULATOR_SKY81452 tristate "Skyworks Solutions SKY81452 voltage regulator" depends on MFD_SKY81452 diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 35639f3115fd..98ecbbc3c6b7 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -172,6 +172,7 @@ obj-$(CONFIG_REGULATOR_S2MPA01) +=3D s2mpa01.o obj-$(CONFIG_REGULATOR_S2MPS11) +=3D s2mps11.o obj-$(CONFIG_REGULATOR_S5M8767) +=3D s5m8767.o obj-$(CONFIG_REGULATOR_SC2731) +=3D sc2731-regulator.o +obj-$(CONFIG_REGULATOR_SGM3804) +=3D sgm3804-regulator.o obj-$(CONFIG_REGULATOR_SKY81452) +=3D sky81452-regulator.o obj-$(CONFIG_REGULATOR_SLG51000) +=3D slg51000-regulator.o obj-$(CONFIG_REGULATOR_SPACEMIT_P1) +=3D spacemit-p1.o diff --git a/drivers/regulator/sgm3804-regulator.c b/drivers/regulator/sgm3= 804-regulator.c new file mode 100644 index 000000000000..c52f0596acf3 --- /dev/null +++ b/drivers/regulator/sgm3804-regulator.c @@ -0,0 +1,164 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include +#include +#include +#include +#include +#include +#include + +struct sgm3804_data { + struct regmap *regmap; + struct gpio_desc *reset_gpio[2]; + bool enabled; +}; + +static const struct regmap_config sgm3804_regmap_config =3D { + .reg_bits =3D 8, + .val_bits =3D 8, + .max_register =3D 0x03, +}; + +static int sgm3804_enable(struct regulator_dev *rdev) +{ + struct sgm3804_data *data =3D rdev_get_drvdata(rdev); + struct regmap *regmap =3D data->regmap; + int ret =3D 0; + + /* Set reset GPIO high to enable the device if available */ + if (data->reset_gpio[0]) + gpiod_set_value_cansleep(data->reset_gpio[0], 1); + + if (data->reset_gpio[1]) + gpiod_set_value_cansleep(data->reset_gpio[1], 1); + + ret |=3D regmap_write(regmap, 0x00, 0x0c); + ret |=3D regmap_write(regmap, 0x01, 0x0c); + ret |=3D regmap_write(regmap, 0x03, 0x03); + if (ret) { + dev_err(rdev->dev.parent, + "Failed to enable SGM3804 regulator\n"); + return ret; + } + + data->enabled =3D true; + return 0; +} + +static int sgm3804_disable(struct regulator_dev *rdev) +{ + struct sgm3804_data *data =3D rdev_get_drvdata(rdev); + + if (data->reset_gpio[0]) + gpiod_set_value_cansleep(data->reset_gpio[0], 0); + + if (data->reset_gpio[1]) + gpiod_set_value_cansleep(data->reset_gpio[1], 0); + + data->enabled =3D false; + return 0; +} + +static int sgm3804_is_enabled(struct regulator_dev *rdev) +{ + struct sgm3804_data *data =3D rdev_get_drvdata(rdev); + + return data->enabled; +} + +static int sgm3804_get_voltage(struct regulator_dev *rdev) +{ + return 5000000; +} + +static const struct regulator_ops sgm3804_ops =3D { + .enable =3D sgm3804_enable, + .disable =3D sgm3804_disable, + .is_enabled =3D sgm3804_is_enabled, + .get_voltage =3D sgm3804_get_voltage, +}; + +static const struct regulator_desc sgm3804_reg =3D { + .name =3D "SGM3804", + .id =3D 0, + .ops =3D &sgm3804_ops, + .type =3D REGULATOR_VOLTAGE, + .n_voltages =3D 1, + .min_uV =3D 5000000, + .owner =3D THIS_MODULE, +}; + +static int sgm3804_i2c_probe(struct i2c_client *i2c) +{ + struct device *dev =3D &i2c->dev; + struct regulator_config config =3D {}; + struct regulator_dev *rdev; + struct sgm3804_data *data; + int error; + + data =3D devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->regmap =3D devm_regmap_init_i2c(i2c, &sgm3804_regmap_config); + if (IS_ERR(data->regmap)) + return dev_err_probe(dev, PTR_ERR(data->regmap), + "failed to init regmap\n"); + + /* Get reset-gpio from device tree */ + data->reset_gpio[0] =3D + devm_gpiod_get_index(dev, "reset", 0, GPIOD_OUT_HIGH); + if (IS_ERR(data->reset_gpio[0])) + return dev_err_probe(dev, PTR_ERR(data->reset_gpio[0]), + "failed to get first reset GPIO\n"); + + data->reset_gpio[1] =3D + devm_gpiod_get_index(dev, "reset", 1, GPIOD_OUT_HIGH); + if (IS_ERR(data->reset_gpio[1])) + dev_warn(dev, "failed to get second reset GPIO\n"); + + config.dev =3D dev; + config.regmap =3D data->regmap; + config.driver_data =3D data; + config.of_node =3D dev->of_node; + config.init_data =3D + of_get_regulator_init_data(dev, dev->of_node, &sgm3804_reg); + if (!config.init_data) + return -ENOMEM; + data->enabled =3D false; + rdev =3D devm_regulator_register(dev, &sgm3804_reg, &config); + if (IS_ERR(rdev)) { + error =3D PTR_ERR(rdev); + dev_err(dev, "Failed to register SGM3804 regulator: %d\n", + error); + return error; + } + + return 0; +} + +static const struct i2c_device_id sgm3804_i2c_id[] =3D { { "sgm3804" }, {}= }; +MODULE_DEVICE_TABLE(i2c, sgm3804_i2c_id); + +static const struct of_device_id sgm3804_i2c_of_match[] =3D { + { .compatible =3D "sgmicro,sgm3804" }, + {} +}; +MODULE_DEVICE_TABLE(of, sgm3804_i2c_of_match); + +static struct i2c_driver sgm3804_regulator_driver =3D { + .driver =3D { + .name =3D "sgm3804", + .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, + .of_match_table =3D sgm3804_i2c_of_match, + }, + .probe =3D sgm3804_i2c_probe, + .id_table =3D sgm3804_i2c_id, +}; + +module_i2c_driver(sgm3804_regulator_driver); + +MODULE_DESCRIPTION("SGMicro sgm3804 regulator Driver"); +MODULE_AUTHOR("Kancy Joe "); +MODULE_LICENSE("GPL"); --=20 2.54.0