Skip to contentSkip to conversation

leds: rt4505: Add support for Richtek RT4505 flash LED controller

PATCH In review cy_huang 4 participants 10 messages Nov 2, 2020 – Mar 25, 2021

Subsystems (2)
lore
Share & tools
lore

cy_huang

author
#0 lore raw

PATCH v2 1/2 leds: rt4505: Add support for Richtek RT4505 flash LED controller

From: ChiYuan Huang <[email protected]>

Add support for RT4505 flash LED controller. It can support up to 1.5A flash current with hardware timeout and low input voltage protection.

---
Changes since v1 to v2

- Create flash directory into drvers/leds.
- Coding style fix to meet 80 charactors per line limit.
- Refine the description in the Kconfig help text.
- Change all descriptions for 'led' text to uppercase 'LED'.

---
 drivers/leds/Kconfig             |   2 +
 drivers/leds/Makefile            |   3 +
 drivers/leds/flash/Kconfig       |  17 ++
 drivers/leds/flash/Makefile      |   2 +
 drivers/leds/flash/leds-rt4505.c | 430 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 454 insertions(+)
 create mode 100644 drivers/leds/flash/Kconfig
 create mode 100644 drivers/leds/flash/Makefile
 create mode 100644 drivers/leds/flash/leds-rt4505.c
drivers/leds/Kconfig +2 -0
index 849d3c5..e4ad5ab 100644
@@ -30,6 +30,8 @@ config LEDS_CLASS_FLASH
 	  for the flash related features of a LED device. It can be built
 	  as a module.
 
+source "drivers/leds/flash/Kconfig"
+
 config LEDS_CLASS_MULTICOLOR
 	tristate "LED Multicolor Class Support"
 	depends on LEDS_CLASS
drivers/leds/Makefile +3 -0
index 73e603e..1564a83 100644
@@ -103,5 +103,8 @@ obj-$(CONFIG_LEDS_SPI_BYTE)		+= leds-spi-byte.o
 # LED Userspace Drivers
 obj-$(CONFIG_LEDS_USER)			+= uleds.o
 
+# LED Flash Drivers
+obj-y					+= flash/
+
 # LED Triggers
 obj-$(CONFIG_LEDS_TRIGGERS)		+= trigger/
drivers/leds/flash/Kconfig new file +17 -0
new file mode 100644
index 00000000..df32764
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+menu "LED Flash Chip support"
+	depends on LEDS_CLASS_FLASH
+
+config LEDS_RT4505
+	tristate "LED support for RT4505 flashlight controller"
+	depends on I2C && OF
+	depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
+	select REGMAP_I2C
+	help
+	  This option enables support for the RT4505 flash LED controller.
+	  RT4505 includes torch and flash functions with programmable current.
+	  And it's commonly used to compensate the illuminance for the camera
+	  inside the mobile product like as phones or tablets.
+
+endmenu
drivers/leds/flash/Makefile new file +2 -0
new file mode 100644
index 00000000..1b2eded
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_LEDS_RT4505)		+= leds-rt4505.o
drivers/leds/flash/leds-rt4505.c new file +430 -0

430 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 2/2 leds: rt4505: Add DT binding document for Richtek RT4505

From: ChiYuan Huang <[email protected]>

Add DT binding document for Richtek RT4505 flash LED controller.

---
Changes since v1 to v2

- Change the descriptions for 'led' text to uppercase 'LED'.

---
 .../devicetree/bindings/leds/leds-rt4505.yaml      | 57 ++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-rt4505.yaml
Documentation/devicetree/bindings/leds/leds-rt4505.yaml new file +57 -0
new file mode 100644
index 00000000..5b0c74a
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-rt4505.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT4505 Single Channel LED Driver
+
+maintainers:
+  - ChiYuan Huang <[email protected]>
+
+description: |
+  The RT4505 is a flash LED driver that can support up to 375mA and 1.5A for
+  torch and flash mode, respectively.
+
+  The data sheet can be found at:
+    https://www.richtek.com/assets/product_file/RT4505/DS4505-02.pdf
+
+properties:
+  compatible:
+    const: richtek,rt4505
+
+  reg:
+    description: I2C slave address of the controller.
+    maxItems: 1
+
+  led:
+    type: object
+    $ref: common.yaml#
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      led-controller@63 {
+        compatible = "richtek,rt4505";
+        reg = <0x63>;
+
+        rt4505_flash: led {
+          function = LED_FUNCTION_FLASH;
+          color = <LED_COLOR_ID_WHITE>;
+          led-max-microamp = <375000>;
+          flash-max-microamp = <1500000>;
+          flash-max-timeout-us = <800000>;
+        };
+      };
+    };
Signature · 1 line
2.7.4
Acked-by on v2 1/2
#2 lore raw
In reply to cy_huang

Hi ChiYuan,

Quoted 21 lines · cy_huang

From: ChiYuan Huang <[email protected]>

Add support for RT4505 flash LED controller. It can support up to 1.5A flash current with hardware timeout and low input voltage protection.

---
Changes since v1 to v2

- Create flash directory into drvers/leds.
- Coding style fix to meet 80 charactors per line limit.
- Refine the description in the Kconfig help text.
- Change all descriptions for 'led' text to uppercase 'LED'.

---
  drivers/leds/Kconfig             |   2 +
  drivers/leds/Makefile            |   3 +
  drivers/leds/flash/Kconfig       |  17 ++
  drivers/leds/flash/Makefile      |   2 +
  drivers/leds/flash/leds-rt4505.c | 430 +++++++++++++++++++++++++++++++++++++++
  5 files changed, 454 insertions(+)
Quoted 3 lines

create mode 100644 drivers/leds/flash/Kconfig create mode 100644 drivers/leds/flash/Makefile create mode 100644 drivers/leds/flash/leds-rt4505.c

Signature · 2 lines
Best regards,
Jacek Anaszewski
#3 lore raw

Hi, Jacek:

Jacek Anaszewski <[email protected]> 於 2020年11月3日 週二 上午4:44寫道:

Quoted 29 lines

Hi ChiYuan,

Quoted 21 lines · cy_huang

From: ChiYuan Huang <[email protected]>

Add support for RT4505 flash LED controller. It can support up to 1.5A flash current with hardware timeout and low input voltage protection.

---
Changes since v1 to v2

- Create flash directory into drvers/leds.
- Coding style fix to meet 80 charactors per line limit.
- Refine the description in the Kconfig help text.
- Change all descriptions for 'led' text to uppercase 'LED'.

---
  drivers/leds/Kconfig             |   2 +
  drivers/leds/Makefile            |   3 +
  drivers/leds/flash/Kconfig       |  17 ++
  drivers/leds/flash/Makefile      |   2 +
  drivers/leds/flash/leds-rt4505.c | 430 +++++++++++++++++++++++++++++++++++++++
  5 files changed, 454 insertions(+)
Quoted 3 lines

create mode 100644 drivers/leds/flash/Kconfig create mode 100644 drivers/leds/flash/Makefile create mode 100644 drivers/leds/flash/leds-rt4505.c

Quoted 2 lines

Any problem with this patch? Do I need to submit it again?

Quoted 3 lines

--
Best regards,
Jacek Anaszewski

#4 lore raw

Hi!

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

create mode 100644 drivers/leds/flash/Kconfig create mode 100644 drivers/leds/flash/Makefile create mode 100644 drivers/leds/flash/leds-rt4505.c

Any problem with this patch? Do I need to submit it again?

It won't apply on current next.

So please: Merge ACKs, reorder it so that docs goes first, port it to

To gitolite.kernel.org:pub/scm/linux/kernel/git/pavel/linux-leds.git
34731ed13e8a..85674b0e40d9 for-next -> for-next

and resubmit.

Thanks you,
Pavel

Signature · 1 line
http://www.livejournal.com/~pavelmachek
#5 lore raw

Pavel Machek <[email protected]> 於 2021年3月25日 週四 下午6:01寫道:

Quoted 11 lines

Hi!

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

create mode 100644 drivers/leds/flash/Kconfig create mode 100644 drivers/leds/flash/Makefile create mode 100644 drivers/leds/flash/leds-rt4505.c

Any problem with this patch? Do I need to submit it again?

Quoted 8 lines

It won't apply on current next.

So please: Merge ACKs, reorder it so that docs goes first, port it to

To gitolite.kernel.org:pub/scm/linux/kernel/git/pavel/linux-leds.git
34731ed13e8a..85674b0e40d9 for-next -> for-next

and resubmit.

Thx. It's clear.
So the next I need to do is
1. Merge ACKs
2. Reorder this patch from the docs first

After done, do I need to change the patch revision from v2 to v3 before submitng it?

Quoted 5 lines

Thanks you,
Pavel
--
http://www.livejournal.com/~pavelmachek

#6 lore raw
Quoted 21 lines · ChiYuan Huang

Pavel Machek <[email protected]> 於 2021年3月25日 週四 下午6:01寫道:

Quoted 11 lines

Hi!

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

create mode 100644 drivers/leds/flash/Kconfig create mode 100644 drivers/leds/flash/Makefile create mode 100644 drivers/leds/flash/leds-rt4505.c

Any problem with this patch? Do I need to submit it again?

Quoted 8 lines

It won't apply on current next.

So please: Merge ACKs, reorder it so that docs goes first, port it to

To gitolite.kernel.org:pub/scm/linux/kernel/git/pavel/linux-leds.git
34731ed13e8a..85674b0e40d9 for-next -> for-next

and resubmit.

Quoted 7 lines

Thx. It's clear.
So the next I need to do is
1. Merge ACKs
2. Reorder this patch from the docs first

After done, do I need to change the patch revision from v2 to v3 before submitng it?

Most important step is

0. port it to the for-next tree.

And yes, you can increase patch revision.

Best regards,

Pavel

Signature · 1 line
http://www.livejournal.com/~pavelmachek
#7 lore raw
In reply to cy_huang
Quoted 3 lines · cy_huang
 drivers/leds/flash/Kconfig       |  17 ++
 drivers/leds/flash/Makefile      |   2 +
 drivers/leds/flash/leds-rt4505.c | 430 +++++++++++++++++++++++++++++++++++++++

Hm Pavel also asked me to create this directory and structure, so if this gets applied to the MFD tree there will be some serious clash.

I can rebase on this patch set if Lee applies it first, they you need an immutable branch from Lee first to set up the build infrastructure in the LEDs tree, and then I can rebase on your tree once you have pulled in that.

Yours,
Linus Walleij

#8 lore raw

Hi, Jacek/Pavel:

Linus Walleij <[email protected]> 於 2020年11月16日 週一 上午7:55寫道:

Quoted 11 lines · cy_huang
Quoted 4 lines
 drivers/leds/flash/Kconfig       |  17 ++
 drivers/leds/flash/Makefile      |   2 +
 drivers/leds/flash/leds-rt4505.c | 430 +++++++++++++++++++++++++++++++++++++++

Hm Pavel also asked me to create this directory and structure, so if this gets applied to the MFD tree there will be some serious clash.

Quoted 7 lines

I can rebase on this patch set if Lee applies it first, they you need an immutable branch from Lee first to set up the build infrastructure in the LEDs tree, and then I can rebase on your tree once you have pulled in that.

Yours,
Linus Walleij

From linus walleij's mail, how can I support him? Or just wait my patch to be committed on linux main stream? Due to this, how's the status about rt4505 patch?

Sincerely,
ChiYuan Huang.

#9 lore raw
Quoted 2 lines · ChiYuan Huang

From linus walleij's mail, how can I support him? Or just wait my patch to be committed on linux main stream?

I think it's chill, Lee has a good habit to sync with other maintainers with immutable branches, so the LED maintainers should be able to get something from him to pull once he is happy with the series, then I can rebase my patch.

Yours,
Linus Walleij