1 /*
2  * LCD panel support for the TI OMAP1610 Innovator board
3  *
4  * Copyright (C) 2004 Nokia Corporation
5  * Author: Imre Deak <imre.deak@nokia.com>
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation; either version 2 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20  */
21 
22 #include <linux/module.h>
23 #include <linux/platform_device.h>
24 
25 #include <mach/gpio.h>
26 #include "omapfb.h"
27 
28 #define MODULE_NAME	"omapfb-lcd_h3"
29 
innovator1610_panel_init(struct lcd_panel * panel,struct omapfb_device * fbdev)30 static int innovator1610_panel_init(struct lcd_panel *panel,
31 				    struct omapfb_device *fbdev)
32 {
33 	int r = 0;
34 
35 	if (gpio_request(14, "lcd_en0")) {
36 		pr_err(MODULE_NAME ": can't request GPIO 14\n");
37 		r = -1;
38 		goto exit;
39 	}
40 	if (gpio_request(15, "lcd_en1")) {
41 		pr_err(MODULE_NAME ": can't request GPIO 15\n");
42 		gpio_free(14);
43 		r = -1;
44 		goto exit;
45 	}
46 	/* configure GPIO(14, 15) as outputs */
47 	gpio_direction_output(14, 0);
48 	gpio_direction_output(15, 0);
49 exit:
50 	return r;
51 }
52 
innovator1610_panel_cleanup(struct lcd_panel * panel)53 static void innovator1610_panel_cleanup(struct lcd_panel *panel)
54 {
55 	gpio_free(15);
56 	gpio_free(14);
57 }
58 
innovator1610_panel_enable(struct lcd_panel * panel)59 static int innovator1610_panel_enable(struct lcd_panel *panel)
60 {
61 	/* set GPIO14 and GPIO15 high */
62 	gpio_set_value(14, 1);
63 	gpio_set_value(15, 1);
64 	return 0;
65 }
66 
innovator1610_panel_disable(struct lcd_panel * panel)67 static void innovator1610_panel_disable(struct lcd_panel *panel)
68 {
69 	/* set GPIO13, GPIO14 and GPIO15 low */
70 	gpio_set_value(14, 0);
71 	gpio_set_value(15, 0);
72 }
73 
innovator1610_panel_get_caps(struct lcd_panel * panel)74 static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel)
75 {
76 	return 0;
77 }
78 
79 struct lcd_panel innovator1610_panel = {
80 	.name		= "inn1610",
81 	.config		= OMAP_LCDC_PANEL_TFT,
82 
83 	.bpp		= 16,
84 	.data_lines	= 16,
85 	.x_res		= 320,
86 	.y_res		= 240,
87 	.pixel_clock	= 12500,
88 	.hsw		= 40,
89 	.hfp		= 40,
90 	.hbp		= 72,
91 	.vsw		= 1,
92 	.vfp		= 1,
93 	.vbp		= 0,
94 	.pcd		= 12,
95 
96 	.init		= innovator1610_panel_init,
97 	.cleanup	= innovator1610_panel_cleanup,
98 	.enable		= innovator1610_panel_enable,
99 	.disable	= innovator1610_panel_disable,
100 	.get_caps	= innovator1610_panel_get_caps,
101 };
102 
innovator1610_panel_probe(struct platform_device * pdev)103 static int innovator1610_panel_probe(struct platform_device *pdev)
104 {
105 	omapfb_register_panel(&innovator1610_panel);
106 	return 0;
107 }
108 
innovator1610_panel_remove(struct platform_device * pdev)109 static int innovator1610_panel_remove(struct platform_device *pdev)
110 {
111 	return 0;
112 }
113 
innovator1610_panel_suspend(struct platform_device * pdev,pm_message_t mesg)114 static int innovator1610_panel_suspend(struct platform_device *pdev,
115 				       pm_message_t mesg)
116 {
117 	return 0;
118 }
119 
innovator1610_panel_resume(struct platform_device * pdev)120 static int innovator1610_panel_resume(struct platform_device *pdev)
121 {
122 	return 0;
123 }
124 
125 struct platform_driver innovator1610_panel_driver = {
126 	.probe		= innovator1610_panel_probe,
127 	.remove		= innovator1610_panel_remove,
128 	.suspend	= innovator1610_panel_suspend,
129 	.resume		= innovator1610_panel_resume,
130 	.driver		= {
131 		.name	= "lcd_inn1610",
132 		.owner	= THIS_MODULE,
133 	},
134 };
135 
innovator1610_panel_drv_init(void)136 static int __init innovator1610_panel_drv_init(void)
137 {
138 	return platform_driver_register(&innovator1610_panel_driver);
139 }
140 
innovator1610_panel_drv_cleanup(void)141 static void __exit innovator1610_panel_drv_cleanup(void)
142 {
143 	platform_driver_unregister(&innovator1610_panel_driver);
144 }
145 
146 module_init(innovator1610_panel_drv_init);
147 module_exit(innovator1610_panel_drv_cleanup);
148 
149