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> |
Wolfram Sang | 9787076 | 2017-08-14 18:34:23 +0200 | [diff] [blame] | 24 | #include <linux/mfd/tps65010.h> |
Bjorn Helgaas | 288e6ea | 2016-02-02 13:53:23 -0600 | [diff] [blame] | 25 | #include <linux/gpio.h> |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 26 | |
Tomi Valkeinen | 91773a0 | 2009-08-03 15:06:36 +0300 | [diff] [blame] | 27 | #include "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_enable(struct lcd_panel *panel) |
| 32 | { |
| 33 | int r = 0; |
| 34 | |
| 35 | /* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */ |
| 36 | r = tps65010_set_gpio_out_value(GPIO1, HIGH); |
| 37 | if (!r) |
| 38 | r = tps65010_set_gpio_out_value(GPIO2, HIGH); |
| 39 | if (r) |
Emil Medve | 1f7c823 | 2007-10-16 23:29:48 -0700 | [diff] [blame] | 40 | pr_err(MODULE_NAME ": Unable to turn on LCD panel\n"); |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 41 | |
| 42 | return r; |
| 43 | } |
| 44 | |
| 45 | static void h3_panel_disable(struct lcd_panel *panel) |
| 46 | { |
| 47 | int r = 0; |
| 48 | |
| 49 | /* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */ |
| 50 | r = tps65010_set_gpio_out_value(GPIO1, LOW); |
| 51 | if (!r) |
| 52 | tps65010_set_gpio_out_value(GPIO2, LOW); |
| 53 | if (r) |
Emil Medve | 1f7c823 | 2007-10-16 23:29:48 -0700 | [diff] [blame] | 54 | pr_err(MODULE_NAME ": Unable to turn off LCD panel\n"); |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 55 | } |
| 56 | |
Lars-Peter Clausen | b2c1e8a | 2017-01-30 17:39:49 +0100 | [diff] [blame] | 57 | static struct lcd_panel h3_panel = { |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 58 | .name = "h3", |
| 59 | .config = OMAP_LCDC_PANEL_TFT, |
| 60 | |
| 61 | .data_lines = 16, |
| 62 | .bpp = 16, |
| 63 | .x_res = 240, |
| 64 | .y_res = 320, |
| 65 | .pixel_clock = 12000, |
| 66 | .hsw = 12, |
| 67 | .hfp = 14, |
| 68 | .hbp = 72 - 12, |
| 69 | .vsw = 1, |
| 70 | .vfp = 1, |
| 71 | .vbp = 0, |
| 72 | .pcd = 0, |
| 73 | |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 74 | .enable = h3_panel_enable, |
| 75 | .disable = h3_panel_disable, |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | static int h3_panel_probe(struct platform_device *pdev) |
| 79 | { |
| 80 | omapfb_register_panel(&h3_panel); |
| 81 | return 0; |
| 82 | } |
| 83 | |
Axel Lin | f990544 | 2011-12-09 09:37:57 +0800 | [diff] [blame] | 84 | static struct platform_driver h3_panel_driver = { |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 85 | .probe = h3_panel_probe, |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 86 | .driver = { |
| 87 | .name = "lcd_h3", |
Imre Deak | 65316c9 | 2007-07-17 04:06:04 -0700 | [diff] [blame] | 88 | }, |
| 89 | }; |
| 90 | |
Axel Lin | f806f9b | 2011-12-09 09:59:56 +0800 | [diff] [blame] | 91 | module_platform_driver(h3_panel_driver); |
Arnd Bergmann | 1bde9f2 | 2018-06-08 18:08:12 +0200 | [diff] [blame] | 92 | |
| 93 | MODULE_AUTHOR("Imre Deak"); |
| 94 | MODULE_DESCRIPTION("LCD panel support for the TI OMAP H3 board"); |
| 95 | MODULE_LICENSE("GPL"); |