~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to drivers/video/omap2/omapfb/omapfb-main.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
static int def_vrfb;
49
49
static int def_rotate;
50
50
static int def_mirror;
 
51
static bool auto_update;
 
52
static unsigned int auto_update_freq;
 
53
module_param(auto_update, bool, 0);
 
54
module_param(auto_update_freq, uint, 0644);
51
55
 
52
56
#ifdef DEBUG
53
57
unsigned int omapfb_debug;
806
810
static void omapfb_calc_addr(const struct omapfb_info *ofbi,
807
811
                             const struct fb_var_screeninfo *var,
808
812
                             const struct fb_fix_screeninfo *fix,
809
 
                             int rotation, u32 *paddr, void __iomem **vaddr)
 
813
                             int rotation, u32 *paddr)
810
814
{
811
815
        u32 data_start_p;
812
 
        void __iomem *data_start_v;
813
816
        int offset;
814
817
 
815
 
        if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
 
818
        if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
816
819
                data_start_p = omapfb_get_region_rot_paddr(ofbi, rotation);
817
 
                data_start_v = NULL;
818
 
        } else {
 
820
        else
819
821
                data_start_p = omapfb_get_region_paddr(ofbi);
820
 
                data_start_v = omapfb_get_region_vaddr(ofbi);
821
 
        }
822
822
 
823
823
        if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
824
824
                offset = calc_rotation_offset_vrfb(var, fix, rotation);
826
826
                offset = calc_rotation_offset_dma(var, fix, rotation);
827
827
 
828
828
        data_start_p += offset;
829
 
        data_start_v += offset;
830
829
 
831
830
        if (offset)
832
831
                DBG("offset %d, %d = %d\n",
833
832
                    var->xoffset, var->yoffset, offset);
834
833
 
835
 
        DBG("paddr %x, vaddr %p\n", data_start_p, data_start_v);
 
834
        DBG("paddr %x\n", data_start_p);
836
835
 
837
836
        *paddr = data_start_p;
838
 
        *vaddr = data_start_v;
839
837
}
840
838
 
841
839
/* setup overlay according to the fb */
848
846
        struct fb_fix_screeninfo *fix = &fbi->fix;
849
847
        enum omap_color_mode mode = 0;
850
848
        u32 data_start_p = 0;
851
 
        void __iomem *data_start_v = NULL;
852
849
        struct omap_overlay_info info;
853
850
        int xres, yres;
854
851
        int screen_width;
878
875
        }
879
876
 
880
877
        if (ofbi->region->size)
881
 
                omapfb_calc_addr(ofbi, var, fix, rotation,
882
 
                                 &data_start_p, &data_start_v);
 
878
                omapfb_calc_addr(ofbi, var, fix, rotation, &data_start_p);
883
879
 
884
880
        r = fb_mode_to_dss_mode(var, &mode);
885
881
        if (r) {
908
904
                mirror = ofbi->mirror;
909
905
 
910
906
        info.paddr = data_start_p;
911
 
        info.vaddr = data_start_v;
912
907
        info.screen_width = screen_width;
913
908
        info.width = xres;
914
909
        info.height = yres;
1244
1239
        struct omapfb_info *ofbi = FB2OFB(fbi);
1245
1240
        struct omapfb2_device *fbdev = ofbi->fbdev;
1246
1241
        struct omap_dss_device *display = fb2display(fbi);
 
1242
        struct omapfb_display_data *d;
1247
1243
        int r = 0;
1248
1244
 
1249
1245
        if (!display)
1251
1247
 
1252
1248
        omapfb_lock(fbdev);
1253
1249
 
 
1250
        d = get_display_data(fbdev, display);
 
1251
 
1254
1252
        switch (blank) {
1255
1253
        case FB_BLANK_UNBLANK:
1256
1254
                if (display->state != OMAP_DSS_DISPLAY_SUSPENDED)
1259
1257
                if (display->driver->resume)
1260
1258
                        r = display->driver->resume(display);
1261
1259
 
 
1260
                if ((display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) &&
 
1261
                                d->update_mode == OMAPFB_AUTO_UPDATE &&
 
1262
                                !d->auto_update_work_enabled)
 
1263
                        omapfb_start_auto_update(fbdev, display);
 
1264
 
1262
1265
                break;
1263
1266
 
1264
1267
        case FB_BLANK_NORMAL:
1270
1273
                if (display->state != OMAP_DSS_DISPLAY_ACTIVE)
1271
1274
                        goto exit;
1272
1275
 
 
1276
                if (d->auto_update_work_enabled)
 
1277
                        omapfb_stop_auto_update(fbdev, display);
 
1278
 
1273
1279
                if (display->driver->suspend)
1274
1280
                        r = display->driver->suspend(display);
1275
1281
 
1726
1732
        return r;
1727
1733
}
1728
1734
 
 
1735
static void omapfb_auto_update_work(struct work_struct *work)
 
1736
{
 
1737
        struct omap_dss_device *dssdev;
 
1738
        struct omap_dss_driver *dssdrv;
 
1739
        struct omapfb_display_data *d;
 
1740
        u16 w, h;
 
1741
        unsigned int freq;
 
1742
        struct omapfb2_device *fbdev;
 
1743
 
 
1744
        d = container_of(work, struct omapfb_display_data,
 
1745
                        auto_update_work.work);
 
1746
 
 
1747
        dssdev = d->dssdev;
 
1748
        dssdrv = dssdev->driver;
 
1749
        fbdev = d->fbdev;
 
1750
 
 
1751
        if (!dssdrv || !dssdrv->update)
 
1752
                return;
 
1753
 
 
1754
        if (dssdrv->sync)
 
1755
                dssdrv->sync(dssdev);
 
1756
 
 
1757
        dssdrv->get_resolution(dssdev, &w, &h);
 
1758
        dssdrv->update(dssdev, 0, 0, w, h);
 
1759
 
 
1760
        freq = auto_update_freq;
 
1761
        if (freq == 0)
 
1762
                freq = 20;
 
1763
        queue_delayed_work(fbdev->auto_update_wq,
 
1764
                        &d->auto_update_work, HZ / freq);
 
1765
}
 
1766
 
 
1767
void omapfb_start_auto_update(struct omapfb2_device *fbdev,
 
1768
                struct omap_dss_device *display)
 
1769
{
 
1770
        struct omapfb_display_data *d;
 
1771
 
 
1772
        if (fbdev->auto_update_wq == NULL) {
 
1773
                struct workqueue_struct *wq;
 
1774
 
 
1775
                wq = create_singlethread_workqueue("omapfb_auto_update");
 
1776
 
 
1777
                if (wq == NULL) {
 
1778
                        dev_err(fbdev->dev, "Failed to create workqueue for "
 
1779
                                        "auto-update\n");
 
1780
                        return;
 
1781
                }
 
1782
 
 
1783
                fbdev->auto_update_wq = wq;
 
1784
        }
 
1785
 
 
1786
        d = get_display_data(fbdev, display);
 
1787
 
 
1788
        INIT_DELAYED_WORK(&d->auto_update_work, omapfb_auto_update_work);
 
1789
 
 
1790
        d->auto_update_work_enabled = true;
 
1791
 
 
1792
        omapfb_auto_update_work(&d->auto_update_work.work);
 
1793
}
 
1794
 
 
1795
void omapfb_stop_auto_update(struct omapfb2_device *fbdev,
 
1796
                struct omap_dss_device *display)
 
1797
{
 
1798
        struct omapfb_display_data *d;
 
1799
 
 
1800
        d = get_display_data(fbdev, display);
 
1801
 
 
1802
        cancel_delayed_work_sync(&d->auto_update_work);
 
1803
 
 
1804
        d->auto_update_work_enabled = false;
 
1805
}
 
1806
 
1729
1807
/* initialize fb_info, var, fix to something sane based on the display */
1730
1808
static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi)
1731
1809
{
1860
1938
        }
1861
1939
 
1862
1940
        for (i = 0; i < fbdev->num_displays; i++) {
1863
 
                if (fbdev->displays[i]->state != OMAP_DSS_DISPLAY_DISABLED)
1864
 
                        fbdev->displays[i]->driver->disable(fbdev->displays[i]);
1865
 
 
1866
 
                omap_dss_put_device(fbdev->displays[i]);
 
1941
                struct omap_dss_device *dssdev = fbdev->displays[i].dssdev;
 
1942
 
 
1943
                if (fbdev->displays[i].auto_update_work_enabled)
 
1944
                        omapfb_stop_auto_update(fbdev, dssdev);
 
1945
 
 
1946
                if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)
 
1947
                        dssdev->driver->disable(dssdev);
 
1948
 
 
1949
                omap_dss_put_device(dssdev);
 
1950
        }
 
1951
 
 
1952
        if (fbdev->auto_update_wq != NULL) {
 
1953
                flush_workqueue(fbdev->auto_update_wq);
 
1954
                destroy_workqueue(fbdev->auto_update_wq);
 
1955
                fbdev->auto_update_wq = NULL;
1867
1956
        }
1868
1957
 
1869
1958
        dev_set_drvdata(fbdev->dev, NULL);
1870
1959
        kfree(fbdev);
1871
1960
}
1872
1961
 
1873
 
static void size_notify(struct fb_info *fbi, int w, int h)
1874
 
{
1875
 
        struct omapfb_info *ofbi = FB2OFB(fbi);
1876
 
        struct fb_var_screeninfo var = fbi->var;
1877
 
        struct fb_var_screeninfo saved_var = fbi->var;
1878
 
        int orig_flags;
1879
 
        int new_size = (w * var.bits_per_pixel >> 3) * h;
1880
 
 
1881
 
        DBG("size_notify: %dx%d\n", w, h);
1882
 
 
1883
 
        var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_ALL | FB_ACTIVATE_NOW;
1884
 
        var.xres = w;
1885
 
        var.yres = h;
1886
 
        var.xres_virtual = w;
1887
 
        var.yres_virtual = h;
1888
 
 
1889
 
        console_lock();
1890
 
 
1891
 
        /* Try to increase memory allocated for FB, if needed */
1892
 
        if (new_size > ofbi->region->size) {
1893
 
                DBG("re-allocating FB - old size: %ld - new size: %d\n", ofbi->region->size, new_size);
1894
 
                omapfb_get_mem_region(ofbi->region);
1895
 
                omapfb_realloc_fbmem(fbi, new_size, 0);
1896
 
                omapfb_put_mem_region(ofbi->region);
1897
 
        }
1898
 
 
1899
 
        /* this ensures fbdev clients, like the console driver, get notified about
1900
 
         * the change:
1901
 
         */
1902
 
        orig_flags = fbi->flags;
1903
 
        fbi->flags |= FBINFO_MISC_USEREVENT;
1904
 
        fb_set_var(fbi, &var);
1905
 
        fbi->flags &= ~FBINFO_MISC_USEREVENT;
1906
 
 
1907
 
        /* now delete old mode:
1908
 
         */
1909
 
        saved_var.activate |= FB_ACTIVATE_INV_MODE;
1910
 
        fbi->flags |= FBINFO_MISC_USEREVENT;
1911
 
        fb_set_var(fbi, &saved_var);
1912
 
        fbi->flags = orig_flags;
1913
 
 
1914
 
        console_unlock();
1915
 
}
1916
 
 
1917
 
struct omapfb_notifier_block {
1918
 
        struct notifier_block notifier;
1919
 
        struct omapfb2_device *fbdev;
1920
 
};
1921
 
 
1922
 
static int omapfb_notifier(struct notifier_block *nb,
1923
 
                unsigned long evt, void *arg)
1924
 
{
1925
 
        struct omapfb_notifier_block *notifier =
1926
 
                        container_of(nb, struct omapfb_notifier_block, notifier);
1927
 
        struct omap_dss_device *dssdev = arg;
1928
 
        struct omapfb2_device *fbdev = notifier->fbdev;
1929
 
        int keep = false;
1930
 
        int i;
1931
 
 
1932
 
        /* figure out if this event pertains to this omapfb device:
1933
 
         */
1934
 
        for (i = 0; i < fbdev->num_managers; i++) {
1935
 
                if (fbdev->managers[i]->device == dssdev) {
1936
 
                        keep = true;
1937
 
                        break;
1938
 
                }
1939
 
        }
1940
 
 
1941
 
        if (!keep)
1942
 
                return NOTIFY_DONE;
1943
 
 
1944
 
        /* the event pertains to us.. see if we care:
1945
 
         */
1946
 
        switch (evt) {
1947
 
                case OMAP_DSS_SIZE_CHANGE: {
1948
 
                        u16 w, h;
1949
 
                        dssdev->driver->get_resolution(dssdev, &w, &h);
1950
 
                        for (i = 0; i < fbdev->num_fbs; i++)
1951
 
                                size_notify(fbdev->fbs[i], w, h);
1952
 
                        break;
1953
 
                }
1954
 
                default:  /* don't care about other events for now */
1955
 
                        break;
1956
 
        }
1957
 
 
1958
 
        return NOTIFY_OK;
1959
 
}
1960
 
 
1961
1962
static int omapfb_create_framebuffers(struct omapfb2_device *fbdev)
1962
1963
{
1963
1964
        int r, i;
2174
2175
        int r;
2175
2176
        u8 bpp;
2176
2177
        struct omap_video_timings timings, temp_timings;
 
2178
        struct omapfb_display_data *d;
2177
2179
 
2178
2180
        r = omapfb_mode_to_timings(mode_str, &timings, &bpp);
2179
2181
        if (r)
2180
2182
                return r;
2181
2183
 
2182
 
        fbdev->bpp_overrides[fbdev->num_bpp_overrides].dssdev = display;
2183
 
        fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp;
2184
 
        ++fbdev->num_bpp_overrides;
 
2184
        d = get_display_data(fbdev, display);
 
2185
        d->bpp_override = bpp;
2185
2186
 
2186
2187
        if (display->driver->check_timings) {
2187
2188
                r = display->driver->check_timings(display, &timings);
2207
2208
static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev,
2208
2209
                struct omap_dss_device *dssdev)
2209
2210
{
2210
 
        int i;
 
2211
        struct omapfb_display_data *d;
2211
2212
 
2212
2213
        BUG_ON(dssdev->driver->get_recommended_bpp == NULL);
2213
2214
 
2214
 
        for (i = 0; i < fbdev->num_bpp_overrides; ++i) {
2215
 
                if (dssdev == fbdev->bpp_overrides[i].dssdev)
2216
 
                        return fbdev->bpp_overrides[i].bpp;
2217
 
        }
 
2215
        d = get_display_data(fbdev, dssdev);
 
2216
 
 
2217
        if (d->bpp_override != 0)
 
2218
                return d->bpp_override;
2218
2219
 
2219
2220
        return dssdev->driver->get_recommended_bpp(dssdev);
2220
2221
}
2246
2247
 
2247
2248
                display = NULL;
2248
2249
                for (i = 0; i < fbdev->num_displays; ++i) {
2249
 
                        if (strcmp(fbdev->displays[i]->name,
 
2250
                        if (strcmp(fbdev->displays[i].dssdev->name,
2250
2251
                                                display_str) == 0) {
2251
 
                                display = fbdev->displays[i];
 
2252
                                display = fbdev->displays[i].dssdev;
2252
2253
                                break;
2253
2254
                        }
2254
2255
                }
2268
2269
        return r;
2269
2270
}
2270
2271
 
 
2272
static void fb_videomode_to_omap_timings(struct fb_videomode *m,
 
2273
                struct omap_video_timings *t)
 
2274
{
 
2275
        t->x_res = m->xres;
 
2276
        t->y_res = m->yres;
 
2277
        t->pixel_clock = PICOS2KHZ(m->pixclock);
 
2278
        t->hsw = m->hsync_len;
 
2279
        t->hfp = m->right_margin;
 
2280
        t->hbp = m->left_margin;
 
2281
        t->vsw = m->vsync_len;
 
2282
        t->vfp = m->lower_margin;
 
2283
        t->vbp = m->upper_margin;
 
2284
}
 
2285
 
 
2286
static int omapfb_find_best_mode(struct omap_dss_device *display,
 
2287
                struct omap_video_timings *timings)
 
2288
{
 
2289
        struct fb_monspecs *specs;
 
2290
        u8 *edid;
 
2291
        int r, i, best_xres, best_idx, len;
 
2292
 
 
2293
        if (!display->driver->read_edid)
 
2294
                return -ENODEV;
 
2295
 
 
2296
        len = 0x80 * 2;
 
2297
        edid = kmalloc(len, GFP_KERNEL);
 
2298
 
 
2299
        r = display->driver->read_edid(display, edid, len);
 
2300
        if (r < 0)
 
2301
                goto err1;
 
2302
 
 
2303
        specs = kzalloc(sizeof(*specs), GFP_KERNEL);
 
2304
 
 
2305
        fb_edid_to_monspecs(edid, specs);
 
2306
 
 
2307
        if (edid[126] > 0)
 
2308
                fb_edid_add_monspecs(edid + 0x80, specs);
 
2309
 
 
2310
        best_xres = 0;
 
2311
        best_idx = -1;
 
2312
 
 
2313
        for (i = 0; i < specs->modedb_len; ++i) {
 
2314
                struct fb_videomode *m;
 
2315
                struct omap_video_timings t;
 
2316
 
 
2317
                m = &specs->modedb[i];
 
2318
 
 
2319
                if (m->pixclock == 0)
 
2320
                        continue;
 
2321
 
 
2322
                /* skip repeated pixel modes */
 
2323
                if (m->xres == 2880 || m->xres == 1440)
 
2324
                        continue;
 
2325
 
 
2326
                fb_videomode_to_omap_timings(m, &t);
 
2327
 
 
2328
                r = display->driver->check_timings(display, &t);
 
2329
                if (r == 0 && best_xres < m->xres) {
 
2330
                        best_xres = m->xres;
 
2331
                        best_idx = i;
 
2332
                }
 
2333
        }
 
2334
 
 
2335
        if (best_xres == 0) {
 
2336
                r = -ENOENT;
 
2337
                goto err2;
 
2338
        }
 
2339
 
 
2340
        fb_videomode_to_omap_timings(&specs->modedb[best_idx], timings);
 
2341
 
 
2342
        r = 0;
 
2343
 
 
2344
err2:
 
2345
        fb_destroy_modedb(specs->modedb);
 
2346
        kfree(specs);
 
2347
err1:
 
2348
        kfree(edid);
 
2349
 
 
2350
        return r;
 
2351
}
 
2352
 
2271
2353
static int omapfb_init_display(struct omapfb2_device *fbdev,
2272
2354
                struct omap_dss_device *dssdev)
2273
2355
{
2274
2356
        struct omap_dss_driver *dssdrv = dssdev->driver;
 
2357
        struct omapfb_display_data *d;
2275
2358
        int r;
2276
2359
 
2277
2360
        r = dssdrv->enable(dssdev);
2281
2364
                return r;
2282
2365
        }
2283
2366
 
 
2367
        d = get_display_data(fbdev, dssdev);
 
2368
 
 
2369
        d->fbdev = fbdev;
 
2370
 
2284
2371
        if (dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
2285
2372
                u16 w, h;
 
2373
 
 
2374
                if (auto_update) {
 
2375
                        omapfb_start_auto_update(fbdev, dssdev);
 
2376
                        d->update_mode = OMAPFB_AUTO_UPDATE;
 
2377
                } else {
 
2378
                        d->update_mode = OMAPFB_MANUAL_UPDATE;
 
2379
                }
 
2380
 
2286
2381
                if (dssdrv->enable_te) {
2287
2382
                        r = dssdrv->enable_te(dssdev, 1);
2288
2383
                        if (r) {
2291
2386
                        }
2292
2387
                }
2293
2388
 
2294
 
                if (dssdrv->set_update_mode) {
2295
 
                        r = dssdrv->set_update_mode(dssdev,
2296
 
                                        OMAP_DSS_UPDATE_MANUAL);
2297
 
                        if (r) {
2298
 
                                dev_err(fbdev->dev,
2299
 
                                                "Failed to set update mode\n");
2300
 
                                return r;
2301
 
                        }
2302
 
                }
2303
 
 
2304
2389
                dssdrv->get_resolution(dssdev, &w, &h);
2305
2390
                r = dssdrv->update(dssdev, 0, 0, w, h);
2306
2391
                if (r) {
2309
2394
                        return r;
2310
2395
                }
2311
2396
        } else {
2312
 
                if (dssdrv->set_update_mode) {
2313
 
                        r = dssdrv->set_update_mode(dssdev,
2314
 
                                        OMAP_DSS_UPDATE_AUTO);
2315
 
                        if (r) {
2316
 
                                dev_err(fbdev->dev,
2317
 
                                                "Failed to set update mode\n");
2318
 
                                return r;
2319
 
                        }
2320
 
                }
 
2397
                d->update_mode = OMAPFB_AUTO_UPDATE;
2321
2398
        }
2322
2399
 
2323
2400
        return 0;
2396
2473
        fbdev->num_displays = 0;
2397
2474
        dssdev = NULL;
2398
2475
        for_each_dss_dev(dssdev) {
2399
 
                struct omapfb_notifier_block *notifier;
 
2476
                struct omapfb_display_data *d;
 
2477
 
2400
2478
                omap_dss_get_device(dssdev);
2401
2479
 
2402
2480
                if (!dssdev->driver) {
2403
 
                        dev_err(&pdev->dev, "no driver for display\n");
2404
 
                        r = -ENODEV;
 
2481
                        dev_warn(&pdev->dev, "no driver for display: %s\n",
 
2482
                                dssdev->name);
 
2483
                        omap_dss_put_device(dssdev);
 
2484
                        continue;
2405
2485
                }
2406
2486
 
2407
 
                fbdev->displays[fbdev->num_displays++] = dssdev;
2408
 
 
2409
 
                notifier = kzalloc(sizeof(struct omapfb_notifier_block), GFP_KERNEL);
2410
 
                notifier->notifier.notifier_call = omapfb_notifier;
2411
 
                notifier->fbdev = fbdev;
2412
 
                omap_dss_add_notify(dssdev, &notifier->notifier);
 
2487
                d = &fbdev->displays[fbdev->num_displays++];
 
2488
                d->dssdev = dssdev;
 
2489
                if (dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE)
 
2490
                        d->update_mode = OMAPFB_MANUAL_UPDATE;
 
2491
                else
 
2492
                        d->update_mode = OMAPFB_AUTO_UPDATE;
2413
2493
        }
2414
2494
 
2415
2495
        if (r)
2429
2509
        for (i = 0; i < fbdev->num_managers; i++)
2430
2510
                fbdev->managers[i] = omap_dss_get_overlay_manager(i);
2431
2511
 
 
2512
        /* gfx overlay should be the default one. find a display
 
2513
         * connected to that, and use it as default display */
 
2514
        ovl = omap_dss_get_overlay(0);
 
2515
        if (ovl->manager && ovl->manager->device) {
 
2516
                def_display = ovl->manager->device;
 
2517
        } else {
 
2518
                dev_warn(&pdev->dev, "cannot find default display\n");
 
2519
                def_display = NULL;
 
2520
        }
 
2521
 
2432
2522
        if (def_mode && strlen(def_mode) > 0) {
2433
2523
                if (omapfb_parse_def_modes(fbdev))
2434
2524
                        dev_warn(&pdev->dev, "cannot parse default modes\n");
 
2525
        } else if (def_display && def_display->driver->set_timings &&
 
2526
                        def_display->driver->check_timings) {
 
2527
                struct omap_video_timings t;
 
2528
 
 
2529
                r = omapfb_find_best_mode(def_display, &t);
 
2530
 
 
2531
                if (r == 0)
 
2532
                        def_display->driver->set_timings(def_display, &t);
2435
2533
        }
2436
2534
 
2437
2535
        r = omapfb_create_framebuffers(fbdev);
2448
2546
 
2449
2547
        DBG("mgr->apply'ed\n");
2450
2548
 
2451
 
        /* gfx overlay should be the default one. find a display
2452
 
         * connected to that, and use it as default display */
2453
 
        ovl = omap_dss_get_overlay(0);
2454
 
        if (ovl->manager && ovl->manager->device) {
2455
 
                def_display = ovl->manager->device;
2456
 
        } else {
2457
 
                dev_warn(&pdev->dev, "cannot find default display\n");
2458
 
                def_display = NULL;
2459
 
        }
2460
 
 
2461
2549
        if (def_display) {
2462
2550
                r = omapfb_init_display(fbdev, def_display);
2463
2551
                if (r) {