Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 1 | /* |
| 2 | * linux/drivers/video/omap2/dss/dpi.c |
| 3 | * |
| 4 | * Copyright (C) 2009 Nokia Corporation |
| 5 | * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com> |
| 6 | * |
| 7 | * Some code and ideas taken from drivers/video/omap/ driver |
| 8 | * by Imre Deak. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License version 2 as published by |
| 12 | * the Free Software Foundation. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 17 | * more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License along with |
| 20 | * this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | */ |
| 22 | |
| 23 | #define DSS_SUBSYS_NAME "DPI" |
| 24 | |
| 25 | #include <linux/kernel.h> |
| 26 | #include <linux/clk.h> |
| 27 | #include <linux/delay.h> |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 28 | #include <linux/err.h> |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 29 | #include <linux/errno.h> |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 30 | #include <linux/platform_device.h> |
| 31 | #include <linux/regulator/consumer.h> |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 32 | |
Tomi Valkeinen | a0b38cc | 2011-05-11 14:05:07 +0300 | [diff] [blame] | 33 | #include <video/omapdss.h> |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 34 | #include <plat/cpu.h> |
| 35 | |
| 36 | #include "dss.h" |
| 37 | |
| 38 | static struct { |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 39 | struct regulator *vdds_dsi_reg; |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 40 | struct platform_device *dsidev; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 41 | } dpi; |
| 42 | |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 43 | static struct platform_device *dpi_get_dsidev(enum omap_dss_clk_source clk) |
| 44 | { |
| 45 | int dsi_module; |
| 46 | |
| 47 | dsi_module = clk == OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC ? 0 : 1; |
| 48 | |
| 49 | return dsi_get_dsidev_from_id(dsi_module); |
| 50 | } |
| 51 | |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 52 | static bool dpi_use_dsi_pll(struct omap_dss_device *dssdev) |
| 53 | { |
| 54 | if (dssdev->clocks.dispc.dispc_fclk_src == |
| 55 | OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC || |
Archit Taneja | 5a8b572 | 2011-05-12 17:26:29 +0530 | [diff] [blame] | 56 | dssdev->clocks.dispc.dispc_fclk_src == |
| 57 | OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC || |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 58 | dssdev->clocks.dispc.channel.lcd_clk_src == |
Archit Taneja | 5a8b572 | 2011-05-12 17:26:29 +0530 | [diff] [blame] | 59 | OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC || |
| 60 | dssdev->clocks.dispc.channel.lcd_clk_src == |
| 61 | OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC) |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 62 | return true; |
| 63 | else |
| 64 | return false; |
| 65 | } |
| 66 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 67 | static int dpi_set_dsi_clk(struct omap_dss_device *dssdev, bool is_tft, |
| 68 | unsigned long pck_req, unsigned long *fck, int *lck_div, |
| 69 | int *pck_div) |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 70 | { |
| 71 | struct dsi_clock_info dsi_cinfo; |
| 72 | struct dispc_clock_info dispc_cinfo; |
| 73 | int r; |
| 74 | |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 75 | r = dsi_pll_calc_clock_div_pck(dpi.dsidev, is_tft, pck_req, |
| 76 | &dsi_cinfo, &dispc_cinfo); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 77 | if (r) |
| 78 | return r; |
| 79 | |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 80 | r = dsi_pll_set_clock_div(dpi.dsidev, &dsi_cinfo); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 81 | if (r) |
| 82 | return r; |
| 83 | |
Archit Taneja | e888166 | 2011-04-12 13:52:24 +0530 | [diff] [blame] | 84 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 85 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 86 | r = dispc_set_clock_div(dssdev->manager->id, &dispc_cinfo); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 87 | if (r) |
| 88 | return r; |
| 89 | |
Archit Taneja | 1bb4783 | 2011-02-24 14:17:30 +0530 | [diff] [blame] | 90 | *fck = dsi_cinfo.dsi_pll_hsdiv_dispc_clk; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 91 | *lck_div = dispc_cinfo.lck_div; |
| 92 | *pck_div = dispc_cinfo.pck_div; |
| 93 | |
| 94 | return 0; |
| 95 | } |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 96 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 97 | static int dpi_set_dispc_clk(struct omap_dss_device *dssdev, bool is_tft, |
| 98 | unsigned long pck_req, unsigned long *fck, int *lck_div, |
| 99 | int *pck_div) |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 100 | { |
| 101 | struct dss_clock_info dss_cinfo; |
| 102 | struct dispc_clock_info dispc_cinfo; |
| 103 | int r; |
| 104 | |
| 105 | r = dss_calc_clock_div(is_tft, pck_req, &dss_cinfo, &dispc_cinfo); |
| 106 | if (r) |
| 107 | return r; |
| 108 | |
| 109 | r = dss_set_clock_div(&dss_cinfo); |
| 110 | if (r) |
| 111 | return r; |
| 112 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 113 | r = dispc_set_clock_div(dssdev->manager->id, &dispc_cinfo); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 114 | if (r) |
| 115 | return r; |
| 116 | |
| 117 | *fck = dss_cinfo.fck; |
| 118 | *lck_div = dispc_cinfo.lck_div; |
| 119 | *pck_div = dispc_cinfo.pck_div; |
| 120 | |
| 121 | return 0; |
| 122 | } |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 123 | |
| 124 | static int dpi_set_mode(struct omap_dss_device *dssdev) |
| 125 | { |
| 126 | struct omap_video_timings *t = &dssdev->panel.timings; |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 127 | int lck_div = 0, pck_div = 0; |
| 128 | unsigned long fck = 0; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 129 | unsigned long pck; |
| 130 | bool is_tft; |
| 131 | int r = 0; |
| 132 | |
Archit Taneja | 6af9cd1 | 2011-01-31 16:27:44 +0000 | [diff] [blame] | 133 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 134 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 135 | dispc_set_pol_freq(dssdev->manager->id, dssdev->panel.config, |
| 136 | dssdev->panel.acbi, dssdev->panel.acb); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 137 | |
| 138 | is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0; |
| 139 | |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 140 | if (dpi_use_dsi_pll(dssdev)) |
| 141 | r = dpi_set_dsi_clk(dssdev, is_tft, t->pixel_clock * 1000, |
| 142 | &fck, &lck_div, &pck_div); |
| 143 | else |
| 144 | r = dpi_set_dispc_clk(dssdev, is_tft, t->pixel_clock * 1000, |
| 145 | &fck, &lck_div, &pck_div); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 146 | if (r) |
| 147 | goto err0; |
| 148 | |
| 149 | pck = fck / lck_div / pck_div / 1000; |
| 150 | |
| 151 | if (pck != t->pixel_clock) { |
| 152 | DSSWARN("Could not find exact pixel clock. " |
| 153 | "Requested %d kHz, got %lu kHz\n", |
| 154 | t->pixel_clock, pck); |
| 155 | |
| 156 | t->pixel_clock = pck; |
| 157 | } |
| 158 | |
Sumit Semwal | 64ba4f7 | 2010-12-02 11:27:10 +0000 | [diff] [blame] | 159 | dispc_set_lcd_timings(dssdev->manager->id, t); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 160 | |
| 161 | err0: |
Archit Taneja | 6af9cd1 | 2011-01-31 16:27:44 +0000 | [diff] [blame] | 162 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 163 | return r; |
| 164 | } |
| 165 | |
| 166 | static int dpi_basic_init(struct omap_dss_device *dssdev) |
| 167 | { |
| 168 | bool is_tft; |
| 169 | |
| 170 | is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0; |
| 171 | |
Sumit Semwal | 64ba4f7 | 2010-12-02 11:27:10 +0000 | [diff] [blame] | 172 | dispc_set_parallel_interface_mode(dssdev->manager->id, |
| 173 | OMAP_DSS_PARALLELMODE_BYPASS); |
| 174 | dispc_set_lcd_display_type(dssdev->manager->id, is_tft ? |
| 175 | OMAP_DSS_LCD_DISPLAY_TFT : OMAP_DSS_LCD_DISPLAY_STN); |
| 176 | dispc_set_tft_data_lines(dssdev->manager->id, |
| 177 | dssdev->phy.dpi.data_lines); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 178 | |
| 179 | return 0; |
| 180 | } |
| 181 | |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 182 | int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 183 | { |
| 184 | int r; |
| 185 | |
| 186 | r = omap_dss_start_device(dssdev); |
| 187 | if (r) { |
| 188 | DSSERR("failed to start device\n"); |
| 189 | goto err0; |
| 190 | } |
| 191 | |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 192 | if (cpu_is_omap34xx()) { |
| 193 | r = regulator_enable(dpi.vdds_dsi_reg); |
| 194 | if (r) |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 195 | goto err1; |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 196 | } |
| 197 | |
Archit Taneja | 6af9cd1 | 2011-01-31 16:27:44 +0000 | [diff] [blame] | 198 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 199 | |
| 200 | r = dpi_basic_init(dssdev); |
| 201 | if (r) |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 202 | goto err2; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 203 | |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 204 | if (dpi_use_dsi_pll(dssdev)) { |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 205 | r = dsi_pll_init(dpi.dsidev, 0, 1); |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 206 | if (r) |
Tomi Valkeinen | 19077a7 | 2011-05-18 11:33:44 +0300 | [diff] [blame^] | 207 | goto err2; |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 208 | } |
| 209 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 210 | r = dpi_set_mode(dssdev); |
| 211 | if (r) |
Tomi Valkeinen | 19077a7 | 2011-05-18 11:33:44 +0300 | [diff] [blame^] | 212 | goto err3; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 213 | |
| 214 | mdelay(2); |
| 215 | |
Tomi Valkeinen | a2faee8 | 2010-01-08 17:14:53 +0200 | [diff] [blame] | 216 | dssdev->manager->enable(dssdev->manager); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 217 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 218 | return 0; |
| 219 | |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 220 | err3: |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 221 | if (dpi_use_dsi_pll(dssdev)) |
Tomi Valkeinen | 19077a7 | 2011-05-18 11:33:44 +0300 | [diff] [blame^] | 222 | dsi_pll_uninit(dpi.dsidev, true); |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 223 | err2: |
Archit Taneja | 6af9cd1 | 2011-01-31 16:27:44 +0000 | [diff] [blame] | 224 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK); |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 225 | if (cpu_is_omap34xx()) |
| 226 | regulator_disable(dpi.vdds_dsi_reg); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 227 | err1: |
| 228 | omap_dss_stop_device(dssdev); |
| 229 | err0: |
| 230 | return r; |
| 231 | } |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 232 | EXPORT_SYMBOL(omapdss_dpi_display_enable); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 233 | |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 234 | void omapdss_dpi_display_disable(struct omap_dss_device *dssdev) |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 235 | { |
Tomi Valkeinen | a2faee8 | 2010-01-08 17:14:53 +0200 | [diff] [blame] | 236 | dssdev->manager->disable(dssdev->manager); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 237 | |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 238 | if (dpi_use_dsi_pll(dssdev)) { |
| 239 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 240 | dsi_pll_uninit(dpi.dsidev, true); |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 241 | } |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 242 | |
Archit Taneja | 6af9cd1 | 2011-01-31 16:27:44 +0000 | [diff] [blame] | 243 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 244 | |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 245 | if (cpu_is_omap34xx()) |
| 246 | regulator_disable(dpi.vdds_dsi_reg); |
| 247 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 248 | omap_dss_stop_device(dssdev); |
| 249 | } |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 250 | EXPORT_SYMBOL(omapdss_dpi_display_disable); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 251 | |
Tomi Valkeinen | 69b2048 | 2010-01-20 12:11:25 +0200 | [diff] [blame] | 252 | void dpi_set_timings(struct omap_dss_device *dssdev, |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 253 | struct omap_video_timings *timings) |
| 254 | { |
| 255 | DSSDBG("dpi_set_timings\n"); |
| 256 | dssdev->panel.timings = *timings; |
| 257 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { |
| 258 | dpi_set_mode(dssdev); |
Sumit Semwal | 2a205f3 | 2010-12-02 11:27:12 +0000 | [diff] [blame] | 259 | dispc_go(dssdev->manager->id); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 260 | } |
| 261 | } |
Tomi Valkeinen | 69b2048 | 2010-01-20 12:11:25 +0200 | [diff] [blame] | 262 | EXPORT_SYMBOL(dpi_set_timings); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 263 | |
Tomi Valkeinen | 69b2048 | 2010-01-20 12:11:25 +0200 | [diff] [blame] | 264 | int dpi_check_timings(struct omap_dss_device *dssdev, |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 265 | struct omap_video_timings *timings) |
| 266 | { |
| 267 | bool is_tft; |
| 268 | int r; |
| 269 | int lck_div, pck_div; |
| 270 | unsigned long fck; |
| 271 | unsigned long pck; |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 272 | struct dispc_clock_info dispc_cinfo; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 273 | |
| 274 | if (!dispc_lcd_timings_ok(timings)) |
| 275 | return -EINVAL; |
| 276 | |
| 277 | if (timings->pixel_clock == 0) |
| 278 | return -EINVAL; |
| 279 | |
| 280 | is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0; |
| 281 | |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 282 | if (dpi_use_dsi_pll(dssdev)) { |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 283 | struct dsi_clock_info dsi_cinfo; |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 284 | r = dsi_pll_calc_clock_div_pck(dpi.dsidev, is_tft, |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 285 | timings->pixel_clock * 1000, |
| 286 | &dsi_cinfo, &dispc_cinfo); |
| 287 | |
| 288 | if (r) |
| 289 | return r; |
| 290 | |
Archit Taneja | 1bb4783 | 2011-02-24 14:17:30 +0530 | [diff] [blame] | 291 | fck = dsi_cinfo.dsi_pll_hsdiv_dispc_clk; |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 292 | } else { |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 293 | struct dss_clock_info dss_cinfo; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 294 | r = dss_calc_clock_div(is_tft, timings->pixel_clock * 1000, |
| 295 | &dss_cinfo, &dispc_cinfo); |
| 296 | |
| 297 | if (r) |
| 298 | return r; |
| 299 | |
| 300 | fck = dss_cinfo.fck; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 301 | } |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 302 | |
| 303 | lck_div = dispc_cinfo.lck_div; |
| 304 | pck_div = dispc_cinfo.pck_div; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 305 | |
| 306 | pck = fck / lck_div / pck_div / 1000; |
| 307 | |
| 308 | timings->pixel_clock = pck; |
| 309 | |
| 310 | return 0; |
| 311 | } |
Tomi Valkeinen | 69b2048 | 2010-01-20 12:11:25 +0200 | [diff] [blame] | 312 | EXPORT_SYMBOL(dpi_check_timings); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 313 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 314 | int dpi_init_display(struct omap_dss_device *dssdev) |
| 315 | { |
| 316 | DSSDBG("init_display\n"); |
| 317 | |
Tomi Valkeinen | 5f42f2ce | 2011-02-22 15:53:46 +0200 | [diff] [blame] | 318 | if (cpu_is_omap34xx() && dpi.vdds_dsi_reg == NULL) { |
| 319 | struct regulator *vdds_dsi; |
| 320 | |
| 321 | vdds_dsi = dss_get_vdds_dsi(); |
| 322 | |
| 323 | if (IS_ERR(vdds_dsi)) { |
| 324 | DSSERR("can't get VDDS_DSI regulator\n"); |
| 325 | return PTR_ERR(vdds_dsi); |
| 326 | } |
| 327 | |
| 328 | dpi.vdds_dsi_reg = vdds_dsi; |
| 329 | } |
| 330 | |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 331 | if (dpi_use_dsi_pll(dssdev)) { |
| 332 | enum omap_dss_clk_source dispc_fclk_src = |
| 333 | dssdev->clocks.dispc.dispc_fclk_src; |
| 334 | dpi.dsidev = dpi_get_dsidev(dispc_fclk_src); |
| 335 | } |
| 336 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 337 | return 0; |
| 338 | } |
| 339 | |
Tomi Valkeinen | 277b288 | 2011-03-02 12:32:48 +0200 | [diff] [blame] | 340 | int dpi_init(void) |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 341 | { |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | void dpi_exit(void) |
| 346 | { |
| 347 | } |
| 348 | |