2 * linux/drivers/video/omap2/dss/sdi.c
4 * Copyright (C) 2009 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 #define DSS_SUBSYS_NAME "SDI"
22 #include <linux/kernel.h>
23 #include <linux/clk.h>
24 #include <linux/delay.h>
25 #include <linux/err.h>
27 #include <plat/display.h>
35 static void sdi_basic_init(void)
37 dispc_set_parallel_interface_mode(OMAP_DSS_PARALLELMODE_BYPASS
);
39 dispc_set_lcd_display_type(OMAP_DSS_LCD_DISPLAY_TFT
);
40 dispc_set_tft_data_lines(24);
41 dispc_lcd_enable_signal_polarity(1);
44 int omapdss_sdi_display_enable(struct omap_dss_device
*dssdev
)
46 struct omap_video_timings
*t
= &dssdev
->panel
.timings
;
47 struct dss_clock_info dss_cinfo
;
48 struct dispc_clock_info dispc_cinfo
;
54 r
= omap_dss_start_device(dssdev
);
56 DSSERR("failed to start device\n");
60 /* In case of skip_init sdi_init has already enabled the clocks */
62 dss_clk_enable(DSS_CLK_ICK
| DSS_CLK_FCK1
);
67 dssdev
->panel
.config
|= OMAP_DSS_LCD_RF
| OMAP_DSS_LCD_ONOFF
;
69 dispc_set_pol_freq(dssdev
->panel
.config
, dssdev
->panel
.acbi
,
73 r
= dss_calc_clock_div(1, t
->pixel_clock
* 1000,
74 &dss_cinfo
, &dispc_cinfo
);
76 r
= dss_get_clock_div(&dss_cinfo
);
77 r
= dispc_get_clock_div(&dispc_cinfo
);
84 lck_div
= dispc_cinfo
.lck_div
;
85 pck_div
= dispc_cinfo
.pck_div
;
87 pck
= fck
/ lck_div
/ pck_div
/ 1000;
89 if (pck
!= t
->pixel_clock
) {
90 DSSWARN("Could not find exact pixel clock. Requested %d kHz, "
98 dispc_set_lcd_timings(t
);
100 r
= dss_set_clock_div(&dss_cinfo
);
104 r
= dispc_set_clock_div(&dispc_cinfo
);
108 if (!sdi
.skip_init
) {
109 dss_sdi_init(dssdev
->phy
.sdi
.datapairs
);
110 r
= dss_sdi_enable();
116 dssdev
->manager
->enable(dssdev
->manager
);
122 dss_clk_disable(DSS_CLK_ICK
| DSS_CLK_FCK1
);
124 omap_dss_stop_device(dssdev
);
128 EXPORT_SYMBOL(omapdss_sdi_display_enable
);
130 void omapdss_sdi_display_disable(struct omap_dss_device
*dssdev
)
132 dssdev
->manager
->disable(dssdev
->manager
);
136 dss_clk_disable(DSS_CLK_ICK
| DSS_CLK_FCK1
);
138 omap_dss_stop_device(dssdev
);
140 EXPORT_SYMBOL(omapdss_sdi_display_disable
);
142 int sdi_init_display(struct omap_dss_device
*dssdev
)
144 DSSDBG("SDI init\n");
149 int sdi_init(bool skip_init
)
151 /* we store this for first display enable, then clear it */
152 sdi
.skip_init
= skip_init
;
155 * Enable clocks already here, otherwise there would be a toggle
156 * of them until sdi_display_enable is called.
159 dss_clk_enable(DSS_CLK_ICK
| DSS_CLK_FCK1
);