diff options
Diffstat (limited to 'drivers/video/au1200fb.c')
-rw-r--r-- | drivers/video/au1200fb.c | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index 480ecb1b9d0b..4b58f7ba5728 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c | |||
@@ -46,10 +46,6 @@ | |||
46 | #include <asm/mach-au1x00/au1000.h> | 46 | #include <asm/mach-au1x00/au1000.h> |
47 | #include "au1200fb.h" | 47 | #include "au1200fb.h" |
48 | 48 | ||
49 | #ifndef CONFIG_FB_AU1200_DEVS | ||
50 | #define CONFIG_FB_AU1200_DEVS 4 | ||
51 | #endif | ||
52 | |||
53 | #define DRIVER_NAME "au1200fb" | 49 | #define DRIVER_NAME "au1200fb" |
54 | #define DRIVER_DESC "LCD controller driver for AU1200 processors" | 50 | #define DRIVER_DESC "LCD controller driver for AU1200 processors" |
55 | 51 | ||
@@ -154,7 +150,6 @@ struct au1200fb_device { | |||
154 | dma_addr_t fb_phys; | 150 | dma_addr_t fb_phys; |
155 | }; | 151 | }; |
156 | 152 | ||
157 | static struct fb_info *_au1200fb_infos[CONFIG_FB_AU1200_DEVS]; | ||
158 | /********************************************************************/ | 153 | /********************************************************************/ |
159 | 154 | ||
160 | /* LCD controller restrictions */ | 155 | /* LCD controller restrictions */ |
@@ -167,10 +162,18 @@ static struct fb_info *_au1200fb_infos[CONFIG_FB_AU1200_DEVS]; | |||
167 | /* Default number of visible screen buffer to allocate */ | 162 | /* Default number of visible screen buffer to allocate */ |
168 | #define AU1200FB_NBR_VIDEO_BUFFERS 1 | 163 | #define AU1200FB_NBR_VIDEO_BUFFERS 1 |
169 | 164 | ||
165 | /* Default maximum number of fb devices to create */ | ||
166 | #define MAX_DEVICE_COUNT 4 | ||
167 | |||
168 | /* Default window configuration entry to use (see windows[]) */ | ||
169 | #define DEFAULT_WINDOW_INDEX 2 | ||
170 | |||
170 | /********************************************************************/ | 171 | /********************************************************************/ |
171 | 172 | ||
173 | static struct fb_info *_au1200fb_infos[MAX_DEVICE_COUNT]; | ||
172 | static struct au1200_lcd *lcd = (struct au1200_lcd *) AU1200_LCD_ADDR; | 174 | static struct au1200_lcd *lcd = (struct au1200_lcd *) AU1200_LCD_ADDR; |
173 | static int window_index = 2; /* default is zero */ | 175 | static int device_count = MAX_DEVICE_COUNT; |
176 | static int window_index = DEFAULT_WINDOW_INDEX; /* default is zero */ | ||
174 | static int panel_index = 2; /* default is zero */ | 177 | static int panel_index = 2; /* default is zero */ |
175 | static struct window_settings *win; | 178 | static struct window_settings *win; |
176 | static struct panel_settings *panel; | 179 | static struct panel_settings *panel; |
@@ -683,7 +686,7 @@ static int fbinfo2index (struct fb_info *fb_info) | |||
683 | { | 686 | { |
684 | int i; | 687 | int i; |
685 | 688 | ||
686 | for (i = 0; i < CONFIG_FB_AU1200_DEVS; ++i) { | 689 | for (i = 0; i < device_count; ++i) { |
687 | if (fb_info == _au1200fb_infos[i]) | 690 | if (fb_info == _au1200fb_infos[i]) |
688 | return i; | 691 | return i; |
689 | } | 692 | } |
@@ -1599,7 +1602,7 @@ static int __devinit au1200fb_drv_probe(struct platform_device *dev) | |||
1599 | /* Kickstart the panel */ | 1602 | /* Kickstart the panel */ |
1600 | au1200_setpanel(panel); | 1603 | au1200_setpanel(panel); |
1601 | 1604 | ||
1602 | for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) { | 1605 | for (plane = 0; plane < device_count; ++plane) { |
1603 | bpp = winbpp(win->w[plane].mode_winctrl1); | 1606 | bpp = winbpp(win->w[plane].mode_winctrl1); |
1604 | if (win->w[plane].xres == 0) | 1607 | if (win->w[plane].xres == 0) |
1605 | win->w[plane].xres = panel->Xres; | 1608 | win->w[plane].xres = panel->Xres; |
@@ -1699,7 +1702,7 @@ static int __devexit au1200fb_drv_remove(struct platform_device *dev) | |||
1699 | /* Turn off the panel */ | 1702 | /* Turn off the panel */ |
1700 | au1200_setpanel(NULL); | 1703 | au1200_setpanel(NULL); |
1701 | 1704 | ||
1702 | for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) { | 1705 | for (plane = 0; plane < device_count; ++plane) { |
1703 | fbi = _au1200fb_infos[plane]; | 1706 | fbi = _au1200fb_infos[plane]; |
1704 | fbdev = fbi->par; | 1707 | fbdev = fbi->par; |
1705 | 1708 | ||
@@ -1741,7 +1744,7 @@ static int au1200fb_drv_resume(struct device *dev) | |||
1741 | /* Kickstart the panel */ | 1744 | /* Kickstart the panel */ |
1742 | au1200_setpanel(panel); | 1745 | au1200_setpanel(panel); |
1743 | 1746 | ||
1744 | for (i = 0; i < CONFIG_FB_AU1200_DEVS; i++) { | 1747 | for (i = 0; i < device_count; i++) { |
1745 | fbi = _au1200fb_infos[i]; | 1748 | fbi = _au1200fb_infos[i]; |
1746 | au1200fb_fb_set_par(fbi); | 1749 | au1200fb_fb_set_par(fbi); |
1747 | } | 1750 | } |
@@ -1776,10 +1779,10 @@ static struct platform_driver au1200fb_driver = { | |||
1776 | 1779 | ||
1777 | /* Kernel driver */ | 1780 | /* Kernel driver */ |
1778 | 1781 | ||
1779 | static void au1200fb_setup(void) | 1782 | static int au1200fb_setup(void) |
1780 | { | 1783 | { |
1781 | char* options = NULL; | 1784 | char *options = NULL; |
1782 | char* this_opt; | 1785 | char *this_opt, *endptr; |
1783 | int num_panels = ARRAY_SIZE(known_lcd_panels); | 1786 | int num_panels = ARRAY_SIZE(known_lcd_panels); |
1784 | int panel_idx = -1; | 1787 | int panel_idx = -1; |
1785 | 1788 | ||
@@ -1824,12 +1827,33 @@ static void au1200fb_setup(void) | |||
1824 | nohwcursor = 1; | 1827 | nohwcursor = 1; |
1825 | } | 1828 | } |
1826 | 1829 | ||
1830 | else if (strncmp(this_opt, "devices:", 8) == 0) { | ||
1831 | this_opt += 8; | ||
1832 | device_count = simple_strtol(this_opt, | ||
1833 | &endptr, 0); | ||
1834 | if ((device_count < 0) || | ||
1835 | (device_count > MAX_DEVICE_COUNT)) | ||
1836 | device_count = MAX_DEVICE_COUNT; | ||
1837 | } | ||
1838 | |||
1839 | else if (strncmp(this_opt, "wincfg:", 7) == 0) { | ||
1840 | this_opt += 7; | ||
1841 | window_index = simple_strtol(this_opt, | ||
1842 | &endptr, 0); | ||
1843 | if ((window_index < 0) || | ||
1844 | (window_index >= ARRAY_SIZE(windows))) | ||
1845 | window_index = DEFAULT_WINDOW_INDEX; | ||
1846 | } | ||
1847 | |||
1848 | else if (strncmp(this_opt, "off", 3) == 0) | ||
1849 | return 1; | ||
1827 | /* Unsupported option */ | 1850 | /* Unsupported option */ |
1828 | else { | 1851 | else { |
1829 | print_warn("Unsupported option \"%s\"", this_opt); | 1852 | print_warn("Unsupported option \"%s\"", this_opt); |
1830 | } | 1853 | } |
1831 | } | 1854 | } |
1832 | } | 1855 | } |
1856 | return 0; | ||
1833 | } | 1857 | } |
1834 | 1858 | ||
1835 | static int __init au1200fb_init(void) | 1859 | static int __init au1200fb_init(void) |
@@ -1837,7 +1861,8 @@ static int __init au1200fb_init(void) | |||
1837 | print_info("" DRIVER_DESC ""); | 1861 | print_info("" DRIVER_DESC ""); |
1838 | 1862 | ||
1839 | /* Setup driver with options */ | 1863 | /* Setup driver with options */ |
1840 | au1200fb_setup(); | 1864 | if (au1200fb_setup()) |
1865 | return -ENODEV; | ||
1841 | 1866 | ||
1842 | /* Point to the panel selected */ | 1867 | /* Point to the panel selected */ |
1843 | panel = &known_lcd_panels[panel_index]; | 1868 | panel = &known_lcd_panels[panel_index]; |