From patchwork Mon Oct 30 19:41:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 739361 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A72C1095C for ; Mon, 30 Oct 2023 19:41:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M3qlTjKd" Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21724E6; Mon, 30 Oct 2023 12:41:51 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2c509d5ab43so71058891fa.0; Mon, 30 Oct 2023 12:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698694909; x=1699299709; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=swATsRm/D/rD5LWbhxOgcaqNC48PvNHzrc6mwlQlkRo=; b=M3qlTjKddEF4Z/mI8X2qm40HWUlphyZvdII1BhLpn85ZJhWDwQ80hC1H/sV/JrHDpF yIOm6wTQ39KtN9KAKnOjQr/RJHijnjyOFqO0Jjvx8YEOJ/K3aMuuOINGUvaOlPysxLZy fiABquYSFiEEpi8fwI6LhGmg5qW+WzsDSsTDAOJ7vtjzv6HXbliU6kFS+kDXl9wsx5SO Iva5Mz7dmltFnFiezXONwwSdlGCBUc8B5bRzJcQIEI5NdEZydibk1PkWGuCTSa7+v0Xl mpTBCqh1p9lgJvW3arK5nIcHBrWL232sl8PxQ5qh3s158qlqZkDlVK9WRuWrjl/Cp0Iv d1gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698694909; x=1699299709; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=swATsRm/D/rD5LWbhxOgcaqNC48PvNHzrc6mwlQlkRo=; b=EmysLc4eAsFCS3xA1Z7VfZTcVHqH7yuEGNG1ydCAfcv2F21C7THpi6xDKV3Llt3AYa zY8WKTbCW/lk2CU1wspmM3RgWM+/5nuyo2PhJuPUs4EF07xEN97AMZN1fN1YkQ9I+2nB eEkBIlbc27rCwQpn+hlrfoHZ8hcJoImSuHsqg4sZ30TsfMoEceqRVp2Zpq/2g1IhH1vw QBJQLNU8OUbLKORJ9SJXX9Vf7vUnU5YySnC2FcYGC2456oHRjGLbNWkKJTc/LlPhjWzB lT9biEjXHan+o7/pod2HprLTSLlqUk0JDXrKEaRiusjHvykHxn++ymS+0yAzlY0CSioH x+2A== X-Gm-Message-State: AOJu0YxEW2CCRv/6/ZNYk249GWCYM9ixKIxVzDDwG97CyLSBVS8OPWZl t2DP3Mvj2JBtFUGOgOxFlg0= X-Google-Smtp-Source: AGHT+IHDjgogZloqvF0vTFY93o5pdCKouALhCREZfA40vWUlSo3ELseYviRwZ7oOCxUJTw0ha3c1Mw== X-Received: by 2002:a05:6512:1109:b0:4f8:714e:27a8 with SMTP id l9-20020a056512110900b004f8714e27a8mr9469763lfg.0.1698694909024; Mon, 30 Oct 2023 12:41:49 -0700 (PDT) Received: from hex.my.domain (83.11.208.51.ipv4.supernova.orange.pl. [83.11.208.51]) by smtp.gmail.com with ESMTPSA id m10-20020ac2428a000000b005057184ae62sm1527802lfh.96.2023.10.30.12.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 12:41:48 -0700 (PDT) From: Artur Weber Date: Mon, 30 Oct 2023 20:41:43 +0100 Subject: [PATCH v2 1/6] dt-bindings: mfd: brcm,bcm59056: Convert to YAML Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231030-bcm59054-v2-1-5fa4011aa5ba@gmail.com> References: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> In-Reply-To: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Liam Girdwood , Mark Brown Cc: Stanislav Jakubek , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Artur Weber X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698694906; l=4521; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=Y62BQBGtAcPv02Fu046rbEKVHmHWcxt/VeMRr4coqwE=; b=nx2q3J0EGQzhBlh4CNujQQbnjJb61qCJNAkQKsR4ky9V7rmn4T7KziV5xY9FTTpXm56BySP/+ MJ52RAUBHWrADwtKPq44YGhq1lav7wc3rBoleVHhkWMeAupfSYnw7G0 X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= Convert devicetree bindings for the Broadcom BCM59056 PMU MFD from TXT to YAML format. This patch does not change any functionality; the bindings remain the same. Signed-off-by: Artur Weber --- .../devicetree/bindings/mfd/brcm,bcm59056.txt | 39 ---------- .../devicetree/bindings/mfd/brcm,bcm59056.yaml | 91 ++++++++++++++++++++++ 2 files changed, 91 insertions(+), 39 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/brcm,bcm59056.txt b/Documentation/devicetree/bindings/mfd/brcm,bcm59056.txt deleted file mode 100644 index be51a15e05f9..000000000000 --- a/Documentation/devicetree/bindings/mfd/brcm,bcm59056.txt +++ /dev/null @@ -1,39 +0,0 @@ -------------------------------- -BCM590xx Power Management Units -------------------------------- - -Required properties: -- compatible: "brcm,bcm59056" -- reg: I2C slave address -- interrupts: interrupt for the PMU. Generic interrupt client node bindings - are described in interrupt-controller/interrupts.txt - ------------------- -Voltage Regulators ------------------- - -Optional child nodes: -- regulators: container node for regulators following the generic - regulator binding in regulator/regulator.txt - - The valid regulator node names for BCM59056 are: - rfldo, camldo1, camldo2, simldo1, simldo2, sdldo, sdxldo, - mmcldo1, mmcldo2, audldo, micldo, usbldo, vibldo, - csr, iosr1, iosr2, msr, sdsr1, sdsr2, vsr, - gpldo1, gpldo2, gpldo3, gpldo4, gpldo5, gpldo6, - vbus - -Example: - pmu: bcm59056@8 { - compatible = "brcm,bcm59056"; - reg = <0x08>; - interrupts = ; - regulators { - rfldo_reg: rfldo { - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3300000>; - }; - - ... - }; - }; diff --git a/Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml b/Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml new file mode 100644 index 000000000000..6d6acc9fd312 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml @@ -0,0 +1,91 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/brcm,bcm59056.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: BCM590xx Power Management Unit MFD + +maintainers: + - Artur Weber + +properties: + compatible: + enum: + - "brcm,bcm59056" + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + regulators: + type: object + description: Container node for regulators. + + # The valid regulator node names for BCM59056 are: + # rfldo, camldo1, camldo2, simldo1, simldo2, sdldo, sdxldo, + # mmcldo1, mmcldo2, audldo, micldo, usbldo, vibldo, + # csr, iosr1, iosr2, msr, sdsr1, sdsr2, vsr, + # gpldo1, gpldo2, gpldo3, gpldo4, gpldo5, gpldo6, + # vbus + patternProperties: + "^(cam|sim|mmc)ldo[1-2]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + + "^(rf|sd|sdx|aud|mic|usb|vib)ldo$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + + "^(c|m|v)sr$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + + "^(io|sd)sr[1-2]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + + "^gpldo[1-6]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + + properties: + "vbus": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmu: bcm59056@8 { + compatible = "brcm,bcm59056"; + reg = <0x08>; + interrupts = <0 215 IRQ_TYPE_LEVEL_HIGH>; + regulators { + rfldo_reg: rfldo { + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3300000>; + }; + }; + }; + }; From patchwork Mon Oct 30 19:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 739748 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15FAA1A719 for ; Mon, 30 Oct 2023 19:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ImmCauaL" Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C7B4BD; Mon, 30 Oct 2023 12:41:52 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-50930f126b1so113705e87.3; Mon, 30 Oct 2023 12:41:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698694910; x=1699299710; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rsTszCSXFvrVoDKYOUlX0fXU0RZFKqac+kUpQnY46h0=; b=ImmCauaL2cx0xUGr3e1n7HSNx3TmU2tI7WiAyvRQRDAhMtjJF4CGMAP7vdTNvQthqs +aJYDR/v0Ic+0Eofv41uUDMMMr1rX29KnyHz7bgifM7q3BJdTq5n4eE0UM/Rs12a7VwP M0yjfe/XbxroWjL0LppoU/tmSXic4DN5URoyPRjHL6BXv4jMnXhuU4Sc9/Bc2upsqx96 FvF+PJWJKSmSbOc+lxaHuEMWS1gmUUg2DmPi/lcUmgeeJ7/d49lgLpT1dx2vbiYT+g0X Ut3tdnkvVLu1pw0GoTCDxPxZn3qZf+QbZ2/fkVXOnEJw3X8P7wKpNyG8Ab4XGl+x0Sdz YA9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698694910; x=1699299710; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rsTszCSXFvrVoDKYOUlX0fXU0RZFKqac+kUpQnY46h0=; b=TdWwThTC2RQq6G3Bak8d3M3HNcyXCHsFRrwidV7a0jzJZc7MUb51Ant23vWqoQW9GP wal8D6LVi4XEB/Wm045ToxvdsEN7aBeWNxuoNdbpwLre96pDs8Gy8XPlKd7RsXtJVhAo VvkMTrL3RMYtGIiyFMGzpnBe2D+v1g10doVYPFA7xL9254eVCXab0d6LjFKx86CoYaBc 8a0woufT5xNi4Fw+R4xzDuixIArFSNKT/B/HP9GacJNqVlVJ80FEx7tdekKw2OeKpPgI 9/dGT81A/cCfzsWZ/InS08ZhNjKjpRWjOupHrAVBqemhAI152SjuOS125ZAa8dzv0y/b urFA== X-Gm-Message-State: AOJu0YyN3BG+bBs2vie4nmnXUunIkb2QlLbVNff08mAJutotUIBf4nTx cyqr2o7RrCqyQnvn2m8mmzZ0o8+n2U7LRg== X-Google-Smtp-Source: AGHT+IGYQoyMZ2H8yEcSdfZq8bBvetLhpTMgf6kX8yku45ElmdjlVHmmTYqp+in7EJYqqhmJszyYjQ== X-Received: by 2002:a05:6512:3683:b0:507:ba28:1bc5 with SMTP id d3-20020a056512368300b00507ba281bc5mr6645678lfs.3.1698694910355; Mon, 30 Oct 2023 12:41:50 -0700 (PDT) Received: from hex.my.domain (83.11.208.51.ipv4.supernova.orange.pl. [83.11.208.51]) by smtp.gmail.com with ESMTPSA id m10-20020ac2428a000000b005057184ae62sm1527802lfh.96.2023.10.30.12.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 12:41:50 -0700 (PDT) From: Artur Weber Date: Mon, 30 Oct 2023 20:41:44 +0100 Subject: [PATCH v2 2/6] dt-bindings: mfd: brcm,bcm59056: Add compatible for BCM59054 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231030-bcm59054-v2-2-5fa4011aa5ba@gmail.com> References: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> In-Reply-To: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Liam Girdwood , Mark Brown Cc: Stanislav Jakubek , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Artur Weber X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698694906; l=4952; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=J5qoqMtHdHEbtDpozL70617xHH15jYDWQN+WwVZOQIk=; b=LHx9ucpq3SWxJ6vasg2DPvwm7bIGrPH0ju2dTB62mEmMJUxxHVvKhNbmxUw6WbgWB7NDaVEsO 8Iyv36IpHN6Ba0VZxh/EHiNyjt6gM7KznFdrkZp6z73J+GV5eu0g4c+ X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= The BCM59054 MFD is fairly similar to the BCM59056, and will use the same driver. Add compatible and specify the allowed regulator nodes. Signed-off-by: Artur Weber --- .../devicetree/bindings/mfd/brcm,bcm59056.yaml | 125 +++++++++++++++------ 1 file changed, 88 insertions(+), 37 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml b/Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml index 6d6acc9fd312..5b5044867eca 100644 --- a/Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml +++ b/Documentation/devicetree/bindings/mfd/brcm,bcm59056.yaml @@ -12,6 +12,7 @@ maintainers: properties: compatible: enum: + - "brcm,bcm59054" - "brcm,bcm59056" reg: @@ -24,43 +25,93 @@ properties: type: object description: Container node for regulators. - # The valid regulator node names for BCM59056 are: - # rfldo, camldo1, camldo2, simldo1, simldo2, sdldo, sdxldo, - # mmcldo1, mmcldo2, audldo, micldo, usbldo, vibldo, - # csr, iosr1, iosr2, msr, sdsr1, sdsr2, vsr, - # gpldo1, gpldo2, gpldo3, gpldo4, gpldo5, gpldo6, - # vbus - patternProperties: - "^(cam|sim|mmc)ldo[1-2]$": - type: object - $ref: /schemas/regulator/regulator.yaml# - unevaluatedProperties: false - - "^(rf|sd|sdx|aud|mic|usb|vib)ldo$": - type: object - $ref: /schemas/regulator/regulator.yaml# - unevaluatedProperties: false - - "^(c|m|v)sr$": - type: object - $ref: /schemas/regulator/regulator.yaml# - unevaluatedProperties: false - - "^(io|sd)sr[1-2]$": - type: object - $ref: /schemas/regulator/regulator.yaml# - unevaluatedProperties: false - - "^gpldo[1-6]$": - type: object - $ref: /schemas/regulator/regulator.yaml# - unevaluatedProperties: false - - properties: - "vbus": - type: object - $ref: /schemas/regulator/regulator.yaml# - unevaluatedProperties: false +allOf: + - if: + properties: + compatible: + contains: + const: "brcm,bcm59056" + then: + properties: + regulators: + # The valid regulator node names for BCM59056 are: + # rfldo, camldo1, camldo2, simldo1, simldo2, sdldo, sdxldo, + # mmcldo1, mmcldo2, audldo, micldo, usbldo, vibldo, + # csr, iosr1, iosr2, msr, sdsr1, sdsr2, vsr, + # gpldo1, gpldo2, gpldo3, gpldo4, gpldo5, gpldo6, + # vbus + patternProperties: + "^(cam|sim|mmc)ldo[1-2]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + "^(rf|sd|sdx|aud|mic|usb|vib)ldo$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + "^(c|m|v)sr$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + "^(io|sd)sr[1-2]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + "^gpldo[1-6]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + properties: + "vbus": + type: object + $ref: /schemas/regulator/regulator.yaml# + + additionalProperties: false + + - if: + properties: + compatible: + contains: + const: "brcm,bcm59054" + then: + properties: + regulators: + # The valid regulator node names for BCM59054 are: + # rfldo, camldo1, camldo2, simldo1, simldo2, sdldo, sdxldo, + # mmcldo1, mmcldo2, audldo, micldo, usbldo, vibldo, + # csr, iosr1, iosr2, mmsr, sdsr1, sdsr2, vsr, + # gpldo1, gpldo2, gpldo3, tcxldo, lvldo1, lvldo2 + patternProperties: + "^(cam|sim|mmc)ldo[1-2]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + "^(rf|sd|sdx|aud|mic|usb|vib|tcx)ldo$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + "^(c|mm|v)sr$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + "^(io|sd)sr[1-2]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + "^gpldo[1-3]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + "^lvldo[1-2]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + + properties: + "vbus": + type: object + $ref: /schemas/regulator/regulator.yaml# + + additionalProperties: false required: - compatible From patchwork Mon Oct 30 19:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 739360 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7742D1A716 for ; Mon, 30 Oct 2023 19:41:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GbsBVjjy" Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEFCEE4; Mon, 30 Oct 2023 12:41:53 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-507bd19eac8so7042054e87.0; Mon, 30 Oct 2023 12:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698694912; x=1699299712; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3545GZ4rTilRPlMK6OENQjdsYfS2hQ9SURsOYUBvQmk=; b=GbsBVjjyOyzIskIWEeaalbRZE7qm+QeFubY9uQGYKm9iAVYvbeUQoJXkpSUOycQdIo O0ac9ffx4GtAWjODST59irQ+HgjGNWEMq2XINvt9IYpoz5vL41UoN5FbdL25NcCTZU9X bqNKUJcwkPVtYPn3CU2YNu8KAgzXews/g+it3oQfR1Js8YwobGUuqjInfZmbTHTmXL3N MJSjIIkh+FCHlKGqjrrdB+G+633JSFe+iT07/uvj+HORN/K+y03vQUDNK/Ib0onT6vqg KQ00CiQAFwDG3yo57mpOFjz9/vqbIDfZ46PaOA/qf7P6y4r3VsKRnNlA1OjMkrdhurfE b5uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698694912; x=1699299712; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3545GZ4rTilRPlMK6OENQjdsYfS2hQ9SURsOYUBvQmk=; b=uc+t/dJtYcvvxgmFXnAG1tlmVmOUS40uHe7ykCYc3hElBtNIsJg+To+Qb3P+3f+Flu aJS/St4sV/JVFieuT0+tDw1d1wvla38s3c4TA1p2LF3ISnj25IHHy1RtYGc67+Tqz6Ci Mn/XAogGeqVRDFg2Oh3WhXTBQanpgn76SZMTZQzw3CHXoafbOHsW26rXUKH3f74kXKcC BPtVVgFyUTT7degIoRT5Pj7TtAK2VBvRs4dF48UXdwPLtx5rUr9KSRYcnGNpwuQyq+xL vveFS6sFIgNboZOXGgnIppikZ06WlgiJXtDTwnFtv960/90Z2jgKYvHo30BS0USqjmkE hsCA== X-Gm-Message-State: AOJu0YzWHkD2zilcKqGHy2bJqqk6WKb6PBt5vM1gUxNJF79WR3FGFab1 BlTDHpQbai6T603Cqd7k2s4= X-Google-Smtp-Source: AGHT+IGWswxESjDHXYLTl5Cpnzaj8IEwQ99AVQmntdpTDHIAk6Pqzn4ikpab+YANcim3rmmp2FIGqA== X-Received: by 2002:a19:f80e:0:b0:500:7f71:e46b with SMTP id a14-20020a19f80e000000b005007f71e46bmr8209208lff.1.1698694911772; Mon, 30 Oct 2023 12:41:51 -0700 (PDT) Received: from hex.my.domain (83.11.208.51.ipv4.supernova.orange.pl. [83.11.208.51]) by smtp.gmail.com with ESMTPSA id m10-20020ac2428a000000b005057184ae62sm1527802lfh.96.2023.10.30.12.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 12:41:51 -0700 (PDT) From: Artur Weber Date: Mon, 30 Oct 2023 20:41:45 +0100 Subject: [PATCH v2 3/6] ARM: dts: Drop DTS for BCM59056 PMIC Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231030-bcm59054-v2-3-5fa4011aa5ba@gmail.com> References: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> In-Reply-To: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Liam Girdwood , Mark Brown Cc: Stanislav Jakubek , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Artur Weber X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698694906; l=3995; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=DBtpuYO/zr95rgnLU/rQbbV2xjIrUTq43L7BHBrPA9U=; b=HDu0zf8GfviM5rEV5zkbcvF2LUTvgWofykCLZFC+mAUEKB0AesBtIFkSJQRg/3R/1a1/uY2vW 2Lnqvief9jhAomuborD/4Csi+k8a/E1A0MHcWibrdbGm9siphhSAZMh X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= The BCM59056 PMIC has its own separate DTSI, meant to be included in a DTS file after defining the pmu node on some I2C bus. I'm not aware of many other devices that do this, and it seems very unintuitive. Drop the DTS in favor of adding the BCM59056 PMIC node directly into the device DTS files. Signed-off-by: Artur Weber --- arch/arm/boot/dts/broadcom/bcm28155-ap.dts | 68 +++++++++++----------- arch/arm/boot/dts/broadcom/bcm59056.dtsi | 91 ------------------------------ 2 files changed, 32 insertions(+), 127 deletions(-) diff --git a/arch/arm/boot/dts/broadcom/bcm28155-ap.dts b/arch/arm/boot/dts/broadcom/bcm28155-ap.dts index 2f3634545e64..cefaa9a3c45c 100644 --- a/arch/arm/boot/dts/broadcom/bcm28155-ap.dts +++ b/arch/arm/boot/dts/broadcom/bcm28155-ap.dts @@ -37,7 +37,39 @@ &pmu_bsc { status = "okay"; pmu: pmu@8 { + compatible = "brcm,bcm59056"; + interrupts = ; reg = <0x08>; + + regulators { + camldo1_reg: camldo1 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + sdldo_reg: sdldo { + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + }; + + sdxldo_reg: sdxldo { + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <3300000>; + }; + + usbldo_reg: usbldo { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + iosr1_reg: iosr1 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + }; }; }; @@ -74,39 +106,3 @@ &usbotg { &usbphy { status = "okay"; }; - -#include "bcm59056.dtsi" - -&pmu { - compatible = "brcm,bcm59056"; - interrupts = ; - regulators { - camldo1_reg: camldo1 { - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - }; - - sdldo_reg: sdldo { - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; - }; - - sdxldo_reg: sdxldo { - regulator-min-microvolt = <2700000>; - regulator-max-microvolt = <3300000>; - }; - - usbldo_reg: usbldo { - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - }; - - iosr1_reg: iosr1 { - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - regulator-always-on; - }; - }; -}; diff --git a/arch/arm/boot/dts/broadcom/bcm59056.dtsi b/arch/arm/boot/dts/broadcom/bcm59056.dtsi deleted file mode 100644 index a9bb7ad81378..000000000000 --- a/arch/arm/boot/dts/broadcom/bcm59056.dtsi +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* -* Copyright 2014 Linaro Limited -* Author: Matt Porter -*/ - -&pmu { - compatible = "brcm,bcm59056"; - regulators { - rfldo_reg: rfldo { - }; - - camldo1_reg: camldo1 { - }; - - camldo2_reg: camldo2 { - }; - - simldo1_reg: simldo1 { - }; - - simldo2_reg: simldo2 { - }; - - sdldo_reg: sdldo { - }; - - sdxldo_reg: sdxldo { - }; - - mmcldo1_reg: mmcldo1 { - }; - - mmcldo2_reg: mmcldo2 { - }; - - audldo_reg: audldo { - }; - - micldo_reg: micldo { - }; - - usbldo_reg: usbldo { - }; - - vibldo_reg: vibldo { - }; - - csr_reg: csr { - }; - - iosr1_reg: iosr1 { - }; - - iosr2_reg: iosr2 { - }; - - msr_reg: msr { - }; - - sdsr1_reg: sdsr1 { - }; - - sdsr2_reg: sdsr2 { - }; - - vsr_reg: vsr { - }; - - gpldo1_reg: gpldo1 { - }; - - gpldo2_reg: gpldo2 { - }; - - gpldo3_reg: gpldo3 { - }; - - gpldo4_reg: gpldo4 { - }; - - gpldo5_reg: gpldo5 { - }; - - gpldo6_reg: gpldo6 { - }; - - vbus_reg: vbus { - }; - }; -}; From patchwork Mon Oct 30 19:41:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 739747 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50F691A717 for ; Mon, 30 Oct 2023 19:41:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mrc6uIBm" Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCACCE6; Mon, 30 Oct 2023 12:41:54 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2c509d5ab43so71059591fa.0; Mon, 30 Oct 2023 12:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698694913; x=1699299713; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MVGWdNdmpu8vSibrYJC/RZxDG0iblOVJzHPyX+FabSU=; b=mrc6uIBmP1emLi+0hZsTg8ztrBSFZfqYs20yNqcrwcktkEVtqB79UfdhzARyXq2Ciy mnRuaPB3aNhgvxEQTmEtkvNRyJOnZlF4PTQiB6dYCB1hKWWYM6rywkI8WJcgzZ6Yt8ed 01Q1o65XJd7FxkWQh8gMpmRsyBfP48ZEVrfIzhfRHoxYR+oUMsyKIDMCK7HO/OlkxlQd /vs0LjJjnzh+qyQPUwEu1AuOlrZN7vX1G5YKPnbaDPh/sGljipVgpiNis7cDXoj5woJ6 JBkFvwtbOu4ilR1KDtYCOGvsUAntCd53VY9pbyUlbZmhVzUHpzU9z6CCgUHwSuAQOQxa zeAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698694913; x=1699299713; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MVGWdNdmpu8vSibrYJC/RZxDG0iblOVJzHPyX+FabSU=; b=Or/Q21sMuyWqgNe8oU36urrePCiTmvXnLTSDqm3WJ59cyAnALW/ToLJLqLrYcPBJ5y epLiYAvjv0vfyIO4DEsPjr7cnTOZjXrTUtisnyh9jr4ef4K9eeJ7j1ixEyb0jl0c9HI3 al/9By8UFE5ebZe3VWwlmXYBvWtyL1fhHpsqih0dozXJgJ04CA4X4IFvoLq7f/qZ5o8G upP8XjuCLxAC888fzAzUdC5M5yzwYUTKkw2FrZV/Wf2ehp/gpcOWE0EY7w/qWEkYskfc Sov7U1D0KZQPiyyfOQDtJJM3Nj8s7GN6eZIODx9//PJrZOiTBI088H/gMiu/sZCDf20T nMng== X-Gm-Message-State: AOJu0YxrDTobcAuu9j4Do1Bpz9O9OE+Cwf6nFRducgbT4ZbSCupRiXCC 4jWPosig15aTio5myGHOnrM= X-Google-Smtp-Source: AGHT+IG2fWFrzQ7B0lInjhmgmbToxPfdp7+yDm6KzfqHnJxQ2uEdEnXUVAgy07VZr7nveCyziVdYyA== X-Received: by 2002:ac2:55aa:0:b0:505:98a8:fa39 with SMTP id y10-20020ac255aa000000b0050598a8fa39mr7131537lfg.18.1698694913087; Mon, 30 Oct 2023 12:41:53 -0700 (PDT) Received: from hex.my.domain (83.11.208.51.ipv4.supernova.orange.pl. [83.11.208.51]) by smtp.gmail.com with ESMTPSA id m10-20020ac2428a000000b005057184ae62sm1527802lfh.96.2023.10.30.12.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 12:41:52 -0700 (PDT) From: Artur Weber Date: Mon, 30 Oct 2023 20:41:46 +0100 Subject: [PATCH v2 4/6] mfd: bcm590xx: Add compatible for BCM59054 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231030-bcm59054-v2-4-5fa4011aa5ba@gmail.com> References: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> In-Reply-To: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Liam Girdwood , Mark Brown Cc: Stanislav Jakubek , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Artur Weber X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698694906; l=1936; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=GaZAs1pHOm9g/5MXQbdGtce8n4JeiRhmO5EZ2BKjVhk=; b=AD/A0qChov9/UuR+aIEJvoDFuKb6QmCISZGXUmJiKCiDvIrqzPckzH/r1BjXFz0+orh2oldKb oaNuSd6xQuBALsUkb2Zqe1I8ORVi7y7c2fmGpP6RT8VIQpNkC9hgNzX X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= The BCM59056 supported by the bcm590xx driver is similar to the BCM59054 MFD. Add a compatible for it in the driver, in preparation for adding support for this chip in the bcm590xx regulator driver. Signed-off-by: Artur Weber --- drivers/mfd/bcm590xx.c | 5 ++++- include/linux/mfd/bcm590xx.h | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/bcm590xx.c b/drivers/mfd/bcm590xx.c index 92eede9a5e61..f5c5fa97ca9a 100644 --- a/drivers/mfd/bcm590xx.c +++ b/drivers/mfd/bcm590xx.c @@ -50,6 +50,8 @@ static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri) bcm590xx->dev = &i2c_pri->dev; bcm590xx->i2c_pri = i2c_pri; + bcm590xx->device_type = (unsigned int)of_device_get_match_data(bcm590xx->dev); + bcm590xx->regmap_pri = devm_regmap_init_i2c(i2c_pri, &bcm590xx_regmap_config_pri); if (IS_ERR(bcm590xx->regmap_pri)) { @@ -91,7 +93,8 @@ static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri) } static const struct of_device_id bcm590xx_of_match[] = { - { .compatible = "brcm,bcm59056" }, + { .compatible = "brcm,bcm59054", .data = (void *)BCM59054_TYPE }, + { .compatible = "brcm,bcm59056", .data = (void *)BCM59056_TYPE }, { } }; MODULE_DEVICE_TABLE(of, bcm590xx_of_match); diff --git a/include/linux/mfd/bcm590xx.h b/include/linux/mfd/bcm590xx.h index 6b8791da6119..ed0d8be6387c 100644 --- a/include/linux/mfd/bcm590xx.h +++ b/include/linux/mfd/bcm590xx.h @@ -13,12 +13,19 @@ #include #include +/* device types */ +enum { + BCM59054_TYPE, + BCM59056_TYPE, +}; + /* max register address */ #define BCM590XX_MAX_REGISTER_PRI 0xe7 #define BCM590XX_MAX_REGISTER_SEC 0xf0 struct bcm590xx { struct device *dev; + unsigned int device_type; struct i2c_client *i2c_pri; struct i2c_client *i2c_sec; struct regmap *regmap_pri; From patchwork Mon Oct 30 19:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 739746 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 868321A717 for ; Mon, 30 Oct 2023 19:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ezEuQAG7" Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A5A0FA; Mon, 30 Oct 2023 12:41:56 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50930f126b1so113764e87.3; Mon, 30 Oct 2023 12:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698694914; x=1699299714; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lar4q5BLMYdDXvaz2nduMcPI3LQymFQyRA6QLE+IUPA=; b=ezEuQAG78dFYDbgmWoNTMEmlazVoka1ZX3+B9wtfVhNm1kTubhDSVtGHH2WzryPqkt mIyWcrcBE1pqLocHcpUstmW528iOSIFkr/tn3MSu4WXd96Yq4numxIos6R2kcqCLf3Lz vzyt3I/C5Y3EVJM65ZAqUDu4VlOtHBFyI7TEsWWpG53MnJJEI4M4KDwON5pyOr9dv8ni YZYGv3AvWhUKs4kXZ+ARnbyjjKUIxUX2bD96og4ZLdTHk6xx2L/07sB0wyQ3WqwitIs0 ctFBmCysgdr/mbHszS/lWr80dDzXIk/57uzUT8TUwhMFKf8e3BAL6f4NKCJwEPKv1dC8 5hqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698694914; x=1699299714; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lar4q5BLMYdDXvaz2nduMcPI3LQymFQyRA6QLE+IUPA=; b=hFc5GW5sMrhRFCx1F4TdmULIsKEHYOajTlSH4MSrzAkLB8kfp1BiT4CfB1hTlPH9XN kj8+Q2kAnqKZzAzddCZG+6DLolu8OQ4Oh+FynAtJConzj47LnUducD/OINEYcr8J1yi8 IJkmWF/oe0R4Xt2Tg7yFZoIM3rARA6aVjGlz1iJfEkQtmQOTgYqCYuhL/+6IewZcspZV f4mcklTZnnmgaqISivAyjFLr4bIPmmR6KAj+UHAUYm5pN7ZB9cSAbKntmJyGHhpFcXQY r4eQQX+IlpOQUBhhVLq+R2j+YnOwgozpYOavwqeEg5avRxycMnHqosQKxo81T6AwLlet ThmA== X-Gm-Message-State: AOJu0YwPD79IbDYvyNbOI2JbBrsn7g2rUtwy9nspvHKVy/cSOhhabmpz 47R8Y/1Lt6zdluuyDCUy4ME= X-Google-Smtp-Source: AGHT+IH+3c0llFdOIqdvRFMxP4l3aG+SHTpOangVXSQK9c8H1rpB1Edje3c0vyxB5BwAnebEomqDfw== X-Received: by 2002:a19:9112:0:b0:503:2561:adbc with SMTP id t18-20020a199112000000b005032561adbcmr7309202lfd.64.1698694914471; Mon, 30 Oct 2023 12:41:54 -0700 (PDT) Received: from hex.my.domain (83.11.208.51.ipv4.supernova.orange.pl. [83.11.208.51]) by smtp.gmail.com with ESMTPSA id m10-20020ac2428a000000b005057184ae62sm1527802lfh.96.2023.10.30.12.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 12:41:54 -0700 (PDT) From: Artur Weber Date: Mon, 30 Oct 2023 20:41:47 +0100 Subject: [PATCH v2 5/6] regulator: bcm590xx: Add support for BCM59054 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231030-bcm59054-v2-5-5fa4011aa5ba@gmail.com> References: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> In-Reply-To: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Liam Girdwood , Mark Brown Cc: Stanislav Jakubek , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Artur Weber X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698694906; l=25592; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=Vcld9l2CUccXXlMEKsE/QRX28i7sxc2Cj+81kZnastM=; b=vNEL/nJ5tg2zZ09Wpqx0YFdPp6HrOb5rioB+TITbaS0ZPxsttDnPv+1NES3QWZv/HlqhJx6rq imSwO7rbcv8AdCkAFf0CHw8HXQkq06GVciubF04biqhkEtrOWjBzLJU X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= The BCM59054 is fairly similar in terms of regulators to the already supported BCM59056, as included in the BCM590XX driver. Add support for the BCM59054's regulators to the BCM590XX driver. Switch from using defines for common checks to using functions which return different values depending on the identified MFD model. While we're at it, fix a bug where the enable/vsel register offsets for GPLDO and LDO regulators were calculated incorrectly. Also, change the regulator enable bitmask to cover the entire PMMODE register. Signed-off-by: Artur Weber --- drivers/regulator/bcm590xx-regulator.c | 624 ++++++++++++++++++++++++--------- 1 file changed, 465 insertions(+), 159 deletions(-) diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c index 9f0cda46b015..8b90eae06ca6 100644 --- a/drivers/regulator/bcm590xx-regulator.c +++ b/drivers/regulator/bcm590xx-regulator.c @@ -18,37 +18,54 @@ #include #include +struct bcm590xx_info { + const char *name; + const char *vin_name; + u8 n_voltages; + const unsigned int *volt_table; + u8 n_linear_ranges; + const struct linear_range *linear_ranges; +}; + +struct bcm590xx_reg { + struct regulator_desc *desc; + struct bcm590xx *mfd; +}; + +#define BCM590XX_REG_ENABLE GENMASK(7, 0) +#define BCM590XX_REG_3BIT_ENABLE (GENMASK(4, 3) | GENMASK(1, 0)) +#define BCM590XX_VBUS_ENABLE BIT(2) +#define BCM590XX_LDO_VSEL_MASK GENMASK(5, 3) +#define BCM590XX_SR_VSEL_MASK GENMASK(5, 0) + +/* BCM59056 registers */ + /* I2C slave 0 registers */ -#define BCM590XX_RFLDOPMCTRL1 0x60 -#define BCM590XX_IOSR1PMCTRL1 0x7a -#define BCM590XX_IOSR2PMCTRL1 0x7c -#define BCM590XX_CSRPMCTRL1 0x7e -#define BCM590XX_SDSR1PMCTRL1 0x82 -#define BCM590XX_SDSR2PMCTRL1 0x86 -#define BCM590XX_MSRPMCTRL1 0x8a -#define BCM590XX_VSRPMCTRL1 0x8e -#define BCM590XX_RFLDOCTRL 0x96 -#define BCM590XX_CSRVOUT1 0xc0 +#define BCM59056_RFLDOPMCTRL1 0x60 +#define BCM59056_IOSR1PMCTRL1 0x7a +#define BCM59056_IOSR2PMCTRL1 0x7c +#define BCM59056_CSRPMCTRL1 0x7e +#define BCM59056_SDSR1PMCTRL1 0x82 +#define BCM59056_SDSR2PMCTRL1 0x86 +#define BCM59056_MSRPMCTRL1 0x8a +#define BCM59056_VSRPMCTRL1 0x8e +#define BCM59056_RFLDOCTRL 0x96 +#define BCM59056_CSRVOUT1 0xc0 /* I2C slave 1 registers */ -#define BCM590XX_GPLDO5PMCTRL1 0x16 -#define BCM590XX_GPLDO6PMCTRL1 0x18 -#define BCM590XX_GPLDO1CTRL 0x1a -#define BCM590XX_GPLDO2CTRL 0x1b -#define BCM590XX_GPLDO3CTRL 0x1c -#define BCM590XX_GPLDO4CTRL 0x1d -#define BCM590XX_GPLDO5CTRL 0x1e -#define BCM590XX_GPLDO6CTRL 0x1f -#define BCM590XX_OTG_CTRL 0x40 -#define BCM590XX_GPLDO1PMCTRL1 0x57 -#define BCM590XX_GPLDO2PMCTRL1 0x59 -#define BCM590XX_GPLDO3PMCTRL1 0x5b -#define BCM590XX_GPLDO4PMCTRL1 0x5d - -#define BCM590XX_REG_ENABLE BIT(7) -#define BCM590XX_VBUS_ENABLE BIT(2) -#define BCM590XX_LDO_VSEL_MASK GENMASK(5, 3) -#define BCM590XX_SR_VSEL_MASK GENMASK(5, 0) +#define BCM59056_GPLDO5PMCTRL1 0x16 +#define BCM59056_GPLDO6PMCTRL1 0x18 +#define BCM59056_GPLDO1CTRL 0x1a +#define BCM59056_GPLDO2CTRL 0x1b +#define BCM59056_GPLDO3CTRL 0x1c +#define BCM59056_GPLDO4CTRL 0x1d +#define BCM59056_GPLDO5CTRL 0x1e +#define BCM59056_GPLDO6CTRL 0x1f +#define BCM59056_OTG_CTRL 0x40 +#define BCM59056_GPLDO1PMCTRL1 0x57 +#define BCM59056_GPLDO2PMCTRL1 0x59 +#define BCM59056_GPLDO3PMCTRL1 0x5b +#define BCM59056_GPLDO4PMCTRL1 0x5d /* * RFLDO to VSR regulators are @@ -56,74 +73,69 @@ */ /* LDO regulator IDs */ -#define BCM590XX_REG_RFLDO 0 -#define BCM590XX_REG_CAMLDO1 1 -#define BCM590XX_REG_CAMLDO2 2 -#define BCM590XX_REG_SIMLDO1 3 -#define BCM590XX_REG_SIMLDO2 4 -#define BCM590XX_REG_SDLDO 5 -#define BCM590XX_REG_SDXLDO 6 -#define BCM590XX_REG_MMCLDO1 7 -#define BCM590XX_REG_MMCLDO2 8 -#define BCM590XX_REG_AUDLDO 9 -#define BCM590XX_REG_MICLDO 10 -#define BCM590XX_REG_USBLDO 11 -#define BCM590XX_REG_VIBLDO 12 +#define BCM59056_REG_RFLDO 0 +#define BCM59056_REG_CAMLDO1 1 +#define BCM59056_REG_CAMLDO2 2 +#define BCM59056_REG_SIMLDO1 3 +#define BCM59056_REG_SIMLDO2 4 +#define BCM59056_REG_SDLDO 5 +#define BCM59056_REG_SDXLDO 6 +#define BCM59056_REG_MMCLDO1 7 +#define BCM59056_REG_MMCLDO2 8 +#define BCM59056_REG_AUDLDO 9 +#define BCM59056_REG_MICLDO 10 +#define BCM59056_REG_USBLDO 11 +#define BCM59056_REG_VIBLDO 12 /* DCDC regulator IDs */ -#define BCM590XX_REG_CSR 13 -#define BCM590XX_REG_IOSR1 14 -#define BCM590XX_REG_IOSR2 15 -#define BCM590XX_REG_MSR 16 -#define BCM590XX_REG_SDSR1 17 -#define BCM590XX_REG_SDSR2 18 -#define BCM590XX_REG_VSR 19 +#define BCM59056_REG_CSR 13 +#define BCM59056_REG_IOSR1 14 +#define BCM59056_REG_IOSR2 15 +#define BCM59056_REG_MSR 16 +#define BCM59056_REG_SDSR1 17 +#define BCM59056_REG_SDSR2 18 +#define BCM59056_REG_VSR 19 /* * GPLDO1 to VBUS regulators are * accessed via I2C slave 1 */ -#define BCM590XX_REG_GPLDO1 20 -#define BCM590XX_REG_GPLDO2 21 -#define BCM590XX_REG_GPLDO3 22 -#define BCM590XX_REG_GPLDO4 23 -#define BCM590XX_REG_GPLDO5 24 -#define BCM590XX_REG_GPLDO6 25 -#define BCM590XX_REG_VBUS 26 - -#define BCM590XX_NUM_REGS 27 +#define BCM59056_REG_GPLDO1 20 +#define BCM59056_REG_GPLDO2 21 +#define BCM59056_REG_GPLDO3 22 +#define BCM59056_REG_GPLDO4 23 +#define BCM59056_REG_GPLDO5 24 +#define BCM59056_REG_GPLDO6 25 +#define BCM59056_REG_VBUS 26 -#define BCM590XX_REG_IS_LDO(n) (n < BCM590XX_REG_CSR) -#define BCM590XX_REG_IS_GPLDO(n) \ - ((n > BCM590XX_REG_VSR) && (n < BCM590XX_REG_VBUS)) -#define BCM590XX_REG_IS_VBUS(n) (n == BCM590XX_REG_VBUS) +#define BCM59056_NUM_REGS 27 /* LDO group A: supported voltages in microvolts */ -static const unsigned int ldo_a_table[] = { +static const unsigned int bcm59056_ldo_a_table[] = { 1200000, 1800000, 2500000, 2700000, 2800000, 2900000, 3000000, 3300000, }; /* LDO group C: supported voltages in microvolts */ -static const unsigned int ldo_c_table[] = { +static const unsigned int bcm59056_ldo_c_table[] = { 3100000, 1800000, 2500000, 2700000, 2800000, 2900000, 3000000, 3300000, }; -static const unsigned int ldo_vbus[] = { +static const unsigned int bcm59056_ldo_vbus[] = { 5000000, }; /* DCDC group CSR: supported voltages in microvolts */ -static const struct linear_range dcdc_csr_ranges[] = { +static const struct linear_range bcm59056_dcdc_csr_ranges[] = { REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), REGULATOR_LINEAR_RANGE(1360000, 51, 55, 20000), REGULATOR_LINEAR_RANGE(900000, 56, 63, 0), }; /* DCDC group IOSR1: supported voltages in microvolts */ -static const struct linear_range dcdc_iosr1_ranges[] = { +static const struct linear_range bcm59056_dcdc_iosr1_ranges[] = { REGULATOR_LINEAR_RANGE(860000, 2, 51, 10000), REGULATOR_LINEAR_RANGE(1500000, 52, 52, 0), REGULATOR_LINEAR_RANGE(1800000, 53, 53, 0), @@ -131,121 +143,404 @@ static const struct linear_range dcdc_iosr1_ranges[] = { }; /* DCDC group SDSR1: supported voltages in microvolts */ -static const struct linear_range dcdc_sdsr1_ranges[] = { +static const struct linear_range bcm59056_dcdc_sdsr1_ranges[] = { REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), REGULATOR_LINEAR_RANGE(1340000, 51, 51, 0), REGULATOR_LINEAR_RANGE(900000, 52, 63, 0), }; -struct bcm590xx_info { - const char *name; - const char *vin_name; - u8 n_voltages; - const unsigned int *volt_table; - u8 n_linear_ranges; - const struct linear_range *linear_ranges; +#define BCM59056_REG_TABLE(_name, _table) \ + { \ + .name = #_name, \ + .n_voltages = ARRAY_SIZE(bcm59056_##_table), \ + .volt_table = bcm59056_##_table, \ + } + +#define BCM59056_REG_RANGES(_name, _ranges) \ + { \ + .name = #_name, \ + .n_voltages = 64, \ + .n_linear_ranges = ARRAY_SIZE(bcm59056_##_ranges), \ + .linear_ranges = bcm59056_##_ranges, \ + } + +static struct bcm590xx_info bcm59056_regs[] = { + BCM59056_REG_TABLE(rfldo, ldo_a_table), + BCM59056_REG_TABLE(camldo1, ldo_c_table), + BCM59056_REG_TABLE(camldo2, ldo_c_table), + BCM59056_REG_TABLE(simldo1, ldo_a_table), + BCM59056_REG_TABLE(simldo2, ldo_a_table), + BCM59056_REG_TABLE(sdldo, ldo_c_table), + BCM59056_REG_TABLE(sdxldo, ldo_a_table), + BCM59056_REG_TABLE(mmcldo1, ldo_a_table), + BCM59056_REG_TABLE(mmcldo2, ldo_a_table), + BCM59056_REG_TABLE(audldo, ldo_a_table), + BCM59056_REG_TABLE(micldo, ldo_a_table), + BCM59056_REG_TABLE(usbldo, ldo_a_table), + BCM59056_REG_TABLE(vibldo, ldo_c_table), + BCM59056_REG_RANGES(csr, dcdc_csr_ranges), + BCM59056_REG_RANGES(iosr1, dcdc_iosr1_ranges), + BCM59056_REG_RANGES(iosr2, dcdc_iosr1_ranges), + BCM59056_REG_RANGES(msr, dcdc_iosr1_ranges), + BCM59056_REG_RANGES(sdsr1, dcdc_sdsr1_ranges), + BCM59056_REG_RANGES(sdsr2, dcdc_iosr1_ranges), + BCM59056_REG_RANGES(vsr, dcdc_iosr1_ranges), + BCM59056_REG_TABLE(gpldo1, ldo_a_table), + BCM59056_REG_TABLE(gpldo2, ldo_a_table), + BCM59056_REG_TABLE(gpldo3, ldo_a_table), + BCM59056_REG_TABLE(gpldo4, ldo_a_table), + BCM59056_REG_TABLE(gpldo5, ldo_a_table), + BCM59056_REG_TABLE(gpldo6, ldo_a_table), + BCM59056_REG_TABLE(vbus, ldo_vbus), +}; + +/* BCM59054 registers */ + +/* I2C slave 0 registers */ +#define BCM59054_RFLDOPMCTRL1 0x60 +#define BCM59054_IOSR1PMCTRL1 0x7a +#define BCM59054_IOSR2PMCTRL1 0x7c +#define BCM59054_CSRPMCTRL1 0x7e +#define BCM59054_SDSR1PMCTRL1 0x82 +#define BCM59054_SDSR2PMCTRL1 0x86 +#define BCM59054_MMSRPMCTRL1 0x8a +#define BCM59054_VSRPMCTRL1 0x8e +#define BCM59054_RFLDOCTRL 0x96 +#define BCM59054_CSRVOUT1 0xc0 + +/* I2C slave 1 registers */ +#define BCM59054_LVLDO1PMCTRL1 0x16 +#define BCM59054_LVLDO2PMCTRL1 0x18 +#define BCM59054_GPLDO1CTRL 0x1a +#define BCM59054_GPLDO2CTRL 0x1b +#define BCM59054_GPLDO3CTRL 0x1c +#define BCM59054_TCXLDOCTRL 0x1d +#define BCM59054_LVLDO1CTRL 0x1e +#define BCM59054_LVLDO2CTRL 0x1f +#define BCM59054_OTG_CTRL 0x40 +#define BCM59054_GPLDO1PMCTRL1 0x57 +#define BCM59054_GPLDO2PMCTRL1 0x59 +#define BCM59054_GPLDO3PMCTRL1 0x5b +#define BCM59054_TCXLDOPMCTRL1 0x5d + +/* + * RFLDO to VSR regulators are + * accessed via I2C slave 0 + */ + +/* LDO regulator IDs */ +#define BCM59054_REG_RFLDO 0 +#define BCM59054_REG_CAMLDO1 1 +#define BCM59054_REG_CAMLDO2 2 +#define BCM59054_REG_SIMLDO1 3 +#define BCM59054_REG_SIMLDO2 4 +#define BCM59054_REG_SDLDO 5 +#define BCM59054_REG_SDXLDO 6 +#define BCM59054_REG_MMCLDO1 7 +#define BCM59054_REG_MMCLDO2 8 +#define BCM59054_REG_AUDLDO 9 +#define BCM59054_REG_MICLDO 10 +#define BCM59054_REG_USBLDO 11 +#define BCM59054_REG_VIBLDO 12 + +/* DCDC regulator IDs */ +#define BCM59054_REG_CSR 13 +#define BCM59054_REG_IOSR1 14 +#define BCM59054_REG_IOSR2 15 +#define BCM59054_REG_MMSR 16 +#define BCM59054_REG_SDSR1 17 +#define BCM59054_REG_SDSR2 18 +#define BCM59054_REG_VSR 19 + +/* + * GPLDO1 to VBUS regulators are + * accessed via I2C slave 1 + */ + +#define BCM59054_REG_GPLDO1 20 +#define BCM59054_REG_GPLDO2 21 +#define BCM59054_REG_GPLDO3 22 +#define BCM59054_REG_TCXLDO 23 +#define BCM59054_REG_LVLDO1 24 +#define BCM59054_REG_LVLDO2 25 +#define BCM59054_REG_VBUS 26 + +#define BCM59054_NUM_REGS 27 + +/* LDO group 1: supported voltages in microvolts */ +static const unsigned int bcm59054_ldo_1_table[] = { + 1200000, 1800000, 2500000, 2700000, 2800000, + 2900000, 3000000, 3300000, +}; + +/* LDO group 2: supported voltages in microvolts */ +static const unsigned int bcm59054_ldo_2_table[] = { + 3100000, 1800000, 2500000, 2700000, 2800000, + 2900000, 3000000, 3300000, +}; + +/* LDO group 3: supported voltages in microvolts */ +static const unsigned int bcm59054_ldo_3_table[] = { + 1000000, 1107000, 1143000, 1214000, 1250000, + 1464000, 1500000, 1786000, +}; + +static const unsigned int bcm59054_ldo_vbus[] = { + 5000000, +}; + +/* DCDC group SR: supported voltages in microvolts */ +static const struct linear_range bcm59054_dcdc_sr_ranges[] = { + REGULATOR_LINEAR_RANGE(0, 0, 1, 0), + REGULATOR_LINEAR_RANGE(860000, 2, 60, 10000), + REGULATOR_LINEAR_RANGE(1500000, 61, 61, 0), + REGULATOR_LINEAR_RANGE(1800000, 62, 62, 0), + REGULATOR_LINEAR_RANGE(900000, 63, 63, 0), +}; + +/* DCDC group VSR: supported voltages in microvolts */ +static const struct linear_range bcm59054_dcdc_vsr_ranges[] = { + REGULATOR_LINEAR_RANGE(0, 0, 1, 0), + REGULATOR_LINEAR_RANGE(860000, 2, 59, 10000), + REGULATOR_LINEAR_RANGE(1700000, 60, 60, 0), + REGULATOR_LINEAR_RANGE(1500000, 61, 61, 0), + REGULATOR_LINEAR_RANGE(1800000, 62, 62, 0), + REGULATOR_LINEAR_RANGE(1600000, 63, 63, 0), }; -#define BCM590XX_REG_TABLE(_name, _table) \ +/* DCDC group CSR: supported voltages in microvolts */ +static const struct linear_range bcm59054_dcdc_csr_ranges[] = { + REGULATOR_LINEAR_RANGE(700000, 0, 1, 100000), + REGULATOR_LINEAR_RANGE(860000, 2, 60, 10000), + REGULATOR_LINEAR_RANGE(900000, 61, 63, 0), +}; + +#define BCM59054_REG_TABLE(_name, _table) \ { \ .name = #_name, \ - .n_voltages = ARRAY_SIZE(_table), \ - .volt_table = _table, \ + .n_voltages = ARRAY_SIZE(bcm59054_##_table), \ + .volt_table = bcm59054_##_table, \ } -#define BCM590XX_REG_RANGES(_name, _ranges) \ +#define BCM59054_REG_RANGES(_name, _ranges) \ { \ .name = #_name, \ .n_voltages = 64, \ - .n_linear_ranges = ARRAY_SIZE(_ranges), \ - .linear_ranges = _ranges, \ + .n_linear_ranges = ARRAY_SIZE(bcm59054_##_ranges), \ + .linear_ranges = bcm59054_##_ranges, \ } -static struct bcm590xx_info bcm590xx_regs[] = { - BCM590XX_REG_TABLE(rfldo, ldo_a_table), - BCM590XX_REG_TABLE(camldo1, ldo_c_table), - BCM590XX_REG_TABLE(camldo2, ldo_c_table), - BCM590XX_REG_TABLE(simldo1, ldo_a_table), - BCM590XX_REG_TABLE(simldo2, ldo_a_table), - BCM590XX_REG_TABLE(sdldo, ldo_c_table), - BCM590XX_REG_TABLE(sdxldo, ldo_a_table), - BCM590XX_REG_TABLE(mmcldo1, ldo_a_table), - BCM590XX_REG_TABLE(mmcldo2, ldo_a_table), - BCM590XX_REG_TABLE(audldo, ldo_a_table), - BCM590XX_REG_TABLE(micldo, ldo_a_table), - BCM590XX_REG_TABLE(usbldo, ldo_a_table), - BCM590XX_REG_TABLE(vibldo, ldo_c_table), - BCM590XX_REG_RANGES(csr, dcdc_csr_ranges), - BCM590XX_REG_RANGES(iosr1, dcdc_iosr1_ranges), - BCM590XX_REG_RANGES(iosr2, dcdc_iosr1_ranges), - BCM590XX_REG_RANGES(msr, dcdc_iosr1_ranges), - BCM590XX_REG_RANGES(sdsr1, dcdc_sdsr1_ranges), - BCM590XX_REG_RANGES(sdsr2, dcdc_iosr1_ranges), - BCM590XX_REG_RANGES(vsr, dcdc_iosr1_ranges), - BCM590XX_REG_TABLE(gpldo1, ldo_a_table), - BCM590XX_REG_TABLE(gpldo2, ldo_a_table), - BCM590XX_REG_TABLE(gpldo3, ldo_a_table), - BCM590XX_REG_TABLE(gpldo4, ldo_a_table), - BCM590XX_REG_TABLE(gpldo5, ldo_a_table), - BCM590XX_REG_TABLE(gpldo6, ldo_a_table), - BCM590XX_REG_TABLE(vbus, ldo_vbus), +static struct bcm590xx_info bcm59054_regs[] = { + BCM59054_REG_TABLE(rfldo, ldo_1_table), + BCM59054_REG_TABLE(camldo1, ldo_2_table), + BCM59054_REG_TABLE(camldo2, ldo_2_table), + BCM59054_REG_TABLE(simldo1, ldo_1_table), + BCM59054_REG_TABLE(simldo2, ldo_1_table), + BCM59054_REG_TABLE(sdldo, ldo_2_table), + BCM59054_REG_TABLE(sdxldo, ldo_1_table), + BCM59054_REG_TABLE(mmcldo1, ldo_1_table), + BCM59054_REG_TABLE(mmcldo2, ldo_1_table), + BCM59054_REG_TABLE(audldo, ldo_1_table), + BCM59054_REG_TABLE(micldo, ldo_1_table), + BCM59054_REG_TABLE(usbldo, ldo_1_table), + BCM59054_REG_TABLE(vibldo, ldo_2_table), + BCM59054_REG_RANGES(csr, dcdc_csr_ranges), + BCM59054_REG_RANGES(iosr1, dcdc_sr_ranges), + BCM59054_REG_RANGES(iosr2, dcdc_sr_ranges), + BCM59054_REG_RANGES(mmsr, dcdc_sr_ranges), + BCM59054_REG_RANGES(sdsr1, dcdc_sr_ranges), + BCM59054_REG_RANGES(sdsr2, dcdc_sr_ranges), + BCM59054_REG_RANGES(vsr, dcdc_vsr_ranges), + BCM59054_REG_TABLE(gpldo1, ldo_1_table), + BCM59054_REG_TABLE(gpldo2, ldo_1_table), + BCM59054_REG_TABLE(gpldo3, ldo_1_table), + BCM59054_REG_TABLE(tcxldo, ldo_1_table), + BCM59054_REG_TABLE(lvldo1, ldo_3_table), + BCM59054_REG_TABLE(lvldo2, ldo_3_table), + BCM59054_REG_TABLE(vbus, ldo_vbus), }; -struct bcm590xx_reg { - struct regulator_desc *desc; - struct bcm590xx *mfd; -}; +static int bcm590xx_reg_is_ldo(struct bcm590xx_reg *pmu, int id) +{ + switch (pmu->mfd->device_type) { + case BCM59054_TYPE: + return (id < BCM59054_REG_CSR); + case BCM59056_TYPE: + return (id < BCM59056_REG_CSR); + } + return -EINVAL; +} -static int bcm590xx_get_vsel_register(int id) +static int bcm590xx_reg_is_gpldo(struct bcm590xx_reg *pmu, int id) { - if (BCM590XX_REG_IS_LDO(id)) - return BCM590XX_RFLDOCTRL + id; - else if (BCM590XX_REG_IS_GPLDO(id)) - return BCM590XX_GPLDO1CTRL + id; - else - return BCM590XX_CSRVOUT1 + (id - BCM590XX_REG_CSR) * 3; + switch (pmu->mfd->device_type) { + case BCM59054_TYPE: + return ((id > BCM59054_REG_VSR) && (id < BCM59054_REG_VBUS)); + case BCM59056_TYPE: + return ((id > BCM59056_REG_VSR) && (id < BCM59056_REG_VBUS)); + } + return -EINVAL; +} + +static int bcm590xx_reg_is_vbus(struct bcm590xx_reg *pmu, int id) +{ + switch (pmu->mfd->device_type) { + case BCM59054_TYPE: + return (id == BCM59054_REG_VBUS); + case BCM59056_TYPE: + return (id == BCM59056_REG_VBUS); + } + return -EINVAL; +} + +static int bcm590xx_reg_is_static(struct bcm590xx_reg *pmu, int id) +{ + return bcm590xx_reg_is_vbus(pmu, id); +} + +static int bcm590xx_reg_is_secondary(struct bcm590xx_reg *pmu, int id) +{ + switch (pmu->mfd->device_type) { + case BCM59054_TYPE: + return (bcm590xx_reg_is_gpldo(pmu, id) || \ + id == BCM59054_REG_VBUS); + case BCM59056_TYPE: + return (bcm590xx_reg_is_gpldo(pmu, id) || \ + id == BCM59056_REG_VBUS); + } + return -EINVAL; +} + +static int bcm590xx_reg_mode_is_3bit(struct bcm590xx_reg *pmu, int id) +{ + switch (pmu->mfd->device_type) { + case BCM59054_TYPE: + return (id == BCM59054_REG_CSR || \ + (id > BCM59054_REG_IOSR2 && id < BCM59054_REG_GPLDO1)); + case BCM59056_TYPE: + return false; + } + return -EINVAL; +} + +static int bcm590xx_get_vsel_register(struct bcm590xx_reg *pmu, int id) +{ + switch (pmu->mfd->device_type) { + case BCM59054_TYPE: + if (bcm590xx_reg_is_ldo(pmu, id)) + return BCM59054_RFLDOCTRL + (id - BCM59054_REG_RFLDO); + else if (bcm590xx_reg_is_gpldo(pmu, id)) + return BCM59054_GPLDO1CTRL + (id - BCM59054_REG_GPLDO1); + else + return BCM59054_CSRVOUT1 + (id - BCM59054_REG_CSR) * 3; + case BCM59056_TYPE: + if (bcm590xx_reg_is_ldo(pmu, id)) + return BCM59056_RFLDOCTRL + (id - BCM59056_REG_RFLDO); + else if (bcm590xx_reg_is_gpldo(pmu, id)) + return BCM59056_GPLDO1CTRL + (id - BCM59056_REG_GPLDO1); + else + return BCM59056_CSRVOUT1 + (id - BCM59056_REG_CSR) * 3; + } + return -EINVAL; } -static int bcm590xx_get_enable_register(int id) +static int bcm59054_get_enable_register(struct bcm590xx_reg *pmu, int id) { int reg = 0; - if (BCM590XX_REG_IS_LDO(id)) - reg = BCM590XX_RFLDOPMCTRL1 + id * 2; - else if (BCM590XX_REG_IS_GPLDO(id)) - reg = BCM590XX_GPLDO1PMCTRL1 + id * 2; + if (bcm590xx_reg_is_ldo(pmu, id)) + reg = BCM59054_RFLDOPMCTRL1 + (id - BCM59054_REG_RFLDO) * 2; + else if (bcm590xx_reg_is_gpldo(pmu, id)) + reg = BCM59054_GPLDO1PMCTRL1 + (id - BCM59054_REG_GPLDO1) * 2; else switch (id) { - case BCM590XX_REG_CSR: - reg = BCM590XX_CSRPMCTRL1; + case BCM59054_REG_VSR: + reg = BCM59054_VSRPMCTRL1; break; - case BCM590XX_REG_IOSR1: - reg = BCM590XX_IOSR1PMCTRL1; + case BCM59054_REG_CSR: + reg = BCM59054_CSRPMCTRL1; break; - case BCM590XX_REG_IOSR2: - reg = BCM590XX_IOSR2PMCTRL1; + case BCM59054_REG_MMSR: + reg = BCM59054_MMSRPMCTRL1; break; - case BCM590XX_REG_MSR: - reg = BCM590XX_MSRPMCTRL1; + case BCM59054_REG_SDSR1: + reg = BCM59054_SDSR1PMCTRL1; break; - case BCM590XX_REG_SDSR1: - reg = BCM590XX_SDSR1PMCTRL1; + case BCM59054_REG_SDSR2: + reg = BCM59054_SDSR2PMCTRL1; break; - case BCM590XX_REG_SDSR2: - reg = BCM590XX_SDSR2PMCTRL1; + case BCM59054_REG_IOSR1: + reg = BCM59054_IOSR1PMCTRL1; break; - case BCM590XX_REG_VSR: - reg = BCM590XX_VSRPMCTRL1; + case BCM59054_REG_IOSR2: + reg = BCM59054_IOSR2PMCTRL1; break; - case BCM590XX_REG_VBUS: - reg = BCM590XX_OTG_CTRL; + case BCM59054_REG_VBUS: + reg = BCM59054_OTG_CTRL; break; } + return reg; +} + +static int bcm59056_get_enable_register(struct bcm590xx_reg *pmu, int id) +{ + int reg = 0; + + if (bcm590xx_reg_is_ldo(pmu, id)) + reg = BCM59056_RFLDOPMCTRL1 + (id - BCM59056_REG_RFLDO) * 2; + else if (bcm590xx_reg_is_gpldo(pmu, id)) + reg = BCM59056_GPLDO1PMCTRL1 + (id - BCM59056_REG_GPLDO1) * 2; + else + switch (id) { + case BCM59056_REG_CSR: + reg = BCM59056_CSRPMCTRL1; + break; + case BCM59056_REG_IOSR1: + reg = BCM59056_IOSR1PMCTRL1; + break; + case BCM59056_REG_IOSR2: + reg = BCM59056_IOSR2PMCTRL1; + break; + case BCM59056_REG_MSR: + reg = BCM59056_MSRPMCTRL1; + break; + case BCM59056_REG_SDSR1: + reg = BCM59056_SDSR1PMCTRL1; + break; + case BCM59056_REG_SDSR2: + reg = BCM59056_SDSR2PMCTRL1; + break; + case BCM59056_REG_VSR: + reg = BCM59056_VSRPMCTRL1; + break; + case BCM59056_REG_VBUS: + reg = BCM59056_OTG_CTRL; + break; + } return reg; } +static int bcm590xx_get_enable_register(struct bcm590xx_reg *pmu, int id) +{ + switch (pmu->mfd->device_type) { + case BCM59054_TYPE: + return bcm59054_get_enable_register(pmu, id); + case BCM59056_TYPE: + return bcm59056_get_enable_register(pmu, id); + } + return -EINVAL; +} + +static int bcm590xx_get_enable_mask(struct bcm590xx_reg *pmu, int id) +{ + if (bcm590xx_reg_mode_is_3bit(pmu, id)) + return BCM590XX_REG_3BIT_ENABLE; + + return BCM590XX_REG_ENABLE; +} + static const struct regulator_ops bcm590xx_ops_ldo = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, @@ -266,7 +561,7 @@ static const struct regulator_ops bcm590xx_ops_dcdc = { .map_voltage = regulator_map_voltage_linear_range, }; -static const struct regulator_ops bcm590xx_ops_vbus = { +static const struct regulator_ops bcm590xx_ops_static = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, @@ -279,6 +574,7 @@ static int bcm590xx_probe(struct platform_device *pdev) struct regulator_config config = { }; struct bcm590xx_info *info; struct regulator_dev *rdev; + int n_regulators; int i; pmu = devm_kzalloc(&pdev->dev, sizeof(*pmu), GFP_KERNEL); @@ -289,17 +585,23 @@ static int bcm590xx_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pmu); + if (pmu->mfd->device_type == BCM59054_TYPE) { + info = bcm59054_regs; + n_regulators = BCM59054_NUM_REGS; + } else if (pmu->mfd->device_type == BCM59056_TYPE) { + info = bcm59056_regs; + n_regulators = BCM59056_NUM_REGS; + } + pmu->desc = devm_kcalloc(&pdev->dev, - BCM590XX_NUM_REGS, + n_regulators, sizeof(struct regulator_desc), GFP_KERNEL); if (!pmu->desc) return -ENOMEM; - info = bcm590xx_regs; - - for (i = 0; i < BCM590XX_NUM_REGS; i++, info++) { - /* Register the regulators */ + /* Register the regulators */ + for (i = 0; i < n_regulators; i++, info++) { pmu->desc[i].name = info->name; pmu->desc[i].of_match = of_match_ptr(info->name); pmu->desc[i].regulators_node = of_match_ptr("regulators"); @@ -310,33 +612,37 @@ static int bcm590xx_probe(struct platform_device *pdev) pmu->desc[i].linear_ranges = info->linear_ranges; pmu->desc[i].n_linear_ranges = info->n_linear_ranges; - if ((BCM590XX_REG_IS_LDO(i)) || (BCM590XX_REG_IS_GPLDO(i))) { + if (bcm590xx_reg_is_ldo(pmu, i) || \ + bcm590xx_reg_is_gpldo(pmu, i)) { pmu->desc[i].ops = &bcm590xx_ops_ldo; pmu->desc[i].vsel_mask = BCM590XX_LDO_VSEL_MASK; - } else if (BCM590XX_REG_IS_VBUS(i)) - pmu->desc[i].ops = &bcm590xx_ops_vbus; - else { + } else if (bcm590xx_reg_is_static(pmu, i)) { + pmu->desc[i].ops = &bcm590xx_ops_static; + } else { pmu->desc[i].ops = &bcm590xx_ops_dcdc; pmu->desc[i].vsel_mask = BCM590XX_SR_VSEL_MASK; } - if (BCM590XX_REG_IS_VBUS(i)) + if (bcm590xx_reg_is_vbus(pmu, i)) { pmu->desc[i].enable_mask = BCM590XX_VBUS_ENABLE; - else { - pmu->desc[i].vsel_reg = bcm590xx_get_vsel_register(i); + } else { + pmu->desc[i].vsel_reg = \ + bcm590xx_get_vsel_register(pmu, i); + pmu->desc[i].enable_mask = \ + bcm590xx_get_enable_mask(pmu, i); pmu->desc[i].enable_is_inverted = true; - pmu->desc[i].enable_mask = BCM590XX_REG_ENABLE; } - pmu->desc[i].enable_reg = bcm590xx_get_enable_register(i); + pmu->desc[i].enable_reg = \ + bcm590xx_get_enable_register(pmu, i); pmu->desc[i].type = REGULATOR_VOLTAGE; pmu->desc[i].owner = THIS_MODULE; - config.dev = bcm590xx->dev; + config.dev = pmu->mfd->dev; config.driver_data = pmu; - if (BCM590XX_REG_IS_GPLDO(i) || BCM590XX_REG_IS_VBUS(i)) - config.regmap = bcm590xx->regmap_sec; + if (bcm590xx_reg_is_secondary(pmu, i)) + config.regmap = pmu->mfd->regmap_sec; else - config.regmap = bcm590xx->regmap_pri; + config.regmap = pmu->mfd->regmap_pri; rdev = devm_regulator_register(&pdev->dev, &pmu->desc[i], &config); From patchwork Mon Oct 30 19:41:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 739359 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2B0A1A716 for ; Mon, 30 Oct 2023 19:42:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mDMD1tUa" Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B25FE10A; Mon, 30 Oct 2023 12:41:57 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-507962561adso7107470e87.0; Mon, 30 Oct 2023 12:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698694916; x=1699299716; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nV4Ai08tkpOWFMEbSJPptM95Z5+f/6Xg1fGxclm9cNA=; b=mDMD1tUatcmH3j4c80jPFQ3s2sCeTlmfISC2YbY2GexRO/6liIPwaKY0TD06xtW3+o CE0BarUN6zkoPm/QgJbrzdcKRyQb20htth0Q3cBdnjHcN7d84QVsJcx7d28ZtUXc4HhW ObBnebXDlTF0h1Ak6kT/9egDygdR1RXt3eO8PbBPoQl/0eUeRKNaNpA7rzDcC+L+qAYU FLl6GElzDvKxyHJduuLIgxixwcuhVELMqvGwFqv7vT2HW1XUil0d5RS45mGtoluYMtvm TCIdzkeXG/XJotvHMNKaGgAAyLmhbE2zL1aYF1x/vb0dPoxCn1/DKToFmtsMmZViM5z6 +p4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698694916; x=1699299716; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nV4Ai08tkpOWFMEbSJPptM95Z5+f/6Xg1fGxclm9cNA=; b=ejQYkBXhQdCYTexYeaNCc62HTmb0kZoyE8xmw6IwK/H5jEo2pLZbLOYZT8Ft5UXOuk tA+6aFvAOc2tYNJwdnRfXXz4F8XTZJevDhWV/Kbq/rt5QUoWVBHS1Vj5gFNB/pAVt0hT uaI7LQUo0XZvk3xONzGCAudK9xYPFA5DmKdgFjVdMzwJao948Wk1ogW9GF8ul4CoflbQ MrZHWGphYPxQnq8bOu2QUnUhyp/oK1jmRZTZ0XP2Vb4Ufa5Hcyn/YaaRcbGP7Yk2yVol 4UuUVD0gT9aJjeUG+2yEP1bH67g9eX+CBZw70KlItgEejRt/cBbSs+cHU4wvBHX42JVu IW/g== X-Gm-Message-State: AOJu0YyYjg76ONKlAsFgA8xFXflkNZqBC4aYf4nxu5PxOwv0bOGloFAE przOX5xVCLS3bts6TLfLS20= X-Google-Smtp-Source: AGHT+IGlIeZzyq3CXKnAFKiUZLlTEcTypiCnxmVZUhW20jITO9bthnPr+fPPYDRtfYBZCJdUShAiFA== X-Received: by 2002:a19:ad44:0:b0:4fb:9f93:365f with SMTP id s4-20020a19ad44000000b004fb9f93365fmr7587568lfd.38.1698694915815; Mon, 30 Oct 2023 12:41:55 -0700 (PDT) Received: from hex.my.domain (83.11.208.51.ipv4.supernova.orange.pl. [83.11.208.51]) by smtp.gmail.com with ESMTPSA id m10-20020ac2428a000000b005057184ae62sm1527802lfh.96.2023.10.30.12.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 12:41:55 -0700 (PDT) From: Artur Weber Date: Mon, 30 Oct 2023 20:41:48 +0100 Subject: [PATCH v2 6/6] regulator: bcm590xx: Add proper handling for PMMODE registers Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231030-bcm59054-v2-6-5fa4011aa5ba@gmail.com> References: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> In-Reply-To: <20231030-bcm59054-v2-0-5fa4011aa5ba@gmail.com> To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Liam Girdwood , Mark Brown Cc: Stanislav Jakubek , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Artur Weber X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698694906; l=6532; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=MOr6P062Hw1cr9IL31CLgUIsSEz/SzMD3p5bHJ1QOHY=; b=kLCeoKqnWrubrHw320soyDTW4OEXc3S5QCIyFAvROBe8Aa6eK7SRWEca6BdODbEslTI1mCmHT 0z/YbvmoUDSBuEf3a86eSCoh/CRt+rotHIRF/NlMuvrk5sv7l8RL8qk X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= The state of BCM590XX regulators is controlled by writing to the PMCTRL registers; there are 7 selectable mode entries in those registers, each storing a specific mode value - OFF, LPM or ON. Which entry is selected depends on the combination of enabled PC pins (PC1, PC2 and the optional PC3). Add a new function to write a specific mode value to all entries, and make a custom enable/disable function to make use of it. Keep the is_enabled function using the naive regmap method (a potential improvement here would be to add support for getting the state of the PC pins to figure out the selected mode). It should also be possible to extend this to support regulator modes, though some work may be needed to make sure it doesn't interfere with the enabled/disabled state. Signed-off-by: Artur Weber --- drivers/regulator/bcm590xx-regulator.c | 96 +++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 12 deletions(-) diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c index 8b90eae06ca6..1905dc2a4111 100644 --- a/drivers/regulator/bcm590xx-regulator.c +++ b/drivers/regulator/bcm590xx-regulator.c @@ -38,6 +38,15 @@ struct bcm590xx_reg { #define BCM590XX_LDO_VSEL_MASK GENMASK(5, 3) #define BCM590XX_SR_VSEL_MASK GENMASK(5, 0) +#define BCM590XX_PMMODE_ON 0x0 +#define BCM590XX_PMMODE_LPM 0x1 +#define BCM590XX_PMMODE_OFF 0x2 + +#define PMMODE_3BIT_MASK(mode) \ + ((mode << 3) | mode) +#define PMMODE_2BIT_MASK(mode) \ + ((mode << 6) | (mode << 4) | (mode << 2) | mode) + /* BCM59056 registers */ /* I2C slave 0 registers */ @@ -444,7 +453,7 @@ static int bcm590xx_get_vsel_register(struct bcm590xx_reg *pmu, int id) return -EINVAL; } -static int bcm59054_get_enable_register(struct bcm590xx_reg *pmu, int id) +static int bcm59054_get_pmctrl_register(struct bcm590xx_reg *pmu, int id) { int reg = 0; @@ -483,7 +492,7 @@ static int bcm59054_get_enable_register(struct bcm590xx_reg *pmu, int id) return reg; } -static int bcm59056_get_enable_register(struct bcm590xx_reg *pmu, int id) +static int bcm59056_get_pmctrl_register(struct bcm590xx_reg *pmu, int id) { int reg = 0; @@ -522,13 +531,13 @@ static int bcm59056_get_enable_register(struct bcm590xx_reg *pmu, int id) return reg; } -static int bcm590xx_get_enable_register(struct bcm590xx_reg *pmu, int id) +static int bcm590xx_get_pmctrl_register(struct bcm590xx_reg *pmu, int id) { switch (pmu->mfd->device_type) { case BCM59054_TYPE: - return bcm59054_get_enable_register(pmu, id); + return bcm59054_get_pmctrl_register(pmu, id); case BCM59056_TYPE: - return bcm59056_get_enable_register(pmu, id); + return bcm59056_get_pmctrl_register(pmu, id); } return -EINVAL; } @@ -541,10 +550,73 @@ static int bcm590xx_get_enable_mask(struct bcm590xx_reg *pmu, int id) return BCM590XX_REG_ENABLE; } +/* + * The state of BCM590XX regulators is controlled by the PM mode; most + * regulators have 3 such modes (off, low-power and on). + * + * These modes are then stored in the PMCTRL registers - there are 7 + * PMMODE entries within these registers for any given regulator. + * Which one is selected is decided by the PC1 and PC2 pins (and the + * optional PC3 pin, if configured). + * + * For simplicity, to set a PM mode, we write it to all available + * PMMODE registers. + */ +static int +_bcm590xx_set_pmmode(struct bcm590xx_reg *pmu, int reg_id, unsigned int mode) +{ + struct regmap *regmap; + u8 pmctrl_addr = bcm590xx_get_pmctrl_register(pmu, reg_id); + unsigned int i; + int pmctrl_count; + int mode_mask; + int ret; + + /* + * Regulators using 2-bit mode controls have 2 PMCTRL registers; + * regulators using 3-bit mode controls have 4 PMCTRL registers. + * This is to accommodate all 7 selectable modes. + */ + if (bcm590xx_reg_mode_is_3bit(pmu, reg_id)) { + pmctrl_count = 4; + mode_mask = PMMODE_3BIT_MASK(mode); + } else { + pmctrl_count = 2; + mode_mask = PMMODE_2BIT_MASK(mode); + } + + if (bcm590xx_reg_is_secondary(pmu, reg_id)) + regmap = pmu->mfd->regmap_sec; + else + regmap = pmu->mfd->regmap_pri; + + for (i = 0; i < pmctrl_count; i++) { + ret = regmap_write(regmap, pmctrl_addr + i, mode_mask); + if (ret) + return ret; + } + + return 0; +} + +static int bcm590xx_regulator_enable(struct regulator_dev *rdev) +{ + struct bcm590xx_reg *pmu = rdev->reg_data; + + return _bcm590xx_set_pmmode(pmu, rdev->desc->id, BCM590XX_PMMODE_ON); +} + +static int bcm590xx_regulator_disable(struct regulator_dev *rdev) +{ + struct bcm590xx_reg *pmu = rdev->reg_data; + + return _bcm590xx_set_pmmode(pmu, rdev->desc->id, BCM590XX_PMMODE_OFF); +} + static const struct regulator_ops bcm590xx_ops_ldo = { .is_enabled = regulator_is_enabled_regmap, - .enable = regulator_enable_regmap, - .disable = regulator_disable_regmap, + .enable = bcm590xx_regulator_enable, + .disable = bcm590xx_regulator_disable, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .list_voltage = regulator_list_voltage_table, @@ -553,8 +625,8 @@ static const struct regulator_ops bcm590xx_ops_ldo = { static const struct regulator_ops bcm590xx_ops_dcdc = { .is_enabled = regulator_is_enabled_regmap, - .enable = regulator_enable_regmap, - .disable = regulator_disable_regmap, + .enable = bcm590xx_regulator_enable, + .disable = bcm590xx_regulator_disable, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .list_voltage = regulator_list_voltage_linear_range, @@ -563,8 +635,8 @@ static const struct regulator_ops bcm590xx_ops_dcdc = { static const struct regulator_ops bcm590xx_ops_static = { .is_enabled = regulator_is_enabled_regmap, - .enable = regulator_enable_regmap, - .disable = regulator_disable_regmap, + .enable = bcm590xx_regulator_enable, + .disable = bcm590xx_regulator_disable, }; static int bcm590xx_probe(struct platform_device *pdev) @@ -633,7 +705,7 @@ static int bcm590xx_probe(struct platform_device *pdev) pmu->desc[i].enable_is_inverted = true; } pmu->desc[i].enable_reg = \ - bcm590xx_get_enable_register(pmu, i); + bcm590xx_get_pmctrl_register(pmu, i); pmu->desc[i].type = REGULATOR_VOLTAGE; pmu->desc[i].owner = THIS_MODULE;