2 * LCD panel driver for Sharp LS037V7DW01
4 * Copyright (C) 2008 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <linux/module.h>
21 #include <linux/delay.h>
22 #include <linux/device.h>
24 #include <linux/err.h>
25 #include <linux/slab.h>
27 #include <video/omapdss.h>
32 static struct omap_video_timings sharp_ls_timings = {
46 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
47 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
48 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
49 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
50 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
54 static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
56 struct sharp_data *sd;
58 dssdev->panel.timings = sharp_ls_timings;
60 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
64 dev_set_drvdata(&dssdev->dev, sd);
69 static void __exit sharp_ls_panel_remove(struct omap_dss_device *dssdev)
71 struct sharp_data *sd = dev_get_drvdata(&dssdev->dev);
76 static int sharp_ls_power_on(struct omap_dss_device *dssdev)
80 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
83 omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
84 omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
86 r = omapdss_dpi_display_enable(dssdev);
90 /* wait couple of vsyncs until enabling the LCD */
93 if (dssdev->platform_enable) {
94 r = dssdev->platform_enable(dssdev);
101 omapdss_dpi_display_disable(dssdev);
106 static void sharp_ls_power_off(struct omap_dss_device *dssdev)
108 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
111 if (dssdev->platform_disable)
112 dssdev->platform_disable(dssdev);
114 /* wait at least 5 vsyncs after disabling the LCD */
118 omapdss_dpi_display_disable(dssdev);
121 static int sharp_ls_panel_enable(struct omap_dss_device *dssdev)
124 r = sharp_ls_power_on(dssdev);
125 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
129 static void sharp_ls_panel_disable(struct omap_dss_device *dssdev)
131 sharp_ls_power_off(dssdev);
132 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
135 static struct omap_dss_driver sharp_ls_driver = {
136 .probe = sharp_ls_panel_probe,
137 .remove = __exit_p(sharp_ls_panel_remove),
139 .enable = sharp_ls_panel_enable,
140 .disable = sharp_ls_panel_disable,
143 .name = "sharp_ls_panel",
144 .owner = THIS_MODULE,
148 static int __init sharp_ls_panel_drv_init(void)
150 return omap_dss_register_driver(&sharp_ls_driver);
153 static void __exit sharp_ls_panel_drv_exit(void)
155 omap_dss_unregister_driver(&sharp_ls_driver);
158 module_init(sharp_ls_panel_drv_init);
159 module_exit(sharp_ls_panel_drv_exit);
160 MODULE_LICENSE("GPL");