| From 79593aa52562650ff10af41ad89783cdb76440ba Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Fri, 16 Jan 2026 08:07:34 +0100 |
| Subject: backlight: qcom-wled: Support ovp values for PMI8994 |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| From: Barnabás Czémán <barnabas.czeman@mainlining.org> |
| |
| [ Upstream commit f29f972a6e7e3f187ea4d89b98a76c1981ca4d53 ] |
| |
| WLED4 found in PMI8994 supports different ovp values. |
| |
| Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible") |
| Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org> |
| Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> |
| Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> |
| Link: https://patch.msgid.link/20260116-pmi8950-wled-v3-2-e6c93de84079@mainlining.org |
| Signed-off-by: Lee Jones <lee@kernel.org> |
| Signed-off-by: Sasha Levin <sashal@kernel.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 21c1fba64ad5d..2ecfbe1b0d3d4 100644 |
| --- a/drivers/video/backlight/qcom-wled.c |
| +++ b/drivers/video/backlight/qcom-wled.c |
| @@ -1242,6 +1242,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) |
| { |
| /* |
| @@ -1355,6 +1364,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", |
| @@ -1421,8 +1453,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.51.0 |
| |