arm64: dts: qcom: msm8916: Define regulator constraints next to usage
authorStephan Gerhold <stephan@gerhold.net>
Wed, 17 May 2023 18:48:46 +0000 (20:48 +0200)
committerBjorn Andersson <andersson@kernel.org>
Thu, 25 May 2023 04:50:47 +0000 (21:50 -0700)
commitb0a8f16ae4a0eb423122256691849b3ebc64efc2
tree49bd5469a9a54887c5b381855289119333bee08e
parentf193264986b5944216e574b9962616f2524aac08
arm64: dts: qcom: msm8916: Define regulator constraints next to usage

Right now each MSM8916 device has a huge block of regulator constraints
with allowed voltages for each regulator. For lack of better
documentation these voltages are often copied as-is from the vendor
device tree, without much extra thought.

Unfortunately, the voltages in the vendor device trees are often
misleading or even wrong, e.g. because:

 - There is a large voltage range allowed and the actual voltage is
   only set somewhere hidden in some messy vendor driver. This is often
   the case for pm8916_{l14,l15,l16} because they have a broad range of
   1.8-3.3V by default.

 - The voltage is actually wrong but thanks to the voltage constraints
   in the RPM firmware it still ends up applying the correct voltage.

To have proper regulator constraints it is important to review them in
context of the usage. The current setup in the MSM8916 device trees
makes this quite hard because each device duplicates the standard
voltages for components of the SoC and mixes those with minor
device-specific additions and dummy voltages for completely unused
regulators.

The actual usage of the regulators for the SoC components is in
msm8916-pm8916.dtsi, so it can and should also define the related
voltage constraints. These are not board-specific but defined in the
APQ8016E/PM8916 Device Specification. The board DT can then focus on
describing the actual board-specific regulators, which makes it much
easier to review and spot potential mistakes there.

Note that this commit does not make any functional change. All used
regulators still have the same regulator constraints as before. Unused
regulators do not have regulator constraints anymore because most of
these were too broad or even entirely wrong. They should be added back
with proper voltage constraints when there is an actual usage.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230510-msm8916-regulators-v1-7-54d4960a05fc@gerhold.net
15 files changed:
arch/arm64/boot/dts/qcom/apq8016-sbc.dts
arch/arm64/boot/dts/qcom/msm8916-acer-a1-724.dts
arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts
arch/arm64/boot/dts/qcom/msm8916-asus-z00l.dts
arch/arm64/boot/dts/qcom/msm8916-gplus-fl8005a.dts
arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
arch/arm64/boot/dts/qcom/msm8916-longcheer-l8910.dts
arch/arm64/boot/dts/qcom/msm8916-pm8916.dtsi
arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi
arch/arm64/boot/dts/qcom/msm8916-samsung-gt5-common.dtsi
arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi
arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts
arch/arm64/boot/dts/qcom/msm8916-ufi.dtsi
arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts