Skip to contentSkip to conversation

AS3645A flash support

PATCH In review Sakari Ailus 5 participants 10 messages Aug 23, 2017 – Sep 7, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover AS3645A flash support

Hi everyone,

This set adds support for the AS3645A flash driver which can be found e.g. in Nokia N9.

The set depeds on the flash patches here so I'd prefer to merge this through mediatree.

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=flash>

since v2:

- Add acks.

- Improve commit message in dt binding patch.

- Align From header and SoB tags.

Since v1:

- Fix flash label use.

- Drop "flash" property from sensors in N9 DTS patch. This will reappear in a sepeate patch after the "flash" binding documentation patch.

- Remove PM support from the driver (the LED framework handles this).

- Enable runtime PM un as3645a driver.

- Add I²C device ID table for module autoloading.

- Add label to the binding examples as well as reference to common.txt.

- Document label as an optional property for both LED sub-nodes.

Since the RFC set:

- Add back the DT binding documentation I lost long ago.

- Use colon (":") in the default names instead of a space.

Sakari Ailus (3):
dt: bindings: Document DT bindings for Analog devices as3645a
leds: as3645a: Add LED flash class driver
arm: dts: omap3: N9/N950: Add AS3645A camera flash

 .../devicetree/bindings/leds/ams,as3645a.txt       |  71 ++
 MAINTAINERS                                        |   6 +
 arch/arm/boot/dts/omap3-n950-n9.dtsi               |  14 +
 drivers/leds/Kconfig                               |   8 +
 drivers/leds/Makefile                              |   1 +
 drivers/leds/leds-as3645a.c                        | 770 +++++++++++++++++++++
 6 files changed, 870 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/ams,as3645a.txt
 create mode 100644 drivers/leds/leds-as3645a.c
Signature · 22 lines
2.11.0


*** BLURB HERE ***

Sakari Ailus (3):
  dt: bindings: Document DT bindings for Analog devices as3645a
  leds: as3645a: Add LED flash class driver
  arm: dts: omap3: N9/N950: Add AS3645A camera flash

 .../devicetree/bindings/leds/ams,as3645a.txt       |  71 ++
 MAINTAINERS                                        |   6 +
 arch/arm/boot/dts/omap3-n950-n9.dtsi               |  14 +
 drivers/leds/Kconfig                               |   8 +
 drivers/leds/Makefile                              |   1 +
 drivers/leds/leds-as3645a.c                        | 763 +++++++++++++++++++++
 6 files changed, 863 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/ams,as3645a.txt
 create mode 100644 drivers/leds/leds-as3645a.c

-- 
2.11.0
#1 lore raw

PATCH v3 1/3 dt: bindings: Document DT bindings for Analog devices as3645a

Document DT bindings for Analog Devices as3645a flash LED controller which also supports an indicator LED.

---
 .../devicetree/bindings/leds/ams,as3645a.txt       | 71 ++++++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/ams,as3645a.txt
Documentation/devicetree/bindings/leds/ams,as3645a.txt new file +71 -0
new file mode 100644
index 000000000000..12c5ef26ec73
@@ -0,0 +1,71 @@
+Analog devices AS3645A device tree bindings
+
+The AS3645A flash LED controller can drive two LEDs, one high current
+flash LED and one indicator LED. The high current flash LED can be
+used in torch mode as well.
+
+Ranges below noted as [a, b] are closed ranges between a and b, i.e. a
+and b are included in the range.
+
+Please also see common.txt in the same directory.
+
+
+Required properties
+===================
+
+compatible	: Must be "ams,as3645a".
+reg		: The I2C address of the device. Typically 0x30.
+
+
+Required properties of the "flash" child node
+=============================================
+
+flash-timeout-us: Flash timeout in microseconds. The value must be in
+		  the range [100000, 850000] and divisible by 50000.
+flash-max-microamp: Maximum flash current in microamperes. Has to be
+		    in the range between [200000, 500000] and
+		    divisible by 20000.
+led-max-microamp: Maximum torch (assist) current in microamperes. The
+		  value must be in the range between [20000, 160000] and
+		  divisible by 20000.
+ams,input-max-microamp: Maximum flash controller input current. The
+			value must be in the range [1250000, 2000000]
+			and divisible by 50000.
+
+
+Optional properties of the "flash" child node
+=============================================
+
+label		: The label of the flash LED.
+
+
+Required properties of the "indicator" child node
+=================================================
+
+led-max-microamp: Maximum indicator current. The allowed values are
+		  2500, 5000, 7500 and 10000.
+
+Optional properties of the "indicator" child node
+=================================================
+
+label		: The label of the indicator LED.
+
+
+Example
+=======
+
+	as3645a@30 {
+		reg = <0x30>;
+		compatible = "ams,as3645a";
+		flash {
+			flash-timeout-us = <150000>;
+			flash-max-microamp = <320000>;
+			led-max-microamp = <60000>;
+			ams,input-max-microamp = <1750000>;
+			label = "as3645a:flash";
+		};
+		indicator {
+			led-max-microamp = <10000>;
+			label = "as3645a:indicator";
+		};
+	};
Signature · 1 line
2.11.0
#3 lore raw

PATCH v3 2/3 leds: as3645a: Add LED flash class driver

In reply to Sakari Ailus

Add a LED flash class driver for the as3654a flash controller. A V4L2 flash driver for it already exists (drivers/media/i2c/as3645a.c), and this driver is based on that.

---
 MAINTAINERS                 |   6 +
 drivers/leds/Kconfig        |   8 +
 drivers/leds/Makefile       |   1 +
 drivers/leds/leds-as3645a.c | 763 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 778 insertions(+)
 create mode 100644 drivers/leds/leds-as3645a.c
MAINTAINERS +6 -0
index 38471657e222..24587bb5f85c 100644
@@ -2124,6 +2124,12 @@ F:	arch/arm64/
 F:	Documentation/arm64/
 
 AS3645A LED FLASH CONTROLLER DRIVER
+M:	Sakari Ailus <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/leds/leds-as3645a.c
+
+AS3645A LED FLASH CONTROLLER DRIVER
 M:	Laurent Pinchart <[email protected]>
 L:	[email protected]
 T:	git git://linuxtv.org/media_tree.git
drivers/leds/Kconfig +8 -0
index 594b24d410c3..bad3a4098104 100644
@@ -58,6 +58,14 @@ config LEDS_AAT1290
 	help
 	 This option enables support for the LEDs on the AAT1290.
 
+config LEDS_AS3645A
+	tristate "AS3645A LED flash controller support"
+	depends on I2C && LEDS_CLASS_FLASH
+	help
+	  Enable LED flash class support for AS3645A LED flash
+	  controller. V4L2 flash API is provided as well if
+	  CONFIG_V4L2_FLASH_API is enabled.
+
 config LEDS_BCM6328
 	tristate "LED Support for Broadcom BCM6328"
 	depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
index 909dae62ba05..7d7b26552923 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_LEDS_TRIGGERS)		+= led-triggers.o
 # LED Platform Drivers
 obj-$(CONFIG_LEDS_88PM860X)		+= leds-88pm860x.o
 obj-$(CONFIG_LEDS_AAT1290)		+= leds-aat1290.o
+obj-$(CONFIG_LEDS_AS3645A)		+= leds-as3645a.o
 obj-$(CONFIG_LEDS_BCM6328)		+= leds-bcm6328.o
 obj-$(CONFIG_LEDS_BCM6358)		+= leds-bcm6358.o
 obj-$(CONFIG_LEDS_BD2802)		+= leds-bd2802.o
drivers/leds/leds-as3645a.c new file +763 -0

763 lines not on this page · raw message

Signature · 1 line
2.11.0
#10 lore raw

PATCH v3 3/3 arm: dts: omap3: N9/N950: Add AS3645A camera flash

In reply to Sakari Ailus

Add the as3645a flash controller to the DT source.

---
 arch/arm/boot/dts/omap3-n950-n9.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm/boot/dts/omap3-n950-n9.dtsi +14 -0
index df3366fa5409..cb47ae79a5f9 100644
@@ -265,6 +265,20 @@
 
 &i2c2 {
 	clock-frequency = <400000>;
+
+	as3645a@30 {
+		reg = <0x30>;
+		compatible = "ams,as3645a";
+		flash {
+			flash-timeout-us = <150000>;
+			flash-max-microamp = <320000>;
+			led-max-microamp = <60000>;
+			peak-current-limit = <1750000>;
+		};
+		indicator {
+			led-max-microamp = <10000>;
+		};
+	};
 };
 
 &i2c3 {
Signature · 1 line
2.11.0
#2 lore raw

Re: [PATCH v3 1/3] dt: bindings: Document DT bindings for Analog devices as3645a

In reply to Sakari Ailus

Hi!

Documentation/devicetree/bindings/leds/ams,as3645a.txt line 31

Quoted 4 lines
Documentation/devicetree/bindings/leds/ams,as3645a.txt new file +4 -0
+led-max-microamp: Maximum torch (assist) current in microamperes. The
+		  value must be in the range between [20000, 160000] and
+		  divisible by 20000.
+ams,input-max-microamp: Maximum flash controller input current. The

"in microamperes".

Documentation/devicetree/bindings/leds/ams,as3645a.txt line 33

Quoted 2 lines
Documentation/devicetree/bindings/leds/ams,as3645a.txt new file +2 -0
+			value must be in the range [1250000, 2000000]
+			and divisible by 50000.

Is there any reason for "ams," prefix here?

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
#5 lore raw

Re: [PATCH v3 2/3] leds: as3645a: Add LED flash class driver

In reply to a message not in the archive
Quoted 3 lines · Sakari Ailus

Add a LED flash class driver for the as3654a flash controller. A V4L2 flash driver for it already exists (drivers/media/i2c/as3645a.c), and this driver is based on that.

We do not want to have two drivers for same hardware... how is that supposed to work?

Yes, we might want to have both LED and v4l2 interface for a single LED, because v4l2 is just too hairy to use, but we should not duplicate drivers for that.

We _might_ want to do some helpers; as these LED drivers are all quite similar, it should be possible to have "flash led driver" and just link it to v4l2 and LED interfaces...

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#6 lore raw

Re: [PATCH v3 2/3] leds: as3645a: Add LED flash class driver

Hi Pavel,

Quoted 7 lines · Pavel Machek
Quoted 3 lines · Sakari Ailus

Add a LED flash class driver for the as3654a flash controller. A V4L2 flash driver for it already exists (drivers/media/i2c/as3645a.c), and this driver is based on that.

We do not want to have two drivers for same hardware... how is that supposed to work?

No, we don't. The intent is to remove the other driver later on, as it's implemented as a V4L2 sub-device driver. It also lacks DT support.

Quoted 8 lines

Yes, we might want to have both LED and v4l2 interface for a single LED, because v4l2 is just too hairy to use, but we should not duplicate drivers for that.

We _might_ want to do some helpers; as these LED drivers are all quite similar, it should be possible to have "flash led driver" and just link it to v4l2 and LED interfaces...

This is what the new LED (flash) class driver does. Feature-wise it's a superset of the old one. There's a minor matter left, though, which is querying the flash strobe status which the old driver did and the new one does not do yet. I don't know if anyone ever even used that feature though.

Signature · 4 lines
Regards,

Sakari Ailus
e-mail: [email protected]
Acked-by
#7 lore raw

Re: [PATCH v3 2/3] leds: as3645a: Add LED flash class driver

Hi!

Quoted 11 lines · Pavel Machek
Quoted 7 lines · Sakari Ailus
Quoted 3 lines

Add a LED flash class driver for the as3654a flash controller. A V4L2 flash driver for it already exists (drivers/media/i2c/as3645a.c), and this driver is based on that.

We do not want to have two drivers for same hardware... how is that supposed to work?

No, we don't. The intent is to remove the other driver later on, as it's implemented as a V4L2 sub-device driver. It also lacks DT support.

Could we perhaps remove the driver with the same patch that merges this?

Having two drivers would be confusing.

Quoted 4 lines
Quoted 4 lines

Yes, we might want to have both LED and v4l2 interface for a single LED, because v4l2 is just too hairy to use, but we should not duplicate drivers for that.

Quoted 8 lines
Quoted 3 lines

We _might_ want to do some helpers; as these LED drivers are all quite similar, it should be possible to have "flash led driver" and just link it to v4l2 and LED interfaces...

This is what the new LED (flash) class driver does. Feature-wise it's a superset of the old one. There's a minor matter left, though, which is querying the flash strobe status which the old driver did and the new one does not do yet. I don't know if anyone ever even used that feature though.

Yes, I don't think anyone will notice...

Anyway,

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#8 lore raw

Re: [PATCH v3 2/3] leds: as3645a: Add LED flash class driver

Quoted 8 lines · Pavel Machek

Hi!

Quoted 6 lines · Pavel Machek
Quoted 5 lines · Sakari Ailus
Quoted 3 lines

Add a LED flash class driver for the as3654a flash controller. A V4L2 flash driver for it already exists (drivers/media/i2c/as3645a.c), and this driver is based on that.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

We do not want to have two drivers for same hardware... how is that supposed to work?

No, we don't. The intent is to remove the other driver later on, as it's implemented as a V4L2 sub-device driver. It also lacks DT support.

Could we perhaps remove the driver with the same patch that merges this?

This patch is already merged, but I can submit another patch removing the other driver.

Signature · 6 lines
Sakari Ailus
e-mail: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

Re: [PATCH v3 2/3] leds: as3645a: Add LED flash class driver

Quoted 12 lines · Sakari Ailus
Quoted 11 lines · Pavel Machek

Hi!

Quoted 9 lines · Pavel Machek
Quoted 7 lines · Sakari Ailus
Quoted 3 lines

Add a LED flash class driver for the as3654a flash controller. A V4L2 flash driver for it already exists (drivers/media/i2c/as3645a.c), and this driver is based on that.

We do not want to have two drivers for same hardware... how is that supposed to work?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

No, we don't. The intent is to remove the other driver later on, as it's implemented as a V4L2 sub-device driver. It also lacks DT support.

Could we perhaps remove the driver with the same patch that merges this?

This patch is already merged, but I can submit another patch removing the other driver.

Yes, that would be nice.

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html