aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/sm501fb.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index f31252ce8892..46d1a64fe80d 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -1729,6 +1729,15 @@ static int sm501fb_init_fb(struct fb_info *fb,
1729 FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | 1729 FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT |
1730 FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN; 1730 FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
1731 1731
1732#if defined(CONFIG_OF)
1733#ifdef __BIG_ENDIAN
1734 if (of_get_property(info->dev->parent->of_node, "little-endian", NULL))
1735 fb->flags |= FBINFO_FOREIGN_ENDIAN;
1736#else
1737 if (of_get_property(info->dev->parent->of_node, "big-endian", NULL))
1738 fb->flags |= FBINFO_FOREIGN_ENDIAN;
1739#endif
1740#endif
1732 /* fixed data */ 1741 /* fixed data */
1733 1742
1734 fb->fix.type = FB_TYPE_PACKED_PIXELS; 1743 fb->fix.type = FB_TYPE_PACKED_PIXELS;
@@ -1765,14 +1774,17 @@ static int sm501fb_init_fb(struct fb_info *fb,
1765 fb->var.xres_virtual = fb->var.xres; 1774 fb->var.xres_virtual = fb->var.xres;
1766 fb->var.yres_virtual = fb->var.yres; 1775 fb->var.yres_virtual = fb->var.yres;
1767 } else { 1776 } else {
1768 if (info->edid_data) 1777 if (info->edid_data) {
1769 ret = fb_find_mode(&fb->var, fb, fb_mode, 1778 ret = fb_find_mode(&fb->var, fb, fb_mode,
1770 fb->monspecs.modedb, 1779 fb->monspecs.modedb,
1771 fb->monspecs.modedb_len, 1780 fb->monspecs.modedb_len,
1772 &sm501_default_mode, default_bpp); 1781 &sm501_default_mode, default_bpp);
1773 else 1782 /* edid_data is no longer needed, free it */
1783 kfree(info->edid_data);
1784 } else {
1774 ret = fb_find_mode(&fb->var, fb, 1785 ret = fb_find_mode(&fb->var, fb,
1775 NULL, NULL, 0, NULL, 8); 1786 NULL, NULL, 0, NULL, 8);
1787 }
1776 1788
1777 switch (ret) { 1789 switch (ret) {
1778 case 1: 1790 case 1:
@@ -1933,8 +1945,32 @@ static int __devinit sm501fb_probe(struct platform_device *pdev)
1933 } 1945 }
1934 1946
1935 if (info->pdata == NULL) { 1947 if (info->pdata == NULL) {
1936 dev_info(dev, "using default configuration data\n"); 1948 int found = 0;
1949#if defined(CONFIG_OF)
1950 struct device_node *np = pdev->dev.parent->of_node;
1951 const u8 *prop;
1952 const char *cp;
1953 int len;
1954
1937 info->pdata = &sm501fb_def_pdata; 1955 info->pdata = &sm501fb_def_pdata;
1956 if (np) {
1957 /* Get EDID */
1958 cp = of_get_property(np, "mode", &len);
1959 if (cp)
1960 strcpy(fb_mode, cp);
1961 prop = of_get_property(np, "edid", &len);
1962 if (prop && len == EDID_LENGTH) {
1963 info->edid_data = kmemdup(prop, EDID_LENGTH,
1964 GFP_KERNEL);
1965 if (info->edid_data)
1966 found = 1;
1967 }
1968 }
1969#endif
1970 if (!found) {
1971 dev_info(dev, "using default configuration data\n");
1972 info->pdata = &sm501fb_def_pdata;
1973 }
1938 } 1974 }
1939 1975
1940 /* probe for the presence of each panel */ 1976 /* probe for the presence of each panel */