Skip to contentSkip to conversation

leds: mt6360: Add LED driver for MT6360

PATCH Superseded Gene Chen 5 participants 16 messages Dec 2, 2020 – Dec 9, 2020

Subsystems (3)

v11 of 15 Superseded Latest is v15 →

lore
Share & tools
lore

Gene Chen

author
#0 lore raw

v11 cover leds: mt6360: Add LED driver for MT6360

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

Gene Chen (5)
leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
leds: flash: Fix multicolor no-ops registration by return 0
dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
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/Kconfig                                    |   13 
 drivers/leds/Makefile                                   |    1 
 drivers/leds/leds-mt6360.c                              |  827 ++++++++++++++++
 include/dt-bindings/leds/common.h                       |    1 
 include/linux/led-class-flash.h                         |   42 
 include/linux/led-class-multicolor.h                    |   42 
 7 files changed, 1049 insertions(+), 36 deletions(-)

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

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

author
#1 lore raw

PATCH v11 1/5 leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH

From: Gene Chen <[email protected]>

Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH, and move the same registration functions outside of #ifdef block.

---
 include/linux/led-class-flash.h | 42 ++++++++++++++++++++++++++++++++---------
 1 file changed, 33 insertions(+), 9 deletions(-)
include/linux/led-class-flash.h +33 -9
index 21a3358..612b4ca 100644
@@ -85,6 +85,7 @@ static inline struct led_classdev_flash *lcdev_to_flcdev(
 	return container_of(lcdev, struct led_classdev_flash, led_cdev);
 }
 
+#if IS_ENABLED(CONFIG_LEDS_CLASS_FLASH)
 /**
  * led_classdev_flash_register_ext - register a new object of LED class with
  *				     init data and with support for flash LEDs
@@ -98,12 +99,6 @@ int led_classdev_flash_register_ext(struct device *parent,
 				    struct led_classdev_flash *fled_cdev,
 				    struct led_init_data *init_data);
 
-static inline int led_classdev_flash_register(struct device *parent,
-					   struct led_classdev_flash *fled_cdev)
-{
-	return led_classdev_flash_register_ext(parent, fled_cdev, NULL);
-}
-
 /**
  * led_classdev_flash_unregister - unregisters an object of led_classdev class
  *				   with support for flash LEDs
@@ -118,15 +113,44 @@ int devm_led_classdev_flash_register_ext(struct device *parent,
 				     struct led_init_data *init_data);
 
 
+void devm_led_classdev_flash_unregister(struct device *parent,
+					struct led_classdev_flash *fled_cdev);
+
+#else
+
+static inline int led_classdev_flash_register_ext(struct device *parent,
+				    struct led_classdev_flash *fled_cdev,
+				    struct led_init_data *init_data)
+{
+	return 0;
+}
+
+static inline void led_classdev_flash_unregister(struct led_classdev_flash *fled_cdev) {};
+static inline int devm_led_classdev_flash_register_ext(struct device *parent,
+				     struct led_classdev_flash *fled_cdev,
+				     struct led_init_data *init_data)
+{
+	return 0;
+}
+
+static inline void devm_led_classdev_flash_unregister(struct device *parent,
+					struct led_classdev_flash *fled_cdev)
+{};
+
+#endif  /* IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) */
+
+static inline int led_classdev_flash_register(struct device *parent,
+					   struct led_classdev_flash *fled_cdev)
+{
+	return led_classdev_flash_register_ext(parent, fled_cdev, NULL);
+}
+
 static inline int devm_led_classdev_flash_register(struct device *parent,
 				     struct led_classdev_flash *fled_cdev)
 {
 	return devm_led_classdev_flash_register_ext(parent, fled_cdev, NULL);
 }
 
-void devm_led_classdev_flash_unregister(struct device *parent,
-					struct led_classdev_flash *fled_cdev);
-
 /**
  * led_set_flash_strobe - setup flash strobe
  * @fled_cdev: the flash LED to set strobe on
Signature · 7 lines
2.7.4


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

PATCH v11 2/5 leds: flash: Fix multicolor no-ops registration by return 0

In reply to Gene Chen

From: Gene Chen <[email protected]>

Fix multicolor no-ops registration by return 0,
and move the same registration functions outside of #ifdef block.

---
 include/linux/led-class-multicolor.h | 42 +++++++++++++-----------------------
 1 file changed, 15 insertions(+), 27 deletions(-)
include/linux/led-class-multicolor.h +15 -27
index 5116f9a..210d57b 100644
@@ -44,12 +44,6 @@ int led_classdev_multicolor_register_ext(struct device *parent,
 					    struct led_classdev_mc *mcled_cdev,
 					    struct led_init_data *init_data);
 
-static inline int led_classdev_multicolor_register(struct device *parent,
-					    struct led_classdev_mc *mcled_cdev)
-{
-	return led_classdev_multicolor_register_ext(parent, mcled_cdev, NULL);
-}
-
 /**
  * led_classdev_multicolor_unregister - unregisters an object of led_classdev
  *					class with support for multicolor LEDs
@@ -68,13 +62,6 @@ int devm_led_classdev_multicolor_register_ext(struct device *parent,
 					  struct led_classdev_mc *mcled_cdev,
 					  struct led_init_data *init_data);
 
-static inline int devm_led_classdev_multicolor_register(struct device *parent,
-				     struct led_classdev_mc *mcled_cdev)
-{
-	return devm_led_classdev_multicolor_register_ext(parent, mcled_cdev,
-							 NULL);
-}
-
 void devm_led_classdev_multicolor_unregister(struct device *parent,
 					    struct led_classdev_mc *mcled_cdev);
 #else
@@ -83,27 +70,33 @@ static inline int led_classdev_multicolor_register_ext(struct device *parent,
 					    struct led_classdev_mc *mcled_cdev,
 					    struct led_init_data *init_data)
 {
-	return -EINVAL;
-}
-
-static inline int led_classdev_multicolor_register(struct device *parent,
-					    struct led_classdev_mc *mcled_cdev)
-{
-	return led_classdev_multicolor_register_ext(parent, mcled_cdev, NULL);
+	return 0;
 }
 
 static inline void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev) {};
 static inline int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,
 					       enum led_brightness brightness)
 {
-	return -EINVAL;
+	return 0;
 }
 
 static inline int devm_led_classdev_multicolor_register_ext(struct device *parent,
 					  struct led_classdev_mc *mcled_cdev,
 					  struct led_init_data *init_data)
 {
-	return -EINVAL;
+	return 0;
+}
+
+static inline void devm_led_classdev_multicolor_unregister(struct device *parent,
+					    struct led_classdev_mc *mcled_cdev)
+{};
+
+#endif  /* IS_ENABLED(CONFIG_LEDS_CLASS_MULTICOLOR) */
+
+static inline int led_classdev_multicolor_register(struct device *parent,
+					    struct led_classdev_mc *mcled_cdev)
+{
+	return led_classdev_multicolor_register_ext(parent, mcled_cdev, NULL);
 }
 
 static inline int devm_led_classdev_multicolor_register(struct device *parent,
@@ -113,9 +106,4 @@ static inline int devm_led_classdev_multicolor_register(struct device *parent,
 							 NULL);
 }
 
-static inline void devm_led_classdev_multicolor_unregister(struct device *parent,
-					    struct led_classdev_mc *mcled_cdev)
-{};
-
-#endif  /* IS_ENABLED(CONFIG_LEDS_CLASS_MULTICOLOR) */
 #endif	/* _LINUX_MULTICOLOR_LEDS_H_INCLUDED */
Signature · 7 lines
2.7.4


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

PATCH v11 3/5 dt-bindings: leds: Add LED_FUNCTION_MOONLIGHT definitions

In reply to Gene Chen

From: Gene Chen <[email protected]>

Add LED_FUNCTION_MOONLIGHT definitions

---
 include/dt-bindings/leds/common.h | 1 +
 1 file changed, 1 insertion(+)
include/dt-bindings/leds/common.h +1 -0
index 52b619d..843e65d 100644
@@ -78,6 +78,7 @@
 #define LED_FUNCTION_INDICATOR "indicator"
 #define LED_FUNCTION_LAN "lan"
 #define LED_FUNCTION_MAIL "mail"
+#define LED_FUNCTION_MOONLIGHT "moonlight"
 #define LED_FUNCTION_MTD "mtd"
 #define LED_FUNCTION_PANIC "panic"
 #define LED_FUNCTION_PROGRAMMING "programming"
Signature · 7 lines
2.7.4


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

Re: [PATCH v11 3/5] dt-bindings: leds: Add LED_FUNCTION_MOONLIGHT definitions

Quoted 16 lines · Gene Chen

From: Gene Chen <[email protected]>

Add LED_FUNCTION_MOONLIGHT definitions

---
 include/dt-bindings/leds/common.h | 1 +
 1 file changed, 1 insertion(+)
include/dt-bindings/leds/common.h +0 -0
index 52b619d..843e65d 100644

include/dt-bindings/leds/common.h line 81

Quoted 4 lines
include/dt-bindings/leds/common.h +1 -0
@@ -78,6 +78,7 @@
 #define LED_FUNCTION_INDICATOR "indicator"
 #define LED_FUNCTION_LAN "lan"
 #define LED_FUNCTION_MAIL "mail"
+#define LED_FUNCTION_MOONLIGHT "moonlight"

There's "torch" function that should be used for this. I guess comment should be added with explanation what exactly that is and how should the LED be named.

Best regards,
Pavel

Signature · 1 line
http://www.livejournal.com/~pavelmachek

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

author
#5 lore raw

Re: [PATCH v11 3/5] dt-bindings: leds: Add LED_FUNCTION_MOONLIGHT definitions

Pavel Machek <[email protected]> 於 2020年12月2日 週三 下午8:23寫道:

Quoted 13 lines · Gene Chen
Quoted 11 lines

From: Gene Chen <[email protected]>

Add LED_FUNCTION_MOONLIGHT definitions

---
 include/dt-bindings/leds/common.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines

include/dt-bindings/leds/common.h line 81

Quoted 9 lines
include/dt-bindings/leds/common.h +1 -0
index 52b619d..843e65d 100644
@@ -78,6 +78,7 @@
 #define LED_FUNCTION_INDICATOR "indicator"
 #define LED_FUNCTION_LAN "lan"
 #define LED_FUNCTION_MAIL "mail"
+#define LED_FUNCTION_MOONLIGHT "moonlight"

There's "torch" function that should be used for this. I guess comment should be added with explanation what exactly that is and how should the LED be named.

According to mail, 11/25 "Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions",
The Moonlight LED is LED which maximum current more than torch, but less than flash. Such as front camera fill light.
I think our channel is moonlight, not torch.
I will add this description to comment.
We can't exactly define moonlight current level, because every vendor has their own specification.

Quoted 4 lines

Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek

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

#6 lore raw

Re: [PATCH v11 3/5] dt-bindings: leds: Add LED_FUNCTION_MOONLIGHT definitions

Hi!

Quoted 12 lines
Quoted 11 lines

include/dt-bindings/leds/common.h line 81

Quoted 6 lines

+++ b/include/dt-bindings/leds/common.h

include/dt-bindings/leds/common.h +1 -0
@@ -78,6 +78,7 @@
 #define LED_FUNCTION_INDICATOR "indicator"
 #define LED_FUNCTION_LAN "lan"
 #define LED_FUNCTION_MAIL "mail"
+#define LED_FUNCTION_MOONLIGHT "moonlight"

There's "torch" function that should be used for this. I guess comment should be added with explanation what exactly that is and how should the LED be named.

Quoted 8 lines

According to mail, 11/25 "Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions",
The Moonlight LED is LED which maximum current more than torch, but less than flash. Such as front camera fill light.
I think our channel is moonlight, not torch.
I will add this description to comment.
We can't exactly define moonlight current level, because every vendor has their own specification.

So... what is the timelimit on moonlight?

But if it is used for camera illumination, I believe it should be simply called flash.

Best regards,

Pavel

Signature · 1 line
http://www.livejournal.com/~pavelmachek

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

#7 lore raw

Re: [PATCH v11 3/5] dt-bindings: leds: Add LED_FUNCTION_MOONLIGHT definitions

Hi Pavel,

Quoted 23 lines · Pavel Machek

Hi!

Quoted 12 lines
Quoted 11 lines

include/dt-bindings/leds/common.h line 81

Quoted 6 lines

+++ b/include/dt-bindings/leds/common.h

include/dt-bindings/leds/common.h +1 -0
@@ -78,6 +78,7 @@
  #define LED_FUNCTION_INDICATOR "indicator"
  #define LED_FUNCTION_LAN "lan"
  #define LED_FUNCTION_MAIL "mail"
+#define LED_FUNCTION_MOONLIGHT "moonlight"

There's "torch" function that should be used for this. I guess comment should be added with explanation what exactly that is and how should the LED be named.

Quoted 8 lines

According to mail, 11/25 "Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions",
The Moonlight LED is LED which maximum current more than torch, but less than flash. Such as front camera fill light.
I think our channel is moonlight, not torch.
I will add this description to comment.
We can't exactly define moonlight current level, because every vendor has their own specification.

Quoted 4 lines

So... what is the timelimit on moonlight?

But if it is used for camera illumination, I believe it should be simply called flash.

Let's keep FLASH reserved for LED flash class devices. This device has already two other flash iouts.

Also iouts amperage gives clue that they have three different functions.

Signature · 7 lines
Best regards,
Jacek Anaszewski

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

Re: [PATCH v11 3/5] dt-bindings: leds: Add LED_FUNCTION_MOONLIGHT definitions

Quoted 28 lines · Jacek Anaszewski

Hi Pavel,

Quoted 25 lines · Pavel Machek

Hi!

Quoted 12 lines
Quoted 11 lines

include/dt-bindings/leds/common.h line 81

Quoted 6 lines

+++ b/include/dt-bindings/leds/common.h

include/dt-bindings/leds/common.h +1 -0
@@ -78,6 +78,7 @@
  #define LED_FUNCTION_INDICATOR "indicator"
  #define LED_FUNCTION_LAN "lan"
  #define LED_FUNCTION_MAIL "mail"
+#define LED_FUNCTION_MOONLIGHT "moonlight"

There's "torch" function that should be used for this. I guess comment should be added with explanation what exactly that is and how should the LED be named.

Quoted 8 lines

According to mail, 11/25 "Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions",
The Moonlight LED is LED which maximum current more than torch, but less than flash. Such as front camera fill light.
I think our channel is moonlight, not torch.
I will add this description to comment.
We can't exactly define moonlight current level, because every vendor has their own specification.

So... what is the timelimit on moonlight?

Quoted 8 lines
Quoted 2 lines

But if it is used for camera illumination, I believe it should be simply called flash.

Let's keep FLASH reserved for LED flash class devices. This device has already two other flash iouts.

Also iouts amperage gives clue that they have three different functions.

Perhaps there should just be a table of currents and max times rather than trying to continually expand this while tied to function.

One could simply want an LED brighter when blinking than steady state would allow for.

Rob

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

author
#9 lore raw

PATCH v11 4/5 dt-bindings: leds: Add bindings for MT6360 LED

In reply to Gene Chen

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 0000000..73c67b1
@@ -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:
+  "(^led@[0-5]$|led)":
+    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_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>;
+     };
+   };
+
+  - |
+
+   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 · 7 lines
2.7.4


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Acked-by on v11 4/5
#10 lore raw

Re: [PATCH v11 4/5] dt-bindings: leds: Add bindings for MT6360 LED

Hi Gene,

Thanks for the update.

Documentation/devicetree/bindings/leds/leds-mt6360.yaml

Quoted 15 lines · Gene Chen

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 +0 -0
new file mode 100644
index 0000000..73c67b1
Signature · 7 lines
Best regards,
Jacek Anaszewski

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

Re: [PATCH v11 4/5] dt-bindings: leds: Add bindings for MT6360 LED

In reply to Gene Chen
Quoted 35 lines · Gene Chen

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 +19 -0
new file mode 100644
index 0000000..73c67b1
@@ -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:

Documentation/devicetree/bindings/leds/leds-mt6360.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-mt6360.yaml new file +10 -0
+    const: mediatek,mt6360-led
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "(^led@[0-5]$|led)":

"^(multi-)?led@[0-5]$":

Quoted 133 lines
Documentation/devicetree/bindings/leds/leds-mt6360.yaml new file +130 -0
+    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_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>;
+     };
+   };
+
+  - |
+
+   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.7.4

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

author
#12 lore raw

PATCH v11 5/5 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/Kconfig       |  13 +
 drivers/leds/Makefile      |   1 +
 drivers/leds/leds-mt6360.c | 827 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 841 insertions(+)
 create mode 100644 drivers/leds/leds-mt6360.c
drivers/leds/Kconfig +13 -0
index 1c181df..4f533bc 100644
@@ -271,6 +271,19 @@ config LEDS_MT6323
 	  This option enables support for on-chip LED drivers found on
 	  Mediatek MT6323 PMIC.
 
+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_S3C24XX
 	tristate "LED Support for Samsung S3C24XX GPIO LEDs"
 	depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
index c2c7d7a..5596427 100644
@@ -66,6 +66,7 @@ obj-$(CONFIG_LEDS_MIKROTIK_RB532)	+= leds-rb532.o
 obj-$(CONFIG_LEDS_MLXCPLD)		+= leds-mlxcpld.o
 obj-$(CONFIG_LEDS_MLXREG)		+= leds-mlxreg.o
 obj-$(CONFIG_LEDS_MT6323)		+= leds-mt6323.o
+obj-$(CONFIG_LEDS_MT6360)		+= leds-mt6360.o
 obj-$(CONFIG_LEDS_NET48XX)		+= leds-net48xx.o
 obj-$(CONFIG_LEDS_NETXBIG)		+= leds-netxbig.o
 obj-$(CONFIG_LEDS_NIC78BX)		+= leds-nic78bx.o
drivers/leds/leds-mt6360.c new file +827 -0

827 lines not on this page · raw message

Signature · 7 lines
2.7.4


_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
#13 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Gene,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on pavel-linux-leds/for-next]
[also build test WARNING on robh/for-next linus/master v5.10-rc6 next-20201201] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Gene-Chen/leds-mt6360-Add-LED-driver-for-MT6360/20201202-185224
base:   git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next
config: arm-randconfig-r035-20201202 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 2671fccf0381769276ca8246ec0499adcb9b0355)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/594faa6d4c2cea720cd53d19375000ab042bb5cb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Gene-Chen/leds-mt6360-Add-LED-driver-for-MT6360/20201202-185224 git checkout 594faa6d4c2cea720cd53d19375000ab042bb5cb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/leds/leds-mt6360.c:724:80: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                   dev_err(&pdev->dev, "No child node or node count over max led number %lu\n", count);
                                                                                        ~~~     ^~~~~
                                                                                        %u
   include/linux/dev_printk.h:112:32: note: expanded from macro 'dev_err'
           _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                 ~~~     ^~~~~~~~~~~

1 warning generated.

vim +724 drivers/leds/leds-mt6360.c

714
715 static int mt6360_led_probe(struct platform_device *pdev)
716 {
717 struct mt6360_priv *priv;
718 struct fwnode_handle *child;
719 size_t count;
720 int i = 0, ret;
721
722 count = device_get_child_node_count(&pdev->dev);
723 if (!count || count > MT6360_MAX_LEDS) {

 > 724			dev_err(&pdev->dev, "No child node or node count over max led number %lu\n", count);

725 return -EINVAL;
726 }
727
728 priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count), GFP_KERNEL);
729 if (!priv)
730 return -ENOMEM;
731
732 priv->leds_count = count;
733 priv->dev = &pdev->dev;
734 mutex_init(&priv->lock);
735
736 priv->regmap = dev_get_regmap(pdev->dev.parent, NULL);
737 if (!priv->regmap) {
738 dev_err(&pdev->dev, "Failed to get parent regmap\n");
739 return -ENODEV;
740 }
741
742 device_for_each_child_node(&pdev->dev, child) {
743 struct mt6360_led *led = priv->leds + i;
744 struct led_init_data init_data = { .fwnode = child, };
745 u32 reg, led_color;
746
747 ret = fwnode_property_read_u32(child, "color", &led_color);
748 if (ret)
749 goto out_flash_release;
750
751 if (led_color == LED_COLOR_ID_RGB || led_color == LED_COLOR_ID_MULTI)
752 reg = MT6360_VIRTUAL_MULTICOLOR;
753 else {
754 ret = fwnode_property_read_u32(child, "reg", &reg);
755 if (ret)
756 goto out_flash_release;
757
758 if (reg >= MT6360_MAX_LEDS) {
759 ret = -EINVAL;
760 goto out_flash_release;
761 }
762 }
763
764 if (priv->leds_active & BIT(reg)) {
765 ret = -EINVAL;
766 goto out_flash_release;
767 }
768 priv->leds_active |= BIT(reg);
769
770 led->led_no = reg;
771 led->priv = priv;
772
773 ret = mt6360_init_common_properties(led, &init_data);
774 if (ret)
775 goto out_flash_release;
776
777 if (reg == MT6360_VIRTUAL_MULTICOLOR ||
778 (reg >= MT6360_LED_ISNK1 && reg <= MT6360_LED_ISNKML))
779 ret = mt6360_init_isnk_properties(led, &init_data);
780 else
781 ret = mt6360_init_flash_properties(led, &init_data);
782
783 if (ret)
784 goto out_flash_release;
785
786 ret = mt6360_led_register(&pdev->dev, led, &init_data);
787 if (ret)
788 goto out_flash_release;
789
790 i++;
791 }
792
793 platform_set_drvdata(pdev, priv);
794 return 0;
795
796 out_flash_release:
797 mt6360_v4l2_flash_release(priv);
798 return ret;
799 }
800

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#14 lore raw
In reply to Gene Chen
Thank you for the patch! Perhaps something to improve:

Hi Gene,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on pavel-linux-leds/for-next]
[also build test WARNING on robh/for-next linus/master v5.10-rc6 next-20201201] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Gene-Chen/leds-mt6360-Add-LED-driver-for-MT6360/20201202-185224
base:   git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next
config: nds32-randconfig-r012-20201202 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/594faa6d4c2cea720cd53d19375000ab042bb5cb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Gene-Chen/leds-mt6360-Add-LED-driver-for-MT6360/20201202-185224 git checkout 594faa6d4c2cea720cd53d19375000ab042bb5cb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

In file included from include/linux/device.h:15,

                    from include/linux/leds.h:12,
                    from include/linux/led-class-flash.h:11,
                    from drivers/leds/leds-mt6360.c:8:
   drivers/leds/leds-mt6360.c: In function 'mt6360_led_probe':
>> drivers/leds/leds-mt6360.c:724:23: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     724 |   dev_err(&pdev->dev, "No child node or node count over max led number %lu\n", count);
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/leds/leds-mt6360.c:724:3: note: in expansion of macro 'dev_err'
     724 |   dev_err(&pdev->dev, "No child node or node count over max led number %lu\n", count);
         |   ^~~~~~~
   drivers/leds/leds-mt6360.c:724:74: note: format string is defined here
     724 |   dev_err(&pdev->dev, "No child node or node count over max led number %lu\n", count);
         |                                                                        ~~^
         |                                                                          |
         |                                                                          long unsigned int
         |                                                                        %u

vim +724 drivers/leds/leds-mt6360.c

714
715 static int mt6360_led_probe(struct platform_device *pdev)
716 {
717 struct mt6360_priv *priv;
718 struct fwnode_handle *child;
719 size_t count;
720 int i = 0, ret;
721
722 count = device_get_child_node_count(&pdev->dev);
723 if (!count || count > MT6360_MAX_LEDS) {

 > 724			dev_err(&pdev->dev, "No child node or node count over max led number %lu\n", count);

725 return -EINVAL;
726 }
727
728 priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count), GFP_KERNEL);
729 if (!priv)
730 return -ENOMEM;
731
732 priv->leds_count = count;
733 priv->dev = &pdev->dev;
734 mutex_init(&priv->lock);
735
736 priv->regmap = dev_get_regmap(pdev->dev.parent, NULL);
737 if (!priv->regmap) {
738 dev_err(&pdev->dev, "Failed to get parent regmap\n");
739 return -ENODEV;
740 }
741
742 device_for_each_child_node(&pdev->dev, child) {
743 struct mt6360_led *led = priv->leds + i;
744 struct led_init_data init_data = { .fwnode = child, };
745 u32 reg, led_color;
746
747 ret = fwnode_property_read_u32(child, "color", &led_color);
748 if (ret)
749 goto out_flash_release;
750
751 if (led_color == LED_COLOR_ID_RGB || led_color == LED_COLOR_ID_MULTI)
752 reg = MT6360_VIRTUAL_MULTICOLOR;
753 else {
754 ret = fwnode_property_read_u32(child, "reg", &reg);
755 if (ret)
756 goto out_flash_release;
757
758 if (reg >= MT6360_MAX_LEDS) {
759 ret = -EINVAL;
760 goto out_flash_release;
761 }
762 }
763
764 if (priv->leds_active & BIT(reg)) {
765 ret = -EINVAL;
766 goto out_flash_release;
767 }
768 priv->leds_active |= BIT(reg);
769
770 led->led_no = reg;
771 led->priv = priv;
772
773 ret = mt6360_init_common_properties(led, &init_data);
774 if (ret)
775 goto out_flash_release;
776
777 if (reg == MT6360_VIRTUAL_MULTICOLOR ||
778 (reg >= MT6360_LED_ISNK1 && reg <= MT6360_LED_ISNKML))
779 ret = mt6360_init_isnk_properties(led, &init_data);
780 else
781 ret = mt6360_init_flash_properties(led, &init_data);
782
783 if (ret)
784 goto out_flash_release;
785
786 ret = mt6360_led_register(&pdev->dev, led, &init_data);
787 if (ret)
788 goto out_flash_release;
789
790 i++;
791 }
792
793 platform_set_drvdata(pdev, priv);
794 return 0;
795
796 out_flash_release:
797 mt6360_v4l2_flash_release(priv);
798 return ret;
799 }
800

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

Acked-by on v11 5/5
#15 lore raw
In reply to Gene Chen

Hi Gene,

Quoted 40 lines · 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/Kconfig       |  13 +
  drivers/leds/Makefile      |   1 +
  drivers/leds/leds-mt6360.c | 827 +++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 841 insertions(+)

create mode 100644 drivers/leds/leds-mt6360.c

drivers/leds/Kconfig +13 -0
index 1c181df..4f533bc 100644
@@ -271,6 +271,19 @@ config LEDS_MT6323
  	  This option enables support for on-chip LED drivers found on
  	  Mediatek MT6323 PMIC.
 
+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_S3C24XX
  	tristate "LED Support for Samsung S3C24XX GPIO LEDs"
  	depends on LEDS_CLASS
drivers/leds/Makefile +0 -0
index c2c7d7a..5596427 100644

[...]

Quoted 73 lines
drivers/leds/Makefile +73 -0
+static int mt6360_led_probe(struct platform_device *pdev)
+{
+	struct mt6360_priv *priv;
+	struct fwnode_handle *child;
+	size_t count;
+	int i = 0, ret;
+
+	count = device_get_child_node_count(&pdev->dev);
+	if (!count || count > MT6360_MAX_LEDS) {
+		dev_err(&pdev->dev, "No child node or node count over max led number %lu\n", count);
+		return -EINVAL;
+	}
+
+	priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->leds_count = count;
+	priv->dev = &pdev->dev;
+	mutex_init(&priv->lock);
+
+	priv->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (!priv->regmap) {
+		dev_err(&pdev->dev, "Failed to get parent regmap\n");
+		return -ENODEV;
+	}
+
+	device_for_each_child_node(&pdev->dev, child) {
+		struct mt6360_led *led = priv->leds + i;
+		struct led_init_data init_data = { .fwnode = child, };
+		u32 reg, led_color;
+
+		ret = fwnode_property_read_u32(child, "color", &led_color);
+		if (ret)
+			goto out_flash_release;
+
+		if (led_color == LED_COLOR_ID_RGB || led_color == LED_COLOR_ID_MULTI)
+			reg = MT6360_VIRTUAL_MULTICOLOR;
+		else {
+			ret = fwnode_property_read_u32(child, "reg", &reg);
+			if (ret)
+				goto out_flash_release;
+
+			if (reg >= MT6360_MAX_LEDS) {
+				ret = -EINVAL;
+				goto out_flash_release;
+			}
+		}
+
+		if (priv->leds_active & BIT(reg)) {
+			ret = -EINVAL;
+			goto out_flash_release;
+		}
+		priv->leds_active |= BIT(reg);
+
+		led->led_no = reg;
+		led->priv = priv;
+
+		ret = mt6360_init_common_properties(led, &init_data);
+		if (ret)
+			goto out_flash_release;
+
+		if (reg == MT6360_VIRTUAL_MULTICOLOR ||
+			(reg >= MT6360_LED_ISNK1 && reg <= MT6360_LED_ISNKML))
+			ret = mt6360_init_isnk_properties(led, &init_data);
+		else
+			ret = mt6360_init_flash_properties(led, &init_data);
+
+		if (ret)
+			goto out_flash_release;
+
+		ret = mt6360_led_register(&pdev->dev, led, &init_data);
+		if (ret)

drivers/leds/Makefile

Quoted 10 lines
drivers/leds/Makefile +10 -0
+			goto out_flash_release;
+
+		i++;
+	}
+
+	platform_set_drvdata(pdev, priv);
+	return 0;
+
+out_flash_release:
+	mt6360_v4l2_flash_release(priv);

The need for releasing v4l2_flash devices here and not other LEDs is not obvious at first glance. Of course this is due to the fact that LED/flash registration functions have devm support but v4l2_flash doesn't. It would be good to cover it at some point.

If you added that support to drivers/media/v4l2-core/v4l2-flash-led-class.c then you could simplify the code in this driver quite nicely.

But it's up to you.

That being said:

Signature · 7 lines
Best regards,
Jacek Anaszewski

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