display.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. /*
  2. * OMAP2plus display device setup / initialization.
  3. *
  4. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  5. * Senthilvadivu Guruswamy
  6. * Sumit Semwal
  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 version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  13. * kind, whether express or implied; without even the implied warranty
  14. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. */
  17. #include <linux/string.h>
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/io.h>
  22. #include <linux/clk.h>
  23. #include <linux/err.h>
  24. #include <linux/delay.h>
  25. #include <linux/of.h>
  26. #include <linux/of_platform.h>
  27. #include <linux/slab.h>
  28. #include <linux/mfd/syscon.h>
  29. #include <linux/regmap.h>
  30. #include <linux/platform_data/omapdss.h>
  31. #include "omap_hwmod.h"
  32. #include "omap_device.h"
  33. #include "omap-pm.h"
  34. #include "common.h"
  35. #include "soc.h"
  36. #include "iomap.h"
  37. #include "control.h"
  38. #include "display.h"
  39. #include "prm.h"
  40. #define DISPC_CONTROL 0x0040
  41. #define DISPC_CONTROL2 0x0238
  42. #define DISPC_CONTROL3 0x0848
  43. #define DISPC_IRQSTATUS 0x0018
  44. #define DSS_SYSCONFIG 0x10
  45. #define DSS_SYSSTATUS 0x14
  46. #define DSS_CONTROL 0x40
  47. #define DSS_SDI_CONTROL 0x44
  48. #define DSS_PLL_CONTROL 0x48
  49. #define LCD_EN_MASK (0x1 << 0)
  50. #define DIGIT_EN_MASK (0x1 << 1)
  51. #define FRAMEDONE_IRQ_SHIFT 0
  52. #define EVSYNC_EVEN_IRQ_SHIFT 2
  53. #define EVSYNC_ODD_IRQ_SHIFT 3
  54. #define FRAMEDONE2_IRQ_SHIFT 22
  55. #define FRAMEDONE3_IRQ_SHIFT 30
  56. #define FRAMEDONETV_IRQ_SHIFT 24
  57. /*
  58. * FRAMEDONE_IRQ_TIMEOUT: how long (in milliseconds) to wait during DISPC
  59. * reset before deciding that something has gone wrong
  60. */
  61. #define FRAMEDONE_IRQ_TIMEOUT 100
  62. static struct platform_device omap_display_device = {
  63. .name = "omapdss",
  64. .id = -1,
  65. .dev = {
  66. .platform_data = NULL,
  67. },
  68. };
  69. struct omap_dss_hwmod_data {
  70. const char *oh_name;
  71. const char *dev_name;
  72. const int id;
  73. };
  74. static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initconst = {
  75. { "dss_core", "omapdss_dss", -1 },
  76. { "dss_dispc", "omapdss_dispc", -1 },
  77. { "dss_rfbi", "omapdss_rfbi", -1 },
  78. { "dss_venc", "omapdss_venc", -1 },
  79. };
  80. static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initconst = {
  81. { "dss_core", "omapdss_dss", -1 },
  82. { "dss_dispc", "omapdss_dispc", -1 },
  83. { "dss_rfbi", "omapdss_rfbi", -1 },
  84. { "dss_venc", "omapdss_venc", -1 },
  85. { "dss_dsi1", "omapdss_dsi", 0 },
  86. };
  87. static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initconst = {
  88. { "dss_core", "omapdss_dss", -1 },
  89. { "dss_dispc", "omapdss_dispc", -1 },
  90. { "dss_rfbi", "omapdss_rfbi", -1 },
  91. { "dss_dsi1", "omapdss_dsi", 0 },
  92. { "dss_dsi2", "omapdss_dsi", 1 },
  93. { "dss_hdmi", "omapdss_hdmi", -1 },
  94. };
  95. #define OMAP4_DSIPHY_SYSCON_OFFSET 0x78
  96. static struct regmap *omap4_dsi_mux_syscon;
  97. static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
  98. {
  99. u32 enable_mask, enable_shift;
  100. u32 pipd_mask, pipd_shift;
  101. u32 reg;
  102. if (dsi_id == 0) {
  103. enable_mask = OMAP4_DSI1_LANEENABLE_MASK;
  104. enable_shift = OMAP4_DSI1_LANEENABLE_SHIFT;
  105. pipd_mask = OMAP4_DSI1_PIPD_MASK;
  106. pipd_shift = OMAP4_DSI1_PIPD_SHIFT;
  107. } else if (dsi_id == 1) {
  108. enable_mask = OMAP4_DSI2_LANEENABLE_MASK;
  109. enable_shift = OMAP4_DSI2_LANEENABLE_SHIFT;
  110. pipd_mask = OMAP4_DSI2_PIPD_MASK;
  111. pipd_shift = OMAP4_DSI2_PIPD_SHIFT;
  112. } else {
  113. return -ENODEV;
  114. }
  115. regmap_read(omap4_dsi_mux_syscon, OMAP4_DSIPHY_SYSCON_OFFSET, &reg);
  116. reg &= ~enable_mask;
  117. reg &= ~pipd_mask;
  118. reg |= (lanes << enable_shift) & enable_mask;
  119. reg |= (lanes << pipd_shift) & pipd_mask;
  120. regmap_write(omap4_dsi_mux_syscon, OMAP4_DSIPHY_SYSCON_OFFSET, reg);
  121. return 0;
  122. }
  123. static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
  124. {
  125. if (cpu_is_omap44xx())
  126. return omap4_dsi_mux_pads(dsi_id, lane_mask);
  127. return 0;
  128. }
  129. static void omap_dsi_disable_pads(int dsi_id, unsigned lane_mask)
  130. {
  131. if (cpu_is_omap44xx())
  132. omap4_dsi_mux_pads(dsi_id, 0);
  133. }
  134. static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput)
  135. {
  136. return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput);
  137. }
  138. static struct platform_device *create_dss_pdev(const char *pdev_name,
  139. int pdev_id, const char *oh_name, void *pdata, int pdata_len,
  140. struct platform_device *parent)
  141. {
  142. struct platform_device *pdev;
  143. struct omap_device *od;
  144. struct omap_hwmod *ohs[1];
  145. struct omap_hwmod *oh;
  146. int r;
  147. oh = omap_hwmod_lookup(oh_name);
  148. if (!oh) {
  149. pr_err("Could not look up %s\n", oh_name);
  150. r = -ENODEV;
  151. goto err;
  152. }
  153. pdev = platform_device_alloc(pdev_name, pdev_id);
  154. if (!pdev) {
  155. pr_err("Could not create pdev for %s\n", pdev_name);
  156. r = -ENOMEM;
  157. goto err;
  158. }
  159. if (parent != NULL)
  160. pdev->dev.parent = &parent->dev;
  161. if (pdev->id != -1)
  162. dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
  163. else
  164. dev_set_name(&pdev->dev, "%s", pdev->name);
  165. ohs[0] = oh;
  166. od = omap_device_alloc(pdev, ohs, 1);
  167. if (IS_ERR(od)) {
  168. pr_err("Could not alloc omap_device for %s\n", pdev_name);
  169. r = -ENOMEM;
  170. goto err;
  171. }
  172. r = platform_device_add_data(pdev, pdata, pdata_len);
  173. if (r) {
  174. pr_err("Could not set pdata for %s\n", pdev_name);
  175. goto err;
  176. }
  177. r = omap_device_register(pdev);
  178. if (r) {
  179. pr_err("Could not register omap_device for %s\n", pdev_name);
  180. goto err;
  181. }
  182. return pdev;
  183. err:
  184. return ERR_PTR(r);
  185. }
  186. static struct platform_device *create_simple_dss_pdev(const char *pdev_name,
  187. int pdev_id, void *pdata, int pdata_len,
  188. struct platform_device *parent)
  189. {
  190. struct platform_device *pdev;
  191. int r;
  192. pdev = platform_device_alloc(pdev_name, pdev_id);
  193. if (!pdev) {
  194. pr_err("Could not create pdev for %s\n", pdev_name);
  195. r = -ENOMEM;
  196. goto err;
  197. }
  198. if (parent != NULL)
  199. pdev->dev.parent = &parent->dev;
  200. if (pdev->id != -1)
  201. dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
  202. else
  203. dev_set_name(&pdev->dev, "%s", pdev->name);
  204. r = platform_device_add_data(pdev, pdata, pdata_len);
  205. if (r) {
  206. pr_err("Could not set pdata for %s\n", pdev_name);
  207. goto err;
  208. }
  209. r = platform_device_add(pdev);
  210. if (r) {
  211. pr_err("Could not register platform_device for %s\n", pdev_name);
  212. goto err;
  213. }
  214. return pdev;
  215. err:
  216. return ERR_PTR(r);
  217. }
  218. static enum omapdss_version __init omap_display_get_version(void)
  219. {
  220. if (cpu_is_omap24xx())
  221. return OMAPDSS_VER_OMAP24xx;
  222. else if (cpu_is_omap3630())
  223. return OMAPDSS_VER_OMAP3630;
  224. else if (cpu_is_omap34xx()) {
  225. if (soc_is_am35xx()) {
  226. return OMAPDSS_VER_AM35xx;
  227. } else {
  228. if (omap_rev() < OMAP3430_REV_ES3_0)
  229. return OMAPDSS_VER_OMAP34xx_ES1;
  230. else
  231. return OMAPDSS_VER_OMAP34xx_ES3;
  232. }
  233. } else if (omap_rev() == OMAP4430_REV_ES1_0)
  234. return OMAPDSS_VER_OMAP4430_ES1;
  235. else if (omap_rev() == OMAP4430_REV_ES2_0 ||
  236. omap_rev() == OMAP4430_REV_ES2_1 ||
  237. omap_rev() == OMAP4430_REV_ES2_2)
  238. return OMAPDSS_VER_OMAP4430_ES2;
  239. else if (cpu_is_omap44xx())
  240. return OMAPDSS_VER_OMAP4;
  241. else if (soc_is_omap54xx())
  242. return OMAPDSS_VER_OMAP5;
  243. else if (soc_is_am43xx())
  244. return OMAPDSS_VER_AM43xx;
  245. else if (soc_is_dra7xx())
  246. return OMAPDSS_VER_DRA7xx;
  247. else
  248. return OMAPDSS_VER_UNKNOWN;
  249. }
  250. int __init omap_display_init(struct omap_dss_board_info *board_data)
  251. {
  252. int r = 0;
  253. struct platform_device *pdev;
  254. int i, oh_count;
  255. const struct omap_dss_hwmod_data *curr_dss_hwmod;
  256. struct platform_device *dss_pdev;
  257. enum omapdss_version ver;
  258. /* create omapdss device */
  259. ver = omap_display_get_version();
  260. if (ver == OMAPDSS_VER_UNKNOWN) {
  261. pr_err("DSS not supported on this SoC\n");
  262. return -ENODEV;
  263. }
  264. board_data->version = ver;
  265. board_data->dsi_enable_pads = omap_dsi_enable_pads;
  266. board_data->dsi_disable_pads = omap_dsi_disable_pads;
  267. board_data->set_min_bus_tput = omap_dss_set_min_bus_tput;
  268. omap_display_device.dev.platform_data = board_data;
  269. r = platform_device_register(&omap_display_device);
  270. if (r < 0) {
  271. pr_err("Unable to register omapdss device\n");
  272. return r;
  273. }
  274. /* create devices for dss hwmods */
  275. if (cpu_is_omap24xx()) {
  276. curr_dss_hwmod = omap2_dss_hwmod_data;
  277. oh_count = ARRAY_SIZE(omap2_dss_hwmod_data);
  278. } else if (cpu_is_omap34xx()) {
  279. curr_dss_hwmod = omap3_dss_hwmod_data;
  280. oh_count = ARRAY_SIZE(omap3_dss_hwmod_data);
  281. } else {
  282. curr_dss_hwmod = omap4_dss_hwmod_data;
  283. oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
  284. }
  285. /*
  286. * First create the pdev for dss_core, which is used as a parent device
  287. * by the other dss pdevs. Note: dss_core has to be the first item in
  288. * the hwmod list.
  289. */
  290. dss_pdev = create_dss_pdev(curr_dss_hwmod[0].dev_name,
  291. curr_dss_hwmod[0].id,
  292. curr_dss_hwmod[0].oh_name,
  293. board_data, sizeof(*board_data),
  294. NULL);
  295. if (IS_ERR(dss_pdev)) {
  296. pr_err("Could not build omap_device for %s\n",
  297. curr_dss_hwmod[0].oh_name);
  298. return PTR_ERR(dss_pdev);
  299. }
  300. for (i = 1; i < oh_count; i++) {
  301. pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name,
  302. curr_dss_hwmod[i].id,
  303. curr_dss_hwmod[i].oh_name,
  304. board_data, sizeof(*board_data),
  305. dss_pdev);
  306. if (IS_ERR(pdev)) {
  307. pr_err("Could not build omap_device for %s\n",
  308. curr_dss_hwmod[i].oh_name);
  309. return PTR_ERR(pdev);
  310. }
  311. }
  312. /* Create devices for DPI and SDI */
  313. pdev = create_simple_dss_pdev("omapdss_dpi", 0,
  314. board_data, sizeof(*board_data), dss_pdev);
  315. if (IS_ERR(pdev)) {
  316. pr_err("Could not build platform_device for omapdss_dpi\n");
  317. return PTR_ERR(pdev);
  318. }
  319. if (cpu_is_omap34xx()) {
  320. pdev = create_simple_dss_pdev("omapdss_sdi", 0,
  321. board_data, sizeof(*board_data), dss_pdev);
  322. if (IS_ERR(pdev)) {
  323. pr_err("Could not build platform_device for omapdss_sdi\n");
  324. return PTR_ERR(pdev);
  325. }
  326. }
  327. /* create DRM device */
  328. r = omap_init_drm();
  329. if (r < 0) {
  330. pr_err("Unable to register omapdrm device\n");
  331. return r;
  332. }
  333. /* create vrfb device */
  334. r = omap_init_vrfb();
  335. if (r < 0) {
  336. pr_err("Unable to register omapvrfb device\n");
  337. return r;
  338. }
  339. /* create FB device */
  340. r = omap_init_fb();
  341. if (r < 0) {
  342. pr_err("Unable to register omapfb device\n");
  343. return r;
  344. }
  345. /* create V4L2 display device */
  346. r = omap_init_vout();
  347. if (r < 0) {
  348. pr_err("Unable to register omap_vout device\n");
  349. return r;
  350. }
  351. return 0;
  352. }
  353. static void dispc_disable_outputs(void)
  354. {
  355. u32 v, irq_mask = 0;
  356. bool lcd_en, digit_en, lcd2_en = false, lcd3_en = false;
  357. int i;
  358. struct omap_dss_dispc_dev_attr *da;
  359. struct omap_hwmod *oh;
  360. oh = omap_hwmod_lookup("dss_dispc");
  361. if (!oh) {
  362. WARN(1, "display: could not disable outputs during reset - could not find dss_dispc hwmod\n");
  363. return;
  364. }
  365. if (!oh->dev_attr) {
  366. pr_err("display: could not disable outputs during reset due to missing dev_attr\n");
  367. return;
  368. }
  369. da = (struct omap_dss_dispc_dev_attr *)oh->dev_attr;
  370. /* store value of LCDENABLE and DIGITENABLE bits */
  371. v = omap_hwmod_read(oh, DISPC_CONTROL);
  372. lcd_en = v & LCD_EN_MASK;
  373. digit_en = v & DIGIT_EN_MASK;
  374. /* store value of LCDENABLE for LCD2 */
  375. if (da->manager_count > 2) {
  376. v = omap_hwmod_read(oh, DISPC_CONTROL2);
  377. lcd2_en = v & LCD_EN_MASK;
  378. }
  379. /* store value of LCDENABLE for LCD3 */
  380. if (da->manager_count > 3) {
  381. v = omap_hwmod_read(oh, DISPC_CONTROL3);
  382. lcd3_en = v & LCD_EN_MASK;
  383. }
  384. if (!(lcd_en | digit_en | lcd2_en | lcd3_en))
  385. return; /* no managers currently enabled */
  386. /*
  387. * If any manager was enabled, we need to disable it before
  388. * DSS clocks are disabled or DISPC module is reset
  389. */
  390. if (lcd_en)
  391. irq_mask |= 1 << FRAMEDONE_IRQ_SHIFT;
  392. if (digit_en) {
  393. if (da->has_framedonetv_irq) {
  394. irq_mask |= 1 << FRAMEDONETV_IRQ_SHIFT;
  395. } else {
  396. irq_mask |= 1 << EVSYNC_EVEN_IRQ_SHIFT |
  397. 1 << EVSYNC_ODD_IRQ_SHIFT;
  398. }
  399. }
  400. if (lcd2_en)
  401. irq_mask |= 1 << FRAMEDONE2_IRQ_SHIFT;
  402. if (lcd3_en)
  403. irq_mask |= 1 << FRAMEDONE3_IRQ_SHIFT;
  404. /*
  405. * clear any previous FRAMEDONE, FRAMEDONETV,
  406. * EVSYNC_EVEN/ODD, FRAMEDONE2 or FRAMEDONE3 interrupts
  407. */
  408. omap_hwmod_write(irq_mask, oh, DISPC_IRQSTATUS);
  409. /* disable LCD and TV managers */
  410. v = omap_hwmod_read(oh, DISPC_CONTROL);
  411. v &= ~(LCD_EN_MASK | DIGIT_EN_MASK);
  412. omap_hwmod_write(v, oh, DISPC_CONTROL);
  413. /* disable LCD2 manager */
  414. if (da->manager_count > 2) {
  415. v = omap_hwmod_read(oh, DISPC_CONTROL2);
  416. v &= ~LCD_EN_MASK;
  417. omap_hwmod_write(v, oh, DISPC_CONTROL2);
  418. }
  419. /* disable LCD3 manager */
  420. if (da->manager_count > 3) {
  421. v = omap_hwmod_read(oh, DISPC_CONTROL3);
  422. v &= ~LCD_EN_MASK;
  423. omap_hwmod_write(v, oh, DISPC_CONTROL3);
  424. }
  425. i = 0;
  426. while ((omap_hwmod_read(oh, DISPC_IRQSTATUS) & irq_mask) !=
  427. irq_mask) {
  428. i++;
  429. if (i > FRAMEDONE_IRQ_TIMEOUT) {
  430. pr_err("didn't get FRAMEDONE1/2/3 or TV interrupt\n");
  431. break;
  432. }
  433. mdelay(1);
  434. }
  435. }
  436. int omap_dss_reset(struct omap_hwmod *oh)
  437. {
  438. struct omap_hwmod_opt_clk *oc;
  439. int c = 0;
  440. int i, r;
  441. if (!(oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS)) {
  442. pr_err("dss_core: hwmod data doesn't contain reset data\n");
  443. return -EINVAL;
  444. }
  445. for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
  446. if (oc->_clk)
  447. clk_prepare_enable(oc->_clk);
  448. dispc_disable_outputs();
  449. /* clear SDI registers */
  450. if (cpu_is_omap3430()) {
  451. omap_hwmod_write(0x0, oh, DSS_SDI_CONTROL);
  452. omap_hwmod_write(0x0, oh, DSS_PLL_CONTROL);
  453. }
  454. /*
  455. * clear DSS_CONTROL register to switch DSS clock sources to
  456. * PRCM clock, if any
  457. */
  458. omap_hwmod_write(0x0, oh, DSS_CONTROL);
  459. omap_test_timeout((omap_hwmod_read(oh, oh->class->sysc->syss_offs)
  460. & SYSS_RESETDONE_MASK),
  461. MAX_MODULE_SOFTRESET_WAIT, c);
  462. if (c == MAX_MODULE_SOFTRESET_WAIT)
  463. pr_warn("dss_core: waiting for reset to finish failed\n");
  464. else
  465. pr_debug("dss_core: softreset done\n");
  466. for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
  467. if (oc->_clk)
  468. clk_disable_unprepare(oc->_clk);
  469. r = (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 0;
  470. return r;
  471. }
  472. void __init omapdss_early_init_of(void)
  473. {
  474. }
  475. static const char * const omapdss_compat_names[] __initconst = {
  476. "ti,omap2-dss",
  477. "ti,omap3-dss",
  478. "ti,omap4-dss",
  479. "ti,omap5-dss",
  480. "ti,dra7-dss",
  481. };
  482. struct device_node * __init omapdss_find_dss_of_node(void)
  483. {
  484. struct device_node *node;
  485. int i;
  486. for (i = 0; i < ARRAY_SIZE(omapdss_compat_names); ++i) {
  487. node = of_find_compatible_node(NULL, NULL,
  488. omapdss_compat_names[i]);
  489. if (node)
  490. return node;
  491. }
  492. return NULL;
  493. }
  494. int __init omapdss_init_of(void)
  495. {
  496. int r;
  497. enum omapdss_version ver;
  498. struct device_node *node;
  499. struct platform_device *pdev;
  500. static struct omap_dss_board_info board_data = {
  501. .dsi_enable_pads = omap_dsi_enable_pads,
  502. .dsi_disable_pads = omap_dsi_disable_pads,
  503. .set_min_bus_tput = omap_dss_set_min_bus_tput,
  504. };
  505. /* only create dss helper devices if dss is enabled in the .dts */
  506. node = omapdss_find_dss_of_node();
  507. if (!node)
  508. return 0;
  509. if (!of_device_is_available(node))
  510. return 0;
  511. ver = omap_display_get_version();
  512. if (ver == OMAPDSS_VER_UNKNOWN) {
  513. pr_err("DSS not supported on this SoC\n");
  514. return -ENODEV;
  515. }
  516. pdev = of_find_device_by_node(node);
  517. if (!pdev) {
  518. pr_err("Unable to find DSS platform device\n");
  519. return -ENODEV;
  520. }
  521. r = of_platform_populate(node, NULL, NULL, &pdev->dev);
  522. if (r) {
  523. pr_err("Unable to populate DSS submodule devices\n");
  524. return r;
  525. }
  526. board_data.version = ver;
  527. omap_display_device.dev.platform_data = &board_data;
  528. r = platform_device_register(&omap_display_device);
  529. if (r < 0) {
  530. pr_err("Unable to register omapdss device\n");
  531. return r;
  532. }
  533. /* create DRM device */
  534. r = omap_init_drm();
  535. if (r < 0) {
  536. pr_err("Unable to register omapdrm device\n");
  537. return r;
  538. }
  539. /* create vrfb device */
  540. r = omap_init_vrfb();
  541. if (r < 0) {
  542. pr_err("Unable to register omapvrfb device\n");
  543. return r;
  544. }
  545. /* create FB device */
  546. r = omap_init_fb();
  547. if (r < 0) {
  548. pr_err("Unable to register omapfb device\n");
  549. return r;
  550. }
  551. /* create V4L2 display device */
  552. r = omap_init_vout();
  553. if (r < 0) {
  554. pr_err("Unable to register omap_vout device\n");
  555. return r;
  556. }
  557. /* add DSI info for omap4 */
  558. node = of_find_node_by_name(NULL, "omap4_padconf_global");
  559. if (node)
  560. omap4_dsi_mux_syscon = syscon_node_to_regmap(node);
  561. return 0;
  562. }