get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2216171/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2216171,
    "url": "http://patchwork.ozlabs.org/api/patches/2216171/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260325223232.1553212-16-raymondmaoca@gmail.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260325223232.1553212-16-raymondmaoca@gmail.com>",
    "list_archive_url": null,
    "date": "2026-03-25T22:32:31",
    "name": "[v3,15/16] power: regulator: add support for Spacemit P1 SoC",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "b01c626e71a7d330c16d18f65d498f881e171c6f",
    "submitter": {
        "id": 91989,
        "url": "http://patchwork.ozlabs.org/api/people/91989/?format=api",
        "name": "Raymond Mao",
        "email": "raymondmaoca@gmail.com"
    },
    "delegate": {
        "id": 20174,
        "url": "http://patchwork.ozlabs.org/api/users/20174/?format=api",
        "username": "Andes",
        "first_name": "Andes",
        "last_name": "",
        "email": "uboot@andestech.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260325223232.1553212-16-raymondmaoca@gmail.com/mbox/",
    "series": [
        {
            "id": 497518,
            "url": "http://patchwork.ozlabs.org/api/series/497518/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=497518",
            "date": "2026-03-25T22:32:17",
            "name": "Add board support for Spacemit K1 SoC in SPL",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/497518/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2216171/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2216171/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=KkLnfIzr;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.b=\"KkLnfIzr\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=raymondmaoca@gmail.com"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fh1v06F5hz1y1x\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 09:35:08 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id ABDFA83E7A;\n\tWed, 25 Mar 2026 23:33:35 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id E775D840ED; Wed, 25 Mar 2026 23:33:28 +0100 (CET)",
            "from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com\n [IPv6:2607:f8b0:4864:20::72d])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 68E15840F1\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 23:33:26 +0100 (CET)",
            "by mail-qk1-x72d.google.com with SMTP id\n af79cd13be357-8cd8c6e365eso47620185a.0\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 15:33:26 -0700 (PDT)",
            "from ubuntu.localdomain (173-206-124-85.cpe.distributel.net.\n [173.206.124.85]) by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8d00e39fc17sm101540185a.5.2026.03.25.15.33.23\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 25 Mar 2026 15:33:24 -0700 (PDT)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_GMAIL_RCVD,FREEMAIL_FROM,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no\n autolearn_force=no version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774478005; x=1775082805; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=gjawqQ1KfcSr5CO973ACirRx4W9wDBkvAwDUZ6icL0Q=;\n b=KkLnfIzrMYf91YVnY3QFoLZJNVsIlb55LpLCNpWYuP94gx3ILeG+aRFKhPrMy7fPpI\n pc2FXgU5majfMlJl85I3r+OeraJ2wV8xQAU+voRBeauAPviKMYtJk6yUcZR73DbETD14\n H/4Y4qCmUIWhW0L8lG2qyOipea0wTvfRgLqg6Pd/d9Pvd4Tit8gGM3Z6qSwQ2rMfOXO1\n tMDFLgvcVaUk77F7IycJH4kVZ+4+upBGukSIJjfOTRfiysoBB07CaBCgDQ4xFNgnpbEt\n nFroIjk//K/18Hky8vesR8uWT6YqKx/+uirGuSlndCOGw9kdN+31DNOi/lLooWixOFk5\n CTgw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774478005; x=1775082805;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=gjawqQ1KfcSr5CO973ACirRx4W9wDBkvAwDUZ6icL0Q=;\n b=BFTDwBp/PeB/GSXxDrP6G9hGBNabZL79UDeZ5VgSvxCm2Id4cckB35O/Gl/ixv3ISw\n j3MckSw6R0GYK952MoPRB3YWLJmDlC0STMSJaMLH1qk1aBK/ijwPwr/nOvwVrjeV79Oz\n upcPzhD2/iFjCEo8RCCFa6IRtLJiOetlO9Sf3SOnD7/CcEwSQQ9QhrJOtmcz0rzycNwN\n tmqljpYmMWdCK4EyTOcxRpogflnhU6aeiTWmAYrYMX4uqQXmS7G8GOfYskDszt0cvUHz\n SrgqnRuMdfpVjWNcwyYpIYcKOxchEPpSZTlKUUpRbGKzaxKlzsTPU7L7nsILNUuvxfcu\n 3Apg==",
        "X-Gm-Message-State": "AOJu0Yzpp+uWdzt/ZrQYuGvmWLSm2IL16K0IvpjQsP2vWxpu4In8GE6I\n GlJQ6CkVWZTnyKn1J/mP7pZKR1QkL3jIaeeMYOxRSN/fxUjpwZTKPWdhgn37fIVX",
        "X-Gm-Gg": "ATEYQzyDlPQqXlyNBFZ9l5Jp1W5t1oD1UCUY5ooeDxH1438xqrcELl+v/YCzsDLbLX+\n 9V6VACTJvT+SbubvAFE/ruHM7OFntymDato7Hud7iw7BBd6j9ZukOPQWNW1LGUSngYv2MN+zMyW\n 9RkU/TPUTeS19AeA9aK2IipVdMw5Y4XYZMrFcsBCmYJIh98r8KOt8RFMyVrp3F9A5X1TBIZ3luI\n o20yagFfKW2vbsAhvIFTsS89pbeSgvW8fFBeqeDc0QIRdH3OVXZ43aiO6JvOTeyGjoIv+KIT5RN\n 0NdQNOJp680r9ZkmHawUyhFLVNtONb+G8UxLphd8k/3dqA2p7kxuNaDKbabDvQi9p5C+DcEgk4t\n /M2G+M70UY7ynriIoOH38VBbgorKuh6SXa9FTGaEoA7rOv4RawSZFo40THDFRHPEN1boPZjgJcy\n VoQVmpF9qZXTw1AhwnifVQ68KgTnfAm4y/MljtTlNT2qXSa3wMglU6qIYu7xVTWNZ0Duyyky0z5\n lCHutxVs7c=",
        "X-Received": "by 2002:a05:620a:c4d:b0:8cf:bcf7:fcf4 with SMTP id\n af79cd13be357-8d000f20d32mr789551685a.22.1774478004754;\n Wed, 25 Mar 2026 15:33:24 -0700 (PDT)",
        "From": "Raymond Mao <raymondmaoca@gmail.com>",
        "To": "u-boot@lists.denx.de",
        "Cc": "uboot@riscstar.com, u-boot-spacemit@groups.io, raymond.mao@riscstar.com,\n rick@andestech.com, ycliang@andestech.com, trini@konsulko.com,\n lukma@denx.de, hs@nabladev.com, jh80.chung@samsung.com, peng.fan@nxp.com,\n xypron.glpk@gmx.de, randolph@andestech.com, dlan@gentoo.org,\n junhui.liu@pigmoral.tech, neil.armstrong@linaro.org,\n quentin.schulz@cherry.de, samuel@sholland.org, raymondmaoca@gmail.com",
        "Subject": "[PATCH v3 15/16] power: regulator: add support for Spacemit P1 SoC",
        "Date": "Wed, 25 Mar 2026 18:32:31 -0400",
        "Message-Id": "<20260325223232.1553212-16-raymondmaoca@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20260325223232.1553212-1-raymondmaoca@gmail.com>",
        "References": "<20260325223232.1553212-1-raymondmaoca@gmail.com>",
        "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 <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "From: Raymond Mao <raymond.mao@riscstar.com>\n\nSupport voltage regulator for Spacemit P1 SoC. It contains 6 BUCKs\nand 11 LDOs.\n\nSigned-off-by: Raymond Mao <raymond.mao@riscstar.com>\nAcked-by: Peng Fan <peng.fan@nxp.com>\n---\nChanges in v3:\n- Drop SPL_DM_REGULATOR_SPACEMIT_P1 Kconfig\n\n drivers/power/regulator/Kconfig               |   8 +\n drivers/power/regulator/Makefile              |   1 +\n .../power/regulator/spacemit_p1_regulator.c   | 460 ++++++++++++++++++\n 3 files changed, 469 insertions(+)\n create mode 100644 drivers/power/regulator/spacemit_p1_regulator.c",
    "diff": "diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig\nindex 4f39e46cebd..ddfbfd1483d 100644\n--- a/drivers/power/regulator/Kconfig\n+++ b/drivers/power/regulator/Kconfig\n@@ -547,3 +547,11 @@ config DM_REGULATOR_MT6359\n \t  MediaTek MT6359 PMIC.\n \t  This driver supports the control of different power rails of device\n \t  through regulator interface.\n+\n+config DM_REGULATOR_SPACEMIT_P1\n+\tbool \"Enable driver for Spacemit P1 PMIC regulators\"\n+\tdepends on DM_REGULATOR && PMIC_SPACEMIT_P1\n+\thelp\n+\t  Enable implementation of driver-model regulator uclass features\n+\t  for regulator P1. The driver supports BUCKs, LDOs and SWITCHes.\n+\ndiff --git a/drivers/power/regulator/Makefile b/drivers/power/regulator/Makefile\nindex 9e303d4f7f8..8103382951b 100644\n--- a/drivers/power/regulator/Makefile\n+++ b/drivers/power/regulator/Makefile\n@@ -29,6 +29,7 @@ obj-$(CONFIG_$(PHASE_)REGULATOR_RK8XX) += rk8xx.o\n obj-$(CONFIG_DM_REGULATOR_S2MPS11) += s2mps11_regulator.o\n obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o\n obj-$(CONFIG_DM_REGULATOR_SANDBOX) += sandbox.o\n+obj-$(CONFIG_DM_REGULATOR_SPACEMIT_P1) += spacemit_p1_regulator.o\n obj-$(CONFIG_REGULATOR_TPS65090) += tps65090_regulator.o\n obj-$(CONFIG_$(PHASE_)DM_REGULATOR_PALMAS) += palmas_regulator.o\n obj-$(CONFIG_$(PHASE_)DM_REGULATOR_PBIAS) += pbias_regulator.o\ndiff --git a/drivers/power/regulator/spacemit_p1_regulator.c b/drivers/power/regulator/spacemit_p1_regulator.c\nnew file mode 100644\nindex 00000000000..ab3ca489f0b\n--- /dev/null\n+++ b/drivers/power/regulator/spacemit_p1_regulator.c\n@@ -0,0 +1,460 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Copyright (C) 2025-2026 RISCstar Ltd.\n+ */\n+\n+#include <dm.h>\n+#include <dm/lists.h>\n+#include <errno.h>\n+#include <log.h>\n+#include <power/pmic.h>\n+#include <power/regulator.h>\n+#include <power/spacemit_p1.h>\n+\n+struct p1_reg_info {\n+\tuint min_uv;\n+\tuint step_uv;\n+\tu8 vsel_reg;\n+\tu8 vsel_sleep_reg;\n+\tu8 config_reg;\n+\tu8 vsel_mask;\n+\tu8 min_sel;\n+\tu8 max_sel;\n+};\n+\n+static const struct p1_reg_info p1_bucks[] = {\n+\t/* BUCK 1 */\n+\t{ 500000,  5000, P1_BUCK_VSEL(1), P1_BUCK_SVSEL(1), P1_BUCK_CTRL(1),\n+\t  BUCK_VSEL_MASK, 0x00, 0xaa },\n+\t{ 1375000, 25000, P1_BUCK_VSEL(1), P1_BUCK_SVSEL(1), P1_BUCK_CTRL(1),\n+\t  BUCK_VSEL_MASK, 0xab, 0xfe },\n+\t/* BUCK 2 */\n+\t{ 500000,  5000, P1_BUCK_VSEL(2), P1_BUCK_SVSEL(2), P1_BUCK_CTRL(2),\n+\t  BUCK_VSEL_MASK, 0x00, 0xaa },\n+\t{ 1375000, 25000, P1_BUCK_VSEL(2), P1_BUCK_SVSEL(2), P1_BUCK_CTRL(2),\n+\t  BUCK_VSEL_MASK, 0xab, 0xfe },\n+\t/* BUCK 3 */\n+\t{ 500000,  5000, P1_BUCK_VSEL(3), P1_BUCK_SVSEL(3), P1_BUCK_CTRL(3),\n+\t  BUCK_VSEL_MASK, 0x00, 0xaa },\n+\t{ 1375000, 25000, P1_BUCK_VSEL(3), P1_BUCK_SVSEL(3), P1_BUCK_CTRL(3),\n+\t  BUCK_VSEL_MASK, 0xab, 0xfe },\n+\t/* BUCK 4 */\n+\t{ 500000,  5000, P1_BUCK_VSEL(4), P1_BUCK_SVSEL(4), P1_BUCK_CTRL(4),\n+\t  BUCK_VSEL_MASK, 0x00, 0xaa },\n+\t{ 1375000, 25000, P1_BUCK_VSEL(4), P1_BUCK_SVSEL(4), P1_BUCK_CTRL(4),\n+\t  BUCK_VSEL_MASK, 0xab, 0xfe },\n+\t/* BUCK 5 */\n+\t{ 500000,  5000, P1_BUCK_VSEL(5), P1_BUCK_SVSEL(5), P1_BUCK_CTRL(5),\n+\t  BUCK_VSEL_MASK, 0x00, 0xaa },\n+\t{ 1375000, 25000, P1_BUCK_VSEL(5), P1_BUCK_SVSEL(5), P1_BUCK_CTRL(5),\n+\t  BUCK_VSEL_MASK, 0xab, 0xfe },\n+\t/* BUCK 6 */\n+\t{ 500000,  5000, P1_BUCK_VSEL(6), P1_BUCK_SVSEL(6), P1_BUCK_CTRL(6),\n+\t  BUCK_VSEL_MASK, 0x00, 0xaa },\n+\t{ 1375000, 25000, P1_BUCK_VSEL(6), P1_BUCK_SVSEL(6), P1_BUCK_CTRL(6),\n+\t  BUCK_VSEL_MASK, 0xab, 0xfe },\n+};\n+\n+static const struct p1_reg_info p1_aldos[] = {\n+\t/* ALDO 1 */\n+\t{ 500000, 25000, P1_ALDO_VOLT(1), P1_ALDO_SVOLT(1), P1_ALDO_CTRL(1),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+\t/* ALDO 2 */\n+\t{ 500000, 25000, P1_ALDO_VOLT(2), P1_ALDO_SVOLT(2), P1_ALDO_CTRL(2),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+\t/* ALDO 3 */\n+\t{ 500000, 25000, P1_ALDO_VOLT(3), P1_ALDO_SVOLT(3), P1_ALDO_CTRL(3),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+\t/* ALDO 4 */\n+\t{ 500000, 25000, P1_ALDO_VOLT(4), P1_ALDO_SVOLT(4), P1_ALDO_CTRL(4),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+};\n+\n+static const struct p1_reg_info p1_dldos[] = {\n+\t/* DLDO 1 */\n+\t{ 500000, 25000, P1_DLDO_VOLT(1), P1_DLDO_SVOLT(1), P1_DLDO_CTRL(1),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+\t/* DLDO 2 */\n+\t{ 500000, 25000, P1_DLDO_VOLT(2), P1_DLDO_SVOLT(2), P1_DLDO_CTRL(2),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+\t/* DLDO 3 */\n+\t{ 500000, 25000, P1_DLDO_VOLT(3), P1_DLDO_SVOLT(3), P1_DLDO_CTRL(3),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+\t/* DLDO 4 */\n+\t{ 500000, 25000, P1_DLDO_VOLT(4), P1_DLDO_SVOLT(4), P1_DLDO_CTRL(4),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+\t/* DLDO 5 */\n+\t{ 500000, 25000, P1_DLDO_VOLT(5), P1_DLDO_SVOLT(5), P1_DLDO_CTRL(5),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+\t/* DLDO 6 */\n+\t{ 500000, 25000, P1_DLDO_VOLT(6), P1_DLDO_SVOLT(6), P1_DLDO_CTRL(6),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+\t/* DLDO 7 */\n+\t{ 500000, 25000, P1_DLDO_VOLT(7), P1_DLDO_SVOLT(7), P1_DLDO_CTRL(7),\n+\t  ALDO_VSEL_MASK, 0x0b, 0x7f },\n+};\n+\n+static const struct p1_reg_info *get_buck_reg(struct udevice *pmic,\n+\t\t\t\t\t      int idx, int uvolt)\n+{\n+\tif (idx < 0)\n+\t\treturn NULL;\n+\tif (uvolt < 1375000)\n+\t\treturn &p1_bucks[(idx - 1) * 2 + 0];\n+\treturn &p1_bucks[(idx - 1) * 2 + 1];\n+}\n+\n+static const struct p1_reg_info *get_aldo_reg(struct udevice *pmic,\n+\t\t\t\t\t      int idx, int uvolt)\n+{\n+\treturn &p1_aldos[idx];\n+}\n+\n+static const struct p1_reg_info *get_dldo_reg(struct udevice *pmic,\n+\t\t\t\t\t      int idx, int uvolt)\n+{\n+\treturn &p1_dldos[idx];\n+}\n+\n+static int buck_get_value(struct udevice *dev)\n+{\n+\tconst struct dm_pmic_ops *ops = device_get_ops(dev->parent);\n+\tconst struct p1_reg_info *info;\n+\tuint val;\n+\tint ret;\n+\n+\tif (!ops || !ops->read)\n+\t\treturn -ENOSYS;\n+\n+\tinfo = get_buck_reg(dev->parent, dev->driver_data, 0);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\tret = pmic_reg_read(dev->parent, info->vsel_reg);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\tval = ret & info->vsel_mask;\n+\twhile (val > info->max_sel)\n+\t\tinfo++;\n+\n+\treturn info->min_uv + (val - info->min_sel) * info->step_uv;\n+}\n+\n+static int buck_set_value(struct udevice *dev, int uvolt)\n+{\n+\tconst struct dm_pmic_ops *ops = device_get_ops(dev->parent);\n+\tconst struct p1_reg_info *info;\n+\tuint val;\n+\tint ret;\n+\n+\tif (!ops || !ops->write)\n+\t\treturn -ENOSYS;\n+\n+\tinfo = get_buck_reg(dev->parent, dev->driver_data, uvolt);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\tval = (uvolt - info->min_uv);\n+\tval = val / info->step_uv;\n+\tval += info->min_sel;\n+\tret = pmic_reg_write(dev->parent, info->vsel_reg, val);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\treturn 0;\n+}\n+\n+static int buck_get_enable(struct udevice *dev)\n+{\n+\tconst struct p1_reg_info *info;\n+\tint ret;\n+\n+\tinfo = get_buck_reg(dev->parent, dev->driver_data, 0);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\n+\tret = pmic_reg_read(dev->parent, info->config_reg);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\treturn ret & BUCK_EN_MASK;\n+}\n+\n+static int buck_set_enable(struct udevice *dev, bool enable)\n+{\n+\tconst struct p1_reg_info *info;\n+\tuint val;\n+\tint ret;\n+\n+\tinfo = get_buck_reg(dev->parent, dev->driver_data, 0);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\n+\tret = pmic_reg_read(dev->parent, info->config_reg);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\tval = (unsigned int)ret;\n+\tval &= BUCK_EN_MASK;\n+\n+\tif (enable == val)\n+\t\treturn 0;\n+\n+\tval = enable;\n+\tret = pmic_clrsetbits(dev->parent, info->config_reg, BUCK_EN_MASK, val);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\treturn 0;\n+}\n+\n+static const struct dm_regulator_ops p1_buck_ops = {\n+\t.get_value  = buck_get_value,\n+\t.set_value  = buck_set_value,\n+\t.get_enable = buck_get_enable,\n+\t.set_enable = buck_set_enable,\n+};\n+\n+static int p1_buck_probe(struct udevice *dev)\n+{\n+\tstruct dm_regulator_uclass_plat *uc_pdata;\n+\n+\tuc_pdata = dev_get_uclass_plat(dev);\n+\n+\tuc_pdata->type = REGULATOR_TYPE_BUCK;\n+\tuc_pdata->mode_count = 0;\n+\n+\treturn 0;\n+}\n+\n+U_BOOT_DRIVER(p1_buck) = {\n+\t.name\t\t= P1_BUCK_DRIVER,\n+\t.id\t\t= UCLASS_REGULATOR,\n+\t.ops\t\t= &p1_buck_ops,\n+\t.probe\t\t= p1_buck_probe,\n+};\n+\n+static int aldo_get_value(struct udevice *dev)\n+{\n+\tconst struct dm_pmic_ops *ops = device_get_ops(dev->parent);\n+\tconst struct p1_reg_info *info;\n+\tuint val;\n+\tint ret;\n+\n+\tif (!ops || !ops->read)\n+\t\treturn -ENOSYS;\n+\n+\tinfo = get_aldo_reg(dev->parent, dev->driver_data, 0);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\n+\tret = pmic_reg_read(dev->parent, info->vsel_reg);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tval = ret & info->vsel_mask;\n+\twhile (val > info->max_sel)\n+\t\tinfo++;\n+\n+\treturn info->min_uv + (val - info->min_sel) * info->step_uv;\n+}\n+\n+static int aldo_set_value(struct udevice *dev, int uvolt)\n+{\n+\tconst struct dm_pmic_ops *ops = device_get_ops(dev->parent);\n+\tconst struct p1_reg_info *info;\n+\tuint val;\n+\tint ret;\n+\n+\tif (!ops || !ops->write)\n+\t\treturn -ENOSYS;\n+\n+\tinfo = get_aldo_reg(dev->parent, dev->driver_data, uvolt);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\tval = (uvolt - info->min_uv);\n+\tval = val / info->step_uv;\n+\tval += info->min_sel;\n+\tret = pmic_reg_write(dev->parent, info->vsel_reg, val);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\treturn 0;\n+}\n+\n+static int aldo_get_enable(struct udevice *dev)\n+{\n+\tconst struct p1_reg_info *info;\n+\tint ret;\n+\n+\tinfo = get_aldo_reg(dev->parent, dev->driver_data, 0);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\n+\tret = pmic_reg_read(dev->parent, info->config_reg);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\treturn ret & ALDO_EN_MASK;\n+}\n+\n+static int aldo_set_enable(struct udevice *dev, bool enable)\n+{\n+\tconst struct p1_reg_info *info;\n+\tuint val;\n+\tint ret;\n+\n+\tinfo = get_aldo_reg(dev->parent, dev->driver_data, 0);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\n+\tret = pmic_reg_read(dev->parent, info->config_reg);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\tval = (unsigned int)ret;\n+\tval &= ALDO_EN_MASK;\n+\n+\tif (enable == val)\n+\t\treturn 0;\n+\n+\tval = enable;\n+\tret = pmic_clrsetbits(dev->parent, info->config_reg, ALDO_EN_MASK, val);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\treturn 0;\n+}\n+\n+static const struct dm_regulator_ops p1_aldo_ops = {\n+\t.get_value\t= aldo_get_value,\n+\t.set_value\t= aldo_set_value,\n+\t.get_enable\t= aldo_get_enable,\n+\t.set_enable\t= aldo_set_enable,\n+};\n+\n+static int p1_aldo_probe(struct udevice *dev)\n+{\n+\tstruct dm_regulator_uclass_plat *uc_pdata;\n+\n+\tuc_pdata = dev_get_uclass_plat(dev);\n+\n+\tuc_pdata->type = REGULATOR_TYPE_LDO;\n+\tuc_pdata->mode_count = 0;\n+\n+\treturn 0;\n+}\n+\n+U_BOOT_DRIVER(p1_aldo) = {\n+\t.name\t\t= P1_ALDO_DRIVER,\n+\t.id\t\t= UCLASS_REGULATOR,\n+\t.ops\t\t= &p1_aldo_ops,\n+\t.probe\t\t= p1_aldo_probe,\n+};\n+\n+static int dldo_get_value(struct udevice *dev)\n+{\n+\tconst struct dm_pmic_ops *ops = device_get_ops(dev->parent);\n+\tconst struct p1_reg_info *info;\n+\tuint val;\n+\tint ret;\n+\n+\tif (!ops || !ops->read)\n+\t\treturn -ENOSYS;\n+\n+\tinfo = get_dldo_reg(dev->parent, dev->driver_data, 0);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\n+\tret = pmic_reg_read(dev->parent, info->vsel_reg);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tval = ret & info->vsel_mask;\n+\twhile (val > info->max_sel)\n+\t\tinfo++;\n+\n+\treturn info->min_uv + (val - info->min_sel) * info->step_uv;\n+}\n+\n+static int dldo_set_value(struct udevice *dev, int uvolt)\n+{\n+\tconst struct dm_pmic_ops *ops = device_get_ops(dev->parent);\n+\tconst struct p1_reg_info *info;\n+\tuint val;\n+\tint ret;\n+\n+\tif (!ops || !ops->write)\n+\t\treturn -ENOSYS;\n+\n+\tinfo = get_dldo_reg(dev->parent, dev->driver_data, uvolt);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\tval = (uvolt - info->min_uv);\n+\tval = val / info->step_uv;\n+\tval += info->min_sel;\n+\tret = pmic_reg_write(dev->parent, info->vsel_reg, val);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\treturn 0;\n+}\n+\n+static int dldo_get_enable(struct udevice *dev)\n+{\n+\tconst struct p1_reg_info *info;\n+\tint ret;\n+\n+\tinfo = get_dldo_reg(dev->parent, dev->driver_data, 0);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\n+\tret = pmic_reg_read(dev->parent, info->config_reg);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\treturn ret & DLDO_EN_MASK;\n+}\n+\n+static int dldo_set_enable(struct udevice *dev, bool enable)\n+{\n+\tconst struct p1_reg_info *info;\n+\tuint val;\n+\tint ret;\n+\n+\tinfo = get_dldo_reg(dev->parent, dev->driver_data, 0);\n+\tif (!info)\n+\t\treturn -ENOENT;\n+\n+\tret = pmic_reg_read(dev->parent, info->config_reg);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\tval = (unsigned int)ret;\n+\tval &= DLDO_EN_MASK;\n+\n+\tif (enable == val)\n+\t\treturn 0;\n+\n+\tval = enable;\n+\tret = pmic_clrsetbits(dev->parent, info->config_reg, DLDO_EN_MASK, val);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\treturn 0;\n+}\n+\n+static const struct dm_regulator_ops p1_dldo_ops = {\n+\t.get_value\t= dldo_get_value,\n+\t.set_value\t= dldo_set_value,\n+\t.get_enable\t= dldo_get_enable,\n+\t.set_enable\t= dldo_set_enable,\n+};\n+\n+static int p1_dldo_probe(struct udevice *dev)\n+{\n+\tstruct dm_regulator_uclass_plat *uc_pdata;\n+\n+\tuc_pdata = dev_get_uclass_plat(dev);\n+\n+\tuc_pdata->type = REGULATOR_TYPE_LDO;\n+\tuc_pdata->mode_count = 0;\n+\n+\treturn 0;\n+}\n+\n+U_BOOT_DRIVER(p1_dldo) = {\n+\t.name\t\t= P1_DLDO_DRIVER,\n+\t.id\t\t= UCLASS_REGULATOR,\n+\t.ops\t\t= &p1_dldo_ops,\n+\t.probe\t\t= p1_dldo_probe,\n+};\n",
    "prefixes": [
        "v3",
        "15/16"
    ]
}