Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

leds: rgb: leds-qcom-lpg: Add PPG check for setting/clearing PBS triggers

Currently, all LED LPG devices will call lpg_{set,clear}_pbs_trigger()
when setting brightness regardless of if they support PPG and have PBS
triggers. Check if device supports PPG before setting/clearing PBS
triggers.

Fixes: 6ab1f766a80a ("leds: rgb: leds-qcom-lpg: Add support for PPG through single SDAM")
Fixes: 5e9ff626861a ("leds: rgb: leds-qcom-lpg: Include support for PPG with dedicated LUT SDAM")
Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20240607005250.4047135-1-quic_amelende@quicinc.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Anjelique Melendez and committed by
Lee Jones
7e776e21 ab477b76

+7 -1
+7 -1
drivers/leds/rgb/leds-qcom-lpg.c
··· 2 2 /* 3 3 * Copyright (c) 2017-2022 Linaro Ltd 4 4 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. 5 - * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. 5 + * Copyright (c) 2023-2024, Qualcomm Innovation Center, Inc. All rights reserved. 6 6 */ 7 7 #include <linux/bits.h> 8 8 #include <linux/bitfield.h> ··· 254 254 u8 val = 0; 255 255 int rc; 256 256 257 + if (!lpg->lpg_chan_sdam) 258 + return 0; 259 + 257 260 lpg->pbs_en_bitmap &= (~lut_mask); 258 261 if (!lpg->pbs_en_bitmap) { 259 262 rc = nvmem_device_write(lpg->lpg_chan_sdam, SDAM_REG_PBS_SEQ_EN, 1, &val); ··· 278 275 { 279 276 u8 val = PBS_SW_TRIG_BIT; 280 277 int rc; 278 + 279 + if (!lpg->lpg_chan_sdam) 280 + return 0; 281 281 282 282 if (!lpg->pbs_en_bitmap) { 283 283 rc = nvmem_device_write(lpg->lpg_chan_sdam, SDAM_REG_PBS_SEQ_EN, 1, &val);