]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/video/omap2/dss/overlay.c
OMAP: DSS2: Convert simple/strict_strto* to kstrto*
[mv-sheeva.git] / drivers / video / omap2 / dss / overlay.c
1 /*
2  * linux/drivers/video/omap2/dss/overlay.c
3  *
4  * Copyright (C) 2009 Nokia Corporation
5  * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
6  *
7  * Some code and ideas taken from drivers/video/omap/ driver
8  * by Imre Deak.
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU General Public License version 2 as published by
12  * the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17  * more details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22
23 #define DSS_SUBSYS_NAME "OVERLAY"
24
25 #include <linux/kernel.h>
26 #include <linux/module.h>
27 #include <linux/err.h>
28 #include <linux/sysfs.h>
29 #include <linux/kobject.h>
30 #include <linux/platform_device.h>
31 #include <linux/delay.h>
32 #include <linux/slab.h>
33
34 #include <video/omapdss.h>
35 #include <plat/cpu.h>
36
37 #include "dss.h"
38 #include "dss_features.h"
39
40 static int num_overlays;
41 static struct list_head overlay_list;
42
43 static ssize_t overlay_name_show(struct omap_overlay *ovl, char *buf)
44 {
45         return snprintf(buf, PAGE_SIZE, "%s\n", ovl->name);
46 }
47
48 static ssize_t overlay_manager_show(struct omap_overlay *ovl, char *buf)
49 {
50         return snprintf(buf, PAGE_SIZE, "%s\n",
51                         ovl->manager ? ovl->manager->name : "<none>");
52 }
53
54 static ssize_t overlay_manager_store(struct omap_overlay *ovl, const char *buf,
55                 size_t size)
56 {
57         int i, r;
58         struct omap_overlay_manager *mgr = NULL;
59         struct omap_overlay_manager *old_mgr;
60         int len = size;
61
62         if (buf[size-1] == '\n')
63                 --len;
64
65         if (len > 0) {
66                 for (i = 0; i < omap_dss_get_num_overlay_managers(); ++i) {
67                         mgr = omap_dss_get_overlay_manager(i);
68
69                         if (sysfs_streq(buf, mgr->name))
70                                 break;
71
72                         mgr = NULL;
73                 }
74         }
75
76         if (len > 0 && mgr == NULL)
77                 return -EINVAL;
78
79         if (mgr)
80                 DSSDBG("manager %s found\n", mgr->name);
81
82         if (mgr == ovl->manager)
83                 return size;
84
85         old_mgr = ovl->manager;
86
87         /* detach old manager */
88         if (old_mgr) {
89                 r = ovl->unset_manager(ovl);
90                 if (r) {
91                         DSSERR("detach failed\n");
92                         return r;
93                 }
94
95                 r = old_mgr->apply(old_mgr);
96                 if (r)
97                         return r;
98         }
99
100         if (mgr) {
101                 r = ovl->set_manager(ovl, mgr);
102                 if (r) {
103                         DSSERR("Failed to attach overlay\n");
104                         return r;
105                 }
106
107                 r = mgr->apply(mgr);
108                 if (r)
109                         return r;
110         }
111
112         return size;
113 }
114
115 static ssize_t overlay_input_size_show(struct omap_overlay *ovl, char *buf)
116 {
117         return snprintf(buf, PAGE_SIZE, "%d,%d\n",
118                         ovl->info.width, ovl->info.height);
119 }
120
121 static ssize_t overlay_screen_width_show(struct omap_overlay *ovl, char *buf)
122 {
123         return snprintf(buf, PAGE_SIZE, "%d\n", ovl->info.screen_width);
124 }
125
126 static ssize_t overlay_position_show(struct omap_overlay *ovl, char *buf)
127 {
128         return snprintf(buf, PAGE_SIZE, "%d,%d\n",
129                         ovl->info.pos_x, ovl->info.pos_y);
130 }
131
132 static ssize_t overlay_position_store(struct omap_overlay *ovl,
133                 const char *buf, size_t size)
134 {
135         int r;
136         char *last;
137         struct omap_overlay_info info;
138
139         ovl->get_overlay_info(ovl, &info);
140
141         info.pos_x = simple_strtoul(buf, &last, 10);
142         ++last;
143         if (last - buf >= size)
144                 return -EINVAL;
145
146         info.pos_y = simple_strtoul(last, &last, 10);
147
148         r = ovl->set_overlay_info(ovl, &info);
149         if (r)
150                 return r;
151
152         if (ovl->manager) {
153                 r = ovl->manager->apply(ovl->manager);
154                 if (r)
155                         return r;
156         }
157
158         return size;
159 }
160
161 static ssize_t overlay_output_size_show(struct omap_overlay *ovl, char *buf)
162 {
163         return snprintf(buf, PAGE_SIZE, "%d,%d\n",
164                         ovl->info.out_width, ovl->info.out_height);
165 }
166
167 static ssize_t overlay_output_size_store(struct omap_overlay *ovl,
168                 const char *buf, size_t size)
169 {
170         int r;
171         char *last;
172         struct omap_overlay_info info;
173
174         ovl->get_overlay_info(ovl, &info);
175
176         info.out_width = simple_strtoul(buf, &last, 10);
177         ++last;
178         if (last - buf >= size)
179                 return -EINVAL;
180
181         info.out_height = simple_strtoul(last, &last, 10);
182
183         r = ovl->set_overlay_info(ovl, &info);
184         if (r)
185                 return r;
186
187         if (ovl->manager) {
188                 r = ovl->manager->apply(ovl->manager);
189                 if (r)
190                         return r;
191         }
192
193         return size;
194 }
195
196 static ssize_t overlay_enabled_show(struct omap_overlay *ovl, char *buf)
197 {
198         return snprintf(buf, PAGE_SIZE, "%d\n", ovl->info.enabled);
199 }
200
201 static ssize_t overlay_enabled_store(struct omap_overlay *ovl, const char *buf,
202                 size_t size)
203 {
204         int r, enable;
205         struct omap_overlay_info info;
206
207         ovl->get_overlay_info(ovl, &info);
208
209         r = kstrtoint(buf, 0, &enable);
210         if (r)
211                 return r;
212
213         info.enabled = !!enable;
214
215         r = ovl->set_overlay_info(ovl, &info);
216         if (r)
217                 return r;
218
219         if (ovl->manager) {
220                 r = ovl->manager->apply(ovl->manager);
221                 if (r)
222                         return r;
223         }
224
225         return size;
226 }
227
228 static ssize_t overlay_global_alpha_show(struct omap_overlay *ovl, char *buf)
229 {
230         return snprintf(buf, PAGE_SIZE, "%d\n",
231                         ovl->info.global_alpha);
232 }
233
234 static ssize_t overlay_global_alpha_store(struct omap_overlay *ovl,
235                 const char *buf, size_t size)
236 {
237         int r;
238         u8 alpha;
239         struct omap_overlay_info info;
240
241         r = kstrtou8(buf, 0, &alpha);
242         if (r)
243                 return r;
244
245         ovl->get_overlay_info(ovl, &info);
246
247         /* Video1 plane does not support global alpha
248          * to always make it 255 completely opaque
249          */
250         if (!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) &&
251                         ovl->id == OMAP_DSS_VIDEO1)
252                 info.global_alpha = 255;
253         else
254                 info.global_alpha = alpha;
255
256         r = ovl->set_overlay_info(ovl, &info);
257         if (r)
258                 return r;
259
260         if (ovl->manager) {
261                 r = ovl->manager->apply(ovl->manager);
262                 if (r)
263                         return r;
264         }
265
266         return size;
267 }
268
269 static ssize_t overlay_pre_mult_alpha_show(struct omap_overlay *ovl,
270                 char *buf)
271 {
272         return snprintf(buf, PAGE_SIZE, "%d\n",
273                         ovl->info.pre_mult_alpha);
274 }
275
276 static ssize_t overlay_pre_mult_alpha_store(struct omap_overlay *ovl,
277                 const char *buf, size_t size)
278 {
279         int r;
280         u8 alpha;
281         struct omap_overlay_info info;
282
283         r = kstrtou8(buf, 0, &alpha);
284         if (r)
285                 return r;
286
287         ovl->get_overlay_info(ovl, &info);
288
289         /* only GFX and Video2 plane support pre alpha multiplied
290          * set zero for Video1 plane
291          */
292         if (!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) &&
293                 ovl->id == OMAP_DSS_VIDEO1)
294                 info.pre_mult_alpha = 0;
295         else
296                 info.pre_mult_alpha = alpha;
297
298         r = ovl->set_overlay_info(ovl, &info);
299         if (r)
300                 return r;
301
302         if (ovl->manager) {
303                 r = ovl->manager->apply(ovl->manager);
304                 if (r)
305                         return r;
306         }
307
308         return size;
309 }
310
311 struct overlay_attribute {
312         struct attribute attr;
313         ssize_t (*show)(struct omap_overlay *, char *);
314         ssize_t (*store)(struct omap_overlay *, const char *, size_t);
315 };
316
317 #define OVERLAY_ATTR(_name, _mode, _show, _store) \
318         struct overlay_attribute overlay_attr_##_name = \
319         __ATTR(_name, _mode, _show, _store)
320
321 static OVERLAY_ATTR(name, S_IRUGO, overlay_name_show, NULL);
322 static OVERLAY_ATTR(manager, S_IRUGO|S_IWUSR,
323                 overlay_manager_show, overlay_manager_store);
324 static OVERLAY_ATTR(input_size, S_IRUGO, overlay_input_size_show, NULL);
325 static OVERLAY_ATTR(screen_width, S_IRUGO, overlay_screen_width_show, NULL);
326 static OVERLAY_ATTR(position, S_IRUGO|S_IWUSR,
327                 overlay_position_show, overlay_position_store);
328 static OVERLAY_ATTR(output_size, S_IRUGO|S_IWUSR,
329                 overlay_output_size_show, overlay_output_size_store);
330 static OVERLAY_ATTR(enabled, S_IRUGO|S_IWUSR,
331                 overlay_enabled_show, overlay_enabled_store);
332 static OVERLAY_ATTR(global_alpha, S_IRUGO|S_IWUSR,
333                 overlay_global_alpha_show, overlay_global_alpha_store);
334 static OVERLAY_ATTR(pre_mult_alpha, S_IRUGO|S_IWUSR,
335                 overlay_pre_mult_alpha_show,
336                 overlay_pre_mult_alpha_store);
337
338 static struct attribute *overlay_sysfs_attrs[] = {
339         &overlay_attr_name.attr,
340         &overlay_attr_manager.attr,
341         &overlay_attr_input_size.attr,
342         &overlay_attr_screen_width.attr,
343         &overlay_attr_position.attr,
344         &overlay_attr_output_size.attr,
345         &overlay_attr_enabled.attr,
346         &overlay_attr_global_alpha.attr,
347         &overlay_attr_pre_mult_alpha.attr,
348         NULL
349 };
350
351 static ssize_t overlay_attr_show(struct kobject *kobj, struct attribute *attr,
352                 char *buf)
353 {
354         struct omap_overlay *overlay;
355         struct overlay_attribute *overlay_attr;
356
357         overlay = container_of(kobj, struct omap_overlay, kobj);
358         overlay_attr = container_of(attr, struct overlay_attribute, attr);
359
360         if (!overlay_attr->show)
361                 return -ENOENT;
362
363         return overlay_attr->show(overlay, buf);
364 }
365
366 static ssize_t overlay_attr_store(struct kobject *kobj, struct attribute *attr,
367                 const char *buf, size_t size)
368 {
369         struct omap_overlay *overlay;
370         struct overlay_attribute *overlay_attr;
371
372         overlay = container_of(kobj, struct omap_overlay, kobj);
373         overlay_attr = container_of(attr, struct overlay_attribute, attr);
374
375         if (!overlay_attr->store)
376                 return -ENOENT;
377
378         return overlay_attr->store(overlay, buf, size);
379 }
380
381 static const struct sysfs_ops overlay_sysfs_ops = {
382         .show = overlay_attr_show,
383         .store = overlay_attr_store,
384 };
385
386 static struct kobj_type overlay_ktype = {
387         .sysfs_ops = &overlay_sysfs_ops,
388         .default_attrs = overlay_sysfs_attrs,
389 };
390
391 /* Check if overlay parameters are compatible with display */
392 int dss_check_overlay(struct omap_overlay *ovl, struct omap_dss_device *dssdev)
393 {
394         struct omap_overlay_info *info;
395         u16 outw, outh;
396         u16 dw, dh;
397
398         if (!dssdev)
399                 return 0;
400
401         if (!ovl->info.enabled)
402                 return 0;
403
404         info = &ovl->info;
405
406         if (info->paddr == 0) {
407                 DSSDBG("check_overlay failed: paddr 0\n");
408                 return -EINVAL;
409         }
410
411         dssdev->driver->get_resolution(dssdev, &dw, &dh);
412
413         DSSDBG("check_overlay %d: (%d,%d %dx%d -> %dx%d) disp (%dx%d)\n",
414                         ovl->id,
415                         info->pos_x, info->pos_y,
416                         info->width, info->height,
417                         info->out_width, info->out_height,
418                         dw, dh);
419
420         if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) {
421                 outw = info->width;
422                 outh = info->height;
423         } else {
424                 if (info->out_width == 0)
425                         outw = info->width;
426                 else
427                         outw = info->out_width;
428
429                 if (info->out_height == 0)
430                         outh = info->height;
431                 else
432                         outh = info->out_height;
433         }
434
435         if (dw < info->pos_x + outw) {
436                 DSSDBG("check_overlay failed 1: %d < %d + %d\n",
437                                 dw, info->pos_x, outw);
438                 return -EINVAL;
439         }
440
441         if (dh < info->pos_y + outh) {
442                 DSSDBG("check_overlay failed 2: %d < %d + %d\n",
443                                 dh, info->pos_y, outh);
444                 return -EINVAL;
445         }
446
447         if ((ovl->supported_modes & info->color_mode) == 0) {
448                 DSSERR("overlay doesn't support mode %d\n", info->color_mode);
449                 return -EINVAL;
450         }
451
452         return 0;
453 }
454
455 static int dss_ovl_set_overlay_info(struct omap_overlay *ovl,
456                 struct omap_overlay_info *info)
457 {
458         int r;
459         struct omap_overlay_info old_info;
460
461         old_info = ovl->info;
462         ovl->info = *info;
463
464         if (ovl->manager) {
465                 r = dss_check_overlay(ovl, ovl->manager->device);
466                 if (r) {
467                         ovl->info = old_info;
468                         return r;
469                 }
470         }
471
472         ovl->info_dirty = true;
473
474         return 0;
475 }
476
477 static void dss_ovl_get_overlay_info(struct omap_overlay *ovl,
478                 struct omap_overlay_info *info)
479 {
480         *info = ovl->info;
481 }
482
483 static int dss_ovl_wait_for_go(struct omap_overlay *ovl)
484 {
485         return dss_mgr_wait_for_go_ovl(ovl);
486 }
487
488 static int omap_dss_set_manager(struct omap_overlay *ovl,
489                 struct omap_overlay_manager *mgr)
490 {
491         if (!mgr)
492                 return -EINVAL;
493
494         if (ovl->manager) {
495                 DSSERR("overlay '%s' already has a manager '%s'\n",
496                                 ovl->name, ovl->manager->name);
497                 return -EINVAL;
498         }
499
500         if (ovl->info.enabled) {
501                 DSSERR("overlay has to be disabled to change the manager\n");
502                 return -EINVAL;
503         }
504
505         ovl->manager = mgr;
506
507         dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK);
508         /* XXX: When there is an overlay on a DSI manual update display, and
509          * the overlay is first disabled, then moved to tv, and enabled, we
510          * seem to get SYNC_LOST_DIGIT error.
511          *
512          * Waiting doesn't seem to help, but updating the manual update display
513          * after disabling the overlay seems to fix this. This hints that the
514          * overlay is perhaps somehow tied to the LCD output until the output
515          * is updated.
516          *
517          * Userspace workaround for this is to update the LCD after disabling
518          * the overlay, but before moving the overlay to TV.
519          */
520         dispc_set_channel_out(ovl->id, mgr->id);
521         dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK);
522
523         return 0;
524 }
525
526 static int omap_dss_unset_manager(struct omap_overlay *ovl)
527 {
528         int r;
529
530         if (!ovl->manager) {
531                 DSSERR("failed to detach overlay: manager not set\n");
532                 return -EINVAL;
533         }
534
535         if (ovl->info.enabled) {
536                 DSSERR("overlay has to be disabled to unset the manager\n");
537                 return -EINVAL;
538         }
539
540         r = ovl->wait_for_go(ovl);
541         if (r)
542                 return r;
543
544         ovl->manager = NULL;
545
546         return 0;
547 }
548
549 int omap_dss_get_num_overlays(void)
550 {
551         return num_overlays;
552 }
553 EXPORT_SYMBOL(omap_dss_get_num_overlays);
554
555 struct omap_overlay *omap_dss_get_overlay(int num)
556 {
557         int i = 0;
558         struct omap_overlay *ovl;
559
560         list_for_each_entry(ovl, &overlay_list, list) {
561                 if (i++ == num)
562                         return ovl;
563         }
564
565         return NULL;
566 }
567 EXPORT_SYMBOL(omap_dss_get_overlay);
568
569 static void omap_dss_add_overlay(struct omap_overlay *overlay)
570 {
571         ++num_overlays;
572         list_add_tail(&overlay->list, &overlay_list);
573 }
574
575 static struct omap_overlay *dispc_overlays[MAX_DSS_OVERLAYS];
576
577 void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr)
578 {
579         mgr->num_overlays = dss_feat_get_num_ovls();
580         mgr->overlays = dispc_overlays;
581 }
582
583 #ifdef L4_EXAMPLE
584 static struct omap_overlay *l4_overlays[1];
585 void dss_overlay_setup_l4_manager(struct omap_overlay_manager *mgr)
586 {
587         mgr->num_overlays = 1;
588         mgr->overlays = l4_overlays;
589 }
590 #endif
591
592 void dss_init_overlays(struct platform_device *pdev)
593 {
594         int i, r;
595
596         INIT_LIST_HEAD(&overlay_list);
597
598         num_overlays = 0;
599
600         for (i = 0; i < dss_feat_get_num_ovls(); ++i) {
601                 struct omap_overlay *ovl;
602                 ovl = kzalloc(sizeof(*ovl), GFP_KERNEL);
603
604                 BUG_ON(ovl == NULL);
605
606                 switch (i) {
607                 case 0:
608                         ovl->name = "gfx";
609                         ovl->id = OMAP_DSS_GFX;
610                         ovl->caps = OMAP_DSS_OVL_CAP_DISPC;
611                         ovl->info.global_alpha = 255;
612                         break;
613                 case 1:
614                         ovl->name = "vid1";
615                         ovl->id = OMAP_DSS_VIDEO1;
616                         ovl->caps = OMAP_DSS_OVL_CAP_SCALE |
617                                 OMAP_DSS_OVL_CAP_DISPC;
618                         ovl->info.global_alpha = 255;
619                         break;
620                 case 2:
621                         ovl->name = "vid2";
622                         ovl->id = OMAP_DSS_VIDEO2;
623                         ovl->caps = OMAP_DSS_OVL_CAP_SCALE |
624                                 OMAP_DSS_OVL_CAP_DISPC;
625                         ovl->info.global_alpha = 255;
626                         break;
627                 }
628
629                 ovl->set_manager = &omap_dss_set_manager;
630                 ovl->unset_manager = &omap_dss_unset_manager;
631                 ovl->set_overlay_info = &dss_ovl_set_overlay_info;
632                 ovl->get_overlay_info = &dss_ovl_get_overlay_info;
633                 ovl->wait_for_go = &dss_ovl_wait_for_go;
634
635                 ovl->supported_modes =
636                         dss_feat_get_supported_color_modes(ovl->id);
637
638                 omap_dss_add_overlay(ovl);
639
640                 r = kobject_init_and_add(&ovl->kobj, &overlay_ktype,
641                                 &pdev->dev.kobj, "overlay%d", i);
642
643                 if (r) {
644                         DSSERR("failed to create sysfs file\n");
645                         continue;
646                 }
647
648                 dispc_overlays[i] = ovl;
649         }
650
651 #ifdef L4_EXAMPLE
652         {
653                 struct omap_overlay *ovl;
654                 ovl = kzalloc(sizeof(*ovl), GFP_KERNEL);
655
656                 BUG_ON(ovl == NULL);
657
658                 ovl->name = "l4";
659                 ovl->supported_modes = OMAP_DSS_COLOR_RGB24U;
660
661                 ovl->set_manager = &omap_dss_set_manager;
662                 ovl->unset_manager = &omap_dss_unset_manager;
663                 ovl->set_overlay_info = &dss_ovl_set_overlay_info;
664                 ovl->get_overlay_info = &dss_ovl_get_overlay_info;
665
666                 omap_dss_add_overlay(ovl);
667
668                 r = kobject_init_and_add(&ovl->kobj, &overlay_ktype,
669                                 &pdev->dev.kobj, "overlayl4");
670
671                 if (r)
672                         DSSERR("failed to create sysfs file\n");
673
674                 l4_overlays[0] = ovl;
675         }
676 #endif
677 }
678
679 /* connect overlays to the new device, if not already connected. if force
680  * selected, connect always. */
681 void dss_recheck_connections(struct omap_dss_device *dssdev, bool force)
682 {
683         int i;
684         struct omap_overlay_manager *lcd_mgr;
685         struct omap_overlay_manager *tv_mgr;
686         struct omap_overlay_manager *lcd2_mgr = NULL;
687         struct omap_overlay_manager *mgr = NULL;
688
689         lcd_mgr = omap_dss_get_overlay_manager(OMAP_DSS_OVL_MGR_LCD);
690         tv_mgr = omap_dss_get_overlay_manager(OMAP_DSS_OVL_MGR_TV);
691         if (dss_has_feature(FEAT_MGR_LCD2))
692                 lcd2_mgr = omap_dss_get_overlay_manager(OMAP_DSS_OVL_MGR_LCD2);
693
694         if (dssdev->channel == OMAP_DSS_CHANNEL_LCD2) {
695                 if (!lcd2_mgr->device || force) {
696                         if (lcd2_mgr->device)
697                                 lcd2_mgr->unset_device(lcd2_mgr);
698                         lcd2_mgr->set_device(lcd2_mgr, dssdev);
699                         mgr = lcd2_mgr;
700                 }
701         } else if (dssdev->type != OMAP_DISPLAY_TYPE_VENC
702                         && dssdev->type != OMAP_DISPLAY_TYPE_HDMI) {
703                 if (!lcd_mgr->device || force) {
704                         if (lcd_mgr->device)
705                                 lcd_mgr->unset_device(lcd_mgr);
706                         lcd_mgr->set_device(lcd_mgr, dssdev);
707                         mgr = lcd_mgr;
708                 }
709         }
710
711         if (dssdev->type == OMAP_DISPLAY_TYPE_VENC
712                         || dssdev->type == OMAP_DISPLAY_TYPE_HDMI) {
713                 if (!tv_mgr->device || force) {
714                         if (tv_mgr->device)
715                                 tv_mgr->unset_device(tv_mgr);
716                         tv_mgr->set_device(tv_mgr, dssdev);
717                         mgr = tv_mgr;
718                 }
719         }
720
721         if (mgr) {
722                 for (i = 0; i < dss_feat_get_num_ovls(); i++) {
723                         struct omap_overlay *ovl;
724                         ovl = omap_dss_get_overlay(i);
725                         if (!ovl->manager || force) {
726                                 if (ovl->manager)
727                                         omap_dss_unset_manager(ovl);
728                                 omap_dss_set_manager(ovl, mgr);
729                         }
730                 }
731         }
732 }
733
734 void dss_uninit_overlays(struct platform_device *pdev)
735 {
736         struct omap_overlay *ovl;
737
738         while (!list_empty(&overlay_list)) {
739                 ovl = list_first_entry(&overlay_list,
740                                 struct omap_overlay, list);
741                 list_del(&ovl->list);
742                 kobject_del(&ovl->kobj);
743                 kobject_put(&ovl->kobj);
744                 kfree(ovl);
745         }
746
747         num_overlays = 0;
748 }
749