[3/6] regulator: qcom_smd: Add MP5496 regulators

Message ID 20230113150310.29709-4-quic_devipriy@quicinc.com
State New
Headers
Series Add regulator support for IPQ9574 SoC |

Commit Message

Devi Priya Jan. 13, 2023, 3:03 p.m. UTC
  Adding support for PMIC MP5496 on IPQ9574 SoC

Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com>
Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com>
Signed-off-by: devi priya <quic_devipriy@quicinc.com>
---
 drivers/regulator/qcom_smd-regulator.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
  

Comments

Konrad Dybcio Jan. 13, 2023, 3:24 p.m. UTC | #1
On 13.01.2023 16:03, devi priya wrote:
> Adding support for PMIC MP5496 on IPQ9574 SoC
> 
> Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com>
> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com>
> Signed-off-by: devi priya <quic_devipriy@quicinc.com>
> ---
Please simply extend the existing MP5496 support with this
S1 regulator. If you don't explicitly define and set voltages
for the other vregs, they will not be probed.

Konrad
>  drivers/regulator/qcom_smd-regulator.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
> index 9f2b58458841..1eb17d378897 100644
> --- a/drivers/regulator/qcom_smd-regulator.c
> +++ b/drivers/regulator/qcom_smd-regulator.c
> @@ -767,6 +767,15 @@ static const struct regulator_desc mp5496_ldoa2 = {
>  	.ops = &rpm_mp5496_ops,
>  };
>  
> +static const struct regulator_desc ipq9574_mp5496_smpa1 = {
> +	.linear_ranges = (struct linear_range[]) {
> +		REGULATOR_LINEAR_RANGE(600000, 0, 37, 12500),
> +	},
> +	.n_linear_ranges = 1,
> +	.n_voltages = 38,
> +	.ops = &rpm_mp5496_ops,
> +};
> +
>  static const struct regulator_desc pm2250_lvftsmps = {
>  	.linear_ranges = (struct linear_range[]) {
>  		REGULATOR_LINEAR_RANGE(320000, 0, 269, 4000),
> @@ -799,6 +808,11 @@ static const struct rpm_regulator_data rpm_mp5496_regulators[] = {
>  	{}
>  };
>  
> +static const struct rpm_regulator_data rpm_ipq9574_mp5496_regulators[] = {
> +	{ "s1", QCOM_SMD_RPM_SMPA, 1, &ipq9574_mp5496_smpa1, "s1" },
> +	{}
> +};
> +
>  static const struct rpm_regulator_data rpm_pm2250_regulators[] = {
>  	{ "s1", QCOM_SMD_RPM_SMPA, 1, &pm2250_lvftsmps, "vdd_s1" },
>  	{ "s2", QCOM_SMD_RPM_SMPA, 2, &pm2250_lvftsmps, "vdd_s2" },
> @@ -1320,6 +1334,8 @@ static const struct rpm_regulator_data rpm_pms405_regulators[] = {
>  };
>  
>  static const struct of_device_id rpm_of_match[] = {
> +	{ .compatible = "qcom,rpm-ipq9574-mp5496-regulators",
> +		.data = &rpm_ipq9574_mp5496_regulators },
>  	{ .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators },
>  	{ .compatible = "qcom,rpm-pm2250-regulators", .data = &rpm_pm2250_regulators },
>  	{ .compatible = "qcom,rpm-pm6125-regulators", .data = &rpm_pm6125_regulators },
  
Devi Priya Jan. 27, 2023, 4:01 p.m. UTC | #2
On 1/13/2023 8:54 PM, Konrad Dybcio wrote:
> 
> 
> On 13.01.2023 16:03, devi priya wrote:
>> Adding support for PMIC MP5496 on IPQ9574 SoC
>>
>> Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com>
>> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com>
>> Signed-off-by: devi priya <quic_devipriy@quicinc.com>
>> ---
> Please simply extend the existing MP5496 support with this
> S1 regulator. If you don't explicitly define and set voltages
> for the other vregs, they will not be probed.
> 
> Konrad
IPQ6018 and IPQ9574 platforms use the same PMIC MP5496 but they have a 
different power layout. IPQ9574 has S2 regulator which will be used for 
NSS scaling but S2 in IPQ6018 serves a different purpose. Hence it would 
not be possible to extend the existing MP5496 support for IPQ9574
>>   drivers/regulator/qcom_smd-regulator.c | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
>> diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
>> index 9f2b58458841..1eb17d378897 100644
>> --- a/drivers/regulator/qcom_smd-regulator.c
>> +++ b/drivers/regulator/qcom_smd-regulator.c
>> @@ -767,6 +767,15 @@ static const struct regulator_desc mp5496_ldoa2 = {
>>   	.ops = &rpm_mp5496_ops,
>>   };
>>   
>> +static const struct regulator_desc ipq9574_mp5496_smpa1 = {
>> +	.linear_ranges = (struct linear_range[]) {
>> +		REGULATOR_LINEAR_RANGE(600000, 0, 37, 12500),
>> +	},
>> +	.n_linear_ranges = 1,
>> +	.n_voltages = 38,
>> +	.ops = &rpm_mp5496_ops,
>> +};
>> +
>>   static const struct regulator_desc pm2250_lvftsmps = {
>>   	.linear_ranges = (struct linear_range[]) {
>>   		REGULATOR_LINEAR_RANGE(320000, 0, 269, 4000),
>> @@ -799,6 +808,11 @@ static const struct rpm_regulator_data rpm_mp5496_regulators[] = {
>>   	{}
>>   };
>>   
>> +static const struct rpm_regulator_data rpm_ipq9574_mp5496_regulators[] = {
>> +	{ "s1", QCOM_SMD_RPM_SMPA, 1, &ipq9574_mp5496_smpa1, "s1" },
>> +	{}
>> +};
>> +
>>   static const struct rpm_regulator_data rpm_pm2250_regulators[] = {
>>   	{ "s1", QCOM_SMD_RPM_SMPA, 1, &pm2250_lvftsmps, "vdd_s1" },
>>   	{ "s2", QCOM_SMD_RPM_SMPA, 2, &pm2250_lvftsmps, "vdd_s2" },
>> @@ -1320,6 +1334,8 @@ static const struct rpm_regulator_data rpm_pms405_regulators[] = {
>>   };
>>   
>>   static const struct of_device_id rpm_of_match[] = {
>> +	{ .compatible = "qcom,rpm-ipq9574-mp5496-regulators",
>> +		.data = &rpm_ipq9574_mp5496_regulators },
>>   	{ .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators },
>>   	{ .compatible = "qcom,rpm-pm2250-regulators", .data = &rpm_pm2250_regulators },
>>   	{ .compatible = "qcom,rpm-pm6125-regulators", .data = &rpm_pm6125_regulators },
Best Regards,
Devi Priya
  
Konrad Dybcio Jan. 27, 2023, 4:03 p.m. UTC | #3
On 27.01.2023 17:01, Devi Priya wrote:
> 
> 
> On 1/13/2023 8:54 PM, Konrad Dybcio wrote:
>>
>>
>> On 13.01.2023 16:03, devi priya wrote:
>>> Adding support for PMIC MP5496 on IPQ9574 SoC
>>>
>>> Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com>
>>> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com>
>>> Signed-off-by: devi priya <quic_devipriy@quicinc.com>
>>> ---
>> Please simply extend the existing MP5496 support with this
>> S1 regulator. If you don't explicitly define and set voltages
>> for the other vregs, they will not be probed.
>>
>> Konrad
> IPQ6018 and IPQ9574 platforms use the same PMIC MP5496 but they have a different power layout. IPQ9574 has S2 regulator which will be used for NSS scaling but S2 in IPQ6018 serves a different purpose. Hence it would not be possible to extend the existing MP5496 support for IPQ9574
Does the s2 on IPQ9574 have a different voltage range than
the one on IPQ6018? No? Then there's nothing blocking you
from using the setup for both SoCs. As I've mentioned,
regulators that you don't add to the device tree will
not even be probed.

Konrad
>>>   drivers/regulator/qcom_smd-regulator.c | 16 ++++++++++++++++
>>>   1 file changed, 16 insertions(+)
>>>
>>> diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
>>> index 9f2b58458841..1eb17d378897 100644
>>> --- a/drivers/regulator/qcom_smd-regulator.c
>>> +++ b/drivers/regulator/qcom_smd-regulator.c
>>> @@ -767,6 +767,15 @@ static const struct regulator_desc mp5496_ldoa2 = {
>>>       .ops = &rpm_mp5496_ops,
>>>   };
>>>   +static const struct regulator_desc ipq9574_mp5496_smpa1 = {
>>> +    .linear_ranges = (struct linear_range[]) {
>>> +        REGULATOR_LINEAR_RANGE(600000, 0, 37, 12500),
>>> +    },
>>> +    .n_linear_ranges = 1,
>>> +    .n_voltages = 38,
>>> +    .ops = &rpm_mp5496_ops,
>>> +};
>>> +
>>>   static const struct regulator_desc pm2250_lvftsmps = {
>>>       .linear_ranges = (struct linear_range[]) {
>>>           REGULATOR_LINEAR_RANGE(320000, 0, 269, 4000),
>>> @@ -799,6 +808,11 @@ static const struct rpm_regulator_data rpm_mp5496_regulators[] = {
>>>       {}
>>>   };
>>>   +static const struct rpm_regulator_data rpm_ipq9574_mp5496_regulators[] = {
>>> +    { "s1", QCOM_SMD_RPM_SMPA, 1, &ipq9574_mp5496_smpa1, "s1" },
>>> +    {}
>>> +};
>>> +
>>>   static const struct rpm_regulator_data rpm_pm2250_regulators[] = {
>>>       { "s1", QCOM_SMD_RPM_SMPA, 1, &pm2250_lvftsmps, "vdd_s1" },
>>>       { "s2", QCOM_SMD_RPM_SMPA, 2, &pm2250_lvftsmps, "vdd_s2" },
>>> @@ -1320,6 +1334,8 @@ static const struct rpm_regulator_data rpm_pms405_regulators[] = {
>>>   };
>>>     static const struct of_device_id rpm_of_match[] = {
>>> +    { .compatible = "qcom,rpm-ipq9574-mp5496-regulators",
>>> +        .data = &rpm_ipq9574_mp5496_regulators },
>>>       { .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators },
>>>       { .compatible = "qcom,rpm-pm2250-regulators", .data = &rpm_pm2250_regulators },
>>>       { .compatible = "qcom,rpm-pm6125-regulators", .data = &rpm_pm6125_regulators },
> Best Regards,
> Devi Priya
  
Devi Priya Jan. 31, 2023, 10:16 a.m. UTC | #4
On 1/27/2023 9:33 PM, Konrad Dybcio wrote:
> 
> 
> On 27.01.2023 17:01, Devi Priya wrote:
>>
>>
>> On 1/13/2023 8:54 PM, Konrad Dybcio wrote:
>>>
>>>
>>> On 13.01.2023 16:03, devi priya wrote:
>>>> Adding support for PMIC MP5496 on IPQ9574 SoC
>>>>
>>>> Co-developed-by: Praveenkumar I <quic_ipkumar@quicinc.com>
>>>> Signed-off-by: Praveenkumar I <quic_ipkumar@quicinc.com>
>>>> Signed-off-by: devi priya <quic_devipriy@quicinc.com>
>>>> ---
>>> Please simply extend the existing MP5496 support with this
>>> S1 regulator. If you don't explicitly define and set voltages
>>> for the other vregs, they will not be probed.
>>>
>>> Konrad
>> IPQ6018 and IPQ9574 platforms use the same PMIC MP5496 but they have a different power layout. IPQ9574 has S2 regulator which will be used for NSS scaling but S2 in IPQ6018 serves a different purpose. Hence it would not be possible to extend the existing MP5496 support for IPQ9574
> Does the s2 on IPQ9574 have a different voltage range than
> the one on IPQ6018? No? Then there's nothing blocking you
> from using the setup for both SoCs. As I've mentioned,
> regulators that you don't add to the device tree will
> not even be probed.
> 
Yeah, understood! will update this in V2
> Konrad
>>>>    drivers/regulator/qcom_smd-regulator.c | 16 ++++++++++++++++
>>>>    1 file changed, 16 insertions(+)
>>>>
>>>> diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
>>>> index 9f2b58458841..1eb17d378897 100644
>>>> --- a/drivers/regulator/qcom_smd-regulator.c
>>>> +++ b/drivers/regulator/qcom_smd-regulator.c
>>>> @@ -767,6 +767,15 @@ static const struct regulator_desc mp5496_ldoa2 = {
>>>>        .ops = &rpm_mp5496_ops,
>>>>    };
>>>>    +static const struct regulator_desc ipq9574_mp5496_smpa1 = {
>>>> +    .linear_ranges = (struct linear_range[]) {
>>>> +        REGULATOR_LINEAR_RANGE(600000, 0, 37, 12500),
>>>> +    },
>>>> +    .n_linear_ranges = 1,
>>>> +    .n_voltages = 38,
>>>> +    .ops = &rpm_mp5496_ops,
>>>> +};
>>>> +
>>>>    static const struct regulator_desc pm2250_lvftsmps = {
>>>>        .linear_ranges = (struct linear_range[]) {
>>>>            REGULATOR_LINEAR_RANGE(320000, 0, 269, 4000),
>>>> @@ -799,6 +808,11 @@ static const struct rpm_regulator_data rpm_mp5496_regulators[] = {
>>>>        {}
>>>>    };
>>>>    +static const struct rpm_regulator_data rpm_ipq9574_mp5496_regulators[] = {
>>>> +    { "s1", QCOM_SMD_RPM_SMPA, 1, &ipq9574_mp5496_smpa1, "s1" },
>>>> +    {}
>>>> +};
>>>> +
>>>>    static const struct rpm_regulator_data rpm_pm2250_regulators[] = {
>>>>        { "s1", QCOM_SMD_RPM_SMPA, 1, &pm2250_lvftsmps, "vdd_s1" },
>>>>        { "s2", QCOM_SMD_RPM_SMPA, 2, &pm2250_lvftsmps, "vdd_s2" },
>>>> @@ -1320,6 +1334,8 @@ static const struct rpm_regulator_data rpm_pms405_regulators[] = {
>>>>    };
>>>>      static const struct of_device_id rpm_of_match[] = {
>>>> +    { .compatible = "qcom,rpm-ipq9574-mp5496-regulators",
>>>> +        .data = &rpm_ipq9574_mp5496_regulators },
>>>>        { .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators },
>>>>        { .compatible = "qcom,rpm-pm2250-regulators", .data = &rpm_pm2250_regulators },
>>>>        { .compatible = "qcom,rpm-pm6125-regulators", .data = &rpm_pm6125_regulators },
>> Best Regards,
>> Devi Priya
Best Regards,
Devi Priya
  

Patch

diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
index 9f2b58458841..1eb17d378897 100644
--- a/drivers/regulator/qcom_smd-regulator.c
+++ b/drivers/regulator/qcom_smd-regulator.c
@@ -767,6 +767,15 @@  static const struct regulator_desc mp5496_ldoa2 = {
 	.ops = &rpm_mp5496_ops,
 };
 
+static const struct regulator_desc ipq9574_mp5496_smpa1 = {
+	.linear_ranges = (struct linear_range[]) {
+		REGULATOR_LINEAR_RANGE(600000, 0, 37, 12500),
+	},
+	.n_linear_ranges = 1,
+	.n_voltages = 38,
+	.ops = &rpm_mp5496_ops,
+};
+
 static const struct regulator_desc pm2250_lvftsmps = {
 	.linear_ranges = (struct linear_range[]) {
 		REGULATOR_LINEAR_RANGE(320000, 0, 269, 4000),
@@ -799,6 +808,11 @@  static const struct rpm_regulator_data rpm_mp5496_regulators[] = {
 	{}
 };
 
+static const struct rpm_regulator_data rpm_ipq9574_mp5496_regulators[] = {
+	{ "s1", QCOM_SMD_RPM_SMPA, 1, &ipq9574_mp5496_smpa1, "s1" },
+	{}
+};
+
 static const struct rpm_regulator_data rpm_pm2250_regulators[] = {
 	{ "s1", QCOM_SMD_RPM_SMPA, 1, &pm2250_lvftsmps, "vdd_s1" },
 	{ "s2", QCOM_SMD_RPM_SMPA, 2, &pm2250_lvftsmps, "vdd_s2" },
@@ -1320,6 +1334,8 @@  static const struct rpm_regulator_data rpm_pms405_regulators[] = {
 };
 
 static const struct of_device_id rpm_of_match[] = {
+	{ .compatible = "qcom,rpm-ipq9574-mp5496-regulators",
+		.data = &rpm_ipq9574_mp5496_regulators },
 	{ .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators },
 	{ .compatible = "qcom,rpm-pm2250-regulators", .data = &rpm_pm2250_regulators },
 	{ .compatible = "qcom,rpm-pm6125-regulators", .data = &rpm_pm6125_regulators },