Skip to contentSkip to conversation

leds: mt6360: Add LED driver for MT6360

PATCH Superseded Gene Chen 2 participants 6 messages May 24, 2021 – Jul 16, 2021

Subsystems (3)

v14 of 15 Superseded Latest is v15 →

lore
Share & tools
lore

Gene Chen

author
#0 lore raw

v14 cover leds: mt6360: Add LED driver for MT6360

This patch series add MT6360 LED support contains driver and binding document

Gene Chen (2)
dt-bindings: leds: Add bindings for MT6360 LED
leds: mt6360: Add LED driver for MT6360

 Documentation/devicetree/bindings/leds/leds-mt6360.yaml |  159 ++
 drivers/leds/flash/Kconfig                              |   13 
 drivers/leds/flash/Makefile                             |    1 
 drivers/leds/flash/leds-mt6360.c                        |  910 ++++++++++++++++
 4 files changed, 1083 insertions(+)

changelogs between v1 & v2
- add led driver with mfd

changelogs between v2 & v3
- independent add led driver
- add dt-binding document
- refactor macros definition for easy to debug
- parse device tree by fwnode
- use devm*ext to register led class device

changelogs between v3 & v4
- fix binding document description
- use GENMASK and add unit postfix to definition
- isink register led class device

changelogs between v4 & v5
- change rgb isink to multicolor control
- add binding reference to mfd yaml

changelogs between v5 & v6
- Use DT to decide RGB LED is multicolor device or indicator device only

changelogs between v6 & v7
- Add binding multicolor device sample code
- Add flash ops mutex lock
- Remove V4L2 init with indicator device

changelogs between v7 & v8
- Add mutex for led fault get ops
- Fix flash and multicolor no-ops return 0
- Add LED_FUNCTION_MOONLIGHT

changelogs between v8 & v9
- reuse api in flash and multicolor header

changelogs between v9 & v10
- add comment for reuse registration functions in flash and multicolor

changelogs between v10 & v11
- match dt-binding reg property comment to the functionality name
- remove exist patch in linux-next
- dicide multicolor channel by color definitiion

changelogs between v11 & v12
- Fix print size_t by %zu
- Fix dt-binding name regular experssion

changelogs between v12 & v13
- Fix kbuild test rebot build error

changelogs between v13 & v14
- Move driver to flash folder
- Remove LED FUNCTION MOONLIGHT
- Keep 80 char per line

author
#1 lore raw

PATCH v14 1/2 dt-bindings: leds: Add bindings for MT6360 LED

From: Gene Chen <[email protected]>

Add bindings document for LED support on MT6360 PMIC

---
 .../devicetree/bindings/leds/leds-mt6360.yaml | 159 ++++++++++++++++++
 1 file changed, 159 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-mt6360.yaml
Documentation/devicetree/bindings/leds/leds-mt6360.yaml new file +159 -0
new file mode 100644
index 000000000000..235315531d3b
@@ -0,0 +1,159 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-mt6360.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for MT6360 PMIC from MediaTek Integrated.
+
+maintainers:
+  - Gene Chen <[email protected]>
+
+description: |
+  This module is part of the MT6360 MFD device.
+  see Documentation/devicetree/bindings/mfd/mt6360.yaml
+  Add MT6360 LED driver include 2-channel Flash LED with torch/strobe mode,
+  and 4-channel RGB LED support Register/Flash/Breath Mode
+
+properties:
+  compatible:
+    const: mediatek,mt6360-led
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^(multi-)?led@[0-5]$":
+    type: object
+    $ref: common.yaml#
+    description:
+      Properties for a single LED.
+
+    properties:
+      reg:
+        description: Index of the LED.
+        enum:
+          - 0 # LED output ISINK1
+          - 1 # LED output ISINK2
+          - 2 # LED output ISINK3
+          - 3 # LED output ISINKML
+          - 4 # LED output FLASH1
+          - 5 # LED output FLASH2
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+   #include <dt-bindings/leds/common.h>
+   led-controller {
+     compatible = "mediatek,mt6360-led";
+     #address-cells = <1>;
+     #size-cells = <0>;
+
+     multi-led@0 {
+       reg = <0>;
+       function = LED_FUNCTION_INDICATOR;
+       color = <LED_COLOR_ID_RGB>;
+       led-max-microamp = <24000>;
+       #address-cells = <1>;
+       #size-cells = <0>;
+       led@0 {
+         reg = <0>;
+         color = <LED_COLOR_ID_RED>;
+       };
+       led@1 {
+         reg = <1>;
+         color = <LED_COLOR_ID_GREEN>;
+       };
+       led@2 {
+         reg = <2>;
+         color = <LED_COLOR_ID_BLUE>;
+       };
+     };
+     led@3 {
+       reg = <3>;
+       function = LED_FUNCTION_INDICATOR;
+       color = <LED_COLOR_ID_WHITE>;
+       led-max-microamp = <150000>;
+     };
+     led@4 {
+       reg = <4>;
+       function = LED_FUNCTION_FLASH;
+       color = <LED_COLOR_ID_WHITE>;
+       function-enumerator = <1>;
+       led-max-microamp = <200000>;
+       flash-max-microamp = <500000>;
+       flash-max-timeout-us = <1024000>;
+     };
+     led@5 {
+       reg = <5>;
+       function = LED_FUNCTION_FLASH;
+       color = <LED_COLOR_ID_WHITE>;
+       function-enumerator = <2>;
+       led-max-microamp = <200000>;
+       flash-max-microamp = <500000>;
+       flash-max-timeout-us = <1024000>;
+     };
+   };
+
+  - |
+
+   led-controller {
+     compatible = "mediatek,mt6360-led";
+     #address-cells = <1>;
+     #size-cells = <0>;
+
+     led@0 {
+       reg = <0>;
+       function = LED_FUNCTION_INDICATOR;
+       color = <LED_COLOR_ID_RED>;
+       led-max-microamp = <24000>;
+     };
+     led@1 {
+       reg = <1>;
+       function = LED_FUNCTION_INDICATOR;
+       color = <LED_COLOR_ID_GREEN>;
+       led-max-microamp = <24000>;
+     };
+     led@2 {
+       reg = <2>;
+       function = LED_FUNCTION_INDICATOR;
+       color = <LED_COLOR_ID_BLUE>;
+       led-max-microamp = <24000>;
+     };
+     led@3 {
+       reg = <3>;
+       function = LED_FUNCTION_MOONLIGHT;
+       color = <LED_COLOR_ID_WHITE>;
+       led-max-microamp = <150000>;
+     };
+     led@4 {
+       reg = <4>;
+       function = LED_FUNCTION_FLASH;
+       color = <LED_COLOR_ID_WHITE>;
+       function-enumerator = <1>;
+       led-max-microamp = <200000>;
+       flash-max-microamp = <500000>;
+       flash-max-timeout-us = <1024000>;
+     };
+     led@5 {
+       reg = <5>;
+       function = LED_FUNCTION_FLASH;
+       color = <LED_COLOR_ID_WHITE>;
+       function-enumerator = <2>;
+       led-max-microamp = <200000>;
+       flash-max-microamp = <500000>;
+       flash-max-timeout-us = <1024000>;
+     };
+   };
+...
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH v14 2/2 leds: mt6360: Add LED driver for MT6360

In reply to Gene Chen

From: Gene Chen <[email protected]>

Add MT6360 LED driver include 2-channel Flash LED with torch/strobe mode, 3-channel RGB LED support Register/Flash/Breath Mode, and 1-channel for moonlight LED.

---
 drivers/leds/flash/Kconfig       |  13 +
 drivers/leds/flash/Makefile      |   1 +
 drivers/leds/flash/leds-mt6360.c | 910 +++++++++++++++++++++++++++++++
 3 files changed, 924 insertions(+)
 create mode 100644 drivers/leds/flash/leds-mt6360.c
drivers/leds/flash/Kconfig +13 -0
index 3f49f3edbffb..7ae95a90a546 100644
@@ -2,6 +2,19 @@
 
 if LEDS_CLASS_FLASH
 
+config LEDS_MT6360
+	tristate "LED Support for Mediatek MT6360 PMIC"
+	depends on LEDS_CLASS && OF
+	depends on LEDS_CLASS_FLASH || !LEDS_CLASS_FLASH
+	depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR
+	depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
+	depends on MFD_MT6360
+	help
+	  This option enables support for dual Flash LED drivers found on
+	  Mediatek MT6360 PMIC.
+	  Independent current sources supply for each flash LED support torch
+	  and strobe mode.
+
 config LEDS_RT4505
 	tristate "LED support for RT4505 flashlight controller"
 	depends on I2C && OF
drivers/leds/flash/Makefile +1 -0
index 09aee561f769..d1833175824d 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
+obj-$(CONFIG_LEDS_MT6360)	+= leds-mt6360.o
 obj-$(CONFIG_LEDS_RT4505)	+= leds-rt4505.o
 obj-$(CONFIG_LEDS_RT8515)	+= leds-rt8515.o
drivers/leds/flash/leds-mt6360.c new file +910 -0

910 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#3 lore raw
In reply to Gene Chen

Gene Chen <[email protected]> 於 2021年5月24日 週一 下午11:24寫道:

Quoted 60 lines

This patch series add MT6360 LED support contains driver and binding document

Gene Chen (2)
dt-bindings: leds: Add bindings for MT6360 LED
leds: mt6360: Add LED driver for MT6360

 Documentation/devicetree/bindings/leds/leds-mt6360.yaml |  159 ++
 drivers/leds/flash/Kconfig                              |   13
 drivers/leds/flash/Makefile                             |    1
 drivers/leds/flash/leds-mt6360.c                        |  910 ++++++++++++++++
 4 files changed, 1083 insertions(+)

changelogs between v1 & v2
- add led driver with mfd

changelogs between v2 & v3
- independent add led driver
- add dt-binding document
- refactor macros definition for easy to debug
- parse device tree by fwnode
- use devm*ext to register led class device

changelogs between v3 & v4
- fix binding document description
- use GENMASK and add unit postfix to definition
- isink register led class device

changelogs between v4 & v5
- change rgb isink to multicolor control
- add binding reference to mfd yaml

changelogs between v5 & v6
- Use DT to decide RGB LED is multicolor device or indicator device only

changelogs between v6 & v7
- Add binding multicolor device sample code
- Add flash ops mutex lock
- Remove V4L2 init with indicator device

changelogs between v7 & v8
- Add mutex for led fault get ops
- Fix flash and multicolor no-ops return 0
- Add LED_FUNCTION_MOONLIGHT

changelogs between v8 & v9
- reuse api in flash and multicolor header

changelogs between v9 & v10
- add comment for reuse registration functions in flash and multicolor

changelogs between v10 & v11
- match dt-binding reg property comment to the functionality name
- remove exist patch in linux-next
- dicide multicolor channel by color definitiion

changelogs between v11 & v12
- Fix print size_t by %zu
- Fix dt-binding name regular experssion

Quoted 9 lines

changelogs between v12 & v13
- Fix kbuild test rebot build error

changelogs between v13 & v14
- Move driver to flash folder
- Remove LED FUNCTION MOONLIGHT
- Keep 80 char per line

Dear Reviewers,

Please let me know if any update.

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#4 lore raw

Hi Gene,

You still can carry my ack:

Quoted 75 lines · Gene Chen

Gene Chen <[email protected]> 於 2021年5月24日 週一 下午11:24寫道:

Quoted 60 lines

This patch series add MT6360 LED support contains driver and binding document

Gene Chen (2)
dt-bindings: leds: Add bindings for MT6360 LED
leds: mt6360: Add LED driver for MT6360

  Documentation/devicetree/bindings/leds/leds-mt6360.yaml |  159 ++
  drivers/leds/flash/Kconfig                              |   13
  drivers/leds/flash/Makefile                             |    1
  drivers/leds/flash/leds-mt6360.c                        |  910 ++++++++++++++++
  4 files changed, 1083 insertions(+)

changelogs between v1 & v2
- add led driver with mfd

changelogs between v2 & v3
- independent add led driver
- add dt-binding document
- refactor macros definition for easy to debug
- parse device tree by fwnode
- use devm*ext to register led class device

changelogs between v3 & v4
- fix binding document description
- use GENMASK and add unit postfix to definition
- isink register led class device

changelogs between v4 & v5
- change rgb isink to multicolor control
- add binding reference to mfd yaml

changelogs between v5 & v6
- Use DT to decide RGB LED is multicolor device or indicator device only

changelogs between v6 & v7
- Add binding multicolor device sample code
- Add flash ops mutex lock
- Remove V4L2 init with indicator device

changelogs between v7 & v8
- Add mutex for led fault get ops
- Fix flash and multicolor no-ops return 0
- Add LED_FUNCTION_MOONLIGHT

changelogs between v8 & v9
- reuse api in flash and multicolor header

changelogs between v9 & v10
- add comment for reuse registration functions in flash and multicolor

changelogs between v10 & v11
- match dt-binding reg property comment to the functionality name
- remove exist patch in linux-next
- dicide multicolor channel by color definitiion

changelogs between v11 & v12
- Fix print size_t by %zu
- Fix dt-binding name regular experssion

Quoted 9 lines

changelogs between v12 & v13
- Fix kbuild test rebot build error

changelogs between v13 & v14
- Move driver to flash folder
- Remove LED FUNCTION MOONLIGHT
- Keep 80 char per line

Dear Reviewers,

Please let me know if any update.

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

Jacek Anaszewski <[email protected]> 於 2021年7月13日 週二 上午4:24寫道:

Quoted 7 lines

Hi Gene,

You still can carry my ack:

Ok, thanks. I will add your ack in patch v15.

Quoted 80 lines · Gene Chen
Quoted 71 lines

Gene Chen <[email protected]> 於 2021年5月24日 週一 下午11:24寫道:

Quoted 60 lines

This patch series add MT6360 LED support contains driver and binding document

Gene Chen (2)
dt-bindings: leds: Add bindings for MT6360 LED
leds: mt6360: Add LED driver for MT6360

  Documentation/devicetree/bindings/leds/leds-mt6360.yaml |  159 ++
  drivers/leds/flash/Kconfig                              |   13
  drivers/leds/flash/Makefile                             |    1
  drivers/leds/flash/leds-mt6360.c                        |  910 ++++++++++++++++
  4 files changed, 1083 insertions(+)

changelogs between v1 & v2
- add led driver with mfd

changelogs between v2 & v3
- independent add led driver
- add dt-binding document
- refactor macros definition for easy to debug
- parse device tree by fwnode
- use devm*ext to register led class device

changelogs between v3 & v4
- fix binding document description
- use GENMASK and add unit postfix to definition
- isink register led class device

changelogs between v4 & v5
- change rgb isink to multicolor control
- add binding reference to mfd yaml

changelogs between v5 & v6
- Use DT to decide RGB LED is multicolor device or indicator device only

changelogs between v6 & v7
- Add binding multicolor device sample code
- Add flash ops mutex lock
- Remove V4L2 init with indicator device

changelogs between v7 & v8
- Add mutex for led fault get ops
- Fix flash and multicolor no-ops return 0
- Add LED_FUNCTION_MOONLIGHT

changelogs between v8 & v9
- reuse api in flash and multicolor header

changelogs between v9 & v10
- add comment for reuse registration functions in flash and multicolor

changelogs between v10 & v11
- match dt-binding reg property comment to the functionality name
- remove exist patch in linux-next
- dicide multicolor channel by color definitiion

changelogs between v11 & v12
- Fix print size_t by %zu
- Fix dt-binding name regular experssion

Quoted 9 lines

changelogs between v12 & v13
- Fix kbuild test rebot build error

changelogs between v13 & v14
- Move driver to flash folder
- Remove LED FUNCTION MOONLIGHT
- Keep 80 char per line

Quoted 4 lines

Dear Reviewers,

Please let me know if any update.

--
Best regards,
Jacek Anaszewski