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 || |
| 56 | dssdev->clocks.dispc.channel.lcd_clk_src == |
| 57 | OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC) |
| 58 | return true; |
| 59 | else |
| 60 | return false; |
| 61 | } |
| 62 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 63 | static int dpi_set_dsi_clk(struct omap_dss_device *dssdev, bool is_tft, |
| 64 | unsigned long pck_req, unsigned long *fck, int *lck_div, |
| 65 | int *pck_div) |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 66 | { |
| 67 | struct dsi_clock_info dsi_cinfo; |
| 68 | struct dispc_clock_info dispc_cinfo; |
| 69 | int r; |
| 70 | |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame^] | 71 | r = dsi_pll_calc_clock_div_pck(dpi.dsidev, is_tft, pck_req, |
| 72 | &dsi_cinfo, &dispc_cinfo); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 73 | if (r) |
| 74 | return r; |
| 75 | |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame^] | 76 | r = dsi_pll_set_clock_div(dpi.dsidev, &dsi_cinfo); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 77 | if (r) |
| 78 | return r; |
| 79 | |
Archit Taneja | e888166 | 2011-04-12 13:52:24 +0530 | [diff] [blame] | 80 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 81 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 82 | r = dispc_set_clock_div(dssdev->manager->id, &dispc_cinfo); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 83 | if (r) |
| 84 | return r; |
| 85 | |
Archit Taneja | 1bb4783 | 2011-02-24 14:17:30 +0530 | [diff] [blame] | 86 | *fck = dsi_cinfo.dsi_pll_hsdiv_dispc_clk; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 87 | *lck_div = dispc_cinfo.lck_div; |
| 88 | *pck_div = dispc_cinfo.pck_div; |
| 89 | |
| 90 | return 0; |
| 91 | } |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 92 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 93 | static int dpi_set_dispc_clk(struct omap_dss_device *dssdev, bool is_tft, |
| 94 | unsigned long pck_req, unsigned long *fck, int *lck_div, |
| 95 | int *pck_div) |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 96 | { |
| 97 | struct dss_clock_info dss_cinfo; |
| 98 | struct dispc_clock_info dispc_cinfo; |
| 99 | int r; |
| 100 | |
| 101 | r = dss_calc_clock_div(is_tft, pck_req, &dss_cinfo, &dispc_cinfo); |
| 102 | if (r) |
| 103 | return r; |
| 104 | |
| 105 | r = dss_set_clock_div(&dss_cinfo); |
| 106 | if (r) |
| 107 | return r; |
| 108 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 109 | r = dispc_set_clock_div(dssdev->manager->id, &dispc_cinfo); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 110 | if (r) |
| 111 | return r; |
| 112 | |
| 113 | *fck = dss_cinfo.fck; |
| 114 | *lck_div = dispc_cinfo.lck_div; |
| 115 | *pck_div = dispc_cinfo.pck_div; |
| 116 | |
| 117 | return 0; |
| 118 | } |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 119 | |
| 120 | static int dpi_set_mode(struct omap_dss_device *dssdev) |
| 121 | { |
| 122 | struct omap_video_timings *t = &dssdev->panel.timings; |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 123 | int lck_div = 0, pck_div = 0; |
| 124 | unsigned long fck = 0; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 125 | unsigned long pck; |
| 126 | bool is_tft; |
| 127 | int r = 0; |
| 128 | |
Archit Taneja | 6af9cd1 | 2011-01-31 16:27:44 +0000 | [diff] [blame] | 129 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 130 | |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 131 | dispc_set_pol_freq(dssdev->manager->id, dssdev->panel.config, |
| 132 | dssdev->panel.acbi, dssdev->panel.acb); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 133 | |
| 134 | is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0; |
| 135 | |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 136 | if (dpi_use_dsi_pll(dssdev)) |
| 137 | r = dpi_set_dsi_clk(dssdev, is_tft, t->pixel_clock * 1000, |
| 138 | &fck, &lck_div, &pck_div); |
| 139 | else |
| 140 | r = dpi_set_dispc_clk(dssdev, is_tft, t->pixel_clock * 1000, |
| 141 | &fck, &lck_div, &pck_div); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 142 | if (r) |
| 143 | goto err0; |
| 144 | |
| 145 | pck = fck / lck_div / pck_div / 1000; |
| 146 | |
| 147 | if (pck != t->pixel_clock) { |
| 148 | DSSWARN("Could not find exact pixel clock. " |
| 149 | "Requested %d kHz, got %lu kHz\n", |
| 150 | t->pixel_clock, pck); |
| 151 | |
| 152 | t->pixel_clock = pck; |
| 153 | } |
| 154 | |
Sumit Semwal | 64ba4f7 | 2010-12-02 11:27:10 +0000 | [diff] [blame] | 155 | dispc_set_lcd_timings(dssdev->manager->id, t); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 156 | |
| 157 | err0: |
Archit Taneja | 6af9cd1 | 2011-01-31 16:27:44 +0000 | [diff] [blame] | 158 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 159 | return r; |
| 160 | } |
| 161 | |
| 162 | static int dpi_basic_init(struct omap_dss_device *dssdev) |
| 163 | { |
| 164 | bool is_tft; |
| 165 | |
| 166 | is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0; |
| 167 | |
Sumit Semwal | 64ba4f7 | 2010-12-02 11:27:10 +0000 | [diff] [blame] | 168 | dispc_set_parallel_interface_mode(dssdev->manager->id, |
| 169 | OMAP_DSS_PARALLELMODE_BYPASS); |
| 170 | dispc_set_lcd_display_type(dssdev->manager->id, is_tft ? |
| 171 | OMAP_DSS_LCD_DISPLAY_TFT : OMAP_DSS_LCD_DISPLAY_STN); |
| 172 | dispc_set_tft_data_lines(dssdev->manager->id, |
| 173 | dssdev->phy.dpi.data_lines); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 174 | |
| 175 | return 0; |
| 176 | } |
| 177 | |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 178 | int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 179 | { |
| 180 | int r; |
| 181 | |
| 182 | r = omap_dss_start_device(dssdev); |
| 183 | if (r) { |
| 184 | DSSERR("failed to start device\n"); |
| 185 | goto err0; |
| 186 | } |
| 187 | |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 188 | if (cpu_is_omap34xx()) { |
| 189 | r = regulator_enable(dpi.vdds_dsi_reg); |
| 190 | if (r) |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 191 | goto err1; |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 192 | } |
| 193 | |
Archit Taneja | 6af9cd1 | 2011-01-31 16:27:44 +0000 | [diff] [blame] | 194 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 195 | |
| 196 | r = dpi_basic_init(dssdev); |
| 197 | if (r) |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 198 | goto err2; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 199 | |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 200 | if (dpi_use_dsi_pll(dssdev)) { |
| 201 | dss_clk_enable(DSS_CLK_SYSCK); |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame^] | 202 | r = dsi_pll_init(dpi.dsidev, 0, 1); |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 203 | if (r) |
| 204 | goto err3; |
| 205 | } |
| 206 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 207 | r = dpi_set_mode(dssdev); |
| 208 | if (r) |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 209 | goto err4; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 210 | |
| 211 | mdelay(2); |
| 212 | |
Tomi Valkeinen | a2faee8 | 2010-01-08 17:14:53 +0200 | [diff] [blame] | 213 | dssdev->manager->enable(dssdev->manager); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 214 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 215 | return 0; |
| 216 | |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 217 | err4: |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 218 | if (dpi_use_dsi_pll(dssdev)) |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame^] | 219 | dsi_pll_uninit(dpi.dsidev, true); |
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)) |
| 222 | dss_clk_disable(DSS_CLK_SYSCK); |
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 | dss_clk_disable(DSS_CLK_SYSCK); |
| 242 | } |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 243 | |
Archit Taneja | 6af9cd1 | 2011-01-31 16:27:44 +0000 | [diff] [blame] | 244 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 245 | |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 246 | if (cpu_is_omap34xx()) |
| 247 | regulator_disable(dpi.vdds_dsi_reg); |
| 248 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 249 | omap_dss_stop_device(dssdev); |
| 250 | } |
Tomi Valkeinen | 37ac60e | 2010-01-12 15:12:07 +0200 | [diff] [blame] | 251 | EXPORT_SYMBOL(omapdss_dpi_display_disable); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 252 | |
Tomi Valkeinen | 69b2048 | 2010-01-20 12:11:25 +0200 | [diff] [blame] | 253 | void dpi_set_timings(struct omap_dss_device *dssdev, |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 254 | struct omap_video_timings *timings) |
| 255 | { |
| 256 | DSSDBG("dpi_set_timings\n"); |
| 257 | dssdev->panel.timings = *timings; |
| 258 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { |
| 259 | dpi_set_mode(dssdev); |
Sumit Semwal | 2a205f3 | 2010-12-02 11:27:12 +0000 | [diff] [blame] | 260 | dispc_go(dssdev->manager->id); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 261 | } |
| 262 | } |
Tomi Valkeinen | 69b2048 | 2010-01-20 12:11:25 +0200 | [diff] [blame] | 263 | EXPORT_SYMBOL(dpi_set_timings); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 264 | |
Tomi Valkeinen | 69b2048 | 2010-01-20 12:11:25 +0200 | [diff] [blame] | 265 | int dpi_check_timings(struct omap_dss_device *dssdev, |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 266 | struct omap_video_timings *timings) |
| 267 | { |
| 268 | bool is_tft; |
| 269 | int r; |
| 270 | int lck_div, pck_div; |
| 271 | unsigned long fck; |
| 272 | unsigned long pck; |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 273 | struct dispc_clock_info dispc_cinfo; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 274 | |
| 275 | if (!dispc_lcd_timings_ok(timings)) |
| 276 | return -EINVAL; |
| 277 | |
| 278 | if (timings->pixel_clock == 0) |
| 279 | return -EINVAL; |
| 280 | |
| 281 | is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0; |
| 282 | |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 283 | if (dpi_use_dsi_pll(dssdev)) { |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 284 | struct dsi_clock_info dsi_cinfo; |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame^] | 285 | r = dsi_pll_calc_clock_div_pck(dpi.dsidev, is_tft, |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 286 | timings->pixel_clock * 1000, |
| 287 | &dsi_cinfo, &dispc_cinfo); |
| 288 | |
| 289 | if (r) |
| 290 | return r; |
| 291 | |
Archit Taneja | 1bb4783 | 2011-02-24 14:17:30 +0530 | [diff] [blame] | 292 | fck = dsi_cinfo.dsi_pll_hsdiv_dispc_clk; |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 293 | } else { |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 294 | struct dss_clock_info dss_cinfo; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 295 | r = dss_calc_clock_div(is_tft, timings->pixel_clock * 1000, |
| 296 | &dss_cinfo, &dispc_cinfo); |
| 297 | |
| 298 | if (r) |
| 299 | return r; |
| 300 | |
| 301 | fck = dss_cinfo.fck; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 302 | } |
Archit Taneja | 7636b3b | 2011-04-12 13:52:26 +0530 | [diff] [blame] | 303 | |
| 304 | lck_div = dispc_cinfo.lck_div; |
| 305 | pck_div = dispc_cinfo.pck_div; |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 306 | |
| 307 | pck = fck / lck_div / pck_div / 1000; |
| 308 | |
| 309 | timings->pixel_clock = pck; |
| 310 | |
| 311 | return 0; |
| 312 | } |
Tomi Valkeinen | 69b2048 | 2010-01-20 12:11:25 +0200 | [diff] [blame] | 313 | EXPORT_SYMBOL(dpi_check_timings); |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 314 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 315 | int dpi_init_display(struct omap_dss_device *dssdev) |
| 316 | { |
| 317 | DSSDBG("init_display\n"); |
| 318 | |
Tomi Valkeinen | 5f42f2c | 2011-02-22 15:53:46 +0200 | [diff] [blame] | 319 | if (cpu_is_omap34xx() && dpi.vdds_dsi_reg == NULL) { |
| 320 | struct regulator *vdds_dsi; |
| 321 | |
| 322 | vdds_dsi = dss_get_vdds_dsi(); |
| 323 | |
| 324 | if (IS_ERR(vdds_dsi)) { |
| 325 | DSSERR("can't get VDDS_DSI regulator\n"); |
| 326 | return PTR_ERR(vdds_dsi); |
| 327 | } |
| 328 | |
| 329 | dpi.vdds_dsi_reg = vdds_dsi; |
| 330 | } |
| 331 | |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame^] | 332 | if (dpi_use_dsi_pll(dssdev)) { |
| 333 | enum omap_dss_clk_source dispc_fclk_src = |
| 334 | dssdev->clocks.dispc.dispc_fclk_src; |
| 335 | dpi.dsidev = dpi_get_dsidev(dispc_fclk_src); |
| 336 | } |
| 337 | |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 338 | return 0; |
| 339 | } |
| 340 | |
Tomi Valkeinen | 277b288 | 2011-03-02 12:32:48 +0200 | [diff] [blame] | 341 | int dpi_init(void) |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 342 | { |
Tomi Valkeinen | 553c48c | 2009-08-07 13:15:50 +0300 | [diff] [blame] | 343 | return 0; |
| 344 | } |
| 345 | |
| 346 | void dpi_exit(void) |
| 347 | { |
| 348 | } |
| 349 | |