Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] arm64: dts: qcom: sm6350-lena: invalid led-max-microamp in 
pm6150l_flash
--

commit c063589d95e3f37ff34d230113ce64e10e062736
Author: erebion <[email protected]>

arm64: dts: qcom: sm6350-lena: Add flash LED

This commit adds a devicetree node for the camera flash LED on the Sony
Xperia 10 III (pdx213).

> diff --git a/arch/arm64/boot/dts/qcom/sm6350-sony-xperia-lena-pdx213.dts 
> b/arch/arm64/boot/dts/qcom/sm6350-sony-xperia-lena-pdx213.dts
> index 6e2bbf4f060ac..6942a117d41cf 100644
> --- a/arch/arm64/boot/dts/qcom/sm6350-sony-xperia-lena-pdx213.dts
> +++ b/arch/arm64/boot/dts/qcom/sm6350-sony-xperia-lena-pdx213.dts

[ ... ]

> @@ -302,6 +304,19 @@ touchscreen@48 {
>       };
>  };
>  
> +&pm6150l_flash {
> +     status = "okay";
> +
> +     led-0 {
> +             function = LED_FUNCTION_FLASH;
> +             color = <LED_COLOR_ID_WHITE>;
> +             led-sources = <1>;
> +             led-max-microamp = <1500000>;
> +             flash-max-microamp = <1000000>;

[Severity: Medium]
Is led-max-microamp = <1500000> in pm6150l_flash intended here, or was a lower
continuous torch current limit such as 150000 uA meant instead?

In Documentation/devicetree/bindings/leds/common.yaml and
Documentation/devicetree/bindings/leds/qcom,spmi-flash-led.yaml,
led-max-microamp specifies the maximum continuous torch current, whereas
flash-max-microamp specifies the pulsed strobe flash current. The binding
schema constrains led-max-microamp to a maximum of 500000 uA for a single
channel (or 1000000 uA for two ganged channels):

Documentation/devicetree/bindings/leds/qcom,spmi-flash-led.yaml:
      led-max-microamp:
        anyOf:
          - minimum: 5000
            maximum: 500000
            multipleOf: 5000
          - minimum: 10000
            maximum: 1000000
            multipleOf: 10000

Setting led-max-microamp to 1500000 uA causes dtbs_check validation to fail
and sets the continuous torch limit higher than flash-max-microamp
(1000000 uA).

At runtime, when qcom_flash_led_probe() calls qcom_flash_register_led_device()
in drivers/leds/flash/leds-qcom-flash.c for a single-channel LED
(led-sources = <1>), the driver clamps led-max-microamp to the hardware per-
channel maximum of 500000 uA (TORCH_CURRENT_MAX_UA):

drivers/leds/flash/leds-qcom-flash.c:qcom_flash_register_led_device() {
        ...
        current_ua = min_t(u32, current_ua, TORCH_CURRENT_MAX_UA * 
led->chan_count);
        led->max_torch_current_ma = current_ua / UA_PER_MA;
        ...
}

This allows up to 500 mA in continuous torch mode rather than a board-specific
torch limit.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to