Linux Documentation
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Cc: linux-arm-msm@vger.kernel.org, "Pavel Machek" <pavel@kernel.org>,
	"Griffin Kroah-Hartman" <griffin@kroah.com>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Anjelique Melendez" <quic_amelende@quicinc.com>,
	"Guru Das Srinagesh" <linux@gurudas.dev>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"David Collins" <david.collins@oss.qualcomm.com>,
	"Subbaraman Narayanamurthy"
	<subbaraman.narayanamurthy@oss.qualcomm.com>,
	"Kamal Wadhwa" <kamal.wadhwa@oss.qualcomm.com>,
	"Pavel Machek" <pavel@ucw.cz>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pwm@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v3 2/4] leds: rgb: leds-qcom-lpg: Fix LED color balancing in HW pattern mode
Date: Tue, 1 Dec 2026 14:24:37 +0000	[thread overview]
Message-ID: <179568561811.32537.12779758747288611716@kernel.org> (raw)
In-Reply-To: <20261122-led-qcom-leds-multiple-fixes-and-pwm-fm-support-v3-2-f911edd40a31@oss.qualcomm.com>

On Sun, 22 Nov 2026, Fenglin Wu wrote:

> The multicolor hardware-pattern path has two related issues.
>
> First, lpg_pattern_set() programs one unscaled LUT and assigns it to
> every LPG channel. RGB and multicolor LEDs therefore replay identical
> brightness values regardless of multi_intensity, making the output
> white-balanced rather than preserving the requested color.
>
> Fix this by normalizing the requested pattern once, scaling its
> brightness values for each enabled sub-LED, and allocating and
> programming a separate LUT range for every active LPG channel. Stop the
> channels before replacing or releasing their LUTs, and roll back all
> per-channel allocations if an update fails.
>
> Second, a pattern is scaled only when it is installed. Updating
> brightness or multi_intensity while it is active leaves already-enabled
> channels with stale LUT values. A channel that was disabled when the
> pattern was installed has no LUT and falls back to static PWM when it is
> enabled later.
>
> Fix this by caching the normalized, unscaled pattern and repeat state.
> On each multicolor brightness callback, stop the running pattern,
> release its per-channel LUTs, rebuild them from the current sub-LED
> intensities, and restart the active channels. Clear the cached active
> state when the pattern is removed.
>
> The second issue was identified and fixed by OpenAI Codex when I used
> it to review the original change.
>
> Both of the fixes have been tested on a Maili QRD device and confirmed
> that the HW pattern of a multicolor LED could be scaled and refreshed
> correctly whenever hw_pattern, brightness, multi_intensity were updated.
>
> Fixes: 24e2d05d1b68 ("leds: Add driver for Qualcomm LPG")
> 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: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
> ---
>  Documentation/leds/leds-qcom-lpg.rst |   9 +
>  drivers/leds/rgb/leds-qcom-lpg.c     | 324 ++++++++++++++++++++++++++++-------
>  2 files changed, 275 insertions(+), 58 deletions(-)
>
> diff --git a/Documentation/leds/leds-qcom-lpg.rst b/Documentation/leds/leds-qcom-lpg.rst
> index d6a76c38c581..e83d8dde7eab 100644
> --- a/Documentation/leds/leds-qcom-lpg.rst
> +++ b/Documentation/leds/leds-qcom-lpg.rst
> @@ -39,6 +39,15 @@ described below). As the LPG hardware is not able to perform the linear
>  transitions expected by the leds-trigger-pattern format, each entry in the
>  pattern must be followed a zero-length entry of the same brightness.
>
> +For multicolor LEDs, each pattern brightness value is scaled by the component
> +brightness calculated from the global ``brightness`` and ``multi_intensity``
> +values. A component whose calculated brightness is zero does not have a LUT
> +range allocated. Consequently, if ``hw_pattern`` is configured while global
> +brightness is zero, the pattern is cached but no LUT range is programmed until
> +a brightness or intensity update produces a nonzero component brightness.
> +Changing either value while a hardware pattern is active rebuilds the
> +per-component LUT ranges.
> +
>  Simple pattern::
>
>      "255 500 255 0 0 500 0 0"
> diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
> index 5a63f3bc5dcf..eec942f2af6c 100644
> --- a/drivers/leds/rgb/leds-qcom-lpg.c
> +++ b/drivers/leds/rgb/leds-qcom-lpg.c
> @@ -151,11 +151,32 @@ struct lpg_channel {
>  	bool has_lut;
>  };
>
> +/**
> + * struct lpg_pattern - The LPG pattern normalized from the LED pattern
> + * @data:	The pattern data array
> + * @len:	number of entries to write to the LUT
> + * @delta_t:	common step duration in ms
> + * @lo_pause:	low-pause duration in ms
> + * @hi_pause:	high-pause duration in ms
> + * @ping_pong:	true if the pattern support reverse
> + */
> +struct lpg_pattern {
> +	struct led_pattern *data;
> +	unsigned int len;
> +	unsigned int delta_t;
> +	unsigned int lo_pause;
> +	unsigned int hi_pause;
> +	bool ping_pong;
> +};
> +
>  /**
>   * struct lpg_led - logical LED object
>   * @lpg:		lpg context reference
>   * @cdev:		LED class device
>   * @mcdev:		Multicolor LED class device
> + * @pattern:		unscaled active multicolor pattern; zero length when inactive
> + * @scaled_pattern:	scratch buffer for per-channel LUT updates
> + * @pattern_oneshot:	whether the cached pattern is played only once
>   * @channels:		list of channels associated with the LED
>   * @num_channels:	number of @channels
>   */
> @@ -164,6 +185,9 @@ struct lpg_led {
>
>  	struct led_classdev cdev;
>  	struct led_classdev_mc mcdev;
> +	struct lpg_pattern pattern;
> +	struct led_pattern *scaled_pattern;
> +	bool pattern_oneshot;
>
>  	unsigned int num_channels;
>  	struct lpg_channel *channels[] __counted_by(num_channels);
> @@ -179,6 +203,7 @@ struct lpg_led {
>   * @lut_base:	base address of the LUT block (optional)
>   * @lut_size:	number of entries in the LUT block
>   * @lut_bitmap:	allocation bitmap for LUT entries
> + * @lut_bitmap_tmp: scratch bitmap for LUT allocation preflight
>   * @pbs_dev:	PBS device
>   * @lpg_chan_sdam:	LPG SDAM peripheral device
>   * @lut_sdam:	LUT SDAM peripheral device
> @@ -203,6 +228,7 @@ struct lpg {
>  	u32 lut_base;
>  	u32 lut_size;
>  	unsigned long *lut_bitmap;
> +	unsigned long *lut_bitmap_tmp;
>
>  	struct pbs_dev *pbs_dev;
>  	struct nvmem_device *lpg_chan_sdam;
> @@ -876,18 +902,25 @@ static int lpg_brightness_single_set(struct led_classdev *cdev,
>  	return 0;
>  }
>
> +static int lpg_pattern_mc_update(struct lpg_led *led);

No forward declarations please.  Didn't we already discuss this?

>  static int lpg_brightness_mc_set(struct led_classdev *cdev,
>  				 enum led_brightness value)
>  {
>  	struct led_classdev_mc *mc = lcdev_to_mccdev(cdev);
>  	struct lpg_led *led = container_of(mc, struct lpg_led, mcdev);
> +	int ret = 0;
>
> -	mutex_lock(&led->lpg->lock);
> +	guard(mutex)(&led->lpg->lock);
>
>  	led_mc_calc_color_components(mc, value);
> -	lpg_brightness_set(led, cdev, mc->subled_info);
> +	if (led->pattern.len) {
> +		ret = lpg_pattern_mc_update(led);
> +		if (ret)
> +			return ret;
> +	}
>
> -	mutex_unlock(&led->lpg->lock);
> +	lpg_brightness_set(led, cdev, mc->subled_info);
>
>  	return 0;
>  }
> @@ -966,23 +999,16 @@ static int lpg_blink_mc_set(struct led_classdev *cdev,
>  	return ret;
>  }
>
> -static int lpg_pattern_set(struct lpg_led *led, struct led_pattern *led_pattern,
> -			   u32 len, int repeat)
> +static int lpg_prepare_pattern(struct lpg *lpg,
> +			       struct led_pattern *led_pattern, u32 len,
> +			       int repeat, struct lpg_pattern *prep)
>  {
> -	struct lpg_channel *chan;
> -	struct lpg *lpg = led->lpg;
> -	struct led_pattern *pattern;
>  	unsigned int brightness_a;
>  	unsigned int brightness_b;
> -	unsigned int hi_pause = 0;
> -	unsigned int lo_pause = 0;
>  	unsigned int actual_len;
>  	unsigned int delta_t;
> -	unsigned int lo_idx;
> -	unsigned int hi_idx;
>  	unsigned int i;
>  	bool ping_pong = true;
> -	int ret = -EINVAL;
>
>  	/* Hardware only support oneshot or indefinite loops */
>  	if (repeat != -1 && repeat != 1)
> @@ -1002,15 +1028,16 @@ static int lpg_pattern_set(struct lpg_led *led, struct led_pattern *led_pattern,
>  	if (len % 2)
>  		return -EINVAL;
>
> -	pattern = kzalloc_objs(*pattern, len / 2);
> +	struct led_pattern *pattern __free(kfree) = kzalloc_objs(*pattern, len / 2);
> +
>  	if (!pattern)
>  		return -ENOMEM;
>
>  	for (i = 0; i < len; i += 2) {
>  		if (led_pattern[i].brightness != led_pattern[i + 1].brightness)
> -			goto out_free_pattern;
> +			return -EINVAL;
>  		if (led_pattern[i + 1].delta_t != 0)
> -			goto out_free_pattern;
> +			return -EINVAL;
>
>  		pattern[i / 2].brightness = led_pattern[i].brightness;
>  		pattern[i / 2].delta_t = led_pattern[i].delta_t;
> @@ -1023,7 +1050,7 @@ static int lpg_pattern_set(struct lpg_led *led, struct led_pattern *led_pattern,
>  	 * through the entire LUT, so prohibit this.
>  	 */
>  	if (len < 2)
> -		goto out_free_pattern;
> +		return -EINVAL;
>
>  	/*
>  	 * The LPG plays patterns with at a fixed pace, a "low pause" can be
> @@ -1080,13 +1107,13 @@ static int lpg_pattern_set(struct lpg_led *led, struct led_pattern *led_pattern,
>  			 * specify hi pause. Reject other variations.
>  			 */
>  			if (i != actual_len - 1)
> -				goto out_free_pattern;
> +				return -EINVAL;
>  		}
>  	}
>
>  	/* LPG_RAMP_DURATION_REG is a 9bit */
>  	if (delta_t >= BIT(9))
> -		goto out_free_pattern;
> +		return -EINVAL;
>
>  	/*
>  	 * Find "low pause" and "high pause" in the pattern in the LUT case.
> @@ -1094,44 +1121,65 @@ static int lpg_pattern_set(struct lpg_led *led, struct led_pattern *led_pattern,
>  	 * duration of all steps.
>  	 */
>  	if (lpg->lut_base || lpg->lut_sdam) {
> -		lo_pause = pattern[0].delta_t;
> -		hi_pause = pattern[actual_len - 1].delta_t;
> +		prep->lo_pause = pattern[0].delta_t;
> +		prep->hi_pause = pattern[actual_len - 1].delta_t;
>  	} else {
>  		if (delta_t != pattern[0].delta_t || delta_t != pattern[actual_len - 1].delta_t)
> -			goto out_free_pattern;
> +			return -EINVAL;
> +		prep->lo_pause = 0;
> +		prep->hi_pause = 0;
>  	}
>
> +	prep->data = no_free_ptr(pattern);
> +	prep->len = actual_len;
> +	prep->delta_t = delta_t;
> +	prep->ping_pong = ping_pong;
>
> -	mutex_lock(&lpg->lock);
> +	return 0;
> +}
> +
> +static int lpg_pattern_set(struct lpg_led *led, struct led_pattern *led_pattern,
> +			   u32 len, int repeat)
> +{
> +	struct lpg_channel *chan;
> +	struct lpg *lpg = led->lpg;
> +	struct lpg_pattern pattern;
> +	unsigned int lo_idx;
> +	unsigned int hi_idx;
> +	unsigned int i;
> +	int ret;
> +
> +	ret = lpg_prepare_pattern(lpg, led_pattern, len, repeat, &pattern);
> +	if (ret < 0)

From v1: if (ret)?

> +		return ret;
> +
> +	struct led_pattern *prep_data __free(kfree) = pattern.data;
> +
> +	guard(mutex)(&lpg->lock);
>
>  	if (lpg->lut_base)
> -		ret = lpg_lut_store(lpg, pattern, actual_len, &lo_idx, &hi_idx);
> +		ret = lpg_lut_store(lpg, prep_data, pattern.len, &lo_idx, &hi_idx);
>  	else
> -		ret = lpg_lut_store_sdam(lpg, pattern, actual_len, &lo_idx, &hi_idx);
> +		ret = lpg_lut_store_sdam(lpg, prep_data, pattern.len, &lo_idx, &hi_idx);
>
>  	if (ret < 0)
> -		goto out_unlock;
> +		return ret;
>
>  	for (i = 0; i < led->num_channels; i++) {
>  		chan = led->channels[i];
>
> -		chan->ramp_tick_ms = delta_t;
> -		chan->ramp_ping_pong = ping_pong;
> +		chan->ramp_tick_ms = pattern.delta_t;
> +		chan->ramp_ping_pong = pattern.ping_pong;
>  		chan->ramp_oneshot = repeat != -1;
>
> -		chan->ramp_lo_pause_ms = lo_pause;
> -		chan->ramp_hi_pause_ms = hi_pause;
> +		chan->ramp_lo_pause_ms = pattern.lo_pause;
> +		chan->ramp_hi_pause_ms = pattern.hi_pause;
>
>  		chan->pattern_lo_idx = lo_idx;
>  		chan->pattern_hi_idx = hi_idx;
>  		chan->has_lut = true;
>  	}
>
> -out_unlock:
> -	mutex_unlock(&lpg->lock);
> -out_free_pattern:
> -	kfree(pattern);
> -
>  	return ret;
>  }
>
> @@ -1151,50 +1199,196 @@ static int lpg_pattern_single_set(struct led_classdev *cdev,
>  	return 0;
>  }
>
> -static int lpg_pattern_mc_set(struct led_classdev *cdev,
> -			      struct led_pattern *pattern, u32 len,
> -			      int repeat)
> +/* Caller must hold lpg->lock. Stop all readers before releasing their LUTs. */
> +static int lpg_pattern_stop(struct lpg_led *led)
>  {
> -	struct led_classdev_mc *mc = lcdev_to_mccdev(cdev);
> -	struct lpg_led *led = container_of(mc, struct lpg_led, mcdev);
> +	struct lpg *lpg = led->lpg;
> +	struct lpg_channel *chan;
>  	unsigned int triled_mask = 0;
> -	int ret, i;
> +	unsigned int i;
> +	int ret;
>
>  	for (i = 0; i < led->num_channels; i++)
>  		triled_mask |= led->channels[i]->triled_mask;
> -	triled_set(led->lpg, triled_mask, 0);
> -
> -	ret = lpg_pattern_set(led, pattern, len, repeat);
> -	if (ret < 0)
> +	ret = triled_set(lpg, triled_mask, 0);
> +	if (ret)
>  		return ret;
>
> -	led_mc_calc_color_components(mc, LED_FULL);
> -	lpg_brightness_set(led, cdev, mc->subled_info);
> +	for (i = 0; i < led->num_channels; i++) {
> +		chan = led->channels[i];
> +		ret = lpg_sdam_configure_triggers(chan, 0);
> +		if (ret < 0)


As above, etc.

Below too:

> +			return ret;
> +		ret = regmap_update_bits(lpg->map, chan->base + PWM_ENABLE_CONTROL_REG,
> +					 LPG_ENABLE_CONTROL_OUTPUT |
> +					 LPG_ENABLE_CONTROL_RAMP_GEN, 0);
> +		if (ret)
> +			return ret;
> +		ret = lpg_clear_pbs_trigger(lpg, chan->lut_mask);
> +		if (ret)
> +			return ret;
> +
> +		chan->enabled = false;
> +		chan->ramp_enabled = false;
> +	}
>
>  	return 0;
>  }
>
> -static int lpg_pattern_clear(struct lpg_led *led)
> +/* Caller must hold lpg->lock. */
> +static int lpg_pattern_mc_preflight(struct lpg_led *led)
>  {
> +	struct led_classdev_mc *mc = &led->mcdev;
> +	struct lpg_pattern *pattern = &led->pattern;
> +	struct lpg *lpg = led->lpg;
>  	struct lpg_channel *chan;
> +	unsigned int idx;
> +	unsigned int i;
> +	int len;
> +
> +	bitmap_copy(lpg->lut_bitmap_tmp, lpg->lut_bitmap, lpg->lut_size);
> +
> +	for (i = 0; i < led->num_channels; i++) {
> +		chan = led->channels[i];
> +		if (!chan->has_lut)
> +			continue;
> +
> +		len = chan->pattern_hi_idx - chan->pattern_lo_idx + 1;
> +		bitmap_clear(lpg->lut_bitmap_tmp, chan->pattern_lo_idx, len);
> +	}
> +
> +	for (i = 0; i < led->num_channels; i++) {
> +		if (!mc->subled_info[i].brightness)
> +			continue;
> +
> +		idx = bitmap_find_next_zero_area(lpg->lut_bitmap_tmp, lpg->lut_size,
> +						 0, pattern->len, 0);
> +		if (idx >= lpg->lut_size)
> +			return lpg->lut_base ? -ENOMEM : -ENOSPC;
> +
> +		bitmap_set(lpg->lut_bitmap_tmp, idx, pattern->len);
> +	}
> +
> +	return 0;
> +}
> +
> +/* Caller must hold lpg->lock. */
> +static int lpg_pattern_mc_update(struct lpg_led *led)
> +{
> +	struct led_classdev_mc *mc = &led->mcdev;
> +	struct led_classdev *cdev = &mc->led_cdev;
> +	struct lpg_pattern *pattern = &led->pattern;
> +	struct led_pattern *scaled = led->scaled_pattern;
>  	struct lpg *lpg = led->lpg;
> -	int i;
> +	struct lpg_channel *chan;
> +	unsigned int lo_idx, hi_idx;
> +	unsigned int i, j;
> +	int ret;
>
> -	mutex_lock(&lpg->lock);
> +	ret = lpg_pattern_mc_preflight(led);
> +	if (ret)
> +		return ret;
>
> -	chan = led->channels[0];
> -	lpg_lut_free(chan);
> +	ret = lpg_pattern_stop(led);
> +	if (ret)
> +		return ret;
> +
> +	for (i = 0; i < led->num_channels; i++)
> +		lpg_lut_free(led->channels[i]);
>
>  	for (i = 0; i < led->num_channels; i++) {
>  		chan = led->channels[i];
> -		lpg_sdam_configure_triggers(chan, 0);
> -		lpg_clear_pbs_trigger(chan->lpg, chan->lut_mask);
> -		chan->pattern_lo_idx = 0;
> -		chan->pattern_hi_idx = 0;
> -		chan->has_lut = false;
> +
> +		/* Ignore pattern config for 0 brightness channel */
> +		if (!mc->subled_info[i].brightness)
> +			continue;
> +
> +		/* Rebuild the pattern based on component brightness. */
> +		for (j = 0; j < pattern->len; j++) {
> +			scaled[j].brightness =
> +				DIV_ROUND_CLOSEST((u32)pattern->data[j].brightness *
> +						  mc->subled_info[i].brightness,
> +						  cdev->max_brightness);
> +			scaled[j].delta_t = pattern->data[j].delta_t;
> +		}
> +
> +		if (lpg->lut_base)
> +			ret = lpg_lut_store(lpg, scaled, pattern->len, &lo_idx, &hi_idx);
> +		else
> +			ret = lpg_lut_store_sdam(lpg, scaled, pattern->len, &lo_idx, &hi_idx);
> +		if (ret < 0)
> +			goto out_free;
> +
> +		chan->ramp_tick_ms = pattern->delta_t;
> +		chan->ramp_ping_pong = pattern->ping_pong;
> +		chan->ramp_oneshot = led->pattern_oneshot;
> +		chan->ramp_lo_pause_ms = pattern->lo_pause;
> +		chan->ramp_hi_pause_ms = pattern->hi_pause;
> +		chan->pattern_lo_idx = lo_idx;
> +		chan->pattern_hi_idx = hi_idx;
> +		chan->has_lut = true;
>  	}
>
> -	mutex_unlock(&lpg->lock);
> +	return 0;
> +
> +out_free:
> +	for (i = 0; i < led->num_channels; i++)
> +		lpg_lut_free(led->channels[i]);
> +	return ret;
> +}
> +
> +static int lpg_pattern_mc_set(struct led_classdev *cdev,
> +			      struct led_pattern *led_pattern, u32 len,
> +			      int repeat)
> +{
> +	struct led_classdev_mc *mc = lcdev_to_mccdev(cdev);
> +	struct lpg_led *led = container_of(mc, struct lpg_led, mcdev);
> +	struct lpg *lpg = led->lpg;
> +	struct lpg_pattern pattern;
> +	int ret;
> +
> +	ret = lpg_prepare_pattern(lpg, led_pattern, len, repeat, &pattern);
> +	if (ret < 0)
> +		return ret;
> +
> +	struct led_pattern *prep_data __free(kfree) = pattern.data;
> +
> +	if (pattern.len > lpg->lut_size)
> +		return -EINVAL;
> +
> +	guard(mutex)(&lpg->lock);
> +
> +	memcpy(led->pattern.data, prep_data, pattern.len * sizeof(*prep_data));
> +	pattern.data = led->pattern.data;
> +	led->pattern = pattern;
> +	led->pattern_oneshot = repeat != -1;
> +
> +	ret = lpg_pattern_mc_update(led);
> +	if (ret) {
> +		led->pattern.len = 0;
> +		return ret;
> +	}
> +
> +	lpg_brightness_set(led, cdev, mc->subled_info);
> +
> +	return 0;
> +}
> +
> +static int lpg_pattern_clear(struct lpg_led *led)
> +{
> +	struct lpg *lpg = led->lpg;
> +	unsigned int i;
> +	int ret;
> +
> +	guard(mutex)(&lpg->lock);
> +
> +	ret = lpg_pattern_stop(led);
> +	if (ret)
> +		return ret;
> +
> +	for (i = 0; i < led->num_channels; i++)
> +		lpg_lut_free(led->channels[i]);
> +	led->pattern.len = 0;
>
>  	return 0;
>  }
> @@ -1433,6 +1627,17 @@ static int lpg_add_led(struct lpg *lpg, struct fwnode_handle *fw)
>
>  		/* Register pattern accessors if we have a LUT block or when using PPG */
>  		if (lpg->lut_base || lpg->lpg_chan_sdam) {
> +			led->pattern.data = devm_kcalloc(lpg->dev, lpg->lut_size,
> +							 sizeof(*led->pattern.data), GFP_KERNEL);
> +			if (!led->pattern.data)
> +				return -ENOMEM;
> +
> +			led->scaled_pattern = devm_kcalloc(lpg->dev, lpg->lut_size,
> +							   sizeof(*led->scaled_pattern),
> +							   GFP_KERNEL);
> +			if (!led->scaled_pattern)
> +				return -ENOMEM;
> +
>  			cdev->pattern_set = lpg_pattern_mc_set;
>  			cdev->pattern_clear = lpg_pattern_mc_clear;
>  		}
> @@ -1549,6 +1754,9 @@ static int lpg_init_lut(struct lpg *lpg)
>  	lpg->lut_bitmap = devm_bitmap_zalloc(lpg->dev, lpg->lut_size, GFP_KERNEL);
>  	if (!lpg->lut_bitmap)
>  		return -ENOMEM;
> +	lpg->lut_bitmap_tmp = devm_bitmap_zalloc(lpg->dev, lpg->lut_size, GFP_KERNEL);
> +	if (!lpg->lut_bitmap_tmp)
> +		return -ENOMEM;
>
>  	return 0;
>  }
>
> -- 
> 2.43.0
>
>

-- 
Lee Jones

  reply	other threads:[~2026-12-01 14:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  7:02 [PATCH v3 0/4] leds: leds-qcom-lpg: Add several fixes and the PWM frequency mode support Fenglin Wu
2026-11-23  7:02 ` [PATCH v3 1/4] leds: rgb: leds-qcom-lpg: Fix single-entry LUT leak Fenglin Wu
2026-12-01 14:23   ` Lee Jones
2026-11-23  7:02 ` [PATCH v3 2/4] leds: rgb: leds-qcom-lpg: Fix LED color balancing in HW pattern mode Fenglin Wu
2026-12-01 14:24   ` Lee Jones [this message]
2026-11-23  7:02 ` [PATCH v3 3/4] leds: rgb: leds-qcom-lpg: Add mutex lock in lpg_pwm_get_state() Fenglin Wu
2026-11-23  7:02 ` [PATCH v3 4/4] leds: rgb: leds-qcom-lpg: Add PWM frequency mode support Fenglin Wu
2026-12-01 14:30   ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179568561811.32537.12779758747288611716@kernel.org \
    --to=lee@kernel.org \
    --cc=andersson@kernel.org \
    --cc=corbet@lwn.net \
    --cc=david.collins@oss.qualcomm.com \
    --cc=fenglin.wu@oss.qualcomm.com \
    --cc=griffin@kroah.com \
    --cc=kamal.wadhwa@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux@gurudas.dev \
    --cc=marijn.suijten@somainline.org \
    --cc=pavel@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=quic_amelende@quicinc.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=subbaraman.narayanamurthy@oss.qualcomm.com \
    --cc=ukleinek@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox