4 * HDMI library support functions for TI OMAP4 processors.
6 * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
7 * Authors: Mythri P k <mythripk@ti.com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along with
19 * this program. If not, see <http://www.gnu.org/licenses/>.
22 #include <linux/kernel.h>
23 #include <linux/err.h>
25 #include <linux/mutex.h>
26 #include <linux/module.h>
27 #include <plat/display.h>
32 struct mutex hdmi_lock
;
36 static int hdmi_panel_probe(struct omap_dss_device
*dssdev
)
38 DSSDBG("ENTER hdmi_panel_probe\n");
40 dssdev
->panel
.config
= OMAP_DSS_LCD_TFT
|
41 OMAP_DSS_LCD_IVS
| OMAP_DSS_LCD_IHS
;
44 * Initialize the timings to 640 * 480
45 * This is only for framebuffer update not for TV timing setting
46 * Setting TV timing will be done only on enable
48 dssdev
->panel
.timings
.x_res
= 640;
49 dssdev
->panel
.timings
.y_res
= 480;
51 DSSDBG("hdmi_panel_probe x_res= %d y_res = %d\n",
52 dssdev
->panel
.timings
.x_res
,
53 dssdev
->panel
.timings
.y_res
);
57 static void hdmi_panel_remove(struct omap_dss_device
*dssdev
)
62 static int hdmi_panel_enable(struct omap_dss_device
*dssdev
)
65 DSSDBG("ENTER hdmi_panel_enable\n");
67 mutex_lock(&hdmi
.hdmi_lock
);
69 if (dssdev
->state
!= OMAP_DSS_DISPLAY_DISABLED
) {
74 r
= omapdss_hdmi_display_enable(dssdev
);
76 DSSERR("failed to power on\n");
80 dssdev
->state
= OMAP_DSS_DISPLAY_ACTIVE
;
83 mutex_unlock(&hdmi
.hdmi_lock
);
88 static void hdmi_panel_disable(struct omap_dss_device
*dssdev
)
90 mutex_lock(&hdmi
.hdmi_lock
);
92 if (dssdev
->state
== OMAP_DSS_DISPLAY_ACTIVE
)
93 omapdss_hdmi_display_disable(dssdev
);
95 dssdev
->state
= OMAP_DSS_DISPLAY_DISABLED
;
97 mutex_unlock(&hdmi
.hdmi_lock
);
100 static int hdmi_panel_suspend(struct omap_dss_device
*dssdev
)
104 mutex_lock(&hdmi
.hdmi_lock
);
106 if (dssdev
->state
!= OMAP_DSS_DISPLAY_ACTIVE
) {
111 dssdev
->state
= OMAP_DSS_DISPLAY_SUSPENDED
;
113 omapdss_hdmi_display_disable(dssdev
);
116 mutex_unlock(&hdmi
.hdmi_lock
);
121 static int hdmi_panel_resume(struct omap_dss_device
*dssdev
)
125 mutex_lock(&hdmi
.hdmi_lock
);
127 if (dssdev
->state
!= OMAP_DSS_DISPLAY_SUSPENDED
) {
132 r
= omapdss_hdmi_display_enable(dssdev
);
134 DSSERR("failed to power on\n");
138 dssdev
->state
= OMAP_DSS_DISPLAY_ACTIVE
;
141 mutex_unlock(&hdmi
.hdmi_lock
);
146 static void hdmi_get_timings(struct omap_dss_device
*dssdev
,
147 struct omap_video_timings
*timings
)
149 mutex_lock(&hdmi
.hdmi_lock
);
151 *timings
= dssdev
->panel
.timings
;
153 mutex_unlock(&hdmi
.hdmi_lock
);
156 static void hdmi_set_timings(struct omap_dss_device
*dssdev
,
157 struct omap_video_timings
*timings
)
159 DSSDBG("hdmi_set_timings\n");
161 mutex_lock(&hdmi
.hdmi_lock
);
163 dssdev
->panel
.timings
= *timings
;
165 if (dssdev
->state
== OMAP_DSS_DISPLAY_ACTIVE
) {
166 /* turn the hdmi off and on to get new timings to use */
167 omapdss_hdmi_display_disable(dssdev
);
168 omapdss_hdmi_display_set_timing(dssdev
);
171 mutex_unlock(&hdmi
.hdmi_lock
);
174 static int hdmi_check_timings(struct omap_dss_device
*dssdev
,
175 struct omap_video_timings
*timings
)
179 DSSDBG("hdmi_check_timings\n");
181 mutex_lock(&hdmi
.hdmi_lock
);
183 r
= omapdss_hdmi_display_check_timing(dssdev
, timings
);
185 DSSERR("Timing cannot be applied\n");
189 mutex_unlock(&hdmi
.hdmi_lock
);
193 static struct omap_dss_driver hdmi_driver
= {
194 .probe
= hdmi_panel_probe
,
195 .remove
= hdmi_panel_remove
,
196 .enable
= hdmi_panel_enable
,
197 .disable
= hdmi_panel_disable
,
198 .suspend
= hdmi_panel_suspend
,
199 .resume
= hdmi_panel_resume
,
200 .get_timings
= hdmi_get_timings
,
201 .set_timings
= hdmi_set_timings
,
202 .check_timings
= hdmi_check_timings
,
204 .name
= "hdmi_panel",
205 .owner
= THIS_MODULE
,
209 int hdmi_panel_init(void)
211 mutex_init(&hdmi
.hdmi_lock
);
213 omap_dss_register_driver(&hdmi_driver
);
218 void hdmi_panel_exit(void)
220 omap_dss_unregister_driver(&hdmi_driver
);