From 04b3ff5e28ac35e8f9db4c9cfaef853ae0400567 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Thu, 8 Dec 2011 23:04:32 +0100 Subject: [PATCH] Patch by maacruz: Added option to disable indicator led --- .../patches/option_disable_indicator_led.diff | 91 ++++++++++++++++++++ kernel-power-2.6.28/debian/patches/series | 1 + 2 files changed, 92 insertions(+) create mode 100644 kernel-power-2.6.28/debian/patches/option_disable_indicator_led.diff diff --git a/kernel-power-2.6.28/debian/patches/option_disable_indicator_led.diff b/kernel-power-2.6.28/debian/patches/option_disable_indicator_led.diff new file mode 100644 index 0000000..3499213 --- /dev/null +++ b/kernel-power-2.6.28/debian/patches/option_disable_indicator_led.diff @@ -0,0 +1,91 @@ +--- a/include/media/adp1653.h 2011-10-03 18:06:48.000000000 +0200 ++++ b/include/media/adp1653.h 2011-10-08 21:22:27.348047579 +0200 +@@ -27,6 +27,7 @@ + + #include + #include ++#include + #include + #include + +@@ -75,6 +76,7 @@ struct adp1653_flash { + u32 flash_intensity; + u32 torch_intensity; + u32 indicator_intensity; ++ u32 indicator_disabled; + + struct v4l2_int_device *v4l2_int_device; + +--- a/drivers/media/video/adp1653.c 2011-10-09 01:11:26.601046961 +0200 ++++ b/drivers/media/video/adp1653.c 2011-10-09 00:49:42.339046573 +0200 +@@ -56,7 +56,8 @@ static int adp1653_update_hw(struct v4l2 + if (flash->power != V4L2_POWER_ON) + return 0; + +- out_sel |= flash->indicator_intensity << ADP1653_REG_OUT_SEL_ILED_SHIFT; ++ if (! flash->indicator_disabled) ++ out_sel |= flash->indicator_intensity << ADP1653_REG_OUT_SEL_ILED_SHIFT; + /* Set torch intensity to zero--prevents false triggering of SC Fault */ + rval = i2c_smbus_write_byte_data(flash->i2c_client, + ADP1653_REG_OUT_SEL, out_sel); +@@ -490,6 +491,37 @@ static int adp1653_resume(struct i2c_cli + + #endif /* CONFIG_PM */ + ++static ssize_t disable_indicator_led_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct adp1653_flash *flash = dev_get_drvdata(dev); ++ ++ return sprintf(buf, "%u\n", flash->indicator_disabled); ++} ++ ++static ssize_t disable_indicator_led_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ struct adp1653_flash *flash = dev_get_drvdata(dev); ++ unsigned long res; ++ int i; ++ ++ if (strict_strtoul(buf, 10, &res) < 0) ++ return -EINVAL; ++ i = res ? 1 : 0; ++ ++ if (i == flash->indicator_disabled) ++ goto out; ++ ++ flash->indicator_disabled = i; ++ adp1653_update_hw(flash->v4l2_int_device); ++out: ++ return count; ++} ++ ++static DEVICE_ATTR(disable_indicator_led, S_IRUGO|S_IWUSR, disable_indicator_led_show, disable_indicator_led_store); ++ + static int adp1653_probe(struct i2c_client *client, + const struct i2c_device_id *devid) + { +@@ -507,7 +539,13 @@ static int adp1653_probe(struct i2c_clie + flash->v4l2_int_device = &adp1653_int_device; + + flash->i2c_client = client; +- i2c_set_clientdata(client, flash); ++ i2c_set_clientdata(client, flash); /* => dev_set_drvdata(&client->dev, flash) */ ++ ++ flash->indicator_disabled = 0; ++ rval = device_create_file(&client->dev, &dev_attr_disable_indicator_led); ++ if (rval < 0) ++ dev_warn(&client->dev, "can't create sysfs file for %s: %d\n", ++ dev_attr_disable_indicator_led.attr.name, rval); + + rval = v4l2_int_device_register(flash->v4l2_int_device); + if (rval) +@@ -523,6 +561,7 @@ static int __exit adp1653_remove(struct + if (!client->adapter) + return -ENODEV; /* our client isn't attached */ + ++ device_remove_file(&client->dev, &dev_attr_disable_indicator_led); + v4l2_int_device_unregister(flash->v4l2_int_device); + i2c_set_clientdata(client, NULL); + diff --git a/kernel-power-2.6.28/debian/patches/series b/kernel-power-2.6.28/debian/patches/series index 26affdd..eb7e6bc 100644 --- a/kernel-power-2.6.28/debian/patches/series +++ b/kernel-power-2.6.28/debian/patches/series @@ -56,3 +56,4 @@ radio-si4713.diff overclock_smartreflex_900.diff dspbridge.diff shutdown-reboot-patch.diff +option_disable_indicator_led.diff -- 1.7.9.5