From nobody Sat Sep 26 10:01:18 2026 Received: from mta0.migadu.com (out-1.mta0.migadu.com [91.218.175.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0FA8463B91 for ; Wed, 2 Sep 2026 11:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347026; cv=none; b=F3V6LfqHAfQtgT6JgatIrTasQI/aEfmj68YPQSCaYXXRpJ5phuY0JXwoHOfVJEFUO8kMGpNJ90fCA3ptPVV8WjyR/QiGrPPVIeFhq/TQ/WZo66FAQhliop1PMBXTHnzWW8K3j/vIQHNDY0fKrYx1KzxWcJcFSH02HbKGFLKDGuk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347026; c=relaxed/simple; bh=fGZT7zNeGmflVJxOVQMCTUZjEBSrvoWj/XRw3c0yCrw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gMRdpk6aNwLMZrjGANV5sd6oliHLwiEamm1wQmpoQ7GVNGUDgWB63loYWOreZuQFQHJX/hyz7DCnv+gOZ/s6j7CLP27STdgQ/LgH/g7czb8Kup2rBn09LI2AUNNfyWYwDoUcLE1JMpxwHyMGlxdIY2hNMY18xSHyAKE9+NSU0kM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=kK7ukstL; arc=none smtp.client-ip=91.218.175.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="kK7ukstL" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=fGZT7zNeGmflVJxOVQMCTUZjEBSrvoWj/XRw3c0yCrw=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347020; v=1; x=1788951820; b=kK7ukstLN0ADSdHwHB0YWJtzTymUX7YZaibG2PM56oCp2W3456Cz5NXQmOIZzYEHuXkea4Uf YRX8gIiiPU6OWBYjAQOJqvPFqdE2AKauXNoKFaTpSj/KWaEFJ2nyqwAHVuMezJjX6DOdpHw6E7N 1cTSFZ/ZrQYW8rK47bUfzHng= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta12.migadu.com with ESMTPS id 848de4a5cb6d0df7; Wed, 02 Sep 2026 11:03:40 +0000 X-Mizu-Trace-ID: 848de4a5cb6d0df7 X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:03:35 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 01/10] dt-bindings: mfd: common ROHM PMIC properties Message-ID: Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LIWGryBFmZ4MVgCn" Content-Disposition: inline In-Reply-To: --LIWGryBFmZ4MVgCn Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen ROHM PMICs keep having similar functionalities from one generation to the next. Keeping the device-trees describing these functionalities similar helps users because: 1. They can re-use existing device-tree properties when switching from one project, using a ROHM PMIC, to next project using newer variant. 2. The users can find and re-use examples from old projects - even if they never worked with ROHM PMICs before. Similarly, introducing new and different properties for same functionality previous variant had, will be adding confusion. Sometimes the existing properties aren't 100% what reviewers would prefer. When issues are minor or just cosmetic, changing the existing properties is not feasible. Reviewers can't be expected to know which properties are new, and which are existing - and this can lead to unnecessary review discussion wasting time and energy from everyone. Adding a common file for re-used ROHM PMIC properties should make it clearly visible that a property is re-used, when a new PMIC binding refers to this file instead of (re-)describing all the existing bindings. This will also help keeping the common properties identical across the variants. Add new file listing commonly used ROHM PMIC properties. Signed-off-by: Matti Vaittinen Reviewed-by: Rob Herring (Arm) Reviewed-by: Linus Walleij --- Revision history: v3: - No changes v2: - New patch --- .../bindings/mfd/rohm,pmic-pins.yaml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/rohm,pmic-pins.ya= ml diff --git a/Documentation/devicetree/bindings/mfd/rohm,pmic-pins.yaml b/Do= cumentation/devicetree/bindings/mfd/rohm,pmic-pins.yaml new file mode 100644 index 000000000000..0d1082804f5a --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/rohm,pmic-pins.yaml @@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/rohm,pmic-pins.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ROHM PMICs' OTP configured pin descriptions + +maintainers: + - Matti Vaittinen + +description: + Collection of properties which are commonly used to describe various + ROHM PMIC's pins. + +properties: + rohm,clkout-open-drain: + description: clk32kout mode. Set to 1 for "open-drain" or 0 for "cmos" + a.k.a "push-pull". + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 1 + + rohm,pin-clkout: + $ref: /schemas/types.yaml#/definitions/string + description: + The IC has different OTP options to use clkout-pin for different + purposes. Set this property to indicate the OTP variant. + + Many of the ROHM ICs have pins, which function can be defined in + OTP. Some of them provide no means to detect the pin configuration + at run-time, leaving software unaware of which features the IC + really has. These properties can be used to inform which pins + provide which functionality. IOW, these properties aren't used to + configure pin, they are used to tell what functionality pins on + this specific IC have. + + # Supported functionalities depend on the exact IC model. Following + # values are already defined: gpi, gpo. + # Please, re-use them when adding new ICs. + + rohm,pin-fault_b: + $ref: /schemas/types.yaml#/definitions/string + description: + The IC has different OTP options to use fault_b-pin for different + purposes. Set this property to indicate the OTP variant. + + # Supported functionalities depend on the exact IC model. Following + # values are already defined: gpi, gpo, faultb, readyind, pwrseq. + # Please, re-use them when adding new ICs. + +patternProperties: + "^rohm,pin-dvs[0-1]$": + $ref: /schemas/types.yaml#/definitions/string + description: + The IC has different OTP options to use dvs-pins for different + purposes. Set this property to indicate the OTP variant. + # Supported functionalities depend on the exact IC model. Following + # values are already defined: dvs-input, gpi, gpo, pwrseq. + # Please, re-use them when adding new ICs. + + "^rohm,pin-exten([0-1])?$": + $ref: /schemas/types.yaml#/definitions/string + description: + The IC has an OTP option to use exten -pin(s) for different purposes. + Set this property to indicate the OTP variant. + # Supported functionalities depend on the exact IC model. Following + # values are already defined: gpi, gpo, pwrseq. + # Please, re-use them when adding new ICs. + +# The schema is expected to be reference by IC schemas, which may introduce +# other properties that must be allowed. +additionalProperties: true --=20 2.55.0 --LIWGryBFmZ4MVgCn Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYAocACgkQeFA3/03a ocXNKQf7BCBsapKSYb0p4RgN8PZ5U+BoP7d5dpvO7ov6WTU6pQS1IkqJ5nKKyOrL XIwhMgl1DUjWpQZR9iukb/TOoBTD+gO0iMIcQixBUWbW7cstt/v5OnjkSmw32exR G0YybNBbSIfpb/7FZyOUP9l8wkGw1cozyo6IE9OlMgwwVikmtCbYmQTc1jY38IUr lk9hkBtz2Vyf5ML2pGzBjhGnYCzUTUj7j5ApVpyJeSn0VSseYdVJzRkoKZCM2QrC YGHn2Mw+9zJjbVPkX41a5aRR/47C/i3SKXCAEXU//n3hj8SA4HbJ4LskSafxa3LW xkj6MuuJobJyw5qsoftn5j/sTrbZcg== =CMo7 -----END PGP SIGNATURE----- --LIWGryBFmZ4MVgCn-- From nobody Sat Sep 26 10:01:18 2026 Received: from mta0.migadu.com (out-19.mta0.migadu.com [91.218.175.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E09B3463B91 for ; Wed, 2 Sep 2026 11:04:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347050; cv=none; b=WEsjrlQvfhbYiDLVkldBN99QdRV4z6VU64Ku64nwCaHIVEYuzW7MdzDvjPZ3XDUfwawDhu9M6hTxIZCqTre9+gV8eksf0fD+c27/vJTtdPQL9BGCRft5Xz+7k00kCCipoUkre5fXn+NSgliQmxiqeYNUna1N4mWMJRTIQfn9OaE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347050; c=relaxed/simple; bh=boIFzYTONzPjf+AA8M8c6ELFTdsgpE88c0fvNdrnXTM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b59eZlf4efQjlwZYKd2Z+QdQlfQM0T6IKSjYNrm+5yW3m27+4BARrs2YDdc3ytD/oPgja4VYdFMhWIApds/4P+GsgcYnJ5a08Ebl8QceqFh9ZZfErvKsMucl/IVkMJAyDatc3sY2kMqXDl7bf60gS6OFcw3/Q8Zbilrb925cLJY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=HMZvCZ5e; arc=none smtp.client-ip=91.218.175.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="HMZvCZ5e" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=boIFzYTONzPjf+AA8M8c6ELFTdsgpE88c0fvNdrnXTM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347045; v=1; x=1788951845; b=HMZvCZ5eEeU1lUVybsBVcRqPH1B7HD2NidZv1OwcsnAlvhP3THSDZMv/JiCIeCAmJl4Yicl4 GNkY4HaQ27zrh/jo8ASGLeiPdThVFafsYmO9iL8zecKx5/TDec+VeYSrap9g72dOrMNBLC82QtZ 9ygp/Q2WYJaHf/Hg0x7l50Qk= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta12.migadu.com with ESMTPS id 1656e6b9af72c2cb; Wed, 02 Sep 2026 11:04:05 +0000 X-Mizu-Trace-ID: 1656e6b9af72c2cb X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:04:00 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 02/10] dt-bindings: rohm,bd*: Ref common ROHM bindings Message-ID: <14c3341d84941e13a4b41420e115e016f377d662.1788346553.git.mazziesaccount@gmail.com> Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NafCu4dhMD20aIpu" Content-Disposition: inline In-Reply-To: --NafCu4dhMD20aIpu Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen The commonly used ROHM PMIC bindings were added into rohm,pmic-pins.yaml. Keeping commonly used properties in one file can ease both the maintaining the bindings and the reviewing process. Reference the common bindings from rohm,pmic-pins.yaml, instead of declaring them from the scratch for every PMIC using them. Keep the PMIC variant specific information (like supported pin functions) in PMIC the specific files, so unsupported values won't be allowed. Signed-off-by: Matti Vaittinen Reviewed-by: Rob Herring (Arm) Reviewed-by: Linus Walleij --- Revision history: v3: - No changes v2: - New patch --- .../bindings/mfd/rohm,bd71815-pmic.yaml | 9 +++--- .../bindings/mfd/rohm,bd71828-pmic.yaml | 9 +++--- .../bindings/mfd/rohm,bd72720-pmic.yaml | 29 +++---------------- 3 files changed, 12 insertions(+), 35 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml b= /Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml index 4fc78efaa550..0a67de054674 100644 --- a/Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml +++ b/Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml @@ -15,6 +15,9 @@ description: | for LED and a 500 mA single-cell linear charger. Also included is a Coul= omb counter, a real-time clock (RTC), and a 32.768 kHz clock gate and two GP= Os. =20 +allOf: + - $ref: rohm,pmic-pins.yaml# + properties: compatible: const: rohm,bd71815 @@ -44,11 +47,7 @@ properties: clock-output-names: const: bd71815-32k-out =20 - rohm,clkout-open-drain: - description: clk32kout mode. Set to 1 for "open-drain" or 0 for "cmos". - $ref: /schemas/types.yaml#/definitions/uint32 - minimum: 0 - maximum: 1 + rohm,clkout-open-drain: true =20 rohm,charger-sense-resistor-micro-ohms: minimum: 10000 diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd71828-pmic.yaml b= /Documentation/devicetree/bindings/mfd/rohm,bd71828-pmic.yaml index 09e7d68e92bf..e5043dec990d 100644 --- a/Documentation/devicetree/bindings/mfd/rohm,bd71828-pmic.yaml +++ b/Documentation/devicetree/bindings/mfd/rohm,bd71828-pmic.yaml @@ -15,6 +15,9 @@ description: | single-cell linear charger. Also included is a Coulomb counter, a real-t= ime clock (RTC), and a 32.768 kHz clock gate. =20 +allOf: + - $ref: rohm,pmic-pins.yaml# + properties: compatible: oneOf: @@ -49,11 +52,7 @@ properties: clock-output-names: const: bd71828-32k-out =20 - rohm,clkout-open-drain: - description: clk32kout mode. Set to 1 for "open-drain" or 0 for "cmos". - $ref: /schemas/types.yaml#/definitions/uint32 - minimum: 0 - maximum: 1 + rohm,clkout-open-drain: true =20 rohm,charger-sense-resistor-micro-ohms: minimum: 10000 diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd72720-pmic.yaml b= /Documentation/devicetree/bindings/mfd/rohm,bd72720-pmic.yaml index b094542339e8..52d0f6e4ef0f 100644 --- a/Documentation/devicetree/bindings/mfd/rohm,bd72720-pmic.yaml +++ b/Documentation/devicetree/bindings/mfd/rohm,bd72720-pmic.yaml @@ -15,6 +15,9 @@ description: and a 3000 mA switching charger. ICs also include a Coulomb counter, a real-time clock (RTC), GPIOs and a 32.768 kHz clock gate. =20 +allOf: + - $ref: rohm,pmic-pins.yaml# + # In addition to the properties found from the charger node, PMICs # use properties from a static battery node. Please see the: # Documentation/devicetree/bindings/power/supply/battery.yaml @@ -80,10 +83,7 @@ properties: clock-output-names: const: bd71828-32k-out =20 - rohm,clkout-open-drain: - description: clk32kout mode. Set to 1 for "open-drain" or 0 for "cmos". - $ref: /schemas/types.yaml#/definitions/uint32 - maximum: 1 + rohm,clkout-open-drain: true =20 rohm,charger-sense-resistor-micro-ohms: minimum: 10000 @@ -103,14 +103,6 @@ properties: $ref: /schemas/leds/rohm,bd71828-leds.yaml =20 rohm,pin-fault_b: - $ref: /schemas/types.yaml#/definitions/string - description: - PMIC has an OTP option to use fault_b-pin for different - purposes. Set this property accordingly. OTP options are - OTP0 - bi-directional FAULT_B or READY indicator depending on a - 'sub option' - OTP1 - GPO - OTP2 - Power sequencer output. enum: - faultb - readyind @@ -119,14 +111,6 @@ properties: =20 patternProperties: "^rohm,pin-dvs[0-1]$": - $ref: /schemas/types.yaml#/definitions/string - description: - PMIC has 4 different OTP options to determine the use of dvs-pins. - OTP0 - regulator RUN state control. - OTP1 - GPI. - OTP2 - GPO. - OTP3 - Power sequencer output. - This property specifies the use of the pin. enum: - dvs-input - gpi @@ -134,11 +118,6 @@ patternProperties: - pwrseq =20 "^rohm,pin-exten[0-1]$": - $ref: /schemas/types.yaml#/definitions/string - description: PMIC has an OTP option to use exten0-pin for different - purposes. Set this property accordingly. - OTP0 - GPO - OTP1 - Power sequencer output. enum: - gpo - pwrseq --=20 2.55.0 --NafCu4dhMD20aIpu Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYAqAACgkQeFA3/03a ocXAbQf/Qhh2rVBCFE5RSUkIKcIrGJuDA7vzUcILuYXekdV4WthPMndaoCU7iMji yUd8cxeWsL9j2v6LspHDsIdKjcAR+y6tnW/1uOSSjsTIL1w6e8LprJAmXfwkKcgq npON08qeC56A0+HGpfP37G9fmhj45cC9Z7EZ9t+2p/jcQOntm2NhLIm81OAPJeQy k/rOtBCkBaWDIABHf4tIyj6kq7Q+SXzED0HpWaONdwGLf6l45LJrUpLS3YobNK7O iapYdgvyPWi4oQMlgoOWOcu5Lc6Z9P2X6vJkJtV498jeXtPVcWCm9HtPCrMR170/ cKZX6c6aVPwJaLYt5j5HgVQKxl66gg== =T/Zy -----END PGP SIGNATURE----- --NafCu4dhMD20aIpu-- From nobody Sat Sep 26 10:01:18 2026 Received: from mta0.migadu.com (out-27.mta0.migadu.com [91.218.175.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7471947044A for ; Wed, 2 Sep 2026 11:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.27 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347065; cv=none; b=g2xTCCSLzJYSemT4ZP4+TJBaMy3yfUuNCTD0Thd9Zgna+lqPTheO0wnr8UPrBBbxaYZuWFULqYKTwFI0gfRo5M9STeSUgUNv0Cad1UpZVJg0ExQsUzTgTWeyDvV2NZmJQt2MWLpvHvkfEIGnIe3DlXXzR+Q/on5BcE6ZIjl+h1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347065; c=relaxed/simple; bh=mNzjoXbA5ma/7li2AYSLeMuio74ySSjVxw8OjFqvkhQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SpnuYXwRpuAIIuzMnBLife9+g4agNBIZirS98VC7u/5hU1xRO9dBcVmM9ahp+vG+7QAza2vDRoDzHv8yjEHued/u+Wg1c9E/zBWfiChIf9vfOwO6oOz/32iRQ/RMPi4kqo6/zn0gp8vIokRPI5orsJ5dCBK6xgAtlMCF+MM+KOg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=F9mPjNyu; arc=none smtp.client-ip=91.218.175.27 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="F9mPjNyu" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=mNzjoXbA5ma/7li2AYSLeMuio74ySSjVxw8OjFqvkhQ=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347060; v=1; x=1788951860; b=F9mPjNyu18FrAiNFrTp1fXr2L1/mNtsN52L4ClStpDBM6p6uXzJFy543Nrp42NK7A97dkpi8 89BKU3ZIwjWa32A/ZsP8gUVAvBw6ICnymigVn2A7YntpkHYLn+mERQ2nU7n9QO23B7/stdwCsAu Jh7UlJw3L4xTkQiH0DkwGqGY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta12.migadu.com with ESMTPS id 534f7718f5f0019a; Wed, 02 Sep 2026 11:04:20 +0000 X-Mizu-Trace-ID: 534f7718f5f0019a X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:04:15 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 03/10] dt-bindings: regulator: ROHM BD73800 regulators Message-ID: Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="x6SObUgyw3EOWLBl" Content-Disposition: inline In-Reply-To: --x6SObUgyw3EOWLBl Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen Add bindings for the BUCKs and LDOs on ROHM BD73800. The PMIC state specific voltages can be set in same fashion as with a few other ROHM PMICs (for example with BD718[15,28,37,47,50,79]). Same properties are recycled :) The LDOs 1 and 4 can use different voltage ranges depending on the OTP configuration. Signed-off-by: Matti Vaittinen Reviewed-by: Rob Herring (Arm) --- Revision history: v3: - No changes v1 =3D> v2: - Description of the state specific voltages moved to own file and referenced from it (because multiple PMIC bindings used them). The dt checker's documentation reference checker warns about the link to the MFD binding - which will be introduced in next commit. These commits have kind of a chicken and egg issue as MFD is referencing regulator properties introduced in this patch. I could squash these but IMO, this is clearer for the reviewers. AFAICS, Both MFD and regulator subsystems tend to be busy. I could also split adding the MFD comment reference to own patch which would be after the patch adding the MFD binding, but having own patch for just adding the comment is a bit meh. So, I decided to live with the broken doc-link between these two patches. --- .../regulator/rohm,bd73800-regulator.yaml | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/rohm,bd7380= 0-regulator.yaml diff --git a/Documentation/devicetree/bindings/regulator/rohm,bd73800-regul= ator.yaml b/Documentation/devicetree/bindings/regulator/rohm,bd73800-regula= tor.yaml new file mode 100644 index 000000000000..2db4585272c5 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/rohm,bd73800-regulator.ya= ml @@ -0,0 +1,99 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/rohm,bd73800-regulator.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ROHM BD73800 Power Management Integrated Circuit regulators + +maintainers: + - Matti Vaittinen + +description: | + This module is part of the ROHM BD73800 MFD device. For more details + see Documentation/devicetree/bindings/mfd/rohm,bd73800-pmic.yaml. + + The regulator controller is represented as a sub-node of the PMIC node + on the device tree. + + Regulator nodes should be named to buck and ldo. + The valid names for BD73800 regulator nodes are + buck1, buck2, buck3, buck4, buck5, buck6, buck7, buck8 + ldo1, ldo2, ldo3, ldo4 + +patternProperties: + "^buck[1-8]$": + type: object + description: + Properties for a single BUCK regulator. + allOf: + - $ref: regulator.yaml# + - $ref: rohm,pmic-states.yaml# + + properties: + regulator-name: + pattern: "^buck[1-8]$" + description: + should be "buck1", ..., "buck8" + + rohm,dvs-run-voltage: + minimum: 0 + maximum: 3500000 + + rohm,dvs-idle-voltage: + minimum: 0 + maximum: 3500000 + + rohm,dvs-suspend-voltage: + minimum: 0 + maximum: 3500000 + + # BUCKs 1,2,3,4 and 8 support voltages 0.5 - 1.3V + # BUCK 5 supports voltages 0.3 - 1.3V + # BUCKs 6 and 7 support voltages 1.5 - 3.5V + + required: + - regulator-name + + unevaluatedProperties: false + + "^ldo[1-4]$": + type: object + description: + Properties for single LDO regulator. + allOf: + - $ref: regulator.yaml# + - $ref: rohm,pmic-states.yaml# + + properties: + regulator-name: + pattern: "^ldo[1-4]$" + description: + should be "ldo1", ..., "ldo4" + + rohm,dvs-run-voltage: + minimum: 0 + maximum: 1 + + rohm,dvs-idle-voltage: + minimum: 0 + maximum: 1 + + rohm,dvs-suspend-voltage: + minimum: 0 + maximum: 1 + + rohm,ldo-range-high: + type: boolean + description: + LDO1 and LDO3 voltage ranges can be "high" or "low" depending on + OTP. Indicate that the "high" range is used. See comment below + for voltages. + + # LDOs 2 and 4 support voltages 0.75 - 3.3V + # LDOs 1 and 3 may support different ranges depending on OTP. + # either 0.6 - 1.8V or 0.75 - 3.3V. + + unevaluatedProperties: false + +additionalProperties: false --=20 2.55.0 --x6SObUgyw3EOWLBl Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYAq8ACgkQeFA3/03a ocW1TwgAnEvX9XY08LsxpPRBIyMMiJ6cJFUojWYQgONE3gFsR9xIee+FllPTVtsH BPg0JUJrtK47U2vdwyAhqMS5qBOteBmF7J2VnFAmxMQ5Mx+qfQ3kZGU/9K/MiiuD f456ylRb0pp0WxLlObw4dxWWmguS2FhlhR6kY0/MlxDULPaa5B24rwPJqIi5f3X2 drCR7nsnDwgqegcaq7uJk2OdvxLWULK5A8wtZV6Ulb8qEFIcs/K2MqGF9qF+4ggD 7px3jtQgIXkj2TJ1qwnOyGtkWcmjjtAxP0eH3yTZm4KSH90IVy4FXT5SRTfK+JMS UUnQa28MWeltdyjSM3/qg9y5s8p3WA== =KO5n -----END PGP SIGNATURE----- --x6SObUgyw3EOWLBl-- From nobody Sat Sep 26 10:01:18 2026 Received: from mta1.migadu.com (out-109.mta1.migadu.com [95.215.58.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 290B145C6E4 for ; Wed, 2 Sep 2026 11:04:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.109 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347084; cv=none; b=jJ2UGKovNWXsyJ1q8pBIs8zPR/PqPcEwGnbPkqxWC7Ea8jlbB++duzz/iYxTts6ce9Q6z+52WxTb6nZbf7/G/6MUR9610M/vYqspZJkdqk0jK5+lFaHLxDy9xA/AyhQoRyCN2SrtBmQohLWxuGzgAUbgTJKnqrd0HduFdE5xY8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347084; c=relaxed/simple; bh=fmI4DOuv9++hl02BcBWeRz5c2pa1UczaZyxWJbJ7/XM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bWGy49hR+GOloAj5E5mt9p4C2FdZfIy0kaM7XMQSmyGB4rAtZcyjDXtXiEualohJEf6/4tZTizIJgYIhowthTDzuidEcd9ZdtnZyoyUJzT66vr17P8BtX1CBfsi5D3VNyIud1hpWmlsiH90A28GKZtkRSLeLMFt01axQpvdZIc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ocu+AuKH; arc=none smtp.client-ip=95.215.58.109 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ocu+AuKH" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=fmI4DOuv9++hl02BcBWeRz5c2pa1UczaZyxWJbJ7/XM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347079; v=1; x=1788951879; b=ocu+AuKHsmu+luxgTCaPiFT5+MZkPdhYgvsxqwPZ9iqCPIQvizu0NdtCckQf+f0GaKCEWK8s JoKQAxWO20m5bQAw55qmRfUu9/jkSXh5oCdFT5HJYPsx+rMXpceeOx2zv4NOTBdpT6u00eFbIgM pJZTDLtS6N67jEQ6ZFg+FYaI= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id ff7c205f4979509a; Wed, 02 Sep 2026 11:04:39 +0000 X-Mizu-Trace-ID: ff7c205f4979509a X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:04:30 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 04/10] dt-bindings: mfd: ROHM BD73800 PMIC Message-ID: Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4bLmcPpxB6m05oMv" Content-Disposition: inline In-Reply-To: --4bLmcPpxB6m05oMv Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen The ROHM BD73800 is a power management IC which integrates 8 BUCKs and 4 LDOs. There is also an ADC and operation amplifier intended for current / temperature measurement and accumulation. RTC and 32.768 kHz clock gate are also included. The PMIC can be customized via OTP and it has options for operating as a main PMIC in multi-PMIC installation. Some of the pins can also be used for GPO or GPI (including interrupt support). There are also ROHM BD71851 and BD71885 PMICs out there. These are, from the SW-perspective, similar to the BD73800. There is only some different default values and OTP settings. The driver should be able to handle them just fine. Signed-off-by: Matti Vaittinen Reviewed-by: Rob Herring (Arm) --- Revision history: v3: - No changes v1 =3D> v2: - Reference commonly used ROHM bindings from a common binding file - Simplify compatible list - Move relevant comments to description so they can be shown in generated human-readable doc. - Allow other clock-output-names besides "bd73800-32k-out" --- .../bindings/mfd/rohm,bd73800-pmic.yaml | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd73800-pmic= .yaml diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd73800-pmic.yaml b= /Documentation/devicetree/bindings/mfd/rohm,bd73800-pmic.yaml new file mode 100644 index 000000000000..8371e7f2ab84 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/rohm,bd73800-pmic.yaml @@ -0,0 +1,218 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/rohm,bd73800-pmic.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ROHM BD73800 Power Management Integrated Circuit + +maintainers: + - Matti Vaittinen + +description: + BD73800GW is a single-chip power management IC for battery-powered + portable devices. It integrates 8 buck converters, 4 LDOs and a current + sense amplifier with ADC. Also included is a Real Time Clock (RTC) and a + 32.768 kHz clock gate. Depending on the OTP configuration the BD73800 + may also have interrupt controller and GPIOs. + + There are also different variants called BD71851 and BD71885 which are + almost identical from the software point of view. + +allOf: + - $ref: rohm,pmic-pins.yaml# + +properties: + compatible: + oneOf: + - const: rohm,bd73800 + + - items: + - enum: + - rohm,bd71851 + - rohm,bd71885 + - const: rohm,bd73800 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + # The GPIO1, CLKOUT (GPIO2), FAULT_B and EXTEN_OUT pins can be + # configured to interrupt pins by OTP. + interrupt-controller: true + + "#interrupt-cells": + const: 1 + description: + The IRQ number. 0 is GPIO1, 1 CLKOUT (GPIO2), 2 FAULT_B and 3 EXTEN_= OUT. + NOTE, A pin can operate as IRQ source only when the OTP + configuration for it has been set to GPI. + + gpio-controller: true + + "#gpio-cells": + const: 2 + + rohm,pin-gpio1: + $ref: /schemas/types.yaml#/definitions/string + description: + Indicate if the GPIO1 pin has been set to GPI or GPO at manufacturin= g. + The GPIO1, CLKOUT, FAULT_B and EXTEN_OUT pins may be configured for a + specific purpose (like ADC input, 32.768 clk output, fault indicator= or + delivering power sequence to a companion PMIC when multiple PMICs are + used) - but also to be either a GPO or GPI. (When used as a GPI the = pin + can also be used as an IRQ source). The pin purpose is determined by + OTP (One Time Programmable memory), typically during device + manufacturing. The OTP can't be read at runtime so device-tree should + describe the GPIO pins. + enum: [gpi, gpo] + + rohm,pin-clkout: + enum: [gpi, gpo] + + rohm,pin-fault_b: + enum: [gpi, gpo] + + rohm,pin-exten: + enum: [gpi, gpo] + + clocks: + description: + The CLKOUT pin may have its purpose overridden by OTP configuration.= It + is possible the BD73800 does not output a clock signal. Hence the clk + properties are optional. + maxItems: 1 + + "#clock-cells": + const: 0 + + clock-output-names: + maxItems: 1 + + rohm,clkout-open-drain: true + + regulators: + $ref: /schemas/regulator/rohm,bd73800-regulator.yaml + description: + List of child nodes that specify the regulators. + +required: + - compatible + - reg + - interrupts + - regulators + +additionalProperties: false + +examples: + - | + #include + #include + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + pmic: pmic@4b { + compatible =3D "rohm,bd73800"; + reg =3D <0x4b>; + + interrupt-parent =3D <&gpio1>; + interrupts =3D <29 IRQ_TYPE_LEVEL_LOW>; + + clocks =3D <&osc 0>; + #clock-cells =3D <0>; + clock-output-names =3D "bd73800-32k-out"; + + gpio-controller; + #gpio-cells =3D <2>; + + rohm,pin-gpio1 =3D "gpo"; + rohm,pin-exten =3D "gpi"; + + regulators { + buck1: buck1 { + regulator-name =3D "buck1"; + regulator-min-microvolt =3D <800000>; + regulator-max-microvolt =3D <2000000>; + regulator-always-on; + regulator-ramp-delay =3D <1250>; + rohm,dvs-run-voltage =3D <1150000>; + rohm,dvs-suspend-voltage =3D <950000>; + }; + buck2: buck2 { + regulator-name =3D "buck2"; + regulator-min-microvolt =3D <800000>; + regulator-max-microvolt =3D <2000000>; + regulator-always-on; + regulator-ramp-delay =3D <1250>; + rohm,dvs-run-voltage =3D <1150000>; + rohm,dvs-suspend-voltage =3D <950000>; + }; + buck3: buck3 { + regulator-name =3D "buck3"; + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <2700000>; + rohm,dvs-run-voltage =3D <1150000>; + rohm,dvs-idle-voltage =3D <1100000>; + rohm,dvs-suspend-voltage =3D <950000>; + regulator-always-on; + }; + buck4: buck4 { + regulator-name =3D "buck4"; + regulator-min-microvolt =3D <1100000>; + regulator-max-microvolt =3D <1850000>; + regulator-always-on; + }; + buck5: buck5 { + regulator-name =3D "buck5"; + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <3300000>; + regulator-always-on; + }; + buck6: buck6 { + regulator-name =3D "buck6"; + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <3300000>; + regulator-always-on; + }; + buck7: buck7 { + regulator-name =3D "buck7"; + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <3300000>; + regulator-always-on; + }; + buck8: buck8 { + regulator-name =3D "buck8"; + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + }; + ldo1: ldo1 { + regulator-name =3D "ldo1"; + rohm,ldo-range-high; + regulator-min-microvolt =3D <800000>; + regulator-max-microvolt =3D <3300000>; + regulator-always-on; + }; + ldo2: ldo2 { + regulator-name =3D "ldo2"; + regulator-min-microvolt =3D <800000>; + regulator-max-microvolt =3D <3300000>; + regulator-always-on; + }; + ldo3: ldo3 { + regulator-name =3D "ldo3"; + regulator-min-microvolt =3D <800000>; + regulator-max-microvolt =3D <3300000>; + regulator-always-on; + }; + ldo4: ldo4 { + regulator-name =3D "ldo4"; + regulator-min-microvolt =3D <650000>; + regulator-max-microvolt =3D <1750000>; + regulator-always-on; + }; + }; + }; + }; --=20 2.55.0 --4bLmcPpxB6m05oMv Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYAr4ACgkQeFA3/03a ocXs9Qf/RJmOo/uKfYyBt7PGL5qwR4BMsWDhQDZWnZl135xWK9IOHx58Bp347fi9 DHijPhTgXBiDYiD5R6r7NB3XyfN+FS8z6q69nxn5TBAg9+0rVRStcWkjzHb26ahy rSS6gQDao/hZxq+dqbiAorhCkVmgVg4+u6CnLVSlOXNgDNP1/qlLdQJh8UiXjw+D CBFvNPZ0hj/Zh4q+zliAgnVzt/LqjEqQ9Em1z2CqbJDVa9u3m/rcWlKVON/W4xKm c6qwNFNB+fS10EMHkijfQN25LFGxzEilnVNZAAgpgdRm3hPau4YpyrJTJsr5I6gt jd8sKm0lVrae0I+swQaUDudssvEHgg== =WgI8 -----END PGP SIGNATURE----- --4bLmcPpxB6m05oMv-- From nobody Sat Sep 26 10:01:18 2026 Received: from mta0.migadu.com (out-51.mta0.migadu.com [91.218.175.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEF2A470440 for ; Wed, 2 Sep 2026 11:05:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347107; cv=none; b=RFdPERqXCS6GBpLcMaabRucok3daKqeJW0m/4OH4VKEukXwlVzlWC6AGQ57CwWZQQilR2+KUoOA0do/6G5HdPQm+N+9lGXoYV91XXDIsffti8Rb9WLOmzSkH6AzlHeAWPYoi39+66/XA9OJv4YPhtWuGWbuBVr90Ixt6cq86SdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347107; c=relaxed/simple; bh=koU+W1IQMvxptp8N4suQFLzKTL1IGFulcSSj9cro7Kg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hke7PwaGOHXsaCo7WdaCcAOBXprLkVvVCLBcTShaFmD736wJybjDBBHd/MWTTUJE2B4eLQbuYG8GoRGP1vGzW2/ApJF4u7mOv6iGPbSw/G+r96/SSBAmm9B0gwNahUqj5Tf7h/bhckqNX/4Kob5bJFH6IYHCSEmV3yelS4gMFYg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=S2vbi1aw; arc=none smtp.client-ip=91.218.175.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="S2vbi1aw" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=koU+W1IQMvxptp8N4suQFLzKTL1IGFulcSSj9cro7Kg=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347101; v=1; x=1788951901; b=S2vbi1awTXWgOyXYNKMoWm2dqQDCZoO9zZQzgGhseUDckF8thHxXb+fMLU3IWQFII7D+ZamK EGWMHZqXrXtEKcpTTRAvG0nqmex/aHU4T4SZhlcaNDILzFnBCW4HXN9iIkmOTaqM0EZPnzSTXSP 33az3b4AHMZNY2BU7c7ndzBo= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta12.migadu.com with ESMTPS id 779074de3f4e75e8; Wed, 02 Sep 2026 11:05:00 +0000 X-Mizu-Trace-ID: 779074de3f4e75e8 X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:04:55 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 05/10] mfd: Support for ROHM BD73800 PMIC core Message-ID: Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jE1SHM7zvqDYiC9s" Content-Disposition: inline In-Reply-To: --jE1SHM7zvqDYiC9s Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen The BD73800 integrates regulators, ADC (intended for accumulating current / voltage / power values), a real-time clock (RTC), clock gate and GPIOs. Add core support for ROHM BD73800 Power Management IC. Signed-off-by: Matti Vaittinen Acked-by: Lee Jones Reviewed-by: Bartosz Golaszewski --- Revision history: v3: - Translated this: https://lore.kernel.org/all/20260813105955.GA1820248@google.com/ to an ack. Please, let me know if this isn't ok. v1 =3D> v2: - styling - update copyright years --- drivers/mfd/Kconfig | 15 +- drivers/mfd/rohm-bd71828.c | 147 ++++++++++++++- include/linux/mfd/rohm-bd73800.h | 307 +++++++++++++++++++++++++++++++ include/linux/mfd/rohm-generic.h | 1 + 4 files changed, 462 insertions(+), 8 deletions(-) create mode 100644 include/linux/mfd/rohm-bd73800.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index e4fd4572472f..439dbf5ee110 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -2226,7 +2226,7 @@ config MFD_ROHM_BD718XX and emergency shut down as well as 32,768KHz clock output. =20 config MFD_ROHM_BD71828 - tristate "ROHM BD718[15/28/79], BD72720 and BD73900 PMICs" + tristate "ROHM BD718[15/28/79], BD72720 and BD73[8/9]00 PMICs" depends on I2C=3Dy depends on OF select REGMAP_I2C @@ -2235,14 +2235,17 @@ config MFD_ROHM_BD71828 select MFD_ROHM_PWRBUTTON help Select this option to get support for the ROHM BD71815, BD71828, - BD71879, BD72720 and BD73900 Power Management ICs (PMICs). These are - single-chip Power Management ICs (PMIC), mainly for battery-powered - portable devices. + BD71879, BD72720, BD73800 and BD73900 Power Management ICs (PMICs). + These are single-chip Power Management ICs (PMIC), mainly for + battery-powered portable devices. The BD71815 has 5 bucks, 7 LDOs, and a boost for driving LEDs. The BD718[28/79] have 7 buck converters and 7 LDOs. The BD72720 and the BD73900 have 10 bucks and 11 LDOs. - All ICs provide a single-cell linear charger, a Coulomb counter, - a Real-Time Clock (RTC), GPIOs and a 32.768 kHz clock gate. + All the above ICs provide a single-cell linear charger, and a Coulomb + counter. + The BD73800 has 8 bucks, 4 LDOs and ADC for power/current + accumulation but no charging logic. All these PMICs integrate also a + Real-Time Clock (RTC), GPIOs and a 32.768 kHz clock gate. =20 config MFD_ROHM_BD957XMUF tristate "ROHM BD9576MUF and BD9573MUF Power Management ICs" diff --git a/drivers/mfd/rohm-bd71828.c b/drivers/mfd/rohm-bd71828.c index bf4df8e1b34c..46faef7058f8 100644 --- a/drivers/mfd/rohm-bd71828.c +++ b/drivers/mfd/rohm-bd71828.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (C) 2019 ROHM Semiconductors + * Copyright (C) 2019, 2026 ROHM Semiconductor * - * ROHM BD718[15/28/79] and BD72720 PMIC driver + * ROHM BD718[15/28/79], BD72720 and BD73[8/9]00 PMIC driver */ =20 #include @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -56,6 +57,12 @@ static const struct resource bd72720_rtc_irqs[] =3D { DEFINE_RES_IRQ_NAMED(BD72720_INT_RTC2, "bd70528-rtc-alm-2"), }; =20 +static const struct resource bd73800_rtc_irqs[] =3D { + DEFINE_RES_IRQ_NAMED(BD73800_INT_RTC0, "bd70528-rtc-alm-0"), + DEFINE_RES_IRQ_NAMED(BD73800_INT_RTC1, "bd70528-rtc-alm-1"), + DEFINE_RES_IRQ_NAMED(BD73800_INT_RTC2, "bd70528-rtc-alm-2"), +}; + static const struct resource bd71815_power_irqs[] =3D { DEFINE_RES_IRQ_NAMED(BD71815_INT_DCIN_RMV, "bd71815-dcin-rmv"), DEFINE_RES_IRQ_NAMED(BD71815_INT_CLPS_OUT, "bd71815-dcin-clps-out"), @@ -230,6 +237,17 @@ static const struct mfd_cell bd72720_mfd_cells[] =3D { /* Power button is registered separately */ }; =20 +static const struct mfd_cell bd73800_mfd_cells[] =3D { + { .name =3D "bd73800-pmic", }, + { .name =3D "bd73800-clk", }, + { .name =3D "bd73800-gpio", }, + { + .name =3D "bd73800-rtc", + .num_resources =3D ARRAY_SIZE(bd73800_rtc_irqs), + .resources =3D bd73800_rtc_irqs, + }, +}; + static const struct regmap_range bd71815_volatile_ranges[] =3D { regmap_reg_range(BD71815_REG_SEC, BD71815_REG_YEAR), regmap_reg_range(BD71815_REG_CONF, BD71815_REG_BAT_TEMP), @@ -339,6 +357,17 @@ static const struct regmap_range bd72720_volatile_rang= es_4c[] =3D { BD72720_UNWRAP_REG_RANGE(BD72720_REG_IMPCHK_CTRL, BD72720_REG_IMPCHK_CTRL= ), }; =20 +static const struct regmap_range bd73800_volatile_ranges[] =3D { + regmap_reg_range(BD73800_REG_POR_REASON, BD73800_REG_POW_STATE), + regmap_reg_range(BD73800_REG_PS_CTRL_1, BD73800_REG_PS_CTRL_2), + regmap_reg_range(BD73800_REG_RCVNUM, BD73800_REG_RCVNUM), + regmap_reg_range(BD73800_REG_RTC_SEC, BD73800_REG_RTC_YEAR), + regmap_reg_range(BD73800_REG_RTC_CONF, BD73800_REG_RTC_CONF), + regmap_reg_range(BD73800_REG_ADC_ACCUM_KICK, BD73800_REG_ADC_TEMP_VAL0), + regmap_reg_range(BD73800_REG_INT_MAIN_STAT, BD73800_REG_INT_5_STAT), + regmap_reg_range(BD73800_REG_INT_MAIN_SRC, BD73800_REG_INT_5_SRC), +}; + static const struct regmap_access_table bd71815_volatile_regs =3D { .yes_ranges =3D &bd71815_volatile_ranges[0], .n_yes_ranges =3D ARRAY_SIZE(bd71815_volatile_ranges), @@ -364,6 +393,24 @@ static const struct regmap_access_table bd72720_volati= le_regs_4c =3D { .n_yes_ranges =3D ARRAY_SIZE(bd72720_volatile_ranges_4c), }; =20 +static const struct regmap_access_table bd73800_volatile_regs =3D { + .yes_ranges =3D bd73800_volatile_ranges, + .n_yes_ranges =3D ARRAY_SIZE(bd73800_volatile_ranges), +}; + +static const struct regmap_range bd73800_read_only_ranges[] =3D { + regmap_reg_range(BD73800_REG_PRODUCT_ID, BD73800_REG_NVMVERSION), + regmap_reg_range(BD73800_REG_POW_STATE, BD73800_REG_POW_STATE), + regmap_reg_range(BD73800_REG_ADC_ACCUM_CNT2, BD73800_REG_ADC_TEMP_VAL0), + regmap_reg_range(BD73800_REG_INT_MAIN_STAT, BD73800_REG_INT_MAIN_STAT), + regmap_reg_range(BD73800_REG_INT_MAIN_SRC, BD73800_REG_INT_5_SRC), +}; + +static const struct regmap_access_table bd73800_ro_regs =3D { + .no_ranges =3D bd73800_read_only_ranges, + .n_no_ranges =3D ARRAY_SIZE(bd73800_read_only_ranges), +}; + static const struct regmap_config bd71815_regmap =3D { .reg_bits =3D 8, .val_bits =3D 8, @@ -448,6 +495,15 @@ static const struct regmap_config bd72720_regmap_4c = =3D { .cache_type =3D REGCACHE_MAPLE, }; =20 +static const struct regmap_config bd73800_regmap =3D { + .reg_bits =3D 8, + .val_bits =3D 8, + .wr_table =3D &bd73800_ro_regs, + .volatile_table =3D &bd73800_volatile_regs, + .max_register =3D BD73800_MAX_REGISTER - 1, + .cache_type =3D REGCACHE_MAPLE, +}; + /* * Mapping of main IRQ register bits to sub-IRQ register offsets so that w= e can * access corect sub-IRQ registers based on bits that are set in main IRQ @@ -779,6 +835,60 @@ static int bd72720_set_type_config(unsigned int **buf,= unsigned int type, return regmap_irq_set_type_config_simple(buf, type, irq_data, idx, irq_dr= v_data); } =20 +static const struct regmap_irq bd73800_irqs[] =3D { + /* INT_STAT_1 register IRQs, ADC and RTC */ + REGMAP_IRQ_REG(BD73800_INT_ADC_ACCUM_DONE, 0, BD73800_INT_ADC_ACCUM_DONE_= MASK), + REGMAP_IRQ_REG(BD73800_INT_ADC_ACCUM_OVF, 0, BD73800_INT_ADC_ACCUM_OVF_MA= SK), + REGMAP_IRQ_REG(BD73800_INT_ADC_ACCUM_VAL, 0, BD73800_INT_ADC_ACCUM_VAL_MA= SK), + REGMAP_IRQ_REG(BD73800_INT_ADC_ACCUM_TW, 0, BD73800_INT_ADC_ACCUM_TW_MASK= ), + REGMAP_IRQ_REG(BD73800_INT_ADC_POW_VAL, 0, BD73800_INT_ADC_POW_VAL_MASK), + REGMAP_IRQ_REG(BD73800_INT_RTC0, 0, BD73800_INT_RTC0_MASK), + REGMAP_IRQ_REG(BD73800_INT_RTC1, 0, BD73800_INT_RTC1_MASK), + REGMAP_IRQ_REG(BD73800_INT_RTC2, 0, BD73800_INT_RTC2_MASK), + + /* BUCK reg interrupts */ + /* INT_STAT_2 IRQs */ + REGMAP_IRQ_REG(BD73800_INT_BUCK1_DVS_DONE, 1, BD73800_INT_BUCK1_DVS_DONE_= MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK2_DVS_DONE, 1, BD73800_INT_BUCK2_DVS_DONE_= MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK3_DVS_DONE, 1, BD73800_INT_BUCK3_DVS_DONE_= MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK4_DVS_DONE, 1, BD73800_INT_BUCK4_DVS_DONE_= MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK5_DVS_DONE, 1, BD73800_INT_BUCK5_DVS_DONE_= MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK6_DVS_DONE, 1, BD73800_INT_BUCK6_DVS_DONE_= MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK7_DVS_DONE, 1, BD73800_INT_BUCK7_DVS_DONE_= MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK8_DVS_DONE, 1, BD73800_INT_BUCK8_DVS_DONE_= MASK), + /* INT_STAT_3 IRQs */ + REGMAP_IRQ_REG(BD73800_INT_BUCK1_OCP, 2, BD73800_INT_BUCK1_OCP_MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK2_OCP, 2, BD73800_INT_BUCK2_OCP_MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK3_OCP, 2, BD73800_INT_BUCK3_OCP_MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK4_OCP, 2, BD73800_INT_BUCK4_OCP_MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK5_OCP, 2, BD73800_INT_BUCK5_OCP_MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK6_OCP, 2, BD73800_INT_BUCK6_OCP_MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK7_OCP, 2, BD73800_INT_BUCK7_OCP_MASK), + REGMAP_IRQ_REG(BD73800_INT_BUCK8_OCP, 2, BD73800_INT_BUCK8_OCP_MASK), + + /* INT_STAT_4 IRQs, power-button, WDG and reset */ + REGMAP_IRQ_REG(BD73800_INT_PBTN_LONG_PRESS, 3, BD73800_INT_PBTN_LONG_PRES= S_MASK), + REGMAP_IRQ_REG(BD73800_INT_PBTN_MID_PRESS, 3, BD73800_INT_PBTN_MID_PRESS_= MASK), + /* + * The SHORT_PUSH is generated when button is first pressed (longer + * than configured time limit), and then released before the MID_PRESS + * time limit. The SHORT_PRESS is generated immediately when button is + * pressed for longer than configured limit, whether it is released or + * not. + */ + REGMAP_IRQ_REG(BD73800_INT_PBTN_SHORT_PUSH, 3, BD73800_INT_PBTN_SHORT_PUS= H_MASK), + REGMAP_IRQ_REG(BD73800_INT_PBTN_SHORT_PRESS, 3, BD73800_INT_PBTN_SHORT_PR= ESS_MASK), + REGMAP_IRQ_REG(BD73800_INT_WDG, 3, BD73800_INT_WDG_MASK), + REGMAP_IRQ_REG(BD73800_INT_SWRESET, 3, BD73800_INT_SWRESET_MASK), + REGMAP_IRQ_REG(BD73800_INT_SEQ_DONE, 3, BD73800_INT_SEQ_DONE_MASK), + + /* INT_STAT_5 IRQs, GPIO */ + REGMAP_IRQ_REG(BD73800_INT_GPIO1, 4, BD73800_INT_GPIO1_MASK), + REGMAP_IRQ_REG(BD73800_INT_GPIO2, 4, BD73800_INT_GPIO2_MASK), + REGMAP_IRQ_REG(BD73800_INT_GPIO3, 4, BD73800_INT_GPIO3_MASK), + REGMAP_IRQ_REG(BD73800_INT_GPIO4, 4, BD73800_INT_GPIO4_MASK), +}; + static const struct regmap_irq_chip bd71828_irq_chip =3D { .name =3D "bd71828_irq", .main_status =3D BD71828_REG_INT_MAIN, @@ -833,6 +943,25 @@ static const struct regmap_irq_chip bd72720_irq_chip = =3D { .irq_reg_stride =3D 1, }; =20 +static const struct regmap_irq_chip bd73800_irq_chip =3D { + .name =3D "bd73800_irq", + .main_status =3D BD73800_REG_INT_MAIN_STAT, + .irqs =3D bd73800_irqs, + .num_irqs =3D ARRAY_SIZE(bd73800_irqs), + .status_base =3D BD73800_REG_INT_1_STAT, + .unmask_base =3D BD73800_REG_INT_1_EN, + .ack_base =3D BD73800_REG_INT_1_STAT, + .init_ack_masked =3D true, + .num_regs =3D 5, + .num_main_regs =3D 1, + /* + * Ignore mirrored bits [7:5]. They are handled as part of normal INT_4 + * handling. + */ + .num_main_status_bits =3D 5, + .irq_reg_stride =3D 1, +}; + static int set_clk_mode(struct device *dev, struct regmap *regmap, int clkmode_reg) { @@ -971,6 +1100,17 @@ static int bd71828_i2c_probe(struct i2c_client *i2c) main_lvl_val =3D BD72720_MASK_LVL1_EN_ALL; break; } + case ROHM_CHIP_TYPE_BD73800: + mfd =3D bd73800_mfd_cells; + cells =3D ARRAY_SIZE(bd73800_mfd_cells); + regmap_config =3D &bd73800_regmap; + irqchip =3D &bd73800_irq_chip; + clkmode_reg =3D BD73800_REG_OUT32K; + button_irq =3D BD73800_INT_PBTN_SHORT_PUSH; + main_lvl_mask_reg =3D BD73800_REG_INT_MAIN_EN; + main_lvl_val =3D BD73800_INT_MAIN_EN_ALL; + break; + default: dev_err(&i2c->dev, "Unknown device type"); return -EINVAL; @@ -1051,6 +1191,9 @@ static const struct of_device_id bd71828_of_match[] = =3D { }, { .compatible =3D "rohm,bd72720", .data =3D (void *)ROHM_CHIP_TYPE_BD72720, + }, { + .compatible =3D "rohm,bd73800", + .data =3D (void *)ROHM_CHIP_TYPE_BD73800, }, { }, }; diff --git a/include/linux/mfd/rohm-bd73800.h b/include/linux/mfd/rohm-bd73= 800.h new file mode 100644 index 000000000000..107cc9a5a2be --- /dev/null +++ b/include/linux/mfd/rohm-bd73800.h @@ -0,0 +1,307 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright 2026 ROHM Semiconductors. + * + * Author: Matti Vaittinen + */ + +#ifndef _MFD_BD73800_H +#define _MFD_BD73800_H + +#include + +enum { + BD73800_BUCK1 =3D 0, + BD73800_BUCK2, + BD73800_BUCK3, + BD73800_BUCK4, + BD73800_BUCK5, + BD73800_BUCK6, + BD73800_BUCK7, + BD73800_BUCK8, + BD73800_LDO1, + BD73800_LDO2, + BD73800_LDO3, + BD73800_LDO4, +}; + +/* + * All regulators except BUCK 5 have full 8-bit register of valid voltage + * values, including 0. + */ +#define BD73800_NUM_VOLTS (0xff + 1) +/* + * BUCK 5 has two sets of voltage ranges, both having valid voltage select= ors + * from 0x0 to 0x7f + */ +#define BD73800_BUCK5_VOLTS (0x80 + 0x80) + +/* BD73800 interrupts */ +enum { + /* INT_STAT_1 register IRQs, ADC and RTC */ + BD73800_INT_ADC_ACCUM_DONE, + BD73800_INT_ADC_ACCUM_OVF, + BD73800_INT_ADC_ACCUM_VAL, + BD73800_INT_ADC_ACCUM_TW, + BD73800_INT_ADC_POW_VAL, + BD73800_INT_RTC0, + BD73800_INT_RTC1, + BD73800_INT_RTC2, + + /* BUCK reg interrupts */ + /* INT_STAT_2 IRQs */ + BD73800_INT_BUCK1_DVS_DONE, + BD73800_INT_BUCK2_DVS_DONE, + BD73800_INT_BUCK3_DVS_DONE, + BD73800_INT_BUCK4_DVS_DONE, + BD73800_INT_BUCK5_DVS_DONE, + BD73800_INT_BUCK6_DVS_DONE, + BD73800_INT_BUCK7_DVS_DONE, + BD73800_INT_BUCK8_DVS_DONE, + /* INT_STAT_3 IRQs */ + BD73800_INT_BUCK1_OCP, + BD73800_INT_BUCK2_OCP, + BD73800_INT_BUCK3_OCP, + BD73800_INT_BUCK4_OCP, + BD73800_INT_BUCK5_OCP, + BD73800_INT_BUCK6_OCP, + BD73800_INT_BUCK7_OCP, + BD73800_INT_BUCK8_OCP, + + /* INT_STAT_4 IRQs, power-button, WDG and reset */ + BD73800_INT_PBTN_LONG_PRESS, + BD73800_INT_PBTN_MID_PRESS, + /* + * The SHORT_PUSH is generated when button is first pressed (longer + * than configured time limit), and then released before the MID_PRESS + * time limit. The SHORT_PRESS is generated immediately when button is + * pressed for longer than configured limit, whether it is released or + * not. + */ + BD73800_INT_PBTN_SHORT_PUSH, + BD73800_INT_PBTN_SHORT_PRESS, + BD73800_INT_WDG, + BD73800_INT_SWRESET, + BD73800_INT_SEQ_DONE, + + /* INT_STAT_5 IRQs, GPIO */ + BD73800_INT_GPIO1, + BD73800_INT_GPIO2, + BD73800_INT_GPIO3, + BD73800_INT_GPIO4, +}; + +#define BD73800_MASK_RUN_EN BIT(2) +#define BD73800_MASK_SUSP_EN BIT(1) +#define BD73800_MASK_IDLE_EN BIT(0) +#define BD73800_MASK_VOLT GENMASK(7, 0) +#define BD73800_MASK_BUCK5_VOLT GENMASK(6, 0) +#define BD73800_MASK_RAMP_DELAY GENMASK(2, 1) +#define BD73800_BUCK5_RANGE_MASK BIT(7) + +/* BD73800 registers */ +enum { + BD73800_REG_PRODUCT_ID =3D 0x0, + BD73800_REG_MANUFACTURER_ID, + BD73800_REG_REVISION, + BD73800_REG_NVMVERSION, + BD73800_REG_POR_REASON, + BD73800_REG_RESET_REASON1, + BD73800_REG_RESET_REASON2, + BD73800_REG_RESET_REASON3, + BD73800_REG_POW_STATE, + BD73800_REG_WRST_SEL, + BD73800_REG_PS_CTRL_1, + BD73800_REG_PS_CTRL_2, + BD73800_REG_RCVCFG, + BD73800_REG_RCVNUM, + BD73800_REG_CRDCFG, /* 0x0f, followed by undocumented reg */ + + BD73800_REG_BUCK1_ON =3D 0x11, + BD73800_REG_BUCK1_MODE, + BD73800_REG_BUCK1_VOLT_RUN, + BD73800_REG_BUCK1_VOLT_IDLE, + BD73800_REG_BUCK1_VOLT_SUSP, /* 0x15, followed by undocumented reg */ + + BD73800_REG_BUCK2_ON =3D 0x17, + BD73800_REG_BUCK2_MODE, + BD73800_REG_BUCK2_VOLT_RUN, + BD73800_REG_BUCK2_VOLT_IDLE, + BD73800_REG_BUCK2_VOLT_SUSP, /* 0x1b */ + + BD73800_REG_BUCK3_ON =3D 0x1d, + BD73800_REG_BUCK3_MODE, + BD73800_REG_BUCK3_VOLT_RUN, + BD73800_REG_BUCK3_VOLT_IDLE, + BD73800_REG_BUCK3_VOLT_SUSP, /* 0x21 */ + + BD73800_REG_BUCK4_ON =3D 0x23, + BD73800_REG_BUCK4_MODE, + BD73800_REG_BUCK4_VOLT_RUN, + BD73800_REG_BUCK4_VOLT_IDLE, + BD73800_REG_BUCK4_VOLT_SUSP, /* 0x27 */ + + BD73800_REG_BUCK5_ON =3D 0x29, + BD73800_REG_BUCK5_MODE, + BD73800_REG_BUCK5_VOLT_RUN, + BD73800_REG_BUCK5_VOLT_IDLE, + BD73800_REG_BUCK5_VOLT_SUSP, /* 0x2d */ + + BD73800_REG_BUCK6_ON =3D 0x2f, + BD73800_REG_BUCK6_MODE, + BD73800_REG_BUCK6_VOLT_RUN, + BD73800_REG_BUCK6_VOLT_IDLE, + BD73800_REG_BUCK6_VOLT_SUSP, /* 0x33 */ + + BD73800_REG_BUCK7_ON =3D 0x35, + BD73800_REG_BUCK7_MODE, + BD73800_REG_BUCK7_VOLT_RUN, + BD73800_REG_BUCK7_VOLT_IDLE, + BD73800_REG_BUCK7_VOLT_SUSP, /* 0x39 */ + + BD73800_REG_BUCK8_ON =3D 0x3b, + BD73800_REG_BUCK8_MODE, + BD73800_REG_BUCK8_VOLT_RUN, + BD73800_REG_BUCK8_VOLT_IDLE, + BD73800_REG_BUCK8_VOLT_SUSP, /* 0x3f */ + + BD73800_REG_LDO1_ON =3D 0x41, + BD73800_REG_LDO1_VOLT, + BD73800_REG_LDO1_MODE, + BD73800_REG_LDO2_ON, + BD73800_REG_LDO2_VOLT, + BD73800_REG_LDO2_MODE, + BD73800_REG_LDO3_ON, + BD73800_REG_LDO3_VOLT, + BD73800_REG_LDO3_MODE, + BD73800_REG_LDO4_ON, + BD73800_REG_LDO4_VOLT, + BD73800_REG_LDO4_MODE, /* 0x4c */ + + BD73800_REG_GPO_OUT =3D 0x4e, + BD73800_REG_OUT32K =3D 0x50, + BD73800_REG_RTC_SEC, + BD73800_REG_RTC_MIN, + BD73800_REG_RTC_HOUR, + BD73800_REG_RTC_WEEK, + BD73800_REG_RTC_DAY, + BD73800_REG_RTC_MONTH, + BD73800_REG_RTC_YEAR, + BD73800_REG_RTC_ALM0_SEC, + BD73800_REG_RTC_ALM0_MIN, + BD73800_REG_RTC_ALM0_HOUR, + BD73800_REG_RTC_ALM0_WEEK, + BD73800_REG_RTC_ALM0_DAY, + BD73800_REG_RTC_ALM0_MONTH, + BD73800_REG_RTC_ALM0_YEAR, + BD73800_REG_RTC_ALM1_SEC, + BD73800_REG_RTC_ALM1_MIN, + BD73800_REG_RTC_ALM1_HOUR, + BD73800_REG_RTC_ALM1_WEEK, + BD73800_REG_RTC_ALM1_DAY, + BD73800_REG_RTC_ALM1_MONTH, + BD73800_REG_RTC_ALM1_YEAR, + BD73800_REG_RTC_ALM2, + BD73800_REG_RTC_CONF, /* 0x69 */ + + BD73800_REG_ADC_CTRL_1 =3D 0x6b, + BD73800_REG_ADC_CTRL_2, + BD73800_REG_ADC_ACCUM_NUM2, + BD73800_REG_ADC_ACCUM_NUM1, + BD73800_REG_ADC_ACCUM_NUM0, + BD73800_REG_ADC_ACCUM_KICK, + BD73800_REG_ADC_ACCUM_CNT2, + BD73800_REG_ADC_ACCUM_CNT1, + BD73800_REG_ADC_ACCUM_CNT0, + BD73800_REG_ADC_ACCUM_VAL2, + BD73800_REG_ADC_ACCUM_VAL1, + BD73800_REG_ADC_ACCUM_VAL0, + BD73800_REG_ADC_VOL_VAL1, + BD73800_REG_ADC_VOL_VAL0, + BD73800_REG_ADC_CUR_VAL1, + BD73800_REG_ADC_CUR_VAL0, + BD73800_REG_ADC_POW_VAL1, + BD73800_REG_ADC_POW_VAL0, + BD73800_REG_ADC_TEMP_VAL1, + BD73800_REG_ADC_TEMP_VAL0, + BD73800_REG_ADC_ACCUM_VAL_INT_TH4, + BD73800_REG_ADC_ACCUM_VAL_INT_TH3, + BD73800_REG_ADC_ACCUM_VAL_INT_TH2, + BD73800_REG_ADC_ACCUM_VAL_INT_TH1, + BD73800_REG_ADC_ACCUM_VAL_INT_TH0, + BD73800_REG_ADC_WARN_TEMP_INT_TH1, + BD73800_REG_ADC_WARN_TEMP_INT_TH0, + BD73800_REG_ADC_POW_VAL_INT_TH1, + BD73800_REG_ADC_POW_VAL_INT_TH0, /* 0x89 */ + + BD73800_REG_PBTN_CONF =3D 0x8b, + + BD73800_REG_INT_MAIN_EN =3D 0x8f, + BD73800_REG_INT_1_EN, + BD73800_REG_INT_2_EN, + BD73800_REG_INT_3_EN, + BD73800_REG_INT_4_EN, + BD73800_REG_INT_5_EN, /* 0x94 */ + + BD73800_REG_INT_MAIN_STAT =3D 0x96, + BD73800_REG_INT_1_STAT, + BD73800_REG_INT_2_STAT, + BD73800_REG_INT_3_STAT, + BD73800_REG_INT_4_STAT, + BD73800_REG_INT_5_STAT, /* 0x9b */ + + BD73800_REG_INT_MAIN_SRC =3D 0x9d, + BD73800_REG_INT_1_SRC, + BD73800_REG_INT_2_SRC, + BD73800_REG_INT_3_SRC, + BD73800_REG_INT_4_SRC, + BD73800_REG_INT_5_SRC, /* 0xa2 */ + + BD73800_REG_RST_MASK =3D 0xaf, + BD73800_MAX_REGISTER, +}; + +#define BD73800_REG_RTC_START BD73800_REG_RTC_SEC +#define BD73800_REG_RTC_ALM_START BD73800_REG_RTC_ALM0_SEC + +/* BD73800 IRQ register masks */ + +#define BD73800_INT_MAIN_EN_ALL GENMASK(4, 0) +#define BD73800_INT_ADC_ACCUM_DONE_MASK BIT(0) +#define BD73800_INT_ADC_ACCUM_OVF_MASK BIT(1) +#define BD73800_INT_ADC_ACCUM_VAL_MASK BIT(2) +#define BD73800_INT_ADC_ACCUM_TW_MASK BIT(3) +#define BD73800_INT_ADC_POW_VAL_MASK BIT(4) +#define BD73800_INT_RTC0_MASK BIT(5) +#define BD73800_INT_RTC1_MASK BIT(6) +#define BD73800_INT_RTC2_MASK BIT(7) +#define BD73800_INT_BUCK1_DVS_DONE_MASK BIT(0) +#define BD73800_INT_BUCK2_DVS_DONE_MASK BIT(1) +#define BD73800_INT_BUCK3_DVS_DONE_MASK BIT(2) +#define BD73800_INT_BUCK4_DVS_DONE_MASK BIT(3) +#define BD73800_INT_BUCK5_DVS_DONE_MASK BIT(4) +#define BD73800_INT_BUCK6_DVS_DONE_MASK BIT(5) +#define BD73800_INT_BUCK7_DVS_DONE_MASK BIT(6) +#define BD73800_INT_BUCK8_DVS_DONE_MASK BIT(7) +#define BD73800_INT_BUCK1_OCP_MASK BIT(0) +#define BD73800_INT_BUCK2_OCP_MASK BIT(1) +#define BD73800_INT_BUCK3_OCP_MASK BIT(2) +#define BD73800_INT_BUCK4_OCP_MASK BIT(3) +#define BD73800_INT_BUCK5_OCP_MASK BIT(4) +#define BD73800_INT_BUCK6_OCP_MASK BIT(5) +#define BD73800_INT_BUCK7_OCP_MASK BIT(6) +#define BD73800_INT_BUCK8_OCP_MASK BIT(7) +#define BD73800_INT_PBTN_LONG_PRESS_MASK BIT(0) +#define BD73800_INT_PBTN_MID_PRESS_MASK BIT(1) +#define BD73800_INT_PBTN_SHORT_PUSH_MASK BIT(2) +#define BD73800_INT_PBTN_SHORT_PRESS_MASK BIT(3) +#define BD73800_INT_WDG_MASK BIT(4) +#define BD73800_INT_SWRESET_MASK BIT(5) +#define BD73800_INT_SEQ_DONE_MASK BIT(6) +#define BD73800_INT_GPIO1_MASK BIT(0) +#define BD73800_INT_GPIO2_MASK BIT(1) +#define BD73800_INT_GPIO3_MASK BIT(2) +#define BD73800_INT_GPIO4_MASK BIT(3) + +#endif /* _MFD_BD73800_H */ + diff --git a/include/linux/mfd/rohm-generic.h b/include/linux/mfd/rohm-gene= ric.h index 0a284919a6c3..3ec87428ee97 100644 --- a/include/linux/mfd/rohm-generic.h +++ b/include/linux/mfd/rohm-generic.h @@ -17,6 +17,7 @@ enum rohm_chip_type { ROHM_CHIP_TYPE_BD71837, ROHM_CHIP_TYPE_BD71847, ROHM_CHIP_TYPE_BD72720, + ROHM_CHIP_TYPE_BD73800, ROHM_CHIP_TYPE_BD96801, ROHM_CHIP_TYPE_BD96802, ROHM_CHIP_TYPE_BD96805, --=20 2.55.0 --jE1SHM7zvqDYiC9s Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYAtcACgkQeFA3/03a ocXYvQf9EVkH8WKGXloaEboHEeHzNUp+2M2AoUri9Zlj7uvovrxnjFUaR50lUViO ishzRl8J+zEgFyyHD4Cm/yzizNcCQK4vGMDWjED3cwYV6rFEpfuyo/mP9TAvv3j1 HKHUSqG6nIKVJ5Ty5wD4VjfT7zq0WljxxFzERDCvmbGctd6OR54eawPIymb8/x4x 1wWkM79IvsQcAK4d3+Hn5DjVUPbCKxd+tngVf56eDEArMDeqLpEedPiOSKHnxZzW oSjJawyUcC2LjG7gw1hUQbzlTqm1aFAOZ7udFbss1T5MfrIG+CrzC89pIUVqAdT8 6d3ZewkWITYL3OQc5Ow7LN0NW+zIuA== =7zKK -----END PGP SIGNATURE----- --jE1SHM7zvqDYiC9s-- From nobody Sat Sep 26 10:01:18 2026 Received: from mta0.migadu.com (out-65.mta0.migadu.com [91.218.175.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9E58471255 for ; Wed, 2 Sep 2026 11:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347127; cv=none; b=Jbls0bCqPnGpp7k9kjm9v9f7RB7zwCgeg3RTo1TA5HkSZlV1wH4jqyieEm55BxPMR9HUH7OgAx3Y2+X07D/xaJJufIz0LtUvW6/67MdPidsWOU6gqCj4tOCh9B/nbzX25ZiwpumOcr7Kj4UxJCLVTWo+tLWDfjAe4haq0rRUQ1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347127; c=relaxed/simple; bh=HaNYEnH8LVUlMmFL5E2ONB5bXrGpyqsXd9iFMN8eYbQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rhKghkeY6Wkz4qtJL+778/mIEq6LmlobMWimCNUjEGkB7PQQLcti5rIoVHUTePeANuTMKE+SQcYGFynb8UqM01+GlUDuSSqcvmCibjR23b+9yiZXVZFKknnp90UG/f4bjmmP520bnMsLZA15qwBxtyXxWIwJYLTbrEAPJ93owZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=pU7jKEQI; arc=none smtp.client-ip=91.218.175.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pU7jKEQI" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=HaNYEnH8LVUlMmFL5E2ONB5bXrGpyqsXd9iFMN8eYbQ=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347122; v=1; x=1788951922; b=pU7jKEQI4LlILKRWKRTcFxOiSSjBsF8PsthjYgBY1cYw9o7aWtLtNocjkzonpnnF4JA4Zn9H Xic+iYk9vsQlftLF1DV1YlzSB8DpPzHlYS9SlxCeXE7qszUHciEekgmMmKXFPW1BsF3XpBeZzJT pm8GIVQOD+t9why+K9eaBAOM= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id 8e0f7be38ebc2042; Wed, 02 Sep 2026 11:05:15 +0000 X-Mizu-Trace-ID: 8e0f7be38ebc2042 X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:05:11 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 06/10] rtc: bd70528: Support RTC on ROHM BD73800 Message-ID: Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ZbYZHO2k6nhQcAFN" Content-Disposition: inline In-Reply-To: --ZbYZHO2k6nhQcAFN Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen BD73800 contains similar RTC block as BD71828 and BD71815. Only the address offsets seem different. Support also BD73800 RTC using the rtc-bd70528. Signed-off-by: Matti Vaittinen Acked-by: Alexandre Belloni --- Revision history: v1 =3D> : - No changes --- drivers/rtc/rtc-bd70528.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/rtc/rtc-bd70528.c b/drivers/rtc/rtc-bd70528.c index 482810b61495..fd415e327ea6 100644 --- a/drivers/rtc/rtc-bd70528.c +++ b/drivers/rtc/rtc-bd70528.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -284,6 +285,12 @@ static int bd70528_probe(struct platform_device *pdev) bd_rtc->bd718xx_alm_block_start =3D BD72720_REG_RTC_ALM_START; hour_reg =3D BD72720_REG_RTC_HOUR; break; + case ROHM_CHIP_TYPE_BD73800: + bd_rtc->reg_time_start =3D BD73800_REG_RTC_START; + bd_rtc->bd718xx_alm_block_start =3D BD73800_REG_RTC_ALM_START; + hour_reg =3D BD73800_REG_RTC_HOUR; + break; + default: dev_err(&pdev->dev, "Unknown chip\n"); return -ENOENT; @@ -344,6 +351,7 @@ static const struct platform_device_id bd718x7_rtc_id[]= =3D { { .name =3D "bd71828-rtc", .driver_data =3D ROHM_CHIP_TYPE_BD71828 }, { .name =3D "bd71815-rtc", .driver_data =3D ROHM_CHIP_TYPE_BD71815 }, { .name =3D "bd72720-rtc", .driver_data =3D ROHM_CHIP_TYPE_BD72720 }, + { .name =3D "bd73800-rtc", .driver_data =3D ROHM_CHIP_TYPE_BD73800 }, { } }; MODULE_DEVICE_TABLE(platform, bd718x7_rtc_id); --=20 2.55.0 --ZbYZHO2k6nhQcAFN Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYAucACgkQeFA3/03a ocXMBgf/TUt9DOWU0huBBQ/MfEOupg3r4aPH5gSN10GPm11yxis34Taox4c0BSiy SpkFzrGRLMaApCAsdx5CPAnMaYElKQUObWPEXC22cB/d2xZb+d/VjsjNJ6UHLyJx k8AGUdsyHj3ZLmzJRhifvdadW/ddIwitkxaBAY4CrQ6fQwAEfMAH8vmcgF+LlAhR GShYcq2CV62ppZ1iWflizgHngTGWJTRqxgc74Tf5HP1SRvr4TYCZWcR9kkKLvW8+ O5aR5L+b5+t0ZeFLGK142eKDMftxroMHrTolAp5aU3SmAgYuG+CJyaFmqPg/wB0A ZoVGJFzpV4CMCUFmcxOL0Zw1VC91vw== =mYIV -----END PGP SIGNATURE----- --ZbYZHO2k6nhQcAFN-- From nobody Sat Sep 26 10:01:18 2026 Received: from mta1.migadu.com (out-141.mta1.migadu.com [95.215.58.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1707C4766B3 for ; Wed, 2 Sep 2026 11:05:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347148; cv=none; b=aeyALyiFIbfNHZbj8oHKekmbYRrMpYPFkZCf3eCWJGoBxfkamRwb78kg2Cmtif2qpuV3DsGw5I2QAA1enaW4yQds4yLaQSU3mWlR7GdqMdqkuf319xl9uJIhztHqjI/kweE7qRS94GJEn2VeFniESAsJAKkJriOHXzHW5BfwDWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347148; c=relaxed/simple; bh=sH6lkVm6vZh1Gd3NVECn/sV8ep/I6wwJuRdHTGBDZJw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Gxz/1W+XSw87uk1b9K3lJg5Qe6npEP9RFGg2x5a7vNCTY7uRL3IBUxZUhVlPkF1S8bsQR4sa6Q+TlEJXTuPTL2uaGgwI8JWs17Uj6T75qHwSV6ByXicMYtAl0bsJy5afZinfmE2tjI1AVKO26HJcDesKo6Jt7LxXsL+u5OLp7tk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=hCTfs1Kb; arc=none smtp.client-ip=95.215.58.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="hCTfs1Kb" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=sH6lkVm6vZh1Gd3NVECn/sV8ep/I6wwJuRdHTGBDZJw=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347141; v=1; x=1788951941; b=hCTfs1KbjC9HJPd8rQ1k1tC8K8Fksi4H7NAsYrUPi4PLJxSSNLdsJzi+ygxs/BaZuprVDp4E gByukAXovanejd/XKDr6HpzwYfgLK2pVJ5RN20OXYVj3DaSCYmUM1367cOiTObyqkg1rqD2Ch3U DAfeNjZHQllaB2JRmwK/+1Hg= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta12.migadu.com with ESMTPS id e4175a6b2e7b939f; Wed, 02 Sep 2026 11:05:40 +0000 X-Mizu-Trace-ID: e4175a6b2e7b939f X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:05:36 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 07/10] regulator: bd71828: Support ROHM BD73800 Message-ID: Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="lPa3qMn8dZhlVFjV" Content-Disposition: inline In-Reply-To: --lPa3qMn8dZhlVFjV Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen The ROHM BD73800 is a power management IC which integrates 8 BUCKs and 4 LDOs. The PMIC has internal state-machine and it can support transitions to RUN, SUSPEND and IDLE states. The LDOs 1 and 3 have two different voltage range configurations that can be set at the manufacturing phase by OTP. By default driver assumes low voltage ranges to be used because the data-sheet indicates the higher voltage ranges to be an 'OTP option'. The high voltage range can be indicated via device-tree property. Signed-off-by: Matti Vaittinen Acked-by: Mark Brown --- Revision history: v3: - No changes v1 =3D> v2: - Simplified DT parsing as was suggested by Mark - Fix buck5 vsel_mask --- drivers/regulator/Kconfig | 4 +- drivers/regulator/bd71828-regulator.c | 558 +++++++++++++++++++++++++- 2 files changed, 559 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 89789ac7a786..13928af8cad4 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -241,12 +241,12 @@ config REGULATOR_BD71815 will be called bd71815-regulator. =20 config REGULATOR_BD71828 - tristate "ROHM BD71828, BD72720 and BD73900 Power Regulators" + tristate "ROHM BD71828, BD72720 and BD73[8/9]00 Power Regulators" depends on MFD_ROHM_BD71828 select REGULATOR_ROHM help This driver supports voltage regulators on ROHM BD71828, - BD71879, BD72720 and BD73900 PMICs. This will enable + BD71879, BD72720 and BD73[8/9]00 PMICs. This will enable support for the software controllable buck and LDO regulators. =20 This driver can also be built as a module. If so, the module diff --git a/drivers/regulator/bd71828-regulator.c b/drivers/regulator/bd71= 828-regulator.c index 2ced81df0c02..dea551cf658a 100644 --- a/drivers/regulator/bd71828-regulator.c +++ b/drivers/regulator/bd71828-regulator.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only // Copyright (C) 2019 ROHM Semiconductors // bd71828-regulator.c ROHM BD71828GW-DS1 regulator driver -// =20 #include #include @@ -10,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +31,13 @@ struct bd71828_regulator_data { int reg_init_amnt; }; =20 +/* + * LDO1 and LDO3 node names are used also in the driver to find OTP settin= g for + * the used voltage range. + */ +#define LDO1_NODE_NAME "ldo1" +#define LDO3_NODE_NAME "ldo3" + static const struct reg_init bd71828_buck1_inits[] =3D { /* * DVS Buck voltages can be changed by register values or via GPIO. @@ -172,6 +179,55 @@ static const struct linear_range bd72720_ldo6_volts[] = =3D { REGULATOR_LINEAR_RANGE(1800000, 0x79, 0x7f, 0), }; =20 +static const struct linear_range bd73800_buck12348_volts[] =3D { + REGULATOR_LINEAR_RANGE(500000, 0x00, 0x50, 10000), + REGULATOR_LINEAR_RANGE(1300000, 0x51, 0xff, 0), +}; + +static const unsigned int bd73800_buck5_volt_range_sel[] =3D { + 0x0, 0x0, 0x1, 0x1, +}; + +static const struct linear_range bd73800_buck5_volts[] =3D { + /* range selector 0 */ + REGULATOR_LINEAR_RANGE(500000, 0x00, 0x50, 10000), + REGULATOR_LINEAR_RANGE(1300000, 0x51, 0x7f, 0), + /* range selector 1 */ + REGULATOR_LINEAR_RANGE(300000, 0x00, 0x46, 10000), + REGULATOR_LINEAR_RANGE(1000000, 0x47, 0x7f, 0), +}; + +/* + * BUCK5 has two different pickable ranges, each having voltages matching + * selectors 0x0 to 0x7f. This gives 0x7f + 1 different voltages for each = of + * the ranges. + */ +#define BD73800_NUM_BUCK5_VOLTS ((0x7f + 1) * 2) + +static const struct linear_range bd73800_buck67_volts[] =3D { + REGULATOR_LINEAR_RANGE(1500000, 0x00, 0xc8, 10000), + REGULATOR_LINEAR_RANGE(3500000, 0xc9, 0xff, 0), +}; + +/* + * On the BD73800 the LDO1 and LDO3 support two different voltage areas. + * Whether to use 'high' or 'low' ranges is configured by OTP. There seems + * to be no register to read the configured area so it must be given via + * device-tree properties. + */ +static const struct linear_range bd73800_ldo13_low_volts[] =3D { + REGULATOR_LINEAR_RANGE(600000, 0x00, 0x78, 10000), + REGULATOR_LINEAR_RANGE(1800000, 0x79, 0xff, 0), +}; + +static const struct linear_range bd73800_ldo13_high_volts[] =3D { + REGULATOR_LINEAR_RANGE(750000, 0x00, 0xff, 10000), +}; + +static const struct linear_range bd73800_ldo24_volts[] =3D { + REGULATOR_LINEAR_RANGE(750000, 0x00, 0xff, 10000), +}; + static const unsigned int bd71828_ramp_delay[] =3D { 2500, 5000, 10000, 20= 000 }; =20 /* @@ -225,6 +281,36 @@ static int bd71828_ldo6_parse_dt(struct device_node *n= p, return 0; } =20 +/* Operations for all other BUCKs but BUCK 5 */ +static const struct regulator_ops bd73800_buck_ops =3D { + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .is_enabled =3D regulator_is_enabled_regmap, + .list_voltage =3D regulator_list_voltage_linear_range, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_ramp_delay =3D regulator_set_ramp_delay_regmap, +}; + +static const struct regulator_ops bd73800_buck5_ops =3D { + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .is_enabled =3D regulator_is_enabled_regmap, + .list_voltage =3D regulator_list_voltage_pickable_linear_range, + .set_voltage_sel =3D regulator_set_voltage_sel_pickable_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_pickable_regmap, + .set_ramp_delay =3D regulator_set_ramp_delay_regmap, +}; + +static const struct regulator_ops bd73800_ldo_ops =3D { + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .is_enabled =3D regulator_is_enabled_regmap, + .list_voltage =3D regulator_list_voltage_linear_range, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, +}; + static const struct regulator_ops bd71828_buck_ops =3D { .enable =3D regulator_enable_regmap, .disable =3D regulator_disable_regmap, @@ -1565,6 +1651,412 @@ static const struct bd71828_regulator_data bd72720_= rdata[] =3D { }, }; =20 +static const struct bd71828_regulator_data bd73800_rdata[] =3D { + { + .desc =3D { + .name =3D "buck1", + .of_match =3D of_match_ptr("buck1"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_BUCK1, + .ops =3D &bd73800_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_buck12348_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_buck12348_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_BUCK1_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_BUCK1_VOLT_RUN, + .vsel_mask =3D BD73800_MASK_VOLT, + .ramp_delay_table =3D bd71828_ramp_delay, + .n_ramp_values =3D ARRAY_SIZE(bd71828_ramp_delay), + .ramp_reg =3D BD73800_REG_BUCK1_MODE, + .ramp_mask =3D BD73800_MASK_RAMP_DELAY, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_BUCK1_VOLT_RUN, + .run_mask =3D BD73800_MASK_VOLT, + .idle_reg =3D BD73800_REG_BUCK1_VOLT_IDLE, + .idle_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_reg =3D BD73800_REG_BUCK1_VOLT_SUSP, + .suspend_mask =3D BD73800_MASK_VOLT, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, { + .desc =3D { + .name =3D "buck2", + .of_match =3D of_match_ptr("buck2"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_BUCK2, + .ops =3D &bd73800_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_buck12348_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_buck12348_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_BUCK2_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_BUCK2_VOLT_RUN, + .vsel_mask =3D BD73800_MASK_VOLT, + .ramp_delay_table =3D bd71828_ramp_delay, + .n_ramp_values =3D ARRAY_SIZE(bd71828_ramp_delay), + .ramp_reg =3D BD73800_REG_BUCK2_MODE, + .ramp_mask =3D BD73800_MASK_RAMP_DELAY, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_BUCK2_VOLT_RUN, + .run_mask =3D BD73800_MASK_VOLT, + .idle_reg =3D BD73800_REG_BUCK2_VOLT_IDLE, + .idle_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_reg =3D BD73800_REG_BUCK2_VOLT_SUSP, + .suspend_mask =3D BD73800_MASK_VOLT, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, { + .desc =3D { + .name =3D "buck3", + .of_match =3D of_match_ptr("buck3"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_BUCK3, + .ops =3D &bd73800_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_buck12348_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_buck12348_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_BUCK3_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_BUCK3_VOLT_RUN, + .vsel_mask =3D BD73800_MASK_VOLT, + .ramp_delay_table =3D bd71828_ramp_delay, + .n_ramp_values =3D ARRAY_SIZE(bd71828_ramp_delay), + .ramp_reg =3D BD73800_REG_BUCK3_MODE, + .ramp_mask =3D BD73800_MASK_RAMP_DELAY, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_BUCK3_VOLT_RUN, + .run_mask =3D BD73800_MASK_VOLT, + .idle_reg =3D BD73800_REG_BUCK3_VOLT_IDLE, + .idle_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_reg =3D BD73800_REG_BUCK3_VOLT_SUSP, + .suspend_mask =3D BD73800_MASK_VOLT, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + + }, { + .desc =3D { + .name =3D "buck4", + .of_match =3D of_match_ptr("buck4"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_BUCK4, + .ops =3D &bd73800_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_buck12348_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_buck12348_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_BUCK4_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_BUCK4_VOLT_RUN, + .vsel_mask =3D BD73800_MASK_VOLT, + .ramp_delay_table =3D bd71828_ramp_delay, + .n_ramp_values =3D ARRAY_SIZE(bd71828_ramp_delay), + .ramp_reg =3D BD73800_REG_BUCK4_MODE, + .ramp_mask =3D BD73800_MASK_RAMP_DELAY, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_BUCK4_VOLT_RUN, + .run_mask =3D BD73800_MASK_VOLT, + .idle_reg =3D BD73800_REG_BUCK4_VOLT_IDLE, + .idle_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_reg =3D BD73800_REG_BUCK4_VOLT_SUSP, + .suspend_mask =3D BD73800_MASK_VOLT, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, { + .desc =3D { + .name =3D "buck5", + .of_match =3D of_match_ptr("buck5"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_BUCK5, + .ops =3D &bd73800_buck5_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_buck5_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_buck5_volts), + .linear_range_selectors_bitfield =3D + bd73800_buck5_volt_range_sel, + .n_voltages =3D BD73800_NUM_BUCK5_VOLTS, + .enable_reg =3D BD73800_REG_BUCK5_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_BUCK5_VOLT_RUN, + .vsel_mask =3D BD73800_MASK_BUCK5_VOLT, + .vsel_range_reg =3D BD73800_REG_BUCK5_MODE, + .vsel_range_mask =3D BD73800_BUCK5_RANGE_MASK, + .range_applied_by_vsel =3D true, + .ramp_delay_table =3D bd71828_ramp_delay, + .n_ramp_values =3D ARRAY_SIZE(bd71828_ramp_delay), + .ramp_reg =3D BD73800_REG_BUCK5_MODE, + .ramp_mask =3D BD73800_MASK_RAMP_DELAY, + .owner =3D THIS_MODULE, + }, + .dvs =3D { + /* + * We don't support setting the IDLE / SUSPEND voltages + * for the BUCK 5 for now. Reason is that the pickable + * range selector bit is common for all states (RUN, + * SUSPEND and IDLE), and toggling it for one impacts + * also others. + * Furthermore, writing the BD73800 range selector does + * not impact the RUN voltage until a new voltage value + * is also written to the vsel register. Hence the + * voltage change can be done without any 'intermediate + * voltages', even when the range is changed when the + * BUCK is enabled. + * It, however, is not documented how the IDLE / SUSPEND + * states work in this regard. I expect the full + * combination of the range selector and vsel is taken + * into account at the state change, no matter when they + * have been written to. + */ + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_BUCK5_VOLT_RUN, + .run_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + + }, { + .desc =3D { + .name =3D "buck6", + .of_match =3D of_match_ptr("buck6"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_BUCK6, + .ops =3D &bd73800_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_buck67_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_buck67_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_BUCK6_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_BUCK6_VOLT_RUN, + .vsel_mask =3D BD73800_MASK_VOLT, + .ramp_delay_table =3D bd71828_ramp_delay, + .n_ramp_values =3D ARRAY_SIZE(bd71828_ramp_delay), + .ramp_reg =3D BD73800_REG_BUCK6_MODE, + .ramp_mask =3D BD73800_MASK_RAMP_DELAY, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_BUCK6_VOLT_RUN, + .run_mask =3D BD73800_MASK_VOLT, + .idle_reg =3D BD73800_REG_BUCK6_VOLT_IDLE, + .idle_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_reg =3D BD73800_REG_BUCK6_VOLT_SUSP, + .suspend_mask =3D BD73800_MASK_VOLT, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, { + .desc =3D { + .name =3D "buck7", + .of_match =3D of_match_ptr("buck7"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_BUCK7, + .ops =3D &bd73800_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_buck67_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_buck67_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_BUCK7_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_BUCK7_VOLT_RUN, + .vsel_mask =3D BD73800_MASK_VOLT, + .ramp_delay_table =3D bd71828_ramp_delay, + .n_ramp_values =3D ARRAY_SIZE(bd71828_ramp_delay), + .ramp_reg =3D BD73800_REG_BUCK7_MODE, + .ramp_mask =3D BD73800_MASK_RAMP_DELAY, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_BUCK7_VOLT_RUN, + .run_mask =3D BD73800_MASK_VOLT, + .idle_reg =3D BD73800_REG_BUCK7_VOLT_IDLE, + .idle_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_reg =3D BD73800_REG_BUCK7_VOLT_SUSP, + .suspend_mask =3D BD73800_MASK_VOLT, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, { + .desc =3D { + .name =3D "buck8", + .of_match =3D of_match_ptr("buck8"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_BUCK8, + .ops =3D &bd73800_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_buck12348_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_buck12348_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_BUCK8_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_BUCK8_VOLT_RUN, + .vsel_mask =3D BD73800_MASK_VOLT, + .ramp_delay_table =3D bd71828_ramp_delay, + .n_ramp_values =3D ARRAY_SIZE(bd71828_ramp_delay), + .ramp_reg =3D BD73800_REG_BUCK8_MODE, + .ramp_mask =3D BD73800_MASK_RAMP_DELAY, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_BUCK8_VOLT_RUN, + .run_mask =3D BD73800_MASK_VOLT, + .idle_reg =3D BD73800_REG_BUCK8_VOLT_IDLE, + .idle_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_reg =3D BD73800_REG_BUCK8_VOLT_SUSP, + .suspend_mask =3D BD73800_MASK_VOLT, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, { + .desc =3D { + .name =3D "ldo1", + .of_match =3D of_match_ptr(LDO1_NODE_NAME), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_LDO1, + .ops =3D &bd73800_ldo_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_ldo13_low_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_ldo13_low_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_LDO1_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_LDO1_VOLT, + .vsel_mask =3D BD73800_MASK_VOLT, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + /* + * LDOs support only single voltage for all states. + * Voltage can be individually enabled for each state + * though. Allow setting enable/disable config by + * setting the _on_mask for all supported states. + */ + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_LDO1_VOLT, + .run_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, { + .desc =3D { + .name =3D "ldo2", + .of_match =3D of_match_ptr("ldo2"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_LDO2, + .ops =3D &bd73800_ldo_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_ldo24_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_ldo24_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_LDO2_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_LDO2_VOLT, + .vsel_mask =3D BD73800_MASK_VOLT, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_LDO2_VOLT, + .run_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, { + .desc =3D { + .name =3D "ldo3", + .of_match =3D of_match_ptr(LDO3_NODE_NAME), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_LDO3, + .ops =3D &bd73800_ldo_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_ldo13_low_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_ldo13_low_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_LDO3_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_LDO3_VOLT, + .vsel_mask =3D BD73800_MASK_VOLT, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_LDO3_VOLT, + .run_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, { + .desc =3D { + .name =3D "ldo4", + .of_match =3D of_match_ptr("ldo4"), + .regulators_node =3D of_match_ptr("regulators"), + .id =3D BD73800_LDO4, + .ops =3D &bd73800_ldo_ops, + .type =3D REGULATOR_VOLTAGE, + .linear_ranges =3D bd73800_ldo24_volts, + .n_linear_ranges =3D ARRAY_SIZE(bd73800_ldo24_volts), + .n_voltages =3D BD73800_NUM_VOLTS, + .enable_reg =3D BD73800_REG_LDO4_ON, + .enable_mask =3D BD73800_MASK_RUN_EN, + .vsel_reg =3D BD73800_REG_LDO4_VOLT, + .vsel_mask =3D BD73800_MASK_VOLT, + .owner =3D THIS_MODULE, + .of_parse_cb =3D buck_set_hw_dvs_levels, + }, + .dvs =3D { + .level_map =3D ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | + ROHM_DVS_LEVEL_SUSPEND, + .run_reg =3D BD73800_REG_LDO4_VOLT, + .run_mask =3D BD73800_MASK_VOLT, + .idle_on_mask =3D BD73800_MASK_IDLE_EN, + .suspend_on_mask =3D BD73800_MASK_SUSP_EN, + }, + }, +}; + static int bd72720_buck10_ldon_head_mode(struct device *dev, struct device_node *npreg, struct regmap *regmap, @@ -1619,6 +2111,52 @@ static int bd72720_dt_parse(struct device *dev, return bd72720_buck10_ldon_head_mode(dev, nproot, regmap, buck10_desc); } =20 +static bool bd73800_use_ldo_high_range(struct device_node *nproot, + const char *ldo_node) +{ + struct device_node *np __free(device_node) =3D + of_get_child_by_name(nproot, ldo_node); + + if (!np) + return false; + + return of_property_read_bool(np, "rohm,ldo-range-high"); +} + +static int bd73800_check_ldo_otp_options(struct device *dev, + struct bd71828_regulator_data *d, + unsigned int num_reg_data) +{ + struct device_node *nproot __free(device_node) =3D + of_get_child_by_name(dev->parent->of_node, "regulators"); + + /* + * The code assumes regulator IDs to start from 0 and to match the + * indexing of regulator data arrays. WARN if someone changes this. + */ + WARN_ON(d[BD73800_LDO1].desc.id !=3D BD73800_LDO1); + WARN_ON(d[BD73800_LDO3].desc.id !=3D BD73800_LDO3); + + if (!nproot) { + dev_err(dev, "failed to find regulators node\n"); + return -ENODEV; + } + + if (bd73800_use_ldo_high_range(nproot, LDO1_NODE_NAME)) { + d[BD73800_LDO1].desc.linear_ranges =3D bd73800_ldo13_high_volts; + d[BD73800_LDO1].desc.n_linear_ranges =3D + ARRAY_SIZE(bd73800_ldo13_high_volts); + } + + if (bd73800_use_ldo_high_range(nproot, LDO3_NODE_NAME)) { + d[BD73800_LDO3].desc.linear_ranges =3D bd73800_ldo13_high_volts; + d[BD73800_LDO3].desc.n_linear_ranges =3D + ARRAY_SIZE(bd73800_ldo13_high_volts); + } + + return 0; +} + static int bd71828_probe(struct platform_device *pdev) { int i, j, ret, num_regulators; @@ -1656,6 +2194,23 @@ static int bd71828_probe(struct platform_device *pde= v) num_regulators =3D ARRAY_SIZE(bd71828_rdata); =20 break; + + case ROHM_CHIP_TYPE_BD73800: + { + rdata =3D devm_kmemdup(&pdev->dev, bd73800_rdata, + sizeof(bd73800_rdata), GFP_KERNEL); + if (!rdata) + return -ENOMEM; + + num_regulators =3D ARRAY_SIZE(bd73800_rdata); + + ret =3D bd73800_check_ldo_otp_options(&pdev->dev, rdata, + num_regulators); + if (ret) + return ret; + + break; + } default: return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported device\n"); @@ -1692,6 +2247,7 @@ static int bd71828_probe(struct platform_device *pdev) static const struct platform_device_id bd71828_pmic_id[] =3D { { .name =3D "bd71828-pmic", .driver_data =3D ROHM_CHIP_TYPE_BD71828 }, { .name =3D "bd72720-pmic", .driver_data =3D ROHM_CHIP_TYPE_BD72720 }, + { .name =3D "bd73800-pmic", .driver_data =3D ROHM_CHIP_TYPE_BD73800 }, { } }; MODULE_DEVICE_TABLE(platform, bd71828_pmic_id); --=20 2.55.0 --lPa3qMn8dZhlVFjV Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYAwAACgkQeFA3/03a ocW8BwgAv++z/Tfspn3XuGT3IfXxrehJiWMirQgQAxdnsx8Y+J1wr5OFiE1K7Hqn 96Y9wOpj+uFRMwjYxeIGp+GFKyAhV23Ra8+3dqh5mnNMlj1gfKoCm04ofxjfM4eA s6AaHTD8i75YuHj2JtwvilkvZjasIFwcaoCUn/KipIYu9PyXgthIP7P96k5VR6al QSjCG6jiNvgajqresr9Si3jvW2hqkGAbwr5C0Xolq8U7K6knSKGPy92H/rx9ISk7 AAx1zIwMomGVJRvdU4x5HWyvLtXZKCvN5CM95U5q4+3Du3SdQpFA3RKbFoRE0BpB O6i+FHxarktDqR8XJAbyuNlczJwXdg== =RMIr -----END PGP SIGNATURE----- --lPa3qMn8dZhlVFjV-- From nobody Sat Sep 26 10:01:18 2026 Received: from mta1.migadu.com (out-151.mta1.migadu.com [95.215.58.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A6804746BE for ; Wed, 2 Sep 2026 11:05:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347161; cv=none; b=AZ6Fdc6iW6+8nB8VItfd7xOZsqxzxm5+HkMkE4Tu+J0LpYP9gjnclfdTS4O7PyhX6Xm0kfBlU+Bv75AQ7FY90J/52S+wneel8oKzb2kmaySuZ/L+mrbobwVGT9uwR71f9BzatnTNnXWAomZgn/+u3WR+GrVxViZRVPQDt/4DBZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347161; c=relaxed/simple; bh=+RN7OEaS2RJa4iP5e8mwoll+FCOPeNzaEDLuiXoncPY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QsosaIOMhUGnn6EvghWuYxIvzIAV23/k2ubi20/2yVAC0WcOqgYufenEMts8C7tUyscPc0DYCPdD+8B1ouCqoRfW5lLfcC774lxBBcdBCOJKPsBKyYxJjC9Ti3zQ4WXpQhBM5ybFiB/1iUynTqrc3tbIqBZyRagRLEBZdMZM04s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=pqDEG48i; arc=none smtp.client-ip=95.215.58.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pqDEG48i" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=+RN7OEaS2RJa4iP5e8mwoll+FCOPeNzaEDLuiXoncPY=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347154; v=1; x=1788951954; b=pqDEG48iUtHH1JVaqe0YWn9JOCTVnaTLlVdnS2Q9jwl8knqOFhrBpAf3WOIhcOGQT5MgcmWC MXJkXvWihvsFoupoB8AGwTkZa/Xkp2Y6Mgkx1KQ6L2iwmHpp4WogY063hem2Z+C+3CdDMtt0/s7 fCeTE2ubjdpdJQ73LmBUWHFk= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id 134b9c3664a29d20; Wed, 02 Sep 2026 11:05:54 +0000 X-Mizu-Trace-ID: 134b9c3664a29d20 X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:05:50 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 08/10] clk: bd718x7: Support ROHM BD73800 Message-ID: <2a74fea679420d147ab1029943ff071628dc8c5a.1788346553.git.mazziesaccount@gmail.com> Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tyc7TRMBnVUQim7w" Content-Disposition: inline In-Reply-To: --tyc7TRMBnVUQim7w Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen The ROHM BD73800 PMIC has a 32.768 kHz clock gate. Add support for controlling this clock. NOTE: The CLKOUT pin can be muxed by an OTP option. On some OTP configurations the CLKOUT is not outputting the clk signal. Signed-off-by: Matti Vaittinen Reviewed-by: Jerome Brunet --- Revision history: v2 =3D> v3: - Use named initializers for platform_device_id v1 =3D> v2: - No changes --- drivers/clk/clk-bd718x7.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/clk-bd718x7.c b/drivers/clk/clk-bd718x7.c index 8ddb50c67757..1698b763bcb7 100644 --- a/drivers/clk/clk-bd718x7.c +++ b/drivers/clk/clk-bd718x7.c @@ -21,6 +21,9 @@ #define BD718XX_REG_OUT32K 0x2E /* BD72720 */ #define BD72720_REG_OUT32K 0x9a +/* BD73800 */ +#define BD73800_REG_OUT32K 0x50 + /* * BD71837, BD71847, and BD71828 all use bit [0] to clk output control */ @@ -123,6 +126,10 @@ static int bd71837_clk_probe(struct platform_device *p= dev) c->reg =3D BD72720_REG_OUT32K; c->mask =3D CLK_OUT_EN_MASK; break; + case ROHM_CHIP_TYPE_BD73800: + c->reg =3D BD73800_REG_OUT32K; + c->mask =3D CLK_OUT_EN_MASK; + break; default: dev_err(&pdev->dev, "Unknown clk chip\n"); return -EINVAL; @@ -152,6 +159,7 @@ static const struct platform_device_id bd718x7_clk_id[]= =3D { { .name =3D "bd71828-clk", .driver_data =3D ROHM_CHIP_TYPE_BD71828 }, { .name =3D "bd71815-clk", .driver_data =3D ROHM_CHIP_TYPE_BD71815 }, { .name =3D "bd72720-clk", .driver_data =3D ROHM_CHIP_TYPE_BD72720 }, + { .name =3D "bd73800-clk", .driver_data =3D ROHM_CHIP_TYPE_BD73800 }, { } }; MODULE_DEVICE_TABLE(platform, bd718x7_clk_id); --=20 2.55.0 --tyc7TRMBnVUQim7w Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYAw4ACgkQeFA3/03a ocUozAgAnGdSvHA3m4YOD+AOHJ2dXLLvGZlVIhTKUMWvU5uyyhVo/6Mr06cykIc5 5vh3FCHibs28v2vlmymfhGooJ6DLohqmhgz+hB3kEtXXoabgA95qYhl2ZMEoJFNr Gsb6yzWqKVF5nyh5eD/xDIhiuLdwJqMqr+wBv/szYeAh0tkEjZ25FuPOq6RV8CXX Kldq9Y8lBVKIVODVLDEs9ty9/S4p4+4trFPhylaCvxNoU22GTwLhFmeLeTI/KxLQ lsMsOi218Vj1XcagBJHaXQf1XTaKMbbgnezmH0hU2B9yKGHOWd1V8UnSZY+Wreet AVO0QUzI1w6kabi1F+SC8AkBAXlWAg== =DvFa -----END PGP SIGNATURE----- --tyc7TRMBnVUQim7w-- From nobody Sat Sep 26 10:01:18 2026 Received: from mta0.migadu.com (out-119.mta0.migadu.com [91.218.175.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 461A9476045 for ; Wed, 2 Sep 2026 11:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.119 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347262; cv=none; b=RwZRIoyCP/Oy3jorCrGJsisZugQ/ybLfJnuTI3ihGFILdrPpArbvdqOjpPe64HgcObknv1wMhPrHsc1mtk5zGYXw5SSPF43un1kkjcUUyNjnA6XIDPJ5HEkH98abTjD1Oz8Q7R7d0gLDVvQWrrw+ETRFVEJiHN83ZRbCJjP+TbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347262; c=relaxed/simple; bh=6zEYNA2Td8jkmMqw1SHsqThQUjXU+HkOqVe+AjUuSiQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kB41BAQZGu+QqCkI1Zo1XUtQaIiunYN2euIN8fNzbwWREZjoyduqttVPhplldn4TouQHfwRZWE/cQaGz86FDW9H2txOnXQDl1y0KGKyEd1TqzebcEYVto0P7/jjESTwktt0x6LBwcEo/RdrI30ee6ejqS15yCwBrUWMMg6RuzGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=KPuHccUg; arc=none smtp.client-ip=91.218.175.119 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="KPuHccUg" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=6zEYNA2Td8jkmMqw1SHsqThQUjXU+HkOqVe+AjUuSiQ=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347257; v=1; x=1788952057; b=KPuHccUgubl9NtkyU4s5FL9xDNbkUsmZdF9/EDzmhs/602NVVZQnSeGN+GIAi2DnM1EvrfTD YScSnIOzJnjK2oArJlUM5zSF/yZL8pZWiKujRHZVUJwfUxwXmGMZvj19SBirAP+7FVdHTfDwDXf KmjJdvEDsuZxKTJf1Knc3U0c= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta11.migadu.com with ESMTPS id 785d9323279932c3; Wed, 02 Sep 2026 11:07:37 +0000 X-Mizu-Trace-ID: 785d9323279932c3 X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:07:32 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 09/10] gpio: bd73800: Support ROHM BD73800 PMIC GPIOs Message-ID: <5eb294e68b8d5d2c1d3a12b14a55dd2a9c075a09.1788346553.git.mazziesaccount@gmail.com> Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="lZriLAE4o4ZjnyjS" Content-Disposition: inline In-Reply-To: --lZriLAE4o4ZjnyjS Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen The ROHM BD73800 PMIC has 4 pins (named GPIO1, CLKOUT, FAULT_B and EXTEN_OUT) which might have been set to operate as a GPI or GPO when OTP (One Time Programmable memory) is written at device manufacturing. Support the GPI/GPO use-case via GPIO framework. The default OTP for these pins is to not use any of them as GPI or GPO. (The GPIO1 defaults as an ADC input regardless the naming). Hence the driver assumes none of these pins is a GPI/GPO unless explicitly pointed as GPI or GPO via device tree. Furthermore, pin's direction can't be changed after OTP configuration is done. Also the default drive type for a GPO (CMOS / Open Drain) is set by the OTP configuration. The BD73800 has a set of undocumented test registers which should allow changing the drive type. Access to the test register area or the test registers aren't documented and so this driver does not support configuring the drive type even though it might be doable. Signed-off-by: Matti Vaittinen Acked-by: Bartosz Golaszewski Reviewed-by: Linus Walleij --- Revision history: v2 =3D> v3: - Use gpio-regmap as was suggested by Linus W. v1 =3D> v2: - Return -ENODEV when no GPIO pins are found - Drop useless comment - Use 'data' instead of 'g' as a name of the private data struct. Do so consistently (change also the 'bdgpio' to 'data'). - Use device_property_... instead of the fwnode_property_... - fix fault_b pin property name (re-use existing name) --- drivers/gpio/Kconfig | 12 +++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-bd73800.c | 209 ++++++++++++++++++++++++++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 drivers/gpio/gpio-bd73800.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index a48586bb8edb..64127740a248 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -1385,6 +1385,18 @@ config GPIO_BD72720 be configured to GPO on the ROHM PMIC. The pin configuration is done on OTP at manufacturing. =20 +config GPIO_BD73800 + tristate "ROHM BD73800 GPIO support" + depends on MFD_ROHM_BD71828 + select GPIO_REGMAP + help + Support for GPIOs on ROHM BD73800 PMIC. There can be up to 4 + GPI or GPO pins available on the PMIC in total. The purpose of + the pins is decided at the device manufacturing by OTP + configuration and can't be reconfigured later. Enable this + if your PMIC has pins set as GPIs or GPOs and if you wish to + control the pins via the GPIO framework. + config GPIO_BD9571MWV tristate "ROHM BD9571 GPIO support" depends on MFD_BD9571MWV diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index dc9e6d643b5b..dc5e0583e328 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_GPIO_BCM_XGS_IPROC) +=3D gpio-xgs-iproc.o obj-$(CONFIG_GPIO_BD71815) +=3D gpio-bd71815.o obj-$(CONFIG_GPIO_BD71828) +=3D gpio-bd71828.o obj-$(CONFIG_GPIO_BD72720) +=3D gpio-bd72720.o +obj-$(CONFIG_GPIO_BD73800) +=3D gpio-bd73800.o obj-$(CONFIG_GPIO_BD9571MWV) +=3D gpio-bd9571mwv.o obj-$(CONFIG_GPIO_BLZP1600) +=3D gpio-blzp1600.o obj-$(CONFIG_GPIO_BRCMSTB) +=3D gpio-brcmstb.o diff --git a/drivers/gpio/gpio-bd73800.c b/drivers/gpio/gpio-bd73800.c new file mode 100644 index 000000000000..824901859a61 --- /dev/null +++ b/drivers/gpio/gpio-bd73800.c @@ -0,0 +1,209 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Support to GPIOs on ROHM BD73800 + * Copyright 2024 ROHM Semiconductors. + * Author: Matti Vaittinen + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define BD73800_GPIO_MAX_PINS 4 +/* + * The BD73800 has several "one time programmable" (OTP) configurations wh= ich + * can be set at manufacturing phase. Some of these options allow using + * individual pins as GPI or GPO (not both at the same time). The OTP + * configuration can't be read at run-time, so drivers rely on device-tree= to + * advertise the OTP programmed in manufacturing. + * + * The pins which can be used as GPIO are: + * GPIO1, CLKOUT (GPIO2), FAULT_B, EXTEN_OUT. + * + * The OTP options 2 and 3 state for all the pins: + * - OTP2: GPI (also IRQ source) + * - OTP3: GPO (NOTE: This is actually 2 different OTP options. Either a + * register controllable output or a power-sequence controlled output. + * The "gpo" referred here means only the register controllable output.) + * The datasheet refers to this as: " output is controlled by + * GPIO_OUT or power on/off sequencer to control external VRs. ON/OFF + * sequence timing is configurable." + * + * The data-sheet further says that the GPI/GPO is not a default OTP + * configuration for any of the pins. Hence the GPIO driver defaults to a = pin + * not being a GPI or GPO, but requires the pin to be explicitly marked as= a + * GPI or GPO in the device-tree. + * + * DT properties: + * "rohm,pin-gpio1", "rohm,pin-clkout", "rohm,pin-fault_b", "rohm,pin-exte= n" + * can be set to one of the values "gpi" or "gpo" to enable them to be use= d as + * GPIO. + * + * The amount of GPIO lines the chip exposes to the user-space (chip.ngpio= ) is + * always the same, regardless of the OTP variant in use. The lines which = are + * not usable as GPIO on a given OTP variant are marked invalid via the GP= IO + * valid_mask. This way the user-space always sees a constant amount of GP= IO + * lines, where numbering (relative to the chip's base) stays also the sam= e. + * Users can then use the valid_mask to find out which of the lines are us= able. + */ + +struct bd73800_gpio { + /* dev points to the platform device for devm and prints */ + struct device *dev; + struct regmap *regmap; + /* Pins which have been OTP configured as GPI or GPO */ + DECLARE_BITMAP(valid_mask, BD73800_GPIO_MAX_PINS); + /* Subset of valid_mask - pins which have been OTP configured as GPO */ + DECLARE_BITMAP(output_mask, BD73800_GPIO_MAX_PINS); +}; + +static const char * const bd73800_gpio_properties[BD73800_GPIO_MAX_PINS] = =3D { + "rohm,pin-gpio1", "rohm,pin-clkout", "rohm,pin-fault_b", "rohm,pin-exten" +}; + +static int bd73800_gpio_get_pins(struct bd73800_gpio *data) +{ + struct device *parent =3D data->dev->parent; + const char *val; + int i, ret; + + for (i =3D 0; i < BD73800_GPIO_MAX_PINS; i++) { + ret =3D device_property_read_string(parent, + bd73800_gpio_properties[i], + &val); + if (ret) { + if (ret =3D=3D -EINVAL) + continue; + + return dev_err_probe(data->dev, ret, + "pin %d (%s), bad configuration\n", i, + bd73800_gpio_properties[i]); + } + + if (!strcmp(val, "gpi")) { + __set_bit(i, data->valid_mask); + } else if (!strcmp(val, "gpo")) { + __set_bit(i, data->valid_mask); + __set_bit(i, data->output_mask); + } else { + dev_warn(data->dev, + "pin %d (%s), unknown value '%s' ignored\n", i, + bd73800_gpio_properties[i], val); + } + } + + return 0; +} + +static int bd73800_gpio_init_valid_mask(struct gpio_chip *gc, + unsigned long *valid_mask, + unsigned int ngpios) +{ + struct gpio_regmap *gpio =3D gpiochip_get_data(gc); + struct bd73800_gpio *data =3D gpio_regmap_get_drvdata(gpio); + + bitmap_copy(valid_mask, data->valid_mask, ngpios); + + return 0; +} + +/* + * The used register depends on OTP: + * - If OTP has set pin as GPO, only the GPO_OUT register is valid. + * - If OTP has set pin as GPI, only the INT_5_SRC register is valid. + */ +static int bd73800_gpio_reg_mask_xlate(struct gpio_regmap *gpio, + enum gpio_regmap_operation op, + unsigned int base, unsigned int offset, + unsigned int *reg, unsigned int *mask) +{ + struct bd73800_gpio *data =3D gpio_regmap_get_drvdata(gpio); + bool is_output =3D test_bit(offset, data->output_mask); + + if (is_output) + *reg =3D BD73800_REG_GPO_OUT; + else + *reg =3D base; + + *mask =3D BIT(offset); + + return 0; +} + +static int gpo_bd73800_probe(struct platform_device *pdev) +{ + struct gpio_regmap_config config =3D { }; + struct bd73800_gpio *data; + struct device *parent, *dev; + struct gpio_regmap *gpio; + int ret; + + dev =3D &pdev->dev; + /* The device-tree and regmap come from MFD =3D> use parent for that */ + parent =3D dev->parent; + + data =3D devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->dev =3D dev; + data->regmap =3D dev_get_regmap(parent, NULL); + if (!data->regmap) + return dev_err_probe(dev, -ENODEV, "no parent regmap\n"); + + ret =3D bd73800_gpio_get_pins(data); + if (ret) + return ret; + + if (bitmap_empty(data->valid_mask, BD73800_GPIO_MAX_PINS)) { + /* + * The BD73800 may or may not have pins allocated for GPIO + * depending on the OTP used at manufacturing. + * If there are no pins, then we have nothing to do. + */ + dev_dbg(dev, "no GPIO pins\n"); + return -ENODEV; + } + + config.parent =3D parent; + config.regmap =3D data->regmap; + config.label =3D "bd73800"; + config.ngpio =3D BD73800_GPIO_MAX_PINS; + config.reg_dat_base =3D BD73800_REG_INT_5_SRC; + config.reg_set_base =3D BD73800_REG_GPO_OUT; + config.reg_mask_xlate =3D bd73800_gpio_reg_mask_xlate; + config.init_valid_mask =3D bd73800_gpio_init_valid_mask; + /* All pins that are valid GPIO lines also have a fixed direction */ + config.fixed_direction_mask =3D data->valid_mask; + config.fixed_direction_output =3D data->output_mask; + config.drvdata =3D data; + + gpio =3D devm_gpio_regmap_register(dev, &config); + + return PTR_ERR_OR_ZERO(gpio); +} + +static const struct platform_device_id bd73800_gpio_id[] =3D { + { "bd73800-gpio" }, + { }, +}; +MODULE_DEVICE_TABLE(platform, bd73800_gpio_id); + +static struct platform_driver gpo_bd73800_driver =3D { + .driver =3D { + .name =3D "bd73800-gpio", + .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, + }, + .probe =3D gpo_bd73800_probe, + .id_table =3D bd73800_gpio_id, +}; +module_platform_driver(gpo_bd73800_driver); + +MODULE_AUTHOR("Matti Vaittinen "); +MODULE_DESCRIPTION("GPIO interface for BD73800"); +MODULE_LICENSE("GPL"); --=20 2.55.0 --lZriLAE4o4ZjnyjS Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYA3QACgkQeFA3/03a ocUKMwf+ODC5Hwq02YB/5rNAOwKV83e+jqn8B8gw7QzB62LlHMwj7ItY+IJ5OIVT l5pX1tkwa7KifGn8mkRd30X/CuFjb9NGWsLTqqvcCGsNsE48iDbDrt7ZbpdrKbjQ 00FCK8ub7SSMI5c7MhDTFZDuQfWm7JgPO1fDQtITwZJHmzx4MyWatLTTeKRM71Pa opBJYZGFz+8Ry9Q0CO9NG9x++lLTB7o75b7uMm9Nj0xkqG72XRSvXV+iHI1oAFDA Q0nj4uA8Otk0KmZFlcY3ibpCMjB/92LvxHB3VGWqcu56gdkcyQqEl0Y4hmoXGY7O 8higJwzh1b5ixQSveWVOMBPn683BBw== =Ti9U -----END PGP SIGNATURE----- --lZriLAE4o4ZjnyjS-- From nobody Sat Sep 26 10:01:18 2026 Received: from mta0.migadu.com (out-133.mta0.migadu.com [91.218.175.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EAE7476CC0 for ; Wed, 2 Sep 2026 11:07:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347281; cv=none; b=b+qS7p3VbqJFyYwti8+pkFcP+889yYe18GZpK6oKwcABpe7tubl0mMeMnufPPd92H4weSGXo6lzc6RPP++IoHXrRHgMZPvtn2T8iwPPs+DWn5rEwwh/qy8Z+E8CW1YH/Ewd5DAfh/LnW6UD13YPauGKZm/Eo+FWWgGWT2dkVstU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788347281; c=relaxed/simple; bh=1HVX0QznIeEH3Yn+cjpqvVAEiGoY+5zL4TL1ple+vFo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pWgtGtCOXFtgWJfwIN6VpCL6S/wu4diVopSe/cMI3c1hUzuYn7kf8hntifQwQuEx1QILDNHe3UDWIeUrAdzJHrIGAU3rV2at6MiM8lNqLTsJsTFrSwMP/W/tMq45jlHvOLB1ctvdHTo/0U70vnADKau/kWrTGltVLilp5Z+U/D4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=lIDuz1Gp; arc=none smtp.client-ip=91.218.175.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="lIDuz1Gp" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=1HVX0QznIeEH3Yn+cjpqvVAEiGoY+5zL4TL1ple+vFo=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788347277; v=1; x=1788952077; b=lIDuz1GpVB3Kunsc4lviuvbGbpug/5XYyhoWAuqLYXy4V7rS/HDJUQAzfi0mitj1mpRH499n jtB2PxcBTgfImlIPpnQMtZqZxW1erAGQQxrUpwgJm44BeQdzTG6foqP/c+UqmbKqz1PVDOyUZrF 7q4lgWw6hDJI4V7fzgnGsaPI= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id b9341dd2beae2cd4; Wed, 02 Sep 2026 11:07:56 +0000 X-Mizu-Trace-ID: b9341dd2beae2cd4 X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Sep 2026 14:07:51 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen , Matti Vaittinen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Matti Vaittinen , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Alexandre Belloni , Michael Walle , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v3 10/10] MAINTAINERS: Add ROHM BD73800 PMIC files Message-ID: Reply-To: Matti Vaittinen References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0FeZEPMpasJlEgax" Content-Disposition: inline In-Reply-To: --0FeZEPMpasJlEgax Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matti Vaittinen Add the undersigned as a maintainer for the ROHM BD73800 PMIC related files. Signed-off-by: Matti Vaittinen --- Revision history: v1 =3D> : - No changes --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3a19da74d00c..b0925fa212cc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23821,6 +23821,7 @@ F: drivers/clk/clk-bd718x7.c F: drivers/gpio/gpio-bd71815.c F: drivers/gpio/gpio-bd71828.c F: drivers/gpio/gpio-bd72720.c +F: drivers/gpio/gpio-bd73800.c F: drivers/mfd/rohm-bd71828.c F: drivers/mfd/rohm-bd718x7.c F: drivers/mfd/rohm-bd9576.c @@ -23840,6 +23841,7 @@ F: include/linux/mfd/rohm-bd71815.h F: include/linux/mfd/rohm-bd71828.h F: include/linux/mfd/rohm-bd718x7.h F: include/linux/mfd/rohm-bd72720.h +F: include/linux/mfd/rohm-bd73800.h F: include/linux/mfd/rohm-bd957x.h F: include/linux/mfd/rohm-bd96801.h F: include/linux/mfd/rohm-bd96802.h --=20 2.55.0 --0FeZEPMpasJlEgax Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmqYA4cACgkQeFA3/03a ocXk7wf/fv7aGQBmrQLxOgHBApSHfBrtnLYfNs/PJK1KrLJgU82PQ1eosOVB42Id DdKz+lGmOMWd7FZbbT5NUnH7dQu8WScXrn0016aNsYpN13dhaUwZMacOAYfrcuQr ySclGtVBxKaF9fq8TF5H5XNdI6xZJ4odC0Zyz4pt1aoRayOGqgJvexsg2K3ckI2T rId4F/LihCnHT0n3eaSHFWl24J+flFCz//gUr8uA14ufig0gi9y73zceg+V28Qj9 QDkCe2kr5JRrMeGu0MpjZefGGP6dU9r2P5yzK9gs2vWZkbwGCO9u/09hLTGC6xgG wh88iMN5JnRl6ogCm1W1bzvHqtV8gg== =rFWO -----END PGP SIGNATURE----- --0FeZEPMpasJlEgax--