exynos_drm_fimd.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  1. /* exynos_drm_fimd.c
  2. *
  3. * Copyright (C) 2011 Samsung Electronics Co.Ltd
  4. * Authors:
  5. * Joonyoung Shim <jy0922.shim@samsung.com>
  6. * Inki Dae <inki.dae@samsung.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. */
  14. #include <drm/drmP.h>
  15. #include <linux/kernel.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/clk.h>
  18. #include <linux/of.h>
  19. #include <linux/of_device.h>
  20. #include <linux/pm_runtime.h>
  21. #include <linux/component.h>
  22. #include <linux/mfd/syscon.h>
  23. #include <linux/regmap.h>
  24. #include <video/of_display_timing.h>
  25. #include <video/of_videomode.h>
  26. #include <video/samsung_fimd.h>
  27. #include <drm/exynos_drm.h>
  28. #include "exynos_drm_drv.h"
  29. #include "exynos_drm_fbdev.h"
  30. #include "exynos_drm_crtc.h"
  31. #include "exynos_drm_plane.h"
  32. #include "exynos_drm_iommu.h"
  33. /*
  34. * FIMD stands for Fully Interactive Mobile Display and
  35. * as a display controller, it transfers contents drawn on memory
  36. * to a LCD Panel through Display Interfaces such as RGB or
  37. * CPU Interface.
  38. */
  39. #define FIMD_DEFAULT_FRAMERATE 60
  40. #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
  41. /* position control register for hardware window 0, 2 ~ 4.*/
  42. #define VIDOSD_A(win) (VIDOSD_BASE + 0x00 + (win) * 16)
  43. #define VIDOSD_B(win) (VIDOSD_BASE + 0x04 + (win) * 16)
  44. /*
  45. * size control register for hardware windows 0 and alpha control register
  46. * for hardware windows 1 ~ 4
  47. */
  48. #define VIDOSD_C(win) (VIDOSD_BASE + 0x08 + (win) * 16)
  49. /* size control register for hardware windows 1 ~ 2. */
  50. #define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16)
  51. #define VIDWnALPHA0(win) (VIDW_ALPHA + 0x00 + (win) * 8)
  52. #define VIDWnALPHA1(win) (VIDW_ALPHA + 0x04 + (win) * 8)
  53. #define VIDWx_BUF_START(win, buf) (VIDW_BUF_START(buf) + (win) * 8)
  54. #define VIDWx_BUF_END(win, buf) (VIDW_BUF_END(buf) + (win) * 8)
  55. #define VIDWx_BUF_SIZE(win, buf) (VIDW_BUF_SIZE(buf) + (win) * 4)
  56. /* color key control register for hardware window 1 ~ 4. */
  57. #define WKEYCON0_BASE(x) ((WKEYCON0 + 0x140) + ((x - 1) * 8))
  58. /* color key value register for hardware window 1 ~ 4. */
  59. #define WKEYCON1_BASE(x) ((WKEYCON1 + 0x140) + ((x - 1) * 8))
  60. /* I80 / RGB trigger control register */
  61. #define TRIGCON 0x1A4
  62. #define TRGMODE_I80_RGB_ENABLE_I80 (1 << 0)
  63. #define SWTRGCMD_I80_RGB_ENABLE (1 << 1)
  64. /* display mode change control register except exynos4 */
  65. #define VIDOUT_CON 0x000
  66. #define VIDOUT_CON_F_I80_LDI0 (0x2 << 8)
  67. /* I80 interface control for main LDI register */
  68. #define I80IFCONFAx(x) (0x1B0 + (x) * 4)
  69. #define I80IFCONFBx(x) (0x1B8 + (x) * 4)
  70. #define LCD_CS_SETUP(x) ((x) << 16)
  71. #define LCD_WR_SETUP(x) ((x) << 12)
  72. #define LCD_WR_ACTIVE(x) ((x) << 8)
  73. #define LCD_WR_HOLD(x) ((x) << 4)
  74. #define I80IFEN_ENABLE (1 << 0)
  75. /* FIMD has totally five hardware windows. */
  76. #define WINDOWS_NR 5
  77. struct fimd_driver_data {
  78. unsigned int timing_base;
  79. unsigned int lcdblk_offset;
  80. unsigned int lcdblk_vt_shift;
  81. unsigned int lcdblk_bypass_shift;
  82. unsigned int has_shadowcon:1;
  83. unsigned int has_clksel:1;
  84. unsigned int has_limited_fmt:1;
  85. unsigned int has_vidoutcon:1;
  86. unsigned int has_vtsel:1;
  87. };
  88. static struct fimd_driver_data s3c64xx_fimd_driver_data = {
  89. .timing_base = 0x0,
  90. .has_clksel = 1,
  91. .has_limited_fmt = 1,
  92. };
  93. static struct fimd_driver_data exynos3_fimd_driver_data = {
  94. .timing_base = 0x20000,
  95. .lcdblk_offset = 0x210,
  96. .lcdblk_bypass_shift = 1,
  97. .has_shadowcon = 1,
  98. .has_vidoutcon = 1,
  99. };
  100. static struct fimd_driver_data exynos4_fimd_driver_data = {
  101. .timing_base = 0x0,
  102. .lcdblk_offset = 0x210,
  103. .lcdblk_vt_shift = 10,
  104. .lcdblk_bypass_shift = 1,
  105. .has_shadowcon = 1,
  106. .has_vtsel = 1,
  107. };
  108. static struct fimd_driver_data exynos4415_fimd_driver_data = {
  109. .timing_base = 0x20000,
  110. .lcdblk_offset = 0x210,
  111. .lcdblk_vt_shift = 10,
  112. .lcdblk_bypass_shift = 1,
  113. .has_shadowcon = 1,
  114. .has_vidoutcon = 1,
  115. .has_vtsel = 1,
  116. };
  117. static struct fimd_driver_data exynos5_fimd_driver_data = {
  118. .timing_base = 0x20000,
  119. .lcdblk_offset = 0x214,
  120. .lcdblk_vt_shift = 24,
  121. .lcdblk_bypass_shift = 15,
  122. .has_shadowcon = 1,
  123. .has_vidoutcon = 1,
  124. .has_vtsel = 1,
  125. };
  126. struct fimd_context {
  127. struct device *dev;
  128. struct drm_device *drm_dev;
  129. struct exynos_drm_crtc *crtc;
  130. struct exynos_drm_plane planes[WINDOWS_NR];
  131. struct clk *bus_clk;
  132. struct clk *lcd_clk;
  133. void __iomem *regs;
  134. struct regmap *sysreg;
  135. unsigned int default_win;
  136. unsigned long irq_flags;
  137. u32 vidcon0;
  138. u32 vidcon1;
  139. u32 vidout_con;
  140. u32 i80ifcon;
  141. bool i80_if;
  142. bool suspended;
  143. int pipe;
  144. wait_queue_head_t wait_vsync_queue;
  145. atomic_t wait_vsync_event;
  146. atomic_t win_updated;
  147. atomic_t triggering;
  148. struct exynos_drm_panel_info panel;
  149. struct fimd_driver_data *driver_data;
  150. struct exynos_drm_display *display;
  151. };
  152. static const struct of_device_id fimd_driver_dt_match[] = {
  153. { .compatible = "samsung,s3c6400-fimd",
  154. .data = &s3c64xx_fimd_driver_data },
  155. { .compatible = "samsung,exynos3250-fimd",
  156. .data = &exynos3_fimd_driver_data },
  157. { .compatible = "samsung,exynos4210-fimd",
  158. .data = &exynos4_fimd_driver_data },
  159. { .compatible = "samsung,exynos4415-fimd",
  160. .data = &exynos4415_fimd_driver_data },
  161. { .compatible = "samsung,exynos5250-fimd",
  162. .data = &exynos5_fimd_driver_data },
  163. {},
  164. };
  165. MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
  166. static inline struct fimd_driver_data *drm_fimd_get_driver_data(
  167. struct platform_device *pdev)
  168. {
  169. const struct of_device_id *of_id =
  170. of_match_device(fimd_driver_dt_match, &pdev->dev);
  171. return (struct fimd_driver_data *)of_id->data;
  172. }
  173. static void fimd_wait_for_vblank(struct exynos_drm_crtc *crtc)
  174. {
  175. struct fimd_context *ctx = crtc->ctx;
  176. if (ctx->suspended)
  177. return;
  178. atomic_set(&ctx->wait_vsync_event, 1);
  179. /*
  180. * wait for FIMD to signal VSYNC interrupt or return after
  181. * timeout which is set to 50ms (refresh rate of 20).
  182. */
  183. if (!wait_event_timeout(ctx->wait_vsync_queue,
  184. !atomic_read(&ctx->wait_vsync_event),
  185. HZ/20))
  186. DRM_DEBUG_KMS("vblank wait timed out.\n");
  187. }
  188. static void fimd_enable_video_output(struct fimd_context *ctx, unsigned int win,
  189. bool enable)
  190. {
  191. u32 val = readl(ctx->regs + WINCON(win));
  192. if (enable)
  193. val |= WINCONx_ENWIN;
  194. else
  195. val &= ~WINCONx_ENWIN;
  196. writel(val, ctx->regs + WINCON(win));
  197. }
  198. static void fimd_enable_shadow_channel_path(struct fimd_context *ctx,
  199. unsigned int win,
  200. bool enable)
  201. {
  202. u32 val = readl(ctx->regs + SHADOWCON);
  203. if (enable)
  204. val |= SHADOWCON_CHx_ENABLE(win);
  205. else
  206. val &= ~SHADOWCON_CHx_ENABLE(win);
  207. writel(val, ctx->regs + SHADOWCON);
  208. }
  209. static void fimd_clear_channel(struct fimd_context *ctx)
  210. {
  211. unsigned int win, ch_enabled = 0;
  212. DRM_DEBUG_KMS("%s\n", __FILE__);
  213. /* Check if any channel is enabled. */
  214. for (win = 0; win < WINDOWS_NR; win++) {
  215. u32 val = readl(ctx->regs + WINCON(win));
  216. if (val & WINCONx_ENWIN) {
  217. fimd_enable_video_output(ctx, win, false);
  218. if (ctx->driver_data->has_shadowcon)
  219. fimd_enable_shadow_channel_path(ctx, win,
  220. false);
  221. ch_enabled = 1;
  222. }
  223. }
  224. /* Wait for vsync, as disable channel takes effect at next vsync */
  225. if (ch_enabled) {
  226. unsigned int state = ctx->suspended;
  227. ctx->suspended = 0;
  228. fimd_wait_for_vblank(ctx->crtc);
  229. ctx->suspended = state;
  230. }
  231. }
  232. static int fimd_iommu_attach_devices(struct fimd_context *ctx,
  233. struct drm_device *drm_dev)
  234. {
  235. /* attach this sub driver to iommu mapping if supported. */
  236. if (is_drm_iommu_supported(ctx->drm_dev)) {
  237. int ret;
  238. /*
  239. * If any channel is already active, iommu will throw
  240. * a PAGE FAULT when enabled. So clear any channel if enabled.
  241. */
  242. fimd_clear_channel(ctx);
  243. ret = drm_iommu_attach_device(ctx->drm_dev, ctx->dev);
  244. if (ret) {
  245. DRM_ERROR("drm_iommu_attach failed.\n");
  246. return ret;
  247. }
  248. }
  249. return 0;
  250. }
  251. static void fimd_iommu_detach_devices(struct fimd_context *ctx)
  252. {
  253. /* detach this sub driver from iommu mapping if supported. */
  254. if (is_drm_iommu_supported(ctx->drm_dev))
  255. drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
  256. }
  257. static u32 fimd_calc_clkdiv(struct fimd_context *ctx,
  258. const struct drm_display_mode *mode)
  259. {
  260. unsigned long ideal_clk = mode->htotal * mode->vtotal * mode->vrefresh;
  261. u32 clkdiv;
  262. if (ctx->i80_if) {
  263. /*
  264. * The frame done interrupt should be occurred prior to the
  265. * next TE signal.
  266. */
  267. ideal_clk *= 2;
  268. }
  269. /* Find the clock divider value that gets us closest to ideal_clk */
  270. clkdiv = DIV_ROUND_UP(clk_get_rate(ctx->lcd_clk), ideal_clk);
  271. return (clkdiv < 0x100) ? clkdiv : 0xff;
  272. }
  273. static bool fimd_mode_fixup(struct exynos_drm_crtc *crtc,
  274. const struct drm_display_mode *mode,
  275. struct drm_display_mode *adjusted_mode)
  276. {
  277. if (adjusted_mode->vrefresh == 0)
  278. adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE;
  279. return true;
  280. }
  281. static void fimd_commit(struct exynos_drm_crtc *crtc)
  282. {
  283. struct fimd_context *ctx = crtc->ctx;
  284. struct drm_display_mode *mode = &crtc->base.mode;
  285. struct fimd_driver_data *driver_data = ctx->driver_data;
  286. void *timing_base = ctx->regs + driver_data->timing_base;
  287. u32 val, clkdiv;
  288. if (ctx->suspended)
  289. return;
  290. /* nothing to do if we haven't set the mode yet */
  291. if (mode->htotal == 0 || mode->vtotal == 0)
  292. return;
  293. if (ctx->i80_if) {
  294. val = ctx->i80ifcon | I80IFEN_ENABLE;
  295. writel(val, timing_base + I80IFCONFAx(0));
  296. /* disable auto frame rate */
  297. writel(0, timing_base + I80IFCONFBx(0));
  298. /* set video type selection to I80 interface */
  299. if (driver_data->has_vtsel && ctx->sysreg &&
  300. regmap_update_bits(ctx->sysreg,
  301. driver_data->lcdblk_offset,
  302. 0x3 << driver_data->lcdblk_vt_shift,
  303. 0x1 << driver_data->lcdblk_vt_shift)) {
  304. DRM_ERROR("Failed to update sysreg for I80 i/f.\n");
  305. return;
  306. }
  307. } else {
  308. int vsync_len, vbpd, vfpd, hsync_len, hbpd, hfpd;
  309. u32 vidcon1;
  310. /* setup polarity values */
  311. vidcon1 = ctx->vidcon1;
  312. if (mode->flags & DRM_MODE_FLAG_NVSYNC)
  313. vidcon1 |= VIDCON1_INV_VSYNC;
  314. if (mode->flags & DRM_MODE_FLAG_NHSYNC)
  315. vidcon1 |= VIDCON1_INV_HSYNC;
  316. writel(vidcon1, ctx->regs + driver_data->timing_base + VIDCON1);
  317. /* setup vertical timing values. */
  318. vsync_len = mode->crtc_vsync_end - mode->crtc_vsync_start;
  319. vbpd = mode->crtc_vtotal - mode->crtc_vsync_end;
  320. vfpd = mode->crtc_vsync_start - mode->crtc_vdisplay;
  321. val = VIDTCON0_VBPD(vbpd - 1) |
  322. VIDTCON0_VFPD(vfpd - 1) |
  323. VIDTCON0_VSPW(vsync_len - 1);
  324. writel(val, ctx->regs + driver_data->timing_base + VIDTCON0);
  325. /* setup horizontal timing values. */
  326. hsync_len = mode->crtc_hsync_end - mode->crtc_hsync_start;
  327. hbpd = mode->crtc_htotal - mode->crtc_hsync_end;
  328. hfpd = mode->crtc_hsync_start - mode->crtc_hdisplay;
  329. val = VIDTCON1_HBPD(hbpd - 1) |
  330. VIDTCON1_HFPD(hfpd - 1) |
  331. VIDTCON1_HSPW(hsync_len - 1);
  332. writel(val, ctx->regs + driver_data->timing_base + VIDTCON1);
  333. }
  334. if (driver_data->has_vidoutcon)
  335. writel(ctx->vidout_con, timing_base + VIDOUT_CON);
  336. /* set bypass selection */
  337. if (ctx->sysreg && regmap_update_bits(ctx->sysreg,
  338. driver_data->lcdblk_offset,
  339. 0x1 << driver_data->lcdblk_bypass_shift,
  340. 0x1 << driver_data->lcdblk_bypass_shift)) {
  341. DRM_ERROR("Failed to update sysreg for bypass setting.\n");
  342. return;
  343. }
  344. /* setup horizontal and vertical display size. */
  345. val = VIDTCON2_LINEVAL(mode->vdisplay - 1) |
  346. VIDTCON2_HOZVAL(mode->hdisplay - 1) |
  347. VIDTCON2_LINEVAL_E(mode->vdisplay - 1) |
  348. VIDTCON2_HOZVAL_E(mode->hdisplay - 1);
  349. writel(val, ctx->regs + driver_data->timing_base + VIDTCON2);
  350. /*
  351. * fields of register with prefix '_F' would be updated
  352. * at vsync(same as dma start)
  353. */
  354. val = ctx->vidcon0;
  355. val |= VIDCON0_ENVID | VIDCON0_ENVID_F;
  356. if (ctx->driver_data->has_clksel)
  357. val |= VIDCON0_CLKSEL_LCD;
  358. clkdiv = fimd_calc_clkdiv(ctx, mode);
  359. if (clkdiv > 1)
  360. val |= VIDCON0_CLKVAL_F(clkdiv - 1) | VIDCON0_CLKDIR;
  361. writel(val, ctx->regs + VIDCON0);
  362. }
  363. static int fimd_enable_vblank(struct exynos_drm_crtc *crtc)
  364. {
  365. struct fimd_context *ctx = crtc->ctx;
  366. u32 val;
  367. if (ctx->suspended)
  368. return -EPERM;
  369. if (!test_and_set_bit(0, &ctx->irq_flags)) {
  370. val = readl(ctx->regs + VIDINTCON0);
  371. val |= VIDINTCON0_INT_ENABLE;
  372. if (ctx->i80_if) {
  373. val |= VIDINTCON0_INT_I80IFDONE;
  374. val |= VIDINTCON0_INT_SYSMAINCON;
  375. val &= ~VIDINTCON0_INT_SYSSUBCON;
  376. } else {
  377. val |= VIDINTCON0_INT_FRAME;
  378. val &= ~VIDINTCON0_FRAMESEL0_MASK;
  379. val |= VIDINTCON0_FRAMESEL0_VSYNC;
  380. val &= ~VIDINTCON0_FRAMESEL1_MASK;
  381. val |= VIDINTCON0_FRAMESEL1_NONE;
  382. }
  383. writel(val, ctx->regs + VIDINTCON0);
  384. }
  385. return 0;
  386. }
  387. static void fimd_disable_vblank(struct exynos_drm_crtc *crtc)
  388. {
  389. struct fimd_context *ctx = crtc->ctx;
  390. u32 val;
  391. if (ctx->suspended)
  392. return;
  393. if (test_and_clear_bit(0, &ctx->irq_flags)) {
  394. val = readl(ctx->regs + VIDINTCON0);
  395. val &= ~VIDINTCON0_INT_ENABLE;
  396. if (ctx->i80_if) {
  397. val &= ~VIDINTCON0_INT_I80IFDONE;
  398. val &= ~VIDINTCON0_INT_SYSMAINCON;
  399. val &= ~VIDINTCON0_INT_SYSSUBCON;
  400. } else
  401. val &= ~VIDINTCON0_INT_FRAME;
  402. writel(val, ctx->regs + VIDINTCON0);
  403. }
  404. }
  405. static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win)
  406. {
  407. struct exynos_drm_plane *plane = &ctx->planes[win];
  408. unsigned long val;
  409. val = WINCONx_ENWIN;
  410. /*
  411. * In case of s3c64xx, window 0 doesn't support alpha channel.
  412. * So the request format is ARGB8888 then change it to XRGB8888.
  413. */
  414. if (ctx->driver_data->has_limited_fmt && !win) {
  415. if (plane->pixel_format == DRM_FORMAT_ARGB8888)
  416. plane->pixel_format = DRM_FORMAT_XRGB8888;
  417. }
  418. switch (plane->pixel_format) {
  419. case DRM_FORMAT_C8:
  420. val |= WINCON0_BPPMODE_8BPP_PALETTE;
  421. val |= WINCONx_BURSTLEN_8WORD;
  422. val |= WINCONx_BYTSWP;
  423. break;
  424. case DRM_FORMAT_XRGB1555:
  425. val |= WINCON0_BPPMODE_16BPP_1555;
  426. val |= WINCONx_HAWSWP;
  427. val |= WINCONx_BURSTLEN_16WORD;
  428. break;
  429. case DRM_FORMAT_RGB565:
  430. val |= WINCON0_BPPMODE_16BPP_565;
  431. val |= WINCONx_HAWSWP;
  432. val |= WINCONx_BURSTLEN_16WORD;
  433. break;
  434. case DRM_FORMAT_XRGB8888:
  435. val |= WINCON0_BPPMODE_24BPP_888;
  436. val |= WINCONx_WSWP;
  437. val |= WINCONx_BURSTLEN_16WORD;
  438. break;
  439. case DRM_FORMAT_ARGB8888:
  440. val |= WINCON1_BPPMODE_25BPP_A1888
  441. | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL;
  442. val |= WINCONx_WSWP;
  443. val |= WINCONx_BURSTLEN_16WORD;
  444. break;
  445. default:
  446. DRM_DEBUG_KMS("invalid pixel size so using unpacked 24bpp.\n");
  447. val |= WINCON0_BPPMODE_24BPP_888;
  448. val |= WINCONx_WSWP;
  449. val |= WINCONx_BURSTLEN_16WORD;
  450. break;
  451. }
  452. DRM_DEBUG_KMS("bpp = %d\n", plane->bpp);
  453. /*
  454. * In case of exynos, setting dma-burst to 16Word causes permanent
  455. * tearing for very small buffers, e.g. cursor buffer. Burst Mode
  456. * switching which is based on plane size is not recommended as
  457. * plane size varies alot towards the end of the screen and rapid
  458. * movement causes unstable DMA which results into iommu crash/tear.
  459. */
  460. if (plane->fb_width < MIN_FB_WIDTH_FOR_16WORD_BURST) {
  461. val &= ~WINCONx_BURSTLEN_MASK;
  462. val |= WINCONx_BURSTLEN_4WORD;
  463. }
  464. writel(val, ctx->regs + WINCON(win));
  465. /* hardware window 0 doesn't support alpha channel. */
  466. if (win != 0) {
  467. /* OSD alpha */
  468. val = VIDISD14C_ALPHA0_R(0xf) |
  469. VIDISD14C_ALPHA0_G(0xf) |
  470. VIDISD14C_ALPHA0_B(0xf) |
  471. VIDISD14C_ALPHA1_R(0xf) |
  472. VIDISD14C_ALPHA1_G(0xf) |
  473. VIDISD14C_ALPHA1_B(0xf);
  474. writel(val, ctx->regs + VIDOSD_C(win));
  475. val = VIDW_ALPHA_R(0xf) | VIDW_ALPHA_G(0xf) |
  476. VIDW_ALPHA_G(0xf);
  477. writel(val, ctx->regs + VIDWnALPHA0(win));
  478. writel(val, ctx->regs + VIDWnALPHA1(win));
  479. }
  480. }
  481. static void fimd_win_set_colkey(struct fimd_context *ctx, unsigned int win)
  482. {
  483. unsigned int keycon0 = 0, keycon1 = 0;
  484. keycon0 = ~(WxKEYCON0_KEYBL_EN | WxKEYCON0_KEYEN_F |
  485. WxKEYCON0_DIRCON) | WxKEYCON0_COMPKEY(0);
  486. keycon1 = WxKEYCON1_COLVAL(0xffffffff);
  487. writel(keycon0, ctx->regs + WKEYCON0_BASE(win));
  488. writel(keycon1, ctx->regs + WKEYCON1_BASE(win));
  489. }
  490. /**
  491. * shadow_protect_win() - disable updating values from shadow registers at vsync
  492. *
  493. * @win: window to protect registers for
  494. * @protect: 1 to protect (disable updates)
  495. */
  496. static void fimd_shadow_protect_win(struct fimd_context *ctx,
  497. unsigned int win, bool protect)
  498. {
  499. u32 reg, bits, val;
  500. if (ctx->driver_data->has_shadowcon) {
  501. reg = SHADOWCON;
  502. bits = SHADOWCON_WINx_PROTECT(win);
  503. } else {
  504. reg = PRTCON;
  505. bits = PRTCON_PROTECT;
  506. }
  507. val = readl(ctx->regs + reg);
  508. if (protect)
  509. val |= bits;
  510. else
  511. val &= ~bits;
  512. writel(val, ctx->regs + reg);
  513. }
  514. static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
  515. {
  516. struct fimd_context *ctx = crtc->ctx;
  517. struct exynos_drm_plane *plane;
  518. dma_addr_t dma_addr;
  519. unsigned long val, size, offset;
  520. unsigned int last_x, last_y, buf_offsize, line_size;
  521. if (ctx->suspended)
  522. return;
  523. if (win < 0 || win >= WINDOWS_NR)
  524. return;
  525. plane = &ctx->planes[win];
  526. /* If suspended, enable this on resume */
  527. if (ctx->suspended) {
  528. plane->resume = true;
  529. return;
  530. }
  531. /*
  532. * SHADOWCON/PRTCON register is used for enabling timing.
  533. *
  534. * for example, once only width value of a register is set,
  535. * if the dma is started then fimd hardware could malfunction so
  536. * with protect window setting, the register fields with prefix '_F'
  537. * wouldn't be updated at vsync also but updated once unprotect window
  538. * is set.
  539. */
  540. /* protect windows */
  541. fimd_shadow_protect_win(ctx, win, true);
  542. offset = plane->src_x * (plane->bpp >> 3);
  543. offset += plane->src_y * plane->pitch;
  544. /* buffer start address */
  545. dma_addr = plane->dma_addr[0] + offset;
  546. val = (unsigned long)dma_addr;
  547. writel(val, ctx->regs + VIDWx_BUF_START(win, 0));
  548. /* buffer end address */
  549. size = plane->pitch * plane->crtc_height;
  550. val = (unsigned long)(dma_addr + size);
  551. writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
  552. DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n",
  553. (unsigned long)dma_addr, val, size);
  554. DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
  555. plane->crtc_width, plane->crtc_height);
  556. /* buffer size */
  557. buf_offsize = plane->pitch - (plane->crtc_width * (plane->bpp >> 3));
  558. line_size = plane->crtc_width * (plane->bpp >> 3);
  559. val = VIDW_BUF_SIZE_OFFSET(buf_offsize) |
  560. VIDW_BUF_SIZE_PAGEWIDTH(line_size) |
  561. VIDW_BUF_SIZE_OFFSET_E(buf_offsize) |
  562. VIDW_BUF_SIZE_PAGEWIDTH_E(line_size);
  563. writel(val, ctx->regs + VIDWx_BUF_SIZE(win, 0));
  564. /* OSD position */
  565. val = VIDOSDxA_TOPLEFT_X(plane->crtc_x) |
  566. VIDOSDxA_TOPLEFT_Y(plane->crtc_y) |
  567. VIDOSDxA_TOPLEFT_X_E(plane->crtc_x) |
  568. VIDOSDxA_TOPLEFT_Y_E(plane->crtc_y);
  569. writel(val, ctx->regs + VIDOSD_A(win));
  570. last_x = plane->crtc_x + plane->crtc_width;
  571. if (last_x)
  572. last_x--;
  573. last_y = plane->crtc_y + plane->crtc_height;
  574. if (last_y)
  575. last_y--;
  576. val = VIDOSDxB_BOTRIGHT_X(last_x) | VIDOSDxB_BOTRIGHT_Y(last_y) |
  577. VIDOSDxB_BOTRIGHT_X_E(last_x) | VIDOSDxB_BOTRIGHT_Y_E(last_y);
  578. writel(val, ctx->regs + VIDOSD_B(win));
  579. DRM_DEBUG_KMS("osd pos: tx = %d, ty = %d, bx = %d, by = %d\n",
  580. plane->crtc_x, plane->crtc_y, last_x, last_y);
  581. /* OSD size */
  582. if (win != 3 && win != 4) {
  583. u32 offset = VIDOSD_D(win);
  584. if (win == 0)
  585. offset = VIDOSD_C(win);
  586. val = plane->crtc_width * plane->crtc_height;
  587. writel(val, ctx->regs + offset);
  588. DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val);
  589. }
  590. fimd_win_set_pixfmt(ctx, win);
  591. /* hardware window 0 doesn't support color key. */
  592. if (win != 0)
  593. fimd_win_set_colkey(ctx, win);
  594. fimd_enable_video_output(ctx, win, true);
  595. if (ctx->driver_data->has_shadowcon)
  596. fimd_enable_shadow_channel_path(ctx, win, true);
  597. /* Enable DMA channel and unprotect windows */
  598. fimd_shadow_protect_win(ctx, win, false);
  599. plane->enabled = true;
  600. if (ctx->i80_if)
  601. atomic_set(&ctx->win_updated, 1);
  602. }
  603. static void fimd_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
  604. {
  605. struct fimd_context *ctx = crtc->ctx;
  606. struct exynos_drm_plane *plane;
  607. if (win < 0 || win >= WINDOWS_NR)
  608. return;
  609. plane = &ctx->planes[win];
  610. if (ctx->suspended) {
  611. /* do not resume this window*/
  612. plane->resume = false;
  613. return;
  614. }
  615. /* protect windows */
  616. fimd_shadow_protect_win(ctx, win, true);
  617. fimd_enable_video_output(ctx, win, false);
  618. if (ctx->driver_data->has_shadowcon)
  619. fimd_enable_shadow_channel_path(ctx, win, false);
  620. /* unprotect windows */
  621. fimd_shadow_protect_win(ctx, win, false);
  622. plane->enabled = false;
  623. }
  624. static void fimd_window_suspend(struct fimd_context *ctx)
  625. {
  626. struct exynos_drm_plane *plane;
  627. int i;
  628. for (i = 0; i < WINDOWS_NR; i++) {
  629. plane = &ctx->planes[i];
  630. plane->resume = plane->enabled;
  631. if (plane->enabled)
  632. fimd_win_disable(ctx->crtc, i);
  633. }
  634. }
  635. static void fimd_window_resume(struct fimd_context *ctx)
  636. {
  637. struct exynos_drm_plane *plane;
  638. int i;
  639. for (i = 0; i < WINDOWS_NR; i++) {
  640. plane = &ctx->planes[i];
  641. plane->enabled = plane->resume;
  642. plane->resume = false;
  643. }
  644. }
  645. static void fimd_apply(struct fimd_context *ctx)
  646. {
  647. struct exynos_drm_plane *plane;
  648. int i;
  649. for (i = 0; i < WINDOWS_NR; i++) {
  650. plane = &ctx->planes[i];
  651. if (plane->enabled)
  652. fimd_win_commit(ctx->crtc, i);
  653. else
  654. fimd_win_disable(ctx->crtc, i);
  655. }
  656. fimd_commit(ctx->crtc);
  657. }
  658. static int fimd_poweron(struct fimd_context *ctx)
  659. {
  660. int ret;
  661. if (!ctx->suspended)
  662. return 0;
  663. ctx->suspended = false;
  664. pm_runtime_get_sync(ctx->dev);
  665. ret = clk_prepare_enable(ctx->bus_clk);
  666. if (ret < 0) {
  667. DRM_ERROR("Failed to prepare_enable the bus clk [%d]\n", ret);
  668. goto bus_clk_err;
  669. }
  670. ret = clk_prepare_enable(ctx->lcd_clk);
  671. if (ret < 0) {
  672. DRM_ERROR("Failed to prepare_enable the lcd clk [%d]\n", ret);
  673. goto lcd_clk_err;
  674. }
  675. /* if vblank was enabled status, enable it again. */
  676. if (test_and_clear_bit(0, &ctx->irq_flags)) {
  677. ret = fimd_enable_vblank(ctx->crtc);
  678. if (ret) {
  679. DRM_ERROR("Failed to re-enable vblank [%d]\n", ret);
  680. goto enable_vblank_err;
  681. }
  682. }
  683. fimd_window_resume(ctx);
  684. fimd_apply(ctx);
  685. return 0;
  686. enable_vblank_err:
  687. clk_disable_unprepare(ctx->lcd_clk);
  688. lcd_clk_err:
  689. clk_disable_unprepare(ctx->bus_clk);
  690. bus_clk_err:
  691. ctx->suspended = true;
  692. return ret;
  693. }
  694. static int fimd_poweroff(struct fimd_context *ctx)
  695. {
  696. if (ctx->suspended)
  697. return 0;
  698. /*
  699. * We need to make sure that all windows are disabled before we
  700. * suspend that connector. Otherwise we might try to scan from
  701. * a destroyed buffer later.
  702. */
  703. fimd_window_suspend(ctx);
  704. clk_disable_unprepare(ctx->lcd_clk);
  705. clk_disable_unprepare(ctx->bus_clk);
  706. pm_runtime_put_sync(ctx->dev);
  707. ctx->suspended = true;
  708. return 0;
  709. }
  710. static void fimd_dpms(struct exynos_drm_crtc *crtc, int mode)
  711. {
  712. DRM_DEBUG_KMS("%s, %d\n", __FILE__, mode);
  713. switch (mode) {
  714. case DRM_MODE_DPMS_ON:
  715. fimd_poweron(crtc->ctx);
  716. break;
  717. case DRM_MODE_DPMS_STANDBY:
  718. case DRM_MODE_DPMS_SUSPEND:
  719. case DRM_MODE_DPMS_OFF:
  720. fimd_poweroff(crtc->ctx);
  721. break;
  722. default:
  723. DRM_DEBUG_KMS("unspecified mode %d\n", mode);
  724. break;
  725. }
  726. }
  727. static void fimd_trigger(struct device *dev)
  728. {
  729. struct fimd_context *ctx = dev_get_drvdata(dev);
  730. struct fimd_driver_data *driver_data = ctx->driver_data;
  731. void *timing_base = ctx->regs + driver_data->timing_base;
  732. u32 reg;
  733. /*
  734. * Skips triggering if in triggering state, because multiple triggering
  735. * requests can cause panel reset.
  736. */
  737. if (atomic_read(&ctx->triggering))
  738. return;
  739. /* Enters triggering mode */
  740. atomic_set(&ctx->triggering, 1);
  741. reg = readl(timing_base + TRIGCON);
  742. reg |= (TRGMODE_I80_RGB_ENABLE_I80 | SWTRGCMD_I80_RGB_ENABLE);
  743. writel(reg, timing_base + TRIGCON);
  744. /*
  745. * Exits triggering mode if vblank is not enabled yet, because when the
  746. * VIDINTCON0 register is not set, it can not exit from triggering mode.
  747. */
  748. if (!test_bit(0, &ctx->irq_flags))
  749. atomic_set(&ctx->triggering, 0);
  750. }
  751. static void fimd_te_handler(struct exynos_drm_crtc *crtc)
  752. {
  753. struct fimd_context *ctx = crtc->ctx;
  754. /* Checks the crtc is detached already from encoder */
  755. if (ctx->pipe < 0 || !ctx->drm_dev)
  756. return;
  757. /*
  758. * If there is a page flip request, triggers and handles the page flip
  759. * event so that current fb can be updated into panel GRAM.
  760. */
  761. if (atomic_add_unless(&ctx->win_updated, -1, 0))
  762. fimd_trigger(ctx->dev);
  763. /* Wakes up vsync event queue */
  764. if (atomic_read(&ctx->wait_vsync_event)) {
  765. atomic_set(&ctx->wait_vsync_event, 0);
  766. wake_up(&ctx->wait_vsync_queue);
  767. }
  768. if (test_bit(0, &ctx->irq_flags))
  769. drm_handle_vblank(ctx->drm_dev, ctx->pipe);
  770. }
  771. static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable)
  772. {
  773. struct fimd_context *ctx = crtc->ctx;
  774. u32 val;
  775. /*
  776. * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE
  777. * clock. On these SoCs the bootloader may enable it but any
  778. * power domain off/on will reset it to disable state.
  779. */
  780. if (ctx->driver_data != &exynos5_fimd_driver_data)
  781. return;
  782. val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
  783. writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON);
  784. }
  785. static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
  786. .dpms = fimd_dpms,
  787. .mode_fixup = fimd_mode_fixup,
  788. .commit = fimd_commit,
  789. .enable_vblank = fimd_enable_vblank,
  790. .disable_vblank = fimd_disable_vblank,
  791. .wait_for_vblank = fimd_wait_for_vblank,
  792. .win_commit = fimd_win_commit,
  793. .win_disable = fimd_win_disable,
  794. .te_handler = fimd_te_handler,
  795. .clock_enable = fimd_dp_clock_enable,
  796. };
  797. static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
  798. {
  799. struct fimd_context *ctx = (struct fimd_context *)dev_id;
  800. u32 val, clear_bit;
  801. val = readl(ctx->regs + VIDINTCON1);
  802. clear_bit = ctx->i80_if ? VIDINTCON1_INT_I80 : VIDINTCON1_INT_FRAME;
  803. if (val & clear_bit)
  804. writel(clear_bit, ctx->regs + VIDINTCON1);
  805. /* check the crtc is detached already from encoder */
  806. if (ctx->pipe < 0 || !ctx->drm_dev)
  807. goto out;
  808. if (ctx->i80_if) {
  809. exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
  810. /* Exits triggering mode */
  811. atomic_set(&ctx->triggering, 0);
  812. } else {
  813. drm_handle_vblank(ctx->drm_dev, ctx->pipe);
  814. exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
  815. /* set wait vsync event to zero and wake up queue. */
  816. if (atomic_read(&ctx->wait_vsync_event)) {
  817. atomic_set(&ctx->wait_vsync_event, 0);
  818. wake_up(&ctx->wait_vsync_queue);
  819. }
  820. }
  821. out:
  822. return IRQ_HANDLED;
  823. }
  824. static int fimd_bind(struct device *dev, struct device *master, void *data)
  825. {
  826. struct fimd_context *ctx = dev_get_drvdata(dev);
  827. struct drm_device *drm_dev = data;
  828. struct exynos_drm_private *priv = drm_dev->dev_private;
  829. struct exynos_drm_plane *exynos_plane;
  830. enum drm_plane_type type;
  831. unsigned int zpos;
  832. int ret;
  833. ctx->drm_dev = drm_dev;
  834. ctx->pipe = priv->pipe++;
  835. for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
  836. type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
  837. DRM_PLANE_TYPE_OVERLAY;
  838. ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
  839. 1 << ctx->pipe, type, zpos);
  840. if (ret)
  841. return ret;
  842. }
  843. exynos_plane = &ctx->planes[ctx->default_win];
  844. ctx->crtc = exynos_drm_crtc_create(drm_dev, &exynos_plane->base,
  845. ctx->pipe, EXYNOS_DISPLAY_TYPE_LCD,
  846. &fimd_crtc_ops, ctx);
  847. if (IS_ERR(ctx->crtc))
  848. return PTR_ERR(ctx->crtc);
  849. if (ctx->display)
  850. exynos_drm_create_enc_conn(drm_dev, ctx->display);
  851. return fimd_iommu_attach_devices(ctx, drm_dev);
  852. }
  853. static void fimd_unbind(struct device *dev, struct device *master,
  854. void *data)
  855. {
  856. struct fimd_context *ctx = dev_get_drvdata(dev);
  857. fimd_dpms(ctx->crtc, DRM_MODE_DPMS_OFF);
  858. fimd_iommu_detach_devices(ctx);
  859. if (ctx->display)
  860. exynos_dpi_remove(ctx->display);
  861. }
  862. static const struct component_ops fimd_component_ops = {
  863. .bind = fimd_bind,
  864. .unbind = fimd_unbind,
  865. };
  866. static int fimd_probe(struct platform_device *pdev)
  867. {
  868. struct device *dev = &pdev->dev;
  869. struct fimd_context *ctx;
  870. struct device_node *i80_if_timings;
  871. struct resource *res;
  872. int ret;
  873. if (!dev->of_node)
  874. return -ENODEV;
  875. ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
  876. if (!ctx)
  877. return -ENOMEM;
  878. ret = exynos_drm_component_add(dev, EXYNOS_DEVICE_TYPE_CRTC,
  879. EXYNOS_DISPLAY_TYPE_LCD);
  880. if (ret)
  881. return ret;
  882. ctx->dev = dev;
  883. ctx->suspended = true;
  884. ctx->driver_data = drm_fimd_get_driver_data(pdev);
  885. if (of_property_read_bool(dev->of_node, "samsung,invert-vden"))
  886. ctx->vidcon1 |= VIDCON1_INV_VDEN;
  887. if (of_property_read_bool(dev->of_node, "samsung,invert-vclk"))
  888. ctx->vidcon1 |= VIDCON1_INV_VCLK;
  889. i80_if_timings = of_get_child_by_name(dev->of_node, "i80-if-timings");
  890. if (i80_if_timings) {
  891. u32 val;
  892. ctx->i80_if = true;
  893. if (ctx->driver_data->has_vidoutcon)
  894. ctx->vidout_con |= VIDOUT_CON_F_I80_LDI0;
  895. else
  896. ctx->vidcon0 |= VIDCON0_VIDOUT_I80_LDI0;
  897. /*
  898. * The user manual describes that this "DSI_EN" bit is required
  899. * to enable I80 24-bit data interface.
  900. */
  901. ctx->vidcon0 |= VIDCON0_DSI_EN;
  902. if (of_property_read_u32(i80_if_timings, "cs-setup", &val))
  903. val = 0;
  904. ctx->i80ifcon = LCD_CS_SETUP(val);
  905. if (of_property_read_u32(i80_if_timings, "wr-setup", &val))
  906. val = 0;
  907. ctx->i80ifcon |= LCD_WR_SETUP(val);
  908. if (of_property_read_u32(i80_if_timings, "wr-active", &val))
  909. val = 1;
  910. ctx->i80ifcon |= LCD_WR_ACTIVE(val);
  911. if (of_property_read_u32(i80_if_timings, "wr-hold", &val))
  912. val = 0;
  913. ctx->i80ifcon |= LCD_WR_HOLD(val);
  914. }
  915. of_node_put(i80_if_timings);
  916. ctx->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node,
  917. "samsung,sysreg");
  918. if (IS_ERR(ctx->sysreg)) {
  919. dev_warn(dev, "failed to get system register.\n");
  920. ctx->sysreg = NULL;
  921. }
  922. ctx->bus_clk = devm_clk_get(dev, "fimd");
  923. if (IS_ERR(ctx->bus_clk)) {
  924. dev_err(dev, "failed to get bus clock\n");
  925. ret = PTR_ERR(ctx->bus_clk);
  926. goto err_del_component;
  927. }
  928. ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
  929. if (IS_ERR(ctx->lcd_clk)) {
  930. dev_err(dev, "failed to get lcd clock\n");
  931. ret = PTR_ERR(ctx->lcd_clk);
  932. goto err_del_component;
  933. }
  934. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  935. ctx->regs = devm_ioremap_resource(dev, res);
  936. if (IS_ERR(ctx->regs)) {
  937. ret = PTR_ERR(ctx->regs);
  938. goto err_del_component;
  939. }
  940. res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
  941. ctx->i80_if ? "lcd_sys" : "vsync");
  942. if (!res) {
  943. dev_err(dev, "irq request failed.\n");
  944. ret = -ENXIO;
  945. goto err_del_component;
  946. }
  947. ret = devm_request_irq(dev, res->start, fimd_irq_handler,
  948. 0, "drm_fimd", ctx);
  949. if (ret) {
  950. dev_err(dev, "irq request failed.\n");
  951. goto err_del_component;
  952. }
  953. init_waitqueue_head(&ctx->wait_vsync_queue);
  954. atomic_set(&ctx->wait_vsync_event, 0);
  955. platform_set_drvdata(pdev, ctx);
  956. ctx->display = exynos_dpi_probe(dev);
  957. if (IS_ERR(ctx->display)) {
  958. ret = PTR_ERR(ctx->display);
  959. goto err_del_component;
  960. }
  961. pm_runtime_enable(dev);
  962. ret = component_add(dev, &fimd_component_ops);
  963. if (ret)
  964. goto err_disable_pm_runtime;
  965. return ret;
  966. err_disable_pm_runtime:
  967. pm_runtime_disable(dev);
  968. err_del_component:
  969. exynos_drm_component_del(dev, EXYNOS_DEVICE_TYPE_CRTC);
  970. return ret;
  971. }
  972. static int fimd_remove(struct platform_device *pdev)
  973. {
  974. pm_runtime_disable(&pdev->dev);
  975. component_del(&pdev->dev, &fimd_component_ops);
  976. exynos_drm_component_del(&pdev->dev, EXYNOS_DEVICE_TYPE_CRTC);
  977. return 0;
  978. }
  979. struct platform_driver fimd_driver = {
  980. .probe = fimd_probe,
  981. .remove = fimd_remove,
  982. .driver = {
  983. .name = "exynos4-fb",
  984. .owner = THIS_MODULE,
  985. .of_match_table = fimd_driver_dt_match,
  986. },
  987. };