lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7jf4xvqmlymwkyrdp2ulpazfwmhdmfegzigewc5esk2sj323a5@72skiavskrqt>
Date: Thu, 13 Nov 2025 22:58:35 -0600
From: Bjorn Andersson <andersson@...nel.org>
To: fenglin.wu@....qualcomm.com
Cc: kernel@....qualcomm.com, Lee Jones <lee@...nel.org>, 
	Pavel Machek <pavel@...nel.org>, Marijn Suijten <marijn.suijten@...ainline.org>, 
	Subbaraman Narayanamurthy <subbaraman.narayanamurthy@....qualcomm.com>, Pavel Machek <pavel@....cz>, linux-leds@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: rgb: leds-qcom-lpg: Only enable TRILED when LPG is
 used by LED

On Fri, Nov 14, 2025 at 09:11:17AM +0800, Fenglin Wu via B4 Relay wrote:
> From: Fenglin Wu <fenglin.wu@....qualcomm.com>
> 
> Enabling the TRILED channel will cause a voltage increase on its power
> supply, which is unnecessary if the LPG channel is not being used to
> control an LED.
> 
> Fixes: 24e2d05d1b68 ("leds: Add driver for Qualcomm LPG")
> Signed-off-by: Fenglin Wu <fenglin.wu@....qualcomm.com>
> ---
>  drivers/leds/rgb/leds-qcom-lpg.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
> index 4f2a178e3d265a2cc88e651d3e2ca6ae3dfac2e2..234059b4c0f49d0398030ae5f86967fc1905206d 100644
> --- a/drivers/leds/rgb/leds-qcom-lpg.c
> +++ b/drivers/leds/rgb/leds-qcom-lpg.c
> @@ -2,7 +2,7 @@
>  /*
>   * Copyright (c) 2017-2022 Linaro Ltd
>   * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
> - * Copyright (c) 2023-2024, Qualcomm Innovation Center, Inc. All rights reserved.
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
>   */
>  #include <linux/bits.h>
>  #include <linux/bitfield.h>
> @@ -1247,7 +1247,9 @@ static int lpg_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>  
>  	lpg_apply(chan);
>  
> -	triled_set(lpg, chan->triled_mask, chan->enabled ? chan->triled_mask : 0);
> +	/* Only control TRILED if the LPG channel is used by TRILED */
> +	if (chan->in_use && chan->triled_mask)

How is this possible?

If chan->in_use, then the channel is exposed as a LED and
lpg_pwm_request() should have returned -EBUSY, so we should never reach
lpg_pwm_apply()?


Why do you check chan->triled_mask? I guess we will still read/write the
triled regiter, but don't make any changes if this is 0?

Or is this the actual issue that you're fixing, that we read/write the
registers when we shouldn't? If so this should be clarified in the
commit message.

Regards,
Bjorn

> +		triled_set(lpg, chan->triled_mask, chan->enabled ? chan->triled_mask : 0);
>  
>  out_unlock:
>  	mutex_unlock(&lpg->lock);
> 
> ---
> base-commit: ea1c4c7e648d1ca91577071fc42fdc219521098c
> change-id: 20251114-lpg_triled_fix-44491b49b340
> 
> Best regards,
> -- 
> Fenglin Wu <fenglin.wu@....qualcomm.com>
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ