Re: [PATCH RESEND v3] leds: flash: leds-qcom-flash: limit LED current based on thermal condition

From: Luca Weiss
Date: Mon Jul 08 2024 - 03:39:20 EST


On Mon Jul 8, 2024 at 4:59 AM CEST, Fenglin Wu wrote:
>
>
> On 7/5/2024 10:23 PM, Luca Weiss wrote:
> > On Fri Jul 5, 2024 at 9:55 AM CEST, Fenglin Wu via B4 Relay wrote:
> >> From: Fenglin Wu <quic_fenglinw@xxxxxxxxxxx>
> >>
> >> The flash module has status bits to indicate different thermal
> >> conditions which are called as OTSTx. For each OTSTx status,
> >> there is a recommended total flash current for all channels to
> >> prevent the flash module entering into higher thermal level.
> >> For example, the total flash current should be limited to 1000mA/500mA
> >> respectively when the HW reaches the OTST1/OTST2 thermal level.
> >
> > Hi Fenglin,
> >
> > Only semi-related to this patch, but I wanted to ask.
> >
> > Since most phones with a flash also have a thermistor for the flash led,
> > is there any plan to add support to be able to declare the flash led to
> > be a "cooling-device" for the relevant thermal zone? That way from a
> > Linux thermal API standpoint when the zone gets too hot that it can ask
> > the driver to throttle the brightness or turn the LED off completely.
> >
> > Right now the only action the kernel can take is with type 'critical' to
> > just kill the entire system to mitigate the thermal situation.
> >
> > Regards
> > Luca
> >
>
> Hi Luca,
>
> This change provides the ability to throttle flash current based on the
> thermal status sensed by the temperature sensor inside the flash module
> HW , it doesn't need to register anything in Linux thermal framework.
>
> For the case that you mentioned, when an external thermistor is
> installed nearby the flash LED component and normally the ADC_TM driver
> registers a thermal_zone device with it, I agree that having the flash
> LED driver providing a thermal_cooling device so that any cooling
> mapping policy could be defined between the thermal sensor and the
> cooling device would be a good option for better system level thermal
> control. I would assume that this could be added in flash LED framework
> driver instead of the client drivers considering this should be a common
> request because of the big thermal dissipation of flash LED?

Right, the LED core getting the ability to register a cooling device
would probably be a reasonable solution, that way any flash LED driver
would be cooling-ready. Apart from decreasing brightness - or worst case
turning the LED off completely I can't think of many other actions that
could be taken anyways?

Pavel, Lee, your opinion?

Regards
Luca

>
> Fenglin
> >>
> >> ---
> >> base-commit: ca66b10a11da3c445c9c0ca1184f549bbe9061f2
> >> change-id: 20240507-qcom_flash_thermal_derating-260b1f3c757c
> >>
> >> Best regards,
> >