2023-05-17 18:53:45

by Stephan Gerhold

[permalink] [raw]
Subject: [PATCH 0/8] arm64: dts: qcom: msm8916: Rework regulator constraints

Rework the regulator constraints for the MSM8916 device trees to be
closer to reality. There are several mistakes in there, some of them
taken over directly from Qualcomm's vendor kernel. Fortunately, none of
the mistakes is absolutely critical because it turns out that the RPM
firmware also validates the voltages and silently clamps the requests
to a proper range. Still, this behavior should be clearly represented
in the device tree rather than pretending to apply the wrong voltages.

To make the regulator constraints more easily maintainable with a large
number of similar MSM8916 boards I propose moving the voltages for the
standard components in the SoC to the shared msm8916-pm8916.dtsi
include. With this only the actual board-specific regulators are
described in the board DT.

Signed-off-by: Stephan Gerhold <[email protected]>
---
Stephan Gerhold (8):
arm64: dts: qcom: apq8016-sbc: Fix regulator constraints
arm64: dts: qcom: apq8016-sbc: Fix 1.8V power rail on LS expansion
arm64: dts: qcom: msm8916: Fix regulator constraints
arm64: dts: qcom: msm8916: Disable audio codecs by default
arm64: dts: qcom: pm8916: Move default regulator "-supply"s
arm64: dts: qcom: msm8916-pm8916: Clarify purpose
arm64: dts: qcom: msm8916: Define regulator constraints next to usage
arm64: dts: qcom: msm8916-pm8916: Mark always-on regulators

arch/arm64/boot/dts/qcom/apq8016-sbc.dts | 145 +++++----------------
arch/arm64/boot/dts/qcom/msm8916-acer-a1-724.dts | 115 ++--------------
.../boot/dts/qcom/msm8916-alcatel-idol347.dts | 110 +---------------
arch/arm64/boot/dts/qcom/msm8916-asus-z00l.dts | 110 +---------------
arch/arm64/boot/dts/qcom/msm8916-gplus-fl8005a.dts | 110 +---------------
arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts | 125 ++++--------------
.../boot/dts/qcom/msm8916-longcheer-l8150.dts | 110 +---------------
.../boot/dts/qcom/msm8916-longcheer-l8910.dts | 110 +---------------
arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi | 121 ++++++++++++++---
.../dts/qcom/msm8916-samsung-a2015-common.dtsi | 110 +---------------
.../boot/dts/qcom/msm8916-samsung-gt5-common.dtsi | 110 +---------------
.../boot/dts/qcom/msm8916-samsung-j5-common.dtsi | 103 ---------------
.../boot/dts/qcom/msm8916-samsung-serranove.dts | 103 ---------------
arch/arm64/boot/dts/qcom/msm8916-ufi.dtsi | 103 ---------------
.../boot/dts/qcom/msm8916-wingtech-wt88047.dts | 119 +++--------------
arch/arm64/boot/dts/qcom/msm8916.dtsi | 1 +
arch/arm64/boot/dts/qcom/pm8916.dtsi | 4 +-
17 files changed, 236 insertions(+), 1473 deletions(-)
---
base-commit: 4272e06e19f388ccfe1f04f19060ea84d2a19a8b
change-id: 20230510-msm8916-regulators-97fa33735efe

Best regards,
--
Stephan Gerhold <[email protected]>



2023-05-17 18:54:12

by Stephan Gerhold

[permalink] [raw]
Subject: [PATCH 4/8] arm64: dts: qcom: msm8916: Disable audio codecs by default

Not every device has something connected to the digital audio codec
in MSM8916 and/or the analog audio codec in PM8916. Disable those by
default so the hardware is only powered up when necessary.

Signed-off-by: Stephan Gerhold <[email protected]>
---
arch/arm64/boot/dts/qcom/apq8016-sbc.dts | 5 +++++
arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts | 5 +++++
arch/arm64/boot/dts/qcom/msm8916.dtsi | 1 +
arch/arm64/boot/dts/qcom/pm8916.dtsi | 1 +
4 files changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dts b/arch/arm64/boot/dts/qcom/apq8016-sbc.dts
index 3ec449f5cab7..7d7af6406c39 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dts
+++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dts
@@ -310,6 +310,10 @@ &lpass {
status = "okay";
};

+&lpass_codec {
+ status = "okay";
+};
+
&mdss {
status = "okay";
};
@@ -399,6 +403,7 @@ &usb_hs_phy {
};

&wcd_codec {
+ status = "okay";
clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>;
clock-names = "mclk";
qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
diff --git a/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts b/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
index baa7bb86cdd5..8197710372ad 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
@@ -218,6 +218,10 @@ &lpass {
status = "okay";
};

+&lpass_codec {
+ status = "okay";
+};
+
&pm8916_resin {
status = "okay";
linux,code = <KEY_VOLUMEDOWN>;
@@ -302,6 +306,7 @@ &usb_hs_phy {
};

&wcd_codec {
+ status = "okay";
qcom,micbias-lvl = <2800>;
qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
index 7e0fa37a3adf..d5081a356288 100644
--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
@@ -1551,6 +1551,7 @@ lpass_codec: audio-codec@771c000 {
<&gcc GCC_CODEC_DIGCODEC_CLK>;
clock-names = "ahbix-clk", "mclk";
#sound-dai-cells = <1>;
+ status = "disabled";
};

sdhc_1: mmc@7824000 {
diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
index f4fb1a92ab55..33ca1002fb75 100644
--- a/arch/arm64/boot/dts/qcom/pm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
@@ -178,6 +178,7 @@ wcd_codec: audio-codec@f000 {
vdd-cdc-tx-rx-cx-supply = <&pm8916_l5>;
vdd-micbias-supply = <&pm8916_l13>;
#sound-dai-cells = <1>;
+ status = "disabled";
};
};
};

--
2.40.1


2023-05-17 19:05:26

by Stephan Gerhold

[permalink] [raw]
Subject: [PATCH 2/8] arm64: dts: qcom: apq8016-sbc: Fix 1.8V power rail on LS expansion

The 96Boards specification expects a 1.8V power rail on the low-speed
expansion connector that is able to provide at least 0.18W / 100 mA.
According to the DB410c hardware user manual this is done by connecting
both L15 and L16 in parallel with up to 55mA each (for 110 mA total) [1].

Unfortunately the current regulator setup in the DB410c device tree
does not implement the specification correctly and only provides 5 mA:

- Only L15 is marked always-on, so L16 is never enabled.
- Without specifying a load the regulator is put into LPM where
it can only provide 5 mA.

Fix this by:

- Adding proper voltage constraints for L16.
- Making L16 always-on.
- Adding regulator-system-load for both L15 and L16. 100 mA should be
available in total, so specify 50 mA for each. (The regulator
hardware can only be in normal (55 mA) or low-power mode (5 mA) so
this will actually result in the expected 110 mA total...)

[1]: https://www.96boards.org/documentation/consumer/dragonboard/dragonboard410c/hardware-docs/hardware-user-manual.md.html#power-supplies

Cc: Srinivas Kandagatla <[email protected]>
Fixes: 828dd5d66f0f ("arm64: dts: apq8016-sbc: make 1.8v available on LS expansion")
Signed-off-by: Stephan Gerhold <[email protected]>
---
arch/arm64/boot/dts/qcom/apq8016-sbc.dts | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dts b/arch/arm64/boot/dts/qcom/apq8016-sbc.dts
index 14cb217a13c1..3ec449f5cab7 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dts
+++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dts
@@ -526,19 +526,27 @@ l14 {
regulator-max-microvolt = <3300000>;
};

- /**
- * 1.8v required on LS expansion
- * for mezzanine boards
+ /*
+ * The 96Boards specification expects a 1.8V power rail on the low-speed
+ * expansion connector that is able to provide at least 0.18W / 100 mA.
+ * L15/L16 are connected in parallel to provide 55 mA each. A minimum load
+ * must be specified to ensure the regulators are not put in LPM where they
+ * would only provide 5 mA.
*/
l15 {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
+ regulator-system-load = <50000>;
+ regulator-allow-set-load;
regulator-always-on;
};

l16 {
regulator-min-microvolt = <1800000>;
- regulator-max-microvolt = <3300000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-system-load = <50000>;
+ regulator-allow-set-load;
+ regulator-always-on;
};

l17 {

--
2.40.1


2023-05-17 19:09:30

by Stephan Gerhold

[permalink] [raw]
Subject: [PATCH 5/8] arm64: dts: qcom: pm8916: Move default regulator "-supply"s

Some of the power supplies for the analog audio codec in PM8916 are
wired externally. While most boards use the regulators currently
specified in pm8916.dtsi, in theory it could be connected differently.

We already have msm8916-pm8916.dtsi that models that standard setup
used by most devices so move the -supply properties there and keep
the base pm8916.dtsi independent.

Currently all MSM8916 boards in mainline make use of
msm8916-pm8916.dtsi, so it is not necessary to adjust any other boards.

Signed-off-by: Stephan Gerhold <[email protected]>
---
arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi | 6 ++++++
arch/arm64/boot/dts/qcom/pm8916.dtsi | 3 ---
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi
index 6eb5e0a39510..5b3ed7137e1f 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi
@@ -35,6 +35,12 @@ &usb_hs_phy {
v3p3-supply = <&pm8916_l13>;
};

+&wcd_codec {
+ vdd-cdc-io-supply = <&pm8916_l5>;
+ vdd-cdc-tx-rx-cx-supply = <&pm8916_l5>;
+ vdd-micbias-supply = <&pm8916_l13>;
+};
+
&wcnss {
vddpx-supply = <&pm8916_l7>;
};
diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
index 33ca1002fb75..864bb1cd68db 100644
--- a/arch/arm64/boot/dts/qcom/pm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
@@ -174,9 +174,6 @@ wcd_codec: audio-codec@f000 {
"cdc_ear_cnp_int",
"cdc_hphr_cnp_int",
"cdc_hphl_cnp_int";
- vdd-cdc-io-supply = <&pm8916_l5>;
- vdd-cdc-tx-rx-cx-supply = <&pm8916_l5>;
- vdd-micbias-supply = <&pm8916_l13>;
#sound-dai-cells = <1>;
status = "disabled";
};

--
2.40.1


2023-05-25 05:35:58

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH 0/8] arm64: dts: qcom: msm8916: Rework regulator constraints

On Wed, 17 May 2023 20:48:39 +0200, Stephan Gerhold wrote:
> Rework the regulator constraints for the MSM8916 device trees to be
> closer to reality. There are several mistakes in there, some of them
> taken over directly from Qualcomm's vendor kernel. Fortunately, none of
> the mistakes is absolutely critical because it turns out that the RPM
> firmware also validates the voltages and silently clamps the requests
> to a proper range. Still, this behavior should be clearly represented
> in the device tree rather than pretending to apply the wrong voltages.
>
> [...]

Applied, thanks!

[1/8] arm64: dts: qcom: apq8016-sbc: Fix regulator constraints
commit: e27654df20d77ad7549a3cf6739ebaa3aa59a088
[2/8] arm64: dts: qcom: apq8016-sbc: Fix 1.8V power rail on LS expansion
commit: 5500f823db38db073d30557af159b77fb1f2bf26
[3/8] arm64: dts: qcom: msm8916: Fix regulator constraints
commit: 355750828c5519c88de6ac0d09202d2a7e5892c5
[4/8] arm64: dts: qcom: msm8916: Disable audio codecs by default
commit: a5cf21b14666c42912327c7bece38711f6e0d708
[5/8] arm64: dts: qcom: pm8916: Move default regulator "-supply"s
commit: 38218822a72fd31e89affc7fc457d527f65581aa
[6/8] arm64: dts: qcom: msm8916-pm8916: Clarify purpose
commit: f193264986b5944216e574b9962616f2524aac08
[7/8] arm64: dts: qcom: msm8916: Define regulator constraints next to usage
commit: b0a8f16ae4a0eb423122256691849b3ebc64efc2
[8/8] arm64: dts: qcom: msm8916-pm8916: Mark always-on regulators
commit: 8bbd35771f903a9d14fe95bcba8c7b9f07aeb958

Best regards,
--
Bjorn Andersson <[email protected]>