Skip to contentSkip to conversation

as3645a flash driver

PATCH Superseded Laurent Pinchart 3 participants 18 messages Nov 15, 2011 – Nov 16, 2011

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover as3645a flash driver

Hi everybody,

v3 was missing a small bug fix (setting ctrl->cur.val to 0 before adding bits in the fault control read code). v4 fixes that (and also includes a cosmetic fix).

Laurent Pinchart (2):
v4l: Add over-current and indicator flash fault bits
as3645a: Add driver for LED flash controller

 Documentation/DocBook/media/v4l/controls.xml |   10 +
 drivers/media/video/Kconfig                  |    7 +
 drivers/media/video/Makefile                 |    1 +
 drivers/media/video/as3645a.c                |  881 ++++++++++++++++++++++++++
 include/linux/videodev2.h                    |    2 +
 include/media/as3645a.h                      |   83 +++
 6 files changed, 984 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/as3645a.c
 create mode 100644 include/media/as3645a.h
Signature · 3 lines
Regards,

Laurent Pinchart
#1 lore raw

PATCH v4 1/2 v4l: Add over-current and indicator flash fault bits

Flash controllers can report over-current and indicator fault conditions. Define flash fault control bits for them.

---
 Documentation/DocBook/media/v4l/controls.xml |   10 ++++++++++
 include/linux/videodev2.h                    |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)
Documentation/DocBook/media/v4l/controls.xml +10 -0
index 3bc5ee8..a978b88 100644
@@ -3329,6 +3329,16 @@ interface and may change in the future.</para>
 		  <entry>The short circuit protection of the flash
 		  controller has been triggered.</entry>
 		</row>
+		<row>
+		  <entry><constant>V4L2_FLASH_FAULT_OVER_CURRENT</constant></entry>
+		  <entry>Current in the LED power supply has exceeded the limit
+		  specific to the flash controller.</entry>
+		</row>
+		<row>
+		  <entry><constant>V4L2_FLASH_FAULT_INDICATOR</constant></entry>
+		  <entry>The flash controller has detected a short or open
+		  circuit condition on the indicator LED.</entry>
+		</row>
 	      </tbody>
 	    </entrytbl>
 	  </row>
include/linux/videodev2.h +2 -0
index 4b752d5..3d62631 100644
@@ -1682,6 +1682,8 @@ enum v4l2_flash_strobe_source {
 #define V4L2_FLASH_FAULT_TIMEOUT		(1 << 1)
 #define V4L2_FLASH_FAULT_OVER_TEMPERATURE	(1 << 2)
 #define V4L2_FLASH_FAULT_SHORT_CIRCUIT		(1 << 3)
+#define V4L2_FLASH_FAULT_OVER_CURRENT		(1 << 4)
+#define V4L2_FLASH_FAULT_INDICATOR		(1 << 5)
 
 #define V4L2_CID_FLASH_CHARGE			(V4L2_CID_FLASH_CLASS_BASE + 11)
 #define V4L2_CID_FLASH_READY			(V4L2_CID_FLASH_CLASS_BASE + 12)
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH v4 2/2 as3645a: Add driver for LED flash controller

In reply to Laurent Pinchart

This patch adds the driver for the as3645a LED flash controller. This controller supports a high power led in flash and torch modes and an indicator light, sometimes also called privacy light.

---
 drivers/media/video/Kconfig   |    7 +
 drivers/media/video/Makefile  |    1 +
 drivers/media/video/as3645a.c |  881 +++++++++++++++++++++++++++++++++++++++++
 include/media/as3645a.h       |   83 ++++
 4 files changed, 972 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/as3645a.c
 create mode 100644 include/media/as3645a.h
drivers/media/video/Kconfig +7 -0
index 4e8a0c4..9617c05 100644
@@ -533,6 +533,13 @@ config VIDEO_ADP1653
 	  This is a driver for the ADP1653 flash controller. It is used for
 	  example in Nokia N900.
 
+config VIDEO_AS3645A
+	tristate "AS3645A flash driver support"
+	depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
+	---help---
+	  This is a driver for the AS3645A and LM3555 flash controllers. It has
+	  build in control for Flash, Torch and Indicator LEDs.
+
 comment "Video improvement chips"
 
 config VIDEO_UPD64031A
drivers/media/video/Makefile +1 -0
index ddeaa6c..86aabd6 100644
@@ -74,6 +74,7 @@ obj-$(CONFIG_VIDEO_NOON010PC30)	+= noon010pc30.o
 obj-$(CONFIG_VIDEO_M5MOLS)	+= m5mols/
 obj-$(CONFIG_VIDEO_S5K6AA)	+= s5k6aa.o
 obj-$(CONFIG_VIDEO_ADP1653)	+= adp1653.o
+obj-$(CONFIG_VIDEO_AS3645A)	+= as3645a.o
 
 obj-$(CONFIG_SOC_CAMERA_IMX074)		+= imx074.o
 obj-$(CONFIG_SOC_CAMERA_MT9M001)	+= mt9m001.o
drivers/media/video/as3645a.c new file +881 -0

881 lines not on this page · raw message

include/media/as3645a.h new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#3 lore raw

cover as3645a: set of fixes up

This series incorporates Sakari's comments and couple of fixes from my version of the driver.

Andy Shevchenko (9):
as3645a: mention lm3555 as a clone of that chip
as3645a: print vendor and revision of the chip
as3645a: remove unused code
as3645a: No error, no message.
as3645a: move limits to the platform_data
as3645a: free resources in case of error properly
as3645a: use struct dev_pm_ops
as3645a: use pr_err macro instead of printk KERN_ERR
as3645a: use the same timeout for hw and sw strobes

 drivers/media/video/as3645a.c |   76 ++++++++++++++++++-----------------------
 include/media/as3645a.h       |   32 +++++++----------
 2 files changed, 46 insertions(+), 62 deletions(-)
Signature · 1 line
1.7.7.1
#4 lore raw

PATCH 1/9 as3645a: mention lm3555 as a clone of that chip

---
 drivers/media/video/as3645a.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/as3645a.c +1 -1
index a9f857f..ef1226d 100644
@@ -878,5 +878,5 @@ module_init(as3645a_init);
 module_exit(as3645a_exit);
 
 MODULE_AUTHOR("Laurent Pinchart <[email protected]>");
-MODULE_DESCRIPTION("AS3645A Flash driver");
+MODULE_DESCRIPTION("LED Flash driver for AS3645a, LM3555 and their clones");
 MODULE_LICENSE("GPL");
Signature · 1 line
1.7.7.1
#5 lore raw

PATCH 2/9 as3645a: print vendor and revision of the chip

In reply to Andy Shevchenko

The as3645a_registered() is used to detect connected chip. It would be nice to print the detected value every time we load the module. The "Vendor" is probably better word to use there. For example, lm3555 (NSC) is slightly different to as3645a.

---
 drivers/media/video/as3645a.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/video/as3645a.c +2 -2
index ef1226d..8882a14 100644
@@ -602,8 +602,8 @@ static int as3645a_registered(struct v4l2_subdev *sd)
 		factory = "Unknown";
 	}
 
-	dev_dbg(&client->dev, "Factory: %s(%d) Version: %d\n", factory, man,
-		version);
+	dev_info(&client->dev, "Chip vendor: %s(%d) Version: %d\n", factory,
+			man, version);
 
 	rval = as3645a_write(flash, AS_PASSWORD_REG, AS_PASSWORD_UNLOCK_VALUE);
 	if (rval < 0)
Signature · 1 line
1.7.7.1
#6 lore raw

Re: [PATCH 2/9] as3645a: print vendor and revision of the chip

Hi Andy,

Thanks for the patch.

Quoted 15 lines · On Tuesday 15 November 2011 18:49:54 Andy Shevchenko wrote:

The as3645a_registered() is used to detect connected chip. It would be nice to print the detected value every time we load the module. The "Vendor" is probably better word to use there. For example, lm3555 (NSC) is slightly different to as3645a.

---
 drivers/media/video/as3645a.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/video/as3645a.c +0 -0
index ef1226d..8882a14 100644

drivers/media/video/as3645a.c static int as3645a_registered(struct v4l2_subdev *sd) · line 606

Quoted 7 lines
drivers/media/video/as3645a.c +2 -2
@@ -602,8 +602,8 @@ static int as3645a_registered(struct v4l2_subdev *sd)
 		factory = "Unknown";
 	}
 
-	dev_dbg(&client->dev, "Factory: %s(%d) Version: %d\n", factory, man,
-		version);
+	dev_info(&client->dev, "Chip vendor: %s(%d) Version: %d\n", factory,
+			man, version);

I'll rename the factory variable to vendor.

Quoted 2 lines
drivers/media/video/as3645a.c +0 -0
 	rval = as3645a_write(flash, AS_PASSWORD_REG, AS_PASSWORD_UNLOCK_VALUE);
 	if (rval < 0)
Signature · 3 lines
Regards,

Laurent Pinchart
#7 lore raw

PATCH 3/9 as3645a: remove unused code

In reply to Andy Shevchenko
---
 drivers/media/video/as3645a.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/media/video/as3645a.c +0 -4
index 8882a14..5c7e42f 100644
@@ -90,9 +90,6 @@
 #define AS_PASSWORD_REG				0x0f
 #define AS_PASSWORD_UNLOCK_VALUE		0x55
 
-/* AS_CONTROL_EXT_TORCH_ON - on, 0 - off */
-#define TORCH_IN_STANDBY			0
-
 enum as_mode {
 	AS_MODE_EXT_TORCH = 0 << AS_CONTROL_MODE_SETTING_SHIFT,
 	AS_MODE_INDICATOR = 1 << AS_CONTROL_MODE_SETTING_SHIFT,
@@ -228,7 +225,6 @@ as3645a_set_control(struct as3645a *flash, enum as_mode mode, bool on)
 
 	/* Configure output parameters and operation mode. */
 	reg = (flash->pdata->peak << AS_CONTROL_COIL_PEAK_SHIFT)
-	    | TORCH_IN_STANDBY
 	    | (on ? AS_CONTROL_OUT_ON : 0)
 	    | mode;
 
Signature · 1 line
1.7.7.1
#8 lore raw

PATCH 4/9 as3645a: No error, no message.

In reply to Andy Shevchenko
---
 drivers/media/video/as3645a.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/media/video/as3645a.c +0 -3
index 5c7e42f..108bc0f 100644
@@ -317,9 +317,6 @@ static int as3645a_read_fault(struct as3645a *flash)
 		dev_dbg(&client->dev, "Over voltage fault: "
 			"Indicates missing capacitor or open connection\n");
 
-	if (rval & ~AS_FAULT_INFO_INDICATOR_LED)
-		dev_dbg(&client->dev, "No faults, nice\n");
-
 	return rval;
 }
 
Signature · 1 line
1.7.7.1
#9 lore raw

PATCH 5/9 as3645a: move limits to the platform_data

In reply to Andy Shevchenko
---
 drivers/media/video/as3645a.c |   12 ++++++------
 include/media/as3645a.h       |   32 +++++++++++++-------------------
 2 files changed, 19 insertions(+), 25 deletions(-)
drivers/media/video/as3645a.c +6 -6
index 108bc0f..541f8bc 100644
@@ -724,8 +724,8 @@ static int as3645a_init_controls(struct as3645a *flash)
 			  V4L2_CID_FLASH_STROBE_STOP, 0, 0, 0, 0);
 
 	/* V4L2_CID_FLASH_TIMEOUT */
-	minimum = pdata->limits.timeout_min;
-	maximum = pdata->limits.timeout_max;
+	minimum = pdata->timeout_min;
+	maximum = pdata->timeout_max;
 
 	v4l2_ctrl_new_std(&flash->ctrls, &as3645a_ctrl_ops,
 			  V4L2_CID_FLASH_TIMEOUT, minimum, maximum,
@@ -734,8 +734,8 @@ static int as3645a_init_controls(struct as3645a *flash)
 	flash->timeout = maximum;
 
 	/* V4L2_CID_FLASH_INTENSITY */
-	minimum = pdata->limits.flash_min_current;
-	maximum = pdata->limits.flash_max_current;
+	minimum = pdata->flash_min_current;
+	maximum = pdata->flash_max_current;
 
 	v4l2_ctrl_new_std(&flash->ctrls, &as3645a_ctrl_ops,
 			  V4L2_CID_FLASH_INTENSITY, minimum, maximum,
@@ -745,8 +745,8 @@ static int as3645a_init_controls(struct as3645a *flash)
 			     / AS3645A_FLASH_INTENSITY_STEP;
 
 	/* V4L2_CID_FLASH_TORCH_INTENSITY */
-	minimum = pdata->limits.torch_min_current;
-	maximum = pdata->limits.torch_max_current;
+	minimum = pdata->torch_min_current;
+	maximum = pdata->torch_max_current;
 
 	v4l2_ctrl_new_std(&flash->ctrls, &as3645a_ctrl_ops,
 			  V4L2_CID_FLASH_TORCH_INTENSITY, minimum, maximum,
include/media/as3645a.h +13 -19
index d8a3c41..11d77c9 100644
@@ -47,15 +47,25 @@
 #define AS3645A_INDICATOR_INTENSITY_STEP	2500
 
 /*
- * as3645a_flash_torch_limits - Flash and torch currents and timeout limits
+ * as3645a_platform_data - Flash controller platform data
+ * @set_power:	Set power callback
+ * @vref:	VREF offset (0=0V, 1=+0.3V, 2=-0.3V, 3=+0.6V)
+ * @peak:	Inductor peak current limit (0=1.25A, 1=1.5A, 2=1.75A, 3=2.0A)
+ * @ext_strobe:	True if external flash strobe can be used
  * @flash_min_current:	Min flash current (mA, >= AS3645A_FLASH_INTENSITY_MIN)
- * @flash_max_current:	Max flash current (mA, <= AS3645A_FLASH_INTENSITY_MAX*)
+ * @flash_max_current:	Max flash current (mA, <= AS3645A_FLASH_INTENSITY_MAX)
  * @torch_min_current:	Min torch current (mA, <= AS3645A_TORCH_INTENSITY_MIN)
  * @torch_max_current:	Max torch current (mA, >= AS3645A_TORCH_INTENSITY_MAX)
  * @timeout_min:	Min flash timeout (us, >= 1)
  * @timeout_max:	Max flash timeout (us, <= AS3645A_FLASH_TIMEOUT_MAX)
  */
-struct as3645a_flash_torch_limits {
+struct as3645a_platform_data {
+	int (*set_power)(struct v4l2_subdev *subdev, int on);
+	unsigned int vref;
+	unsigned int peak;
+	bool ext_strobe;
+
+	/* Flash and torch currents and timeout limits */
 	unsigned int flash_min_current;
 	unsigned int flash_max_current;
 	unsigned int torch_min_current;
@@ -64,20 +74,4 @@ struct as3645a_flash_torch_limits {
 	unsigned int timeout_max;
 };
 
-/*
- * as3645a_platform_data - Flash controller platform data
- * @set_power:	Set power callback
- * @vref:	VREF offset (0=0V, 1=+0.3V, 2=-0.3V, 3=+0.6V)
- * @peak:	Inductor peak current limit (0=1.25A, 1=1.5A, 2=1.75A, 3=2.0A)
- * @ext_strobe:	True if external flash strobe can be used
- * @limits:	Flash and torch currents and timeout limits
- */
-struct as3645a_platform_data {
-	int (*set_power)(struct v4l2_subdev *subdev, int on);
-	unsigned int vref;
-	unsigned int peak;
-	bool ext_strobe;
-	struct as3645a_flash_torch_limits limits;
-};
-
 #endif /* __AS3645A_H__ */
Signature · 1 line
1.7.7.1
#10 lore raw

PATCH 6/9 as3645a: free resources in case of error properly

In reply to Andy Shevchenko
---
 drivers/media/video/as3645a.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
drivers/media/video/as3645a.c +12 -11
index 541f8bc..9aebaa2 100644
@@ -800,11 +800,13 @@ static int as3645a_probe(struct i2c_client *client,
 	flash->subdev.internal_ops = &as3645a_internal_ops;
 	flash->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
+	ret = as3645a_init_controls(flash);
+	if (ret < 0)
+		goto free_and_quit;
+
 	ret = media_entity_init(&flash->subdev.entity, 0, NULL, 0);
-	if (ret < 0) {
-		kfree(flash);
-		return ret;
-	}
+	if (ret < 0)
+		goto free_and_quit;
 
 	flash->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
 
@@ -812,13 +814,12 @@ static int as3645a_probe(struct i2c_client *client,
 
 	flash->led_mode = V4L2_FLASH_LED_MODE_NONE;
 
-	ret = as3645a_init_controls(flash);
-	if (ret < 0) {
-		kfree(flash);
-		return ret;
-	}
-
 	return 0;
+
+free_and_quit:
+	v4l2_ctrl_handler_free(&flash->ctrls);
+	kfree(flash);
+	return ret;
 }
 
 static int __exit as3645a_remove(struct i2c_client *client)
@@ -828,7 +829,7 @@ static int __exit as3645a_remove(struct i2c_client *client)
 
 	v4l2_device_unregister_subdev(subdev);
 	v4l2_ctrl_handler_free(&flash->ctrls);
-
+	media_entity_cleanup(&flash->subdev.entity);
 	kfree(flash);
 
 	return 0;
Signature · 1 line
1.7.7.1
#11 lore raw

Re: [PATCH 6/9] as3645a: free resources in case of error properly

Hi Andy,

Thanks for the patch.

Quoted 28 lines · On Tuesday 15 November 2011 18:49:58 Andy Shevchenko wrote:
---
 drivers/media/video/as3645a.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
drivers/media/video/as3645a.c +6 -4
index 541f8bc..9aebaa2 100644
@@ -800,11 +800,13 @@ static int as3645a_probe(struct i2c_client *client,
 	flash->subdev.internal_ops = &as3645a_internal_ops;
 	flash->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
+	ret = as3645a_init_controls(flash);
+	if (ret < 0)
+		goto free_and_quit;
+
 	ret = media_entity_init(&flash->subdev.entity, 0, NULL, 0);
-	if (ret < 0) {
-		kfree(flash);
-		return ret;
-	}
+	if (ret < 0)
+		goto free_and_quit;
 
 	flash->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
 

drivers/media/video/as3645a.c static int as3645a_probe(struct i2c_client *client, · line 820

Quoted 9 lines
drivers/media/video/as3645a.c +0 -6
@@ -812,13 +814,12 @@ static int as3645a_probe(struct i2c_client *client,
 
 	flash->led_mode = V4L2_FLASH_LED_MODE_NONE;
 
-	ret = as3645a_init_controls(flash);
-	if (ret < 0) {
-		kfree(flash);
-		return ret;
-	}
-

Would you mind if I replace this code below

drivers/media/video/as3645a.c static int as3645a_probe(struct i2c_client *client, · line 822

Quoted 6 lines
drivers/media/video/as3645a.c +5 -0
 	return 0;
+
+free_and_quit:
+	v4l2_ctrl_handler_free(&flash->ctrls);
+	kfree(flash);
+	return ret;

with

done:

	if (ret < 0) {
		v4l2_ctrl_handler_free(&flash->ctrls);
		kfree(flash);
	}

	return ret;
Quoted 13 lines
drivers/media/video/as3645a.c +1 -1
 }
 
 static int __exit as3645a_remove(struct i2c_client *client)
@@ -828,7 +829,7 @@ static int __exit as3645a_remove(struct i2c_client
 *client)
 
 	v4l2_device_unregister_subdev(subdev);
 	v4l2_ctrl_handler_free(&flash->ctrls);
-
+	media_entity_cleanup(&flash->subdev.entity);
 	kfree(flash);
 

return 0;

Signature · 3 lines
Regards,

Laurent Pinchart
#12 lore raw

Re: [PATCH 6/9] as3645a: free resources in case of error properly

Quoted 22 lines · Laurent Pinchart

drivers/media/video/as3645a.c static int as3645a_probe(struct i2c_client *client, · line 820

Quoted 10 lines
drivers/media/video/as3645a.c +0 -6
@@ -812,13 +814,12 @@ static int as3645a_probe(struct i2c_client *client,
 
 	flash->led_mode = V4L2_FLASH_LED_MODE_NONE;
 
-	ret = as3645a_init_controls(flash);
-	if (ret < 0) {
-		kfree(flash);
-		return ret;
-	}
-

Would you mind if I replace this code below

drivers/media/video/as3645a.c static int as3645a_probe(struct i2c_client *client, · line 822

Quoted 6 lines
drivers/media/video/as3645a.c +5 -0
 	return 0;
+
+free_and_quit:
+	v4l2_ctrl_handler_free(&flash->ctrls);
+	kfree(flash);
+	return ret;

with

Quoted 8 lines

done:

	if (ret < 0) {
		v4l2_ctrl_handler_free(&flash->ctrls);
		kfree(flash);
	}

	return ret;

I'm okay with it. However, I don't know if the compiler could optimize double check here.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#13 lore raw

PATCH 7/9 as3645a: use struct dev_pm_ops

In reply to Andy Shevchenko
---
 drivers/media/video/as3645a.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
drivers/media/video/as3645a.c +10 -4
index 9aebaa2..774f797 100644
@@ -646,8 +646,9 @@ static const struct v4l2_subdev_internal_ops as3645a_internal_ops = {
  */
 #ifdef CONFIG_PM
 
-static int as3645a_suspend(struct i2c_client *client, pm_message_t mesg)
+static int as3645a_suspend(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	struct v4l2_subdev *subdev = i2c_get_clientdata(client);
 	struct as3645a *flash = to_as3645a(subdev);
 	int rval;
@@ -662,8 +663,9 @@ static int as3645a_suspend(struct i2c_client *client, pm_message_t mesg)
 	return rval;
 }
 
-static int as3645a_resume(struct i2c_client *client)
+static int as3645a_resume(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	struct v4l2_subdev *subdev = i2c_get_clientdata(client);
 	struct as3645a *flash = to_as3645a(subdev);
 	int rval;
@@ -841,14 +843,18 @@ static const struct i2c_device_id as3645a_id_table[] = {
 };
 MODULE_DEVICE_TABLE(i2c, as3645a_id_table);
 
+static const struct dev_pm_ops as3645a_pm_ops = {
+	.suspend = as3645a_suspend,
+	.resume = as3645a_resume,
+};
+
 static struct i2c_driver as3645a_i2c_driver = {
 	.driver	= {
 		.name = AS3645A_NAME,
+		.pm   = &as3645a_pm_ops,
 	},
 	.probe	= as3645a_probe,
 	.remove	= __exit_p(as3645a_remove),
-	.suspend = as3645a_suspend,
-	.resume = as3645a_resume,
 	.id_table = as3645a_id_table,
 };
 
Signature · 1 line
1.7.7.1
#14 lore raw

PATCH 8/9 as3645a: use pr_err macro instead of printk KERN_ERR

In reply to Andy Shevchenko
---
 drivers/media/video/as3645a.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/as3645a.c +1 -1
index 774f797..5f8fa68 100644
@@ -864,7 +864,7 @@ static int __init as3645a_init(void)
 
 	rval = i2c_add_driver(&as3645a_i2c_driver);
 	if (rval)
-		printk(KERN_ERR "Failed registering driver" AS3645A_NAME"\n");
+		pr_err("%s: Failed to register the driver\n", AS3645A_NAME);
 
 	return rval;
 }
Signature · 1 line
1.7.7.1
#15 lore raw

PATCH 9/9 as3645a: use the same timeout for hw and sw strobes

In reply to Andy Shevchenko

It seems the timeout value couldn't be different for either external or software strobe (accordingly to as3645a datasheet, table 6).

This patch doesn't prevent to use software watchdog, because it will use another mechanism to stop strobing (i.e. low "out" pin).

---
 drivers/media/video/as3645a.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)
drivers/media/video/as3645a.c +1 -11
index 5f8fa68..5462209 100644
@@ -187,18 +187,8 @@ static int as3645a_set_config(struct as3645a *flash)
 	if (ret < 0)
 		return ret;
 
-	if (flash->strobe_source == V4L2_FLASH_STROBE_SOURCE_EXTERNAL) {
-		/* Use timeout to protect the flash in case the external
-		 * strobe gets stuck. Minimum value 100 ms, maximum 850 ms.
-		 */
-		u32 timeout = DIV_ROUND_UP(flash->timeout, 1000);
-		timeout = max_t(u32, DIV_ROUND_UP(timeout, 50) * 50, 100);
-		val = AS_TIMER_MS_TO_CODE(timeout)
+	val = AS_TIMER_MS_TO_CODE(flash->timeout / 1000)
 		    << AS_INDICATOR_AND_TIMER_TIMEOUT_SHIFT;
-	} else {
-		val = AS_TIMER_MS_TO_CODE(flash->timeout / 1000)
-		    << AS_INDICATOR_AND_TIMER_TIMEOUT_SHIFT;
-	}
 
 	val |= (flash->pdata->vref << AS_INDICATOR_AND_TIMER_VREF_SHIFT)
 	    |  ((flash->indicator_current ? flash->indicator_current - 1 : 0)
Signature · 1 line
1.7.7.1
Acked-by on the v1 series
#16 lore raw

Re: [PATCH 0/9] as3645a: set of fixes up

In reply to Andy Shevchenko
Quoted 14 lines · Andy Shevchenko

This series incorporates Sakari's comments and couple of fixes from my version of the driver.

Andy Shevchenko (9):
as3645a: mention lm3555 as a clone of that chip
as3645a: print vendor and revision of the chip
as3645a: remove unused code
as3645a: No error, no message.
as3645a: move limits to the platform_data
as3645a: free resources in case of error properly
as3645a: use struct dev_pm_ops
as3645a: use pr_err macro instead of printk KERN_ERR
as3645a: use the same timeout for hw and sw strobes

Quoted 3 lines
 drivers/media/video/as3645a.c |   76 ++++++++++++++++++-----------------------
 include/media/as3645a.h       |   32 +++++++----------
 2 files changed, 46 insertions(+), 62 deletions(-)

Thanks for the patches, Andy!

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	jabber/XMPP/Gmail: [email protected]
Acked-by on the v4 series
#17 lore raw
In reply to Laurent Pinchart
Quoted 9 lines · Laurent Pinchart

Hi everybody,

v3 was missing a small bug fix (setting ctrl->cur.val to 0 before adding bits in the fault control read code). v4 fixes that (and also includes a cosmetic fix).

Laurent Pinchart (2):
v4l: Add over-current and indicator flash fault bits
as3645a: Add driver for LED flash controller

Thanks for the patchset!

For both patches:

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	jabber/XMPP/Gmail: [email protected]