Re: [PATCH v14 3/3] leds: flash: mt6370: Add MediaTek MT6370 flashlight support

From: Jacek Anaszewski
Date: Tue Oct 11 2022 - 07:02:17 EST


On 10/11/22 11:52, AngeloGioacchino Del Regno wrote:
Il 11/10/22 06:05, ChiaEn Wu ha scritto:
From: Alice Chen <alice_chen@xxxxxxxxxxx>

The MediaTek MT6370 is a highly-integrated smart power management IC,
which includes a single cell Li-Ion/Li-Polymer switching battery
charger, a USB Type-C & Power Delivery (PD) controller, dual Flash
LED current sources, a RGB LED driver, a backlight WLED driver,
a display bias driver and a general LDO for portable devices.

Add support for the MT6370 Flash LED driver. Flash LED in MT6370
has 2 channels and support torch/strobe mode.

Signed-off-by: Alice Chen <alice_chen@xxxxxxxxxxx>
Signed-off-by: ChiaEn Wu <chiaen_wu@xxxxxxxxxxx>
---

v14
- Remove unused 'depend on OF' in Kconfig
---
  drivers/leds/flash/Kconfig             |  14 +
  drivers/leds/flash/Makefile            |   1 +
  drivers/leds/flash/leds-mt6370-flash.c | 631 +++++++++++++++++++++++++++++++++
  3 files changed, 646 insertions(+)
  create mode 100644 drivers/leds/flash/leds-mt6370-flash.c

diff --git a/drivers/leds/flash/Kconfig b/drivers/leds/flash/Kconfig
index d3eb689..0dd955c 100644
--- a/drivers/leds/flash/Kconfig
+++ b/drivers/leds/flash/Kconfig
@@ -61,6 +61,20 @@ config LEDS_MT6360
        Independent current sources supply for each flash LED support torch
        and strobe mode.
+config LEDS_MT6370_FLASH
+    tristate "Flash LED Support for MediaTek MT6370 PMIC"
+    depends on LEDS_CLASS
+    depends on LEDS_CLASS_FLASH || !LEDS_CLASS_FLASH

This dependency makes no sense, as the options in the Kconfig you're putting
this into gets parsed only `if LEDS_CLASS_FLASH`.
Please remove that.

So the Kconfig is buggy. Someone didn't take into account
`config LEDS_MT6360` requirements when moving drivers to the
flash subdirectory.


+    depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS

Well, if it depends on that being either y, m or n, it means that it does
not depend on that at all. Remove.

I disagree. It makes a lot of sense.
This syntax allows creating correct dependencies by depmod for both
cases when V4L2_FLASH_LED_CLASS is enabled or not, since the driver
can work in both cases.


After which,
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>

+    depends on MFD_MT6370
+    help
+      Support 2 channels and torch/strobe mode.
+      Say Y here to enable support for
+      MT6370_FLASH_LED device.
+
+      This driver can also be built as a module. If so, the module
+      will be called "leds-mt6370-flash".
+
  config LEDS_RT4505
      tristate "LED support for RT4505 flashlight controller"
      depends on I2C && OF

--
Best regards,
Jacek Anaszewski