leds: mt6360: Add LED driver for MT6360
Subsystems (3)
v7 cover leds: mt6360: Add LED driver for MT6360
In-Reply-To:
Gene Chen (5)
leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
dt-bindings: leds: common: Increase LED_COLOR_ID_* maximum size
dt-bindings: leds: Add bindings for MT6360 LED
leds: mt6360: Add LED driver for MT6360
Documentation/devicetree/bindings/leds/common.yaml | 2 Documentation/devicetree/bindings/leds/leds-mt6360.yaml | 164 +++ drivers/leds/Kconfig | 13 drivers/leds/Makefile | 1 drivers/leds/leds-mt6360.c | 808 ++++++++++++++++ include/dt-bindings/leds/common.h | 3 include/linux/led-class-flash.h | 36 7 files changed, 1025 insertions(+), 2 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
PATCH v7 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
--- include/linux/led-class-flash.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
include/linux/led-class-flash.h +36 -0
@@ -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
@@ -127,6 +128,41 @@ static inline int devm_led_classdev_flash_register(struct device *parent,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 -EINVAL ; +} + +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 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 -EINVAL ; +} + +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) +{}; + +#endif /* IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) */ +/** * 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
kernel test robot
build botRe: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
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-rc4 next-20201118] [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/20201118-185208 base: git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next config: nds32-randconfig-r001-20201118 (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/a088d9624f18b888ede6b0344163b8464db82f3b
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/20201118-185208 git checkout a088d9624f18b888ede6b0344163b8464db82f3b
# 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 drivers/staging/greybus/light.c:11:
>> include/linux/led-class-flash.h:160:6: warning: no previous prototype for 'devm_led_classdev_flash_unregister' [-Wmissing-prototypes]
160 | void devm_led_classdev_flash_unregister(struct device *parent,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/devm_led_classdev_flash_unregister +160 include/linux/led-class-flash.h
159
> 160 void devm_led_classdev_flash_unregister(struct device *parent,
161 struct led_classdev_flash *fled_cdev)
162 {};
163
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
In reply to Gene ChenHi Gene,
Quoted 22 lines · Gene Chen
From: Gene Chen <[email protected]>
Add flash registration with undefined
CONFIG_LEDS_CLASS_FLASHSigned-off-by Gene Chen <[email protected]>--- include/linux/led-class-flash.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)include/linux/led-class-flash.h +1
-0@@ -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
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 137
Quoted 10 lines
include/linux/led-class-flash.h +7
-0@@ -127,6 +128,41 @@ static inline int devm_led_classdev_flash_register(struct device *parent,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 -EINVAL ;
s/-EINVAL/0/
The goal here is to assure that client will not fail when using no-op.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 144
Quoted 7 lines
include/linux/led-class-flash.h +7
-0+} + +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 ); +}
This function should be placed after #ifdef block because its shape is the same for both cases.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 151
Quoted 6 lines
include/linux/led-class-flash.h +6
-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 -EINVAL ;
/-EINVAL/0/
Please do the same fix in all no-ops in the led-class-multicolor.h, as we've discussed.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 158
Quoted 7 lines
include/linux/led-class-flash.h +7
-0+} + +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 ); +}
This function should also be placed after #ifdef block. Please make the same optimizations in the led-class-multicolor.h as you are at it.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 159
Quoted 2 lines
include/linux/led-class-flash.h +2
-0+ +void devm_led_classdev_flash_unregister(struct device *parent,
s/void/static inline void/
That's the reason why you got warning from buildbot.
Quoted 9 lines
include/linux/led-class-flash.h +5
-0+ struct led_classdev_flash *fled_cdev) +{}; + +#endif /* IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) */ +/** * led_set_flash_strobe - setup flash strobe * @fled_cdev: the flash LED to set strobe on
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
Jacek Anaszewski <[email protected]> 於 2020年11月20日 週五 上午6:29寫道:
Quoted 61 lines
Hi Gene,
Quoted 22 lines · Gene Chen
From: Gene Chen <[email protected]>
Add flash registration with undefined
CONFIG_LEDS_CLASS_FLASHSigned-off-by Gene Chen <[email protected]>--- include/linux/led-class-flash.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)include/linux/led-class-flash.h +1
-0@@ -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 include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 137
Quoted 10 lines
include/linux/led-class-flash.h +7
-0@@ -127,6 +128,41 @@ static inline int devm_led_classdev_flash_register(struct device *parent,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 -EINVAL ;s/-EINVAL/0/
The goal here is to assure that client will not fail when using no-op.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 144
Quoted 7 lines
include/linux/led-class-flash.h +7
-0+} + +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 ); +}This function should be placed after #ifdef block because its shape is the same for both cases.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 151
Quoted 6 lines
include/linux/led-class-flash.h +6
-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 -EINVAL ;/-EINVAL/0/
Quoted 3 lines
Please do the same fix in all no-ops in the
led-class-multicolor.h, as we've discussed.
I think return -EINVAL is correct, because I should register flash light device if I define FLED in DTS node.
Quoted 13 lines
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 158
Quoted 7 lines
include/linux/led-class-flash.h +7
-0+} + +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 ); +}This function should also be placed after #ifdef block. Please make the same optimizations in the
led-class-multicolor.has you are at it.
Quoted 7 lines
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 159
Quoted 2 lines
include/linux/led-class-flash.h +2
-0+ +void devm_led_classdev_flash_unregister(struct device *parent,s/void/static inline void/
That's the reason why you got warning from buildbot.
ACK
Quoted 5 lines
Quoted 5 lines
include/linux/led-class-flash.h +5
-0+ struct led_classdev_flash *fled_cdev) +{}; + +#endif /* IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) */ +
Quoted 8 lines
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 168
Quoted 4 lines
include/linux/led-class-flash.h +0
-0/** * led_set_flash_strobe - setup flash strobe * @fled_cdev: the flash LED to set strobe on --
Best regards,
Jacek Anaszewski
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
Quoted 62 lines · Gene Chen
Jacek Anaszewski <[email protected]> 於 2020年11月20日 週五 上午6:29寫道:
Quoted 61 lines
Hi Gene,
Quoted 22 lines · Gene Chen
From: Gene Chen <[email protected]>
Add flash registration with undefined
CONFIG_LEDS_CLASS_FLASHSigned-off-by Gene Chen <[email protected]>--- include/linux/led-class-flash.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)include/linux/led-class-flash.h +1
-0@@ -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 include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 137
Quoted 10 lines
include/linux/led-class-flash.h +7
-0@@ -127,6 +128,41 @@ static inline int devm_led_classdev_flash_register(struct device *parent,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 -EINVAL ;s/-EINVAL/0/
The goal here is to assure that client will not fail when using no-op.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 144
Quoted 7 lines
include/linux/led-class-flash.h +7
-0+} + +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 ); +}This function should be placed after #ifdef block because its shape is the same for both cases.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 151
Quoted 6 lines
include/linux/led-class-flash.h +6
-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 -EINVAL ;/-EINVAL/0/
Quoted 6 lines
Quoted 3 lines
Please do the same fix in all no-ops in the
led-class-multicolor.h, as we've discussed.I think return
-EINVALis correct, because I should register flash light device if I define FLED in DTS node.
I don't quite follow your logic here.
No-op function's purpose is to simplify the code on the caller's side. Therefore it should report success.
Please return 0 from it.
Signature · 7 lines
Best regards, Jacek Anaszewski _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
Jacek Anaszewski <[email protected]> 於 2020年11月24日 週二 上午5:07寫道:
Quoted 71 lines · Gene Chen
Quoted 62 lines
Jacek Anaszewski <[email protected]> 於 2020年11月20日 週五 上午6:29寫道:
Quoted 61 lines
Hi Gene,
Quoted 22 lines · Gene Chen
From: Gene Chen <[email protected]>
Add flash registration with undefined
CONFIG_LEDS_CLASS_FLASHSigned-off-by Gene Chen <[email protected]>--- include/linux/led-class-flash.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)include/linux/led-class-flash.h +1
-0@@ -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 include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 137
Quoted 10 lines
include/linux/led-class-flash.h +7
-0@@ -127,6 +128,41 @@ static inline int devm_led_classdev_flash_register(struct device *parent,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 -EINVAL ;s/-EINVAL/0/
The goal here is to assure that client will not fail when using no-op.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 144
Quoted 7 lines
include/linux/led-class-flash.h +7
-0+} + +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 ); +}This function should be placed after #ifdef block because its shape is the same for both cases.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 151
Quoted 6 lines
include/linux/led-class-flash.h +6
-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 -EINVAL ;/-EINVAL/0/
Quoted 6 lines
Quoted 3 lines
Please do the same fix in all no-ops in the
led-class-multicolor.h, as we've discussed.I think return
-EINVALis correct, because I should register flash light device if I define FLED in DTS node.
Quoted 7 lines
I don't quite follow your logic here.
No-op function's purpose is to simplify the code on the caller's side. Therefore it should report success.
Please return 0 from it.
Just like those functions in led-class-multicolor.h, caller may use return value to check whether FLED is registered successfully or not. For this case, is returning 0 a little bit misleading?
Quoted 3 lines
--
Best regards,
Jacek Anaszewski
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
On 11/24/20 7:08 AM, Gene Chen wrote:
[...]
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
This function should be placed after #ifdef block because its shape is the same for both cases.
include/linux/led-class-flash.h static inline int devm_led_classdev_flash_register(struct device *parent, · line 151
Quoted 6 lines
include/linux/led-class-flash.h +6
-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 -EINVAL ;/-EINVAL/0/
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Please do the same fix in all no-ops in the
led-class-multicolor.h, as we've discussed.I think return
-EINVALis correct, because I should register flash light device if I define FLED in DTS node.
OK, I think I'm getting your concerns now. So you're only partially
correct - the driver should register flash LED device if there is
corresponding node in DT, but only if CONFIG_LEDS_CLASS_FLASH is enabled. In case it is disabled the no-op will come into play and return 0, allowing the probe() to proceed as if the registration
succeeded.
From the driver point of view nothing changes, except that flash LED ops will not be called afterwards. This is common pattern. If in doubt skim through the headers in include/linux.
Quoted 6 lines
Quoted 6 lines
I don't quite follow your logic here.
No-op function's purpose is to simplify the code on the caller's side. Therefore it should report success.
Quoted 6 lines
Quoted 2 lines
Please return 0 from it.
Just like those functions in
led-class-multicolor.h, caller may use return value to check whether FLED is registered successfully or not. For this case, is returning 0 a little bit misleading?
Please note that I've already admitted that led-class-multicolor.h class is buggy and should also be fixed to return 0 from its no-ops. Please apply the "s/-EINVAL/0/" fixes to it as well - your driver will need that.
Signature · 2 lines
Best regards, Jacek Anaszewski
PATCH v7 2/5 dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Add LED_COLOR_ID_MOONLIGHT definitions
--- include/dt-bindings/leds/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/dt-bindings/leds/common.h +2 -1
@@ -33,7 +33,8 @@#define LED_COLOR_ID_MULTI 8/* For multicolor LEDs */ #define LED_COLOR_ID_RGB 9/* For multicolor LEDs that can do arbitrary color, so this would include RGBW and similar */ -#define LED_COLOR_ID_MAX 10 +#define LED_COLOR_ID_MOONLIGHT 10 +#define LED_COLOR_ID_MAX 11/* Standard LED functions */ /* Keyboard LEDs, usually it would be input4::capslock etc. */
Signature · 7 lines
2.7.4 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Hi!
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitions
Why is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Best regards,
Pavel
Quoted 19 lines
Signed-off-by Gene Chen <[email protected]>--- include/dt-bindings/leds/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)include/dt-bindings/leds/common.h +2
-1@@ -33,7 +33,8 @@#define LED_COLOR_ID_MULTI 8/* For multicolor LEDs */ #define LED_COLOR_ID_RGB 9/* For multicolor LEDs that can do arbitrary color, so this would include RGBW and similar */ -#define LED_COLOR_ID_MAX 10 +#define LED_COLOR_ID_MOONLIGHT 10 +#define LED_COLOR_ID_MAX 11/* Standard LED functions */ /* Keyboard LEDs, usually it would be input4::capslock etc. */
Signature · 1 line
http://www.livejournal.com/~pavelmachek
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Pavel Machek <[email protected]> 於 2020年11月19日 週四 上午5:37寫道:
Quoted 5 lines
Hi!
Quoted 2 lines
From: Gene Chen <[email protected]>
Quoted 9 lines
Quoted 1 line
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Best regards,
Pavel
Moonlight has more current level(150mA) from general RGB LED (24mA). It can be used as night-light and usually use color AMBER.
Camera flashes are usually use two flash LED. One is YELLOW, and one is WHITE.
Quoted 24 lines
Quoted 12 lines
Signed-off-by Gene Chen <[email protected]>--- include/dt-bindings/leds/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)include/dt-bindings/leds/common.h +0
-0include/dt-bindings/leds/common.h line 40
Quoted 9 lines
include/dt-bindings/leds/common.h +2
-1@@ -33,7 +33,8 @@#define LED_COLOR_ID_MULTI 8/* For multicolor LEDs */ #define LED_COLOR_ID_RGB 9/* For multicolor LEDs that can do arbitrary color, so this would include RGBW and similar */ -#define LED_COLOR_ID_MAX 10 +#define LED_COLOR_ID_MOONLIGHT 10 +#define LED_COLOR_ID_MAX 11/* Standard LED functions */ /* Keyboard LEDs, usually it would be input4::capslock etc. */
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Hi!
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Quoted 8 lines
Quoted 3 lines
Best regards,
PavelMoonlight has more current level(150mA) from general RGB LED (24mA). It can be used as night-light and usually use color AMBER. Camera flashes are usually use two flash LED. One is YELLOW, and one is WHITE.
From what I seen, night-lights are usually differetent "temperatures" of white. Cool white + warm white.
I believe "warm white" would be easier to understand than "moonlight"...
Best regards,
Pavel
Signature · 1 line
http://www.livejournal.com/~pavelmachek
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Pavel Machek <[email protected]> 於 2020年11月19日 週四 下午3:44寫道:
Quoted 20 lines
Hi!
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Quoted 8 lines
Quoted 3 lines
Best regards,
PavelMoonlight has more current level(150mA) from general RGB LED (24mA). It can be used as night-light and usually use color AMBER. Camera flashes are usually use two flash LED. One is YELLOW, and one is WHITE.
Quoted 6 lines
From what I seen, night-lights are usually differetent "temperatures" of white. Cool white + warm white.
I believe "warm white" would be easier to understand than "moonlight"...
ACK, I will change color "LED_COLOR_ID_WHITE"
Quoted 5 lines
Best regards,
Pavel
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Moonlight has more current level(150mA) from general RGB LED (24mA). It can be used as night-light and usually use color AMBER. Camera flashes are usually use two flash LED. One is YELLOW, and one is WHITE.
Quoted 7 lines
Quoted 5 lines
From what I seen, night-lights are usually differetent "temperatures" of white. Cool white + warm white.
I believe "warm white" would be easier to understand than "moonlight"...
ACK, I will change color "
LED_COLOR_ID_WHITE"
If you have two leds that differ only in one being "cool white" and one being "warm white", you may need to introduce defines for one of them.
If not, keeping "LED_COLOR_ID_WHITE" is enough.
Best regards,
Pavel
Signature · 1 line
http://www.livejournal.com/~pavelmachek
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
In reply to Pavel MachekHi Pavel, Gene,
Quoted 9 lines · Pavel Machek
Hi!
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
That's my fault, In fact I should have asked about adding LED_FUNCTION_MOONLIGHT, it was evidently too late for me that evening...
Signature · 7 lines
Best regards, Jacek Anaszewski _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Quoted 7 lines · Jacek Anaszewski
Hi Pavel, Gene,
Quoted 4 lines · Pavel Machek
Hi!
Quoted 2 lines
From: Gene Chen <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
That's my fault, In fact I should have asked about adding
LED_FUNCTION_MOONLIGHT, it was evidently too late for me that evening...
Aha, that makes more sense.
But please let's call it "torch" if we do that, as that is already used in kernel sources... and probably in the interface, too:
./arch/arm/mach-pxa/ezx.c: .name = "a910::torch",
Best regards,
Pavel
Signature · 1 line
http://www.livejournal.com/~pavelmachek
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Quoted 14 lines · Pavel Machek
Quoted 13 lines · Jacek Anaszewski
Hi Pavel, Gene,
Quoted 9 lines · Pavel Machek
Hi!
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Quoted 7 lines
Quoted 2 lines
That's my fault, In fact I should have asked about adding
LED_FUNCTION_MOONLIGHT, it was evidently too late for me that evening...Aha, that makes more sense.
But please let's call it "torch" if we do that, as that is already used in kernel sources... and probably in the interface, too:
I'd say that torch is something different that moonlight, but we would need more input from Gene to learn more about the nature of light emitted by ML LED on his device.
Please note that torch is usually meant as the other mode of flash LED (sometimes it is called "movie mode"), which is already handled by brightness file of LED class flash device (i.e. its LED class subset), and which also maps to v4l2-flash TORCH mode.
Quoted 5 lines
./arch/arm/mach-pxa/ezx.c: .name = "a910::torch",Best regards,
Pavel
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Jacek Anaszewski <[email protected]> 於 2020年11月20日 週五 上午6:26寫道:
Quoted 24 lines · Pavel Machek
Quoted 14 lines · Jacek Anaszewski
Quoted 13 lines
Hi Pavel, Gene,
Quoted 9 lines · Pavel Machek
Hi!
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Quoted 7 lines
Quoted 2 lines
That's my fault, In fact I should have asked about adding
LED_FUNCTION_MOONLIGHT, it was evidently too late for me that evening...Aha, that makes more sense.
But please let's call it "torch" if we do that, as that is already used in kernel sources... and probably in the interface, too:
Quoted 9 lines
I'd say that torch is something different that moonlight, but we would need more input from Gene to learn more about the nature of light emitted by ML LED on his device.
Please note that torch is usually meant as the other mode of flash LED (sometimes it is called "movie mode"), which is already handled by brightness file of LED class flash device (i.e. its LED class subset), and which also maps to v4l2-flash TORCH mode.
It's used to front camera fill light.
More brightness than screen backlight, and more soft light than flash. I think LED_ID_COLOR_WHITE is okay.
Quoted 9 lines
Quoted 5 lines
./arch/arm/mach-pxa/ezx.c: .name = "a910::torch",Best regards,
Pavel--
Best regards,
Jacek Anaszewski
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Quoted 35 lines · Gene Chen
Jacek Anaszewski <[email protected]> 於 2020年11月20日 週五 上午6:26寫道:
Quoted 24 lines · Pavel Machek
Quoted 14 lines · Jacek Anaszewski
Quoted 13 lines
Hi Pavel, Gene,
Quoted 9 lines · Pavel Machek
Hi!
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Quoted 7 lines
Quoted 2 lines
That's my fault, In fact I should have asked about adding
LED_FUNCTION_MOONLIGHT, it was evidently too late for me that evening...Aha, that makes more sense.
But please let's call it "torch" if we do that, as that is already used in kernel sources... and probably in the interface, too:
Quoted 9 lines
I'd say that torch is something different that moonlight, but we would need more input from Gene to learn more about the nature of light emitted by ML LED on his device.
Please note that torch is usually meant as the other mode of flash LED (sometimes it is called "movie mode"), which is already handled by brightness file of LED class flash device (i.e. its LED class subset), and which also maps to v4l2-flash TORCH mode.
Quoted 3 lines
It's used to front camera fill light.
More brightness than screen backlight, and more soft light than flash. I thinkLED_ID_COLOR_WHITEis okay.
So why in v6 you assigned LED_COLOR_ID_AMBER to it?
Regardless of that, now we're talking about LED function - you chose LED_FUNCTION_INDICATOR for it, but inferring from your above description
- it certainly doesn't fit here.
Also register names, containing part "ML" indicate that this LED's intended function is moonlinght, which your description somehow corroborates.
Moonlight LEDs become ubiquitous nowadays so sooner or later we will need to add this function anyway [0].
[0] https://landscapelightingoakville.com/what-is-moon-lighting-and-why-does-it-remain-so-popular/
Signature · 2 lines
Best regards, Jacek Anaszewski
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Jacek Anaszewski <[email protected]> 於 2020年11月24日 週二 上午4:52寫道:
Quoted 51 lines · Gene Chen
Quoted 35 lines
Jacek Anaszewski <[email protected]> 於 2020年11月20日 週五 上午6:26寫道:
Quoted 24 lines · Pavel Machek
Quoted 14 lines · Jacek Anaszewski
Quoted 13 lines
Hi Pavel, Gene,
Quoted 9 lines · Pavel Machek
Hi!
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Quoted 7 lines
Quoted 2 lines
That's my fault, In fact I should have asked about adding
LED_FUNCTION_MOONLIGHT, it was evidently too late for me that evening...Aha, that makes more sense.
But please let's call it "torch" if we do that, as that is already used in kernel sources... and probably in the interface, too:
Quoted 9 lines
I'd say that torch is something different that moonlight, but we would need more input from Gene to learn more about the nature of light emitted by ML LED on his device.
Please note that torch is usually meant as the other mode of flash LED (sometimes it is called "movie mode"), which is already handled by brightness file of LED class flash device (i.e. its LED class subset), and which also maps to v4l2-flash TORCH mode.
Quoted 3 lines
It's used to front camera fill light.
More brightness than screen backlight, and more soft light than flash. I thinkLED_ID_COLOR_WHITEis okay.So why in v6 you assigned
LED_COLOR_ID_AMBERto it?Regardless of that, now we're talking about LED function - you chose
LED_FUNCTION_INDICATORfor it, but inferring from your above description
- it certainly doesn't fit here.Also register names, containing part "ML" indicate that this LED's intended function is moonlinght, which your description somehow corroborates.
Quoted 6 lines
Moonlight LEDs become ubiquitous nowadays so sooner or later we will need to add this function anyway [0].
[0]
https://landscapelightingoakville.com/what-is-moon-lighting-and-why-does-it-remain-so-popular/
We use term "Moonlight" as reference says
"When you are trying to imitate moonlight you need to use low voltage, softer lighting. You don’t want something that’s too bright" which is focus on brightness instead of color.
So we surpose Moonlight can be white or amber.
Should I add LED_FUNCTION_MOONLIGHT and set LED_COLOR_ID_WHITE?
Quoted 3 lines
--
Best regards,
Jacek Anaszewski
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
Fix Typo.
Gene Chen <[email protected]> 於 2020年11月24日 週二 下午3:33寫道:
Quoted 45 lines
Jacek Anaszewski <[email protected]> 於 2020年11月24日 週二 上午4:52寫道:
Quoted 43 lines · Gene Chen
Quoted 35 lines
Jacek Anaszewski <[email protected]> 於 2020年11月20日 週五 上午6:26寫道:
Quoted 24 lines · Pavel Machek
Quoted 14 lines · Jacek Anaszewski
Quoted 13 lines
Hi Pavel, Gene,
Quoted 9 lines · Pavel Machek
Hi!
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Quoted 7 lines
Quoted 2 lines
That's my fault, In fact I should have asked about adding
LED_FUNCTION_MOONLIGHT, it was evidently too late for me that evening...Aha, that makes more sense.
But please let's call it "torch" if we do that, as that is already used in kernel sources... and probably in the interface, too:
Quoted 9 lines
I'd say that torch is something different that moonlight, but we would need more input from Gene to learn more about the nature of light emitted by ML LED on his device.
Please note that torch is usually meant as the other mode of flash LED (sometimes it is called "movie mode"), which is already handled by brightness file of LED class flash device (i.e. its LED class subset), and which also maps to v4l2-flash TORCH mode.
Quoted 3 lines
It's used to front camera fill light.
More brightness than screen backlight, and more soft light than flash. I thinkLED_ID_COLOR_WHITEis okay.So why in v6 you assigned
LED_COLOR_ID_AMBERto it?
we suppose Moonlight can be white or amber.
Quoted 27 lines
Quoted 8 lines
Regardless of that, now we're talking about LED function - you chose
LED_FUNCTION_INDICATORfor it, but inferring from your above description
- it certainly doesn't fit here.Also register names, containing part "ML" indicate that this LED's intended function is moonlinght, which your description somehow corroborates.
Quoted 6 lines
Moonlight LEDs become ubiquitous nowadays so sooner or later we will need to add this function anyway [0].
[0]
https://landscapelightingoakville.com/what-is-moon-lighting-and-why-does-it-remain-so-popular/According to reference,
"When you are trying to imitate moonlight you need to use low voltage, softer lighting. You don’t want something that’s too bright" which is focus on brightness instead of color.So we suppose Moonlight can be white or amber.
Should I add
LED_FUNCTION_MOONLIGHTand setLED_COLOR_ID_WHITE?Quoted 3 lines
--
Best regards,
Jacek Anaszewski
Re: [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions
In reply to Gene ChenQuoted 59 lines · Gene Chen
Jacek Anaszewski <[email protected]> 於 2020年11月24日 週二 上午4:52寫道:
Quoted 51 lines · Gene Chen
Quoted 35 lines
Jacek Anaszewski <[email protected]> 於 2020年11月20日 週五 上午6:26寫道:
Quoted 24 lines · Pavel Machek
Quoted 14 lines · Jacek Anaszewski
Quoted 13 lines
Hi Pavel, Gene,
Quoted 9 lines · Pavel Machek
Hi!
Quoted 3 lines
From: Gene Chen <[email protected]>
Add
LED_COLOR_ID_MOONLIGHTdefinitionsWhy is moonlight a color? Camera flashes are usually white, no?
At least it needs a comment...
Quoted 7 lines
Quoted 2 lines
That's my fault, In fact I should have asked about adding
LED_FUNCTION_MOONLIGHT, it was evidently too late for me that evening...Aha, that makes more sense.
But please let's call it "torch" if we do that, as that is already used in kernel sources... and probably in the interface, too:
Quoted 9 lines
I'd say that torch is something different that moonlight, but we would need more input from Gene to learn more about the nature of light emitted by ML LED on his device.
Please note that torch is usually meant as the other mode of flash LED (sometimes it is called "movie mode"), which is already handled by brightness file of LED class flash device (i.e. its LED class subset), and which also maps to v4l2-flash TORCH mode.
Quoted 3 lines
It's used to front camera fill light.
More brightness than screen backlight, and more soft light than flash. I thinkLED_ID_COLOR_WHITEis okay.So why in v6 you assigned
LED_COLOR_ID_AMBERto it?Regardless of that, now we're talking about LED function - you chose
LED_FUNCTION_INDICATORfor it, but inferring from your above description
- it certainly doesn't fit here.Also register names, containing part "ML" indicate that this LED's intended function is moonlinght, which your description somehow corroborates.
Quoted 6 lines
Moonlight LEDs become ubiquitous nowadays so sooner or later we will need to add this function anyway [0].
[0]
https://landscapelightingoakville.com/what-is-moon-lighting-and-why-does-it-remain-so-popular/
Quoted 8 lines
We use term "Moonlight" as reference says
"When you are trying to imitate moonlight you need to use low voltage, softer lighting. You don’t want something that’s too bright" which is focus on brightness instead of color.So we surpose Moonlight can be white or amber.
Should I add
LED_FUNCTION_MOONLIGHTand setLED_COLOR_ID_WHITE?
Regarding the function - yes, the reference backs that up. Regarding the color - if you feel that it properly describes the LED color then go for it.
Signature · 7 lines
Best regards, Jacek Anaszewski _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v7 3/5 dt-bindings: leds: common: Increase LED_COLOR_ID_* maximum size
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Increase LED_COLOR_ID_* maximum size
--- Documentation/devicetree/bindings/leds/common.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/leds/common.yaml +1 -1
@@ -43,7 +43,7 @@ properties: LED_COLOR_ID available, add a new one. $ref: /schemas/types.yaml#definitions/uint32 minimum: 0 - maximum: 8 + maximum: 10 function-enumerator: description:
Signature · 1 line
2.7.4
PATCH v7 4/5 dt-bindings: leds: Add bindings for MT6360 LED
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Add bindings document for LED support on MT6360 PMIC
--- .../devicetree/bindings/leds/leds-mt6360.yaml | 164 +++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-mt6360.yaml
Documentation/devicetree/bindings/leds/leds-mt6360.yaml new file +164 -0
@@ -0,0 +1,164 @@ +# 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-6]$": + type: object + $ref: common.yaml# + description: + Properties for a single LED. + + properties: + reg: + description: Index of the LED. + enum: + - 0 # LED output INDICATOR1_RED + - 1 # LED output INDICATOR1_GREEN + - 2 # LED output INDICATOR1_BLUE + - 3 # LED output INDICATOR2_ML + - 4 # LED output FLED1 + - 5 # LED output FLED2 + - 6 # LED output MULTICOLOR + +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>; + + led@3 { + reg = <3>; + function = LED_FUNCTION_INDICATOR; + color = <LED_COLOR_ID_MOONLIGHT>; + 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@6 { + reg = <6>; + function = LED_FUNCTION_INDICATOR; + color = <LED_COLOR_ID_RGB>; + led-max-microamp = <24000>; + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + function = LED_FUNCTION_INDICATOR; + color = <LED_COLOR_ID_RED>; + }; + led@1 { + reg = <1>; + function = LED_FUNCTION_INDICATOR; + color = <LED_COLOR_ID_GREEN>; + }; + led@2 { + reg = <2>; + function = LED_FUNCTION_INDICATOR; + color = <LED_COLOR_ID_BLUE>; + }; + }; + }; + + - | + + 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_INDICATOR; + color = <LED_COLOR_ID_MOONLIGHT>; + 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
Rob Herring
maintainerRe: [PATCH v7 4/5] dt-bindings: leds: Add bindings for MT6360 LED
Quoted 10 lines · Gene Chen
From: Gene Chen <[email protected]>
Add bindings document for LED support on MT6360 PMIC
Signed-off-by Gene Chen <[email protected]>--- .../devicetree/bindings/leds/leds-mt6360.yaml | 164 +++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-mt6360.yaml
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:./Documentation/devicetree/bindings/leds/leds-mt6360.yaml:57:2: [warning] wrong indentation: expected 2 but found 1 (indentation)
dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/leds/leds-mt6360.example.dt.yaml: led-controller: led@3:color:0:0: 10 is greater than the maximum of 9
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/leds/leds-mt6360.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/leds/leds-mt6360.example.dt.yaml: led-controller: led@3:color:0:0: 10 is greater than the maximum of 9
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/leds/leds-mt6360.yaml
See https://patchwork.ozlabs.org/patch/1402193
The base for the patch is generally the last rc1. Any dependencies should be noted.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 4/5] dt-bindings: leds: Add bindings for MT6360 LED
Rob Herring <[email protected]> 於 2020年11月19日 週四 上午5:25寫道:
Quoted 16 lines · Gene Chen
Quoted 10 lines
From: Gene Chen <[email protected]>
Add bindings document for LED support on MT6360 PMIC
Signed-off-by Gene Chen <[email protected]>--- .../devicetree/bindings/leds/leds-mt6360.yaml | 164 +++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-mt6360.yamlMy bot found errors running 'make
dt_binding_check' on your patch:
Quoted 10 lines
yamllint warnings/errors:
./Documentation/devicetree/bindings/leds/leds-mt6360.yaml:57:2: [warning] wrong indentation: expected 2 but found 1 (indentation)dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/leds/leds-mt6360.example.dt.yaml: led-controller: led@3:color:0:0: 10 is greater than the maximum of 9
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/leds/leds-mt6360.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/leds/leds-mt6360.example.dt.yaml: led-controller: led@3:color:0:0: 10 is greater than the maximum of 9
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/leds/leds-mt6360.yaml
ACK, I will add description to this patch by
“this patch depends on patch [PATCH v7 3/5] dt-bindings: leds: common:
Increase LED_COLOR_ID_* maximum size"
Quoted 13 lines
See https://patchwork.ozlabs.org/patch/1402193
The base for the patch is generally the last rc1. Any dependencies should be noted.
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit.
PATCH v7 5/5 leds: mt6360: Add LED driver for MT6360
In reply to Gene ChenFrom: 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 | 808 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 822 insertions(+) create mode 100644 drivers/leds/leds-mt6360.c
drivers/leds/Kconfig +13 -0
@@ -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
@@ -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 +808 -0
808 lines not on this page · raw message
Signature · 1 line
2.7.4
Hi Gene,
Quoted 58 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.
Signed-off-by Gene Chen <[email protected]>--- drivers/leds/Kconfig | 13 + drivers/leds/Makefile | 1 + drivers/leds/leds-mt6360.c | 808 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 822 insertions(+)create mode 100644
drivers/leds/leds-mt6360.cdrivers/leds/Kconfig +13
-0@@ -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_CLASSdrivers/leds/Makefile +1
-0@@ -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.odrivers/leds/leds-mt6360.c new file +2
-0@@ -0,0 +1,808 @@ +// SPDX-License-Identifier: GPL-2.0-only +
[...]
drivers/leds/leds-mt6360.c line 308
Quoted 8 lines
drivers/leds/leds-mt6360.c new file +8
-0+static int mt6360_fault_get (struct led_classdev_flash *fl_cdev,u32 *fault) +{ + struct mt6360_led *led = container_of(fl_cdev, struct mt6360_led, flash); +struct mt6360_priv *priv = led->priv; +u16 fled_stat; +unsigned int chg_stat, strobe_timeout_mask, fled_short_mask; +u32 rfault =0 ; +int ret;
You need mutex here as well because you're making two readouts and you have to assure atomicity of this operation.
Quoted 32 lines
drivers/leds/leds-mt6360.c new file +32
-0+ ret =regmap_read (priv->regmap,MT6360_REG_CHGSTAT2 , &chg_stat); +if (ret) +return ret; + + ret =regmap_raw_read (priv->regmap,MT6360_REG_FLEDSTAT1 , &fled_stat,sizeof (fled_stat)); +if (ret) +return ret; + +if (led->led_no ==MT6360_LED_FLASH1 ) { + strobe_timeout_mask =MT6360_FLED1STRBTO_MASK ; + fled_short_mask =MT6360_FLED1SHORT_MASK ; + }else { + strobe_timeout_mask =MT6360_FLED2STRBTO_MASK ; + fled_short_mask =MT6360_FLED2SHORT_MASK ; + } + +if (chg_stat &MT6360_FLEDCHGVINOVP_MASK ) + rfault |=LED_FAULT_INPUT_VOLTAGE ; + +if (fled_stat & strobe_timeout_mask) + rfault |=LED_FAULT_TIMEOUT ; + +if (fled_stat & fled_short_mask) + rfault |=LED_FAULT_SHORT_CIRCUIT ; + +if (fled_stat &MT6360_FLEDLVF_MASK ) + rfault |=LED_FAULT_UNDER_VOLTAGE ; + + *fault = rfault; +return 0 ; +} +
[...]
Signature · 7 lines
Best regards, Jacek Anaszewski _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek