dpi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. /*
  2. * linux/drivers/video/omap2/dss/dpi.c
  3. *
  4. * Copyright (C) 2009 Nokia Corporation
  5. * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
  6. *
  7. * Some code and ideas taken from drivers/video/omap/ driver
  8. * by Imre Deak.
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License version 2 as published by
  12. * the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but WITHOUT
  15. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  17. * more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along with
  20. * this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. #define DSS_SUBSYS_NAME "DPI"
  23. #include <linux/kernel.h>
  24. #include <linux/delay.h>
  25. #include <linux/export.h>
  26. #include <linux/err.h>
  27. #include <linux/errno.h>
  28. #include <linux/platform_device.h>
  29. #include <linux/regulator/consumer.h>
  30. #include <linux/string.h>
  31. #include <video/omapdss.h>
  32. #include "dss.h"
  33. #include "dss_features.h"
  34. static struct {
  35. struct platform_device *pdev;
  36. struct regulator *vdds_dsi_reg;
  37. struct platform_device *dsidev;
  38. struct mutex lock;
  39. struct omap_video_timings timings;
  40. struct dss_lcd_mgr_config mgr_config;
  41. int data_lines;
  42. struct omap_dss_device output;
  43. } dpi;
  44. static struct platform_device *dpi_get_dsidev(enum omap_channel channel)
  45. {
  46. /*
  47. * XXX we can't currently use DSI PLL for DPI with OMAP3, as the DSI PLL
  48. * would also be used for DISPC fclk. Meaning, when the DPI output is
  49. * disabled, DISPC clock will be disabled, and TV out will stop.
  50. */
  51. switch (omapdss_get_version()) {
  52. case OMAPDSS_VER_OMAP24xx:
  53. case OMAPDSS_VER_OMAP34xx_ES1:
  54. case OMAPDSS_VER_OMAP34xx_ES3:
  55. case OMAPDSS_VER_OMAP3630:
  56. case OMAPDSS_VER_AM35xx:
  57. return NULL;
  58. case OMAPDSS_VER_OMAP4430_ES1:
  59. case OMAPDSS_VER_OMAP4430_ES2:
  60. case OMAPDSS_VER_OMAP4:
  61. switch (channel) {
  62. case OMAP_DSS_CHANNEL_LCD:
  63. return dsi_get_dsidev_from_id(0);
  64. case OMAP_DSS_CHANNEL_LCD2:
  65. return dsi_get_dsidev_from_id(1);
  66. default:
  67. return NULL;
  68. }
  69. case OMAPDSS_VER_OMAP5:
  70. switch (channel) {
  71. case OMAP_DSS_CHANNEL_LCD:
  72. return dsi_get_dsidev_from_id(0);
  73. case OMAP_DSS_CHANNEL_LCD3:
  74. return dsi_get_dsidev_from_id(1);
  75. default:
  76. return NULL;
  77. }
  78. default:
  79. return NULL;
  80. }
  81. }
  82. static enum omap_dss_clk_source dpi_get_alt_clk_src(enum omap_channel channel)
  83. {
  84. switch (channel) {
  85. case OMAP_DSS_CHANNEL_LCD:
  86. return OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC;
  87. case OMAP_DSS_CHANNEL_LCD2:
  88. return OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC;
  89. default:
  90. /* this shouldn't happen */
  91. WARN_ON(1);
  92. return OMAP_DSS_CLK_SRC_FCK;
  93. }
  94. }
  95. struct dpi_clk_calc_ctx {
  96. struct platform_device *dsidev;
  97. /* inputs */
  98. unsigned long pck_min, pck_max;
  99. /* outputs */
  100. struct dsi_clock_info dsi_cinfo;
  101. struct dss_clock_info dss_cinfo;
  102. struct dispc_clock_info dispc_cinfo;
  103. };
  104. static bool dpi_calc_dispc_cb(int lckd, int pckd, unsigned long lck,
  105. unsigned long pck, void *data)
  106. {
  107. struct dpi_clk_calc_ctx *ctx = data;
  108. /*
  109. * Odd dividers give us uneven duty cycle, causing problem when level
  110. * shifted. So skip all odd dividers when the pixel clock is on the
  111. * higher side.
  112. */
  113. if (ctx->pck_min >= 100000000) {
  114. if (lckd > 1 && lckd % 2 != 0)
  115. return false;
  116. if (pckd > 1 && pckd % 2 != 0)
  117. return false;
  118. }
  119. ctx->dispc_cinfo.lck_div = lckd;
  120. ctx->dispc_cinfo.pck_div = pckd;
  121. ctx->dispc_cinfo.lck = lck;
  122. ctx->dispc_cinfo.pck = pck;
  123. return true;
  124. }
  125. static bool dpi_calc_hsdiv_cb(int regm_dispc, unsigned long dispc,
  126. void *data)
  127. {
  128. struct dpi_clk_calc_ctx *ctx = data;
  129. /*
  130. * Odd dividers give us uneven duty cycle, causing problem when level
  131. * shifted. So skip all odd dividers when the pixel clock is on the
  132. * higher side.
  133. */
  134. if (regm_dispc > 1 && regm_dispc % 2 != 0 && ctx->pck_min >= 100000000)
  135. return false;
  136. ctx->dsi_cinfo.regm_dispc = regm_dispc;
  137. ctx->dsi_cinfo.dsi_pll_hsdiv_dispc_clk = dispc;
  138. return dispc_div_calc(dispc, ctx->pck_min, ctx->pck_max,
  139. dpi_calc_dispc_cb, ctx);
  140. }
  141. static bool dpi_calc_pll_cb(int regn, int regm, unsigned long fint,
  142. unsigned long pll,
  143. void *data)
  144. {
  145. struct dpi_clk_calc_ctx *ctx = data;
  146. ctx->dsi_cinfo.regn = regn;
  147. ctx->dsi_cinfo.regm = regm;
  148. ctx->dsi_cinfo.fint = fint;
  149. ctx->dsi_cinfo.clkin4ddr = pll;
  150. return dsi_hsdiv_calc(ctx->dsidev, pll, ctx->pck_min,
  151. dpi_calc_hsdiv_cb, ctx);
  152. }
  153. static bool dpi_calc_dss_cb(int fckd, unsigned long fck, void *data)
  154. {
  155. struct dpi_clk_calc_ctx *ctx = data;
  156. ctx->dss_cinfo.fck = fck;
  157. ctx->dss_cinfo.fck_div = fckd;
  158. return dispc_div_calc(fck, ctx->pck_min, ctx->pck_max,
  159. dpi_calc_dispc_cb, ctx);
  160. }
  161. static bool dpi_dsi_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx)
  162. {
  163. unsigned long clkin;
  164. unsigned long pll_min, pll_max;
  165. clkin = dsi_get_pll_clkin(dpi.dsidev);
  166. memset(ctx, 0, sizeof(*ctx));
  167. ctx->dsidev = dpi.dsidev;
  168. ctx->pck_min = pck - 1000;
  169. ctx->pck_max = pck + 1000;
  170. ctx->dsi_cinfo.clkin = clkin;
  171. pll_min = 0;
  172. pll_max = 0;
  173. return dsi_pll_calc(dpi.dsidev, clkin,
  174. pll_min, pll_max,
  175. dpi_calc_pll_cb, ctx);
  176. }
  177. static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx)
  178. {
  179. int i;
  180. /*
  181. * DSS fck gives us very few possibilities, so finding a good pixel
  182. * clock may not be possible. We try multiple times to find the clock,
  183. * each time widening the pixel clock range we look for, up to
  184. * +/- ~15MHz.
  185. */
  186. for (i = 0; i < 25; ++i) {
  187. bool ok;
  188. memset(ctx, 0, sizeof(*ctx));
  189. if (pck > 1000 * i * i * i)
  190. ctx->pck_min = max(pck - 1000 * i * i * i, 0lu);
  191. else
  192. ctx->pck_min = 0;
  193. ctx->pck_max = pck + 1000 * i * i * i;
  194. ok = dss_div_calc(ctx->pck_min, dpi_calc_dss_cb, ctx);
  195. if (ok)
  196. return ok;
  197. }
  198. return false;
  199. }
  200. static int dpi_set_dsi_clk(enum omap_channel channel,
  201. unsigned long pck_req, unsigned long *fck, int *lck_div,
  202. int *pck_div)
  203. {
  204. struct dpi_clk_calc_ctx ctx;
  205. int r;
  206. bool ok;
  207. ok = dpi_dsi_clk_calc(pck_req, &ctx);
  208. if (!ok)
  209. return -EINVAL;
  210. r = dsi_pll_set_clock_div(dpi.dsidev, &ctx.dsi_cinfo);
  211. if (r)
  212. return r;
  213. dss_select_lcd_clk_source(channel,
  214. dpi_get_alt_clk_src(channel));
  215. dpi.mgr_config.clock_info = ctx.dispc_cinfo;
  216. *fck = ctx.dsi_cinfo.dsi_pll_hsdiv_dispc_clk;
  217. *lck_div = ctx.dispc_cinfo.lck_div;
  218. *pck_div = ctx.dispc_cinfo.pck_div;
  219. return 0;
  220. }
  221. static int dpi_set_dispc_clk(unsigned long pck_req, unsigned long *fck,
  222. int *lck_div, int *pck_div)
  223. {
  224. struct dpi_clk_calc_ctx ctx;
  225. int r;
  226. bool ok;
  227. ok = dpi_dss_clk_calc(pck_req, &ctx);
  228. if (!ok)
  229. return -EINVAL;
  230. r = dss_set_clock_div(&ctx.dss_cinfo);
  231. if (r)
  232. return r;
  233. dpi.mgr_config.clock_info = ctx.dispc_cinfo;
  234. *fck = ctx.dss_cinfo.fck;
  235. *lck_div = ctx.dispc_cinfo.lck_div;
  236. *pck_div = ctx.dispc_cinfo.pck_div;
  237. return 0;
  238. }
  239. static int dpi_set_mode(struct omap_overlay_manager *mgr)
  240. {
  241. struct omap_video_timings *t = &dpi.timings;
  242. int lck_div = 0, pck_div = 0;
  243. unsigned long fck = 0;
  244. unsigned long pck;
  245. int r = 0;
  246. if (dpi.dsidev)
  247. r = dpi_set_dsi_clk(mgr->id, t->pixel_clock * 1000, &fck,
  248. &lck_div, &pck_div);
  249. else
  250. r = dpi_set_dispc_clk(t->pixel_clock * 1000, &fck,
  251. &lck_div, &pck_div);
  252. if (r)
  253. return r;
  254. pck = fck / lck_div / pck_div / 1000;
  255. if (pck != t->pixel_clock) {
  256. DSSWARN("Could not find exact pixel clock. "
  257. "Requested %d kHz, got %lu kHz\n",
  258. t->pixel_clock, pck);
  259. t->pixel_clock = pck;
  260. }
  261. dss_mgr_set_timings(mgr, t);
  262. return 0;
  263. }
  264. static void dpi_config_lcd_manager(struct omap_overlay_manager *mgr)
  265. {
  266. dpi.mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
  267. dpi.mgr_config.stallmode = false;
  268. dpi.mgr_config.fifohandcheck = false;
  269. dpi.mgr_config.video_port_width = dpi.data_lines;
  270. dpi.mgr_config.lcden_sig_polarity = 0;
  271. dss_mgr_set_lcd_config(mgr, &dpi.mgr_config);
  272. }
  273. static int dpi_display_enable(struct omap_dss_device *dssdev)
  274. {
  275. struct omap_dss_device *out = &dpi.output;
  276. int r;
  277. mutex_lock(&dpi.lock);
  278. if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI) && !dpi.vdds_dsi_reg) {
  279. DSSERR("no VDSS_DSI regulator\n");
  280. r = -ENODEV;
  281. goto err_no_reg;
  282. }
  283. if (out == NULL || out->manager == NULL) {
  284. DSSERR("failed to enable display: no output/manager\n");
  285. r = -ENODEV;
  286. goto err_no_out_mgr;
  287. }
  288. if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) {
  289. r = regulator_enable(dpi.vdds_dsi_reg);
  290. if (r)
  291. goto err_reg_enable;
  292. }
  293. r = dispc_runtime_get();
  294. if (r)
  295. goto err_get_dispc;
  296. r = dss_dpi_select_source(out->manager->id);
  297. if (r)
  298. goto err_src_sel;
  299. if (dpi.dsidev) {
  300. r = dsi_runtime_get(dpi.dsidev);
  301. if (r)
  302. goto err_get_dsi;
  303. r = dsi_pll_init(dpi.dsidev, 0, 1);
  304. if (r)
  305. goto err_dsi_pll_init;
  306. }
  307. r = dpi_set_mode(out->manager);
  308. if (r)
  309. goto err_set_mode;
  310. dpi_config_lcd_manager(out->manager);
  311. mdelay(2);
  312. r = dss_mgr_enable(out->manager);
  313. if (r)
  314. goto err_mgr_enable;
  315. mutex_unlock(&dpi.lock);
  316. return 0;
  317. err_mgr_enable:
  318. err_set_mode:
  319. if (dpi.dsidev)
  320. dsi_pll_uninit(dpi.dsidev, true);
  321. err_dsi_pll_init:
  322. if (dpi.dsidev)
  323. dsi_runtime_put(dpi.dsidev);
  324. err_get_dsi:
  325. err_src_sel:
  326. dispc_runtime_put();
  327. err_get_dispc:
  328. if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI))
  329. regulator_disable(dpi.vdds_dsi_reg);
  330. err_reg_enable:
  331. err_no_out_mgr:
  332. err_no_reg:
  333. mutex_unlock(&dpi.lock);
  334. return r;
  335. }
  336. static void dpi_display_disable(struct omap_dss_device *dssdev)
  337. {
  338. struct omap_overlay_manager *mgr = dpi.output.manager;
  339. mutex_lock(&dpi.lock);
  340. dss_mgr_disable(mgr);
  341. if (dpi.dsidev) {
  342. dss_select_lcd_clk_source(mgr->id, OMAP_DSS_CLK_SRC_FCK);
  343. dsi_pll_uninit(dpi.dsidev, true);
  344. dsi_runtime_put(dpi.dsidev);
  345. }
  346. dispc_runtime_put();
  347. if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI))
  348. regulator_disable(dpi.vdds_dsi_reg);
  349. mutex_unlock(&dpi.lock);
  350. }
  351. static void dpi_set_timings(struct omap_dss_device *dssdev,
  352. struct omap_video_timings *timings)
  353. {
  354. DSSDBG("dpi_set_timings\n");
  355. mutex_lock(&dpi.lock);
  356. dpi.timings = *timings;
  357. mutex_unlock(&dpi.lock);
  358. }
  359. static void dpi_get_timings(struct omap_dss_device *dssdev,
  360. struct omap_video_timings *timings)
  361. {
  362. mutex_lock(&dpi.lock);
  363. *timings = dpi.timings;
  364. mutex_unlock(&dpi.lock);
  365. }
  366. static int dpi_check_timings(struct omap_dss_device *dssdev,
  367. struct omap_video_timings *timings)
  368. {
  369. struct omap_overlay_manager *mgr = dpi.output.manager;
  370. int lck_div, pck_div;
  371. unsigned long fck;
  372. unsigned long pck;
  373. struct dpi_clk_calc_ctx ctx;
  374. bool ok;
  375. if (mgr && !dispc_mgr_timings_ok(mgr->id, timings))
  376. return -EINVAL;
  377. if (timings->pixel_clock == 0)
  378. return -EINVAL;
  379. if (dpi.dsidev) {
  380. ok = dpi_dsi_clk_calc(timings->pixel_clock * 1000, &ctx);
  381. if (!ok)
  382. return -EINVAL;
  383. fck = ctx.dsi_cinfo.dsi_pll_hsdiv_dispc_clk;
  384. } else {
  385. ok = dpi_dss_clk_calc(timings->pixel_clock * 1000, &ctx);
  386. if (!ok)
  387. return -EINVAL;
  388. fck = ctx.dss_cinfo.fck;
  389. }
  390. lck_div = ctx.dispc_cinfo.lck_div;
  391. pck_div = ctx.dispc_cinfo.pck_div;
  392. pck = fck / lck_div / pck_div / 1000;
  393. timings->pixel_clock = pck;
  394. return 0;
  395. }
  396. static void dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines)
  397. {
  398. mutex_lock(&dpi.lock);
  399. dpi.data_lines = data_lines;
  400. mutex_unlock(&dpi.lock);
  401. }
  402. static int dpi_verify_dsi_pll(struct platform_device *dsidev)
  403. {
  404. int r;
  405. /* do initial setup with the PLL to see if it is operational */
  406. r = dsi_runtime_get(dsidev);
  407. if (r)
  408. return r;
  409. r = dsi_pll_init(dsidev, 0, 1);
  410. if (r) {
  411. dsi_runtime_put(dsidev);
  412. return r;
  413. }
  414. dsi_pll_uninit(dsidev, true);
  415. dsi_runtime_put(dsidev);
  416. return 0;
  417. }
  418. static int dpi_init_regulator(void)
  419. {
  420. struct regulator *vdds_dsi;
  421. if (!dss_has_feature(FEAT_DPI_USES_VDDS_DSI))
  422. return 0;
  423. if (dpi.vdds_dsi_reg)
  424. return 0;
  425. vdds_dsi = devm_regulator_get(&dpi.pdev->dev, "vdds_dsi");
  426. if (IS_ERR(vdds_dsi)) {
  427. DSSERR("can't get VDDS_DSI regulator\n");
  428. return PTR_ERR(vdds_dsi);
  429. }
  430. dpi.vdds_dsi_reg = vdds_dsi;
  431. return 0;
  432. }
  433. static void dpi_init_pll(void)
  434. {
  435. struct platform_device *dsidev;
  436. if (dpi.dsidev)
  437. return;
  438. dsidev = dpi_get_dsidev(dpi.output.dispc_channel);
  439. if (!dsidev)
  440. return;
  441. if (dpi_verify_dsi_pll(dsidev)) {
  442. DSSWARN("DSI PLL not operational\n");
  443. return;
  444. }
  445. dpi.dsidev = dsidev;
  446. }
  447. /*
  448. * Return a hardcoded channel for the DPI output. This should work for
  449. * current use cases, but this can be later expanded to either resolve
  450. * the channel in some more dynamic manner, or get the channel as a user
  451. * parameter.
  452. */
  453. static enum omap_channel dpi_get_channel(void)
  454. {
  455. switch (omapdss_get_version()) {
  456. case OMAPDSS_VER_OMAP24xx:
  457. case OMAPDSS_VER_OMAP34xx_ES1:
  458. case OMAPDSS_VER_OMAP34xx_ES3:
  459. case OMAPDSS_VER_OMAP3630:
  460. case OMAPDSS_VER_AM35xx:
  461. return OMAP_DSS_CHANNEL_LCD;
  462. case OMAPDSS_VER_OMAP4430_ES1:
  463. case OMAPDSS_VER_OMAP4430_ES2:
  464. case OMAPDSS_VER_OMAP4:
  465. return OMAP_DSS_CHANNEL_LCD2;
  466. case OMAPDSS_VER_OMAP5:
  467. return OMAP_DSS_CHANNEL_LCD3;
  468. default:
  469. DSSWARN("unsupported DSS version\n");
  470. return OMAP_DSS_CHANNEL_LCD;
  471. }
  472. }
  473. static int dpi_connect(struct omap_dss_device *dssdev,
  474. struct omap_dss_device *dst)
  475. {
  476. struct omap_overlay_manager *mgr;
  477. int r;
  478. r = dpi_init_regulator();
  479. if (r)
  480. return r;
  481. dpi_init_pll();
  482. mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel);
  483. if (!mgr)
  484. return -ENODEV;
  485. r = dss_mgr_connect(mgr, dssdev);
  486. if (r)
  487. return r;
  488. r = omapdss_output_set_device(dssdev, dst);
  489. if (r) {
  490. DSSERR("failed to connect output to new device: %s\n",
  491. dst->name);
  492. dss_mgr_disconnect(mgr, dssdev);
  493. return r;
  494. }
  495. return 0;
  496. }
  497. static void dpi_disconnect(struct omap_dss_device *dssdev,
  498. struct omap_dss_device *dst)
  499. {
  500. WARN_ON(dst != dssdev->dst);
  501. if (dst != dssdev->dst)
  502. return;
  503. omapdss_output_unset_device(dssdev);
  504. if (dssdev->manager)
  505. dss_mgr_disconnect(dssdev->manager, dssdev);
  506. }
  507. static const struct omapdss_dpi_ops dpi_ops = {
  508. .connect = dpi_connect,
  509. .disconnect = dpi_disconnect,
  510. .enable = dpi_display_enable,
  511. .disable = dpi_display_disable,
  512. .check_timings = dpi_check_timings,
  513. .set_timings = dpi_set_timings,
  514. .get_timings = dpi_get_timings,
  515. .set_data_lines = dpi_set_data_lines,
  516. };
  517. static void dpi_init_output(struct platform_device *pdev)
  518. {
  519. struct omap_dss_device *out = &dpi.output;
  520. out->dev = &pdev->dev;
  521. out->id = OMAP_DSS_OUTPUT_DPI;
  522. out->output_type = OMAP_DISPLAY_TYPE_DPI;
  523. out->name = "dpi.0";
  524. out->dispc_channel = dpi_get_channel();
  525. out->ops.dpi = &dpi_ops;
  526. out->owner = THIS_MODULE;
  527. omapdss_register_output(out);
  528. }
  529. static void __exit dpi_uninit_output(struct platform_device *pdev)
  530. {
  531. struct omap_dss_device *out = &dpi.output;
  532. omapdss_unregister_output(out);
  533. }
  534. static int omap_dpi_probe(struct platform_device *pdev)
  535. {
  536. dpi.pdev = pdev;
  537. mutex_init(&dpi.lock);
  538. dpi_init_output(pdev);
  539. return 0;
  540. }
  541. static int __exit omap_dpi_remove(struct platform_device *pdev)
  542. {
  543. dpi_uninit_output(pdev);
  544. return 0;
  545. }
  546. static struct platform_driver omap_dpi_driver = {
  547. .probe = omap_dpi_probe,
  548. .remove = __exit_p(omap_dpi_remove),
  549. .driver = {
  550. .name = "omapdss_dpi",
  551. .owner = THIS_MODULE,
  552. },
  553. };
  554. int __init dpi_init_platform_driver(void)
  555. {
  556. return platform_driver_register(&omap_dpi_driver);
  557. }
  558. void __exit dpi_uninit_platform_driver(void)
  559. {
  560. platform_driver_unregister(&omap_dpi_driver);
  561. }