1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * LCD panel support for the TI OMAP H3 board
4  *
5  * Copyright (C) 2004 Nokia Corporation
6  * Author: Imre Deak <imre.deak@nokia.com>
7  */
8 
9 #include <linux/module.h>
10 #include <linux/platform_device.h>
11 #include <linux/mfd/tps65010.h>
12 #include <linux/gpio.h>
13 
14 #include "omapfb.h"
15 
16 #define MODULE_NAME	"omapfb-lcd_h3"
17 
h3_panel_enable(struct lcd_panel * panel)18 static int h3_panel_enable(struct lcd_panel *panel)
19 {
20 	int r = 0;
21 
22 	/* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */
23 	r = tps65010_set_gpio_out_value(GPIO1, HIGH);
24 	if (!r)
25 		r = tps65010_set_gpio_out_value(GPIO2, HIGH);
26 	if (r)
27 		pr_err(MODULE_NAME ": Unable to turn on LCD panel\n");
28 
29 	return r;
30 }
31 
h3_panel_disable(struct lcd_panel * panel)32 static void h3_panel_disable(struct lcd_panel *panel)
33 {
34 	int r = 0;
35 
36 	/* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */
37 	r = tps65010_set_gpio_out_value(GPIO1, LOW);
38 	if (!r)
39 		tps65010_set_gpio_out_value(GPIO2, LOW);
40 	if (r)
41 		pr_err(MODULE_NAME ": Unable to turn off LCD panel\n");
42 }
43 
44 static struct lcd_panel h3_panel = {
45 	.name		= "h3",
46 	.config		= OMAP_LCDC_PANEL_TFT,
47 
48 	.data_lines	= 16,
49 	.bpp		= 16,
50 	.x_res		= 240,
51 	.y_res		= 320,
52 	.pixel_clock	= 12000,
53 	.hsw		= 12,
54 	.hfp		= 14,
55 	.hbp		= 72 - 12,
56 	.vsw		= 1,
57 	.vfp		= 1,
58 	.vbp		= 0,
59 	.pcd		= 0,
60 
61 	.enable		= h3_panel_enable,
62 	.disable	= h3_panel_disable,
63 };
64 
h3_panel_probe(struct platform_device * pdev)65 static int h3_panel_probe(struct platform_device *pdev)
66 {
67 	omapfb_register_panel(&h3_panel);
68 	return 0;
69 }
70 
71 static struct platform_driver h3_panel_driver = {
72 	.probe		= h3_panel_probe,
73 	.driver		= {
74 		.name	= "lcd_h3",
75 	},
76 };
77 
78 module_platform_driver(h3_panel_driver);
79 
80 MODULE_AUTHOR("Imre Deak");
81 MODULE_DESCRIPTION("LCD panel support for the TI OMAP H3 board");
82 MODULE_LICENSE("GPL");
83