Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 1 | /* |
| 2 | * LCD panel support for the TI OMAP H3 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> |
David Brownell | 6d16bfb | 2008-01-27 18:14:49 +0100 | [diff] [blame] | 24 | #include <linux/i2c/tps65010.h> |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 25 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 26 | #include <mach/gpio.h> |
| 27 | #include <mach/omapfb.h> |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 28 | |
| 29 | #define MODULE_NAME "omapfb-lcd_h3" |
| 30 | |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 31 | static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) |
| 32 | { |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | static void h3_panel_cleanup(struct lcd_panel *panel) |
| 37 | { |
| 38 | } |
| 39 | |
| 40 | static int h3_panel_enable(struct lcd_panel *panel) |
| 41 | { |
| 42 | int r = 0; |
| 43 | |
| 44 | /* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */ |
| 45 | r = tps65010_set_gpio_out_value(GPIO1, HIGH); |
| 46 | if (!r) |
| 47 | r = tps65010_set_gpio_out_value(GPIO2, HIGH); |
| 48 | if (r) |
Emil Medve | 1f7c823 | 2007-10-16 23:29:48 -0700 | [diff] [blame] | 49 | pr_err(MODULE_NAME ": Unable to turn on LCD panel\n"); |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 50 | |
| 51 | return r; |
| 52 | } |
| 53 | |
| 54 | static void h3_panel_disable(struct lcd_panel *panel) |
| 55 | { |
| 56 | int r = 0; |
| 57 | |
| 58 | /* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */ |
| 59 | r = tps65010_set_gpio_out_value(GPIO1, LOW); |
| 60 | if (!r) |
| 61 | tps65010_set_gpio_out_value(GPIO2, LOW); |
| 62 | if (r) |
Emil Medve | 1f7c823 | 2007-10-16 23:29:48 -0700 | [diff] [blame] | 63 | pr_err(MODULE_NAME ": Unable to turn off LCD panel\n"); |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | static unsigned long h3_panel_get_caps(struct lcd_panel *panel) |
| 67 | { |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | struct lcd_panel h3_panel = { |
| 72 | .name = "h3", |
| 73 | .config = OMAP_LCDC_PANEL_TFT, |
| 74 | |
| 75 | .data_lines = 16, |
| 76 | .bpp = 16, |
| 77 | .x_res = 240, |
| 78 | .y_res = 320, |
| 79 | .pixel_clock = 12000, |
| 80 | .hsw = 12, |
| 81 | .hfp = 14, |
| 82 | .hbp = 72 - 12, |
| 83 | .vsw = 1, |
| 84 | .vfp = 1, |
| 85 | .vbp = 0, |
| 86 | .pcd = 0, |
| 87 | |
| 88 | .init = h3_panel_init, |
| 89 | .cleanup = h3_panel_cleanup, |
| 90 | .enable = h3_panel_enable, |
| 91 | .disable = h3_panel_disable, |
| 92 | .get_caps = h3_panel_get_caps, |
| 93 | }; |
| 94 | |
| 95 | static int h3_panel_probe(struct platform_device *pdev) |
| 96 | { |
| 97 | omapfb_register_panel(&h3_panel); |
| 98 | return 0; |
| 99 | } |
| 100 | |
| 101 | static int h3_panel_remove(struct platform_device *pdev) |
| 102 | { |
| 103 | return 0; |
| 104 | } |
| 105 | |
| 106 | static int h3_panel_suspend(struct platform_device *pdev, pm_message_t mesg) |
| 107 | { |
| 108 | return 0; |
| 109 | } |
| 110 | |
| 111 | static int h3_panel_resume(struct platform_device *pdev) |
| 112 | { |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | struct platform_driver h3_panel_driver = { |
| 117 | .probe = h3_panel_probe, |
| 118 | .remove = h3_panel_remove, |
| 119 | .suspend = h3_panel_suspend, |
| 120 | .resume = h3_panel_resume, |
| 121 | .driver = { |
| 122 | .name = "lcd_h3", |
| 123 | .owner = THIS_MODULE, |
| 124 | }, |
| 125 | }; |
| 126 | |
| 127 | static int h3_panel_drv_init(void) |
| 128 | { |
| 129 | return platform_driver_register(&h3_panel_driver); |
| 130 | } |
| 131 | |
| 132 | static void h3_panel_drv_cleanup(void) |
| 133 | { |
| 134 | platform_driver_unregister(&h3_panel_driver); |
| 135 | } |
| 136 | |
| 137 | module_init(h3_panel_drv_init); |
| 138 | module_exit(h3_panel_drv_cleanup); |
| 139 | |