hdmi_drv.c 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037
  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 void hdmi_resource_poweron(struct hdmi_resources *res)
  512. {
  513. /* turn HDMI power on */
  514. regulator_bulk_enable(res->regul_count, res->regul_bulk);
  515. /* power-on hdmi physical interface */
  516. clk_enable(res->hdmiphy);
  517. /* use VPP as parent clock; HDMIPHY is not working yet */
  518. clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
  519. /* turn clocks on */
  520. clk_enable(res->sclk_hdmi);
  521. }
  522. static void hdmi_resource_poweroff(struct hdmi_resources *res)
  523. {
  524. /* turn clocks off */
  525. clk_disable(res->sclk_hdmi);
  526. /* power-off hdmiphy */
  527. clk_disable(res->hdmiphy);
  528. /* turn HDMI power off */
  529. regulator_bulk_disable(res->regul_count, res->regul_bulk);
  530. }
  531. static int hdmi_s_power(struct v4l2_subdev *sd, int on)
  532. {
  533. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  534. int ret;
  535. if (on)
  536. ret = pm_runtime_get_sync(hdev->dev);
  537. else
  538. ret = pm_runtime_put_sync(hdev->dev);
  539. /* only values < 0 indicate errors */
  540. return IS_ERR_VALUE(ret) ? ret : 0;
  541. }
  542. static int hdmi_s_dv_timings(struct v4l2_subdev *sd,
  543. struct v4l2_dv_timings *timings)
  544. {
  545. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  546. struct device *dev = hdev->dev;
  547. int i;
  548. for (i = 0; i < ARRAY_SIZE(hdmi_timings); i++)
  549. if (v4l_match_dv_timings(&hdmi_timings[i].dv_timings,
  550. timings, 0))
  551. break;
  552. if (i == ARRAY_SIZE(hdmi_timings)) {
  553. dev_err(dev, "timings not supported\n");
  554. return -EINVAL;
  555. }
  556. hdev->cur_conf = hdmi_timings[i].hdmi_timings;
  557. hdev->cur_conf_dirty = 1;
  558. hdev->cur_timings = *timings;
  559. if (!hdmi_timings[i].reduced_fps)
  560. hdev->cur_timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS;
  561. return 0;
  562. }
  563. static int hdmi_g_dv_timings(struct v4l2_subdev *sd,
  564. struct v4l2_dv_timings *timings)
  565. {
  566. *timings = sd_to_hdmi_dev(sd)->cur_timings;
  567. return 0;
  568. }
  569. static int hdmi_g_mbus_fmt(struct v4l2_subdev *sd,
  570. struct v4l2_mbus_framefmt *fmt)
  571. {
  572. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  573. const struct hdmi_timings *t = hdev->cur_conf;
  574. dev_dbg(hdev->dev, "%s\n", __func__);
  575. if (!hdev->cur_conf)
  576. return -EINVAL;
  577. memset(fmt, 0, sizeof(*fmt));
  578. fmt->width = t->hact.end - t->hact.beg;
  579. fmt->height = t->vact[0].end - t->vact[0].beg;
  580. fmt->code = V4L2_MBUS_FMT_FIXED; /* means RGB888 */
  581. fmt->colorspace = V4L2_COLORSPACE_SRGB;
  582. if (t->interlaced) {
  583. fmt->field = V4L2_FIELD_INTERLACED;
  584. fmt->height *= 2;
  585. } else {
  586. fmt->field = V4L2_FIELD_NONE;
  587. }
  588. return 0;
  589. }
  590. static int hdmi_enum_dv_timings(struct v4l2_subdev *sd,
  591. struct v4l2_enum_dv_timings *timings)
  592. {
  593. if (timings->index >= ARRAY_SIZE(hdmi_timings))
  594. return -EINVAL;
  595. timings->timings = hdmi_timings[timings->index].dv_timings;
  596. if (!hdmi_timings[timings->index].reduced_fps)
  597. timings->timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS;
  598. return 0;
  599. }
  600. static int hdmi_dv_timings_cap(struct v4l2_subdev *sd,
  601. struct v4l2_dv_timings_cap *cap)
  602. {
  603. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  604. /* Let the phy fill in the pixelclock range */
  605. v4l2_subdev_call(hdev->phy_sd, video, dv_timings_cap, cap);
  606. cap->type = V4L2_DV_BT_656_1120;
  607. cap->bt.min_width = 720;
  608. cap->bt.max_width = 1920;
  609. cap->bt.min_height = 480;
  610. cap->bt.max_height = 1080;
  611. cap->bt.standards = V4L2_DV_BT_STD_CEA861;
  612. cap->bt.capabilities = V4L2_DV_BT_CAP_INTERLACED |
  613. V4L2_DV_BT_CAP_PROGRESSIVE;
  614. return 0;
  615. }
  616. static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = {
  617. .s_power = hdmi_s_power,
  618. };
  619. static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = {
  620. .s_dv_timings = hdmi_s_dv_timings,
  621. .g_dv_timings = hdmi_g_dv_timings,
  622. .enum_dv_timings = hdmi_enum_dv_timings,
  623. .dv_timings_cap = hdmi_dv_timings_cap,
  624. .g_mbus_fmt = hdmi_g_mbus_fmt,
  625. .s_stream = hdmi_s_stream,
  626. };
  627. static const struct v4l2_subdev_ops hdmi_sd_ops = {
  628. .core = &hdmi_sd_core_ops,
  629. .video = &hdmi_sd_video_ops,
  630. };
  631. static int hdmi_runtime_suspend(struct device *dev)
  632. {
  633. struct v4l2_subdev *sd = dev_get_drvdata(dev);
  634. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  635. dev_dbg(dev, "%s\n", __func__);
  636. v4l2_subdev_call(hdev->mhl_sd, core, s_power, 0);
  637. hdmi_resource_poweroff(&hdev->res);
  638. /* flag that device context is lost */
  639. hdev->cur_conf_dirty = 1;
  640. return 0;
  641. }
  642. static int hdmi_runtime_resume(struct device *dev)
  643. {
  644. struct v4l2_subdev *sd = dev_get_drvdata(dev);
  645. struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
  646. int ret = 0;
  647. dev_dbg(dev, "%s\n", __func__);
  648. hdmi_resource_poweron(&hdev->res);
  649. /* starting MHL */
  650. ret = v4l2_subdev_call(hdev->mhl_sd, core, s_power, 1);
  651. if (hdev->mhl_sd && ret)
  652. goto fail;
  653. dev_dbg(dev, "poweron succeed\n");
  654. return 0;
  655. fail:
  656. hdmi_resource_poweroff(&hdev->res);
  657. dev_err(dev, "poweron failed\n");
  658. return ret;
  659. }
  660. static const struct dev_pm_ops hdmi_pm_ops = {
  661. .runtime_suspend = hdmi_runtime_suspend,
  662. .runtime_resume = hdmi_runtime_resume,
  663. };
  664. static void hdmi_resource_clear_clocks(struct hdmi_resources *res)
  665. {
  666. res->hdmi = ERR_PTR(-EINVAL);
  667. res->sclk_hdmi = ERR_PTR(-EINVAL);
  668. res->sclk_pixel = ERR_PTR(-EINVAL);
  669. res->sclk_hdmiphy = ERR_PTR(-EINVAL);
  670. res->hdmiphy = ERR_PTR(-EINVAL);
  671. }
  672. static void hdmi_resources_cleanup(struct hdmi_device *hdev)
  673. {
  674. struct hdmi_resources *res = &hdev->res;
  675. dev_dbg(hdev->dev, "HDMI resource cleanup\n");
  676. /* put clocks, power */
  677. if (res->regul_count)
  678. regulator_bulk_free(res->regul_count, res->regul_bulk);
  679. /* kfree is NULL-safe */
  680. kfree(res->regul_bulk);
  681. if (!IS_ERR(res->hdmiphy))
  682. clk_put(res->hdmiphy);
  683. if (!IS_ERR(res->sclk_hdmiphy))
  684. clk_put(res->sclk_hdmiphy);
  685. if (!IS_ERR(res->sclk_pixel))
  686. clk_put(res->sclk_pixel);
  687. if (!IS_ERR(res->sclk_hdmi))
  688. clk_put(res->sclk_hdmi);
  689. if (!IS_ERR(res->hdmi))
  690. clk_put(res->hdmi);
  691. memset(res, 0, sizeof(*res));
  692. hdmi_resource_clear_clocks(res);
  693. }
  694. static int hdmi_resources_init(struct hdmi_device *hdev)
  695. {
  696. struct device *dev = hdev->dev;
  697. struct hdmi_resources *res = &hdev->res;
  698. static char *supply[] = {
  699. "hdmi-en",
  700. "vdd",
  701. "vdd_osc",
  702. "vdd_pll",
  703. };
  704. int i, ret;
  705. dev_dbg(dev, "HDMI resource init\n");
  706. memset(res, 0, sizeof(*res));
  707. hdmi_resource_clear_clocks(res);
  708. /* get clocks, power */
  709. res->hdmi = clk_get(dev, "hdmi");
  710. if (IS_ERR(res->hdmi)) {
  711. dev_err(dev, "failed to get clock 'hdmi'\n");
  712. goto fail;
  713. }
  714. res->sclk_hdmi = clk_get(dev, "sclk_hdmi");
  715. if (IS_ERR(res->sclk_hdmi)) {
  716. dev_err(dev, "failed to get clock 'sclk_hdmi'\n");
  717. goto fail;
  718. }
  719. res->sclk_pixel = clk_get(dev, "sclk_pixel");
  720. if (IS_ERR(res->sclk_pixel)) {
  721. dev_err(dev, "failed to get clock 'sclk_pixel'\n");
  722. goto fail;
  723. }
  724. res->sclk_hdmiphy = clk_get(dev, "sclk_hdmiphy");
  725. if (IS_ERR(res->sclk_hdmiphy)) {
  726. dev_err(dev, "failed to get clock 'sclk_hdmiphy'\n");
  727. goto fail;
  728. }
  729. res->hdmiphy = clk_get(dev, "hdmiphy");
  730. if (IS_ERR(res->hdmiphy)) {
  731. dev_err(dev, "failed to get clock 'hdmiphy'\n");
  732. goto fail;
  733. }
  734. res->regul_bulk = kcalloc(ARRAY_SIZE(supply),
  735. sizeof(res->regul_bulk[0]), GFP_KERNEL);
  736. if (!res->regul_bulk) {
  737. dev_err(dev, "failed to get memory for regulators\n");
  738. goto fail;
  739. }
  740. for (i = 0; i < ARRAY_SIZE(supply); ++i) {
  741. res->regul_bulk[i].supply = supply[i];
  742. res->regul_bulk[i].consumer = NULL;
  743. }
  744. ret = regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk);
  745. if (ret) {
  746. dev_err(dev, "failed to get regulators\n");
  747. goto fail;
  748. }
  749. res->regul_count = ARRAY_SIZE(supply);
  750. return 0;
  751. fail:
  752. dev_err(dev, "HDMI resource init - failed\n");
  753. hdmi_resources_cleanup(hdev);
  754. return -ENODEV;
  755. }
  756. static int hdmi_probe(struct platform_device *pdev)
  757. {
  758. struct device *dev = &pdev->dev;
  759. struct resource *res;
  760. struct i2c_adapter *adapter;
  761. struct v4l2_subdev *sd;
  762. struct hdmi_device *hdmi_dev = NULL;
  763. struct s5p_hdmi_platform_data *pdata = dev->platform_data;
  764. int ret;
  765. dev_dbg(dev, "probe start\n");
  766. if (!pdata) {
  767. dev_err(dev, "platform data is missing\n");
  768. ret = -ENODEV;
  769. goto fail;
  770. }
  771. hdmi_dev = devm_kzalloc(&pdev->dev, sizeof(*hdmi_dev), GFP_KERNEL);
  772. if (!hdmi_dev) {
  773. dev_err(dev, "out of memory\n");
  774. ret = -ENOMEM;
  775. goto fail;
  776. }
  777. hdmi_dev->dev = dev;
  778. ret = hdmi_resources_init(hdmi_dev);
  779. if (ret)
  780. goto fail;
  781. /* mapping HDMI registers */
  782. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  783. if (res == NULL) {
  784. dev_err(dev, "get memory resource failed.\n");
  785. ret = -ENXIO;
  786. goto fail_init;
  787. }
  788. hdmi_dev->regs = devm_ioremap(&pdev->dev, res->start,
  789. resource_size(res));
  790. if (hdmi_dev->regs == NULL) {
  791. dev_err(dev, "register mapping failed.\n");
  792. ret = -ENXIO;
  793. goto fail_init;
  794. }
  795. res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  796. if (res == NULL) {
  797. dev_err(dev, "get interrupt resource failed.\n");
  798. ret = -ENXIO;
  799. goto fail_init;
  800. }
  801. ret = devm_request_irq(&pdev->dev, res->start, hdmi_irq_handler, 0,
  802. "hdmi", hdmi_dev);
  803. if (ret) {
  804. dev_err(dev, "request interrupt failed.\n");
  805. goto fail_init;
  806. }
  807. hdmi_dev->irq = res->start;
  808. /* setting v4l2 name to prevent WARN_ON in v4l2_device_register */
  809. strlcpy(hdmi_dev->v4l2_dev.name, dev_name(dev),
  810. sizeof(hdmi_dev->v4l2_dev.name));
  811. /* passing NULL owner prevents driver from erasing drvdata */
  812. ret = v4l2_device_register(NULL, &hdmi_dev->v4l2_dev);
  813. if (ret) {
  814. dev_err(dev, "could not register v4l2 device.\n");
  815. goto fail_init;
  816. }
  817. /* testing if hdmiphy info is present */
  818. if (!pdata->hdmiphy_info) {
  819. dev_err(dev, "hdmiphy info is missing in platform data\n");
  820. ret = -ENXIO;
  821. goto fail_vdev;
  822. }
  823. adapter = i2c_get_adapter(pdata->hdmiphy_bus);
  824. if (adapter == NULL) {
  825. dev_err(dev, "hdmiphy adapter request failed\n");
  826. ret = -ENXIO;
  827. goto fail_vdev;
  828. }
  829. hdmi_dev->phy_sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev,
  830. adapter, pdata->hdmiphy_info, NULL);
  831. /* on failure or not adapter is no longer useful */
  832. i2c_put_adapter(adapter);
  833. if (hdmi_dev->phy_sd == NULL) {
  834. dev_err(dev, "missing subdev for hdmiphy\n");
  835. ret = -ENODEV;
  836. goto fail_vdev;
  837. }
  838. /* initialization of MHL interface if present */
  839. if (pdata->mhl_info) {
  840. adapter = i2c_get_adapter(pdata->mhl_bus);
  841. if (adapter == NULL) {
  842. dev_err(dev, "MHL adapter request failed\n");
  843. ret = -ENXIO;
  844. goto fail_vdev;
  845. }
  846. hdmi_dev->mhl_sd = v4l2_i2c_new_subdev_board(
  847. &hdmi_dev->v4l2_dev, adapter,
  848. pdata->mhl_info, NULL);
  849. /* on failure or not adapter is no longer useful */
  850. i2c_put_adapter(adapter);
  851. if (hdmi_dev->mhl_sd == NULL) {
  852. dev_err(dev, "missing subdev for MHL\n");
  853. ret = -ENODEV;
  854. goto fail_vdev;
  855. }
  856. }
  857. clk_enable(hdmi_dev->res.hdmi);
  858. pm_runtime_enable(dev);
  859. sd = &hdmi_dev->sd;
  860. v4l2_subdev_init(sd, &hdmi_sd_ops);
  861. sd->owner = THIS_MODULE;
  862. strlcpy(sd->name, "s5p-hdmi", sizeof(sd->name));
  863. hdmi_dev->cur_timings =
  864. hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].dv_timings;
  865. /* FIXME: missing fail timings is not supported */
  866. hdmi_dev->cur_conf =
  867. hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].hdmi_timings;
  868. hdmi_dev->cur_conf_dirty = 1;
  869. /* storing subdev for call that have only access to struct device */
  870. dev_set_drvdata(dev, sd);
  871. dev_info(dev, "probe successful\n");
  872. return 0;
  873. fail_vdev:
  874. v4l2_device_unregister(&hdmi_dev->v4l2_dev);
  875. fail_init:
  876. hdmi_resources_cleanup(hdmi_dev);
  877. fail:
  878. dev_err(dev, "probe failed\n");
  879. return ret;
  880. }
  881. static int hdmi_remove(struct platform_device *pdev)
  882. {
  883. struct device *dev = &pdev->dev;
  884. struct v4l2_subdev *sd = dev_get_drvdata(dev);
  885. struct hdmi_device *hdmi_dev = sd_to_hdmi_dev(sd);
  886. pm_runtime_disable(dev);
  887. clk_disable(hdmi_dev->res.hdmi);
  888. v4l2_device_unregister(&hdmi_dev->v4l2_dev);
  889. disable_irq(hdmi_dev->irq);
  890. hdmi_resources_cleanup(hdmi_dev);
  891. dev_info(dev, "remove successful\n");
  892. return 0;
  893. }
  894. static struct platform_driver hdmi_driver __refdata = {
  895. .probe = hdmi_probe,
  896. .remove = hdmi_remove,
  897. .id_table = hdmi_driver_types,
  898. .driver = {
  899. .name = "s5p-hdmi",
  900. .owner = THIS_MODULE,
  901. .pm = &hdmi_pm_ops,
  902. }
  903. };
  904. module_platform_driver(hdmi_driver);