Fix the voltage range for the pm8916_pldo in the qcom_smd-regulator
driver and add definitions for the regulators available in PM8909.
Stephan Gerhold (3):
regulator: qcom_smd: Fix pm8916_pldo range
regulator: dt-bindings: qcom,smd-rpm: Add PM8909
regulator: qcom_smd: Add PM8909 RPM regulators
.../regulator/qcom,smd-rpm-regulator.yaml | 4 +++
drivers/regulator/qcom_smd-regulator.c | 28 +++++++++++++++++--
2 files changed, 30 insertions(+), 2 deletions(-)
--
2.30.2
The set of regulators available in the PM8909 PMIC is similar to PM8916
which is already supported by the driver. s3, s4 and l16 are missing.
However, probing the SPMI hardware identification registers using the
qcom_spmi-regulator driver reveals that the regulators in PM8909 are
actually some kind of mixture between PM8916 and PM8226:
- ult_lo_smps (= pm8916_buck_lvo_smps): s1
- ult_ho_smps (= pm8916_buck_hvo_smps): s2
- ult_nldo (= pm8916_nldo): l1, l2, l3, l10
- ult_pldo (= pm8916_pldo): l4, l8, l9, l12-l15, l17, l18
- pldo (= pm8226_pldo): l5, l6, l7, l11
Use this mapping to add the rpm_regulator_data for PM8909 by reusing
the existing regulator definitions.
Signed-off-by: Stephan Gerhold <[email protected]>
---
drivers/regulator/qcom_smd-regulator.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
index 8b2d884cd693..59024c639141 100644
--- a/drivers/regulator/qcom_smd-regulator.c
+++ b/drivers/regulator/qcom_smd-regulator.c
@@ -784,6 +784,29 @@ static const struct rpm_regulator_data rpm_pm8841_regulators[] = {
{}
};
+static const struct rpm_regulator_data rpm_pm8909_regulators[] = {
+ { "s1", QCOM_SMD_RPM_SMPA, 1, &pm8916_buck_lvo_smps, "vdd_s1" },
+ { "s2", QCOM_SMD_RPM_SMPA, 2, &pm8916_buck_hvo_smps, "vdd_s2" },
+ { "l1", QCOM_SMD_RPM_LDOA, 1, &pm8916_nldo, "vdd_l1" },
+ { "l2", QCOM_SMD_RPM_LDOA, 2, &pm8916_nldo, "vdd_l2_l5" },
+ { "l3", QCOM_SMD_RPM_LDOA, 3, &pm8916_nldo, "vdd_l3_l6_l10" },
+ { "l4", QCOM_SMD_RPM_LDOA, 4, &pm8916_pldo, "vdd_l4_l7" },
+ { "l5", QCOM_SMD_RPM_LDOA, 5, &pm8226_pldo, "vdd_l2_l5" },
+ { "l6", QCOM_SMD_RPM_LDOA, 6, &pm8226_pldo, "vdd_l3_l6_l10" },
+ { "l7", QCOM_SMD_RPM_LDOA, 7, &pm8226_pldo, "vdd_l4_l7" },
+ { "l8", QCOM_SMD_RPM_LDOA, 8, &pm8916_pldo, "vdd_l8_l11_l15_l18" },
+ { "l9", QCOM_SMD_RPM_LDOA, 9, &pm8916_pldo, "vdd_l9_l12_l14_l17" },
+ { "l10", QCOM_SMD_RPM_LDOA, 10, &pm8916_nldo, "vdd_l3_l6_l10" },
+ { "l11", QCOM_SMD_RPM_LDOA, 11, &pm8226_pldo, "vdd_l8_l11_l15_l18" },
+ { "l12", QCOM_SMD_RPM_LDOA, 12, &pm8916_pldo, "vdd_l9_l12_l14_l17" },
+ { "l13", QCOM_SMD_RPM_LDOA, 13, &pm8916_pldo, "vdd_l13" },
+ { "l14", QCOM_SMD_RPM_LDOA, 14, &pm8916_pldo, "vdd_l9_l12_l14_l17" },
+ { "l15", QCOM_SMD_RPM_LDOA, 15, &pm8916_pldo, "vdd_l8_l11_l15_l18" },
+ { "l17", QCOM_SMD_RPM_LDOA, 17, &pm8916_pldo, "vdd_l9_l12_l14_l17" },
+ { "l18", QCOM_SMD_RPM_LDOA, 18, &pm8916_pldo, "vdd_l8_l11_l15_l18" },
+ {}
+};
+
static const struct rpm_regulator_data rpm_pm8916_regulators[] = {
{ "s1", QCOM_SMD_RPM_SMPA, 1, &pm8916_buck_lvo_smps, "vdd_s1" },
{ "s2", QCOM_SMD_RPM_SMPA, 2, &pm8916_buck_lvo_smps, "vdd_s2" },
@@ -1222,6 +1245,7 @@ static const struct rpm_regulator_data rpm_pm2250_regulators[] = {
static const struct of_device_id rpm_of_match[] = {
{ .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators },
{ .compatible = "qcom,rpm-pm8841-regulators", .data = &rpm_pm8841_regulators },
+ { .compatible = "qcom,rpm-pm8909-regulators", .data = &rpm_pm8909_regulators },
{ .compatible = "qcom,rpm-pm8916-regulators", .data = &rpm_pm8916_regulators },
{ .compatible = "qcom,rpm-pm8226-regulators", .data = &rpm_pm8226_regulators },
{ .compatible = "qcom,rpm-pm8941-regulators", .data = &rpm_pm8941_regulators },
--
2.30.2
The PM8916 device specification [1] documents a programmable range of
1.75V to 3.337V with 12.5mV steps for the PMOS LDOs in PM8916. This
range is also used when controlling the regulator directly using the
qcom_spmi-regulator driver ("ult_pldo" there).
However, for some reason the qcom_smd-regulator driver allows a much
larger range for the same hardware component. This could be simply a
typo, since the start of the range is essentially just missing a '1'.
In practice this does not cause any major problems, since the driver
just sends the actual voltage to the RPM firmware instead of making use
of the incorrect voltage selector. Still, having the wrong range there
is confusing and prevents the regulator core from validating requests
correctly.
[1]: https://developer.qualcomm.com/download/sd410/pm8916pm8916-1-power-management-ic-device-specification.pdf
Fixes: 57d6567680ed ("regulator: qcom-smd: Add PM8916 support")
Signed-off-by: Stephan Gerhold <[email protected]>
---
drivers/regulator/qcom_smd-regulator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
index 4051d5fa9df9..8b2d884cd693 100644
--- a/drivers/regulator/qcom_smd-regulator.c
+++ b/drivers/regulator/qcom_smd-regulator.c
@@ -358,10 +358,10 @@ static const struct regulator_desc pm8941_switch = {
static const struct regulator_desc pm8916_pldo = {
.linear_ranges = (struct linear_range[]) {
- REGULATOR_LINEAR_RANGE(750000, 0, 208, 12500),
+ REGULATOR_LINEAR_RANGE(1750000, 0, 127, 12500),
},
.n_linear_ranges = 1,
- .n_voltages = 209,
+ .n_voltages = 128,
.ops = &rpm_smps_ldo_ops,
};
--
2.30.2
On 23/06/2022 11:46, Stephan Gerhold wrote:
> static const struct rpm_regulator_data rpm_pm8916_regulators[] = {
> { "s1", QCOM_SMD_RPM_SMPA, 1, &pm8916_buck_lvo_smps, "vdd_s1" },
> { "s2", QCOM_SMD_RPM_SMPA, 2, &pm8916_buck_lvo_smps, "vdd_s2" },
> @@ -1222,6 +1245,7 @@ static const struct rpm_regulator_data rpm_pm2250_regulators[] = {
> static const struct of_device_id rpm_of_match[] = {
> { .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators },
> { .compatible = "qcom,rpm-pm8841-regulators", .data = &rpm_pm8841_regulators },
> + { .compatible = "qcom,rpm-pm8909-regulators", .data = &rpm_pm8909_regulators },
> { .compatible = "qcom,rpm-pm8916-regulators", .data = &rpm_pm8916_regulators },
> { .compatible = "qcom,rpm-pm8226-regulators", .data = &rpm_pm8226_regulators },
> { .compatible = "qcom,rpm-pm8941-regulators", .data = &rpm_pm8941_regulators },
Isn't this a new compatible? Looks like, so it needs bindings.
Best regards,
Krzysztof
On 23/06/2022 15:26, Krzysztof Kozlowski wrote:
> On 23/06/2022 11:46, Stephan Gerhold wrote:
>
>> static const struct rpm_regulator_data rpm_pm8916_regulators[] = {
>> { "s1", QCOM_SMD_RPM_SMPA, 1, &pm8916_buck_lvo_smps, "vdd_s1" },
>> { "s2", QCOM_SMD_RPM_SMPA, 2, &pm8916_buck_lvo_smps, "vdd_s2" },
>> @@ -1222,6 +1245,7 @@ static const struct rpm_regulator_data rpm_pm2250_regulators[] = {
>> static const struct of_device_id rpm_of_match[] = {
>> { .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators },
>> { .compatible = "qcom,rpm-pm8841-regulators", .data = &rpm_pm8841_regulators },
>> + { .compatible = "qcom,rpm-pm8909-regulators", .data = &rpm_pm8909_regulators },
>> { .compatible = "qcom,rpm-pm8916-regulators", .data = &rpm_pm8916_regulators },
>> { .compatible = "qcom,rpm-pm8226-regulators", .data = &rpm_pm8226_regulators },
>> { .compatible = "qcom,rpm-pm8941-regulators", .data = &rpm_pm8941_regulators },
>
> Isn't this a new compatible? Looks like, so it needs bindings.
Ah, I see the patch now.
Best regards,
Krzysztof
On Thu, 23 Jun 2022 11:46:11 +0200, Stephan Gerhold wrote:
> Fix the voltage range for the pm8916_pldo in the qcom_smd-regulator
> driver and add definitions for the regulators available in PM8909.
>
> Stephan Gerhold (3):
> regulator: qcom_smd: Fix pm8916_pldo range
> regulator: dt-bindings: qcom,smd-rpm: Add PM8909
> regulator: qcom_smd: Add PM8909 RPM regulators
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/3] regulator: qcom_smd: Fix pm8916_pldo range
commit: e8977917e116d1571dacb8e9864474551c1c12bd
[2/3] regulator: dt-bindings: qcom,smd-rpm: Add PM8909
commit: 8cbb948a7cc2875d09234e2ce0424bc501c370b9
[3/3] regulator: qcom_smd: Add PM8909 RPM regulators
commit: bc4d193238be4ef8ecee1ba0e0371169ad448c31
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark