hdmi_drv.c 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. /*
  2. * Samsung HDMI interface driver
  3. *
  4. * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  5. *
  6. * Tomasz Stanislawski, <t.stanislaws@samsung.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published
  10. * by the Free Software Foundiation. either version 2 of the License,
  11. * or (at your option) any later version
  12. */
  13. #define pr_fmt(fmt) "s5p-tv (hdmi_drv): " fmt
  14. #ifdef CONFIG_VIDEO_SAMSUNG_S5P_HDMI_DEBUG
  15. #define DEBUG
  16. #endif
  17. #include <linux/kernel.h>
  18. #include <linux/slab.h>
  19. #include <linux/io.h>
  20. #include <linux/i2c.h>
  21. #include <linux/platform_device.h>
  22. #include <media/v4l2-subdev.h>
  23. #include <linux/module.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/irq.h>
  26. #include <linux/delay.h>
  27. #include <linux/bug.h>
  28. #include <linux/pm_runtime.h>
  29. #include <linux/clk.h>
  30. #include <linux/regulator/consumer.h>
  31. #include <linux/v4l2-dv-timings.h>
  32. #include <media/s5p_hdmi.h>
  33. #include <media/v4l2-common.h>
  34. #include <media/v4l2-dev.h>
  35. #include <media/v4l2-device.h>
  36. #include "regs-hdmi.h"
  37. MODULE_AUTHOR("Tomasz Stanislawski, <t.stanislaws@samsung.com>");
  38. MODULE_DESCRIPTION("Samsung HDMI");
  39. MODULE_LICENSE("GPL");
  40. struct hdmi_pulse {
  41. u32 beg;
  42. u32 end;
  43. };
  44. struct hdmi_timings {
  45. struct hdmi_pulse hact;
  46. u32 hsyn_pol; /* 0 - high, 1 - low */
  47. struct hdmi_pulse hsyn;
  48. u32 interlaced;
  49. struct hdmi_pulse vact[2];
  50. u32 vsyn_pol; /* 0 - high, 1 - low */
  51. u32 vsyn_off;
  52. struct hdmi_pulse vsyn[2];
  53. };
  54. struct hdmi_resources {
  55. struct clk *hdmi;
  56. struct clk *sclk_hdmi;
  57. struct clk *sclk_pixel;
  58. struct clk *sclk_hdmiphy;
  59. struct clk *hdmiphy;
  60. struct regulator_bulk_data *regul_bulk;
  61. int regul_count;
  62. };
  63. struct hdmi_device {
  64. /** base address of HDMI registers */
  65. void __iomem *regs;
  66. /** HDMI interrupt */
  67. unsigned int irq;
  68. /** pointer to device parent */
  69. struct device *dev;
  70. /** subdev generated by HDMI device */
  71. struct v4l2_subdev sd;
  72. /** V4L2 device structure */
  73. struct v4l2_device v4l2_dev;
  74. /** subdev of HDMIPHY interface */
  75. struct v4l2_subdev *phy_sd;
  76. /** subdev of MHL interface */
  77. struct v4l2_subdev *mhl_sd;
  78. /** configuration of current graphic mode */
  79. const struct hdmi_timings *cur_conf;
  80. /** flag indicating that timings are dirty */
  81. int cur_conf_dirty;
  82. /** current timings */
  83. struct v4l2_dv_timings cur_timings;
  84. /** other resources */
  85. struct hdmi_resources res;
  86. };
  87. static struct platform_device_id hdmi_driver_types[] = {
  88. {
  89. .name = "s5pv210-hdmi",
  90. }, {
  91. .name = "exynos4-hdmi",
  92. }, {
  93. /* end node */
  94. }
  95. };
  96. static const struct v4l2_subdev_ops hdmi_sd_ops;
  97. static struct hdmi_device *sd_to_hdmi_dev(struct v4l2_subdev *sd)
  98. {
  99. return container_of(sd, struct hdmi_device, sd);
  100. }
  101. static inline
  102. void hdmi_write(struct hdmi_device *hdev, u32 reg_id, u32 value)
  103. {
  104. writel(value, hdev->regs + reg_id);
  105. }
  106. static inline
  107. void hdmi_write_mask(struct hdmi_device *hdev, u32 reg_id, u32 value, u32 mask)
  108. {
  109. u32 old = readl(hdev->regs + reg_id);
  110. value = (value & mask) | (old & ~mask);
  111. writel(value, hdev->regs + reg_id);
  112. }
  113. static inline
  114. void hdmi_writeb(struct hdmi_device *hdev, u32 reg_id, u8 value)
  115. {
  116. writeb(value, hdev->regs + reg_id);
  117. }
  118. static inline
  119. void hdmi_writebn(struct hdmi_device *hdev, u32 reg_id, int n, u32 value)
  120. {
  121. switch (n) {
  122. default:
  123. writeb(value >> 24, hdev->regs + reg_id + 12);
  124. case 3:
  125. writeb(value >> 16, hdev->regs + reg_id + 8);
  126. case 2:
  127. writeb(value >> 8, hdev->regs + reg_id + 4);
  128. case 1:
  129. writeb(value >> 0, hdev->regs + reg_id + 0);
  130. }
  131. }
  132. static inline u32 hdmi_read(struct hdmi_device *hdev, u32 reg_id)
  133. {
  134. return readl(hdev->regs + reg_id);
  135. }
  136. static irqreturn_t hdmi_irq_handler(int irq, void *dev_data)
  137. {
  138. struct hdmi_device *hdev = dev_data;
  139. u32 intc_flag;
  140. (void)irq;
  141. intc_flag = hdmi_read(hdev, HDMI_INTC_FLAG);
  142. /* clearing flags for HPD plug/unplug */
  143. if (intc_flag & HDMI_INTC_FLAG_HPD_UNPLUG) {
  144. pr_info("unplugged\n");
  145. hdmi_write_mask(hdev, HDMI_INTC_FLAG, ~0,
  146. HDMI_INTC_FLAG_HPD_UNPLUG);
  147. }
  148. if (intc_flag & HDMI_INTC_FLAG_HPD_PLUG) {
  149. pr_info("plugged\n");
  150. hdmi_write_mask(hdev, HDMI_INTC_FLAG, ~0,
  151. HDMI_INTC_FLAG_HPD_PLUG);
  152. }
  153. return IRQ_HANDLED;
  154. }
  155. static void hdmi_reg_init(struct hdmi_device *hdev)
  156. {
  157. /* enable HPD interrupts */
  158. hdmi_write_mask(hdev, HDMI_INTC_CON, ~0, HDMI_INTC_EN_GLOBAL |
  159. HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG);
  160. /* choose DVI mode */
  161. hdmi_write_mask(hdev, HDMI_MODE_SEL,
  162. HDMI_MODE_DVI_EN, HDMI_MODE_MASK);
  163. hdmi_write_mask(hdev, HDMI_CON_2, ~0,
  164. HDMI_DVI_PERAMBLE_EN | HDMI_DVI_BAND_EN);
  165. /* disable bluescreen */
  166. hdmi_write_mask(hdev, HDMI_CON_0, 0, HDMI_BLUE_SCR_EN);
  167. /* choose bluescreen (fecal) color */
  168. hdmi_writeb(hdev, HDMI_BLUE_SCREEN_0, 0x12);
  169. hdmi_writeb(hdev, HDMI_BLUE_SCREEN_1, 0x34);
  170. hdmi_writeb(hdev, HDMI_BLUE_SCREEN_2, 0x56);
  171. }
  172. static void hdmi_timing_apply(struct hdmi_device *hdev,
  173. const struct hdmi_timings *t)
  174. {
  175. /* setting core registers */
  176. hdmi_writebn(hdev, HDMI_H_BLANK_0, 2, t->hact.beg);
  177. hdmi_writebn(hdev, HDMI_H_SYNC_GEN_0, 3,
  178. (t->hsyn_pol << 20) | (t->hsyn.end << 10) | t->hsyn.beg);
  179. hdmi_writeb(hdev, HDMI_VSYNC_POL, t->vsyn_pol);
  180. hdmi_writebn(hdev, HDMI_V_BLANK_0, 3,
  181. (t->vact[0].beg << 11) | t->vact[0].end);
  182. hdmi_writebn(hdev, HDMI_V_SYNC_GEN_1_0, 3,
  183. (t->vsyn[0].beg << 12) | t->vsyn[0].end);
  184. if (t->interlaced) {
  185. u32 vsyn_trans = t->hsyn.beg + t->vsyn_off;
  186. hdmi_writeb(hdev, HDMI_INT_PRO_MODE, 1);
  187. hdmi_writebn(hdev, HDMI_H_V_LINE_0, 3,
  188. (t->hact.end << 12) | t->vact[1].end);
  189. hdmi_writebn(hdev, HDMI_V_BLANK_F_0, 3,
  190. (t->vact[1].end << 11) | t->vact[1].beg);
  191. hdmi_writebn(hdev, HDMI_V_SYNC_GEN_2_0, 3,
  192. (t->vsyn[1].beg << 12) | t->vsyn[1].end);
  193. hdmi_writebn(hdev, HDMI_V_SYNC_GEN_3_0, 3,
  194. (vsyn_trans << 12) | vsyn_trans);
  195. } else {
  196. hdmi_writeb(hdev, HDMI_INT_PRO_MODE, 0);
  197. hdmi_writebn(hdev, HDMI_H_V_LINE_0, 3,
  198. (t->hact.end << 12) | t->vact[0].end);
  199. }
  200. /* Timing generator registers */
  201. hdmi_writebn(hdev, HDMI_TG_H_FSZ_L, 2, t->hact.end);
  202. hdmi_writebn(hdev, HDMI_TG_HACT_ST_L, 2, t->hact.beg);
  203. hdmi_writebn(hdev, HDMI_TG_HACT_SZ_L, 2, t->hact.end - t->hact.beg);
  204. hdmi_writebn(hdev, HDMI_TG_VSYNC_L, 2, t->vsyn[0].beg);
  205. hdmi_writebn(hdev, HDMI_TG_VACT_ST_L, 2, t->vact[0].beg);
  206. hdmi_writebn(hdev, HDMI_TG_VACT_SZ_L, 2,
  207. t->vact[0].end - t->vact[0].beg);
  208. hdmi_writebn(hdev, HDMI_TG_VSYNC_TOP_HDMI_L, 2, t->vsyn[0].beg);
  209. hdmi_writebn(hdev, HDMI_TG_FIELD_TOP_HDMI_L, 2, t->vsyn[0].beg);
  210. if (t->interlaced) {
  211. hdmi_write_mask(hdev, HDMI_TG_CMD, ~0, HDMI_TG_FIELD_EN);
  212. hdmi_writebn(hdev, HDMI_TG_V_FSZ_L, 2, t->vact[1].end);
  213. hdmi_writebn(hdev, HDMI_TG_VSYNC2_L, 2, t->vsyn[1].beg);
  214. hdmi_writebn(hdev, HDMI_TG_FIELD_CHG_L, 2, t->vact[0].end);
  215. hdmi_writebn(hdev, HDMI_TG_VACT_ST2_L, 2, t->vact[1].beg);
  216. hdmi_writebn(hdev, HDMI_TG_VSYNC_BOT_HDMI_L, 2, t->vsyn[1].beg);
  217. hdmi_writebn(hdev, HDMI_TG_FIELD_BOT_HDMI_L, 2, t->vsyn[1].beg);
  218. } else {
  219. hdmi_write_mask(hdev, HDMI_TG_CMD, 0, HDMI_TG_FIELD_EN);
  220. hdmi_writebn(hdev, HDMI_TG_V_FSZ_L, 2, t->vact[0].end);
  221. }
  222. }
  223. static int hdmi_conf_apply(struct hdmi_device *hdmi_dev)
  224. {
  225. struct device *dev = hdmi_dev->dev;
  226. const struct hdmi_timings *conf = hdmi_dev->cur_conf;
  227. int ret;
  228. dev_dbg(dev, "%s\n", __func__);
  229. /* skip if conf is already synchronized with HW */
  230. if (!hdmi_dev->cur_conf_dirty)
  231. return 0;
  232. /* reset hdmiphy */
  233. hdmi_write_mask(hdmi_dev, HDMI_PHY_RSTOUT, ~0, HDMI_PHY_SW_RSTOUT);
  234. mdelay(10);
  235. hdmi_write_mask(hdmi_dev, HDMI_PHY_RSTOUT, 0, HDMI_PHY_SW_RSTOUT);
  236. mdelay(10);
  237. /* configure timings */
  238. ret = v4l2_subdev_call(hdmi_dev->phy_sd, video, s_dv_timings,
  239. &hdmi_dev->cur_timings);
  240. if (ret) {
  241. dev_err(dev, "failed to set timings\n");
  242. return ret;
  243. }
  244. /* resetting HDMI core */
  245. hdmi_write_mask(hdmi_dev, HDMI_CORE_RSTOUT, 0, HDMI_CORE_SW_RSTOUT);
  246. mdelay(10);
  247. hdmi_write_mask(hdmi_dev, HDMI_CORE_RSTOUT, ~0, HDMI_CORE_SW_RSTOUT);
  248. mdelay(10);
  249. hdmi_reg_init(hdmi_dev);
  250. /* setting core registers */
  251. hdmi_timing_apply(hdmi_dev, conf);
  252. hdmi_dev->cur_conf_dirty = 0;
  253. return 0;
  254. }
  255. static void hdmi_dumpregs(struct hdmi_device *hdev, char *prefix)
  256. {
  257. #define DUMPREG(reg_id) \
  258. dev_dbg(hdev->dev, "%s:" #reg_id " = %08x\n", prefix, \
  259. readl(hdev->regs + reg_id))
  260. dev_dbg(hdev->dev, "%s: ---- CONTROL REGISTERS ----\n", prefix);
  261. DUMPREG(HDMI_INTC_FLAG);
  262. DUMPREG(HDMI_INTC_CON);
  263. DUMPREG(HDMI_HPD_STATUS);
  264. DUMPREG(HDMI_PHY_RSTOUT);
  265. DUMPREG(HDMI_PHY_VPLL);
  266. DUMPREG(HDMI_PHY_CMU);
  267. DUMPREG(HDMI_CORE_RSTOUT);
  268. dev_dbg(hdev->dev, "%s: ---- CORE REGISTERS ----\n", prefix);
  269. DUMPREG(HDMI_CON_0);
  270. DUMPREG(HDMI_CON_1);
  271. DUMPREG(HDMI_CON_2);
  272. DUMPREG(HDMI_SYS_STATUS);
  273. DUMPREG(HDMI_PHY_STATUS);
  274. DUMPREG(HDMI_STATUS_EN);
  275. DUMPREG(HDMI_HPD);
  276. DUMPREG(HDMI_MODE_SEL);
  277. DUMPREG(HDMI_HPD_GEN);
  278. DUMPREG(HDMI_DC_CONTROL);
  279. DUMPREG(HDMI_VIDEO_PATTERN_GEN);
  280. dev_dbg(hdev->dev, "%s: ---- CORE SYNC REGISTERS ----\n", prefix);
  281. DUMPREG(HDMI_H_BLANK_0);
  282. DUMPREG(HDMI_H_BLANK_1);
  283. DUMPREG(HDMI_V_BLANK_0);
  284. DUMPREG(HDMI_V_BLANK_1);
  285. DUMPREG(HDMI_V_BLANK_2);
  286. DUMPREG(HDMI_H_V_LINE_0);
  287. DUMPREG(HDMI_H_V_LINE_1);
  288. DUMPREG(HDMI_H_V_LINE_2);
  289. DUMPREG(HDMI_VSYNC_POL);
  290. DUMPREG(HDMI_INT_PRO_MODE);
  291. DUMPREG(HDMI_V_BLANK_F_0);
  292. DUMPREG(HDMI_V_BLANK_F_1);
  293. DUMPREG(HDMI_V_BLANK_F_2);
  294. DUMPREG(HDMI_H_SYNC_GEN_0);
  295. DUMPREG(HDMI_H_SYNC_GEN_1);
  296. DUMPREG(HDMI_H_SYNC_GEN_2);
  297. DUMPREG(HDMI_V_SYNC_GEN_1_0);
  298. DUMPREG(HDMI_V_SYNC_GEN_1_1);
  299. DUMPREG(HDMI_V_SYNC_GEN_1_2);
  300. DUMPREG(HDMI_V_SYNC_GEN_2_0);
  301. DUMPREG(HDMI_V_SYNC_GEN_2_1);
  302. DUMPREG(HDMI_V_SYNC_GEN_2_2);
  303. DUMPREG(HDMI_V_SYNC_GEN_3_0);
  304. DUMPREG(HDMI_V_SYNC_GEN_3_1);
  305. DUMPREG(HDMI_V_SYNC_GEN_3_2);
  306. dev_dbg(hdev->dev, "%s: ---- TG REGISTERS ----\n", prefix);
  307. DUMPREG(HDMI_TG_CMD);
  308. DUMPREG(HDMI_TG_H_FSZ_L);
  309. DUMPREG(HDMI_TG_H_FSZ_H);
  310. DUMPREG(HDMI_TG_HACT_ST_L);
  311. DUMPREG(HDMI_TG_HACT_ST_H);
  312. DUMPREG(HDMI_TG_HACT_SZ_L);
  313. DUMPREG(HDMI_TG_HACT_SZ_H);
  314. DUMPREG(HDMI_TG_V_FSZ_L);
  315. DUMPREG(HDMI_TG_V_FSZ_H);
  316. DUMPREG(HDMI_TG_VSYNC_L);
  317. DUMPREG(HDMI_TG_VSYNC_H);
  318. DUMPREG(HDMI_TG_VSYNC2_L);
  319. DUMPREG(HDMI_TG_VSYNC2_H);
  320. DUMPREG(HDMI_TG_VACT_ST_L);
  321. DUMPREG(HDMI_TG_VACT_ST_H);
  322. DUMPREG(HDMI_TG_VACT_SZ_L);
  323. DUMPREG(HDMI_TG_VACT_SZ_H);
  324. DUMPREG(HDMI_TG_FIELD_CHG_L);
  325. DUMPREG(HDMI_TG_FIELD_CHG_H);
  326. DUMPREG(HDMI_TG_VACT_ST2_L);
  327. DUMPREG(HDMI_TG_VACT_ST2_H);
  328. DUMPREG(HDMI_TG_VSYNC_TOP_HDMI_L);
  329. DUMPREG(HDMI_TG_VSYNC_TOP_HDMI_H);
  330. DUMPREG(HDMI_TG_VSYNC_BOT_HDMI_L);
  331. DUMPREG(HDMI_TG_VSYNC_BOT_HDMI_H);
  332. DUMPREG(HDMI_TG_FIELD_TOP_HDMI_L);
  333. DUMPREG(HDMI_TG_FIELD_TOP_HDMI_H);
  334. DUMPREG(HDMI_TG_FIELD_BOT_HDMI_L);
  335. DUMPREG(HDMI_TG_FIELD_BOT_HDMI_H);
  336. #undef DUMPREG
  337. }
  338. static const struct hdmi_timings hdmi_timings_480p = {
  339. .hact = { .beg = 138, .end = 858 },
  340. .hsyn_pol = 1,
  341. .hsyn = { .beg = 16, .end = 16 + 62 },
  342. .interlaced = 0,
  343. .vact[0] = { .beg = 42 + 3, .end = 522 + 3 },
  344. .vsyn_pol = 1,
  345. .vsyn[0] = { .beg = 6 + 3, .end = 12 + 3},
  346. };
  347. static const struct hdmi_timings hdmi_timings_576p50 = {
  348. .hact = { .beg = 144, .end = 864 },
  349. .hsyn_pol = 1,
  350. .hsyn = { .beg = 12, .end = 12 + 64 },
  351. .interlaced = 0,
  352. .vact[0] = { .beg = 44 + 5, .end = 620 + 5 },
  353. .vsyn_pol = 1,
  354. .vsyn[0] = { .beg = 0 + 5, .end = 5 + 5},
  355. };
  356. static const struct hdmi_timings hdmi_timings_720p60 = {
  357. .hact = { .beg = 370, .end = 1650 },
  358. .hsyn_pol = 0,
  359. .hsyn = { .beg = 110, .end = 110 + 40 },
  360. .interlaced = 0,
  361. .vact[0] = { .beg = 25 + 5, .end = 745 + 5 },
  362. .vsyn_pol = 0,
  363. .vsyn[0] = { .beg = 0 + 5, .end = 5 + 5},
  364. };
  365. static const struct hdmi_timings hdmi_timings_720p50 = {
  366. .hact = { .beg = 700, .end = 1980 },
  367. .hsyn_pol = 0,
  368. .hsyn = { .beg = 440, .end = 440 + 40 },
  369. .interlaced = 0,
  370. .vact[0] = { .beg = 25 + 5, .end = 745 + 5 },
  371. .vsyn_pol = 0,
  372. .vsyn[0] = { .beg = 0 + 5, .end = 5 + 5},
  373. };
  374. static const struct hdmi_timings hdmi_timings_1080p24 = {
  375. .hact = { .beg = 830, .end = 2750 },
  376. .hsyn_pol = 0,
  377. .hsyn = { .beg = 638, .end = 638 + 44 },
  378. .interlaced = 0,
  379. .vact[0] = { .beg = 41 + 4, .end = 1121 + 4 },
  380. .vsyn_pol = 0,
  381. .vsyn[0] = { .beg = 0 + 4, .end = 5 + 4},
  382. };
  383. static const struct hdmi_timings hdmi_timings_1080p60 = {
  384. .hact = { .beg = 280, .end = 2200 },
  385. .hsyn_pol = 0,
  386. .hsyn = { .beg = 88, .end = 88 + 44 },
  387. .interlaced = 0,
  388. .vact[0] = { .beg = 41 + 4, .end = 1121 + 4 },
  389. .vsyn_pol = 0,
  390. .vsyn[0] = { .beg = 0 + 4, .end = 5 + 4},
  391. };
  392. static const struct hdmi_timings hdmi_timings_1080i60 = {
  393. .hact = { .beg = 280, .end = 2200 },
  394. .hsyn_pol = 0,
  395. .hsyn = { .beg = 88, .end = 88 + 44 },
  396. .interlaced = 1,
  397. .vact[0] = { .beg = 20 + 2, .end = 560 + 2 },
  398. .vact[1] = { .beg = 583 + 2, .end = 1123 + 2 },
  399. .vsyn_pol = 0,
  400. .vsyn_off = 1100,
  401. .vsyn[0] = { .beg = 0 + 2, .end = 5 + 2},
  402. .vsyn[1] = { .beg = 562 + 2, .end = 567 + 2},
  403. };
  404. static const struct hdmi_timings hdmi_timings_1080i50 = {
  405. .hact = { .beg = 720, .end = 2640 },
  406. .hsyn_pol = 0,
  407. .hsyn = { .beg = 528, .end = 528 + 44 },
  408. .interlaced = 1,
  409. .vact[0] = { .beg = 20 + 2, .end = 560 + 2 },
  410. .vact[1] = { .beg = 583 + 2, .end = 1123 + 2 },
  411. .vsyn_pol = 0,
  412. .vsyn_off = 1320,
  413. .vsyn[0] = { .beg = 0 + 2, .end = 5 + 2},
  414. .vsyn[1] = { .beg = 562 + 2, .end = 567 + 2},
  415. };
  416. static const struct hdmi_timings hdmi_timings_1080p50 = {
  417. .hact = { .beg = 720, .end = 2640 },
  418. .hsyn_pol = 0,
  419. .hsyn = { .beg = 528, .end = 528 + 44 },
  420. .interlaced = 0,
  421. .vact[0] = { .beg = 41 + 4, .end = 1121 + 4 },
  422. .vsyn_pol = 0,
  423. .vsyn[0] = { .beg = 0 + 4, .end = 5 + 4},
  424. };
  425. /* default hdmi_timings index of the timings configured on probe */
  426. #define HDMI_DEFAULT_TIMINGS_IDX (0)
  427. static const struct {
  428. bool reduced_fps;
  429. const struct v4l2_dv_timings dv_timings;
  430. const struct hdmi_timings *hdmi_timings;
  431. } hdmi_timings[] = {
  432. { false, V4L2_DV_BT_CEA_720X480P59_94, &hdmi_timings_480p },
  433. { false, V4L2_DV_BT_CEA_720X576P50, &hdmi_timings_576p50 },
  434. { false, V4L2_DV_BT_CEA_1280X720P50, &hdmi_timings_720p50 },
  435. { true, V4L2_DV_BT_CEA_1280X720P60, &hdmi_timings_720p60 },
  436. { false, V4L2_DV_BT_CEA_1920X1080P24, &hdmi_timings_1080p24 },
  437. { false, V4L2_DV_BT_CEA_1920X1080P30, &hdmi_timings_1080p60 },
  438. { false, V4L2_DV_BT_CEA_1920X1080P50, &hdmi_timings_1080p50 },
  439. { false, V4L2_DV_BT_CEA_1920X1080I50, &hdmi_timings_1080i50 },
  440. { false, V4L2_DV_BT_CEA_1920X1080I60, &hdmi_timings_1080i60 },
  441. { false, V4L2_DV_BT_CEA_1920X1080P60, &hdmi_timings_1080p60 },
  442. };
  443. static int hdmi_streamon(struct hdmi_device *hdev)
  444. {
  445. struct device *dev = hdev->dev;
  446. struct hdmi_resources *res = &hdev->res;
  447. int ret, tries;
  448. dev_dbg(dev, "%s\n", __func__);
  449. ret = hdmi_conf_apply(hdev);
  450. if (ret)
  451. return ret;
  452. ret = v4l2_subdev_call(hdev->phy_sd, video, s_stream, 1);
  453. if (ret)
  454. return ret;
  455. /* waiting for HDMIPHY's PLL to get to steady state */
  456. for (tries = 100; tries; --tries) {
  457. u32 val = hdmi_read(hdev, HDMI_PHY_STATUS);
  458. if (val & HDMI_PHY_STATUS_READY)
  459. break;
  460. mdelay(1);
  461. }
  462. /* steady state not achieved */
  463. if (tries == 0) {
  464. dev_err(dev, "hdmiphy's pll could not reach steady state.\n");
  465. v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0);
  466. hdmi_dumpregs(hdev, "hdmiphy - s_stream");
  467. return -EIO;
  468. }
  469. /* starting MHL */
  470. ret = v4l2_subdev_call(hdev->mhl_sd, video, s_stream, 1);
  471. if (hdev->mhl_sd && ret) {
  472. v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0);
  473. hdmi_dumpregs(hdev, "mhl - s_stream");
  474. return -EIO;
  475. }
  476. /* hdmiphy clock is used for HDMI in streaming mode */
  477. clk_disable(res->sclk_hdmi);
  478. clk_set_parent(res->sclk_hdmi, res->sclk_hdmiphy);
  479. clk_enable(res->sclk_hdmi);
  480. /* enable HDMI and timing generator */
  481. hdmi_write_mask(hdev, HDMI_CON_0, ~0, HDMI_EN);
  482. hdmi_write_mask(hdev, HDMI_TG_CMD, ~0, HDMI_TG_EN);
  483. hdmi_dumpregs(hdev, "streamon");
  484. return 0;
  485. }
  486. static int hdmi_streamoff(struct hdmi_device *hdev)
  487. {
  488. struct device *dev = hdev->dev;
  489. struct hdmi_resources *res = &hdev->res;
  490. dev_dbg(dev, "%s\n", __func__);
  491. hdmi_write_mask(hdev, HDMI_CON_0, 0, HDMI_EN);
  492. hdmi_write_mask(hdev, HDMI_TG_CMD, 0, HDMI_TG_EN);
  493. /* pixel(vpll) clock is used for HDMI in config mode */
  494. clk_disable(res->sclk_hdmi);
  495. clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
  496. clk_enable(res->sclk_hdmi);
  497. v4l2_subdev_call(hdev->mhl_sd, video, s_stream, 0);
  498. v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0);
  499. hdmi_dumpregs(hdev, "streamoff");
  500. return 0;
  501. }
  502. static int hdmi_s_stream(struct v4l2_subdev *sd, int enable)
  503. {
  504. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  505. struct device *dev = hdev->dev;
  506. dev_dbg(dev, "%s(%d)\n", __func__, enable);
  507. if (enable)
  508. return hdmi_streamon(hdev);
  509. return hdmi_streamoff(hdev);
  510. }
  511. static int hdmi_resource_poweron(struct hdmi_resources *res)
  512. {
  513. int ret;
  514. /* turn HDMI power on */
  515. ret = regulator_bulk_enable(res->regul_count, res->regul_bulk);
  516. if (ret < 0)
  517. return ret;
  518. /* power-on hdmi physical interface */
  519. clk_enable(res->hdmiphy);
  520. /* use VPP as parent clock; HDMIPHY is not working yet */
  521. clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
  522. /* turn clocks on */
  523. clk_enable(res->sclk_hdmi);
  524. return 0;
  525. }
  526. static void hdmi_resource_poweroff(struct hdmi_resources *res)
  527. {
  528. /* turn clocks off */
  529. clk_disable(res->sclk_hdmi);
  530. /* power-off hdmiphy */
  531. clk_disable(res->hdmiphy);
  532. /* turn HDMI power off */
  533. regulator_bulk_disable(res->regul_count, res->regul_bulk);
  534. }
  535. static int hdmi_s_power(struct v4l2_subdev *sd, int on)
  536. {
  537. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  538. int ret;
  539. if (on)
  540. ret = pm_runtime_get_sync(hdev->dev);
  541. else
  542. ret = pm_runtime_put_sync(hdev->dev);
  543. /* only values < 0 indicate errors */
  544. return IS_ERR_VALUE(ret) ? ret : 0;
  545. }
  546. static int hdmi_s_dv_timings(struct v4l2_subdev *sd,
  547. struct v4l2_dv_timings *timings)
  548. {
  549. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  550. struct device *dev = hdev->dev;
  551. int i;
  552. for (i = 0; i < ARRAY_SIZE(hdmi_timings); i++)
  553. if (v4l_match_dv_timings(&hdmi_timings[i].dv_timings,
  554. timings, 0))
  555. break;
  556. if (i == ARRAY_SIZE(hdmi_timings)) {
  557. dev_err(dev, "timings not supported\n");
  558. return -EINVAL;
  559. }
  560. hdev->cur_conf = hdmi_timings[i].hdmi_timings;
  561. hdev->cur_conf_dirty = 1;
  562. hdev->cur_timings = *timings;
  563. if (!hdmi_timings[i].reduced_fps)
  564. hdev->cur_timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS;
  565. return 0;
  566. }
  567. static int hdmi_g_dv_timings(struct v4l2_subdev *sd,
  568. struct v4l2_dv_timings *timings)
  569. {
  570. *timings = sd_to_hdmi_dev(sd)->cur_timings;
  571. return 0;
  572. }
  573. static int hdmi_g_mbus_fmt(struct v4l2_subdev *sd,
  574. struct v4l2_mbus_framefmt *fmt)
  575. {
  576. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  577. const struct hdmi_timings *t = hdev->cur_conf;
  578. dev_dbg(hdev->dev, "%s\n", __func__);
  579. if (!hdev->cur_conf)
  580. return -EINVAL;
  581. memset(fmt, 0, sizeof(*fmt));
  582. fmt->width = t->hact.end - t->hact.beg;
  583. fmt->height = t->vact[0].end - t->vact[0].beg;
  584. fmt->code = V4L2_MBUS_FMT_FIXED; /* means RGB888 */
  585. fmt->colorspace = V4L2_COLORSPACE_SRGB;
  586. if (t->interlaced) {
  587. fmt->field = V4L2_FIELD_INTERLACED;
  588. fmt->height *= 2;
  589. } else {
  590. fmt->field = V4L2_FIELD_NONE;
  591. }
  592. return 0;
  593. }
  594. static int hdmi_enum_dv_timings(struct v4l2_subdev *sd,
  595. struct v4l2_enum_dv_timings *timings)
  596. {
  597. if (timings->index >= ARRAY_SIZE(hdmi_timings))
  598. return -EINVAL;
  599. timings->timings = hdmi_timings[timings->index].dv_timings;
  600. if (!hdmi_timings[timings->index].reduced_fps)
  601. timings->timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS;
  602. return 0;
  603. }
  604. static int hdmi_dv_timings_cap(struct v4l2_subdev *sd,
  605. struct v4l2_dv_timings_cap *cap)
  606. {
  607. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  608. /* Let the phy fill in the pixelclock range */
  609. v4l2_subdev_call(hdev->phy_sd, video, dv_timings_cap, cap);
  610. cap->type = V4L2_DV_BT_656_1120;
  611. cap->bt.min_width = 720;
  612. cap->bt.max_width = 1920;
  613. cap->bt.min_height = 480;
  614. cap->bt.max_height = 1080;
  615. cap->bt.standards = V4L2_DV_BT_STD_CEA861;
  616. cap->bt.capabilities = V4L2_DV_BT_CAP_INTERLACED |
  617. V4L2_DV_BT_CAP_PROGRESSIVE;
  618. return 0;
  619. }
  620. static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = {
  621. .s_power = hdmi_s_power,
  622. };
  623. static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = {
  624. .s_dv_timings = hdmi_s_dv_timings,
  625. .g_dv_timings = hdmi_g_dv_timings,
  626. .enum_dv_timings = hdmi_enum_dv_timings,
  627. .dv_timings_cap = hdmi_dv_timings_cap,
  628. .g_mbus_fmt = hdmi_g_mbus_fmt,
  629. .s_stream = hdmi_s_stream,
  630. };
  631. static const struct v4l2_subdev_ops hdmi_sd_ops = {
  632. .core = &hdmi_sd_core_ops,
  633. .video = &hdmi_sd_video_ops,
  634. };
  635. static int hdmi_runtime_suspend(struct device *dev)
  636. {
  637. struct v4l2_subdev *sd = dev_get_drvdata(dev);
  638. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  639. dev_dbg(dev, "%s\n", __func__);
  640. v4l2_subdev_call(hdev->mhl_sd, core, s_power, 0);
  641. hdmi_resource_poweroff(&hdev->res);
  642. /* flag that device context is lost */
  643. hdev->cur_conf_dirty = 1;
  644. return 0;
  645. }
  646. static int hdmi_runtime_resume(struct device *dev)
  647. {
  648. struct v4l2_subdev *sd = dev_get_drvdata(dev);
  649. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  650. int ret;
  651. dev_dbg(dev, "%s\n", __func__);
  652. ret = hdmi_resource_poweron(&hdev->res);
  653. if (ret < 0)
  654. return ret;
  655. /* starting MHL */
  656. ret = v4l2_subdev_call(hdev->mhl_sd, core, s_power, 1);
  657. if (hdev->mhl_sd && ret)
  658. goto fail;
  659. dev_dbg(dev, "poweron succeed\n");
  660. return 0;
  661. fail:
  662. hdmi_resource_poweroff(&hdev->res);
  663. dev_err(dev, "poweron failed\n");
  664. return ret;
  665. }
  666. static const struct dev_pm_ops hdmi_pm_ops = {
  667. .runtime_suspend = hdmi_runtime_suspend,
  668. .runtime_resume = hdmi_runtime_resume,
  669. };
  670. static void hdmi_resource_clear_clocks(struct hdmi_resources *res)
  671. {
  672. res->hdmi = ERR_PTR(-EINVAL);
  673. res->sclk_hdmi = ERR_PTR(-EINVAL);
  674. res->sclk_pixel = ERR_PTR(-EINVAL);
  675. res->sclk_hdmiphy = ERR_PTR(-EINVAL);
  676. res->hdmiphy = ERR_PTR(-EINVAL);
  677. }
  678. static void hdmi_resources_cleanup(struct hdmi_device *hdev)
  679. {
  680. struct hdmi_resources *res = &hdev->res;
  681. dev_dbg(hdev->dev, "HDMI resource cleanup\n");
  682. /* put clocks, power */
  683. if (res->regul_count)
  684. regulator_bulk_free(res->regul_count, res->regul_bulk);
  685. /* kfree is NULL-safe */
  686. kfree(res->regul_bulk);
  687. if (!IS_ERR(res->hdmiphy))
  688. clk_put(res->hdmiphy);
  689. if (!IS_ERR(res->sclk_hdmiphy))
  690. clk_put(res->sclk_hdmiphy);
  691. if (!IS_ERR(res->sclk_pixel))
  692. clk_put(res->sclk_pixel);
  693. if (!IS_ERR(res->sclk_hdmi))
  694. clk_put(res->sclk_hdmi);
  695. if (!IS_ERR(res->hdmi))
  696. clk_put(res->hdmi);
  697. memset(res, 0, sizeof(*res));
  698. hdmi_resource_clear_clocks(res);
  699. }
  700. static int hdmi_resources_init(struct hdmi_device *hdev)
  701. {
  702. struct device *dev = hdev->dev;
  703. struct hdmi_resources *res = &hdev->res;
  704. static char *supply[] = {
  705. "hdmi-en",
  706. "vdd",
  707. "vdd_osc",
  708. "vdd_pll",
  709. };
  710. int i, ret;
  711. dev_dbg(dev, "HDMI resource init\n");
  712. memset(res, 0, sizeof(*res));
  713. hdmi_resource_clear_clocks(res);
  714. /* get clocks, power */
  715. res->hdmi = clk_get(dev, "hdmi");
  716. if (IS_ERR(res->hdmi)) {
  717. dev_err(dev, "failed to get clock 'hdmi'\n");
  718. goto fail;
  719. }
  720. res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
  721. if (IS_ERR(res->sclk_hdmi)) {
  722. dev_err(dev, "failed to get clock 'sclk_hdmi'\n");
  723. goto fail;
  724. }
  725. res->sclk_pixel = clk_get(dev, "sclk_pixel");
  726. if (IS_ERR(res->sclk_pixel)) {
  727. dev_err(dev, "failed to get clock 'sclk_pixel'\n");
  728. goto fail;
  729. }
  730. res->sclk_hdmiphy = clk_get(dev, "sclk_hdmiphy");
  731. if (IS_ERR(res->sclk_hdmiphy)) {
  732. dev_err(dev, "failed to get clock 'sclk_hdmiphy'\n");
  733. goto fail;
  734. }
  735. res->hdmiphy = clk_get(dev, "hdmiphy");
  736. if (IS_ERR(res->hdmiphy)) {
  737. dev_err(dev, "failed to get clock 'hdmiphy'\n");
  738. goto fail;
  739. }
  740. res->regul_bulk = kcalloc(ARRAY_SIZE(supply),
  741. sizeof(res->regul_bulk[0]), GFP_KERNEL);
  742. if (!res->regul_bulk) {
  743. dev_err(dev, "failed to get memory for regulators\n");
  744. goto fail;
  745. }
  746. for (i = 0; i < ARRAY_SIZE(supply); ++i) {
  747. res->regul_bulk[i].supply = supply[i];
  748. res->regul_bulk[i].consumer = NULL;
  749. }
  750. ret = regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk);
  751. if (ret) {
  752. dev_err(dev, "failed to get regulators\n");
  753. goto fail;
  754. }
  755. res->regul_count = ARRAY_SIZE(supply);
  756. return 0;
  757. fail:
  758. dev_err(dev, "HDMI resource init - failed\n");
  759. hdmi_resources_cleanup(hdev);
  760. return -ENODEV;
  761. }
  762. static int hdmi_probe(struct platform_device *pdev)
  763. {
  764. struct device *dev = &pdev->dev;
  765. struct resource *res;
  766. struct i2c_adapter *adapter;
  767. struct v4l2_subdev *sd;
  768. struct hdmi_device *hdmi_dev = NULL;
  769. struct s5p_hdmi_platform_data *pdata = dev->platform_data;
  770. int ret;
  771. dev_dbg(dev, "probe start\n");
  772. if (!pdata) {
  773. dev_err(dev, "platform data is missing\n");
  774. ret = -ENODEV;
  775. goto fail;
  776. }
  777. hdmi_dev = devm_kzalloc(&pdev->dev, sizeof(*hdmi_dev), GFP_KERNEL);
  778. if (!hdmi_dev) {
  779. dev_err(dev, "out of memory\n");
  780. ret = -ENOMEM;
  781. goto fail;
  782. }
  783. hdmi_dev->dev = dev;
  784. ret = hdmi_resources_init(hdmi_dev);
  785. if (ret)
  786. goto fail;
  787. /* mapping HDMI registers */
  788. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  789. if (res == NULL) {
  790. dev_err(dev, "get memory resource failed.\n");
  791. ret = -ENXIO;
  792. goto fail_init;
  793. }
  794. hdmi_dev->regs = devm_ioremap(&pdev->dev, res->start,
  795. resource_size(res));
  796. if (hdmi_dev->regs == NULL) {
  797. dev_err(dev, "register mapping failed.\n");
  798. ret = -ENXIO;
  799. goto fail_init;
  800. }
  801. res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  802. if (res == NULL) {
  803. dev_err(dev, "get interrupt resource failed.\n");
  804. ret = -ENXIO;
  805. goto fail_init;
  806. }
  807. ret = devm_request_irq(&pdev->dev, res->start, hdmi_irq_handler, 0,
  808. "hdmi", hdmi_dev);
  809. if (ret) {
  810. dev_err(dev, "request interrupt failed.\n");
  811. goto fail_init;
  812. }
  813. hdmi_dev->irq = res->start;
  814. /* setting v4l2 name to prevent WARN_ON in v4l2_device_register */
  815. strlcpy(hdmi_dev->v4l2_dev.name, dev_name(dev),
  816. sizeof(hdmi_dev->v4l2_dev.name));
  817. /* passing NULL owner prevents driver from erasing drvdata */
  818. ret = v4l2_device_register(NULL, &hdmi_dev->v4l2_dev);
  819. if (ret) {
  820. dev_err(dev, "could not register v4l2 device.\n");
  821. goto fail_init;
  822. }
  823. /* testing if hdmiphy info is present */
  824. if (!pdata->hdmiphy_info) {
  825. dev_err(dev, "hdmiphy info is missing in platform data\n");
  826. ret = -ENXIO;
  827. goto fail_vdev;
  828. }
  829. adapter = i2c_get_adapter(pdata->hdmiphy_bus);
  830. if (adapter == NULL) {
  831. dev_err(dev, "hdmiphy adapter request failed\n");
  832. ret = -ENXIO;
  833. goto fail_vdev;
  834. }
  835. hdmi_dev->phy_sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev,
  836. adapter, pdata->hdmiphy_info, NULL);
  837. /* on failure or not adapter is no longer useful */
  838. i2c_put_adapter(adapter);
  839. if (hdmi_dev->phy_sd == NULL) {
  840. dev_err(dev, "missing subdev for hdmiphy\n");
  841. ret = -ENODEV;
  842. goto fail_vdev;
  843. }
  844. /* initialization of MHL interface if present */
  845. if (pdata->mhl_info) {
  846. adapter = i2c_get_adapter(pdata->mhl_bus);
  847. if (adapter == NULL) {
  848. dev_err(dev, "MHL adapter request failed\n");
  849. ret = -ENXIO;
  850. goto fail_vdev;
  851. }
  852. hdmi_dev->mhl_sd = v4l2_i2c_new_subdev_board(
  853. &hdmi_dev->v4l2_dev, adapter,
  854. pdata->mhl_info, NULL);
  855. /* on failure or not adapter is no longer useful */
  856. i2c_put_adapter(adapter);
  857. if (hdmi_dev->mhl_sd == NULL) {
  858. dev_err(dev, "missing subdev for MHL\n");
  859. ret = -ENODEV;
  860. goto fail_vdev;
  861. }
  862. }
  863. clk_enable(hdmi_dev->res.hdmi);
  864. pm_runtime_enable(dev);
  865. sd = &hdmi_dev->sd;
  866. v4l2_subdev_init(sd, &hdmi_sd_ops);
  867. sd->owner = THIS_MODULE;
  868. strlcpy(sd->name, "s5p-hdmi", sizeof(sd->name));
  869. hdmi_dev->cur_timings =
  870. hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].dv_timings;
  871. /* FIXME: missing fail timings is not supported */
  872. hdmi_dev->cur_conf =
  873. hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].hdmi_timings;
  874. hdmi_dev->cur_conf_dirty = 1;
  875. /* storing subdev for call that have only access to struct device */
  876. dev_set_drvdata(dev, sd);
  877. dev_info(dev, "probe successful\n");
  878. return 0;
  879. fail_vdev:
  880. v4l2_device_unregister(&hdmi_dev->v4l2_dev);
  881. fail_init:
  882. hdmi_resources_cleanup(hdmi_dev);
  883. fail:
  884. dev_err(dev, "probe failed\n");
  885. return ret;
  886. }
  887. static int hdmi_remove(struct platform_device *pdev)
  888. {
  889. struct device *dev = &pdev->dev;
  890. struct v4l2_subdev *sd = dev_get_drvdata(dev);
  891. struct hdmi_device *hdmi_dev = sd_to_hdmi_dev(sd);
  892. pm_runtime_disable(dev);
  893. clk_disable(hdmi_dev->res.hdmi);
  894. v4l2_device_unregister(&hdmi_dev->v4l2_dev);
  895. disable_irq(hdmi_dev->irq);
  896. hdmi_resources_cleanup(hdmi_dev);
  897. dev_info(dev, "remove successful\n");
  898. return 0;
  899. }
  900. static struct platform_driver hdmi_driver __refdata = {
  901. .probe = hdmi_probe,
  902. .remove = hdmi_remove,
  903. .id_table = hdmi_driver_types,
  904. .driver = {
  905. .name = "s5p-hdmi",
  906. .owner = THIS_MODULE,
  907. .pm = &hdmi_pm_ops,
  908. }
  909. };
  910. module_platform_driver(hdmi_driver);