aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2015-03-04 11:14:22 -0500
committerBryan Wu <cooloney@gmail.com>2015-03-09 20:16:23 -0400
commit94fdec768dc72a6993479f59a17daa413f30029e (patch)
tree6495761c9d3b3dc36a4aa27229d70914e48b1dc0
parentca1bb4ee4c3a017bb66840d11d5efdf4e8f3f66d (diff)
leds: flash: Remove synchronized flash strobe feature
Synchronized flash strobe feature has been considered not fitting for LED subsystem sysfs interface and thus is being removed. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Bryan Wu <cooloney@gmail.com>
-rw-r--r--drivers/leds/led-class-flash.c82
-rw-r--r--include/linux/led-class-flash.h14
-rw-r--r--include/linux/leds.h1
3 files changed, 0 insertions, 97 deletions
diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c
index 4a19fd44f93f..3b2573411a37 100644
--- a/drivers/leds/led-class-flash.c
+++ b/drivers/leds/led-class-flash.c
@@ -216,75 +216,6 @@ static ssize_t flash_fault_show(struct device *dev,
216} 216}
217static DEVICE_ATTR_RO(flash_fault); 217static DEVICE_ATTR_RO(flash_fault);
218 218
219static ssize_t available_sync_leds_show(struct device *dev,
220 struct device_attribute *attr, char *buf)
221{
222 struct led_classdev *led_cdev = dev_get_drvdata(dev);
223 struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
224 char *pbuf = buf;
225 int i, buf_len;
226
227 buf_len = sprintf(pbuf, "[0: none] ");
228 pbuf += buf_len;
229
230 for (i = 0; i < fled_cdev->num_sync_leds; ++i) {
231 buf_len = sprintf(pbuf, "[%d: %s] ", i + 1,
232 fled_cdev->sync_leds[i]->led_cdev.name);
233 pbuf += buf_len;
234 }
235
236 return sprintf(buf, "%s\n", buf);
237}
238static DEVICE_ATTR_RO(available_sync_leds);
239
240static ssize_t flash_sync_strobe_store(struct device *dev,
241 struct device_attribute *attr, const char *buf, size_t size)
242{
243 struct led_classdev *led_cdev = dev_get_drvdata(dev);
244 struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
245 unsigned long led_id;
246 ssize_t ret;
247
248 mutex_lock(&led_cdev->led_access);
249
250 if (led_sysfs_is_disabled(led_cdev)) {
251 ret = -EBUSY;
252 goto unlock;
253 }
254
255 ret = kstrtoul(buf, 10, &led_id);
256 if (ret)
257 goto unlock;
258
259 if (led_id > fled_cdev->num_sync_leds) {
260 ret = -ERANGE;
261 goto unlock;
262 }
263
264 fled_cdev->sync_led_id = led_id;
265
266 ret = size;
267unlock:
268 mutex_unlock(&led_cdev->led_access);
269 return ret;
270}
271
272static ssize_t flash_sync_strobe_show(struct device *dev,
273 struct device_attribute *attr, char *buf)
274{
275 struct led_classdev *led_cdev = dev_get_drvdata(dev);
276 struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
277 int sled_id = fled_cdev->sync_led_id;
278 char *sync_led_name = "none";
279
280 if (fled_cdev->sync_led_id > 0)
281 sync_led_name = (char *)
282 fled_cdev->sync_leds[sled_id - 1]->led_cdev.name;
283
284 return sprintf(buf, "[%d: %s]\n", sled_id, sync_led_name);
285}
286static DEVICE_ATTR_RW(flash_sync_strobe);
287
288static struct attribute *led_flash_strobe_attrs[] = { 219static struct attribute *led_flash_strobe_attrs[] = {
289 &dev_attr_flash_strobe.attr, 220 &dev_attr_flash_strobe.attr,
290 NULL, 221 NULL,
@@ -307,12 +238,6 @@ static struct attribute *led_flash_fault_attrs[] = {
307 NULL, 238 NULL,
308}; 239};
309 240
310static struct attribute *led_flash_sync_strobe_attrs[] = {
311 &dev_attr_available_sync_leds.attr,
312 &dev_attr_flash_sync_strobe.attr,
313 NULL,
314};
315
316static const struct attribute_group led_flash_strobe_group = { 241static const struct attribute_group led_flash_strobe_group = {
317 .attrs = led_flash_strobe_attrs, 242 .attrs = led_flash_strobe_attrs,
318}; 243};
@@ -329,10 +254,6 @@ static const struct attribute_group led_flash_fault_group = {
329 .attrs = led_flash_fault_attrs, 254 .attrs = led_flash_fault_attrs,
330}; 255};
331 256
332static const struct attribute_group led_flash_sync_strobe_group = {
333 .attrs = led_flash_sync_strobe_attrs,
334};
335
336static void led_flash_resume(struct led_classdev *led_cdev) 257static void led_flash_resume(struct led_classdev *led_cdev)
337{ 258{
338 struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); 259 struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
@@ -361,9 +282,6 @@ static void led_flash_init_sysfs_groups(struct led_classdev_flash *fled_cdev)
361 if (ops->fault_get) 282 if (ops->fault_get)
362 flash_groups[num_sysfs_groups++] = &led_flash_fault_group; 283 flash_groups[num_sysfs_groups++] = &led_flash_fault_group;
363 284
364 if (led_cdev->flags & LED_DEV_CAP_SYNC_STROBE)
365 flash_groups[num_sysfs_groups++] = &led_flash_sync_strobe_group;
366
367 led_cdev->groups = flash_groups; 285 led_cdev->groups = flash_groups;
368} 286}
369 287
diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-flash.h
index 3b5b9643cea1..21ec91e13c47 100644
--- a/include/linux/led-class-flash.h
+++ b/include/linux/led-class-flash.h
@@ -81,20 +81,6 @@ struct led_classdev_flash {
81 81
82 /* LED Flash class sysfs groups */ 82 /* LED Flash class sysfs groups */
83 const struct attribute_group *sysfs_groups[LED_FLASH_MAX_SYSFS_GROUPS]; 83 const struct attribute_group *sysfs_groups[LED_FLASH_MAX_SYSFS_GROUPS];
84
85 /* LEDs available for flash strobe synchronization */
86 struct led_classdev_flash **sync_leds;
87
88 /* Number of LEDs available for flash strobe synchronization */
89 int num_sync_leds;
90
91 /*
92 * The identifier of the sub-led to synchronize the flash strobe with.
93 * Identifiers start from 1, which reflects the first element from the
94 * sync_leds array. 0 means that the flash strobe should not be
95 * synchronized.
96 */
97 u32 sync_led_id;
98}; 84};
99 85
100static inline struct led_classdev_flash *lcdev_to_flcdev( 86static inline struct led_classdev_flash *lcdev_to_flcdev(
diff --git a/include/linux/leds.h b/include/linux/leds.h
index ed634279062e..9a2b000094cf 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -47,7 +47,6 @@ struct led_classdev {
47#define SET_BRIGHTNESS_ASYNC (1 << 21) 47#define SET_BRIGHTNESS_ASYNC (1 << 21)
48#define SET_BRIGHTNESS_SYNC (1 << 22) 48#define SET_BRIGHTNESS_SYNC (1 << 22)
49#define LED_DEV_CAP_FLASH (1 << 23) 49#define LED_DEV_CAP_FLASH (1 << 23)
50#define LED_DEV_CAP_SYNC_STROBE (1 << 24)
51 50
52 /* Set LED brightness level */ 51 /* Set LED brightness level */
53 /* Must not sleep, use a workqueue if needed */ 52 /* Must not sleep, use a workqueue if needed */