Re: [PATCH v8 4/7] leds: rgb: leds-qcom-lpg: Add support for PPG through single SDAM

From: Lee Jones
Date: Thu Jan 11 2024 - 05:06:47 EST


On Thu, 21 Dec 2023, Anjelique Melendez wrote:

> In some PMICs like pmi632, the pattern look up table (LUT) and LPG
> configuration is stored in a single SDAM module instead of LUT
> peripheral. This feature is called PPG. PPG uses Qualcomm Programmable
> Boot Sequencer (PBS) inorder to trigger pattern sequences for PMICs.
>
> Signed-off-by: Anjelique Melendez <quic_amelende@xxxxxxxxxxx>
> Tested-by: Luca Weiss <luca.weiss@xxxxxxxxxxxxx>
> ---
> drivers/leds/rgb/leds-qcom-lpg.c | 268 ++++++++++++++++++++++++++++---
> 1 file changed, 244 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
> index 68d82a682bf6..a76cb1d6b7b5 100644
> --- a/drivers/leds/rgb/leds-qcom-lpg.c
> +++ b/drivers/leds/rgb/leds-qcom-lpg.c
> @@ -8,11 +8,13 @@
> #include <linux/bitfield.h>
> #include <linux/led-class-multicolor.h>
> #include <linux/module.h>
> +#include <linux/nvmem-consumer.h>
> #include <linux/of.h>
> #include <linux/platform_device.h>
> #include <linux/pwm.h>
> #include <linux/regmap.h>
> #include <linux/slab.h>
> +#include <linux/soc/qcom/qcom-pbs.h>

[...]

> +static void lpg_sdam_apply_lut_control(struct lpg_channel *chan)
> +{
> + struct nvmem_device *lpg_chan_sdam = chan->lpg->lpg_chan_sdam;
> + unsigned int lo_idx = chan->pattern_lo_idx;
> + unsigned int hi_idx = chan->pattern_hi_idx;
> + u8 val = 0, conf = 0;
> +
> + if (!chan->ramp_enabled || chan->pattern_lo_idx == chan->pattern_hi_idx)

Nit: you can use lo_idx and hi_idx here instead, right?

Please fix this up subsequently.

--
Lee Jones [李琼斯]