1 --- a/include/media/adp1653.h 2011-10-03 18:06:48.000000000 +0200
2 +++ b/include/media/adp1653.h 2011-10-08 21:22:27.348047579 +0200
5 #include <linux/videodev2.h>
7 +#include <linux/device.h>
8 #include <media/v4l2-int-device.h>
9 #include <media/smiaregs.h>
11 @@ -75,6 +76,7 @@ struct adp1653_flash {
14 u32 indicator_intensity;
15 + u32 indicator_disabled;
17 struct v4l2_int_device *v4l2_int_device;
19 --- a/drivers/media/video/adp1653.c 2011-10-09 01:11:26.601046961 +0200
20 +++ b/drivers/media/video/adp1653.c 2011-10-09 00:49:42.339046573 +0200
21 @@ -56,7 +56,8 @@ static int adp1653_update_hw(struct v4l2
22 if (flash->power != V4L2_POWER_ON)
25 - out_sel |= flash->indicator_intensity << ADP1653_REG_OUT_SEL_ILED_SHIFT;
26 + if (! flash->indicator_disabled)
27 + out_sel |= flash->indicator_intensity << ADP1653_REG_OUT_SEL_ILED_SHIFT;
28 /* Set torch intensity to zero--prevents false triggering of SC Fault */
29 rval = i2c_smbus_write_byte_data(flash->i2c_client,
30 ADP1653_REG_OUT_SEL, out_sel);
31 @@ -490,6 +491,37 @@ static int adp1653_resume(struct i2c_cli
33 #endif /* CONFIG_PM */
35 +static ssize_t disable_indicator_led_show(struct device *dev,
36 + struct device_attribute *attr, char *buf)
38 + struct adp1653_flash *flash = dev_get_drvdata(dev);
40 + return sprintf(buf, "%u\n", flash->indicator_disabled);
43 +static ssize_t disable_indicator_led_store(struct device *dev,
44 + struct device_attribute *attr,
45 + const char *buf, size_t count)
47 + struct adp1653_flash *flash = dev_get_drvdata(dev);
51 + if (strict_strtoul(buf, 10, &res) < 0)
55 + if (i == flash->indicator_disabled)
58 + flash->indicator_disabled = i;
59 + adp1653_update_hw(flash->v4l2_int_device);
64 +static DEVICE_ATTR(disable_indicator_led, S_IRUGO|S_IWUSR, disable_indicator_led_show, disable_indicator_led_store);
66 static int adp1653_probe(struct i2c_client *client,
67 const struct i2c_device_id *devid)
69 @@ -507,7 +539,13 @@ static int adp1653_probe(struct i2c_clie
70 flash->v4l2_int_device = &adp1653_int_device;
72 flash->i2c_client = client;
73 - i2c_set_clientdata(client, flash);
74 + i2c_set_clientdata(client, flash); /* => dev_set_drvdata(&client->dev, flash) */
76 + flash->indicator_disabled = 0;
77 + rval = device_create_file(&client->dev, &dev_attr_disable_indicator_led);
79 + dev_warn(&client->dev, "can't create sysfs file for %s: %d\n",
80 + dev_attr_disable_indicator_led.attr.name, rval);
82 rval = v4l2_int_device_register(flash->v4l2_int_device);
84 @@ -523,6 +561,7 @@ static int __exit adp1653_remove(struct
86 return -ENODEV; /* our client isn't attached */
88 + device_remove_file(&client->dev, &dev_attr_disable_indicator_led);
89 v4l2_int_device_unregister(flash->v4l2_int_device);
90 i2c_set_clientdata(client, NULL);