[PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994

Barnabás Czémán posted 7 patches 1 month ago
[PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994
Posted by Barnabás Czémán 1 month ago
WLED4 found in PMI8994 supports different ovp values.

Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible")
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
---
 drivers/video/backlight/qcom-wled.c | 41 +++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index a63bb42c8f8b..5decbd39b789 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1244,6 +1244,15 @@ static const struct wled_var_cfg wled4_ovp_cfg = {
 	.size = ARRAY_SIZE(wled4_ovp_values),
 };
 
+static const u32 pmi8994_wled_ovp_values[] = {
+	31000, 29500, 19400, 17800,
+};
+
+static const struct wled_var_cfg pmi8994_wled_ovp_cfg = {
+	.values = pmi8994_wled_ovp_values,
+	.size = ARRAY_SIZE(pmi8994_wled_ovp_values),
+};
+
 static inline u32 wled5_ovp_values_fn(u32 idx)
 {
 	/*
@@ -1357,6 +1366,29 @@ static int wled_configure(struct wled *wled)
 		},
 	};
 
+	const struct wled_u32_opts pmi8994_wled_opts[] = {
+		{
+			.name = "qcom,current-boost-limit",
+			.val_ptr = &cfg->boost_i_limit,
+			.cfg = &wled4_boost_i_limit_cfg,
+		},
+		{
+			.name = "qcom,current-limit-microamp",
+			.val_ptr = &cfg->string_i_limit,
+			.cfg = &wled4_string_i_limit_cfg,
+		},
+		{
+			.name = "qcom,ovp-millivolt",
+			.val_ptr = &cfg->ovp,
+			.cfg = &pmi8994_wled_ovp_cfg,
+		},
+		{
+			.name = "qcom,switching-freq",
+			.val_ptr = &cfg->switch_freq,
+			.cfg = &wled3_switch_freq_cfg,
+		},
+	};
+
 	const struct wled_u32_opts wled5_opts[] = {
 		{
 			.name = "qcom,current-boost-limit",
@@ -1423,8 +1455,13 @@ static int wled_configure(struct wled *wled)
 		break;
 
 	case 4:
-		u32_opts = wled4_opts;
-		size = ARRAY_SIZE(wled4_opts);
+		if (of_device_is_compatible(dev->of_node, "qcom,pmi8994-wled")) {
+			u32_opts = pmi8994_wled_opts;
+			size = ARRAY_SIZE(pmi8994_wled_opts);
+		} else {
+			u32_opts = wled4_opts;
+			size = ARRAY_SIZE(wled4_opts);
+		}
 		*cfg = wled4_config_defaults;
 		wled->wled_set_brightness = wled4_set_brightness;
 		wled->wled_sync_toggle = wled3_sync_toggle;

-- 
2.52.0

Re: [PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994
Posted by Daniel Thompson 1 month ago
On Thu, Jan 08, 2026 at 04:43:20AM +0100, Barnabás Czémán wrote:
> WLED4 found in PMI8994 supports different ovp values.
>
> Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible")
> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 41 +++++++++++++++++++++++++++++++++++--
>  1 file changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
> index a63bb42c8f8b..5decbd39b789 100644
> --- a/drivers/video/backlight/qcom-wled.c
> +++ b/drivers/video/backlight/qcom-wled.c
> @@ -1244,6 +1244,15 @@ static const struct wled_var_cfg wled4_ovp_cfg = {
>  	.size = ARRAY_SIZE(wled4_ovp_values),
>  };
>
> +static const u32 pmi8994_wled_ovp_values[] = {
> +	31000, 29500, 19400, 17800,
> +};
> +
> +static const struct wled_var_cfg pmi8994_wled_ovp_cfg = {
> +	.values = pmi8994_wled_ovp_values,
> +	.size = ARRAY_SIZE(pmi8994_wled_ovp_values),
> +};
> +

Do these *have* to be named after one of the two PMICs that implement
this OVP range.

Would something like wled4_alternative_ovp_values[] (and the same
throughout the patch) be more descriptive?


Daniel.
Re: [PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994
Posted by barnabas.czeman@mainlining.org 1 month ago
On 2026-01-08 12:28, Daniel Thompson wrote:
> On Thu, Jan 08, 2026 at 04:43:20AM +0100, Barnabás Czémán wrote:
>> WLED4 found in PMI8994 supports different ovp values.
>> 
>> Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 
>> compatible")
>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
>> ---
>>  drivers/video/backlight/qcom-wled.c | 41 
>> +++++++++++++++++++++++++++++++++++--
>>  1 file changed, 39 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/video/backlight/qcom-wled.c 
>> b/drivers/video/backlight/qcom-wled.c
>> index a63bb42c8f8b..5decbd39b789 100644
>> --- a/drivers/video/backlight/qcom-wled.c
>> +++ b/drivers/video/backlight/qcom-wled.c
>> @@ -1244,6 +1244,15 @@ static const struct wled_var_cfg wled4_ovp_cfg 
>> = {
>>  	.size = ARRAY_SIZE(wled4_ovp_values),
>>  };
>> 
>> +static const u32 pmi8994_wled_ovp_values[] = {
>> +	31000, 29500, 19400, 17800,
>> +};
>> +
>> +static const struct wled_var_cfg pmi8994_wled_ovp_cfg = {
>> +	.values = pmi8994_wled_ovp_values,
>> +	.size = ARRAY_SIZE(pmi8994_wled_ovp_values),
>> +};
>> +
> 
> Do these *have* to be named after one of the two PMICs that implement
> this OVP range.
> 
> Would something like wled4_alternative_ovp_values[] (and the same
> throughout the patch) be more descriptive?
I don't know. I don't like the PMIC naming either but at least it
descriptive about wich PMIC is needing these values.
I think PMIC naming would be fine if compatibles what representing the
same configurations would be deprecated and used as a fallback 
compatbile
style.
I mean we could kept the first added compatible for a configuration.
Maybe they should be named diferently i don't know if WLEDs have 
subversion.
> 
> 
> Daniel.
Re: [PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994
Posted by Konrad Dybcio 1 month ago
On 1/9/26 7:36 AM, barnabas.czeman@mainlining.org wrote:
> On 2026-01-08 12:28, Daniel Thompson wrote:
>> On Thu, Jan 08, 2026 at 04:43:20AM +0100, Barnabás Czémán wrote:
>>> WLED4 found in PMI8994 supports different ovp values.
>>>
>>> Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible")
>>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
>>> ---
>>>  drivers/video/backlight/qcom-wled.c | 41 +++++++++++++++++++++++++++++++++++--
>>>  1 file changed, 39 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
>>> index a63bb42c8f8b..5decbd39b789 100644
>>> --- a/drivers/video/backlight/qcom-wled.c
>>> +++ b/drivers/video/backlight/qcom-wled.c
>>> @@ -1244,6 +1244,15 @@ static const struct wled_var_cfg wled4_ovp_cfg = {
>>>      .size = ARRAY_SIZE(wled4_ovp_values),
>>>  };
>>>
>>> +static const u32 pmi8994_wled_ovp_values[] = {
>>> +    31000, 29500, 19400, 17800,
>>> +};
>>> +
>>> +static const struct wled_var_cfg pmi8994_wled_ovp_cfg = {
>>> +    .values = pmi8994_wled_ovp_values,
>>> +    .size = ARRAY_SIZE(pmi8994_wled_ovp_values),
>>> +};
>>> +
>>
>> Do these *have* to be named after one of the two PMICs that implement
>> this OVP range.
>>
>> Would something like wled4_alternative_ovp_values[] (and the same
>> throughout the patch) be more descriptive?
> I don't know. I don't like the PMIC naming either but at least it
> descriptive about wich PMIC is needing these values.
> I think PMIC naming would be fine if compatibles what representing the
> same configurations would be deprecated and used as a fallback compatbile
> style.
> I mean we could kept the first added compatible for a configuration.
> Maybe they should be named diferently i don't know if WLEDs have subversion.

Every PMIC peripheral is versioned.

WLED has separate versioning for the digital and analog parts:

PMIC		ANA	DIG
---------------------------
PMI8937		2.0	1.0 (also needs the quirk)
PMI8950		2.0	1.0
PMI8994		2.0	1.0
PMI8996		2.1	1.0
PMI8998		3.1	3.0
PM660L		4.1	4.0

I don't know for sure if "PMIC4 with WLED ANA/DIG 3.x" a good
discriminant though..

Konrad
Re: [PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994
Posted by Daniel Thompson 1 month ago
On Fri, Jan 09, 2026 at 12:09:11PM +0100, Konrad Dybcio wrote:
> On 1/9/26 7:36 AM, barnabas.czeman@mainlining.org wrote:
> > On 2026-01-08 12:28, Daniel Thompson wrote:
> >> On Thu, Jan 08, 2026 at 04:43:20AM +0100, Barnabás Czémán wrote:
> >>> WLED4 found in PMI8994 supports different ovp values.
> >>>
> >>> Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible")
> >>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> >>> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
> >>> ---
> >>>  drivers/video/backlight/qcom-wled.c | 41 +++++++++++++++++++++++++++++++++++--
> >>>  1 file changed, 39 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
> >>> index a63bb42c8f8b..5decbd39b789 100644
> >>> --- a/drivers/video/backlight/qcom-wled.c
> >>> +++ b/drivers/video/backlight/qcom-wled.c
> >>> @@ -1244,6 +1244,15 @@ static const struct wled_var_cfg wled4_ovp_cfg = {
> >>>      .size = ARRAY_SIZE(wled4_ovp_values),
> >>>  };
> >>>
> >>> +static const u32 pmi8994_wled_ovp_values[] = {
> >>> +    31000, 29500, 19400, 17800,
> >>> +};
> >>> +
> >>> +static const struct wled_var_cfg pmi8994_wled_ovp_cfg = {
> >>> +    .values = pmi8994_wled_ovp_values,
> >>> +    .size = ARRAY_SIZE(pmi8994_wled_ovp_values),
> >>> +};
> >>> +
> >>
> >> Do these *have* to be named after one of the two PMICs that implement
> >> this OVP range.
> >>
> >> Would something like wled4_alternative_ovp_values[] (and the same
> >> throughout the patch) be more descriptive?
> > I don't know. I don't like the PMIC naming either but at least it
> > descriptive about wich PMIC is needing these values.

It's the descriptive but wrong element I dislike (pmi8994_wled_ovp_cfg
is used by pmi8550).

I know these things crop up for "historical reasons" when is appears in
the same patchset I have to question the naming.


> > I think PMIC naming would be fine if compatibles what representing the
> > same configurations would be deprecated and used as a fallback compatbile
> > style.
> > I mean we could kept the first added compatible for a configuration.
> > Maybe they should be named diferently i don't know if WLEDs have subversion.
>
> Every PMIC peripheral is versioned.
>
> WLED has separate versioning for the digital and analog parts:
>
> PMIC		ANA	DIG
> ---------------------------
> PMI8937		2.0	1.0 (also needs the quirk)
> PMI8950		2.0	1.0
> PMI8994		2.0	1.0
> PMI8996		2.1	1.0
> PMI8998		3.1	3.0
> PM660L		4.1	4.0
>
> I don't know for sure if "PMIC4 with WLED ANA/DIG 3.x" a good
> discriminant though..

Peronally I'd prefer that to making them all use pmi8994 structures.
It's a much better link back to the docs (at least for those with the
power to read them ;-) ).


Daniel.
Re: [PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994
Posted by barnabas.czeman@mainlining.org 1 month ago
On 2026-01-09 14:33, Daniel Thompson wrote:
> On Fri, Jan 09, 2026 at 12:09:11PM +0100, Konrad Dybcio wrote:
>> On 1/9/26 7:36 AM, barnabas.czeman@mainlining.org wrote:
>> > On 2026-01-08 12:28, Daniel Thompson wrote:
>> >> On Thu, Jan 08, 2026 at 04:43:20AM +0100, Barnabás Czémán wrote:
>> >>> WLED4 found in PMI8994 supports different ovp values.
>> >>>
>> >>> Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible")
>> >>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>> >>> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
>> >>> ---
>> >>>  drivers/video/backlight/qcom-wled.c | 41 +++++++++++++++++++++++++++++++++++--
>> >>>  1 file changed, 39 insertions(+), 2 deletions(-)
>> >>>
>> >>> diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
>> >>> index a63bb42c8f8b..5decbd39b789 100644
>> >>> --- a/drivers/video/backlight/qcom-wled.c
>> >>> +++ b/drivers/video/backlight/qcom-wled.c
>> >>> @@ -1244,6 +1244,15 @@ static const struct wled_var_cfg wled4_ovp_cfg = {
>> >>>      .size = ARRAY_SIZE(wled4_ovp_values),
>> >>>  };
>> >>>
>> >>> +static const u32 pmi8994_wled_ovp_values[] = {
>> >>> +    31000, 29500, 19400, 17800,
>> >>> +};
>> >>> +
>> >>> +static const struct wled_var_cfg pmi8994_wled_ovp_cfg = {
>> >>> +    .values = pmi8994_wled_ovp_values,
>> >>> +    .size = ARRAY_SIZE(pmi8994_wled_ovp_values),
>> >>> +};
>> >>> +
>> >>
>> >> Do these *have* to be named after one of the two PMICs that implement
>> >> this OVP range.
>> >>
>> >> Would something like wled4_alternative_ovp_values[] (and the same
>> >> throughout the patch) be more descriptive?
>> > I don't know. I don't like the PMIC naming either but at least it
>> > descriptive about wich PMIC is needing these values.
> 
> It's the descriptive but wrong element I dislike (pmi8994_wled_ovp_cfg
> is used by pmi8550).
No, pmi8950 is using pmi8994_wled_opts struct what is using 
pmi8994_wled_ovp_cfg.
> 
> I know these things crop up for "historical reasons" when is appears in
> the same patchset I have to question the naming.
> 
> 
>> > I think PMIC naming would be fine if compatibles what representing the
>> > same configurations would be deprecated and used as a fallback compatbile
>> > style.
>> > I mean we could kept the first added compatible for a configuration.
>> > Maybe they should be named diferently i don't know if WLEDs have subversion.
>> 
>> Every PMIC peripheral is versioned.
>> 
>> WLED has separate versioning for the digital and analog parts:
>> 
>> PMIC		ANA	DIG
>> ---------------------------
>> PMI8937		2.0	1.0 (also needs the quirk)
>> PMI8950		2.0	1.0
>> PMI8994		2.0	1.0
>> PMI8996		2.1	1.0
>> PMI8998		3.1	3.0
>> PM660L		4.1	4.0
>> 
>> I don't know for sure if "PMIC4 with WLED ANA/DIG 3.x" a good
>> discriminant though..
> 
> Peronally I'd prefer that to making them all use pmi8994 structures.
> It's a much better link back to the docs (at least for those with the
> power to read them ;-) ).
> 
> 
> Daniel.
Re: [PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994
Posted by barnabas.czeman@mainlining.org 1 month ago
On 2026-01-09 16:42, barnabas.czeman@mainlining.org wrote:
> On 2026-01-09 14:33, Daniel Thompson wrote:
>> On Fri, Jan 09, 2026 at 12:09:11PM +0100, Konrad Dybcio wrote:
>>> On 1/9/26 7:36 AM, barnabas.czeman@mainlining.org wrote:
>>> > On 2026-01-08 12:28, Daniel Thompson wrote:
>>> >> On Thu, Jan 08, 2026 at 04:43:20AM +0100, Barnabás Czémán wrote:
>>> >>> WLED4 found in PMI8994 supports different ovp values.
>>> >>>
>>> >>> Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible")
>>> >>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>> >>> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
>>> >>> ---
>>> >>>  drivers/video/backlight/qcom-wled.c | 41 +++++++++++++++++++++++++++++++++++--
>>> >>>  1 file changed, 39 insertions(+), 2 deletions(-)
>>> >>>
>>> >>> diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
>>> >>> index a63bb42c8f8b..5decbd39b789 100644
>>> >>> --- a/drivers/video/backlight/qcom-wled.c
>>> >>> +++ b/drivers/video/backlight/qcom-wled.c
>>> >>> @@ -1244,6 +1244,15 @@ static const struct wled_var_cfg wled4_ovp_cfg = {
>>> >>>      .size = ARRAY_SIZE(wled4_ovp_values),
>>> >>>  };
>>> >>>
>>> >>> +static const u32 pmi8994_wled_ovp_values[] = {
>>> >>> +    31000, 29500, 19400, 17800,
>>> >>> +};
>>> >>> +
>>> >>> +static const struct wled_var_cfg pmi8994_wled_ovp_cfg = {
>>> >>> +    .values = pmi8994_wled_ovp_values,
>>> >>> +    .size = ARRAY_SIZE(pmi8994_wled_ovp_values),
>>> >>> +};
>>> >>> +
>>> >>
>>> >> Do these *have* to be named after one of the two PMICs that implement
>>> >> this OVP range.
>>> >>
>>> >> Would something like wled4_alternative_ovp_values[] (and the same
>>> >> throughout the patch) be more descriptive?
>>> > I don't know. I don't like the PMIC naming either but at least it
>>> > descriptive about wich PMIC is needing these values.
>> 
>> It's the descriptive but wrong element I dislike (pmi8994_wled_ovp_cfg
>> is used by pmi8550).
> No, pmi8950 is using pmi8994_wled_opts struct what is using 
> pmi8994_wled_ovp_cfg.
Maybe would be better move opts to compatible data.
>> 
>> I know these things crop up for "historical reasons" when is appears 
>> in
>> the same patchset I have to question the naming.
>> 
>> 
>>> > I think PMIC naming would be fine if compatibles what representing the
>>> > same configurations would be deprecated and used as a fallback compatbile
>>> > style.
>>> > I mean we could kept the first added compatible for a configuration.
>>> > Maybe they should be named diferently i don't know if WLEDs have subversion.
>>> 
>>> Every PMIC peripheral is versioned.
>>> 
>>> WLED has separate versioning for the digital and analog parts:
>>> 
>>> PMIC		ANA	DIG
>>> ---------------------------
>>> PMI8937		2.0	1.0 (also needs the quirk)
>>> PMI8950		2.0	1.0
>>> PMI8994		2.0	1.0
>>> PMI8996		2.1	1.0
>>> PMI8998		3.1	3.0
>>> PM660L		4.1	4.0
>>> 
>>> I don't know for sure if "PMIC4 with WLED ANA/DIG 3.x" a good
>>> discriminant though..
>> 
>> Peronally I'd prefer that to making them all use pmi8994 structures.
>> It's a much better link back to the docs (at least for those with the
>> power to read them ;-) ).
>> 
>> 
>> Daniel.
Re: [PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994
Posted by Konrad Dybcio 1 month ago
On 1/8/26 4:43 AM, Barnabás Czémán wrote:
> WLED4 found in PMI8994 supports different ovp values.
> 
> Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible")
> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
> ---

Likewise, I reviewed a version that said PMI8950 instead.

Konrad
Re: [PATCH v2 2/7] backlight: qcom-wled: Support ovp values for PMI8994
Posted by Konrad Dybcio 1 month ago
On 1/8/26 9:55 AM, Konrad Dybcio wrote:
> On 1/8/26 4:43 AM, Barnabás Czémán wrote:
>> WLED4 found in PMI8994 supports different ovp values.
>>
>> Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible")
>> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
>> ---
> 
> Likewise, I reviewed a version that said PMI8950 instead.

We can keep it because PMI8994 seems to fall under the same category
indeed

Konrad