PageRenderTime 16ms CodeModel.GetById 9ms app.highlight 6ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/video/omap/lcd_overo.c

https://bitbucket.org/slukk/jb-tsm-kernel-4.2
C | 180 lines | 124 code | 29 blank | 27 comment | 3 complexity | 62dd75f042ac4bcaf8ee8c81cfd0950c MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1/*
  2 * LCD panel support for the Gumstix Overo
  3 *
  4 * Author: Steve Sakoman <steve@sakoman.com>
  5 *
  6 * This program is free software; you can redistribute it and/or modify it
  7 * under the terms of the GNU General Public License as published by the
  8 * Free Software Foundation; either version 2 of the License, or (at your
  9 * option) any later version.
 10 *
 11 * This program is distributed in the hope that it will be useful, but
 12 * WITHOUT ANY WARRANTY; without even the implied warranty of
 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14 * General Public License for more details.
 15 *
 16 * You should have received a copy of the GNU General Public License along
 17 * with this program; if not, write to the Free Software Foundation, Inc.,
 18 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 19 *
 20 */
 21
 22#include <linux/module.h>
 23#include <linux/platform_device.h>
 24#include <linux/i2c/twl.h>
 25
 26#include <mach/gpio.h>
 27#include <plat/mux.h>
 28#include <asm/mach-types.h>
 29
 30#include "omapfb.h"
 31
 32#define LCD_ENABLE       144
 33
 34static int overo_panel_init(struct lcd_panel *panel,
 35				struct omapfb_device *fbdev)
 36{
 37	if ((gpio_request(LCD_ENABLE, "LCD_ENABLE") == 0) &&
 38	    (gpio_direction_output(LCD_ENABLE, 1) == 0))
 39		gpio_export(LCD_ENABLE, 0);
 40	else
 41		printk(KERN_ERR "could not obtain gpio for LCD_ENABLE\n");
 42
 43	return 0;
 44}
 45
 46static void overo_panel_cleanup(struct lcd_panel *panel)
 47{
 48	gpio_free(LCD_ENABLE);
 49}
 50
 51static int overo_panel_enable(struct lcd_panel *panel)
 52{
 53	gpio_set_value(LCD_ENABLE, 1);
 54	return 0;
 55}
 56
 57static void overo_panel_disable(struct lcd_panel *panel)
 58{
 59	gpio_set_value(LCD_ENABLE, 0);
 60}
 61
 62static unsigned long overo_panel_get_caps(struct lcd_panel *panel)
 63{
 64	return 0;
 65}
 66
 67struct lcd_panel overo_panel = {
 68	.name		= "overo",
 69	.config		= OMAP_LCDC_PANEL_TFT,
 70	.bpp		= 16,
 71	.data_lines	= 24,
 72
 73#if defined CONFIG_FB_OMAP_031M3R
 74
 75	/* 640 x 480 @ 60 Hz  Reduced blanking VESA CVT 0.31M3-R */
 76	.x_res		= 640,
 77	.y_res		= 480,
 78	.hfp		= 48,
 79	.hsw		= 32,
 80	.hbp		= 80,
 81	.vfp		= 3,
 82	.vsw		= 4,
 83	.vbp		= 7,
 84	.pixel_clock	= 23500,
 85
 86#elif defined CONFIG_FB_OMAP_048M3R
 87
 88	/* 800 x 600 @ 60 Hz  Reduced blanking VESA CVT 0.48M3-R */
 89	.x_res		= 800,
 90	.y_res		= 600,
 91	.hfp		= 48,
 92	.hsw		= 32,
 93	.hbp		= 80,
 94	.vfp		= 3,
 95	.vsw		= 4,
 96	.vbp		= 11,
 97	.pixel_clock	= 35500,
 98
 99#elif defined CONFIG_FB_OMAP_079M3R
100
101	/* 1024 x 768 @ 60 Hz  Reduced blanking VESA CVT 0.79M3-R */
102	.x_res		= 1024,
103	.y_res		= 768,
104	.hfp		= 48,
105	.hsw		= 32,
106	.hbp		= 80,
107	.vfp		= 3,
108	.vsw		= 4,
109	.vbp		= 15,
110	.pixel_clock	= 56000,
111
112#elif defined CONFIG_FB_OMAP_092M9R
113
114	/* 1280 x 720 @ 60 Hz  Reduced blanking VESA CVT 0.92M9-R */
115	.x_res		= 1280,
116	.y_res		= 720,
117	.hfp		= 48,
118	.hsw		= 32,
119	.hbp		= 80,
120	.vfp		= 3,
121	.vsw		= 5,
122	.vbp		= 13,
123	.pixel_clock	= 64000,
124
125#else
126
127	/* use 640 x 480 if no config option */
128	/* 640 x 480 @ 60 Hz  Reduced blanking VESA CVT 0.31M3-R */
129	.x_res		= 640,
130	.y_res		= 480,
131	.hfp		= 48,
132	.hsw		= 32,
133	.hbp		= 80,
134	.vfp		= 3,
135	.vsw		= 4,
136	.vbp		= 7,
137	.pixel_clock	= 23500,
138
139#endif
140
141	.init		= overo_panel_init,
142	.cleanup	= overo_panel_cleanup,
143	.enable		= overo_panel_enable,
144	.disable	= overo_panel_disable,
145	.get_caps	= overo_panel_get_caps,
146};
147
148static int overo_panel_probe(struct platform_device *pdev)
149{
150	omapfb_register_panel(&overo_panel);
151	return 0;
152}
153
154static int overo_panel_remove(struct platform_device *pdev)
155{
156	/* omapfb does not have unregister_panel */
157	return 0;
158}
159
160static struct platform_driver overo_panel_driver = {
161	.probe		= overo_panel_probe,
162	.remove		= overo_panel_remove,
163	.driver		= {
164		.name	= "overo_lcd",
165		.owner	= THIS_MODULE,
166	},
167};
168
169static int __init overo_panel_drv_init(void)
170{
171	return platform_driver_register(&overo_panel_driver);
172}
173
174static void __exit overo_panel_drv_exit(void)
175{
176	platform_driver_unregister(&overo_panel_driver);
177}
178
179module_init(overo_panel_drv_init);
180module_exit(overo_panel_drv_exit);