adp1653: Add device tree bindings for LED controller
RFC 1/1 adp1653: Add device tree bindings for LED controller
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
Thanks,
Pavel
arch/arm/boot/dts/omap3-n900.dts +12 -0
@@ -553,6 +561,18 @@ ti,usb-charger-detection = <&isp1704>; }; + + adp1653: adp1653 at 30 { + compatible = "ad,adp1653"; + reg = <0x30>; + + max-flash-timeout-usec = <500000>; + max-flash-intensity-uA = <320000>; + max-torch-intensity-uA = <50000>; + max-indicator-intensity-uA = <17500>; + + gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; /* Want 88 */ + }; }; &i2c3 {
drivers/media/i2c/adp1653.c +96 -6
156 lines not on this page · raw message
include/media/adp1653.h +5 -3
@@ -100,9 +100,11 @@ struct adp1653_platform_data {int (*power)(struct v4l2_subdev *sd,int on);u32 max_flash_timeout;/* flash light timeout in us */ -u32 max_flash_intensity;/* led intensity, flash mode */ -u32 max_torch_intensity;/* led intensity, torch mode */ -u32 max_indicator_intensity;/* indicator led intensity */ +u32 max_flash_intensity;/* led intensity, flash mode, mA */ +u32 max_torch_intensity;/* led intensity, torch mode, mA */ +u32 max_indicator_intensity;/* indicator led intensity, uA */ + +int power_gpio;/* for device-tree based boot */ };#define to_adp1653_flash (sd) container_of(sd, struct adp1653_flash, subdev)
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
arch/arm/boot/dts/omap3-n900.dts line 566
Quoted 3 lines · Pavel Machek
[...]
arch/arm/boot/dts/omap3-n900.dts +2
-0+ adp1653: adp1653 at 30 { + compatible = "ad,adp1653";
The Analog Devices vendor prefix is adi.
Quoted 6 lines · Lars-Peter Clausen
arch/arm/boot/dts/omap3-n900.dts line 566
Quoted 3 lines · Pavel Machek
[...]
arch/arm/boot/dts/omap3-n900.dts +2
-0+ adp1653: adp1653 at 30 { + compatible = "ad,adp1653";The Analog Devices vendor prefix is adi.
Thanks, will be fixed in next version.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi Pavel,
Am 16.11.2014 um 08:59 schrieb Pavel Machek:
Quoted 2 lines
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
[...]
arch/arm/boot/dts/omap3-n900.dts line 565
Quoted 10 lines
arch/arm/boot/dts/omap3-n900.dts +2
-0@@ -553,6 +561,18 @@ ti,usb-charger-detection = <&isp1704>; }; + + adp1653: adp1653 at 30 {
This should probably be led-controller at 30 (a generic description not specific to the model). The label name is fine.
arch/arm/boot/dts/omap3-n900.dts line 574
Quoted 9 lines
arch/arm/boot/dts/omap3-n900.dts +9
-0+ compatible = "ad,adp1653"; + reg = <0x30>; + + max-flash-timeout-usec = <500000>; + max-flash-intensity-uA = <320000>; + max-torch-intensity-uA = <50000>; + max-indicator-intensity-uA = <17500>; + + gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; /* Want 88 */
At least to me, the meaning of "Want 88" is not clear - drop or clarify?
arch/arm/boot/dts/omap3-n900.dts line 578
Quoted 4 lines
arch/arm/boot/dts/omap3-n900.dts +1
-0+ }; }; &i2c3 {
[snip]
Regards,
Andreas
Signature · 2 lines
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer; HRB 21284 AG N?rnberg
Quoted 12 lines · Andreas F?rber
Hi Pavel,
Am 16.11.2014 um 08:59 schrieb Pavel Machek:
Quoted 2 lines
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
[...]
Quoted 6 lines
arch/arm/boot/dts/omap3-n900.dts +0
-0@@ -553,6 +561,18 @@
Quoted 7 lines
arch/arm/boot/dts/omap3-n900.dts line 565
Quoted 4 lines
arch/arm/boot/dts/omap3-n900.dts +2
-0ti,usb-charger-detection = <&isp1704>; }; + + adp1653: adp1653 at 30 {This should probably be led-controller at 30 (a generic description not specific to the model). The label name is fine.
Thanks.
Quoted 3 lines
arch/arm/boot/dts/omap3-n900.dts line 574
Quoted 1 line
arch/arm/boot/dts/omap3-n900.dts +1
-0+ gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; /* Want 88 */At least to me, the meaning of "Want 88" is not clear - drop or clarify?
I changed it to /* 88 */ to match rest of code.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 12 lines · On Sunday 16 November 2014 08:59:28 Pavel Machek wrote:
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
Signed-off-by Pavel Machek <[email protected]>Thanks,
Pavel
Hello,
I think that this patch is probably not good and specially not for n900. adp1653 should be registered throw omap3 isp camera subsystem which does not have DT support yet.
See n900 legacy board camera code in file board-rx51-camera.c.
Signature · 9 lines
Pali Roh?r pali.rohar at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141117/b5bddfdf/attachment.sig>
Hi!
Quoted 10 lines · Pali Roh?r
Quoted 5 lines · On Sunday 16 November 2014 08:59:28 Pavel Machek wrote:
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
I think that this patch is probably not good and specially not for n900. adp1653 should be registered throw omap3 isp camera subsystem which does not have DT support yet.
Can you explain?
adp1653 is independend device on i2c bus, and we have kernel driver for it (unlike rest of n900 camera system). Just now it is unusable due to lack of DT binding. It has two functions, LED light and a camera flash; yes, the second one should be integrated to the rest of camera system, but that is not yet merged. That should not prevent us from merging DT support for the flash, so that this part can be tested/maintained.
Quoted 1 line
See n900 legacy board camera code in file
board-rx51-camera.c.
I have seen that.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 17 lines · On Monday 17 November 2014 11:05:19 Pavel Machek wrote:
Hi!
Quoted 11 lines · Pali Roh?r
Quoted 6 lines · On Sunday 16 November 2014 08:59:28 Pavel Machek wrote:
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
I think that this patch is probably not good and specially not for n900. adp1653 should be registered throw omap3 isp camera subsystem which does not have DT support yet.
Can you explain?
Quoted 9 lines
adp1653 is independend device on i2c bus, and we have kernel driver for it (unlike rest of n900 camera system). Just now it is unusable due to lack of DT binding. It has two functions, LED light and a camera flash; yes, the second one should be integrated to the rest of camera system, but that is not yet merged. That should not prevent us from merging DT support for the flash, so that this part can be tested/maintained.
Ok. When ISP camera subsystem has DT support somebody will modify n900 DT to add camera flash from adp1653 to ISP... I believe it will not be hard.
Quoted 5 lines
Quoted 2 lines
See n900 legacy board camera code in file
board-rx51-camera.c.I have seen that.
Pavel
Signature · 9 lines
Pali Roh?r pali.rohar at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141117/44f5239d/attachment.sig>
Quoted 28 lines · Pali Roh?r
Quoted 17 lines · On Monday 17 November 2014 11:05:19 Pavel Machek wrote:
Hi!
Quoted 11 lines · Pali Roh?r
Quoted 6 lines · On Sunday 16 November 2014 08:59:28 Pavel Machek wrote:
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
I think that this patch is probably not good and specially not for n900. adp1653 should be registered throw omap3 isp camera subsystem which does not have DT support yet.
Can you explain?
Quoted 9 lines
adp1653 is independend device on i2c bus, and we have kernel driver for it (unlike rest of n900 camera system). Just now it is unusable due to lack of DT binding. It has two functions, LED light and a camera flash; yes, the second one should be integrated to the rest of camera system, but that is not yet merged. That should not prevent us from merging DT support for the flash, so that this part can be tested/maintained.
Quoted 3 lines
Ok. When ISP camera subsystem has DT support somebody will modify n900 DT to add camera flash from adp1653 to ISP... I believe it will not be hard.
Exactly. And yes, I'd like to get complete camera support for n900 merged. But first step is "make sure existing support does not break".
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 29 lines · Pavel Machek
Quoted 28 lines · Pali Roh?r
Quoted 26 lines · On Monday 17 November 2014 11:05:19 Pavel Machek wrote:
Hi!
Quoted 11 lines · Pali Roh?r
Quoted 6 lines · On Sunday 16 November 2014 08:59:28 Pavel Machek wrote:
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
I think that this patch is probably not good and specially not for n900. adp1653 should be registered throw omap3 isp camera subsystem which does not have DT support yet.
Can you explain?
adp1653 is independend device on i2c bus, and we have kernel driver for it (unlike rest of n900 camera system). Just now it is unusable due to lack of DT binding. It has two functions, LED light and a camera flash; yes, the second one should be integrated to the rest of camera system, but that is not yet merged. That should not prevent us from merging DT support for the flash, so that this part can be tested/maintained.
Quoted 6 lines
Quoted 3 lines
Ok. When ISP camera subsystem has DT support somebody will modify n900 DT to add camera flash from adp1653 to ISP... I believe it will not be hard.
Exactly. And yes, I'd like to get complete camera support for n900 merged. But first step is "make sure existing support does not break".
There's nothing stopping us from initializing the camera code from pdata-quirks.c for now to keep it working. Certainly the binding should be added to the driver, but that removes a dependency to the legacy booting mode if things are otherwise working.
Regards,
Tony
Quoted 44 lines · On Monday 17 November 2014 15:55:46 Tony Lindgren wrote:
Quoted 29 lines · Pavel Machek
Quoted 28 lines · Pali Roh?r
Quoted 26 lines · On Monday 17 November 2014 11:05:19 Pavel Machek wrote:
Hi!
Quoted 5 lines · Pali Roh?r
Quoted 4 lines · On Sunday 16 November 2014 08:59:28 Pavel Machek wrote:
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
Quoted 7 lines
Quoted 2 lines
I'll clean up driver code a bit more, remove the
printks. Anything else obviously wrong?I think that this patch is probably not good and specially not for n900. adp1653 should be registered throw omap3 isp camera subsystem which does not have DT support yet.
Can you explain?
adp1653 is independend device on i2c bus, and we have kernel driver for it (unlike rest of n900 camera system). Just now it is unusable due to lack of DT binding. It has two functions, LED light and a camera flash; yes, the second one should be integrated to the rest of camera system, but that is not yet merged. That should not prevent us from merging DT support for the flash, so that this part can be tested/maintained.
Quoted 7 lines
Quoted 3 lines
Ok. When ISP camera subsystem has DT support somebody will modify n900 DT to add camera flash from adp1653 to ISP... I believe it will not be hard.
Exactly. And yes, I'd like to get complete camera support for n900 merged. But first step is "make sure existing support does not break".
There's nothing stopping us from initializing the camera code from
pdata-quirks.cfor now to keep it working. Certainly the binding should be added to the driver, but that removes a dependency to the legacy booting mode if things are otherwise working.
Quoted 3 lines
Regards,
Tony
Tony, legacy board code for n900 is not in mainline tree. And that omap3 camera subsystem for n900 is broken since 3.5 kernel... (both Front and Back camera on n900 show only green picture).
Signature · 9 lines
Pali Roh?r pali.rohar at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141117/f4aa7e86/attachment-0001.sig>
Sakari Ailus
maintainerHi Pali,
Quoted 45 lines · Pali Roh?r
Quoted 44 lines · On Monday 17 November 2014 15:55:46 Tony Lindgren wrote:
Quoted 29 lines · Pavel Machek
Quoted 28 lines · Pali Roh?r
Quoted 26 lines · On Monday 17 November 2014 11:05:19 Pavel Machek wrote:
Hi!
Quoted 5 lines · Pali Roh?r
Quoted 4 lines · On Sunday 16 November 2014 08:59:28 Pavel Machek wrote:
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
Quoted 7 lines
Quoted 2 lines
I'll clean up driver code a bit more, remove the
printks. Anything else obviously wrong?I think that this patch is probably not good and specially not for n900. adp1653 should be registered throw omap3 isp camera subsystem which does not have DT support yet.
Can you explain?
adp1653 is independend device on i2c bus, and we have kernel driver for it (unlike rest of n900 camera system). Just now it is unusable due to lack of DT binding. It has two functions, LED light and a camera flash; yes, the second one should be integrated to the rest of camera system, but that is not yet merged. That should not prevent us from merging DT support for the flash, so that this part can be tested/maintained.
Quoted 7 lines
Quoted 3 lines
Ok. When ISP camera subsystem has DT support somebody will modify n900 DT to add camera flash from adp1653 to ISP... I believe it will not be hard.
Exactly. And yes, I'd like to get complete camera support for n900 merged. But first step is "make sure existing support does not break".
There's nothing stopping us from initializing the camera code from
pdata-quirks.cfor now to keep it working. Certainly the binding should be added to the driver, but that removes a dependency to the legacy booting mode if things are otherwise working.
Quoted 8 lines
Quoted 3 lines
Regards,
Tony
Tony, legacy board code for n900 is not in mainline tree. And that omap3 camera subsystem for n900 is broken since 3.5 kernel... (both Front and Back camera on n900 show only green picture).
Can you capture raw bayer images correctly? I assume green means YUV buffers that are all zero.
Do you know more specifically which patch breaks it?
Signature · 4 lines
Regards, Sakari Ailus e-mail: sakari.ailus at iki.fi XMPP: sailus at retiisi.org.uk
Quoted 11 lines · On Monday 17 November 2014 16:04:07 Sakari Ailus wrote:
Hi Pali,
Quoted 8 lines · Pali Roh?r
Quoted 7 lines · On Monday 17 November 2014 15:55:46 Tony Lindgren wrote:
Quoted 6 lines · Pavel Machek
Quoted 5 lines · Pali Roh?r
Quoted 4 lines · On Monday 17 November 2014 11:05:19 Pavel Machek wrote:
Hi!
Quoted 1 line · Pali Roh?r
On Sunday 16 November 2014 08:59:28 Pavel Machek
Quoted 47 lines · wrote:
Quoted 38 lines
Quoted 38 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 11 lines
Quoted 6 lines
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
I think that this patch is probably not good and specially not for n900. adp1653 should be registered throw omap3 isp camera subsystem which does not have DT support yet.
Can you explain?
adp1653 is independend device on i2c bus, and we have kernel driver for it (unlike rest of n900 camera system). Just now it is unusable due to lack of DT binding. It has two functions, LED light and a camera flash; yes, the second one should be integrated to the rest of camera system, but that is not yet merged. That should not prevent us from merging DT support for the flash, so that this part can be tested/maintained.
Quoted 7 lines
Quoted 3 lines
Ok. When ISP camera subsystem has DT support somebody will modify n900 DT to add camera flash from adp1653 to ISP... I believe it will not be hard.
Exactly. And yes, I'd like to get complete camera support for n900 merged. But first step is "make sure existing support does not break".
There's nothing stopping us from initializing the camera code from
pdata-quirks.cfor now to keep it working. Certainly the binding should be added to the driver, but that removes a dependency to the legacy booting mode if things are otherwise working.Quoted 8 lines
Quoted 3 lines
Regards,
Tony
Tony, legacy board code for n900 is not in mainline tree. And that omap3 camera subsystem for n900 is broken since 3.5 kernel... (both Front and Back camera on n900 show only green picture).
Quoted 4 lines
Can you capture raw bayer images correctly? I assume green means YUV buffers that are all zero.
Do you know more specifically which patch breaks it?
CCing freemangordon (Ivaylo Dimitrov). He tried to debug it months ago but without success. Should know more info about this problem.
I think that commit which broke it was not bisected...
Signature · 9 lines
Pali Roh?r pali.rohar at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141117/878e3073/attachment.sig>
Hi,
Quoted 11 lines
Quoted 4 lines
Can you capture raw bayer images correctly? I assume green means YUV buffers that are all zero.
Do you know more specifically which patch breaks it?
CCing freemangordon (Ivaylo Dimitrov). He tried to debug it months ago but without success. Should know more info about this problem.
I think that commit which broke it was not bisected...
According to my vague memories, the green captured image was a result from the ISP IRQ never got triggered. I tried to find why, but never succeeded.
Sakari, we discussed that on #maemo-ssu when I was playing with cameras, and there is nothing new in that regard:
http://mg.pov.lt/maemo-ssu-irclog/%23maemo-ssu.2013-09-18.log.html#t2013-09-18T18:46:38
Quoted 8 lines · Pali Roh?r
Quoted 6 lines · On Monday 17 November 2014 15:55:46 Tony Lindgren wrote:
There's nothing stopping us from initializing the camera code from
pdata-quirks.cfor now to keep it working. Certainly the binding should be added to the driver, but that removes a dependency to the legacy booting mode if things are otherwise working.
Quoted 4 lines
Tony, legacy board code for n900 is not in mainline tree. And that omap3 camera subsystem for n900 is broken since 3.5 kernel... (both Front and Back camera on n900 show only green picture).
I'm still seeing the legacy board code for n900 in mainline tree :) It's deprecated, but still there.
Are you maybe talking about some other piece of platform_data that's no longer in the mainline kernel?
No idea what might be wrong with the camera though.
Regards,
Tony
Quoted 8 lines · On Monday 17 November 2014 16:06:17 Tony Lindgren wrote:
Quoted 7 lines · Pali Roh?r
Quoted 5 lines · On Monday 17 November 2014 15:55:46 Tony Lindgren wrote:
There's nothing stopping us from initializing the camera code from
pdata-quirks.cfor now to keep it working. Certainly the binding should be added to the driver, but that removes a dependency to the legacy booting mode if things are otherwise working.
Quoted 8 lines
Quoted 4 lines
Tony, legacy board code for n900 is not in mainline tree. And that omap3 camera subsystem for n900 is broken since 3.5 kernel... (both Front and Back camera on n900 show only green picture).
I'm still seeing the legacy board code for n900 in mainline tree :) It's deprecated, but still there.
Yes, it is there because conversion from board code to DT is not complete yet... It is slow progress but you can watch it on page
http://elinux.org/N900 (last two columns).
Quoted 3 lines
Are you maybe talking about some other piece of
platform_datathat's no longer in the mainline kernel?
Yes, about platform_data which were never in mainline kernel. Just only in other trees. That code is: camera subsystem (with all other devices), cellular modem, bluetooth, radio.
Quoted 5 lines
No idea what might be wrong with the camera though.
Regards,
Tony
Signature · 9 lines
Pali Roh?r pali.rohar at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141117/a510ac35/attachment.sig>
Quoted 14 lines · Tony Lindgren
Quoted 8 lines · Pali Roh?r
Quoted 6 lines · On Monday 17 November 2014 15:55:46 Tony Lindgren wrote:
There's nothing stopping us from initializing the camera code from
pdata-quirks.cfor now to keep it working. Certainly the binding should be added to the driver, but that removes a dependency to the legacy booting mode if things are otherwise working.Quoted 4 lines
Tony, legacy board code for n900 is not in mainline tree. And that omap3 camera subsystem for n900 is broken since 3.5 kernel... (both Front and Back camera on n900 show only green picture).
Quoted 7 lines
I'm still seeing the legacy board code for n900 in mainline tree :) It's deprecated, but still there.
Are you maybe talking about some other piece of
platform_datathat's no longer in the mainline kernel?No idea what might be wrong with the camera though.
Camera support for main and secondary cameras was never mainline, AFAICT.
Merging it will not be easy, as it lacks DT support... and was broken for long time.
Anyway, flash is kind of important for me, since it makes phone useful as backup light; and it is simple piece of hw, so I intend to keep it useful.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Sakari Ailus
maintainerHi Pavel,
Quoted 21 lines · Pavel Machek
Quoted 20 lines · Tony Lindgren
Quoted 8 lines · Pali Roh?r
Quoted 6 lines · On Monday 17 November 2014 15:55:46 Tony Lindgren wrote:
There's nothing stopping us from initializing the camera code from
pdata-quirks.cfor now to keep it working. Certainly the binding should be added to the driver, but that removes a dependency to the legacy booting mode if things are otherwise working.Quoted 4 lines
Tony, legacy board code for n900 is not in mainline tree. And that omap3 camera subsystem for n900 is broken since 3.5 kernel... (both Front and Back camera on n900 show only green picture).
I'm still seeing the legacy board code for n900 in mainline tree :) It's deprecated, but still there.
Are you maybe talking about some other piece of
platform_datathat's no longer in the mainline kernel?
Quoted 6 lines
Quoted 1 line
No idea what might be wrong with the camera though.
Camera support for main and secondary cameras was never mainline, AFAICT.
Merging it will not be easy, as it lacks DT support... and was broken for long time.
I have a smiapp patchset for DT support that I posted a while ago, here:
<URL:http://www.spinics.net/lists/linux-media/msg83285.html>
What's missing on top of that is the omap3isp support, plus something to toggle the sysctl registers based on the chosen receiver. I have a preliminary, not RFC yet but functional set here:
The main camera support requires et8ek8 driver as well, and resolving the breakage with the image capture on 3430.
N9/N950 will be first, though. Lens controllers are another matter, but nothing too difficult on that side either.
Quoted 3 lines
Anyway, flash is kind of important for me, since it makes phone useful as backup light; and it is simple piece of hw, so I intend to keep it useful.
Me, too. :-)
Signature · 4 lines
Kind regards, Sakari Ailus sakari.ailus at iki.fi
Sakari Ailus
maintainerHi Pavel,
Quoted 5 lines · Pavel Machek
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
Jacek Anaszewski is working on flash support for LED devices. I think it'd be good to sync the DT bindings for the two, as the types of devices supported by the LED API and the V4L2 flash API are quite similar.
Cc Jacek.
Quoted 218 lines
Signed-off-by Pavel Machek <[email protected]>Thanks,
Pavelarch/arm/boot/dts/omap3-n900.dts +12
-0@@ -553,6 +561,18 @@ ti,usb-charger-detection = <&isp1704>; }; + + adp1653: adp1653 at 30 { + compatible = "ad,adp1653"; + reg = <0x30>; + + max-flash-timeout-usec = <500000>; + max-flash-intensity-uA = <320000>; + max-torch-intensity-uA = <50000>; + max-indicator-intensity-uA = <17500>; + + gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; /* Want 88 */ + }; }; &i2c3 {drivers/media/i2c/adp1653.c +96
-6@@ -8,6 +8,7 @@* Contributors: * Sakari Ailus <[email protected]> * Tuukka Toivonen <[email protected]> +* Pavel Machek <[email protected]> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,9 +35,12 @@#include <linux/module.h> #include <linux/i2c.h> #include <linux/slab.h> +#include <linux/of_gpio.h> #include <media/adp1653.h> #include <media/v4l2-device.h> +#include <linux/gpio.h> +#define TIMEOUT_MAX 820000#define TIMEOUT_STEP 54600#define TIMEOUT_MIN (TIMEOUT_MAX - ADP1653_REG_CONFIG_TMR_SET_MAX \@@ -308,7 +316,16 @@ __adp1653_set_power(struct adp1653_flash *flash, int on) {int ret; - ret = flash->platform_data->power (&flash->subdev, on); +if (flash->platform_data->power) + ret = flash->platform_data->power (&flash->subdev, on); +else { +gpio_set_value (flash->platform_data->power_gpio, on); +if (on) { +/* Some delay is apparently required. */ +udelay (20 ); + } + } +if (ret <0 )return ret;@@ -316,8 +333,13 @@ __adp1653_set_power(struct adp1653_flash *flash, int on)return 0 ; ret =adp1653_init_device (flash); -if (ret <0 ) +if (ret >=0 ) +return ret; + +if (flash->platform_data->power) flash->platform_data->power (&flash->subdev,0 ); +else +gpio_set_value (flash->platform_data->power_gpio,0 );return ret; }@@ -407,21 +429,87 @@ static int adp1653_resume(struct device *dev)#endif /* CONFIG_PM */ + + + + + + + + + + + + + +static int adp1653_of_init (struct i2c_client *client,struct adp1653_flash *flash, +struct device_node *node) +{ +u32 val; +struct adp1653_platform_data *pd; +enum of_gpio_flags flags; +int gpio; + +if (!node) +return -EINVAL ; + +printk ("adp1653: no platform data\n" ); + pd =devm_kzalloc (&client->dev,sizeof (*pd),GFP_KERNEL ); +if (!pd) +return -ENOMEM ; + flash->platform_data = pd; + + + + + + + +if (of_property_read_u32 (node,"max-flash-timeout-usec" , &val))return -EINVAL ; + pd->max_flash_timeout = val; +if (of_property_read_u32 (node,"max-flash-intensity-uA" , &val))return -EINVAL ; + pd->max_flash_intensity = val/1000 ; +if (of_property_read_u32 (node,"max-torch-intensity-uA" , &val))return -EINVAL ; + pd->max_torch_intensity = val/1000 ; +if (of_property_read_u32 (node,"max-indicator-intensity-uA" , &val))return -EINVAL ; + pd->max_indicator_intensity = val; + +if (!of_find_property (node,"gpios" ,NULL )) { +printk ("No gpio node\n" ); +return -EINVAL ; + } + + gpio =of_get_gpio_flags (node,0 , &flags); +if (gpio <0 ) { +printk ("Error getting GPIO\n" ); +return -EINVAL ; + } + + pd->power_gpio = gpio; + +return 0 ; +} + +static int adp1653_probe (struct i2c_client *client,const struct i2c_device_id *devid) {struct adp1653_flash *flash;int ret; -/* we couldn't work without platform data */ -if (client->dev.platform_data ==NULL ) -return -ENODEV ; +printk ("adp1653: probe\n" ); flash =devm_kzalloc (&client->dev,sizeof (*flash),GFP_KERNEL );if (flash ==NULL )return -ENOMEM ; - flash->platform_data = client->dev.platform_data; +/* we couldn't work without platform data */ +if (client->dev.platform_data ==NULL ) { + ret =adp1653_of_init (client, flash, client->dev.of_node); +if (ret) +return ret; + }else + flash->platform_data = client->dev.platform_data;mutex_init (&flash->power_lock);@@ -439,9 +527,15 @@ static int adp1653_probe(struct i2c_client *client, flash->subdev.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; +__adp1653_set_power (flash,1 ); + +__adp1653_set_power (flash,0 ); +printk ("Flash should have blinked\n" ); +return 0 ; free_and_quit: +printk ("adp1653: something failed registering\n" );v4l2_ctrl_handler_free (&flash->ctrls);return ret; }include/media/adp1653.h +5
-3@@ -100,9 +100,11 @@ struct adp1653_platform_data {int (*power)(struct v4l2_subdev *sd,int on);u32 max_flash_timeout;/* flash light timeout in us */ -u32 max_flash_intensity;/* led intensity, flash mode */ -u32 max_torch_intensity;/* led intensity, torch mode */ -u32 max_indicator_intensity;/* indicator led intensity */ +u32 max_flash_intensity;/* led intensity, flash mode, mA */ +u32 max_torch_intensity;/* led intensity, torch mode, mA */ +u32 max_indicator_intensity;/* indicator led intensity, uA */ + +int power_gpio;/* for device-tree based boot */ };#define to_adp1653_flash (sd) container_of(sd, struct adp1653_flash, subdev)Signature · 3 lines
-- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: sakari.ailus at iki.fi XMPP: sailus at retiisi.org.uk
Hi Pavel, Sakari,
Quoted 6 lines · Sakari Ailus
Hi Pavel,
Quoted 3 lines · Pavel Machek
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
Quoted 8 lines
Quoted 2 lines
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
Jacek Anaszewski is working on flash support for LED devices. I think it'd be good to sync the DT bindings for the two, as the types of devices supported by the LED API and the V4L2 flash API are quite similar.
Cc Jacek.
I've already submitted a patch [1] that updates leds common bindings. I hasn't been merged yet, as the related LED Flash class patch [2] still needs some indicator leds related discussion [3].
I think this is a good moment to discuss the flash related led common bindings.
[1] http://www.spinics.net/lists/linux-leds/msg02121.html
[2] http://www.spinics.net/lists/linux-media/msg83100.html
[3] http://www.spinics.net/lists/linux-leds/msg02472.html
Best Regards,
Jacek Anaszewski
Quoted 16 lines · Jacek Anaszewski
Hi Pavel, Sakari,
Quoted 13 lines · Sakari Ailus
Hi Pavel,
Quoted 5 lines · Pavel Machek
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
Jacek Anaszewski is working on flash support for LED devices. I think it'd be good to sync the DT bindings for the two, as the types of devices supported by the LED API and the V4L2 flash API are quite similar.
Quoted 8 lines
Quoted 1 line
Cc Jacek.
I've already submitted a patch [1] that updates leds common bindings. I hasn't been merged yet, as the related LED Flash class patch [2] still needs some indicator leds related discussion [3].
I think this is a good moment to discuss the flash related led common bindings.
Part of problem is that adp1653 is not regarded as "LED" device by current kernel driver.
Quoted 1 line
@@ -3,6 +3,17 @@ Common leds properties.
Optional properties for child nodes:
- label : The label for this LED. If omitted, the label is taken from the node name (excluding the unit address).
+- iout-torch : Array of maximum intensities in microamperes of the
torch
+ led currents in order from sub-led 0 to N-1, where N is the
number
+ of torch sub-leds exposed by the device
+- iout-flash : Array of maximum intensities in microamperes of the
flash
+ led currents in order from sub-led 0 to N-1, where N is the
number
+ of flash sub-leds exposed by the device
+- iout-indicator : Array of maximum intensities in microamperes of + the indicator led currents in order from sub-led 0 to N-1, + where N is the number of indicator sub-leds exposed by the device +- flash-timeout : timeout in microseconds after which flash led + is turned off
- linux,default-trigger : This parameter, if present, is a string defining the trigger assigned to the LED. Current triggers are:
@@ -19,5 +30,10 @@ Examples:
system-status {
label = "Status"; linux,default-trigger = "heartbeat";
+ iout-torch = <500 500>; + iout-flash = <1000 1000>; + iout-indicator = <100 100>; + flash-timeout = <1000>; + ...
};
I don't get it; system-status describes single LED, why are iout-torch (and friends) arrays of two?
Also, at least on adp1653, these are actually two leds -- white and red. Torch and flash is white led, indicator is red led.
Quoted 2 lines
[2] http://www.spinics.net/lists/linux-media/msg83100.html
[3] http://www.spinics.net/lists/linux-leds/msg02472.html
What device are you using for testing? Can you cc me on future patches?
Why do we need complex "flash LED class" support, and where is the V4L2 glue?
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 23 lines · Pavel Machek
Quoted 22 lines · Jacek Anaszewski
Hi Pavel, Sakari,
Quoted 6 lines · Sakari Ailus
Hi Pavel,
Quoted 3 lines · Pavel Machek
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
Quoted 8 lines
Quoted 2 lines
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
Jacek Anaszewski is working on flash support for LED devices. I think it'd be good to sync the DT bindings for the two, as the types of devices supported by the LED API and the V4L2 flash API are quite similar.
Cc Jacek.
I've already submitted a patch [1] that updates leds common bindings. I hasn't been merged yet, as the related LED Flash class patch [2] still needs some indicator leds related discussion [3].
Quoted 5 lines
Quoted 2 lines
I think this is a good moment to discuss the flash related led common bindings.
Part of problem is that adp1653 is not regarded as "LED" device by current kernel driver.
It doesn't prevent us from keeping the flash devices related DT bindings unified across kernel subsystems. The DT bindings docs for the adp1653 could just provide a reference to the led/common.txt bindings. In the future, when LED Flash class will be merged, all the V4L2 Flash drivers might be moved to the LED subsystem to gain the LED subsystem support.
Quoted 37 lines
Quoted 1 line
(quoted diff) +16
-0@@ -3,6 +3,17 @@ Common leds properties. Optional properties for child nodes: - label : The label for this LED. If omitted, the label is taken from the node name (excluding the unit address). +- iout-torch : Array of maximum intensities in microamperes of the torch + led currents in order from sub-led 0 to N-1, where N is the number + of torch sub-leds exposed by the device +- iout-flash : Array of maximum intensities in microamperes of the flash + led currents in order from sub-led 0 to N-1, where N is the number + of flash sub-leds exposed by the device +- iout-indicator : Array of maximum intensities in microamperes of + the indicator led currents in order from sub-led 0 to N-1, + where N is the number of indicator sub-leds exposed by the device +- flash-timeout : timeout in microseconds after which flash led + is turned off - linux,default-trigger : This parameter, if present, is a string defining the trigger assigned to the LED. Current triggers are:@@ -19,5 +30,10 @@ Examples: system-status { label = "Status"; linux,default-trigger = "heartbeat"; + iout-torch = <500 500>; + iout-flash = <1000 1000>; + iout-indicator = <100 100>; + flash-timeout = <1000>; + };
Quoted 2 lines
I don't get it; system-status describes single LED, why are iout-torch (and friends) arrays of two?
Some devices can control more than one led. The array is for such purposes. The system-status should be probably renamed to something more generic for both common leds and flash leds, e.g. system-led.
Quoted 2 lines
Also, at least on adp1653, these are actually two leds -- white and red. Torch and flash is white led, indicator is red led.
Then you should define three properties:
iout-torch = <[uA]>;
iout-flash = <[uA]>;
iout-indicator = <[uA]>;
iout-torch and iout-flash properties would determine the current for the white led in the torch and flash modes respectively and the iout-indicator property would determine the current for the indicator led.
Quoted 5 lines
Quoted 2 lines
[2] http://www.spinics.net/lists/linux-media/msg83100.html
[3] http://www.spinics.net/lists/linux-leds/msg02472.htmlWhat device are you using for testing? Can you cc me on future patches?
I am using max77693 [1] and aat1290 [2]. OK, I will add you on cc.
Quoted 2 lines
Why do we need complex "flash LED class" support, and where is the V4L2 glue?
The rationale for unification of the LED and V4L2 Flash API can be found in the discussion [3]. The glue is the v4l2-flash [4] module which exposes a sub-device, that controls a LED Flash class device with use of LED Flash class API.
The v4l2-flash sub-device registers with v4l2-async API in a media device. Exemplary support for v4l2-flash sub-devices is added to the exynos4-is driver in the patch [5].
Best Regards,
Jacek Anaszewski
[1] http://www.spinics.net/lists/linux-leds/msg02326.html
[2] http://www.spinics.net/lists/linux-media/msg81079.html
[3] http://www.spinics.net/lists/linux-media/msg69012.html
[4] http://www.spinics.net/lists/linux-leds/msg02322.html
[5] http://www.spinics.net/lists/linux-leds/msg02323.html
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
I've already submitted a patch [1] that updates leds common bindings. I hasn't been merged yet, as the related LED Flash class patch [2] still needs some indicator leds related discussion [3].
I think this is a good moment to discuss the flash related led common bindings.
Part of problem is that adp1653 is not regarded as "LED" device by current kernel driver.
Quoted 6 lines
It doesn't prevent us from keeping the flash devices related DT bindings unified across kernel subsystems. The DT bindings docs for the adp1653 could just provide a reference to the
led/common.txtbindings. In the future, when LED Flash class will be merged, all the V4L2 Flash drivers might be moved to the LED subsystem to gain the LED subsystem support.
Yeah, that makses sense.
Quoted 12 lines
Quoted 12 lines
(quoted diff) +5
-0@@ -19,5 +30,10 @@ Examples: system-status { label = "Status"; linux,default-trigger = "heartbeat"; + iout-torch = <500 500>; + iout-flash = <1000 1000>; + iout-indicator = <100 100>; + flash-timeout = <1000>; + };
Quoted 7 lines
Quoted 2 lines
I don't get it; system-status describes single LED, why are iout-torch (and friends) arrays of two?
Some devices can control more than one led. The array is for such purposes. The system-status should be probably renamed to something more generic for both common leds and flash leds, e.g. system-led.
No, sorry. The Documentation/devicetree/bindings/leds/common.txt describes binding for _one LED_. Yes, your device can have two leds, so your devices should have two such blocks in the device tree... Each led should have its own label and default trigger, for example. And I guess flash-timeout be per-LED, too.
Would it make sense to include "-uA" and "-usec" suffixes in the dt property names?
Quoted 5 lines
Quoted 2 lines
Also, at least on adp1653, these are actually two leds -- white and red. Torch and flash is white led, indicator is red led.
Then you should define three properties:
Quoted 8 lines
iout-torch = <[uA]>;
iout-flash = <[uA]>;
iout-indicator = <[uA]>;iout-torch and iout-flash properties would determine the current for the white led in the torch and flash modes respectively and the iout-indicator property would determine the current for the indicator led.
Yes, that would work. I have used
+ max-flash-timeout-usec = <500000>; + max-flash-intensity-uA = <320000>; + max-torch-intensity-uA = <50000>; + max-indicator-intensity-uA = <17500>;
. Which is pretty similar. (Actually, maybe the longer property names are easier to understand for more people?) (And yes, I should probably separate red and white led into separate groups).
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
[2] http://www.spinics.net/lists/linux-media/msg83100.html
[3] http://www.spinics.net/lists/linux-leds/msg02472.htmlWhat device are you using for testing? Can you cc me on future patches?
I am using max77693 [1] and aat1290 [2]. OK, I will add you on cc.
Thanks for cc and thanks for links!
I see max77693 has two different "white" leds, aat1290 has one "white" led, and neither of them has secondary red led for indication?
Quoted 3 lines
The v4l2-flash sub-device registers with v4l2-async API in a media device. Exemplary support for v4l2-flash sub-devices is added to the exynos4-is driver in the patch [5].
Thanks for the links. It seems that aside from moving adp1653 driver to device tree, it should be moved to the LED framework, but that's a topic for another patch.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 40 lines · Pavel Machek
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
I've already submitted a patch [1] that updates leds common bindings. I hasn't been merged yet, as the related LED Flash class patch [2] still needs some indicator leds related discussion [3].
I think this is a good moment to discuss the flash related led common bindings.
Part of problem is that adp1653 is not regarded as "LED" device by current kernel driver.
Quoted 6 lines
It doesn't prevent us from keeping the flash devices related DT bindings unified across kernel subsystems. The DT bindings docs for the adp1653 could just provide a reference to the
led/common.txtbindings. In the future, when LED Flash class will be merged, all the V4L2 Flash drivers might be moved to the LED subsystem to gain the LED subsystem support.Yeah, that makses sense.
Quoted 12 lines
Quoted 12 lines
(quoted diff) +5
-0@@ -19,5 +30,10 @@ Examples: system-status { label = "Status"; linux,default-trigger = "heartbeat"; + iout-torch = <500 500>; + iout-flash = <1000 1000>; + iout-indicator = <100 100>; + flash-timeout = <1000>; + };Quoted 7 lines
Quoted 2 lines
I don't get it; system-status describes single LED, why are iout-torch (and friends) arrays of two?
Some devices can control more than one led. The array is for such purposes. The system-status should be probably renamed to something more generic for both common leds and flash leds, e.g. system-led.
Quoted 5 lines
No, sorry. The
Documentation/devicetree/bindings/leds/common.txtdescribes binding for_oneLED_. Yes, your device can have two leds, so your devices should have two such blocks in the device tree... Each led should have its own label and default trigger, for example. And I guess flash-timeout be per-LED, too.
I think that a device tree binding describes a single physical device. No matter how many sub-leds a device controls, it is still one piece of hardware.
default-trigger property should also be an array of strings. I agree that flash-timeout should be per led - an array, similarly as in case of iout's.
Quoted 2 lines
Would it make sense to include "-uA" and "-usec" suffixes in the dt property names?
I don't see this type of naming anywhere. The documentation should contain the information about units. Nonetheless I am not a device tree specialist, so an opinion of the relevant maintainer will be welcome.
Quoted 21 lines
Quoted 5 lines
Quoted 2 lines
Also, at least on adp1653, these are actually two leds -- white and red. Torch and flash is white led, indicator is red led.
Then you should define three properties:
Quoted 8 lines
iout-torch = <[uA]>;
iout-flash = <[uA]>;
iout-indicator = <[uA]>;iout-torch and iout-flash properties would determine the current for the white led in the torch and flash modes respectively and the iout-indicator property would determine the current for the indicator led.
Yes, that would work. I have used
arch/arm/boot/dts/omap3-n900.dts +4
-0+ max-flash-timeout-usec = <500000>; + max-flash-intensity-uA = <320000>; + max-torch-intensity-uA = <50000>; + max-indicator-intensity-uA = <17500>;
Quoted 3 lines
. Which is pretty similar. (Actually, maybe the longer property names are easier to understand for more people?) (And yes, I should probably separate red and white led into separate groups).
Documentation of a binding should provide sufficient explanation for the people to understand what a property is for. And I would stay by arrays as argued above.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
[2] http://www.spinics.net/lists/linux-media/msg83100.html
[3] http://www.spinics.net/lists/linux-leds/msg02472.htmlWhat device are you using for testing? Can you cc me on future patches?
Quoted 6 lines
Quoted 1 line
I am using max77693 [1] and aat1290 [2]. OK, I will add you on cc.
Thanks for cc and thanks for links!
I see max77693 has two different "white" leds, aat1290 has one "white" led, and neither of them has secondary red led for indication?
You're right.
Quoted 7 lines
Quoted 3 lines
The v4l2-flash sub-device registers with v4l2-async API in a media device. Exemplary support for v4l2-flash sub-devices is added to the exynos4-is driver in the patch [5].
Thanks for the links. It seems that aside from moving adp1653 driver to device tree, it should be moved to the LED framework, but that's a topic for another patch.
Like I mentioned in the previous message the LED Flash class patch isn't in its final shape yet. Nonetheless I think that we should agree on the leds/common.txt documentation improvements and define DT documentation for adp1653 accordingly.
Regards,
Jacek
Hi!
Quoted 26 lines
Quoted 20 lines
Quoted 12 lines
Quoted 12 lines
(quoted diff) +5
-0@@ -19,5 +30,10 @@ Examples: system-status { label = "Status"; linux,default-trigger = "heartbeat"; + iout-torch = <500 500>; + iout-flash = <1000 1000>; + iout-indicator = <100 100>; + flash-timeout = <1000>; + };Quoted 7 lines
Quoted 2 lines
I don't get it; system-status describes single LED, why are iout-torch (and friends) arrays of two?
Some devices can control more than one led. The array is for such purposes. The system-status should be probably renamed to something more generic for both common leds and flash leds, e.g. system-led.
Quoted 5 lines
No, sorry. The
Documentation/devicetree/bindings/leds/common.txtdescribes binding for_oneLED_. Yes, your device can have two leds, so your devices should have two such blocks in the device tree... Each led should have its own label and default trigger, for example. And I guess flash-timeout be per-LED, too.
Quoted 3 lines
I think that a device tree binding describes a single physical device. No matter how many sub-leds a device controls, it is still one piece of hardware.
You got this wrong, sorry.
In my case, there are three physical devices:
adp1653
white LED
red LED
Each LED should have an label, and probably default trigger -- default trigger for red one should be "we are recording video" and for white should be "this is flash for default camera".
If the hardware LED changes with one that needs different current, the block for the adp1653 stays the same, but white LED block should be updated with different value.
Quoted 1 line
default-trigger property should also be an array of strings.
That is not how it currently works.
Quoted 2 lines
I agree that flash-timeout should be per led - an array, similarly as in case of iout's.
Agreed about per-led, disagreed about the array. As all the fields would need arrays, and as LED system currently does not use arrays for label and linux,default-trigger, I believe we should follow existing design and model it as three devices. (It _is_ physically three devices.)
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
The v4l2-flash sub-device registers with v4l2-async API in a media device. Exemplary support for v4l2-flash sub-devices is added to the exynos4-is driver in the patch [5].
Quoted 8 lines
Quoted 3 lines
Thanks for the links. It seems that aside from moving adp1653 driver to device tree, it should be moved to the LED framework, but that's a topic for another patch.
Like I mentioned in the previous message the LED Flash class patch isn't in its final shape yet. Nonetheless I think that we should agree on the
leds/common.txtdocumentation improvements and define DT documentation for adp1653 accordingly.
Agreed.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi Pavel,
Quoted 32 lines · Pavel Machek
Hi!
Quoted 26 lines
Quoted 20 lines
Quoted 12 lines
Quoted 12 lines
(quoted diff) +5
-0@@ -19,5 +30,10 @@ Examples: system-status { label = "Status"; linux,default-trigger = "heartbeat"; + iout-torch = <500 500>; + iout-flash = <1000 1000>; + iout-indicator = <100 100>; + flash-timeout = <1000>; + };Quoted 7 lines
Quoted 2 lines
I don't get it; system-status describes single LED, why are iout-torch (and friends) arrays of two?
Some devices can control more than one led. The array is for such purposes. The system-status should be probably renamed to something more generic for both common leds and flash leds, e.g. system-led.
Quoted 5 lines
No, sorry. The
Documentation/devicetree/bindings/leds/common.txtdescribes binding for_oneLED_. Yes, your device can have two leds, so your devices should have two such blocks in the device tree... Each led should have its own label and default trigger, for example. And I guess flash-timeout be per-LED, too.Quoted 3 lines
I think that a device tree binding describes a single physical device. No matter how many sub-leds a device controls, it is still one piece of hardware.
Quoted 7 lines
You got this wrong, sorry.
In my case, there are three physical devices:
adp1653
white LED
red LED
You've mentioned that your white led is torch/flash and indicator is the red led. They are probably connected to the HPLED and ILED pins of the ADP1653 device respectively. The device is just a regulator, that delivers electric current to the leds connected to it. Kernel cannot directly activate leds, but has to talk to the device through I2C bus. One I2C device can have only one related device tree binding.
Quoted 3 lines
Each LED should have an label, and probably default trigger -- default trigger for red one should be "we are recording video" and for white should be "this is flash for default camera".
default-trigger is not mandatory, the device doesn't have to have associated led-trigger. I think that you should look at Documentation/leds/leds-class.txt and drivers/leds/triggers for more detailed information. In a nutshell triggers are kernel sources of led events. You can set e.g. "heartbeat", "timer" trigger etc.
As for now the driver belongs to the V4L2 subsystem it doesn't support triggers. Moreover your event "we are recording a video" should be activated by setting V4L2_CID_FLASH_INDICATOR_INTENSITY v4l2 control followed by V4L2_FLASH_LED_MODE_TORCH. Your event "this is flash for default camera" seems to be flash strobe, that can be activated by setting V4L2_CID_FLASH_STROBE control. The driver by default sets the indicator current for both actions to the value previously set with V4L2_CID_FLASH_INDICATOR_INTENSITY.
Quoted 3 lines
If the hardware LED changes with one that needs different current, the block for the adp1653 stays the same, but white LED block should be updated with different value.
I think that you are talking about sub nodes. Indeed I am leaning towards this type of design.
Quoted 3 lines
Quoted 1 line
default-trigger property should also be an array of strings.
That is not how it currently works.
OK, I agree.
Quoted 8 lines
Quoted 3 lines
I agree that flash-timeout should be per led - an array, similarly as in case of iout's.
Agreed about per-led, disagreed about the array. As all the fields would need arrays, and as LED system currently does not use arrays for label and linux,default-trigger, I believe we should follow existing design and model it as three devices. (It _is_ physically three devices.)
Right, I missed that the leds/common.txt describes child node.
I propose following modifications to the binding:
Optional properties for child nodes:
- iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- iout-mode-flash : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
- iout-mode-indicator : initial intensity in microamperes of the indicator LED; it is required to enable support for the indicator led
- max-iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- max-iout-mode-flash : maximum intensity in microamperes of the flash LED
- max-iout-mode-indicator : maximum intensity in microamperes of the indicator LED
- flash-timeout : timeout in microseconds after which flash
led is turned off
system-status {
label = "max77693_1";
iout-mode-led = <500>;
max-iout-mode-led = <500>;
...
};camera-flash1 {
label = "max77693_2";
iout-mode-led = <500>;
iout-mode-flash = <1000>;
iout-mode-indicator = <100>;
max-iout-mode-led = <500>;
max-iout-mode-flash = <1000>;
max-iout-mode-indicator = <100>;
flash-timeout = <1000>;
...
};I propose to avoid name "torch", as for ordinary leds it would be misleading.
Regards,
Jacek
Hi!
Quoted 6 lines
Quoted 3 lines
If the hardware LED changes with one that needs different current, the block for the adp1653 stays the same, but white LED block should be updated with different value.
I think that you are talking about sub nodes. Indeed I am leaning towards this type of design.
I think I am :-).
Quoted 21 lines
Quoted 7 lines
Quoted 2 lines
I agree that flash-timeout should be per led - an array, similarly as in case of iout's.
Agreed about per-led, disagreed about the array. As all the fields would need arrays, and as LED system currently does not use arrays for label and linux,default-trigger, I believe we should follow existing design and model it as three devices. (It _is_ physically three devices.)
Right, I missed that the
leds/common.txtdescribes child node.I propose following modifications to the binding:
Optional properties for child nodes:
- iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- iout-mode-flash : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
- iout-mode-indicator : initial intensity in microamperes of the indicator LED; it is required to enable support for the indicator led
Quoted 8 lines
- max-iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- max-iout-mode-flash : maximum intensity in microamperes of the flash LED
- max-iout-mode-indicator : maximum intensity in microamperes of the indicator LED
- flash-timeout : timeout in microseconds after which flash
led is turned off
Ok, I took a look, and "iout" is notation I understand, but people may have trouble with and I don't see it used anywhere else.
Also... do we need both "current" and "max-current" properties?
But regulators already have "regulator-max-microamp" property. So what about:
max-microamp : maximum intensity in microamperes of the LED
(torch LED for flash devices)
max-flash-microamp : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
flash-timeout-microseconds : timeout in microseconds after which flash
led is turned off
If you had indicator on the same led, I guess
indicator-microamp : recommended intensity in microamperes of the LED
for indication
...would do?
Quoted 2 lines
I propose to avoid name "torch", as for ordinary leds it would be misleading.
Agreed.
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi Pavel, Sakari,
Quoted 57 lines · Pavel Machek
Hi!
Quoted 6 lines
Quoted 3 lines
If the hardware LED changes with one that needs different current, the block for the adp1653 stays the same, but white LED block should be updated with different value.
I think that you are talking about sub nodes. Indeed I am leaning towards this type of design.
I think I am :-).
Quoted 21 lines
Quoted 7 lines
Quoted 2 lines
I agree that flash-timeout should be per led - an array, similarly as in case of iout's.
Agreed about per-led, disagreed about the array. As all the fields would need arrays, and as LED system currently does not use arrays for label and linux,default-trigger, I believe we should follow existing design and model it as three devices. (It _is_ physically three devices.)
Right, I missed that the
leds/common.txtdescribes child node.I propose following modifications to the binding:
Optional properties for child nodes:
- iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- iout-mode-flash : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
- iout-mode-indicator : initial intensity in microamperes of the indicator LED; it is required to enable support for the indicator ledQuoted 8 lines
- max-iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- max-iout-mode-flash : maximum intensity in microamperes of the flash LED
- max-iout-mode-indicator : maximum intensity in microamperes of the indicator LED
- flash-timeout : timeout in microseconds after which flash
led is turned offOk, I took a look, and "iout" is notation I understand, but people may have trouble with and I don't see it used anywhere else.
Also... do we need both "current" and "max-current" properties?
But regulators already have "regulator-max-microamp" property. So what about:
max-microamp : maximum intensity in microamperes of the LED
(torch LED for flash devices)
max-flash-microamp : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
flash-timeout-microseconds : timeout in microseconds after which flash
led is turned off
Quoted 6 lines
If you had indicator on the same led, I guess
indicator-microamp : recommended intensity in microamperes of the LED
for indication...would do?
Ongoing discussion allowed me for taking a look at the indicator issue from different perspective. This is also vital for the issue of whether a v4l2-flash sub-device should be created per device or per sub-led [1].
Currently each sub-led is represented as a separate device tree sub node and the led drivers create separate LED class device for the sub nodes. What this implies is that indicator led also must be represented by the separate LED class device.
This is contrary to the way how V4L2 Flash API approaches this issue, as it considers a flash device as a regulator chip driven through a bus. The API allows to set the led in torch or flash mode and implicitly assumes that there can be additional indicator led supported, which can't be turned on separately, but the drivers apply the indicator current to the indicator led when the torch or flash led is activated.
I propose to create separate v4l2-flash device for the indicator led, and treat it as a regular sub-led similarly like it is done in the LED subsystem. LED Flash class driver would only add a flag LED_DEV_CAP_INDICATOR and basing on it the v4l2-flash sub-device would create only V4L2_CID_FLASH_INDICATOR_INTENSITY control for it. There could ba also additional control added:V4L2_CID_FLASH_INDICATOR_PATTERN to support the feature supported by some LED class drivers.
From the media device perspective such an approach would
be harmful, as the indicator led could be turned on right before strobing the flash or turning the torch on, by separate calls to different v4l2-flash sub-devices.
The design described above would allow for avoiding issues I touched in the message [1].
Regarding DT documentation:
I would also swap the segments of a property name to follow the convention as in case of "regulator-max-microamp".
Updated version:
==========================================================
Optional properties for child nodes:
- max-microamp : maximum intensity in microamperes of the LED (torch LED for flash devices)
- flash-max-microamp : maximum intensity in microamperes of the flash LED; it is mandatory if the led should support the flash mode
- flash-timeout-microsec : timeout in microseconds after which the flash led is turned off
- indicator-pattern : identifier of the blinking pattern for the indicator led
==========================================================
Regards,
Jacek
[1]
http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/84643
Sakari Ailus
maintainerHi Jacek and Pavel,
Quoted 65 lines · Jacek Anaszewski
Hi Pavel, Sakari,
Quoted 62 lines · Pavel Machek
Hi!
Quoted 6 lines
Quoted 3 lines
If the hardware LED changes with one that needs different current, the block for the adp1653 stays the same, but white LED block should be updated with different value.
I think that you are talking about sub nodes. Indeed I am leaning towards this type of design.
I think I am :-).
Quoted 22 lines
Quoted 8 lines
Quoted 2 lines
I agree that flash-timeout should be per led - an array, similarly as in case of iout's.
Agreed about per-led, disagreed about the array. As all the fields would need arrays, and as LED system currently does not use arrays for label and linux,default-trigger, I believe we should follow existing design and model it as three devices. (It _is_ physically three devices.)
Right, I missed that the
leds/common.txtdescribes child node.I propose following modifications to the binding:
Optional properties for child nodes:
- iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- iout-mode-flash : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
- iout-mode-indicator : initial intensity in microamperes of the indicator LED; it is required to enable support for the indicator ledQuoted 8 lines
- max-iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- max-iout-mode-flash : maximum intensity in microamperes of the flash LED
- max-iout-mode-indicator : maximum intensity in microamperes of the indicator LED
- flash-timeout : timeout in microseconds after which flash
led is turned offOk, I took a look, and "iout" is notation I understand, but people may have trouble with and I don't see it used anywhere else.
Also... do we need both "current" and "max-current" properties?
But regulators already have "regulator-max-microamp" property. So what about:
max-microamp : maximum intensity in microamperes of the LED
(torch LED for flash devices)
max-flash-microamp : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
flash-timeout-microseconds : timeout in microseconds after which flash
led is turned offIf you had indicator on the same led, I guess
indicator-microamp : recommended intensity in microamperes of the LED
for indication
The value for the indicator is maximum as well, not just a recommendation.
Quoted 14 lines
Quoted 2 lines
...would do?
Ongoing discussion allowed me for taking a look at the indicator issue from different perspective. This is also vital for the issue of whether a v4l2-flash sub-device should be created per device or per sub-led [1].
Currently each sub-led is represented as a separate device tree sub node and the led drivers create separate LED class device for the sub nodes. What this implies is that indicator led also must be represented by the separate LED class device.
Quoted 7 lines
This is contrary to the way how V4L2 Flash API approaches this issue, as it considers a flash device as a regulator chip driven through a bus. The API allows to set the led in torch or flash mode and implicitly assumes that there can be additional indicator led supported, which can't be turned on separately, but the drivers apply the indicator current to the indicator led when the torch or flash led is activated.
The indicator is independent of the flash LED in V4L2 flash API. At least that's how it should be, and in adp1653 the two are independent, but the as3645a can't use indicator with the flash AFAIR.
Quoted 8 lines
I propose to create separate v4l2-flash device for the indicator led, and treat it as a regular sub-led similarly like it is done in the LED subsystem. LED Flash class driver would only add a flag
LED_DEV_CAP_INDICATORand basing on it the v4l2-flash sub-device would create onlyV4L2_CID_FLASH_INDICATOR_INTENSITYcontrol for it. There could ba also additional control added:V4L2_CID_FLASH_INDICATOR_PATTERNto support the feature supported by some LED class drivers.
Interesting idea.
The flash controller is still a single I2C device with common set of faults, for instance. Some devices refuse to work again in case of faults until they are cleared (= read).
Could the indicator pattern control be present in the same sub-device?
Are there any flash LED controllers that support such functionality?
Quoted 7 lines
From the media device perspective such an approach would be harmful, as the indicator led could be turned on right before strobing the flash or turning the torch on, by separate calls to different v4l2-flash sub-devices.
The design described above would allow for avoiding issues I touched in the message [1].
Let me reply this separately. Feel free to ping me if I obviously appear to miss something.
Signature · 4 lines
Kind regards, Sakari Ailus sakari.ailus at iki.fi
Hi Pavel, Sakari,
Quoted 93 lines · Sakari Ailus
Hi Jacek and Pavel,
Quoted 65 lines · Jacek Anaszewski
Hi Pavel, Sakari,
Quoted 62 lines · Pavel Machek
Hi!
Quoted 6 lines
Quoted 3 lines
If the hardware LED changes with one that needs different current, the block for the adp1653 stays the same, but white LED block should be updated with different value.
I think that you are talking about sub nodes. Indeed I am leaning towards this type of design.
I think I am :-).
Quoted 22 lines
Quoted 8 lines
Quoted 2 lines
I agree that flash-timeout should be per led - an array, similarly as in case of iout's.
Agreed about per-led, disagreed about the array. As all the fields would need arrays, and as LED system currently does not use arrays for label and linux,default-trigger, I believe we should follow existing design and model it as three devices. (It _is_ physically three devices.)
Right, I missed that the
leds/common.txtdescribes child node.I propose following modifications to the binding:
Optional properties for child nodes:
- iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- iout-mode-flash : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
- iout-mode-indicator : initial intensity in microamperes of the indicator LED; it is required to enable support for the indicator ledQuoted 8 lines
- max-iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- max-iout-mode-flash : maximum intensity in microamperes of the flash LED
- max-iout-mode-indicator : maximum intensity in microamperes of the indicator LED
- flash-timeout : timeout in microseconds after which flash
led is turned offOk, I took a look, and "iout" is notation I understand, but people may have trouble with and I don't see it used anywhere else.
Also... do we need both "current" and "max-current" properties?
But regulators already have "regulator-max-microamp" property. So what about:
max-microamp : maximum intensity in microamperes of the LED
(torch LED for flash devices)
max-flash-microamp : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
flash-timeout-microseconds : timeout in microseconds after which flash
led is turned offIf you had indicator on the same led, I guess
indicator-microamp : recommended intensity in microamperes of the LED
for indicationThe value for the indicator is maximum as well, not just a recommendation.
Quoted 14 lines
Quoted 2 lines
...would do?
Ongoing discussion allowed me for taking a look at the indicator issue from different perspective. This is also vital for the issue of whether a v4l2-flash sub-device should be created per device or per sub-led [1].
Currently each sub-led is represented as a separate device tree sub node and the led drivers create separate LED class device for the sub nodes. What this implies is that indicator led also must be represented by the separate LED class device.
Quoted 7 lines
This is contrary to the way how V4L2 Flash API approaches this issue, as it considers a flash device as a regulator chip driven through a bus. The API allows to set the led in torch or flash mode and implicitly assumes that there can be additional indicator led supported, which can't be turned on separately, but the drivers apply the indicator current to the indicator led when the torch or flash led is activated.
Quoted 3 lines
The indicator is independent of the flash LED in V4L2 flash API. At least that's how it should be, and in adp1653 the two are independent, but the as3645a can't use indicator with the flash AFAIR.
Right.
Quoted 9 lines
Quoted 8 lines
I propose to create separate v4l2-flash device for the indicator led, and treat it as a regular sub-led similarly like it is done in the LED subsystem. LED Flash class driver would only add a flag
LED_DEV_CAP_INDICATORand basing on it the v4l2-flash sub-device would create onlyV4L2_CID_FLASH_INDICATOR_INTENSITYcontrol for it. There could ba also additional control added:V4L2_CID_FLASH_INDICATOR_PATTERNto support the feature supported by some LED class drivers.
Quoted 5 lines
Interesting idea.
The flash controller is still a single I2C device with common set of faults, for instance. Some devices refuse to work again in case of faults until they are cleared (= read).
The V4L2_CID_FLASH_FAULT control should be also supported by the indicator v4l2-flash sub-device then.
Quoted 1 line
Could the indicator pattern control be present in the same sub-device?
Yes, this was my intention. To conclude - the indicator v4l2-flash sub-device should support up to three controls:
- V4L2_CID_FLASH_TORCH_INTENSITY
- V4L2_CID_FLASH_FAULT
- V4L2_CID_FLASH_INDICATOR_PATTERN (if supported by the LED Flash class driver)
V4L2_CID_FLASH_INDICATOR_PATTERN would be a menu control with custom menu items.
Quoted 1 line
Are there any flash LED controllers that support such functionality?
There is: lm3556. LED subsystem leds-lm355x.c driver supports it. The driver exposes dedicated sysfs attribute for setting the blinking pattern (four possible options).
Quoted 11 lines
Quoted 7 lines
From the media device perspective such an approach would
be harmful, as the indicator led could be turned on right before strobing the flash or turning the torch on, by separate calls to different v4l2-flash sub-devices.The design described above would allow for avoiding issues I touched in the message [1].
Let me reply this separately. Feel free to ping me if I obviously appear to miss something.
Best Regards,
Jacek Anaszewski
Hi!
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
But regulators already have "regulator-max-microamp" property. So what about:
max-microamp : maximum intensity in microamperes of the LED
(torch LED for flash devices)
max-flash-microamp : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
flash-timeout-microseconds : timeout in microseconds after which flash
led is turned off
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
If you had indicator on the same led, I guess
indicator-microamp : recommended intensity in microamperes of the LED
for indicationThe value for the indicator is maximum as well, not just a recommendation.
Actually, no.
This is all for one LED, if you want to use it as a flash, torch and indicator. You already know the maximum value with max-microamp.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 7 lines
I would also swap the segments of a property name to follow the convention as in case of "regulator-max-microamp".
Updated version:
==========================================================
Quoted 8 lines
Optional properties for child nodes:
- max-microamp : maximum intensity in microamperes of the LED (torch LED for flash devices)
- flash-max-microamp : maximum intensity in microamperes of the flash LED; it is mandatory if the led should support the flash mode
- flash-timeout-microsec : timeout in microseconds after which the flash led is turned off
Works for me. Do you want to submit a patch or should I do it?
Quoted 3 lines
- indicator-pattern : identifier of the blinking pattern for the indicator led
This would need a bit more documentation, no?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi Pavel,
Quoted 18 lines · Pavel Machek
Hi!
Quoted 7 lines
I would also swap the segments of a property name to follow the convention as in case of "regulator-max-microamp".
Updated version:
==========================================================
Quoted 8 lines
Optional properties for child nodes:
- max-microamp : maximum intensity in microamperes of the LED (torch LED for flash devices)
- flash-max-microamp : maximum intensity in microamperes of the flash LED; it is mandatory if the led should support the flash mode
- flash-timeout-microsec : timeout in microseconds after which the flash led is turned off
Quoted 1 line
Works for me. Do you want to submit a patch or should I do it?
You can submit a patch for leds/common.txt and a separate patch for the adp1653 with a reference to the leds/common.txt for the child nodes.
Quoted 6 lines
Quoted 4 lines
- indicator-pattern : identifier of the blinking pattern for the indicator led
This would need a bit more documentation, no?
- indicator-pattern : identifier of the blinking pattern for the indicator led; valid identifiers should be defined in the documentation of the parent node.
I wouldn't go for pre-defined identifiers as the pattern can be a combination of various settings like ramp-up, ramp-down, pulse time etc. Drivers should expose only few combinations of these settings in my opinion, like e.g. leds-lm355x.c does.
Regards,
Jacek
Quoted 96 lines · Jacek Anaszewski
Hi Pavel, Sakari,
Quoted 58 lines · Pavel Machek
Hi!
Quoted 6 lines
Quoted 3 lines
If the hardware LED changes with one that needs different current, the block for the adp1653 stays the same, but white LED block should be updated with different value.
I think that you are talking about sub nodes. Indeed I am leaning towards this type of design.
I think I am :-).
Quoted 22 lines
Quoted 8 lines
Quoted 2 lines
I agree that flash-timeout should be per led - an array, similarly as in case of iout's.
Agreed about per-led, disagreed about the array. As all the fields would need arrays, and as LED system currently does not use arrays for label and linux,default-trigger, I believe we should follow existing design and model it as three devices. (It _is_ physically three devices.)
Right, I missed that the
leds/common.txtdescribes child node.I propose following modifications to the binding:
Optional properties for child nodes:
- iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- iout-mode-flash : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
- iout-mode-indicator : initial intensity in microamperes of the indicator LED; it is required to enable support for the indicator ledQuoted 8 lines
- max-iout-mode-led : maximum intensity in microamperes of the LED
(torch LED for flash devices)
- max-iout-mode-flash : maximum intensity in microamperes of the flash LED
- max-iout-mode-indicator : maximum intensity in microamperes of the indicator LED
- flash-timeout : timeout in microseconds after which flash
led is turned offOk, I took a look, and "iout" is notation I understand, but people may have trouble with and I don't see it used anywhere else.
Also... do we need both "current" and "max-current" properties?
But regulators already have "regulator-max-microamp" property. So what about:
max-microamp : maximum intensity in microamperes of the LED
(torch LED for flash devices)
max-flash-microamp : initial intensity in microamperes of the
flash LED; it is required to enable support for the flash led
flash-timeout-microseconds : timeout in microseconds after which flash
led is turned offQuoted 6 lines
If you had indicator on the same led, I guess
indicator-microamp : recommended intensity in microamperes of the LED
for indication...would do?
Ongoing discussion allowed me for taking a look at the indicator issue from different perspective. This is also vital for the issue of whether a v4l2-flash sub-device should be created per device or per sub-led [1].
Currently each sub-led is represented as a separate device tree sub node and the led drivers create separate LED class device for the sub nodes. What this implies is that indicator led also must be represented by the separate LED class device.
This is contrary to the way how V4L2 Flash API approaches this issue, as it considers a flash device as a regulator chip driven through a bus. The API allows to set the led in torch or flash mode and implicitly assumes that there can be additional indicator led supported, which can't be turned on separately, but the drivers apply the indicator current to the indicator led when the torch or flash led is activated.
I propose to create separate v4l2-flash device for the indicator led, and treat it as a regular sub-led similarly like it is done in the LED subsystem. LED Flash class driver would only add a flag
LED_DEV_CAP_INDICATORand basing on it the v4l2-flash sub-device would create onlyV4L2_CID_FLASH_INDICATOR_INTENSITYcontrol for it. There could ba also additional control added:V4L2_CID_FLASH_INDICATOR_PATTERNto support the feature supported by some LED class drivers.
Quoted 2 lines
From the media device perspective such an approach would
be harmful, as the indicator led could be turned on right
I intended here "wouldn't be harmful".
Quoted 34 lines
before strobing the flash or turning the torch on, by separate calls to different v4l2-flash sub-devices.
The design described above would allow for avoiding issues I touched in the message [1].
Regarding DT documentation:
I would also swap the segments of a property name to follow the convention as in case of "regulator-max-microamp".
Updated version:
==========================================================
Optional properties for child nodes:
- max-microamp : maximum intensity in microamperes of the LED (torch LED for flash devices)
- flash-max-microamp : maximum intensity in microamperes of the flash LED; it is mandatory if the led should support the flash mode
- flash-timeout-microsec : timeout in microseconds after which the flash led is turned off
- indicator-pattern : identifier of the blinking pattern for the indicator led==========================================================
Regards,
Jacek[1]
http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/84643
Quoted 18 lines · Jacek Anaszewski
Hi Pavel, Sakari,
Quoted 6 lines · Sakari Ailus
Hi Pavel,
Quoted 3 lines · Pavel Machek
For device tree people: Yes, I know I'll have to create file in documentation, but does the binding below look acceptable?
Quoted 8 lines
Quoted 2 lines
I'll clean up driver code a bit more, remove the printks. Anything else obviously wrong?
Jacek Anaszewski is working on flash support for LED devices. I think it'd be good to sync the DT bindings for the two, as the types of devices supported by the LED API and the V4L2 flash API are quite similar.
Cc Jacek.
Quoted 8 lines
I've already submitted a patch [1] that updates leds common bindings. I hasn't been merged yet, as the related LED Flash class patch [2] still needs some indicator leds related discussion [3].
I think this is a good moment to discuss the flash related led common bindings.
Actually, would it be possible to do the patches the other way around?
V4L2 api already knows about flash, torch and indicators. Provide glue, so that V4L2 torch automatically appears as two leds in the led subystem? (white and red in my case?)
[Well, I kind of like the LED class API more, but it appears both you and me really have two LEDs in one package, and V4L2 already knows about that so it is better match....?]
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html