From nobody Thu Sep 24 15:11:01 2026 Received: from CHN02-BJS-obe.outbound.protection.partner.outlook.cn (mail-bjschn02on2126.outbound.protection.partner.outlook.cn [139.219.17.126]) (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 60D65563FC0; Tue, 22 Sep 2026 16:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=139.219.17.126 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790093574; cv=fail; b=ik6JcmD1dHm2eGfVGBJ9kGPM34NrNipt7tGY5X0CiXEdtgighNZ9mZP88swqsm84uMtAqburE+mQhcVgRCvjj+v3Awk77WbOgqsQ4sth9OMblcsIhYQPMaF7wRBxuWH6J70Pq+sQfbFvjcTmAxI78I+sSfAsYLHeY1b5Sttz4QU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790093574; c=relaxed/simple; bh=EfGcPCa64Xj+0dnY1vZg/jeTpEVXfTG44ZthDPN2Zos=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=NPN6pSN/64OodTZJzyr32MVwV4gUidqyqw6ljasWAJxRPv2I39220/4b+jZtOCmoyRQJb/Elut5eupk3wZJBDh2JCxmajB/ptpJ76DsGrxxOaeyrAcx14Phyxg7IaYaQUnWGNvINXsyLYTdzDVbt8r/S51VPLZqPHD4lZnx5D0Q= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=starfivetech.com; spf=pass smtp.mailfrom=starfivetech.com; arc=fail smtp.client-ip=139.219.17.126 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JzrumhrxPLhrDsAInBs39LUfay41wRU9fJsMkoxsCFHhvMx5vINeOQDnU7P0YylMNPGEvaGipv5Ot2UYLOhqswB+GJ441Lr2wlR1cZrmIaf7jvnIyujKtG4cWp7ZPZKwEdah8pd8431IPCm0XEWuBPbjWS6RLJfLYq8Bcou6iQAGEsRbesCWWYDzm8N1JxHYiifvRqa+k1ghdQZJi4aMgIN96YQpiJ47Dzj2yGP5D1TvePKz5/iU4Rj737c5DMYTIQx9tRjVs5yQbrjyaz+GZod6DoRphElXN7L7rcBCwLjlcyTx36T7zr0mlE/LGsc8o64OesoRtqlm7W1ztx6Hmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=viOZb9lGILMhtCUjCsOmQ1RdMfdTcfP4nSaCyP8ewy0=; b=ahA6105MP7nIGD6qf0djetd8x/dDBEozAbFoZbe3rouIZA4lSFIoyeWvtyJwj5MJVuBXF7MofQDBREb4rX9eYDm6Sf1/o8IwUtojNMrIpNSmDHMZlbiB8kQ3vMwZNiDfOaw/QwhlAKpGPZbcthvyyWuaDSf0FHYrcuqgJpokDkoHWVAAASSwceDCLcPTjL7Qd9jOPRlCwukWK1tDVSnKghszjJf7GU/rl+xGvU2qEYN9v6nqbqelQAQHMpg0RJ+5mH8HylE9v3u3L606PENlvnB5Kpa6FccpwfaBoTkaaafChtyo2gi7pXWIF+X7QGtfg1sGi2rMCEVkUO6iDRgmMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:20::14) by SH0PR01MB0492.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.428.16; Tue, 22 Sep 2026 16:12:38 +0000 Received: from SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn ([fe80::435e:52b5:c524:459c]) by SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn ([fe80::435e:52b5:c524:459c%3]) with mapi id 15.21.0428.015; Tue, 22 Sep 2026 16:12:38 +0000 From: Joshua Yeong To: broonie@kernel.org, lgirdwood@gmail.com, rahul@summations.net, anup@brainfault.org, lftan.linux@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: alex@ghiti.fr, joshua.yeong@starfivetech.com, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] dt-bindings: regulator: Add RPMI voltage service bindings Date: Wed, 23 Sep 2026 00:11:52 +0800 Message-ID: <20260922161156.1088153-2-joshua.yeong@starfivetech.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260922161156.1088153-1-joshua.yeong@starfivetech.com> References: <20260922161156.1088153-1-joshua.yeong@starfivetech.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BJXPR01CA0066.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::33) To SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:20::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SH0PR01MB0841:EE_|SH0PR01MB0492:EE_ X-MS-Office365-Filtering-Correlation-Id: c1f067f0-c344-4e20-8935-08df18c45220 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|52116014|376014|7416014|1800799024|366016|10067099003|56012099006|3023799007|6133799003|22082099003|18002099003|13003099007|921020|38350700014; X-Microsoft-Antispam-Message-Info: ERea6Pk3MRbTQs7AugZHFWz0O0dcCMHzEjGmormRO+pG1vsCeeSpbJpP1rbATwAR5bbf7gKaAyW54nzcxvjHLrZUOsNICqfp12B7xlekJ3hJjtkDkf2WYi61iPPnJsclcK3oKmgFIqxnsp0JKdIFk52umc8yNVhG7oi4szq+gDB2kRJWNXEsz/r0KCF5M4Xr80Gkipve4n3q8b/zIrfDsjSP8zXgyoVf5Uy4TWwG9kfZdfU1zu5Fk3ge86dtCNIlo2fq8fhaXLUy4+fvY6JA4hKVO7bMGA2KdCLzp2biOl9vW/tzmwoWFNUwJqz36htNr7YMSh6VJTB6oQ6OanScKlbz0WdzEgOGTKMSrNzWKURKtW/OFikBy9PM3hxtijYh0XIrAH0CGF5Y0/UAJuAH+pufkSkMBpAwYBGRBOL5464seJvwS1mHletKX/SvyuJfnfK0QXIh6P2yMrinky6OFo0fds39ps9GMTUgPga2vJQ7kTnJ9E5ZIIqveXt9wKFBqh59YZdk69fGR1rGOky182/cUP5kQP4FbV7UM8+FLPc4B04XVa0dxovNn0AMCAQDwsvE9Bv/fYSon/do5ghFLA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(52116014)(376014)(7416014)(1800799024)(366016)(10067099003)(56012099006)(3023799007)(6133799003)(22082099003)(18002099003)(13003099007)(921020)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?2H0t99qlI0WnFU/cUe6r30fkmQRqdlR73n4sB+D6ixjsHXavCQVCjyGswfz6?= =?us-ascii?Q?KNsIXiiMaHH3+JhhCe2PZsNK3OYTgIXPFNS/cQEL7lAYNAYRyVDnvgVD4mnb?= =?us-ascii?Q?LINEILy8uj1U/FT9UKOcy51i19dSyE/OSNn/0h+HpZajMRXL20JqJ+hu6alv?= =?us-ascii?Q?Do0qVImlfodCofbJXRouI5wQL4l8/31S923eJMRtZvx+Xy5qqSkJuOS8arhP?= =?us-ascii?Q?FaQV/dPFJIWHP+zD4McYK6WmVNe3ITSMwPgH3gpxCvCimVaJ+pN4MljIwfx6?= =?us-ascii?Q?55Ws3nrrCtPavLVSzhfnQsBH8q/0xPUG2RbLV0Tc2PfET5lsxUWeWpK9ZXUz?= =?us-ascii?Q?BKKt49Rwo9E8x4kUVmMrkgNc6aIliMRaDXS5nCJ1rR5K2ivIJQmDBElHC7pa?= =?us-ascii?Q?cWtu3fhsa7ViQZG291TZzxmfHBVSR71JVeo316ORSsyj7nE/k+iRPKu32YMf?= =?us-ascii?Q?wruSnKYe32Ko1T3X3TM/Xaeec6w1JYPk8snFt5W8Q9wobHczgZd3oRAoLBtc?= =?us-ascii?Q?qoGPKF3fH54bQFQi5eKHzgIDrDbdUo1AWhq396uki3pQM0cDhbZfmxqg52wd?= =?us-ascii?Q?+MZwS6oR/1SK2VPy4yQRVSkrkulgm159bxT9gAk3wqbCCrfog9o6viScBTaj?= =?us-ascii?Q?DCTYttZ0DbZZ9wcj3S6EB9CL5+/V19HF0mLzEUFqTQzV1tzBzJPUCk3sJTSV?= =?us-ascii?Q?ehg0f0CMD652V8ifV9z9hcvvAIzMK5wZK+lSKw2n/cuGcRqByZJCILr9vVKk?= =?us-ascii?Q?N6l1MMAN9pWekAT2BueMsTxeCio/mynQP2nsW6I6AhOQl35i25OnOAhTrRCt?= =?us-ascii?Q?InxGHSacdoUj9bN21qgLj72AgOC0DQVRyf8t+YDL1sCiUhBH93MhEvgnNz/b?= =?us-ascii?Q?G03lQ2S15sCKxkXizK2CoVuX67YAGMAoXgB/3YDJWyysDcaIHfDdQoz3Ku9i?= =?us-ascii?Q?4wgY2tLytEDKieYV/57NdS6QmJa1CPe72G7rX5VKfjMAppatrCjO0QmTCxat?= =?us-ascii?Q?fOZmdpwpup+N/UFnHyd1BydLUAKJyeSVg87UhOAidPI9uBofFBje2XDn36W8?= =?us-ascii?Q?DREScqrW/aaYHaXSBeqx4lGQKXgAy2LCYq4Icz83ofJ5QNeAYxk/XcaMdK3k?= =?us-ascii?Q?9Pg5nhs67XXej5zCWiygUK4+0pCl7R+Q/r8q07utRyLfPqn/dYATyoHzw1iY?= =?us-ascii?Q?qM3YZ0pOuLeMWNIyAAdfaMCGWmgdFGHPLbE3nJOPtaeLFJmo3vVof0zH9cC7?= =?us-ascii?Q?/UrPygMjln+bVZFuSChQUVwv8r7PUe1wYfnmgKqrP+W+jlnz1/yPlruF04TV?= =?us-ascii?Q?VXZhSU5NjiBqStpb9usDToUAM3J3fp5lHwHpYg+9qVRo10jDZSRjgvW0aG7U?= =?us-ascii?Q?AG0TYqrVwycbASw97tmHHn4BOdNrcMCEZhq1/xMY0DCi5ctueusUxyi0LVDh?= =?us-ascii?Q?ytYQWNDv8Ly5hYYIcNuf0+g4vKnT7VP5aqPE0wUfCmsCMIBJ9+ABBirKEVBJ?= =?us-ascii?Q?tCg3VaSh3nyyEDFz+pQa5Eieb+/EQRLt9wYuV/hoXMeMZ2Dw8XvWBy2/Q1Lc?= =?us-ascii?Q?bSF/IqnG+kygfPDZU5AGtLBl1WfxpwDswoT9CWcr7oW+Rb3e5TBAsr0zqfwa?= =?us-ascii?Q?2O1bkOfkAs1bpbOGgiSt2Iv5A3C8FcuewQev1Wj5UaM/xJ9yHNjHGrHuQwNy?= =?us-ascii?Q?bZAKqopqVwhnujUx0xvBUln3TDYTOJMcijV6ebfgeqxfTZe7sodyF+F5px/T?= =?us-ascii?Q?DVbAOxgGfCzHranrbgRkphMS79yVu0g=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1f067f0-c344-4e20-8935-08df18c45220 X-MS-Exchange-CrossTenant-AuthSource: SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2026 16:12:38.3336 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Qk77ruHzRMiJFvverz5dv6NeNPNnKPfrRwCV36V28xNXbWKoC+uNnktqGgPieGP0c3cvskl7x6ilCiJr7LIks8d3j+OPJVJ9mN3ypkmQLV0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SH0PR01MB0492 Content-Type: text/plain; charset="utf-8" Add device tree bindings for the RISC-V Platform Management Interface (RPMI) voltage service group, both for the supervisor-facing regulator controller and for the SBI MPXY channel which the SBI implementation uses to expose the service group. Signed-off-by: Joshua Yeong --- .../regulator/riscv,rpmi-mpxy-voltage.yaml | 65 ++++++++ .../regulator/riscv,rpmi-voltage.yaml | 150 ++++++++++++++++++ 2 files changed, 215 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/riscv,rpmi-= mpxy-voltage.yaml create mode 100644 Documentation/devicetree/bindings/regulator/riscv,rpmi-= voltage.yaml diff --git a/Documentation/devicetree/bindings/regulator/riscv,rpmi-mpxy-vo= ltage.yaml b/Documentation/devicetree/bindings/regulator/riscv,rpmi-mpxy-vo= ltage.yaml new file mode 100644 index 000000000000..8cc53879cdf9 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/riscv,rpmi-mpxy-voltage.y= aml @@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/riscv,rpmi-mpxy-voltage.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: RISC-V RPMI voltage service group based message proxy + +maintainers: + - Joshua Yeong + +description: | + The RISC-V Platform Management Interface (RPMI) [1] defines a + messaging protocol which is modular and extensible. The supervisor + software can send/receive RPMI messages via SBI MPXY extension [2] + or some dedicated supervisor-mode RPMI transport. + + The RPMI specification [1] defines voltage service group for accessing + and controlling the voltage domains managed by a platform + microcontroller. The SBI implementation (machine mode firmware or + hypervisor) can implement an SBI MPXY channel to allow RPMI voltage + service group access to the supervisor software. + + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + References + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + + [1] RISC-V Platform Management Interface (RPMI) v1.0 (or higher) + https://github.com/riscv-non-isa/riscv-rpmi/releases + + [2] RISC-V Supervisor Binary Interface (SBI) v3.0 (or higher) + https://github.com/riscv-non-isa/riscv-sbi-doc/releases + +properties: + compatible: + description: + Intended for use by the SBI implementation. + const: riscv,rpmi-mpxy-voltage + + mboxes: + maxItems: 1 + description: + Mailbox channel of the underlying RPMI transport. + + riscv,sbi-mpxy-channel-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + The SBI MPXY channel id to be used for providing RPMI access to + the supervisor software. + +required: + - compatible + - mboxes + - riscv,sbi-mpxy-channel-id + +additionalProperties: false + +examples: + - | + voltage-service { + compatible =3D "riscv,rpmi-mpxy-voltage"; + mboxes =3D <&rpmi_shmem_mbox 0x7>; + riscv,sbi-mpxy-channel-id =3D <0x1004>; + }; +... diff --git a/Documentation/devicetree/bindings/regulator/riscv,rpmi-voltage= .yaml b/Documentation/devicetree/bindings/regulator/riscv,rpmi-voltage.yaml new file mode 100644 index 000000000000..66d1c26592c1 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/riscv,rpmi-voltage.yaml @@ -0,0 +1,150 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/riscv,rpmi-voltage.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: RISC-V RPMI voltage service group based regulator controller + +maintainers: + - Joshua Yeong + +description: | + The RISC-V Platform Management Interface (RPMI) [1] defines a + messaging protocol which is modular and extensible. The supervisor + software can send/receive RPMI messages via SBI MPXY extension [2] + or some dedicated supervisor-mode RPMI transport. + + The RPMI specification [1] defines voltage service group for accessing + and controlling the voltage domains managed by a platform + microcontroller. The supervisor software can access RPMI voltage + service group via SBI MPXY channel or some dedicated supervisor-mode + RPMI transport. + + The voltage domains are discovered at runtime from the platform + microcontroller, which reports the name, the level format, the supported + levels and the always-on capability of each one, so none of that is + described here. + + A consumer names a domain in one of two ways. The first is through a + "-supply" phandle to a child of the optional "regulators" containe= r, + whose "reg" is the domain's RPMI DOMAIN_ID. The second needs no child wi= th + "#voltage-domain-cells" on the provider, a consumer lists + "voltage-domains =3D <&provider DOMAIN_ID>" and names each entry in + "voltage-domain-names", the way it names a voltage power domain. + + A child may also say what the board permits the rail to supply, which the + platform microcontroller has no way to express. A child that gives no + voltage constraint leaves the rail free to move within the levels the + domain advertises. + + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + References + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + + [1] RISC-V Platform Management Interface (RPMI) v1.0 (or higher) + https://github.com/riscv-non-isa/riscv-rpmi/releases + + [2] RISC-V Supervisor Binary Interface (SBI) v3.0 (or higher) + https://github.com/riscv-non-isa/riscv-sbi-doc/releases + +properties: + compatible: + description: + Intended for use by the supervisor software. + const: riscv,rpmi-voltage + + mboxes: + maxItems: 1 + description: + Mailbox channel of the underlying RPMI transport or SBI message prox= y channel. + + "#voltage-domain-cells": + const: 1 + description: + Lets a consumer name a domain by its RPMI DOMAIN_ID, the single cell= of + a "voltage-domains" entry, without a child node for the domain. + + regulators: + type: object + additionalProperties: false + description: + Optional container giving discovered domains a node of their own, for + consumers to reference and for board level constraints. + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + patternProperties: + "^regulator@[0-9a-f]+$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + + properties: + reg: + maxItems: 1 + description: + RPMI DOMAIN_ID of the voltage domain this node describes. + + required: + - reg + + required: + - "#address-cells" + - "#size-cells" + +required: + - compatible + - mboxes + +additionalProperties: false + +examples: + - | + rpmi_voltage: rpmi-voltage { + compatible =3D "riscv,rpmi-voltage"; + mboxes =3D <&mpxy_mbox 0x1004 0x0>; + #voltage-domain-cells =3D <1>; + + regulators { + #address-cells =3D <1>; + #size-cells =3D <0>; + + // A node only so that consumers can name the domain. Its + // voltage stays free to move within the advertised levels. + volt1_reg: regulator@1 { + reg =3D <1>; + }; + + // A board level constraint. Equal bounds pin the rail, so the + // supervisor applies 1.8V and refuses to move it afterwards. + volt2_reg: regulator@2 { + reg =3D <2>; + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; + }; + }; + + sensor { + compatible =3D "vendor,sensor"; + vdd-supply =3D <&volt1_reg>; + }; + + codec { + compatible =3D "vendor,codec"; + vdd-supply =3D <&volt2_reg>; + }; + + // Domains 3 and 4 by DOMAIN_ID, with no child node for either. + phy { + compatible =3D "vendor,phy"; + voltage-domains =3D <&rpmi_voltage 3>, <&rpmi_voltage 4>; + voltage-domain-names =3D "vdda", "vddio"; + }; +... --=20 2.43.0 From nobody Thu Sep 24 15:11:01 2026 Received: from CHN02-BJS-obe.outbound.protection.partner.outlook.cn (mail-bjschn02on2126.outbound.protection.partner.outlook.cn [139.219.17.126]) (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 E537A5650E2; Tue, 22 Sep 2026 16:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=139.219.17.126 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790093579; cv=fail; b=kr7XZR/09O+CaT6e7lK0CPHp0qT+9TVK0S7oa6iYP0yIfHsxt8ZIlVDlNhKcg9EkO/3DU+AL3PeYM7htcHlDMZVOBtWhucwTfcms3WoeZmg+87kEGWM1Iwj5ls2S77Dz4mBeltMLjxxtsvii9Ieqxoumm5o7FDwOqlILQHeQm7w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790093579; c=relaxed/simple; bh=7rzc00L3WW+lDMZiSxN0O/9LZ0e6GRxrsiAlFT5n31k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=bZGAR7gb4PTkzg06KQiEmUW7I5cJN7U/EsFe7ssuoPo3HaV3Sfnv0B9iOoxe0Xc0e6Wxr3iIXRM0X1VHFkmEQG98yP/gnUk2EZPoFnI+ganQDcoKbI+hp8DTEs3wJ/Cc92A8jiJQB0jyWG3y8iI1txPseUKvI2YWg/HuN3OoD6Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=starfivetech.com; spf=pass smtp.mailfrom=starfivetech.com; arc=fail smtp.client-ip=139.219.17.126 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WOxzpU3Jm5g8rVbwdlezTBENrxvKNUTu3aCDGBqUnVR4PUCoUJfxnUTrNvnnhrZTFinnhQiEkQbSQw4FOg/zdG4bTc1lY6f86YtzF/0GI6ArSRku6qTVRIDJFDAk8F0pMdFFij8c5z3IQ1edp+zalkSUqlDdgQqMKHPVj0TZFuymPRDqi2cTZvoRIPHI0NbgvrpBZgbV1Xqmu4kkGFH8Ds2DDsoXuhE9SL1NGITFQYMuG5IuTm5R2cmCHRAKMdZ8nyohdeYWLpwLEuvMdaJoQ+EFj1YbAwp84oTpT26puNt+C+2ZLKVMCmXfVqR/Lqs9tjOapvA465pc6x+y6XjmAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J05U/x0Mopq6Aclznvuqor2NPRAmVw+WbPaA94hlsIM=; b=m/0G/dYVjw83fGBMOBaLE3qYhJNyh0WlOoORFUQtkKXIW6a9mgiZSZ/cTlDKcHe1u77cjvsQ4lQSPaga8eG7Ti3CgKJyal92V2cz2QZPyNn/r/66JjkTucAYxf6WYnadRXPizctWbYY464sOxkKHfkahfkO/3yciOjd9BcpK91vMmLs82TWSMC/dlrXJG/km1z+APyyxWQcRal7N7lITNPYkFm3mf5up6o8r/I04AsRF8mzo/6IYWHiuUJjLYP0ECTo6jOhgWNOl1jI8n40CAgazDcbCpWn5EInG1yLv8xC3IfvxuMpXTe2yYpgYpzaxB1GwR3eFX31Zmdg1G//XJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:20::14) by SH0PR01MB0492.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.428.16; Tue, 22 Sep 2026 16:12:44 +0000 Received: from SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn ([fe80::435e:52b5:c524:459c]) by SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn ([fe80::435e:52b5:c524:459c%3]) with mapi id 15.21.0428.015; Tue, 22 Sep 2026 16:12:44 +0000 From: Joshua Yeong To: broonie@kernel.org, lgirdwood@gmail.com, rahul@summations.net, anup@brainfault.org, lftan.linux@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: alex@ghiti.fr, joshua.yeong@starfivetech.com, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] regulator: Add RPMI voltage service Date: Wed, 23 Sep 2026 00:11:53 +0800 Message-ID: <20260922161156.1088153-3-joshua.yeong@starfivetech.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260922161156.1088153-1-joshua.yeong@starfivetech.com> References: <20260922161156.1088153-1-joshua.yeong@starfivetech.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BJXPR01CA0066.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::33) To SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:20::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SH0PR01MB0841:EE_|SH0PR01MB0492:EE_ X-MS-Office365-Filtering-Correlation-Id: 785a4e36-08f4-4bfb-5a30-08df18c4558f X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|52116014|376014|7416014|1800799024|366016|10067099003|56012099006|3023799007|6133799003|22082099003|18002099003|5023799004|921020|38350700014; X-Microsoft-Antispam-Message-Info: 3gqV7LCHvDW462vrPfNCvC7oZJIqMqu6r1GCjjK1lbZnkM64JoYl5FrzBYgt3/5QZZwG5EAhd0z2pUmCTXZR01NYtLQO0onHaDrugjVxEYxvAX39kUXtXIrdLuhVKfqQgbrxeoB4znhRK1T1TTWK22F1YLY1swIRpyDOks0ucA5EKolgVhGTOEPJo0OYyRcRy5pGW4Q+WGUYlkESo7BxYkzrowKXmFiRGYpRPTlvqukRVBNhFEN0VqiS+M8JaOcBpCYsoBG+2H+UEJuRdhzGwXFDQ9w866NkDDAsHa7aCRou6CVEyCSeRl8wdBgjRadmm++uOk8S0u4NU3wKZeLD6kzDDDuaJ8Jd6XdSr770H6e2nCkRbDiv9kCXbrpwsF0mwMl7ZdGHdNTzLmjU732voXeyP2W0rxElat/DxUNihZanuFNJwT2+xRwI/DHKOhnakXJAoX/OcO+WpbB9ZatvUHjieUeRMSVN4s6tWtU6EYStP+eDQrfPafsQsXRHEjtGc1yxcOxx9V3izXNXvtqM+ft8qZ0B1NizPxX8j5zpbjr9ZrTf4XjRwXdpgtoQmCgguBhe1xlQUS/Ed84Rei78Ow== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(52116014)(376014)(7416014)(1800799024)(366016)(10067099003)(56012099006)(3023799007)(6133799003)(22082099003)(18002099003)(5023799004)(921020)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?QmKTTWmlhZzet2K3Wdt/BvcBBej/wx9/HOAPE+LPcKb6ct+PHkTwDb/RmcqH?= =?us-ascii?Q?53r2DAG7mB9/PSWwxdPlq8PP8OQavn+1krExLKJA6VvsBlLSp1C8UQ6Tpr8K?= =?us-ascii?Q?MYYNIyhCctMmKSj4C7w34hhnpetpb9i+7zB7YamAwdr8oOLm8oGRCfziY1ll?= =?us-ascii?Q?K9hRP7+CqRTtCrgFKc6mIZ/x7eO/ZdRJorCMMw3lbQW24Z5+puvDFXkMjjJ/?= =?us-ascii?Q?iRmnBCyCa7S8O6Ua2uBvcS3Q81Wl0LKa0unCe/hD7yGClKGEt3Rbgr/xs6tt?= =?us-ascii?Q?a14gZQRa52ySK0sPo7jBNI8cH6smUgaqsbyg6Fr2UtVuGiGAmwkX8UX+w78a?= =?us-ascii?Q?ITD4XZ+UjoeW8bADx92ARwWmeKfMr3GLR0klaUhdXeTViPMK0vWG01VR4iKo?= =?us-ascii?Q?FqtM2W2SwHhK0+JmV+CFlknqD580jgPq/Ii0kAXIH8ffkAyZwLK03peTdLW0?= =?us-ascii?Q?L1k7hToisCTtUd2WuzDB8j+ooNb+CeEPvsal3sl3NsWiJ3WxFnyx1Pln2qPh?= =?us-ascii?Q?X0ev9ZHO1NXQdY9tCtunGSQ/M/aoLkE/yi+6GbEAKuxxfeieqlXA+DxU9ARA?= =?us-ascii?Q?uxp/JT5nSOUA5SKEJWeD/f6SLGYH5mLj+m8b7LnkHp1XkL4waaWJKBBS/0bM?= =?us-ascii?Q?ibh66Dn3PEbarMy2foJ837EkHZOfi9K45BM+Goruc9sGticEU2sS7RlIElqL?= =?us-ascii?Q?nwzCLllRIY3HkoX0pNckXMhRCq5k5L2t3Dklh8d2deDU9mZwNEKmdLQlvCMp?= =?us-ascii?Q?X9aBkksqFHsXh+zw94ywmHHJD5meqlrF8LbUeZ1qwHcW2si4AOCNPP+jUKB9?= =?us-ascii?Q?vZvqBlNhU5U9dYiwFtLHmLaxIDB2tYBIC6NZM7LVwbFqmaIN/34LP7wk/N4C?= =?us-ascii?Q?lpwZEHFGT98tIyttmlZHSEcayJSwb/zUmS6u7mZA6TLb/eE1EIFOSK9RWqPa?= =?us-ascii?Q?nJCpHiJTdI9+SXYj3L3LCR21mpM35BO+PpPwRsozeVJVezEzixMJh4NCtaop?= =?us-ascii?Q?HmOIPQpbGSkPZZ00T3zm+0yYnfL2cSSTRTaOonysqr48sL6I04nlzpO2bGAO?= =?us-ascii?Q?8Tp+Zt1/ZcM0an+1fb5M00Hn3jGSh3cFhDkat+PH4Z+y9Xi9f0Xjk3GtXicE?= =?us-ascii?Q?yjczEtXQPEKePSt4j5uoNWcJNb39b8e0FXPkO8IXJKHnGaeqdfrN+OOI7zrG?= =?us-ascii?Q?esgxU1/WGDY3yavufOiGSZvhxAj597gE9VJeXpVr/FRV0m37uHV7H5jWBmqn?= =?us-ascii?Q?hZ0dwe6wCca9alIMJiqa06W01aoeYeuwkBcPTxgePItXOMwam+zZe7jw8q6W?= =?us-ascii?Q?gk/HaPSRiQJUqcyfXnUMHdHEIc44q1f1cwx1QLssN6rhJBc2pCrlXAqsyB/C?= =?us-ascii?Q?qWFvea0J+fKSImPm3V+JPK31iLkw3p99PsZCdtHEwxrH/55szBOxlvh78BFo?= =?us-ascii?Q?TibcGDG/VzbGLIvqYGmMMepwTOe6m7q2V2Qy1tizd7YcXX2hhDfm0Dj/ex3F?= =?us-ascii?Q?Cpb+cuEbGCDuvPuqL08fZsRb4x321tfWjS5BOZpaK1v3UOOuA5Pccv/ZmrFS?= =?us-ascii?Q?mepvRfz9hiGfkjI5eJcZXgZCJKIc8o85X1T2JLuUkxprLZFmQOWzK3BjHdxH?= =?us-ascii?Q?gp7AHI9FvDnWC7qwhls4Csa7+HGyEuWJCkEnvJ9/D/TYmajz1pkDkxJoovT6?= =?us-ascii?Q?D46P4Ik9hOM4B8N2yh9G0gq7S8kQPQmlDuVq+a+C2XIa/KxuHl5FR3aoqzpF?= =?us-ascii?Q?eI6k4kJB6Q1jD4Z41b62gbJ9SuwJiDY=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 785a4e36-08f4-4bfb-5a30-08df18c4558f X-MS-Exchange-CrossTenant-AuthSource: SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2026 16:12:44.3414 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dnPv+1BXH8nsmBbcG5tJRrNsvmRtdcLRVJQ6Gkt1erM3jtuuj3nDm0Sm7xRYfvsauovP8CQ5xxDw5eld0xWXiucDZmUmgLJqSlWEa7fmR7o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SH0PR01MB0492 Content-Type: text/plain; charset="utf-8" The RPMI specification defines a voltage service group which can be accessed via SBI MPXY extension or dedicated S-mode RPMI transport. Add a mailbox client based regulator driver for the RISC-V RPMI voltage service group. The driver enumerates the voltage domains advertised by the platform microcontroller, reads their supported voltage levels and registers each of them as a regulator. Signed-off-by: Joshua Yeong --- drivers/regulator/Kconfig | 13 + drivers/regulator/Makefile | 1 + drivers/regulator/riscv-rpmi-regulator.c | 1077 +++++++++++++++++ include/linux/mailbox/riscv-rpmi-message.h | 14 + .../linux/regulator/riscv-rpmi-regulator.h | 41 + 5 files changed, 1146 insertions(+) create mode 100644 drivers/regulator/riscv-rpmi-regulator.c create mode 100644 include/linux/regulator/riscv-rpmi-regulator.h diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index a54a549196fe..ed833c313a1e 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1255,6 +1255,19 @@ config REGULATOR_RC5T583 through regulator interface. The device supports multiple DCDC/LDO outputs which can be controlled by i2c communication. =20 +config REGULATOR_RISCV_RPMI + tristate "RISC-V RPMI based regulator driver" + depends on MAILBOX || COMPILE_TEST + default RISCV + help + Support for regulators based on the voltage service group defined + by the RISC-V platform management interface (RPMI) specification. + The voltage domains advertised by the platform microcontroller are + registered as regulators. + + To compile this driver as a module, choose M here: the + module will be called riscv-rpmi-regulator. + config REGULATOR_RK808 tristate "Rockchip RK805/RK808/RK809/RK817/RK818 Power regulators" depends on MFD_RK8XX diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 134eee274dbf..098a50b958b3 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -146,6 +146,7 @@ obj-$(CONFIG_REGULATOR_RAA215300) +=3D raa215300.o obj-$(CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY) +=3D rpi-panel-att= iny-regulator.o obj-$(CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_V2) +=3D rpi-panel-v2-regu= lator.o obj-$(CONFIG_REGULATOR_RC5T583) +=3D rc5t583-regulator.o +obj-$(CONFIG_REGULATOR_RISCV_RPMI) +=3D riscv-rpmi-regulator.o obj-$(CONFIG_REGULATOR_RK808) +=3D rk808-regulator.o obj-$(CONFIG_REGULATOR_RN5T618) +=3D rn5t618-regulator.o obj-$(CONFIG_REGULATOR_ROHM) +=3D rohm-regulator.o diff --git a/drivers/regulator/riscv-rpmi-regulator.c b/drivers/regulator/r= iscv-rpmi-regulator.c new file mode 100644 index 000000000000..2309466eccb3 --- /dev/null +++ b/drivers/regulator/riscv-rpmi-regulator.c @@ -0,0 +1,1077 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * RISC-V RPMI Based Regulator Driver through SBI MPXY + * + * Copyright (C) 2026 Shanghai StarFive Technology Co., Ltd. + * + * Implements a regulator driver on top of SBI RPMI Message Proxy Extensio= n (MPXY) + * + * Each SBI MPXY regulator instance is associated, through the means of a = proper DT + * entry description, to a specific Transport ID. + */ + +#define pr_fmt(fmt) "riscv-rpmi-regulator: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define RPMI_REG_DOMAIN_NAME_LEN 16 +/* "domain" and a u32 DOMAIN_ID in decimal */ +#define RPMI_REG_SUPPLY_NAME_LEN 17 + +/* VOLT_GET_ATTRIBUTES FLAGS */ +#define VOLTAGE_FORMAT_MASK GENMASK(3, 1) +#define ALWAYS_ON_MASK BIT(0) + +struct rpmi_ctx { + struct mbox_chan *chan; + struct mbox_client client; + u32 max_msg_size; +}; + +struct rpmi_reg_level_discrete { + u32 uvolt; +}; + +struct rpmi_reg_level_linear { + u32 uvolt_min; + u32 uvolt_max; + u32 uvolt_step; +}; + +struct rpmi_reg_domain { + u32 id; + struct rpmi_ctx *rpmi_ctx; + struct device *dev; + struct regulator_desc desc; + struct regulator_init_data init_data; + u32 voltage_format; + u32 always_on:1; + u32 num_levels; + u32 transition_latency; + u32 *level; + char name[RPMI_REG_DOMAIN_NAME_LEN]; + struct regulator_dev *rdev; + struct regulator_consumer_supply supply; + char supply_name[RPMI_REG_SUPPLY_NAME_LEN]; +}; + +/* + * A provider whose domains a consumer can name by DOMAIN_ID, through + * "voltage-domains =3D <&provider DOMAIN_ID>". It is listed once every do= main + * has been registered, so that devm_rpmi_voltage_supply_alias() can go fr= om + * the phandle to the domain. + */ +struct rpmi_reg_provider { + struct list_head node; + struct device *dev; + struct rpmi_reg_domain *domains; + u32 num_domains; +}; + +static LIST_HEAD(rpmi_reg_providers); +static DEFINE_MUTEX(rpmi_reg_providers_lock); + +/* Service ID: RPMI_VOLTAGE_SRV_GET_NUM_DOMAINS */ +struct rpmi_get_num_domain_rx { + __le32 status; + __le32 num_domains; +}; + +/* Service ID: RPMI_VOLTAGE_SRV_GET_ATTRIBUTES */ +struct rpmi_get_domain_attrs_tx { + __le32 domain_id; +}; + +/* Service ID: RPMI_VOLTAGE_SRV_GET_SUPPORTED_LEVELS */ +struct rpmi_get_supp_levels_tx { + __le32 domain_id; + __le32 level_index; +}; + +struct rpmi_get_supp_levels_rx { + __le32 status; + __le32 flags; + __le32 remaining_items; + __le32 returned_items; + __le32 level[]; +}; + +/* Service ID: RPMI_VOLTAGE_SRV_SET_CONFIG */ +struct rpmi_set_config_tx { + __le32 domain_id; + __le32 config; +}; + +struct rpmi_set_config_rx { + __le32 status; +}; + +/* Service ID: RPMI_VOLTAGE_SRV_GET_CONFIG */ +struct rpmi_get_config_tx { + __le32 domain_id; +}; + +struct rpmi_get_config_rx { + __le32 status; + __le32 config; +}; + +/* Service ID: RPMI_VOLTAGE_SRV_SET_LEVEL */ +struct rpmi_set_level_tx { + __le32 domain_id; + __le32 level; +}; + +struct rpmi_set_level_rx { + __le32 status; +}; + +/* Service ID: RPMI_VOLTAGE_SRV_GET_LEVEL */ +struct rpmi_get_level_tx { + __le32 domain_id; +}; + +struct rpmi_get_level_rx { + __le32 status; + __le32 level; +}; + +/* regulator control */ +enum rpmi_domain_config { + RPMI_VOLT_DISABLE =3D 0, + RPMI_VOLT_ENABLE =3D 1, +}; + +struct rpmi_get_domain_attrs_rx { + __le32 status; + __le32 flags; +#define REG_VOLTAGE_FORMAT(f) (FIELD_GET(VOLTAGE_FORMAT_MASK, (f))) +#define REG_FORMAT_DISCRETE 0 +#define REG_FORMAT_LINEAR 1 +#define REG_ALWAYS_ON(f) (FIELD_GET(ALWAYS_ON_MASK, (f))) + __le32 num_levels; + __le32 transition_latency; + char name[RPMI_REG_DOMAIN_NAME_LEN]; +}; + +static int rpmi_reg_get_num_domains(struct rpmi_ctx *mpxy_ctx, u32 *domain) +{ + struct rpmi_get_num_domain_rx rx =3D { }; + struct rpmi_mbox_message msg; + int ret; + + rpmi_mbox_init_send_with_response(&msg, RPMI_VOLT_SRV_GET_NUM_DOMAINS, + NULL, 0, &rx, sizeof(rx)); + + ret =3D rpmi_mbox_send_message(mpxy_ctx->chan, &msg); + if (ret) + return ret; + + if (rx.status) + return rpmi_to_linux_error(le32_to_cpu(rx.status)); + + if (msg.data.out_response_len < sizeof(rx)) + return -EPROTO; + + *domain =3D le32_to_cpu(rx.num_domains); + + return 0; +} + +static int rpmi_reg_get_attrs(struct rpmi_reg_domain *mpxy_reg) +{ + struct rpmi_get_domain_attrs_tx tx; + struct rpmi_get_domain_attrs_rx rx =3D { }; + struct rpmi_mbox_message msg; + u32 flags, format; + size_t level_size; + int ret; + + tx.domain_id =3D cpu_to_le32(mpxy_reg->id); + + rpmi_mbox_init_send_with_response(&msg, RPMI_VOLT_SRV_GET_ATTRIBUTES, + &tx, sizeof(tx), &rx, sizeof(rx)); + + ret =3D rpmi_mbox_send_message(mpxy_reg->rpmi_ctx->chan, &msg); + if (ret) + return ret; + + if (rx.status) + return rpmi_to_linux_error(le32_to_cpu(rx.status)); + + if (msg.data.out_response_len < sizeof(rx)) + return -EPROTO; + + flags =3D le32_to_cpu(rx.flags); + format =3D REG_VOLTAGE_FORMAT(flags); + + mpxy_reg->num_levels =3D le32_to_cpu(rx.num_levels); + mpxy_reg->transition_latency =3D le32_to_cpu(rx.transition_latency); + strscpy(mpxy_reg->name, rx.name, RPMI_REG_DOMAIN_NAME_LEN); + + switch (format) { + case REG_FORMAT_DISCRETE: + level_size =3D sizeof(struct rpmi_reg_level_discrete); + break; + case REG_FORMAT_LINEAR: + level_size =3D sizeof(struct rpmi_reg_level_linear); + break; + default: + dev_err(mpxy_reg->dev, "voltage domain %u: unknown voltage format %u\n", + mpxy_reg->id, format); + return -EINVAL; + } + + mpxy_reg->voltage_format =3D format; + mpxy_reg->always_on =3D REG_ALWAYS_ON(flags); + + mpxy_reg->level =3D devm_kcalloc(mpxy_reg->dev, mpxy_reg->num_levels, + level_size, GFP_KERNEL); + if (!mpxy_reg->level) + return -ENOMEM; + + return 0; +} + +static int rpmi_reg_get_supported_levels(struct rpmi_reg_domain *mpxy_reg) +{ + u32 max_msg_size =3D mpxy_reg->rpmi_ctx->max_msg_size; + u32 index =3D 0, remaining, returned, words, i; + struct rpmi_get_supp_levels_tx tx; + struct rpmi_get_supp_levels_rx *rx; + struct rpmi_mbox_message msg; + u32 *level =3D mpxy_reg->level; + int ret =3D 0; + + switch (mpxy_reg->voltage_format) { + case REG_FORMAT_DISCRETE: + words =3D sizeof(struct rpmi_reg_level_discrete) / sizeof(u32); + break; + case REG_FORMAT_LINEAR: + words =3D sizeof(struct rpmi_reg_level_linear) / sizeof(u32); + break; + default: + return -EINVAL; + } + + rx =3D kzalloc(max_msg_size, GFP_KERNEL); + if (!rx) + return -ENOMEM; + + tx.domain_id =3D cpu_to_le32(mpxy_reg->id); + + while (index < mpxy_reg->num_levels) { + tx.level_index =3D cpu_to_le32(index); + + rpmi_mbox_init_send_with_response(&msg, RPMI_VOLT_SRV_GET_SUPPORTED_LEVE= LS, + &tx, sizeof(tx), rx, max_msg_size); + + ret =3D rpmi_mbox_send_message(mpxy_reg->rpmi_ctx->chan, &msg); + if (ret) + break; + + if (rx->status) { + ret =3D rpmi_to_linux_error(le32_to_cpu(rx->status)); + break; + } + + if (msg.data.out_response_len < sizeof(*rx)) { + ret =3D -EPROTO; + break; + } + + remaining =3D le32_to_cpu(rx->remaining_items); + returned =3D le32_to_cpu(rx->returned_items); + + if (!returned || returned > mpxy_reg->num_levels - index || + returned > (msg.data.out_response_len - sizeof(*rx)) / + (words * sizeof(u32)) || + remaining !=3D mpxy_reg->num_levels - index - returned) { + dev_err(mpxy_reg->dev, + "voltage domain %u: invalid supported levels reply\n", + mpxy_reg->id); + ret =3D -EPROTO; + break; + } + + for (i =3D 0; i < returned * words; i++) + *level++ =3D le32_to_cpu(rx->level[i]); + + index +=3D returned; + } + + kfree(rx); + + return ret; +} + +static int rpmi_reg_set_config(struct rpmi_reg_domain *mpxy_reg, u32 confi= g) +{ + struct rpmi_set_config_tx tx; + struct rpmi_set_config_rx rx =3D { }; + struct rpmi_mbox_message msg; + int ret; + + tx.domain_id =3D cpu_to_le32(mpxy_reg->id); + tx.config =3D cpu_to_le32(config); + + rpmi_mbox_init_send_with_response(&msg, RPMI_VOLT_SRV_SET_CONFIG, + &tx, sizeof(tx), &rx, sizeof(rx)); + + ret =3D rpmi_mbox_send_message(mpxy_reg->rpmi_ctx->chan, &msg); + if (ret) + return ret; + + if (rx.status) + return rpmi_to_linux_error(le32_to_cpu(rx.status)); + + if (msg.data.out_response_len < sizeof(rx)) + return -EPROTO; + + return 0; +} + +static int mpxy_reg_enable(struct regulator_dev *rdev) +{ + struct rpmi_reg_domain *mpxy_reg =3D rdev_get_drvdata(rdev); + + /* + * An always-on domain cannot be switched and is already supplying, so + * enabling it is a no-op rather than an error. Failing here would also + * fail registration of any domain constrained as always-on. + */ + if (mpxy_reg->always_on) + return 0; + + return rpmi_reg_set_config(mpxy_reg, RPMI_VOLT_ENABLE); +} + +static int mpxy_reg_disable(struct regulator_dev *rdev) +{ + struct rpmi_reg_domain *mpxy_reg =3D rdev_get_drvdata(rdev); + + if (mpxy_reg->always_on) + return -EPERM; + + return rpmi_reg_set_config(mpxy_reg, RPMI_VOLT_DISABLE); +} + +static int mpxy_reg_is_enabled(struct regulator_dev *rdev) +{ + struct rpmi_reg_domain *mpxy_reg =3D rdev_get_drvdata(rdev); + struct rpmi_get_config_tx tx; + struct rpmi_get_config_rx rx =3D { }; + struct rpmi_mbox_message msg; + int ret; + + /* An always-on domain is supplying whatever its config reports. */ + if (mpxy_reg->always_on) + return 1; + + tx.domain_id =3D cpu_to_le32(mpxy_reg->id); + + rpmi_mbox_init_send_with_response(&msg, RPMI_VOLT_SRV_GET_CONFIG, + &tx, sizeof(tx), &rx, sizeof(rx)); + + ret =3D rpmi_mbox_send_message(mpxy_reg->rpmi_ctx->chan, &msg); + if (ret) + return ret; + + if (rx.status) + return rpmi_to_linux_error(le32_to_cpu(rx.status)); + + if (msg.data.out_response_len < sizeof(rx)) + return -EPROTO; + + return !!(le32_to_cpu(rx.config) & RPMI_VOLT_ENABLE); +} + +static int mpxy_reg_set_voltage_sel(struct regulator_dev *rdev, unsigned i= nt selector) +{ + struct rpmi_reg_domain *mpxy_reg =3D rdev_get_drvdata(rdev); + struct rpmi_set_level_tx tx; + struct rpmi_set_level_rx rx =3D { }; + struct rpmi_mbox_message msg; + s32 volt_uV; + int ret; + + volt_uV =3D mpxy_reg->desc.ops->list_voltage(rdev, selector); + if (volt_uV <=3D 0) + return -EINVAL; + + tx.domain_id =3D cpu_to_le32(mpxy_reg->id); + tx.level =3D cpu_to_le32(volt_uV); + + rpmi_mbox_init_send_with_response(&msg, RPMI_VOLT_SRV_SET_LEVEL, + &tx, sizeof(tx), &rx, sizeof(rx)); + + ret =3D rpmi_mbox_send_message(mpxy_reg->rpmi_ctx->chan, &msg); + if (ret) + return ret; + + if (rx.status) + return rpmi_to_linux_error(le32_to_cpu(rx.status)); + + if (msg.data.out_response_len < sizeof(rx)) + return -EPROTO; + + return 0; +} + +static int mpxy_reg_get_voltage_sel(struct regulator_dev *rdev) +{ + struct rpmi_reg_domain *mpxy_reg =3D rdev_get_drvdata(rdev); + struct rpmi_get_level_tx tx; + struct rpmi_get_level_rx rx =3D { }; + struct rpmi_mbox_message msg; + s32 volt_uV; + int ret; + + tx.domain_id =3D cpu_to_le32(mpxy_reg->id); + + rpmi_mbox_init_send_with_response(&msg, RPMI_VOLT_SRV_GET_LEVEL, + &tx, sizeof(tx), &rx, sizeof(rx)); + + ret =3D rpmi_mbox_send_message(mpxy_reg->rpmi_ctx->chan, &msg); + if (ret) + return ret; + + if (rx.status) + return rpmi_to_linux_error(le32_to_cpu(rx.status)); + + if (msg.data.out_response_len < sizeof(rx)) + return -EPROTO; + + volt_uV =3D le32_to_cpu(rx.level); + + return mpxy_reg->desc.ops->map_voltage(rdev, volt_uV, volt_uV); +} + +static const struct regulator_ops mpxy_reg_discrete_ops =3D { + .enable =3D mpxy_reg_enable, + .disable =3D mpxy_reg_disable, + .is_enabled =3D mpxy_reg_is_enabled, + .set_voltage_sel =3D mpxy_reg_set_voltage_sel, + .get_voltage_sel =3D mpxy_reg_get_voltage_sel, + .list_voltage =3D regulator_list_voltage_table, + .map_voltage =3D regulator_map_voltage_iterate, +}; + +static const struct regulator_ops mpxy_reg_multi_linear_ops =3D { + .enable =3D mpxy_reg_enable, + .disable =3D mpxy_reg_disable, + .is_enabled =3D mpxy_reg_is_enabled, + .set_voltage_sel =3D mpxy_reg_set_voltage_sel, + .get_voltage_sel =3D mpxy_reg_get_voltage_sel, + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, +}; + +static int rpmi_reg_setup(struct rpmi_reg_domain *mpxy_reg) +{ + struct regulation_constraints *constraints =3D &mpxy_reg->init_data.const= raints; + struct rpmi_reg_level_linear *linear_level; + struct linear_range *linear_ranges; + u32 i, linear_index, n_step, top; + u32 min_uV =3D U32_MAX, max_uV =3D 0; + + mpxy_reg->desc.name =3D devm_kasprintf(mpxy_reg->dev, GFP_KERNEL, "%s", m= pxy_reg->name); + if (!mpxy_reg->desc.name) + return -ENOMEM; + + mpxy_reg->desc.id =3D mpxy_reg->id; + mpxy_reg->desc.type =3D REGULATOR_VOLTAGE; + mpxy_reg->desc.owner =3D THIS_MODULE; + + switch (mpxy_reg->voltage_format) { + case REG_FORMAT_DISCRETE: + mpxy_reg->desc.n_voltages =3D mpxy_reg->num_levels; + mpxy_reg->desc.volt_table =3D (const unsigned int *)mpxy_reg->level; + mpxy_reg->desc.ops =3D &mpxy_reg_discrete_ops; + + for (i =3D 0; i < mpxy_reg->num_levels; i++) { + /* + * The specification lists discrete levels in strictly + * ascending order, and VOLT_SET_LEVEL carries a level + * as an int32, so one above that cannot be set at all. + */ + if (mpxy_reg->level[i] > INT_MAX || + (i && mpxy_reg->level[i] <=3D mpxy_reg->level[i - 1])) + return -EINVAL; + + min_uV =3D min(min_uV, mpxy_reg->level[i]); + max_uV =3D max(max_uV, mpxy_reg->level[i]); + } + break; + + case REG_FORMAT_LINEAR: + linear_level =3D (struct rpmi_reg_level_linear *)mpxy_reg->level; + + linear_ranges =3D devm_kcalloc(mpxy_reg->dev, mpxy_reg->num_levels, + sizeof(struct linear_range), GFP_KERNEL); + if (!linear_ranges) + return -ENOMEM; + + for (i =3D 0, linear_index =3D 0; i < mpxy_reg->num_levels; i++) { + /* + * The RPMI specification defines a linear range as + * having a constant step size, so a zero step is + * malformed and would divide by zero below. + */ + if (!linear_level[i].uvolt_step) + return -EINVAL; + + if (linear_level[i].uvolt_min > linear_level[i].uvolt_max || + linear_level[i].uvolt_max > INT_MAX || + (i && linear_level[i].uvolt_min <=3D linear_level[i - 1].uvolt_max)) + return -EINVAL; + + n_step =3D (linear_level[i].uvolt_max - linear_level[i].uvolt_min) / + linear_level[i].uvolt_step; + + linear_ranges[i].min =3D linear_level[i].uvolt_min; + linear_ranges[i].min_sel =3D linear_index; + linear_ranges[i].max_sel =3D linear_index + n_step; + linear_ranges[i].step =3D linear_level[i].uvolt_step; + + /* + * max_sel is inclusive, so a range spans n_step + 1 + * selectors and the next range starts past the end of + * this one. + */ + linear_index +=3D n_step + 1; + + /* + * Only levels that land on a step are selectable, so + * the top of the range is the last step at or below + * uvolt_max, not uvolt_max itself. + */ + top =3D linear_level[i].uvolt_min + n_step * linear_level[i].uvolt_step; + min_uV =3D min(min_uV, linear_level[i].uvolt_min); + max_uV =3D max(max_uV, top); + } + + /* + * A linear range only permits the levels that fall on its + * steps, so it is enumerated through selectors. Leaving + * continuous_voltage_range clear is what keeps the core from + * treating every voltage in between as selectable. + */ + mpxy_reg->desc.linear_ranges =3D linear_ranges; + mpxy_reg->desc.n_linear_ranges =3D mpxy_reg->num_levels; + mpxy_reg->desc.n_voltages =3D linear_index; + mpxy_reg->desc.ops =3D &mpxy_reg_multi_linear_ops; + + break; + } + + if (min_uV > max_uV) + return -EINVAL; + + /* + * Everything a regulator constraint would describe is already known: + * the levels come from VOLT_GET_SUPPORTED_LEVELS and the always-on + * capability from the VOLT_GET_ATTRIBUTES flags. Build the constraints + * from that rather than from a device tree node, which would only be a + * second copy of the same facts. Without them the core leaves + * REGULATOR_CHANGE_VOLTAGE clear and refuses every set_voltage(). + */ + constraints->name =3D mpxy_reg->desc.name; + constraints->min_uV =3D min_uV; + constraints->max_uV =3D max_uV; + constraints->always_on =3D mpxy_reg->always_on; + constraints->valid_ops_mask =3D REGULATOR_CHANGE_VOLTAGE; + constraints->settling_time =3D mpxy_reg->transition_latency; + if (!mpxy_reg->always_on) + constraints->valid_ops_mask |=3D REGULATOR_CHANGE_STATUS; + + return 0; +} + +static int rpmi_reg_attr_setup(struct device *dev, struct rpmi_ctx *mpxy_c= tx) +{ + struct rpmi_mbox_message msg; + int ret; + + /* Validate RPMI specification version */ + rpmi_mbox_init_get_attribute(&msg, RPMI_MBOX_ATTR_SPEC_VERSION); + ret =3D rpmi_mbox_send_message(mpxy_ctx->chan, &msg); + if (ret) { + dev_err(dev, "Failed to get spec version\n"); + return ret; + } + + if (msg.attr.value < RPMI_MKVER(1, 0)) { + dev_err(dev, + "msg protocol version mismatch, expected 0x%x, found 0x%x\n", + RPMI_MKVER(1, 0), msg.attr.value); + return -EINVAL; + } + + /* Validate voltage service group ID */ + rpmi_mbox_init_get_attribute(&msg, RPMI_MBOX_ATTR_SERVICEGROUP_ID); + ret =3D rpmi_mbox_send_message(mpxy_ctx->chan, &msg); + if (ret) { + dev_err(dev, "Failed to get service group ID\n"); + return ret; + } + + if (msg.attr.value !=3D RPMI_SRVGRP_VOLTAGE) { + dev_err(dev, + "service group match failed, expected 0x%x, found 0x%x\n", + RPMI_SRVGRP_VOLTAGE, msg.attr.value); + return -EINVAL; + } + + /* Validate voltage service group version */ + rpmi_mbox_init_get_attribute(&msg, RPMI_MBOX_ATTR_SERVICEGROUP_VERSION); + ret =3D rpmi_mbox_send_message(mpxy_ctx->chan, &msg); + if (ret) { + dev_err(dev, "Failed to get service group version\n"); + return ret; + } + + if (msg.attr.value < RPMI_MKVER(1, 0)) { + dev_err(dev, + "service group version failed, expected 0x%x, found 0x%x\n", + RPMI_MKVER(1, 0), msg.attr.value); + return -EINVAL; + } + + /* Get max message size */ + rpmi_mbox_init_get_attribute(&msg, RPMI_MBOX_ATTR_MAX_MSG_DATA_SIZE); + ret =3D rpmi_mbox_send_message(mpxy_ctx->chan, &msg); + if (ret) { + dev_err(dev, "Failed to get max message data size\n"); + return ret; + } + + if (msg.attr.value < sizeof(struct rpmi_get_supp_levels_rx) + + sizeof(struct rpmi_reg_level_linear)) { + dev_err(dev, "max message data size %u too small\n", + msg.attr.value); + return -EINVAL; + } + mpxy_ctx->max_msg_size =3D msg.attr.value; + + return 0; +} + +static void rpmi_reg_mbox_chan_release(void *data) +{ + mbox_free_channel((struct mbox_chan *)data); +} + +/* + * The child of the "regulators" container describing domain @id, if any. + * + * Children are tied to domains by "reg", the RPMI DOMAIN_ID, the way SCMI + * voltage domains are. The DOMAIN_ID is unique by definition; the name a + * domain reports is neither guaranteed unique nor stable, and is truncate= d to + * RPMI_REG_DOMAIN_NAME_LEN, so it cannot be relied on to find the child. + */ +static struct device_node *rpmi_reg_find_child(struct device_node *regulat= ors, + u32 id) +{ + u32 reg; + + for_each_available_child_of_node_scoped(regulators, child) { + if (!of_property_read_u32(child, "reg", ®) && reg =3D=3D id) + return of_node_get(child); + } + + return NULL; +} + +/* + * Fold a board level constraint from the device tree into the constraints + * built from what the domain reported. + * + * Each domain may have a child in the optional "regulators" container, the + * way SCMI voltage domains do. The child is what a consumer's "-sup= ply" + * points at, and it is also the one place a board can say what it permits= the + * rail to supply, which RPMI has no way to express. + * + * Unlike SCMI, a child that says nothing about voltage does not freeze the + * rail: whatever it leaves out is taken from the levels the domain advert= ised, + * so that describing a domain for its phandle does not mean restating its + * range. What it does give narrows that range, and a minimum equal to a + * maximum pins the rail to one voltage. + * + * The child is parsed here rather than through desc.of_match, because the + * core would then use the device tree constraints in place of the discove= red + * ones instead of on top of them. + */ +static int rpmi_reg_apply_dt(struct rpmi_reg_domain *mpxy_reg, + struct device_node *np) +{ + struct regulation_constraints *c =3D &mpxy_reg->init_data.constraints; + struct regulator_init_data *dt; + int min_uV =3D c->min_uV, max_uV =3D c->max_uV; + unsigned int settling_time =3D c->settling_time; + bool always_on =3D c->always_on; + + dt =3D of_get_regulator_init_data(mpxy_reg->dev, np, &mpxy_reg->desc); + if (!dt) + return -EINVAL; + + *c =3D dt->constraints; + + if (!c->name) + c->name =3D mpxy_reg->desc.name; + + /* + * A bound the child sets replaces the discovered one, so the child can + * only narrow the range if it stays inside it. The core clamps both to + * the selectable levels when the regulator is registered, and rejects + * a minimum above the maximum. + */ + if (dt->constraints.min_uV) + min_uV =3D dt->constraints.min_uV; + if (dt->constraints.max_uV) + max_uV =3D dt->constraints.max_uV; + c->min_uV =3D min_uV; + c->max_uV =3D max_uV; + + /* + * Bring the rail inside a range the device tree gave, even when it gave + * only one bound. The core only does that with both, and a discovered + * bound on its own never needs it. + */ + c->apply_uV =3D dt->constraints.min_uV || dt->constraints.max_uV; + + /* A domain the microcontroller keeps on stays on whatever the child says= . */ + c->always_on =3D always_on || dt->constraints.always_on; + + if (!c->ramp_delay && !c->settling_time && + !c->settling_time_up && !c->settling_time_down) + c->settling_time =3D settling_time; + + c->valid_ops_mask &=3D ~(REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STAT= US); + if (c->min_uV !=3D c->max_uV) + c->valid_ops_mask |=3D REGULATOR_CHANGE_VOLTAGE; + if (!c->always_on) + c->valid_ops_mask |=3D REGULATOR_CHANGE_STATUS; + + return 0; +} + +static struct rpmi_reg_provider *rpmi_reg_find_provider(struct device_node= *np) +{ + struct rpmi_reg_provider *provider; + + lockdep_assert_held(&rpmi_reg_providers_lock); + + list_for_each_entry(provider, &rpmi_reg_providers, node) { + if (dev_of_node(provider->dev) =3D=3D np) + return provider; + } + + return NULL; +} + +static void rpmi_reg_provider_remove(void *data) +{ + struct rpmi_reg_provider *provider =3D data; + + guard(mutex)(&rpmi_reg_providers_lock); + list_del(&provider->node); +} + +static void rpmi_reg_put_device(void *data) +{ + put_device(data); +} + +/** + * devm_rpmi_voltage_supply_alias - resolve a supply named by DOMAIN_ID + * @dev: consumer device + * @id: supply name, as listed in the consumer's "voltage-domain-names" + * + * A consumer may name an RPMI voltage domain by its DOMAIN_ID, + * + * voltage-domains =3D <&rpmi_voltage 7>; + * voltage-domain-names =3D "vdd"; + * + * instead of by a "-supply" phandle to a node describing the domain= . The + * regulator core only follows the latter, so this tells it where @id is: = once + * it returns, regulator_get(@dev, @id) reaches that domain, and so does e= very + * other lookup of @id for @dev, such as the one the OPP core makes. The + * mapping lasts until @dev is unbound. + * + * "voltage-domain-names" may be left out when "voltage-domains" has a sin= gle + * entry. + * + * Nothing orders the consumer's probe after the provider's, since the cor= e has + * no idea "voltage-domains" names a supplier, so the provider may not be = there + * yet. Resolve every supply before doing anything that cannot be repeated. + * + * Return: 0 on success, -EPROBE_DEFER until the provider has registered i= ts + * domains, or another negative error number. + */ +int devm_rpmi_voltage_supply_alias(struct device *dev, const char *id) +{ + struct device_node *np =3D dev_of_node(dev); + struct rpmi_reg_provider *provider; + struct rpmi_reg_domain *domain; + struct of_phandle_args args; + const char *src, *alias; + int index =3D 0, ret; + + if (!np || !id) + return -EINVAL; + + if (of_property_present(np, "voltage-domain-names")) { + index =3D of_property_match_string(np, "voltage-domain-names", id); + if (index < 0) + return index; + } else { + ret =3D of_count_phandle_with_args(np, "voltage-domains", + "#voltage-domain-cells"); + if (ret < 0) + return ret; + if (ret !=3D 1) + return -EINVAL; + } + + ret =3D of_parse_phandle_with_args(np, "voltage-domains", + "#voltage-domain-cells", index, &args); + if (ret) + return ret; + + if (args.args_count !=3D 1 || !of_device_is_available(args.np)) { + of_node_put(args.np); + return -ENODEV; + } + + guard(mutex)(&rpmi_reg_providers_lock); + + provider =3D rpmi_reg_find_provider(args.np); + of_node_put(args.np); + if (!provider) + return -EPROBE_DEFER; + + if (args.args[0] >=3D provider->num_domains) + return -EINVAL; + + /* A domain that failed to initialise has nothing to hand out. */ + domain =3D &provider->domains[args.args[0]]; + if (!domain->rdev) + return -ENODEV; + + /* + * The core keeps the names and the provider device by reference, so + * give them the lifetime of the mapping: the caller's @id may be on its + * stack, and the provider may unbind first. + */ + src =3D devm_kstrdup_const(dev, id, GFP_KERNEL); + alias =3D devm_kstrdup(dev, domain->supply_name, GFP_KERNEL); + if (!src || !alias) + return -ENOMEM; + + get_device(provider->dev); + ret =3D devm_add_action_or_reset(dev, rpmi_reg_put_device, provider->dev); + if (ret) + return ret; + + return devm_regulator_register_supply_alias(dev, src, provider->dev, + alias); +} +EXPORT_SYMBOL_GPL(devm_rpmi_voltage_supply_alias); + +static int rpmi_reg_probe(struct platform_device *pdev) +{ + struct device_node *regulators __free(device_node) =3D NULL; + struct regulator_config config =3D {}; + struct rpmi_reg_provider *provider; + struct rpmi_reg_domain *rpmi_reg; + struct device *dev =3D &pdev->dev; + struct regulator_dev *rdev; + struct rpmi_ctx *mpxy_ctx; + u32 num_domains =3D 0; + u32 registered =3D 0; + int ret; + u32 i; + + mpxy_ctx =3D devm_kzalloc(&pdev->dev, sizeof(*mpxy_ctx), GFP_KERNEL); + if (!mpxy_ctx) + return -ENOMEM; + + /* Setup mailbox client */ + mpxy_ctx->client.dev =3D dev; + mpxy_ctx->client.rx_callback =3D NULL; + mpxy_ctx->client.tx_block =3D false; + mpxy_ctx->client.knows_txdone =3D true; + mpxy_ctx->client.tx_tout =3D 0; + + /* Request mailbox channel */ + mpxy_ctx->chan =3D mbox_request_channel(&mpxy_ctx->client, 0); + if (IS_ERR(mpxy_ctx->chan)) + return PTR_ERR(mpxy_ctx->chan); + + ret =3D devm_add_action_or_reset(dev, rpmi_reg_mbox_chan_release, + mpxy_ctx->chan); + if (ret) + return dev_err_probe(dev, ret, + "failed to add rpmi mbox channel cleanup\n"); + + ret =3D rpmi_reg_attr_setup(dev, mpxy_ctx); + if (ret) + return dev_err_probe(dev, ret, + "failed to verify RPMI attribute\n"); + + /* Get number of voltage domain */ + ret =3D rpmi_reg_get_num_domains(mpxy_ctx, &num_domains); + if (ret) + return dev_err_probe(dev, ret, + "failed to get number of voltage domains\n"); + + if (!num_domains) + return dev_err_probe(dev, -EINVAL, "No voltage domains found!\n"); + + dev_dbg(dev, "%u MPXY voltage domains are found\n", num_domains); + + provider =3D devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); + if (!provider) + return -ENOMEM; + + rpmi_reg =3D devm_kcalloc(dev, num_domains, sizeof(*rpmi_reg), GFP_KERNEL= ); + if (!rpmi_reg) + return -ENOMEM; + + provider->dev =3D dev; + provider->domains =3D rpmi_reg; + provider->num_domains =3D num_domains; + + regulators =3D of_get_child_by_name(dev_of_node(dev), "regulators"); + + for (i =3D 0; i < num_domains; i++, rpmi_reg++) { + struct device_node *np __free(device_node) =3D NULL; + + rpmi_reg->rpmi_ctx =3D mpxy_ctx; + rpmi_reg->dev =3D dev; + rpmi_reg->id =3D i; + + ret =3D rpmi_reg_get_attrs(rpmi_reg); + if (ret) { + dev_warn(rpmi_reg->dev, + "voltage domain %d initialization failed\n", + rpmi_reg->id); + continue; + } + + ret =3D rpmi_reg_get_supported_levels(rpmi_reg); + if (ret) { + dev_warn(rpmi_reg->dev, + "voltage domain %d initialization failed\n", + rpmi_reg->id); + continue; + } + + ret =3D rpmi_reg_setup(rpmi_reg); + if (ret) { + dev_warn(rpmi_reg->dev, + "voltage domain %d initialization failed\n", + rpmi_reg->id); + continue; + } + + if (regulators) + np =3D rpmi_reg_find_child(regulators, rpmi_reg->id); + + if (np) { + ret =3D rpmi_reg_apply_dt(rpmi_reg, np); + if (ret) { + dev_warn(dev, "voltage domain %s: bad constraints in %pOF\n", + rpmi_reg->desc.name, np); + continue; + } + } + + config.dev =3D rpmi_reg->dev; + config.driver_data =3D rpmi_reg; + config.init_data =3D &rpmi_reg->init_data; + /* + * A domain without a child gets no node rather than sharing the + * provider's: of_find_regulator_by_node() would otherwise resolve + * a phandle to the provider to whichever domain registered first. + * Such a domain cannot be named by a "-supply", only through + * "voltage-domains". + */ + config.of_node =3D np; + + /* + * A name to look the domain up by without a node of its own, + * for a consumer that names it through "voltage-domains". It + * only has to be unique on this provider, which the DOMAIN_ID + * is and the name the domain reports is not. + */ + snprintf(rpmi_reg->supply_name, sizeof(rpmi_reg->supply_name), + "domain%u", rpmi_reg->id); + rpmi_reg->supply.dev_name =3D dev_name(dev); + rpmi_reg->supply.supply =3D rpmi_reg->supply_name; + rpmi_reg->init_data.consumer_supplies =3D &rpmi_reg->supply; + rpmi_reg->init_data.num_consumer_supplies =3D 1; + + rdev =3D devm_regulator_register(rpmi_reg->dev, &rpmi_reg->desc, &config= ); + if (IS_ERR(rdev)) { + dev_err(dev, "failed to register RPMI voltage domain %d: %pe\n", + i, rdev); + continue; + } + + rpmi_reg->rdev =3D rdev; + registered++; + } + + /* + * Only now can a consumer be pointed at a domain, and it is taken off + * the list again before any of them is unregistered. + */ + scoped_guard(mutex, &rpmi_reg_providers_lock) + list_add(&provider->node, &rpmi_reg_providers); + + ret =3D devm_add_action_or_reset(dev, rpmi_reg_provider_remove, provider); + if (ret) + return ret; + + /* + * One line for the lot. A domain that did not make it has already said + * so above, so naming each one that did only buys a count. + */ + dev_info(dev, "%u MPXY voltage domains registered\n", registered); + + return 0; +} + +static const struct of_device_id rpmi_reg_of_match[] =3D { + { .compatible =3D "riscv,rpmi-voltage" }, + { }, +}; + +MODULE_DEVICE_TABLE(of, rpmi_reg_of_match); + +static struct platform_driver rpmi_reg_platdrv =3D { + .driver =3D { + .name =3D "riscv-rpmi-regulator", + .of_match_table =3D rpmi_reg_of_match, + }, + .probe =3D rpmi_reg_probe, +}; + +module_platform_driver(rpmi_reg_platdrv); + +MODULE_AUTHOR("Joshua Yeong "); +MODULE_DESCRIPTION("Regulator Driver based on SBI MPXY extension"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/mailbox/riscv-rpmi-message.h b/include/linux/mai= lbox/riscv-rpmi-message.h index d5362b5821f9..f96ba08a56bd 100644 --- a/include/linux/mailbox/riscv-rpmi-message.h +++ b/include/linux/mailbox/riscv-rpmi-message.h @@ -92,9 +92,23 @@ static inline int rpmi_to_linux_error(int rpmi_error) =20 /* RPMI service group IDs */ #define RPMI_SRVGRP_SYSTEM_MSI 0x00002 +#define RPMI_SRVGRP_VOLTAGE 0x00007 #define RPMI_SRVGRP_CLOCK 0x00008 #define RPMI_SRVGRP_DEVICE_POWER 0x00009 =20 +/* RPMI Voltage Service IDs */ +enum rpmi_voltage_service_id { + RPMI_VOLT_SRV_ENABLE_NOTIFICATION =3D 0x01, + RPMI_VOLT_SRV_GET_NUM_DOMAINS =3D 0x02, + RPMI_VOLT_SRV_GET_ATTRIBUTES =3D 0x03, + RPMI_VOLT_SRV_GET_SUPPORTED_LEVELS =3D 0x04, + RPMI_VOLT_SRV_SET_CONFIG =3D 0x05, + RPMI_VOLT_SRV_GET_CONFIG =3D 0x06, + RPMI_VOLT_SRV_SET_LEVEL =3D 0x07, + RPMI_VOLT_SRV_GET_LEVEL =3D 0x08, + RPMI_VOLT_SRV_ID_MAX_COUNT, +}; + /* RPMI clock service IDs */ enum rpmi_clock_service_id { RPMI_CLK_SRV_ENABLE_NOTIFICATION =3D 0x01, diff --git a/include/linux/regulator/riscv-rpmi-regulator.h b/include/linux= /regulator/riscv-rpmi-regulator.h new file mode 100644 index 000000000000..684d0c1d7760 --- /dev/null +++ b/include/linux/regulator/riscv-rpmi-regulator.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * RISC-V RPMI voltage service group consumer interface + * + * Copyright (C) 2026 Shanghai StarFive Technology Co., Ltd. + * + * The domains of an RPMI voltage provider are regulators, and a consumer + * normally names one the usual way, with a "-supply" phandle to the + * domain's node. A consumer may instead name a domain by its DOMAIN_ID, + * + * voltage-domains =3D <&rpmi_voltage 7>; + * voltage-domain-names =3D "vdd"; + * + * which needs no node for the domain but which the regulator core cannot + * follow on its own. devm_rpmi_voltage_supply_alias() resolves such a nam= e, + * after which the consumer uses the regulator API as it would for any oth= er + * supply. + */ + +#ifndef _LINUX_REGULATOR_RISCV_RPMI_REGULATOR_H_ +#define _LINUX_REGULATOR_RISCV_RPMI_REGULATOR_H_ + +#include + +struct device; + +#if IS_ENABLED(CONFIG_REGULATOR_RISCV_RPMI) + +int devm_rpmi_voltage_supply_alias(struct device *dev, const char *id); + +#else + +static inline int devm_rpmi_voltage_supply_alias(struct device *dev, + const char *id) +{ + return -ENODEV; +} + +#endif + +#endif /* _LINUX_REGULATOR_RISCV_RPMI_REGULATOR_H_ */ --=20 2.43.0 From nobody Thu Sep 24 15:11:01 2026 Received: from CHN02-BJS-obe.outbound.protection.partner.outlook.cn (mail-bjschn02on2126.outbound.protection.partner.outlook.cn [139.219.17.126]) (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 AE3335650F9; Tue, 22 Sep 2026 16:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=139.219.17.126 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790093581; cv=fail; b=Tda5Ghge5EBzdgOFf9i5PrITen05rkyZbMiddaWkIkzZjkoGslVb+DE18YYZlRBL8B5bHf3k1fdIv75GhuM9rUkLY0KZMhobtPhXidQjvYMBns4298+NRuPf+JLmF63CscmxN79pID+z6a/O+SZGY87iIPBtdLnHI67eQ0sC/cg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790093581; c=relaxed/simple; bh=nJHZ9zbIn1pDqDGnagqUfRKi2IRvnkNQE5yEDyi0guk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=KJD534h4+kGN/kpdQeA42kMUZHBIPXIx46aSyrz7oOGeuZ5gLtKF+vtirgLDtwM4NS1AJtmVlGI7sOUF9eSx6CTojfTh1AuYhcpYoOQag2L7htH+MCsS23iohLNfSteYdXojSK4g6xqgInCMswzbfxJXZsabzaGr9w85eADJ4WY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=starfivetech.com; spf=pass smtp.mailfrom=starfivetech.com; arc=fail smtp.client-ip=139.219.17.126 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HnUJ2avrfNmaeiDCXW+nTxieoq6PtpDJ29wgPAjdJ1yLGDaTCzPrXhOY3SBIooaQCoGXJyfgAsL+1Ulg6Vb5ORW7EU9QTfiLKOlJjAT3RYc5j0xerakk7P0V/5PWyl6HvyPrJLg123Ak6pWGtBfpe9WF96wd4PB4EsnSlVPdvTYHpAQA1uqjT3y17Rw3K1ppp/9glIBstoWPRtl6mFk9NPsqgN56v7MC/zVO81D3LKvNCVIrZdlV9q/RFjJDUCP6ciiLd4roXjeMomKgHsF7u4l8IceIwNyYjps4zMig6kpQLa0f7mbBY3cPuGPRZZk4tDoyC8D0ivQgbOjXJl3FvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HkJB43+h8Shw0m05Tn6ENmaYcywLz+LinSkGo8w7zEc=; b=jGyAB7RFSGBbqG4MLJoO8P12fB5vsLoNVlZu1MksXzuhDn73Vc/bxFpZcKBHGgOPRgIB9dyi8OeHQkvZsgs3h4D2y/rkqLOnXudvdnM4gjAu43nqGtYO0ICa5oufFr8B+ol6x5Lkk0Fa+yicxq9VP94job4tteB1DOg9PQ+YQIJNAdBXl7Oag08V6zHyvIxRQypKPtHPYfgijnKoHaHw+uKbSxgRcmH3FFPrZ2H4wwxRaldwhpdcrm0kihz0McZTvOKTUYNeM5No70wVJIrvrG6OINjx3/Ddkfzr1Nvsk3mob3pF06KPWiX/uKwR+Co6HbAKnfMbS8Jkz6CSbcxthQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:20::14) by SH0PR01MB0492.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.428.16; Tue, 22 Sep 2026 16:12:50 +0000 Received: from SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn ([fe80::435e:52b5:c524:459c]) by SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn ([fe80::435e:52b5:c524:459c%3]) with mapi id 15.21.0428.015; Tue, 22 Sep 2026 16:12:50 +0000 From: Joshua Yeong To: broonie@kernel.org, lgirdwood@gmail.com, rahul@summations.net, anup@brainfault.org, lftan.linux@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: alex@ghiti.fr, joshua.yeong@starfivetech.com, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] MAINTAINERS: Add RISC-V RPMI voltage driver Date: Wed, 23 Sep 2026 00:11:54 +0800 Message-ID: <20260922161156.1088153-4-joshua.yeong@starfivetech.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260922161156.1088153-1-joshua.yeong@starfivetech.com> References: <20260922161156.1088153-1-joshua.yeong@starfivetech.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BJXPR01CA0066.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:12::33) To SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:20::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SH0PR01MB0841:EE_|SH0PR01MB0492:EE_ X-MS-Office365-Filtering-Correlation-Id: a71651bc-cbe3-4417-a041-08df18c45923 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|52116014|376014|7416014|1800799024|366016|10067099003|56012099006|6133799003|22082099003|18002099003|921020|38350700014; X-Microsoft-Antispam-Message-Info: Wkc+xv5yE1FDQRrVnaiq8/SHQf2BvlJv4PNLruuSBIdG7+zL7OQ4GUy6t8v5DxLwYXI5NTPpc1PD2ud+63w2U4bS6QTVaCVZTGyo0TSa24JGbbBRYVZHxWtKofM5I6FGTF8U/g5simV1oUK2hbH9XXBYUYd+nfyynS6GZyCIEH83+mMQN81kPAV4/aGaBbT84p82p6/5v589h0cVwp4q6cJcX+VEwZAM0yGu9xth4hSggoabFScAwsF5Hb4WvnRzTeCmCqLU+KENSNoW5C+bOeC5pCgtriaNG+VyFitjpNBx/jvsSfA6JOJ51BpBEmILDteG+BU2vIcMqtNE/coEAc3OxImMYW5qpasSJ9ZlO423msBVK/1qBidOyvhjppvXEQRRvpfABf2SirSpkCFm83miYAeQ0AhjJokaObuvONvPFzEOjPCG1kILYX4sHXvJlV2T7KkiZ55Yj77+1CI9hWCHWhnbq3psY+/AZh5y39cZnoIpw2wsABBae1Ka52Az18X8hvIA5uAeGaDcO8tusnPvi7tvjZu+wNW81BvBRkWbV6zd7lzj7iB/d9O3NDubpLcCBa2XXPp6M7rwuAq17A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(52116014)(376014)(7416014)(1800799024)(366016)(10067099003)(56012099006)(6133799003)(22082099003)(18002099003)(921020)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dGbbiLLjx+khbaFBIwZI1MYM+7dOakMndqhADfILxxRQ/XQqd/zgVJYpZvX2?= =?us-ascii?Q?h9gdcOrELEwVjw+rOSoE2YyA9ejhvZLtQJ1WhJ0AAs1GUimUoicisUZMtmSt?= =?us-ascii?Q?AaVeGTou+KE5D+Tn0qpd2AJsSep33xfwuDVvEVnw6wUBMHbzqXPATIbQii5H?= =?us-ascii?Q?OXqz7PPKqMlpwHmCMtI2ESvfKK8s1zOwujUNJEHGgxH66CWHoghMXGlj8HZI?= =?us-ascii?Q?JAVy32FJlz9Ryqe3nGNTV3QFo/e3eH3vq9gn+/rw9KFO9XxZNeTdCYqXTMhH?= =?us-ascii?Q?n5btgPSm2E5r1gW3VRBcQ5nYaNZq74URT1mq6jXmWupIVTfT8EjMAL1QB61S?= =?us-ascii?Q?1AQCPkNX2aOc8OSWHATxD1ffGzIOAo+a7qCd5mNDe8wWczvZH6soovucPXi5?= =?us-ascii?Q?0adQ6cz48CFzqKm+QR81DBwJgExcEtSF8+eN0mZLZTsH4uL3mWD9h6AYs84b?= =?us-ascii?Q?cBFJVzj5luWKz6ykSGPcqLq+Kj04X0VAhebN7sqrKbHE3ix7wTevSEPhN68d?= =?us-ascii?Q?BoaCcE4sN733XHFLPPTmJ+wSAdPo2LeW2HmiTpbp2ESGxZeK0ozqZwPJRcep?= =?us-ascii?Q?dKmouEjUJXwfJQXqm/wG7LPoB7HUiLAgez9bVyYbTUQ4+F76WQU5v+1cv2oU?= =?us-ascii?Q?ynBYzRoMQSMvlhACU4L7/s6ulRePdcbu8lWVOnYrtEGruD6sJODPvL5PSCTl?= =?us-ascii?Q?4q2bgi2D8s74zN+6ws5oqw1SfieQ+VbNC0r9vMWqcmpq490KdhXXpzBQVurn?= =?us-ascii?Q?Go0QjaLkKC2/PkFY3ZLE1dSF0GJGlbn1OxH06fwzLuPJzKJkYRzd7LPD35wI?= =?us-ascii?Q?x9NPCJIoJC71Of7JBixY1yTJn4OEzNuuIFH9XGajZ/QXEcmQqw7kEwviNeTr?= =?us-ascii?Q?LwsyeoRC8yOsDLQ13vGIjj3sgk8r0pCMw03ZeiF4qMvKvUx1G9yqjz245KSj?= =?us-ascii?Q?AFN9tiaXWTknusu1EnbDamPT5oRyUr7dQhlwkhwYCr6cEhkcSAS/Eyihl4jy?= =?us-ascii?Q?DK5BrqgpkYfrcjU5JLd6t18Gakey4m4XmRzpy3N+h3Ozu80AEq22JyyNZCMh?= =?us-ascii?Q?SCCQRIso4N8vfiO3KsefESOVwAYx+OTzHg73fPPzJWloDaB/mW6gxdpyDbps?= =?us-ascii?Q?6zEcK8KmQOWHwzpy6ZpegmL9nm2yiQiCFdmtOJ0Z+AE0pcJfR1E4QZOQqUQe?= =?us-ascii?Q?Vg92rznxkds4LTqUK3Fgtaq/MTPWaCZlk101jHuZ1XwHgvlGLb2zSCLvLxFg?= =?us-ascii?Q?SHaOQ1mGv3ei7ioFgcBtB/oodFyVY8BgHcG/6ufxeyHUGTkt60YGmrHp38VR?= =?us-ascii?Q?uUJh8mVDsVHeXGYllcoyXvQ3kOutVxybiJ64hxVZ09t4dqrm+Bb/X2fSmbJQ?= =?us-ascii?Q?l0rcjqomtLUdOFsNhnrqkDzrrZbGcEfmAFLwAUbKc4BLTr3ExUkOwhEOY5Xi?= =?us-ascii?Q?Xm71a023N5jGw1I10PacASl4QW+IUU0uF7PJfFwu1jcI3bg4oVikmp9dEP+p?= =?us-ascii?Q?jY9GgzY/AoSZLqSXfVZYTA2yftg0+07QOm+rlEJnPWCnY0sfJYui/1CTNJDR?= =?us-ascii?Q?XuX8t5WWfVFghcU24a0c6abf6lmwdSlBT8Jxe+v6AYsffbhuf5vlQpcpdu5Z?= =?us-ascii?Q?B87Ppd8gI0c2yqzoLrx1iQSuNL3oAgCAn2bx90WuMpT3jXUJ8DA67BAz1G1e?= =?us-ascii?Q?0yZaoJFNypaDx6d2G3MFKOVjcvfuX2C9vJG81tVpWDdU1lOWxzZODwVCsV6H?= =?us-ascii?Q?LDJvRx3uWGf55sGpD/swJ6MHJUdq2/8=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: a71651bc-cbe3-4417-a041-08df18c45923 X-MS-Exchange-CrossTenant-AuthSource: SH0PR01MB0841.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2026 16:12:50.1083 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BxPLJH0SI6DyqgraTii8k9ucTlkdSOFByyOdQkLmuvA0ZENO676xsjfdDybEEevWXJxk5HxmNi7trrhnRynCVqdPfgtGUhoQd5D+mnheCME= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SH0PR01MB0492 Content-Type: text/plain; charset="utf-8" Add the RPMI voltage driver and its bindings to the RPMI device power entry, renamed to cover both, rather than extending the existing RISC-V RPMI and MPXY drivers entry, which covers drivers maintained by others. Signed-off-by: Joshua Yeong --- MAINTAINERS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 4716da916aa1..cd13d6172655 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23308,13 +23308,17 @@ F: drivers/irqchip/irq-riscv-rpmi-sysmsi.c F: drivers/mailbox/riscv-sbi-mpxy-mbox.c F: include/linux/mailbox/riscv-rpmi-message.h =20 -RISC-V RPMI DEVICE POWER DRIVER +RISC-V RPMI DEVICE POWER AND VOLTAGE DRIVERS M: Joshua Yeong L: linux-riscv@lists.infradead.org S: Maintained F: Documentation/devicetree/bindings/power/riscv,rpmi-device-power.yaml F: Documentation/devicetree/bindings/power/riscv,rpmi-mpxy-device-power.ya= ml +F: Documentation/devicetree/bindings/regulator/riscv,rpmi-mpxy-voltage.yaml +F: Documentation/devicetree/bindings/regulator/riscv,rpmi-voltage.yaml F: drivers/pmdomain/riscv/ +F: drivers/regulator/riscv-rpmi-regulator.c +F: include/linux/regulator/riscv-rpmi-regulator.h =20 RISC-V SPACEMIT SoC Support M: Yixun Lan --=20 2.43.0