Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1 | /* |
| 2 | * hdmi.c |
| 3 | * |
| 4 | * HDMI interface DSS driver setting for TI's OMAP4 family of processor. |
| 5 | * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/ |
| 6 | * Authors: Yong Zhi |
| 7 | * Mythri pk <mythripk@ti.com> |
| 8 | * |
| 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. |
| 12 | * |
| 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 |
| 16 | * more details. |
| 17 | * |
| 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/>. |
| 20 | */ |
| 21 | |
| 22 | #define DSS_SUBSYS_NAME "HDMI" |
| 23 | |
| 24 | #include <linux/kernel.h> |
| 25 | #include <linux/module.h> |
| 26 | #include <linux/err.h> |
| 27 | #include <linux/io.h> |
| 28 | #include <linux/interrupt.h> |
| 29 | #include <linux/mutex.h> |
| 30 | #include <linux/delay.h> |
| 31 | #include <linux/string.h> |
Tomi Valkeinen | 24e6289 | 2011-05-23 11:51:18 +0300 | [diff] [blame] | 32 | #include <linux/platform_device.h> |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 33 | #include <linux/pm_runtime.h> |
| 34 | #include <linux/clk.h> |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 35 | #include <linux/gpio.h> |
Tomi Valkeinen | 1748694 | 2012-08-15 15:55:04 +0300 | [diff] [blame] | 36 | #include <linux/regulator/consumer.h> |
Tomi Valkeinen | a0b38cc | 2011-05-11 14:05:07 +0300 | [diff] [blame] | 37 | #include <video/omapdss.h> |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 38 | |
Mythri P K | 94c5298 | 2011-09-08 19:06:21 +0530 | [diff] [blame] | 39 | #include "ti_hdmi.h" |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 40 | #include "dss.h" |
Ricardo Neri | ad44cc3 | 2011-05-18 22:31:56 -0500 | [diff] [blame] | 41 | #include "dss_features.h" |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 42 | |
Mythri P K | 95a8aeb | 2011-09-08 19:06:18 +0530 | [diff] [blame] | 43 | #define HDMI_WP 0x0 |
| 44 | #define HDMI_CORE_SYS 0x400 |
| 45 | #define HDMI_CORE_AV 0x900 |
| 46 | #define HDMI_PLLCTRL 0x200 |
| 47 | #define HDMI_PHY 0x300 |
| 48 | |
Mythri P K | 7c1f1ec | 2011-09-08 19:06:22 +0530 | [diff] [blame] | 49 | /* HDMI EDID Length move this */ |
| 50 | #define HDMI_EDID_MAX_LENGTH 256 |
| 51 | #define EDID_TIMING_DESCRIPTOR_SIZE 0x12 |
| 52 | #define EDID_DESCRIPTOR_BLOCK0_ADDRESS 0x36 |
| 53 | #define EDID_DESCRIPTOR_BLOCK1_ADDRESS 0x80 |
| 54 | #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4 |
| 55 | #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4 |
| 56 | |
Tomi Valkeinen | b44e458 | 2011-08-22 13:16:24 +0300 | [diff] [blame] | 57 | #define HDMI_DEFAULT_REGN 16 |
Tomi Valkeinen | 8d88767a | 2011-08-22 13:02:52 +0300 | [diff] [blame] | 58 | #define HDMI_DEFAULT_REGM2 1 |
| 59 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 60 | static struct { |
| 61 | struct mutex lock; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 62 | struct platform_device *pdev; |
Mythri P K | 95a8aeb | 2011-09-08 19:06:18 +0530 | [diff] [blame] | 63 | struct hdmi_ip_data ip_data; |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 64 | |
| 65 | struct clk *sys_clk; |
Tomi Valkeinen | 1748694 | 2012-08-15 15:55:04 +0300 | [diff] [blame] | 66 | struct regulator *vdda_hdmi_dac_reg; |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 67 | |
| 68 | int ct_cp_hpd_gpio; |
| 69 | int ls_oe_gpio; |
| 70 | int hpd_gpio; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 71 | } hdmi; |
| 72 | |
| 73 | /* |
| 74 | * Logic for the below structure : |
| 75 | * user enters the CEA or VESA timings by specifying the HDMI/DVI code. |
| 76 | * There is a correspondence between CEA/VESA timing and code, please |
| 77 | * refer to section 6.3 in HDMI 1.3 specification for timing code. |
| 78 | * |
| 79 | * In the below structure, cea_vesa_timings corresponds to all OMAP4 |
| 80 | * supported CEA and VESA timing values.code_cea corresponds to the CEA |
| 81 | * code, It is used to get the timing from cea_vesa_timing array.Similarly |
| 82 | * with code_vesa. Code_index is used for back mapping, that is once EDID |
| 83 | * is read from the TV, EDID is parsed to find the timing values and then |
| 84 | * map it to corresponding CEA or VESA index. |
| 85 | */ |
| 86 | |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 87 | static const struct hdmi_config cea_timings[] = { |
Archit Taneja | cc937e5 | 2012-06-24 13:08:10 +0530 | [diff] [blame] | 88 | { |
| 89 | { 640, 480, 25200, 96, 16, 48, 2, 10, 33, |
| 90 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 91 | false, }, |
| 92 | { 1, HDMI_HDMI }, |
| 93 | }, |
| 94 | { |
| 95 | { 720, 480, 27027, 62, 16, 60, 6, 9, 30, |
| 96 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 97 | false, }, |
| 98 | { 2, HDMI_HDMI }, |
| 99 | }, |
| 100 | { |
| 101 | { 1280, 720, 74250, 40, 110, 220, 5, 5, 20, |
| 102 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 103 | false, }, |
| 104 | { 4, HDMI_HDMI }, |
| 105 | }, |
| 106 | { |
| 107 | { 1920, 540, 74250, 44, 88, 148, 5, 2, 15, |
| 108 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 109 | true, }, |
| 110 | { 5, HDMI_HDMI }, |
| 111 | }, |
| 112 | { |
| 113 | { 1440, 240, 27027, 124, 38, 114, 3, 4, 15, |
| 114 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 115 | true, }, |
| 116 | { 6, HDMI_HDMI }, |
| 117 | }, |
| 118 | { |
| 119 | { 1920, 1080, 148500, 44, 88, 148, 5, 4, 36, |
| 120 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 121 | false, }, |
| 122 | { 16, HDMI_HDMI }, |
| 123 | }, |
| 124 | { |
| 125 | { 720, 576, 27000, 64, 12, 68, 5, 5, 39, |
| 126 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 127 | false, }, |
| 128 | { 17, HDMI_HDMI }, |
| 129 | }, |
| 130 | { |
| 131 | { 1280, 720, 74250, 40, 440, 220, 5, 5, 20, |
| 132 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 133 | false, }, |
| 134 | { 19, HDMI_HDMI }, |
| 135 | }, |
| 136 | { |
| 137 | { 1920, 540, 74250, 44, 528, 148, 5, 2, 15, |
| 138 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 139 | true, }, |
| 140 | { 20, HDMI_HDMI }, |
| 141 | }, |
| 142 | { |
| 143 | { 1440, 288, 27000, 126, 24, 138, 3, 2, 19, |
| 144 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 145 | true, }, |
| 146 | { 21, HDMI_HDMI }, |
| 147 | }, |
| 148 | { |
| 149 | { 1440, 576, 54000, 128, 24, 136, 5, 5, 39, |
| 150 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 151 | false, }, |
| 152 | { 29, HDMI_HDMI }, |
| 153 | }, |
| 154 | { |
| 155 | { 1920, 1080, 148500, 44, 528, 148, 5, 4, 36, |
| 156 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 157 | false, }, |
| 158 | { 31, HDMI_HDMI }, |
| 159 | }, |
| 160 | { |
| 161 | { 1920, 1080, 74250, 44, 638, 148, 5, 4, 36, |
| 162 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 163 | false, }, |
| 164 | { 32, HDMI_HDMI }, |
| 165 | }, |
| 166 | { |
| 167 | { 2880, 480, 108108, 248, 64, 240, 6, 9, 30, |
| 168 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 169 | false, }, |
| 170 | { 35, HDMI_HDMI }, |
| 171 | }, |
| 172 | { |
| 173 | { 2880, 576, 108000, 256, 48, 272, 5, 5, 39, |
| 174 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 175 | false, }, |
| 176 | { 37, HDMI_HDMI }, |
| 177 | }, |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 178 | }; |
Archit Taneja | cc937e5 | 2012-06-24 13:08:10 +0530 | [diff] [blame] | 179 | |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 180 | static const struct hdmi_config vesa_timings[] = { |
Mythri P K | a05ce78 | 2012-01-06 17:52:08 +0530 | [diff] [blame] | 181 | /* VESA From Here */ |
Archit Taneja | cc937e5 | 2012-06-24 13:08:10 +0530 | [diff] [blame] | 182 | { |
| 183 | { 640, 480, 25175, 96, 16, 48, 2, 11, 31, |
| 184 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 185 | false, }, |
| 186 | { 4, HDMI_DVI }, |
| 187 | }, |
| 188 | { |
| 189 | { 800, 600, 40000, 128, 40, 88, 4, 1, 23, |
| 190 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 191 | false, }, |
| 192 | { 9, HDMI_DVI }, |
| 193 | }, |
| 194 | { |
| 195 | { 848, 480, 33750, 112, 16, 112, 8, 6, 23, |
| 196 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 197 | false, }, |
| 198 | { 0xE, HDMI_DVI }, |
| 199 | }, |
| 200 | { |
| 201 | { 1280, 768, 79500, 128, 64, 192, 7, 3, 20, |
| 202 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW, |
| 203 | false, }, |
| 204 | { 0x17, HDMI_DVI }, |
| 205 | }, |
| 206 | { |
| 207 | { 1280, 800, 83500, 128, 72, 200, 6, 3, 22, |
| 208 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW, |
| 209 | false, }, |
| 210 | { 0x1C, HDMI_DVI }, |
| 211 | }, |
| 212 | { |
| 213 | { 1360, 768, 85500, 112, 64, 256, 6, 3, 18, |
| 214 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 215 | false, }, |
| 216 | { 0x27, HDMI_DVI }, |
| 217 | }, |
| 218 | { |
| 219 | { 1280, 960, 108000, 112, 96, 312, 3, 1, 36, |
| 220 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 221 | false, }, |
| 222 | { 0x20, HDMI_DVI }, |
| 223 | }, |
| 224 | { |
| 225 | { 1280, 1024, 108000, 112, 48, 248, 3, 1, 38, |
| 226 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 227 | false, }, |
| 228 | { 0x23, HDMI_DVI }, |
| 229 | }, |
| 230 | { |
| 231 | { 1024, 768, 65000, 136, 24, 160, 6, 3, 29, |
| 232 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW, |
| 233 | false, }, |
| 234 | { 0x10, HDMI_DVI }, |
| 235 | }, |
| 236 | { |
| 237 | { 1400, 1050, 121750, 144, 88, 232, 4, 3, 32, |
| 238 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW, |
| 239 | false, }, |
| 240 | { 0x2A, HDMI_DVI }, |
| 241 | }, |
| 242 | { |
| 243 | { 1440, 900, 106500, 152, 80, 232, 6, 3, 25, |
| 244 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW, |
| 245 | false, }, |
| 246 | { 0x2F, HDMI_DVI }, |
| 247 | }, |
| 248 | { |
| 249 | { 1680, 1050, 146250, 176 , 104, 280, 6, 3, 30, |
| 250 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW, |
| 251 | false, }, |
| 252 | { 0x3A, HDMI_DVI }, |
| 253 | }, |
| 254 | { |
| 255 | { 1366, 768, 85500, 143, 70, 213, 3, 3, 24, |
| 256 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 257 | false, }, |
| 258 | { 0x51, HDMI_DVI }, |
| 259 | }, |
| 260 | { |
| 261 | { 1920, 1080, 148500, 44, 148, 80, 5, 4, 36, |
| 262 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 263 | false, }, |
| 264 | { 0x52, HDMI_DVI }, |
| 265 | }, |
| 266 | { |
| 267 | { 1280, 768, 68250, 32, 48, 80, 7, 3, 12, |
| 268 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH, |
| 269 | false, }, |
| 270 | { 0x16, HDMI_DVI }, |
| 271 | }, |
| 272 | { |
| 273 | { 1400, 1050, 101000, 32, 48, 80, 4, 3, 23, |
| 274 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH, |
| 275 | false, }, |
| 276 | { 0x29, HDMI_DVI }, |
| 277 | }, |
| 278 | { |
| 279 | { 1680, 1050, 119000, 32, 48, 80, 6, 3, 21, |
| 280 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH, |
| 281 | false, }, |
| 282 | { 0x39, HDMI_DVI }, |
| 283 | }, |
| 284 | { |
| 285 | { 1280, 800, 79500, 32, 48, 80, 6, 3, 14, |
| 286 | OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH, |
| 287 | false, }, |
| 288 | { 0x1B, HDMI_DVI }, |
| 289 | }, |
| 290 | { |
| 291 | { 1280, 720, 74250, 40, 110, 220, 5, 5, 20, |
| 292 | OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH, |
| 293 | false, }, |
| 294 | { 0x55, HDMI_DVI }, |
| 295 | }, |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 296 | }; |
| 297 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 298 | static int hdmi_runtime_get(void) |
| 299 | { |
| 300 | int r; |
| 301 | |
| 302 | DSSDBG("hdmi_runtime_get\n"); |
| 303 | |
| 304 | r = pm_runtime_get_sync(&hdmi.pdev->dev); |
| 305 | WARN_ON(r < 0); |
Archit Taneja | a247ce78 | 2012-02-10 11:45:52 +0530 | [diff] [blame] | 306 | if (r < 0) |
Tomi Valkeinen | 852f083 | 2012-02-17 17:58:04 +0200 | [diff] [blame] | 307 | return r; |
Archit Taneja | a247ce78 | 2012-02-10 11:45:52 +0530 | [diff] [blame] | 308 | |
| 309 | return 0; |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | static void hdmi_runtime_put(void) |
| 313 | { |
| 314 | int r; |
| 315 | |
| 316 | DSSDBG("hdmi_runtime_put\n"); |
| 317 | |
Tomi Valkeinen | 0eaf9f5 | 2012-01-23 13:23:08 +0200 | [diff] [blame] | 318 | r = pm_runtime_put_sync(&hdmi.pdev->dev); |
Tomi Valkeinen | 5be3aeb | 2012-06-27 16:37:18 +0300 | [diff] [blame] | 319 | WARN_ON(r < 0 && r != -ENOSYS); |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 320 | } |
| 321 | |
Tomi Valkeinen | 9d8232a | 2012-03-01 16:58:39 +0200 | [diff] [blame] | 322 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 323 | { |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 324 | int r; |
| 325 | |
| 326 | struct gpio gpios[] = { |
| 327 | { hdmi.ct_cp_hpd_gpio, GPIOF_OUT_INIT_LOW, "hdmi_ct_cp_hpd" }, |
| 328 | { hdmi.ls_oe_gpio, GPIOF_OUT_INIT_LOW, "hdmi_ls_oe" }, |
| 329 | { hdmi.hpd_gpio, GPIOF_DIR_IN, "hdmi_hpd" }, |
| 330 | }; |
| 331 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 332 | DSSDBG("init_display\n"); |
| 333 | |
Mythri P K | 60634a2 | 2011-09-08 19:06:26 +0530 | [diff] [blame] | 334 | dss_init_hdmi_ip_ops(&hdmi.ip_data); |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 335 | |
Tomi Valkeinen | 1748694 | 2012-08-15 15:55:04 +0300 | [diff] [blame] | 336 | if (hdmi.vdda_hdmi_dac_reg == NULL) { |
| 337 | struct regulator *reg; |
| 338 | |
| 339 | reg = devm_regulator_get(&hdmi.pdev->dev, "vdda_hdmi_dac"); |
| 340 | |
| 341 | if (IS_ERR(reg)) { |
| 342 | DSSERR("can't get VDDA_HDMI_DAC regulator\n"); |
| 343 | return PTR_ERR(reg); |
| 344 | } |
| 345 | |
| 346 | hdmi.vdda_hdmi_dac_reg = reg; |
| 347 | } |
| 348 | |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 349 | r = gpio_request_array(gpios, ARRAY_SIZE(gpios)); |
| 350 | if (r) |
| 351 | return r; |
| 352 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 353 | return 0; |
| 354 | } |
| 355 | |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 356 | static void __exit hdmi_uninit_display(struct omap_dss_device *dssdev) |
| 357 | { |
| 358 | DSSDBG("uninit_display\n"); |
| 359 | |
| 360 | gpio_free(hdmi.ct_cp_hpd_gpio); |
| 361 | gpio_free(hdmi.ls_oe_gpio); |
| 362 | gpio_free(hdmi.hpd_gpio); |
| 363 | } |
| 364 | |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 365 | static const struct hdmi_config *hdmi_find_timing( |
| 366 | const struct hdmi_config *timings_arr, |
| 367 | int len) |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 368 | { |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 369 | int i; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 370 | |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 371 | for (i = 0; i < len; i++) { |
Mythri P K | 9e4ed60 | 2012-01-06 17:52:10 +0530 | [diff] [blame] | 372 | if (timings_arr[i].cm.code == hdmi.ip_data.cfg.cm.code) |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 373 | return &timings_arr[i]; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 374 | } |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 375 | return NULL; |
| 376 | } |
| 377 | |
| 378 | static const struct hdmi_config *hdmi_get_timings(void) |
| 379 | { |
| 380 | const struct hdmi_config *arr; |
| 381 | int len; |
| 382 | |
Mythri P K | 9e4ed60 | 2012-01-06 17:52:10 +0530 | [diff] [blame] | 383 | if (hdmi.ip_data.cfg.cm.mode == HDMI_DVI) { |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 384 | arr = vesa_timings; |
| 385 | len = ARRAY_SIZE(vesa_timings); |
| 386 | } else { |
| 387 | arr = cea_timings; |
| 388 | len = ARRAY_SIZE(cea_timings); |
| 389 | } |
| 390 | |
| 391 | return hdmi_find_timing(arr, len); |
| 392 | } |
| 393 | |
| 394 | static bool hdmi_timings_compare(struct omap_video_timings *timing1, |
Archit Taneja | cc937e5 | 2012-06-24 13:08:10 +0530 | [diff] [blame] | 395 | const struct omap_video_timings *timing2) |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 396 | { |
| 397 | int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync; |
| 398 | |
| 399 | if ((timing2->pixel_clock == timing1->pixel_clock) && |
| 400 | (timing2->x_res == timing1->x_res) && |
| 401 | (timing2->y_res == timing1->y_res)) { |
| 402 | |
| 403 | timing2_hsync = timing2->hfp + timing2->hsw + timing2->hbp; |
| 404 | timing1_hsync = timing1->hfp + timing1->hsw + timing1->hbp; |
| 405 | timing2_vsync = timing2->vfp + timing2->vsw + timing2->vbp; |
| 406 | timing1_vsync = timing2->vfp + timing2->vsw + timing2->vbp; |
| 407 | |
| 408 | DSSDBG("timing1_hsync = %d timing1_vsync = %d"\ |
| 409 | "timing2_hsync = %d timing2_vsync = %d\n", |
| 410 | timing1_hsync, timing1_vsync, |
| 411 | timing2_hsync, timing2_vsync); |
| 412 | |
| 413 | if ((timing1_hsync == timing2_hsync) && |
| 414 | (timing1_vsync == timing2_vsync)) { |
| 415 | return true; |
| 416 | } |
| 417 | } |
| 418 | return false; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | static struct hdmi_cm hdmi_get_code(struct omap_video_timings *timing) |
| 422 | { |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 423 | int i; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 424 | struct hdmi_cm cm = {-1}; |
| 425 | DSSDBG("hdmi_get_code\n"); |
| 426 | |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 427 | for (i = 0; i < ARRAY_SIZE(cea_timings); i++) { |
| 428 | if (hdmi_timings_compare(timing, &cea_timings[i].timings)) { |
| 429 | cm = cea_timings[i].cm; |
| 430 | goto end; |
| 431 | } |
| 432 | } |
| 433 | for (i = 0; i < ARRAY_SIZE(vesa_timings); i++) { |
| 434 | if (hdmi_timings_compare(timing, &vesa_timings[i].timings)) { |
| 435 | cm = vesa_timings[i].cm; |
| 436 | goto end; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 437 | } |
| 438 | } |
| 439 | |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 440 | end: return cm; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 441 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 442 | } |
| 443 | |
Archit Taneja | c3dc6a7 | 2011-09-13 18:28:41 +0530 | [diff] [blame] | 444 | unsigned long hdmi_get_pixel_clock(void) |
| 445 | { |
| 446 | /* HDMI Pixel Clock in Mhz */ |
Mythri P K | a05ce78 | 2012-01-06 17:52:08 +0530 | [diff] [blame] | 447 | return hdmi.ip_data.cfg.timings.pixel_clock * 1000; |
Archit Taneja | c3dc6a7 | 2011-09-13 18:28:41 +0530 | [diff] [blame] | 448 | } |
| 449 | |
Archit Taneja | 6cb07b2 | 2011-04-12 13:52:25 +0530 | [diff] [blame] | 450 | static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, |
| 451 | struct hdmi_pll_info *pi) |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 452 | { |
Archit Taneja | 6cb07b2 | 2011-04-12 13:52:25 +0530 | [diff] [blame] | 453 | unsigned long clkin, refclk; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 454 | u32 mf; |
| 455 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 456 | clkin = clk_get_rate(hdmi.sys_clk) / 10000; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 457 | /* |
| 458 | * Input clock is predivided by N + 1 |
| 459 | * out put of which is reference clk |
| 460 | */ |
Tomi Valkeinen | 8d88767a | 2011-08-22 13:02:52 +0300 | [diff] [blame] | 461 | if (dssdev->clocks.hdmi.regn == 0) |
| 462 | pi->regn = HDMI_DEFAULT_REGN; |
| 463 | else |
| 464 | pi->regn = dssdev->clocks.hdmi.regn; |
| 465 | |
Tomi Valkeinen | b44e458 | 2011-08-22 13:16:24 +0300 | [diff] [blame] | 466 | refclk = clkin / pi->regn; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 467 | |
Tomi Valkeinen | 8d88767a | 2011-08-22 13:02:52 +0300 | [diff] [blame] | 468 | if (dssdev->clocks.hdmi.regm2 == 0) |
| 469 | pi->regm2 = HDMI_DEFAULT_REGM2; |
| 470 | else |
| 471 | pi->regm2 = dssdev->clocks.hdmi.regm2; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 472 | |
| 473 | /* |
Mythri P K | dd2116a | 2012-02-21 12:10:58 +0530 | [diff] [blame] | 474 | * multiplier is pixel_clk/ref_clk |
| 475 | * Multiplying by 100 to avoid fractional part removal |
| 476 | */ |
| 477 | pi->regm = phy * pi->regm2 / refclk; |
| 478 | |
| 479 | /* |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 480 | * fractional multiplier is remainder of the difference between |
| 481 | * multiplier and actual phy(required pixel clock thus should be |
| 482 | * multiplied by 2^18(262144) divided by the reference clock |
| 483 | */ |
Mythri P K | dd2116a | 2012-02-21 12:10:58 +0530 | [diff] [blame] | 484 | mf = (phy - pi->regm / pi->regm2 * refclk) * 262144; |
| 485 | pi->regmf = pi->regm2 * mf / refclk; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 486 | |
| 487 | /* |
| 488 | * Dcofreq should be set to 1 if required pixel clock |
| 489 | * is greater than 1000MHz |
| 490 | */ |
| 491 | pi->dcofreq = phy > 1000 * 100; |
Tomi Valkeinen | b44e458 | 2011-08-22 13:16:24 +0300 | [diff] [blame] | 492 | pi->regsd = ((pi->regm * clkin / 10) / (pi->regn * 250) + 5) / 10; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 493 | |
Mythri P K | 7b27da5 | 2011-09-08 19:06:19 +0530 | [diff] [blame] | 494 | /* Set the reference clock to sysclk reference */ |
| 495 | pi->refsel = HDMI_REFSEL_SYSCLK; |
| 496 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 497 | DSSDBG("M = %d Mf = %d\n", pi->regm, pi->regmf); |
| 498 | DSSDBG("range = %d sd = %d\n", pi->dcofreq, pi->regsd); |
| 499 | } |
| 500 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 501 | static int hdmi_power_on(struct omap_dss_device *dssdev) |
| 502 | { |
Mythri P K | 46095b2 | 2012-01-06 17:52:09 +0530 | [diff] [blame] | 503 | int r; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 504 | struct omap_video_timings *p; |
Archit Taneja | 6cb07b2 | 2011-04-12 13:52:25 +0530 | [diff] [blame] | 505 | unsigned long phy; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 506 | |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 507 | gpio_set_value(hdmi.ct_cp_hpd_gpio, 1); |
| 508 | gpio_set_value(hdmi.ls_oe_gpio, 1); |
| 509 | |
Tomi Valkeinen | a84b20654b | 2012-04-26 14:58:41 +0300 | [diff] [blame] | 510 | /* wait 300us after CT_CP_HPD for the 5V power output to reach 90% */ |
| 511 | udelay(300); |
| 512 | |
Tomi Valkeinen | 1748694 | 2012-08-15 15:55:04 +0300 | [diff] [blame] | 513 | r = regulator_enable(hdmi.vdda_hdmi_dac_reg); |
| 514 | if (r) |
| 515 | goto err_vdac_enable; |
| 516 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 517 | r = hdmi_runtime_get(); |
| 518 | if (r) |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 519 | goto err_runtime_get; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 520 | |
Tomi Valkeinen | 7797c6d | 2011-11-04 10:22:46 +0200 | [diff] [blame] | 521 | dss_mgr_disable(dssdev->manager); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 522 | |
Archit Taneja | 7849398 | 2012-08-08 16:50:42 +0530 | [diff] [blame] | 523 | p = &hdmi.ip_data.cfg.timings; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 524 | |
Archit Taneja | 7849398 | 2012-08-08 16:50:42 +0530 | [diff] [blame] | 525 | DSSDBG("hdmi_power_on x_res= %d y_res = %d\n", p->x_res, p->y_res); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 526 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 527 | phy = p->pixel_clock; |
| 528 | |
Mythri P K | 7b27da5 | 2011-09-08 19:06:19 +0530 | [diff] [blame] | 529 | hdmi_compute_pll(dssdev, phy, &hdmi.ip_data.pll_data); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 530 | |
Ricardo Neri | c0456be | 2012-04-27 13:48:45 -0500 | [diff] [blame] | 531 | hdmi.ip_data.ops->video_disable(&hdmi.ip_data); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 532 | |
Mythri P K | 95a8aeb | 2011-09-08 19:06:18 +0530 | [diff] [blame] | 533 | /* config the PLL and PHY hdmi_set_pll_pwrfirst */ |
Mythri P K | 60634a2 | 2011-09-08 19:06:26 +0530 | [diff] [blame] | 534 | r = hdmi.ip_data.ops->pll_enable(&hdmi.ip_data); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 535 | if (r) { |
| 536 | DSSDBG("Failed to lock PLL\n"); |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 537 | goto err_pll_enable; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 538 | } |
| 539 | |
Mythri P K | 60634a2 | 2011-09-08 19:06:26 +0530 | [diff] [blame] | 540 | r = hdmi.ip_data.ops->phy_enable(&hdmi.ip_data); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 541 | if (r) { |
| 542 | DSSDBG("Failed to start PHY\n"); |
Ricardo Neri | d3b4aa5 | 2012-07-30 19:12:02 -0500 | [diff] [blame] | 543 | goto err_phy_enable; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 544 | } |
| 545 | |
Mythri P K | 60634a2 | 2011-09-08 19:06:26 +0530 | [diff] [blame] | 546 | hdmi.ip_data.ops->video_configure(&hdmi.ip_data); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 547 | |
| 548 | /* Make selection of HDMI in DSS */ |
| 549 | dss_select_hdmi_venc_clk_source(DSS_HDMI_M_PCLK); |
| 550 | |
| 551 | /* Select the dispc clock source as PRCM clock, to ensure that it is not |
| 552 | * DSI PLL source as the clock selected by DSI PLL might not be |
| 553 | * sufficient for the resolution selected / that can be changed |
| 554 | * dynamically by user. This can be moved to single location , say |
| 555 | * Boardfile. |
| 556 | */ |
Archit Taneja | 6cb07b2 | 2011-04-12 13:52:25 +0530 | [diff] [blame] | 557 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 558 | |
| 559 | /* bypass TV gamma table */ |
| 560 | dispc_enable_gamma_table(0); |
| 561 | |
| 562 | /* tv size */ |
Archit Taneja | 7849398 | 2012-08-08 16:50:42 +0530 | [diff] [blame] | 563 | dss_mgr_set_timings(dssdev->manager, p); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 564 | |
Ricardo Neri | c0456be | 2012-04-27 13:48:45 -0500 | [diff] [blame] | 565 | r = hdmi.ip_data.ops->video_enable(&hdmi.ip_data); |
| 566 | if (r) |
| 567 | goto err_vid_enable; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 568 | |
Tomi Valkeinen | 33ca237 | 2011-11-21 13:42:58 +0200 | [diff] [blame] | 569 | r = dss_mgr_enable(dssdev->manager); |
| 570 | if (r) |
| 571 | goto err_mgr_enable; |
Tomi Valkeinen | 3870c90 | 2011-08-31 14:47:11 +0300 | [diff] [blame] | 572 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 573 | return 0; |
Tomi Valkeinen | 33ca237 | 2011-11-21 13:42:58 +0200 | [diff] [blame] | 574 | |
| 575 | err_mgr_enable: |
Ricardo Neri | c0456be | 2012-04-27 13:48:45 -0500 | [diff] [blame] | 576 | hdmi.ip_data.ops->video_disable(&hdmi.ip_data); |
| 577 | err_vid_enable: |
Tomi Valkeinen | 33ca237 | 2011-11-21 13:42:58 +0200 | [diff] [blame] | 578 | hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); |
Ricardo Neri | d3b4aa5 | 2012-07-30 19:12:02 -0500 | [diff] [blame] | 579 | err_phy_enable: |
Tomi Valkeinen | 33ca237 | 2011-11-21 13:42:58 +0200 | [diff] [blame] | 580 | hdmi.ip_data.ops->pll_disable(&hdmi.ip_data); |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 581 | err_pll_enable: |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 582 | hdmi_runtime_put(); |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 583 | err_runtime_get: |
Tomi Valkeinen | 1748694 | 2012-08-15 15:55:04 +0300 | [diff] [blame] | 584 | regulator_disable(hdmi.vdda_hdmi_dac_reg); |
| 585 | err_vdac_enable: |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 586 | gpio_set_value(hdmi.ct_cp_hpd_gpio, 0); |
| 587 | gpio_set_value(hdmi.ls_oe_gpio, 0); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 588 | return -EIO; |
| 589 | } |
| 590 | |
| 591 | static void hdmi_power_off(struct omap_dss_device *dssdev) |
| 592 | { |
Tomi Valkeinen | 7797c6d | 2011-11-04 10:22:46 +0200 | [diff] [blame] | 593 | dss_mgr_disable(dssdev->manager); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 594 | |
Ricardo Neri | c0456be | 2012-04-27 13:48:45 -0500 | [diff] [blame] | 595 | hdmi.ip_data.ops->video_disable(&hdmi.ip_data); |
Mythri P K | 60634a2 | 2011-09-08 19:06:26 +0530 | [diff] [blame] | 596 | hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); |
| 597 | hdmi.ip_data.ops->pll_disable(&hdmi.ip_data); |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 598 | hdmi_runtime_put(); |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 599 | |
Tomi Valkeinen | 1748694 | 2012-08-15 15:55:04 +0300 | [diff] [blame] | 600 | regulator_disable(hdmi.vdda_hdmi_dac_reg); |
| 601 | |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 602 | gpio_set_value(hdmi.ct_cp_hpd_gpio, 0); |
| 603 | gpio_set_value(hdmi.ls_oe_gpio, 0); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 604 | } |
| 605 | |
| 606 | int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev, |
| 607 | struct omap_video_timings *timings) |
| 608 | { |
| 609 | struct hdmi_cm cm; |
| 610 | |
| 611 | cm = hdmi_get_code(timings); |
| 612 | if (cm.code == -1) { |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 613 | return -EINVAL; |
| 614 | } |
| 615 | |
| 616 | return 0; |
| 617 | |
| 618 | } |
| 619 | |
Archit Taneja | 7849398 | 2012-08-08 16:50:42 +0530 | [diff] [blame] | 620 | void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev, |
| 621 | struct omap_video_timings *timings) |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 622 | { |
| 623 | struct hdmi_cm cm; |
Archit Taneja | 7849398 | 2012-08-08 16:50:42 +0530 | [diff] [blame] | 624 | const struct hdmi_config *t; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 625 | |
Archit Taneja | ed1aa90 | 2012-08-15 00:40:31 +0530 | [diff] [blame] | 626 | mutex_lock(&hdmi.lock); |
| 627 | |
Archit Taneja | 7849398 | 2012-08-08 16:50:42 +0530 | [diff] [blame] | 628 | cm = hdmi_get_code(timings); |
| 629 | hdmi.ip_data.cfg.cm = cm; |
| 630 | |
| 631 | t = hdmi_get_timings(); |
| 632 | if (t != NULL) |
| 633 | hdmi.ip_data.cfg = *t; |
Tomi Valkeinen | fa70dc5 | 2011-08-22 14:57:33 +0300 | [diff] [blame] | 634 | |
Archit Taneja | ed1aa90 | 2012-08-15 00:40:31 +0530 | [diff] [blame] | 635 | mutex_unlock(&hdmi.lock); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 636 | } |
| 637 | |
Tomi Valkeinen | e40402c | 2012-03-02 18:01:07 +0200 | [diff] [blame] | 638 | static void hdmi_dump_regs(struct seq_file *s) |
Mythri P K | 162874d | 2011-09-22 13:37:45 +0530 | [diff] [blame] | 639 | { |
| 640 | mutex_lock(&hdmi.lock); |
| 641 | |
| 642 | if (hdmi_runtime_get()) |
| 643 | return; |
| 644 | |
| 645 | hdmi.ip_data.ops->dump_wrapper(&hdmi.ip_data, s); |
| 646 | hdmi.ip_data.ops->dump_pll(&hdmi.ip_data, s); |
| 647 | hdmi.ip_data.ops->dump_phy(&hdmi.ip_data, s); |
| 648 | hdmi.ip_data.ops->dump_core(&hdmi.ip_data, s); |
| 649 | |
| 650 | hdmi_runtime_put(); |
| 651 | mutex_unlock(&hdmi.lock); |
| 652 | } |
| 653 | |
Tomi Valkeinen | 4702456 | 2011-08-25 17:12:56 +0300 | [diff] [blame] | 654 | int omapdss_hdmi_read_edid(u8 *buf, int len) |
| 655 | { |
| 656 | int r; |
| 657 | |
| 658 | mutex_lock(&hdmi.lock); |
| 659 | |
| 660 | r = hdmi_runtime_get(); |
| 661 | BUG_ON(r); |
| 662 | |
| 663 | r = hdmi.ip_data.ops->read_edid(&hdmi.ip_data, buf, len); |
| 664 | |
| 665 | hdmi_runtime_put(); |
| 666 | mutex_unlock(&hdmi.lock); |
| 667 | |
| 668 | return r; |
| 669 | } |
| 670 | |
Tomi Valkeinen | 759593f | 2011-08-29 18:10:20 +0300 | [diff] [blame] | 671 | bool omapdss_hdmi_detect(void) |
| 672 | { |
| 673 | int r; |
| 674 | |
| 675 | mutex_lock(&hdmi.lock); |
| 676 | |
| 677 | r = hdmi_runtime_get(); |
| 678 | BUG_ON(r); |
| 679 | |
| 680 | r = hdmi.ip_data.ops->detect(&hdmi.ip_data); |
| 681 | |
| 682 | hdmi_runtime_put(); |
| 683 | mutex_unlock(&hdmi.lock); |
| 684 | |
| 685 | return r == 1; |
| 686 | } |
| 687 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 688 | int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) |
| 689 | { |
| 690 | int r = 0; |
| 691 | |
| 692 | DSSDBG("ENTER hdmi_display_enable\n"); |
| 693 | |
| 694 | mutex_lock(&hdmi.lock); |
| 695 | |
Tomi Valkeinen | 05e1d60 | 2011-06-23 16:38:21 +0300 | [diff] [blame] | 696 | if (dssdev->manager == NULL) { |
| 697 | DSSERR("failed to enable display: no manager\n"); |
| 698 | r = -ENODEV; |
| 699 | goto err0; |
| 700 | } |
| 701 | |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 702 | hdmi.ip_data.hpd_gpio = hdmi.hpd_gpio; |
Tomi Valkeinen | c49d005 | 2012-01-17 11:09:57 +0200 | [diff] [blame] | 703 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 704 | r = omap_dss_start_device(dssdev); |
| 705 | if (r) { |
| 706 | DSSERR("failed to start device\n"); |
| 707 | goto err0; |
| 708 | } |
| 709 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 710 | r = hdmi_power_on(dssdev); |
| 711 | if (r) { |
| 712 | DSSERR("failed to power on device\n"); |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 713 | goto err1; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 714 | } |
| 715 | |
| 716 | mutex_unlock(&hdmi.lock); |
| 717 | return 0; |
| 718 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 719 | err1: |
| 720 | omap_dss_stop_device(dssdev); |
| 721 | err0: |
| 722 | mutex_unlock(&hdmi.lock); |
| 723 | return r; |
| 724 | } |
| 725 | |
| 726 | void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev) |
| 727 | { |
| 728 | DSSDBG("Enter hdmi_display_disable\n"); |
| 729 | |
| 730 | mutex_lock(&hdmi.lock); |
| 731 | |
| 732 | hdmi_power_off(dssdev); |
| 733 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 734 | omap_dss_stop_device(dssdev); |
| 735 | |
| 736 | mutex_unlock(&hdmi.lock); |
| 737 | } |
| 738 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 739 | static int hdmi_get_clocks(struct platform_device *pdev) |
| 740 | { |
| 741 | struct clk *clk; |
| 742 | |
| 743 | clk = clk_get(&pdev->dev, "sys_clk"); |
| 744 | if (IS_ERR(clk)) { |
| 745 | DSSERR("can't get sys_clk\n"); |
| 746 | return PTR_ERR(clk); |
| 747 | } |
| 748 | |
| 749 | hdmi.sys_clk = clk; |
| 750 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 751 | return 0; |
| 752 | } |
| 753 | |
| 754 | static void hdmi_put_clocks(void) |
| 755 | { |
| 756 | if (hdmi.sys_clk) |
| 757 | clk_put(hdmi.sys_clk); |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 758 | } |
| 759 | |
Ricardo Neri | 3554762 | 2012-03-20 21:02:01 -0600 | [diff] [blame] | 760 | #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) |
| 761 | int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) |
| 762 | { |
| 763 | u32 deep_color; |
Ricardo Neri | 25a6535 | 2012-03-23 15:49:02 -0600 | [diff] [blame] | 764 | bool deep_color_correct = false; |
Ricardo Neri | 3554762 | 2012-03-20 21:02:01 -0600 | [diff] [blame] | 765 | u32 pclk = hdmi.ip_data.cfg.timings.pixel_clock; |
| 766 | |
| 767 | if (n == NULL || cts == NULL) |
| 768 | return -EINVAL; |
| 769 | |
| 770 | /* TODO: When implemented, query deep color mode here. */ |
| 771 | deep_color = 100; |
| 772 | |
Ricardo Neri | 25a6535 | 2012-03-23 15:49:02 -0600 | [diff] [blame] | 773 | /* |
| 774 | * When using deep color, the default N value (as in the HDMI |
| 775 | * specification) yields to an non-integer CTS. Hence, we |
| 776 | * modify it while keeping the restrictions described in |
| 777 | * section 7.2.1 of the HDMI 1.4a specification. |
| 778 | */ |
Ricardo Neri | 3554762 | 2012-03-20 21:02:01 -0600 | [diff] [blame] | 779 | switch (sample_freq) { |
| 780 | case 32000: |
Ricardo Neri | 25a6535 | 2012-03-23 15:49:02 -0600 | [diff] [blame] | 781 | case 48000: |
| 782 | case 96000: |
| 783 | case 192000: |
| 784 | if (deep_color == 125) |
| 785 | if (pclk == 27027 || pclk == 74250) |
| 786 | deep_color_correct = true; |
| 787 | if (deep_color == 150) |
| 788 | if (pclk == 27027) |
| 789 | deep_color_correct = true; |
Ricardo Neri | 3554762 | 2012-03-20 21:02:01 -0600 | [diff] [blame] | 790 | break; |
| 791 | case 44100: |
Ricardo Neri | 25a6535 | 2012-03-23 15:49:02 -0600 | [diff] [blame] | 792 | case 88200: |
| 793 | case 176400: |
| 794 | if (deep_color == 125) |
| 795 | if (pclk == 27027) |
| 796 | deep_color_correct = true; |
Ricardo Neri | 3554762 | 2012-03-20 21:02:01 -0600 | [diff] [blame] | 797 | break; |
| 798 | default: |
Ricardo Neri | 3554762 | 2012-03-20 21:02:01 -0600 | [diff] [blame] | 799 | return -EINVAL; |
| 800 | } |
| 801 | |
Ricardo Neri | 25a6535 | 2012-03-23 15:49:02 -0600 | [diff] [blame] | 802 | if (deep_color_correct) { |
| 803 | switch (sample_freq) { |
| 804 | case 32000: |
| 805 | *n = 8192; |
| 806 | break; |
| 807 | case 44100: |
| 808 | *n = 12544; |
| 809 | break; |
| 810 | case 48000: |
| 811 | *n = 8192; |
| 812 | break; |
| 813 | case 88200: |
| 814 | *n = 25088; |
| 815 | break; |
| 816 | case 96000: |
| 817 | *n = 16384; |
| 818 | break; |
| 819 | case 176400: |
| 820 | *n = 50176; |
| 821 | break; |
| 822 | case 192000: |
| 823 | *n = 32768; |
| 824 | break; |
| 825 | default: |
| 826 | return -EINVAL; |
| 827 | } |
| 828 | } else { |
| 829 | switch (sample_freq) { |
| 830 | case 32000: |
| 831 | *n = 4096; |
| 832 | break; |
| 833 | case 44100: |
| 834 | *n = 6272; |
| 835 | break; |
| 836 | case 48000: |
| 837 | *n = 6144; |
| 838 | break; |
| 839 | case 88200: |
| 840 | *n = 12544; |
| 841 | break; |
| 842 | case 96000: |
| 843 | *n = 12288; |
| 844 | break; |
| 845 | case 176400: |
| 846 | *n = 25088; |
| 847 | break; |
| 848 | case 192000: |
| 849 | *n = 24576; |
| 850 | break; |
| 851 | default: |
| 852 | return -EINVAL; |
| 853 | } |
| 854 | } |
Ricardo Neri | 3554762 | 2012-03-20 21:02:01 -0600 | [diff] [blame] | 855 | /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */ |
| 856 | *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10); |
| 857 | |
| 858 | return 0; |
| 859 | } |
Ricardo Neri | f3a97491 | 2012-05-09 21:09:50 -0500 | [diff] [blame] | 860 | |
| 861 | int hdmi_audio_enable(void) |
| 862 | { |
| 863 | DSSDBG("audio_enable\n"); |
| 864 | |
| 865 | return hdmi.ip_data.ops->audio_enable(&hdmi.ip_data); |
| 866 | } |
| 867 | |
| 868 | void hdmi_audio_disable(void) |
| 869 | { |
| 870 | DSSDBG("audio_disable\n"); |
| 871 | |
| 872 | hdmi.ip_data.ops->audio_disable(&hdmi.ip_data); |
| 873 | } |
| 874 | |
| 875 | int hdmi_audio_start(void) |
| 876 | { |
| 877 | DSSDBG("audio_start\n"); |
| 878 | |
| 879 | return hdmi.ip_data.ops->audio_start(&hdmi.ip_data); |
| 880 | } |
| 881 | |
| 882 | void hdmi_audio_stop(void) |
| 883 | { |
| 884 | DSSDBG("audio_stop\n"); |
| 885 | |
| 886 | hdmi.ip_data.ops->audio_stop(&hdmi.ip_data); |
| 887 | } |
| 888 | |
| 889 | bool hdmi_mode_has_audio(void) |
| 890 | { |
| 891 | if (hdmi.ip_data.cfg.cm.mode == HDMI_HDMI) |
| 892 | return true; |
| 893 | else |
| 894 | return false; |
| 895 | } |
| 896 | |
| 897 | int hdmi_audio_config(struct omap_dss_audio *audio) |
| 898 | { |
| 899 | return hdmi.ip_data.ops->audio_config(&hdmi.ip_data, audio); |
| 900 | } |
| 901 | |
Ricardo Neri | 3554762 | 2012-03-20 21:02:01 -0600 | [diff] [blame] | 902 | #endif |
| 903 | |
Tomi Valkeinen | 1521653 | 2012-09-06 14:29:31 +0300 | [diff] [blame] | 904 | static struct omap_dss_device * __init hdmi_find_dssdev(struct platform_device *pdev) |
Tomi Valkeinen | 38f3daf | 2012-05-02 14:55:12 +0300 | [diff] [blame] | 905 | { |
| 906 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; |
Tomi Valkeinen | 1521653 | 2012-09-06 14:29:31 +0300 | [diff] [blame] | 907 | const char *def_disp_name = dss_get_default_display_name(); |
| 908 | struct omap_dss_device *def_dssdev; |
| 909 | int i; |
| 910 | |
| 911 | def_dssdev = NULL; |
Tomi Valkeinen | 38f3daf | 2012-05-02 14:55:12 +0300 | [diff] [blame] | 912 | |
| 913 | for (i = 0; i < pdata->num_devices; ++i) { |
| 914 | struct omap_dss_device *dssdev = pdata->devices[i]; |
| 915 | |
| 916 | if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI) |
| 917 | continue; |
| 918 | |
Tomi Valkeinen | 1521653 | 2012-09-06 14:29:31 +0300 | [diff] [blame] | 919 | if (def_dssdev == NULL) |
| 920 | def_dssdev = dssdev; |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 921 | |
Tomi Valkeinen | 1521653 | 2012-09-06 14:29:31 +0300 | [diff] [blame] | 922 | if (def_disp_name != NULL && |
| 923 | strcmp(dssdev->name, def_disp_name) == 0) { |
| 924 | def_dssdev = dssdev; |
| 925 | break; |
Tomi Valkeinen | 38f3daf | 2012-05-02 14:55:12 +0300 | [diff] [blame] | 926 | } |
Tomi Valkeinen | 1521653 | 2012-09-06 14:29:31 +0300 | [diff] [blame] | 927 | } |
Tomi Valkeinen | 38f3daf | 2012-05-02 14:55:12 +0300 | [diff] [blame] | 928 | |
Tomi Valkeinen | 1521653 | 2012-09-06 14:29:31 +0300 | [diff] [blame] | 929 | return def_dssdev; |
| 930 | } |
| 931 | |
| 932 | static void __init hdmi_probe_pdata(struct platform_device *pdev) |
| 933 | { |
| 934 | struct omap_dss_device *dssdev; |
| 935 | struct omap_dss_hdmi_data *priv; |
| 936 | int r; |
| 937 | |
| 938 | dssdev = hdmi_find_dssdev(pdev); |
| 939 | |
| 940 | if (!dssdev) |
| 941 | return; |
| 942 | |
| 943 | priv = dssdev->data; |
| 944 | |
| 945 | hdmi.ct_cp_hpd_gpio = priv->ct_cp_hpd_gpio; |
| 946 | hdmi.ls_oe_gpio = priv->ls_oe_gpio; |
| 947 | hdmi.hpd_gpio = priv->hpd_gpio; |
| 948 | |
Tomi Valkeinen | bcb226a | 2012-09-07 15:21:36 +0300 | [diff] [blame^] | 949 | dssdev->channel = OMAP_DSS_CHANNEL_DIGIT; |
| 950 | |
Tomi Valkeinen | 1521653 | 2012-09-06 14:29:31 +0300 | [diff] [blame] | 951 | r = hdmi_init_display(dssdev); |
| 952 | if (r) { |
| 953 | DSSERR("device %s init failed: %d\n", dssdev->name, r); |
| 954 | return; |
| 955 | } |
| 956 | |
| 957 | r = omap_dss_register_device(dssdev, &pdev->dev); |
| 958 | if (r) { |
| 959 | DSSERR("device %s register failed: %d\n", dssdev->name, r); |
| 960 | return; |
Tomi Valkeinen | 38f3daf | 2012-05-02 14:55:12 +0300 | [diff] [blame] | 961 | } |
| 962 | } |
| 963 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 964 | /* HDMI HW IP initialisation */ |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 965 | static int __init omapdss_hdmihw_probe(struct platform_device *pdev) |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 966 | { |
| 967 | struct resource *hdmi_mem; |
Tomi Valkeinen | 38f3daf | 2012-05-02 14:55:12 +0300 | [diff] [blame] | 968 | int r; |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 969 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 970 | hdmi.pdev = pdev; |
| 971 | |
| 972 | mutex_init(&hdmi.lock); |
| 973 | |
| 974 | hdmi_mem = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0); |
| 975 | if (!hdmi_mem) { |
| 976 | DSSERR("can't get IORESOURCE_MEM HDMI\n"); |
| 977 | return -EINVAL; |
| 978 | } |
| 979 | |
| 980 | /* Base address taken from platform */ |
Mythri P K | 95a8aeb | 2011-09-08 19:06:18 +0530 | [diff] [blame] | 981 | hdmi.ip_data.base_wp = ioremap(hdmi_mem->start, |
| 982 | resource_size(hdmi_mem)); |
| 983 | if (!hdmi.ip_data.base_wp) { |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 984 | DSSERR("can't ioremap WP\n"); |
| 985 | return -ENOMEM; |
| 986 | } |
| 987 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 988 | r = hdmi_get_clocks(pdev); |
| 989 | if (r) { |
Mythri P K | 95a8aeb | 2011-09-08 19:06:18 +0530 | [diff] [blame] | 990 | iounmap(hdmi.ip_data.base_wp); |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 991 | return r; |
| 992 | } |
| 993 | |
| 994 | pm_runtime_enable(&pdev->dev); |
| 995 | |
Mythri P K | 95a8aeb | 2011-09-08 19:06:18 +0530 | [diff] [blame] | 996 | hdmi.ip_data.core_sys_offset = HDMI_CORE_SYS; |
| 997 | hdmi.ip_data.core_av_offset = HDMI_CORE_AV; |
| 998 | hdmi.ip_data.pll_offset = HDMI_PLLCTRL; |
| 999 | hdmi.ip_data.phy_offset = HDMI_PHY; |
Archit Taneja | 7849398 | 2012-08-08 16:50:42 +0530 | [diff] [blame] | 1000 | |
Jassi Brar | 3a5383a | 2012-06-27 19:34:56 +0530 | [diff] [blame] | 1001 | mutex_init(&hdmi.ip_data.lock); |
Mythri P K | 95a8aeb | 2011-09-08 19:06:18 +0530 | [diff] [blame] | 1002 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1003 | hdmi_panel_init(); |
| 1004 | |
Tomi Valkeinen | e40402c | 2012-03-02 18:01:07 +0200 | [diff] [blame] | 1005 | dss_debugfs_create_file("hdmi", hdmi_dump_regs); |
| 1006 | |
Tomi Valkeinen | 38f3daf | 2012-05-02 14:55:12 +0300 | [diff] [blame] | 1007 | hdmi_probe_pdata(pdev); |
Tomi Valkeinen | 35deca3 | 2012-03-01 15:45:53 +0200 | [diff] [blame] | 1008 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1009 | return 0; |
| 1010 | } |
| 1011 | |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 1012 | static int __exit hdmi_remove_child(struct device *dev, void *data) |
| 1013 | { |
| 1014 | struct omap_dss_device *dssdev = to_dss_device(dev); |
| 1015 | hdmi_uninit_display(dssdev); |
| 1016 | return 0; |
| 1017 | } |
| 1018 | |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 1019 | static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1020 | { |
Tomi Valkeinen | cca3501 | 2012-04-26 14:48:32 +0300 | [diff] [blame] | 1021 | device_for_each_child(&pdev->dev, NULL, hdmi_remove_child); |
| 1022 | |
Tomi Valkeinen | 35deca3 | 2012-03-01 15:45:53 +0200 | [diff] [blame] | 1023 | omap_dss_unregister_child_devices(&pdev->dev); |
| 1024 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1025 | hdmi_panel_exit(); |
| 1026 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 1027 | pm_runtime_disable(&pdev->dev); |
| 1028 | |
| 1029 | hdmi_put_clocks(); |
| 1030 | |
Mythri P K | 95a8aeb | 2011-09-08 19:06:18 +0530 | [diff] [blame] | 1031 | iounmap(hdmi.ip_data.base_wp); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1032 | |
| 1033 | return 0; |
| 1034 | } |
| 1035 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 1036 | static int hdmi_runtime_suspend(struct device *dev) |
| 1037 | { |
Rajendra Nayak | f11766d | 2012-06-27 14:21:26 +0530 | [diff] [blame] | 1038 | clk_disable_unprepare(hdmi.sys_clk); |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 1039 | |
| 1040 | dispc_runtime_put(); |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 1041 | |
| 1042 | return 0; |
| 1043 | } |
| 1044 | |
| 1045 | static int hdmi_runtime_resume(struct device *dev) |
| 1046 | { |
| 1047 | int r; |
| 1048 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 1049 | r = dispc_runtime_get(); |
| 1050 | if (r < 0) |
Tomi Valkeinen | 852f083 | 2012-02-17 17:58:04 +0200 | [diff] [blame] | 1051 | return r; |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 1052 | |
Rajendra Nayak | f11766d | 2012-06-27 14:21:26 +0530 | [diff] [blame] | 1053 | clk_prepare_enable(hdmi.sys_clk); |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 1054 | |
| 1055 | return 0; |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 1056 | } |
| 1057 | |
| 1058 | static const struct dev_pm_ops hdmi_pm_ops = { |
| 1059 | .runtime_suspend = hdmi_runtime_suspend, |
| 1060 | .runtime_resume = hdmi_runtime_resume, |
| 1061 | }; |
| 1062 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1063 | static struct platform_driver omapdss_hdmihw_driver = { |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 1064 | .remove = __exit_p(omapdss_hdmihw_remove), |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1065 | .driver = { |
| 1066 | .name = "omapdss_hdmi", |
| 1067 | .owner = THIS_MODULE, |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 1068 | .pm = &hdmi_pm_ops, |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1069 | }, |
| 1070 | }; |
| 1071 | |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 1072 | int __init hdmi_init_platform_driver(void) |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1073 | { |
Tomi Valkeinen | 61055d4 | 2012-03-07 12:53:38 +0200 | [diff] [blame] | 1074 | return platform_driver_probe(&omapdss_hdmihw_driver, omapdss_hdmihw_probe); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1075 | } |
| 1076 | |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 1077 | void __exit hdmi_uninit_platform_driver(void) |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1078 | { |
Tomi Valkeinen | 04c742c | 2012-02-23 15:32:37 +0200 | [diff] [blame] | 1079 | platform_driver_unregister(&omapdss_hdmihw_driver); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 1080 | } |