mbox series

[v13,0/5] leds: mt6360: Add LED driver for MT6360

Message ID 1608547554-6602-1-git-send-email-gene.chen.richtek@gmail.com
Headers show
Series leds: mt6360: Add LED driver for MT6360 | expand

Message

Gene Chen Dec. 21, 2020, 10:45 a.m. UTC
In-Reply-To: 

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

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

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

Comments

Matthias Brugger Jan. 12, 2021, 12:37 p.m. UTC | #1
On 21/12/2020 11:45, Gene Chen wrote:
> From: Gene Chen <gene_chen@richtek.com>
[...]
> +
> +static const struct of_device_id __maybe_unused mt6360_led_of_id[] = {
> +	{ .compatible = "mediatek,mt6360-led", },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, mt6360_led_of_id);
> +

I think we should fix MFD code to not need to use a DT binding here. See [1].

Regards,
Matthias

[1] https://lore.kernel.org/linux-mediatek/20210111164118.GE4728@sirena.org.uk/


> +static struct platform_driver mt6360_led_driver = {
> +	.driver = {
> +		.name = "mt6360-led",
> +		.of_match_table = mt6360_led_of_id,
> +	},
> +	.probe = mt6360_led_probe,
> +	.remove = mt6360_led_remove,
> +};
> +module_platform_driver(mt6360_led_driver);
> +
> +MODULE_AUTHOR("Gene Chen <gene_chen@richtek.com>");
> +MODULE_DESCRIPTION("MT6360 LED Driver");
> +MODULE_LICENSE("GPL v2");
>
Pavel Machek Feb. 19, 2021, 10:47 a.m. UTC | #2
Hi!

> From: Gene Chen <gene_chen@richtek.com>
> 
> Add LED_FUNCTION_MOONLIGHT definitions
> 
> Signed-off-by: Gene Chen <gene_chen@richtek.com>
> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> Acked-by: Rob Herring <robh@kernel.org>

No, sorry, I don't believe we need another define for flash/torch.

Best regards,
								Pavel
Pavel Machek Feb. 19, 2021, 10:53 a.m. UTC | #3
Hi!

> From: Gene Chen <gene_chen@richtek.com>

> 

> 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.


What kind of ninja mutant hardware is this?

Can we make this go to  drivers/leds/flash?

> +static int mt6360_flash_brightness_set(struct led_classdev_flash *fl_cdev, u32 brightness)

> +{

> +	/*

> +	 * Due to the current spike when turning on flash, let brightness to be kept by framework.

> +	 * This empty function is used to prevent led_classdev_flash register ops check failure.

> +	 */


Please stick to 80 columns.

> +static int mt6360_init_common_properties(struct mt6360_led *led, struct led_init_data *init_data)

> +{

> +	const char * const states[] = { "off", "keep", "on" };


No need for space between * and const.

Best regards,
									Pavel

-- 
http://www.livejournal.com/~pavelmachek
Gene Chen March 2, 2021, 6:08 a.m. UTC | #4
Pavel Machek <pavel@ucw.cz> 於 2021年2月19日 週五 下午6:47寫道:
>
> Hi!
>
> > From: Gene Chen <gene_chen@richtek.com>
> >
> > Add LED_FUNCTION_MOONLIGHT definitions
> >
> > Signed-off-by: Gene Chen <gene_chen@richtek.com>
> > Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> > Acked-by: Rob Herring <robh@kernel.org>
>
> No, sorry, I don't believe we need another define for flash/torch.
>

As previous discuss,
> 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.

If any concern about this change, maybe we use LED_FUNCTION_INDICATOR instead?
(refs: https://lkml.org/lkml/2020/11/24/1267)


> Best regards,
>                                                                 Pavel
> --
> http://www.livejournal.com/~pavelmachek
Gene Chen March 22, 2021, 10:54 a.m. UTC | #5
Gene Chen <gene.chen.richtek@gmail.com> 於 2021年3月2日 週二 下午2:08寫道:
>

> Pavel Machek <pavel@ucw.cz> 於 2021年2月19日 週五 下午6:47寫道:

> >

> > Hi!

> >

> > > From: Gene Chen <gene_chen@richtek.com>

> > >

> > > Add LED_FUNCTION_MOONLIGHT definitions

> > >

> > > Signed-off-by: Gene Chen <gene_chen@richtek.com>

> > > Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>

> > > Acked-by: Rob Herring <robh@kernel.org>

> >

> > No, sorry, I don't believe we need another define for flash/torch.

> >

>

> As previous discuss,

> > 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.

>

> If any concern about this change, maybe we use LED_FUNCTION_INDICATOR instead?

> (refs: https://lkml.org/lkml/2020/11/24/1267)


Is there any update?

> > Best regards,

> >                                                                 Pavel

> > --

> > http://www.livejournal.com/~pavelmachek