1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * LCD panel support for the TI OMAP1610 Innovator 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
12#include <linux/gpio.h>
13#include "omapfb.h"
14
15#define MODULE_NAME	"omapfb-lcd_h3"
16
17static int innovator1610_panel_init(struct lcd_panel *panel,
18				    struct omapfb_device *fbdev)
19{
20	int r = 0;
21
22	/* configure GPIO(14, 15) as outputs */
23	if (gpio_request_one(14, GPIOF_OUT_INIT_LOW, "lcd_en0")) {
24		pr_err(MODULE_NAME ": can't request GPIO 14\n");
25		r = -1;
26		goto exit;
27	}
28	if (gpio_request_one(15, GPIOF_OUT_INIT_LOW, "lcd_en1")) {
29		pr_err(MODULE_NAME ": can't request GPIO 15\n");
30		gpio_free(14);
31		r = -1;
32		goto exit;
33	}
34exit:
35	return r;
36}
37
38static void innovator1610_panel_cleanup(struct lcd_panel *panel)
39{
40	gpio_free(15);
41	gpio_free(14);
42}
43
44static int innovator1610_panel_enable(struct lcd_panel *panel)
45{
46	/* set GPIO14 and GPIO15 high */
47	gpio_set_value(14, 1);
48	gpio_set_value(15, 1);
49	return 0;
50}
51
52static void innovator1610_panel_disable(struct lcd_panel *panel)
53{
54	/* set GPIO13, GPIO14 and GPIO15 low */
55	gpio_set_value(14, 0);
56	gpio_set_value(15, 0);
57}
58
59static struct lcd_panel innovator1610_panel = {
60	.name		= "inn1610",
61	.config		= OMAP_LCDC_PANEL_TFT,
62
63	.bpp		= 16,
64	.data_lines	= 16,
65	.x_res		= 320,
66	.y_res		= 240,
67	.pixel_clock	= 12500,
68	.hsw		= 40,
69	.hfp		= 40,
70	.hbp		= 72,
71	.vsw		= 1,
72	.vfp		= 1,
73	.vbp		= 0,
74	.pcd		= 12,
75
76	.init		= innovator1610_panel_init,
77	.cleanup	= innovator1610_panel_cleanup,
78	.enable		= innovator1610_panel_enable,
79	.disable	= innovator1610_panel_disable,
80};
81
82static int innovator1610_panel_probe(struct platform_device *pdev)
83{
84	omapfb_register_panel(&innovator1610_panel);
85	return 0;
86}
87
88static struct platform_driver innovator1610_panel_driver = {
89	.probe		= innovator1610_panel_probe,
90	.driver		= {
91		.name	= "lcd_inn1610",
92	},
93};
94
95module_platform_driver(innovator1610_panel_driver);
96
97MODULE_AUTHOR("Imre Deak");
98MODULE_DESCRIPTION("LCD panel support for the TI OMAP1610 Innovator board");
99MODULE_LICENSE("GPL");
100