Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 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 | */ |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 14 | #include <drm/drmP.h> |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 15 | |
| 16 | #include <linux/kernel.h> |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/clk.h> |
Sachin Kamat | 3f1c781 | 2013-08-14 16:38:01 +0530 | [diff] [blame] | 19 | #include <linux/of.h> |
Joonyoung Shim | d636ead | 2012-12-14 15:48:25 +0900 | [diff] [blame] | 20 | #include <linux/of_device.h> |
Joonyoung Shim | cb91f6a | 2011-12-09 16:52:11 +0900 | [diff] [blame] | 21 | #include <linux/pm_runtime.h> |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 22 | #include <linux/component.h> |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 23 | #include <linux/mfd/syscon.h> |
| 24 | #include <linux/regmap.h> |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 25 | |
Vikas Sajjan | 7f4596f | 2013-03-07 12:15:21 +0530 | [diff] [blame] | 26 | #include <video/of_display_timing.h> |
Andrzej Hajda | 111e605 | 2013-08-21 16:22:01 +0200 | [diff] [blame] | 27 | #include <video/of_videomode.h> |
Leela Krishna Amudala | 5a213a5 | 2012-08-08 09:44:49 +0900 | [diff] [blame] | 28 | #include <video/samsung_fimd.h> |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 29 | #include <drm/exynos_drm.h> |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 30 | |
| 31 | #include "exynos_drm_drv.h" |
| 32 | #include "exynos_drm_fbdev.h" |
| 33 | #include "exynos_drm_crtc.h" |
Inki Dae | bcc5cd1c | 2012-10-19 17:16:36 +0900 | [diff] [blame] | 34 | #include "exynos_drm_iommu.h" |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 35 | |
| 36 | /* |
Sachin Kamat | b8654b3 | 2013-09-19 10:39:44 +0530 | [diff] [blame] | 37 | * FIMD stands for Fully Interactive Mobile Display and |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 38 | * as a display controller, it transfers contents drawn on memory |
| 39 | * to a LCD Panel through Display Interfaces such as RGB or |
| 40 | * CPU Interface. |
| 41 | */ |
| 42 | |
Andrzej Hajda | 111e605 | 2013-08-21 16:22:01 +0200 | [diff] [blame] | 43 | #define FIMD_DEFAULT_FRAMERATE 60 |
Rahul Sharma | 6636746 | 2014-05-07 16:55:22 +0530 | [diff] [blame] | 44 | #define MIN_FB_WIDTH_FOR_16WORD_BURST 128 |
Andrzej Hajda | 111e605 | 2013-08-21 16:22:01 +0200 | [diff] [blame] | 45 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 46 | /* position control register for hardware window 0, 2 ~ 4.*/ |
| 47 | #define VIDOSD_A(win) (VIDOSD_BASE + 0x00 + (win) * 16) |
| 48 | #define VIDOSD_B(win) (VIDOSD_BASE + 0x04 + (win) * 16) |
Leela Krishna Amudala | 0f10cf1 | 2013-03-07 23:28:52 -0500 | [diff] [blame] | 49 | /* |
| 50 | * size control register for hardware windows 0 and alpha control register |
| 51 | * for hardware windows 1 ~ 4 |
| 52 | */ |
| 53 | #define VIDOSD_C(win) (VIDOSD_BASE + 0x08 + (win) * 16) |
| 54 | /* size control register for hardware windows 1 ~ 2. */ |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 55 | #define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16) |
| 56 | |
| 57 | #define VIDWx_BUF_START(win, buf) (VIDW_BUF_START(buf) + (win) * 8) |
| 58 | #define VIDWx_BUF_END(win, buf) (VIDW_BUF_END(buf) + (win) * 8) |
| 59 | #define VIDWx_BUF_SIZE(win, buf) (VIDW_BUF_SIZE(buf) + (win) * 4) |
| 60 | |
| 61 | /* color key control register for hardware window 1 ~ 4. */ |
Leela Krishna Amudala | 0f10cf1 | 2013-03-07 23:28:52 -0500 | [diff] [blame] | 62 | #define WKEYCON0_BASE(x) ((WKEYCON0 + 0x140) + ((x - 1) * 8)) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 63 | /* color key value register for hardware window 1 ~ 4. */ |
Leela Krishna Amudala | 0f10cf1 | 2013-03-07 23:28:52 -0500 | [diff] [blame] | 64 | #define WKEYCON1_BASE(x) ((WKEYCON1 + 0x140) + ((x - 1) * 8)) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 65 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 66 | /* I80 / RGB trigger control register */ |
| 67 | #define TRIGCON 0x1A4 |
| 68 | #define TRGMODE_I80_RGB_ENABLE_I80 (1 << 0) |
| 69 | #define SWTRGCMD_I80_RGB_ENABLE (1 << 1) |
| 70 | |
| 71 | /* display mode change control register except exynos4 */ |
| 72 | #define VIDOUT_CON 0x000 |
| 73 | #define VIDOUT_CON_F_I80_LDI0 (0x2 << 8) |
| 74 | |
| 75 | /* I80 interface control for main LDI register */ |
| 76 | #define I80IFCONFAx(x) (0x1B0 + (x) * 4) |
| 77 | #define I80IFCONFBx(x) (0x1B8 + (x) * 4) |
| 78 | #define LCD_CS_SETUP(x) ((x) << 16) |
| 79 | #define LCD_WR_SETUP(x) ((x) << 12) |
| 80 | #define LCD_WR_ACTIVE(x) ((x) << 8) |
| 81 | #define LCD_WR_HOLD(x) ((x) << 4) |
| 82 | #define I80IFEN_ENABLE (1 << 0) |
| 83 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 84 | /* FIMD has totally five hardware windows. */ |
| 85 | #define WINDOWS_NR 5 |
| 86 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 87 | #define get_fimd_manager(mgr) platform_get_drvdata(to_platform_device(dev)) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 88 | |
Leela Krishna Amudala | e2e1338 | 2012-09-21 16:52:15 +0530 | [diff] [blame] | 89 | struct fimd_driver_data { |
| 90 | unsigned int timing_base; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 91 | unsigned int lcdblk_offset; |
| 92 | unsigned int lcdblk_vt_shift; |
| 93 | unsigned int lcdblk_bypass_shift; |
Tomasz Figa | de7af10 | 2013-05-01 21:02:27 +0200 | [diff] [blame] | 94 | |
| 95 | unsigned int has_shadowcon:1; |
Tomasz Figa | 411d9ed | 2013-05-01 21:02:28 +0200 | [diff] [blame] | 96 | unsigned int has_clksel:1; |
Inki Dae | 5cc4621 | 2013-08-20 14:28:56 +0900 | [diff] [blame] | 97 | unsigned int has_limited_fmt:1; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 98 | unsigned int has_vidoutcon:1; |
Leela Krishna Amudala | e2e1338 | 2012-09-21 16:52:15 +0530 | [diff] [blame] | 99 | }; |
| 100 | |
Tomasz Figa | 725ddea | 2013-05-01 21:02:29 +0200 | [diff] [blame] | 101 | static struct fimd_driver_data s3c64xx_fimd_driver_data = { |
| 102 | .timing_base = 0x0, |
| 103 | .has_clksel = 1, |
Inki Dae | 5cc4621 | 2013-08-20 14:28:56 +0900 | [diff] [blame] | 104 | .has_limited_fmt = 1, |
Tomasz Figa | 725ddea | 2013-05-01 21:02:29 +0200 | [diff] [blame] | 105 | }; |
| 106 | |
Inki Dae | d6ce7b5 | 2014-08-18 16:53:19 +0900 | [diff] [blame] | 107 | static struct fimd_driver_data exynos3_fimd_driver_data = { |
| 108 | .timing_base = 0x20000, |
| 109 | .lcdblk_offset = 0x210, |
| 110 | .lcdblk_bypass_shift = 1, |
| 111 | .has_shadowcon = 1, |
| 112 | .has_vidoutcon = 1, |
| 113 | }; |
| 114 | |
Sachin Kamat | 6ecf18f | 2012-11-19 15:22:54 +0530 | [diff] [blame] | 115 | static struct fimd_driver_data exynos4_fimd_driver_data = { |
Leela Krishna Amudala | e2e1338 | 2012-09-21 16:52:15 +0530 | [diff] [blame] | 116 | .timing_base = 0x0, |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 117 | .lcdblk_offset = 0x210, |
| 118 | .lcdblk_vt_shift = 10, |
| 119 | .lcdblk_bypass_shift = 1, |
Tomasz Figa | de7af10 | 2013-05-01 21:02:27 +0200 | [diff] [blame] | 120 | .has_shadowcon = 1, |
Leela Krishna Amudala | e2e1338 | 2012-09-21 16:52:15 +0530 | [diff] [blame] | 121 | }; |
| 122 | |
YoungJun Cho | dcb622a | 2014-11-07 15:12:25 +0900 | [diff] [blame] | 123 | static struct fimd_driver_data exynos4415_fimd_driver_data = { |
| 124 | .timing_base = 0x20000, |
| 125 | .lcdblk_offset = 0x210, |
| 126 | .lcdblk_vt_shift = 10, |
| 127 | .lcdblk_bypass_shift = 1, |
| 128 | .has_shadowcon = 1, |
| 129 | .has_vidoutcon = 1, |
| 130 | }; |
| 131 | |
Sachin Kamat | 6ecf18f | 2012-11-19 15:22:54 +0530 | [diff] [blame] | 132 | static struct fimd_driver_data exynos5_fimd_driver_data = { |
Leela Krishna Amudala | e2e1338 | 2012-09-21 16:52:15 +0530 | [diff] [blame] | 133 | .timing_base = 0x20000, |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 134 | .lcdblk_offset = 0x214, |
| 135 | .lcdblk_vt_shift = 24, |
| 136 | .lcdblk_bypass_shift = 15, |
Tomasz Figa | de7af10 | 2013-05-01 21:02:27 +0200 | [diff] [blame] | 137 | .has_shadowcon = 1, |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 138 | .has_vidoutcon = 1, |
Leela Krishna Amudala | e2e1338 | 2012-09-21 16:52:15 +0530 | [diff] [blame] | 139 | }; |
| 140 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 141 | struct fimd_win_data { |
| 142 | unsigned int offset_x; |
| 143 | unsigned int offset_y; |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 144 | unsigned int ovl_width; |
| 145 | unsigned int ovl_height; |
| 146 | unsigned int fb_width; |
| 147 | unsigned int fb_height; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 148 | unsigned int bpp; |
Inki Dae | a4f38a8 | 2013-08-20 13:51:02 +0900 | [diff] [blame] | 149 | unsigned int pixel_format; |
Inki Dae | 2c87112 | 2011-11-12 15:23:32 +0900 | [diff] [blame] | 150 | dma_addr_t dma_addr; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 151 | unsigned int buf_offsize; |
| 152 | unsigned int line_size; /* bytes */ |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 153 | bool enabled; |
Prathyush K | db7e55a | 2012-12-06 20:16:06 +0530 | [diff] [blame] | 154 | bool resume; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 155 | }; |
| 156 | |
| 157 | struct fimd_context { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 158 | struct device *dev; |
Sean Paul | 40c8ab4 | 2014-01-30 16:19:04 -0500 | [diff] [blame] | 159 | struct drm_device *drm_dev; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 160 | struct clk *bus_clk; |
| 161 | struct clk *lcd_clk; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 162 | void __iomem *regs; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 163 | struct regmap *sysreg; |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 164 | struct drm_display_mode mode; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 165 | struct fimd_win_data win_data[WINDOWS_NR]; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 166 | unsigned int default_win; |
| 167 | unsigned long irq_flags; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 168 | u32 vidcon0; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 169 | u32 vidcon1; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 170 | u32 vidout_con; |
| 171 | u32 i80ifcon; |
| 172 | bool i80_if; |
Joonyoung Shim | cb91f6a | 2011-12-09 16:52:11 +0900 | [diff] [blame] | 173 | bool suspended; |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 174 | int pipe; |
Prathyush K | 01ce113 | 2012-12-06 20:16:04 +0530 | [diff] [blame] | 175 | wait_queue_head_t wait_vsync_queue; |
| 176 | atomic_t wait_vsync_event; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 177 | atomic_t win_updated; |
| 178 | atomic_t triggering; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 179 | |
Andrzej Hajda | 562ad9f | 2013-08-21 16:22:03 +0200 | [diff] [blame] | 180 | struct exynos_drm_panel_info panel; |
Tomasz Figa | 1887346 | 2013-05-01 21:02:26 +0200 | [diff] [blame] | 181 | struct fimd_driver_data *driver_data; |
Andrzej Hajda | 000cc92 | 2014-04-03 16:26:00 +0200 | [diff] [blame] | 182 | struct exynos_drm_display *display; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 183 | }; |
| 184 | |
Joonyoung Shim | d636ead | 2012-12-14 15:48:25 +0900 | [diff] [blame] | 185 | static const struct of_device_id fimd_driver_dt_match[] = { |
Tomasz Figa | 725ddea | 2013-05-01 21:02:29 +0200 | [diff] [blame] | 186 | { .compatible = "samsung,s3c6400-fimd", |
| 187 | .data = &s3c64xx_fimd_driver_data }, |
Inki Dae | d6ce7b5 | 2014-08-18 16:53:19 +0900 | [diff] [blame] | 188 | { .compatible = "samsung,exynos3250-fimd", |
| 189 | .data = &exynos3_fimd_driver_data }, |
Vikas Sajjan | 5830daf | 2013-02-27 16:02:58 +0530 | [diff] [blame] | 190 | { .compatible = "samsung,exynos4210-fimd", |
Joonyoung Shim | d636ead | 2012-12-14 15:48:25 +0900 | [diff] [blame] | 191 | .data = &exynos4_fimd_driver_data }, |
YoungJun Cho | dcb622a | 2014-11-07 15:12:25 +0900 | [diff] [blame] | 192 | { .compatible = "samsung,exynos4415-fimd", |
| 193 | .data = &exynos4415_fimd_driver_data }, |
Vikas Sajjan | 5830daf | 2013-02-27 16:02:58 +0530 | [diff] [blame] | 194 | { .compatible = "samsung,exynos5250-fimd", |
Joonyoung Shim | d636ead | 2012-12-14 15:48:25 +0900 | [diff] [blame] | 195 | .data = &exynos5_fimd_driver_data }, |
| 196 | {}, |
| 197 | }; |
Sjoerd Simons | 0262cee | 2014-07-30 11:28:31 +0900 | [diff] [blame] | 198 | MODULE_DEVICE_TABLE(of, fimd_driver_dt_match); |
Joonyoung Shim | d636ead | 2012-12-14 15:48:25 +0900 | [diff] [blame] | 199 | |
Leela Krishna Amudala | e2e1338 | 2012-09-21 16:52:15 +0530 | [diff] [blame] | 200 | static inline struct fimd_driver_data *drm_fimd_get_driver_data( |
| 201 | struct platform_device *pdev) |
| 202 | { |
Joonyoung Shim | d636ead | 2012-12-14 15:48:25 +0900 | [diff] [blame] | 203 | const struct of_device_id *of_id = |
| 204 | of_match_device(fimd_driver_dt_match, &pdev->dev); |
| 205 | |
Sachin Kamat | 2d3f173 | 2013-08-28 10:47:58 +0530 | [diff] [blame] | 206 | return (struct fimd_driver_data *)of_id->data; |
Leela Krishna Amudala | e2e1338 | 2012-09-21 16:52:15 +0530 | [diff] [blame] | 207 | } |
| 208 | |
Akshu Agrawal | f13bdbd | 2014-04-28 21:26:39 +0900 | [diff] [blame] | 209 | static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr) |
| 210 | { |
| 211 | struct fimd_context *ctx = mgr->ctx; |
| 212 | |
| 213 | if (ctx->suspended) |
| 214 | return; |
| 215 | |
| 216 | atomic_set(&ctx->wait_vsync_event, 1); |
| 217 | |
| 218 | /* |
| 219 | * wait for FIMD to signal VSYNC interrupt or return after |
| 220 | * timeout which is set to 50ms (refresh rate of 20). |
| 221 | */ |
| 222 | if (!wait_event_timeout(ctx->wait_vsync_queue, |
| 223 | !atomic_read(&ctx->wait_vsync_event), |
| 224 | HZ/20)) |
| 225 | DRM_DEBUG_KMS("vblank wait timed out.\n"); |
| 226 | } |
| 227 | |
Akshu Agrawal | f13bdbd | 2014-04-28 21:26:39 +0900 | [diff] [blame] | 228 | static void fimd_clear_channel(struct exynos_drm_manager *mgr) |
| 229 | { |
| 230 | struct fimd_context *ctx = mgr->ctx; |
| 231 | int win, ch_enabled = 0; |
| 232 | |
| 233 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 234 | |
| 235 | /* Check if any channel is enabled. */ |
| 236 | for (win = 0; win < WINDOWS_NR; win++) { |
Marek Szyprowski | eb8a3bf | 2014-09-01 22:27:10 +0900 | [diff] [blame] | 237 | u32 val = readl(ctx->regs + WINCON(win)); |
| 238 | |
| 239 | if (val & WINCONx_ENWIN) { |
| 240 | /* wincon */ |
| 241 | val &= ~WINCONx_ENWIN; |
| 242 | writel(val, ctx->regs + WINCON(win)); |
| 243 | |
| 244 | /* unprotect windows */ |
| 245 | if (ctx->driver_data->has_shadowcon) { |
| 246 | val = readl(ctx->regs + SHADOWCON); |
| 247 | val &= ~SHADOWCON_CHx_ENABLE(win); |
| 248 | writel(val, ctx->regs + SHADOWCON); |
| 249 | } |
Akshu Agrawal | f13bdbd | 2014-04-28 21:26:39 +0900 | [diff] [blame] | 250 | ch_enabled = 1; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | /* Wait for vsync, as disable channel takes effect at next vsync */ |
Marek Szyprowski | eb8a3bf | 2014-09-01 22:27:10 +0900 | [diff] [blame] | 255 | if (ch_enabled) { |
| 256 | unsigned int state = ctx->suspended; |
| 257 | |
| 258 | ctx->suspended = 0; |
Akshu Agrawal | f13bdbd | 2014-04-28 21:26:39 +0900 | [diff] [blame] | 259 | fimd_wait_for_vblank(mgr); |
Marek Szyprowski | eb8a3bf | 2014-09-01 22:27:10 +0900 | [diff] [blame] | 260 | ctx->suspended = state; |
| 261 | } |
Akshu Agrawal | f13bdbd | 2014-04-28 21:26:39 +0900 | [diff] [blame] | 262 | } |
| 263 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 264 | static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 265 | struct drm_device *drm_dev) |
Sean Paul | 40c8ab4 | 2014-01-30 16:19:04 -0500 | [diff] [blame] | 266 | { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 267 | struct fimd_context *ctx = mgr->ctx; |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 268 | struct exynos_drm_private *priv; |
| 269 | priv = drm_dev->dev_private; |
Sean Paul | 40c8ab4 | 2014-01-30 16:19:04 -0500 | [diff] [blame] | 270 | |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 271 | mgr->drm_dev = ctx->drm_dev = drm_dev; |
| 272 | mgr->pipe = ctx->pipe = priv->pipe++; |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 273 | |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 274 | /* attach this sub driver to iommu mapping if supported. */ |
Akshu Agrawal | f13bdbd | 2014-04-28 21:26:39 +0900 | [diff] [blame] | 275 | if (is_drm_iommu_supported(ctx->drm_dev)) { |
| 276 | /* |
| 277 | * If any channel is already active, iommu will throw |
| 278 | * a PAGE FAULT when enabled. So clear any channel if enabled. |
| 279 | */ |
| 280 | fimd_clear_channel(mgr); |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 281 | drm_iommu_attach_device(ctx->drm_dev, ctx->dev); |
Akshu Agrawal | f13bdbd | 2014-04-28 21:26:39 +0900 | [diff] [blame] | 282 | } |
Sean Paul | 40c8ab4 | 2014-01-30 16:19:04 -0500 | [diff] [blame] | 283 | |
| 284 | return 0; |
| 285 | } |
| 286 | |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 287 | static void fimd_mgr_remove(struct exynos_drm_manager *mgr) |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 288 | { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 289 | struct fimd_context *ctx = mgr->ctx; |
Inki Dae | c32b06e | 2011-12-16 21:49:03 +0900 | [diff] [blame] | 290 | |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 291 | /* detach this sub driver from iommu mapping if supported. */ |
| 292 | if (is_drm_iommu_supported(ctx->drm_dev)) |
| 293 | drm_iommu_detach_device(ctx->drm_dev, ctx->dev); |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 294 | } |
| 295 | |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 296 | static u32 fimd_calc_clkdiv(struct fimd_context *ctx, |
| 297 | const struct drm_display_mode *mode) |
| 298 | { |
| 299 | unsigned long ideal_clk = mode->htotal * mode->vtotal * mode->vrefresh; |
| 300 | u32 clkdiv; |
| 301 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 302 | if (ctx->i80_if) { |
| 303 | /* |
| 304 | * The frame done interrupt should be occurred prior to the |
| 305 | * next TE signal. |
| 306 | */ |
| 307 | ideal_clk *= 2; |
| 308 | } |
| 309 | |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 310 | /* Find the clock divider value that gets us closest to ideal_clk */ |
| 311 | clkdiv = DIV_ROUND_UP(clk_get_rate(ctx->lcd_clk), ideal_clk); |
| 312 | |
| 313 | return (clkdiv < 0x100) ? clkdiv : 0xff; |
| 314 | } |
| 315 | |
| 316 | static bool fimd_mode_fixup(struct exynos_drm_manager *mgr, |
| 317 | const struct drm_display_mode *mode, |
| 318 | struct drm_display_mode *adjusted_mode) |
| 319 | { |
| 320 | if (adjusted_mode->vrefresh == 0) |
| 321 | adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE; |
| 322 | |
| 323 | return true; |
| 324 | } |
| 325 | |
| 326 | static void fimd_mode_set(struct exynos_drm_manager *mgr, |
| 327 | const struct drm_display_mode *in_mode) |
| 328 | { |
| 329 | struct fimd_context *ctx = mgr->ctx; |
| 330 | |
| 331 | drm_mode_copy(&ctx->mode, in_mode); |
| 332 | } |
| 333 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 334 | static void fimd_commit(struct exynos_drm_manager *mgr) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 335 | { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 336 | struct fimd_context *ctx = mgr->ctx; |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 337 | struct drm_display_mode *mode = &ctx->mode; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 338 | struct fimd_driver_data *driver_data = ctx->driver_data; |
| 339 | void *timing_base = ctx->regs + driver_data->timing_base; |
| 340 | u32 val, clkdiv; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 341 | |
Inki Dae | e30d4bc | 2011-12-12 16:35:20 +0900 | [diff] [blame] | 342 | if (ctx->suspended) |
| 343 | return; |
| 344 | |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 345 | /* nothing to do if we haven't set the mode yet */ |
| 346 | if (mode->htotal == 0 || mode->vtotal == 0) |
| 347 | return; |
| 348 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 349 | if (ctx->i80_if) { |
| 350 | val = ctx->i80ifcon | I80IFEN_ENABLE; |
| 351 | writel(val, timing_base + I80IFCONFAx(0)); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 352 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 353 | /* disable auto frame rate */ |
| 354 | writel(0, timing_base + I80IFCONFBx(0)); |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 355 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 356 | /* set video type selection to I80 interface */ |
| 357 | if (ctx->sysreg && regmap_update_bits(ctx->sysreg, |
| 358 | driver_data->lcdblk_offset, |
| 359 | 0x3 << driver_data->lcdblk_vt_shift, |
| 360 | 0x1 << driver_data->lcdblk_vt_shift)) { |
| 361 | DRM_ERROR("Failed to update sysreg for I80 i/f.\n"); |
| 362 | return; |
| 363 | } |
| 364 | } else { |
| 365 | int vsync_len, vbpd, vfpd, hsync_len, hbpd, hfpd; |
| 366 | u32 vidcon1; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 367 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 368 | /* setup polarity values */ |
| 369 | vidcon1 = ctx->vidcon1; |
| 370 | if (mode->flags & DRM_MODE_FLAG_NVSYNC) |
| 371 | vidcon1 |= VIDCON1_INV_VSYNC; |
| 372 | if (mode->flags & DRM_MODE_FLAG_NHSYNC) |
| 373 | vidcon1 |= VIDCON1_INV_HSYNC; |
| 374 | writel(vidcon1, ctx->regs + driver_data->timing_base + VIDCON1); |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 375 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 376 | /* setup vertical timing values. */ |
| 377 | vsync_len = mode->crtc_vsync_end - mode->crtc_vsync_start; |
| 378 | vbpd = mode->crtc_vtotal - mode->crtc_vsync_end; |
| 379 | vfpd = mode->crtc_vsync_start - mode->crtc_vdisplay; |
| 380 | |
| 381 | val = VIDTCON0_VBPD(vbpd - 1) | |
| 382 | VIDTCON0_VFPD(vfpd - 1) | |
| 383 | VIDTCON0_VSPW(vsync_len - 1); |
| 384 | writel(val, ctx->regs + driver_data->timing_base + VIDTCON0); |
| 385 | |
| 386 | /* setup horizontal timing values. */ |
| 387 | hsync_len = mode->crtc_hsync_end - mode->crtc_hsync_start; |
| 388 | hbpd = mode->crtc_htotal - mode->crtc_hsync_end; |
| 389 | hfpd = mode->crtc_hsync_start - mode->crtc_hdisplay; |
| 390 | |
| 391 | val = VIDTCON1_HBPD(hbpd - 1) | |
| 392 | VIDTCON1_HFPD(hfpd - 1) | |
| 393 | VIDTCON1_HSPW(hsync_len - 1); |
| 394 | writel(val, ctx->regs + driver_data->timing_base + VIDTCON1); |
| 395 | } |
| 396 | |
| 397 | if (driver_data->has_vidoutcon) |
| 398 | writel(ctx->vidout_con, timing_base + VIDOUT_CON); |
| 399 | |
| 400 | /* set bypass selection */ |
| 401 | if (ctx->sysreg && regmap_update_bits(ctx->sysreg, |
| 402 | driver_data->lcdblk_offset, |
| 403 | 0x1 << driver_data->lcdblk_bypass_shift, |
| 404 | 0x1 << driver_data->lcdblk_bypass_shift)) { |
| 405 | DRM_ERROR("Failed to update sysreg for bypass setting.\n"); |
| 406 | return; |
| 407 | } |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 408 | |
| 409 | /* setup horizontal and vertical display size. */ |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 410 | val = VIDTCON2_LINEVAL(mode->vdisplay - 1) | |
| 411 | VIDTCON2_HOZVAL(mode->hdisplay - 1) | |
| 412 | VIDTCON2_LINEVAL_E(mode->vdisplay - 1) | |
| 413 | VIDTCON2_HOZVAL_E(mode->hdisplay - 1); |
Leela Krishna Amudala | e2e1338 | 2012-09-21 16:52:15 +0530 | [diff] [blame] | 414 | writel(val, ctx->regs + driver_data->timing_base + VIDTCON2); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 415 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 416 | /* |
| 417 | * fields of register with prefix '_F' would be updated |
| 418 | * at vsync(same as dma start) |
| 419 | */ |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 420 | val = ctx->vidcon0; |
| 421 | val |= VIDCON0_ENVID | VIDCON0_ENVID_F; |
Andrzej Hajda | 1d53106 | 2014-03-20 17:09:00 +0900 | [diff] [blame] | 422 | |
| 423 | if (ctx->driver_data->has_clksel) |
| 424 | val |= VIDCON0_CLKSEL_LCD; |
| 425 | |
| 426 | clkdiv = fimd_calc_clkdiv(ctx, mode); |
| 427 | if (clkdiv > 1) |
| 428 | val |= VIDCON0_CLKVAL_F(clkdiv - 1) | VIDCON0_CLKDIR; |
| 429 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 430 | writel(val, ctx->regs + VIDCON0); |
| 431 | } |
| 432 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 433 | static int fimd_enable_vblank(struct exynos_drm_manager *mgr) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 434 | { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 435 | struct fimd_context *ctx = mgr->ctx; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 436 | u32 val; |
| 437 | |
Joonyoung Shim | cb91f6a | 2011-12-09 16:52:11 +0900 | [diff] [blame] | 438 | if (ctx->suspended) |
| 439 | return -EPERM; |
| 440 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 441 | if (!test_and_set_bit(0, &ctx->irq_flags)) { |
| 442 | val = readl(ctx->regs + VIDINTCON0); |
| 443 | |
| 444 | val |= VIDINTCON0_INT_ENABLE; |
| 445 | val |= VIDINTCON0_INT_FRAME; |
| 446 | |
| 447 | val &= ~VIDINTCON0_FRAMESEL0_MASK; |
| 448 | val |= VIDINTCON0_FRAMESEL0_VSYNC; |
| 449 | val &= ~VIDINTCON0_FRAMESEL1_MASK; |
| 450 | val |= VIDINTCON0_FRAMESEL1_NONE; |
| 451 | |
| 452 | writel(val, ctx->regs + VIDINTCON0); |
| 453 | } |
| 454 | |
| 455 | return 0; |
| 456 | } |
| 457 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 458 | static void fimd_disable_vblank(struct exynos_drm_manager *mgr) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 459 | { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 460 | struct fimd_context *ctx = mgr->ctx; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 461 | u32 val; |
| 462 | |
Joonyoung Shim | cb91f6a | 2011-12-09 16:52:11 +0900 | [diff] [blame] | 463 | if (ctx->suspended) |
| 464 | return; |
| 465 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 466 | if (test_and_clear_bit(0, &ctx->irq_flags)) { |
| 467 | val = readl(ctx->regs + VIDINTCON0); |
| 468 | |
| 469 | val &= ~VIDINTCON0_INT_FRAME; |
| 470 | val &= ~VIDINTCON0_INT_ENABLE; |
| 471 | |
| 472 | writel(val, ctx->regs + VIDINTCON0); |
| 473 | } |
| 474 | } |
| 475 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 476 | static void fimd_win_mode_set(struct exynos_drm_manager *mgr, |
| 477 | struct exynos_drm_overlay *overlay) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 478 | { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 479 | struct fimd_context *ctx = mgr->ctx; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 480 | struct fimd_win_data *win_data; |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 481 | int win; |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 482 | unsigned long offset; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 483 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 484 | if (!overlay) { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 485 | DRM_ERROR("overlay is NULL\n"); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 486 | return; |
| 487 | } |
| 488 | |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 489 | win = overlay->zpos; |
| 490 | if (win == DEFAULT_ZPOS) |
| 491 | win = ctx->default_win; |
| 492 | |
Krzysztof Kozlowski | 37b006e | 2013-05-27 11:56:26 +0200 | [diff] [blame] | 493 | if (win < 0 || win >= WINDOWS_NR) |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 494 | return; |
| 495 | |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 496 | offset = overlay->fb_x * (overlay->bpp >> 3); |
| 497 | offset += overlay->fb_y * overlay->pitch; |
| 498 | |
| 499 | DRM_DEBUG_KMS("offset = 0x%lx, pitch = %x\n", offset, overlay->pitch); |
| 500 | |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 501 | win_data = &ctx->win_data[win]; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 502 | |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 503 | win_data->offset_x = overlay->crtc_x; |
| 504 | win_data->offset_y = overlay->crtc_y; |
| 505 | win_data->ovl_width = overlay->crtc_width; |
| 506 | win_data->ovl_height = overlay->crtc_height; |
| 507 | win_data->fb_width = overlay->fb_width; |
| 508 | win_data->fb_height = overlay->fb_height; |
Seung-Woo Kim | 229d353 | 2011-12-15 14:36:22 +0900 | [diff] [blame] | 509 | win_data->dma_addr = overlay->dma_addr[0] + offset; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 510 | win_data->bpp = overlay->bpp; |
Inki Dae | a4f38a8 | 2013-08-20 13:51:02 +0900 | [diff] [blame] | 511 | win_data->pixel_format = overlay->pixel_format; |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 512 | win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) * |
| 513 | (overlay->bpp >> 3); |
| 514 | win_data->line_size = overlay->crtc_width * (overlay->bpp >> 3); |
| 515 | |
| 516 | DRM_DEBUG_KMS("offset_x = %d, offset_y = %d\n", |
| 517 | win_data->offset_x, win_data->offset_y); |
| 518 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", |
| 519 | win_data->ovl_width, win_data->ovl_height); |
YoungJun Cho | ddd8e95 | 2012-12-10 15:44:58 +0900 | [diff] [blame] | 520 | DRM_DEBUG_KMS("paddr = 0x%lx\n", (unsigned long)win_data->dma_addr); |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 521 | DRM_DEBUG_KMS("fb_width = %d, crtc_width = %d\n", |
| 522 | overlay->fb_width, overlay->crtc_width); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 523 | } |
| 524 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 525 | static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 526 | { |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 527 | struct fimd_win_data *win_data = &ctx->win_data[win]; |
| 528 | unsigned long val; |
| 529 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 530 | val = WINCONx_ENWIN; |
| 531 | |
Inki Dae | 5cc4621 | 2013-08-20 14:28:56 +0900 | [diff] [blame] | 532 | /* |
| 533 | * In case of s3c64xx, window 0 doesn't support alpha channel. |
| 534 | * So the request format is ARGB8888 then change it to XRGB8888. |
| 535 | */ |
| 536 | if (ctx->driver_data->has_limited_fmt && !win) { |
| 537 | if (win_data->pixel_format == DRM_FORMAT_ARGB8888) |
| 538 | win_data->pixel_format = DRM_FORMAT_XRGB8888; |
| 539 | } |
| 540 | |
Inki Dae | a4f38a8 | 2013-08-20 13:51:02 +0900 | [diff] [blame] | 541 | switch (win_data->pixel_format) { |
| 542 | case DRM_FORMAT_C8: |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 543 | val |= WINCON0_BPPMODE_8BPP_PALETTE; |
| 544 | val |= WINCONx_BURSTLEN_8WORD; |
| 545 | val |= WINCONx_BYTSWP; |
| 546 | break; |
Inki Dae | a4f38a8 | 2013-08-20 13:51:02 +0900 | [diff] [blame] | 547 | case DRM_FORMAT_XRGB1555: |
| 548 | val |= WINCON0_BPPMODE_16BPP_1555; |
| 549 | val |= WINCONx_HAWSWP; |
| 550 | val |= WINCONx_BURSTLEN_16WORD; |
| 551 | break; |
| 552 | case DRM_FORMAT_RGB565: |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 553 | val |= WINCON0_BPPMODE_16BPP_565; |
| 554 | val |= WINCONx_HAWSWP; |
| 555 | val |= WINCONx_BURSTLEN_16WORD; |
| 556 | break; |
Inki Dae | a4f38a8 | 2013-08-20 13:51:02 +0900 | [diff] [blame] | 557 | case DRM_FORMAT_XRGB8888: |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 558 | val |= WINCON0_BPPMODE_24BPP_888; |
| 559 | val |= WINCONx_WSWP; |
| 560 | val |= WINCONx_BURSTLEN_16WORD; |
| 561 | break; |
Inki Dae | a4f38a8 | 2013-08-20 13:51:02 +0900 | [diff] [blame] | 562 | case DRM_FORMAT_ARGB8888: |
| 563 | val |= WINCON1_BPPMODE_25BPP_A1888 |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 564 | | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL; |
| 565 | val |= WINCONx_WSWP; |
| 566 | val |= WINCONx_BURSTLEN_16WORD; |
| 567 | break; |
| 568 | default: |
| 569 | DRM_DEBUG_KMS("invalid pixel size so using unpacked 24bpp.\n"); |
| 570 | |
| 571 | val |= WINCON0_BPPMODE_24BPP_888; |
| 572 | val |= WINCONx_WSWP; |
| 573 | val |= WINCONx_BURSTLEN_16WORD; |
| 574 | break; |
| 575 | } |
| 576 | |
| 577 | DRM_DEBUG_KMS("bpp = %d\n", win_data->bpp); |
| 578 | |
Rahul Sharma | 6636746 | 2014-05-07 16:55:22 +0530 | [diff] [blame] | 579 | /* |
| 580 | * In case of exynos, setting dma-burst to 16Word causes permanent |
| 581 | * tearing for very small buffers, e.g. cursor buffer. Burst Mode |
| 582 | * switching which is based on overlay size is not recommended as |
| 583 | * overlay size varies alot towards the end of the screen and rapid |
| 584 | * movement causes unstable DMA which results into iommu crash/tear. |
| 585 | */ |
| 586 | |
| 587 | if (win_data->fb_width < MIN_FB_WIDTH_FOR_16WORD_BURST) { |
| 588 | val &= ~WINCONx_BURSTLEN_MASK; |
| 589 | val |= WINCONx_BURSTLEN_4WORD; |
| 590 | } |
| 591 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 592 | writel(val, ctx->regs + WINCON(win)); |
| 593 | } |
| 594 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 595 | static void fimd_win_set_colkey(struct fimd_context *ctx, unsigned int win) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 596 | { |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 597 | unsigned int keycon0 = 0, keycon1 = 0; |
| 598 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 599 | keycon0 = ~(WxKEYCON0_KEYBL_EN | WxKEYCON0_KEYEN_F | |
| 600 | WxKEYCON0_DIRCON) | WxKEYCON0_COMPKEY(0); |
| 601 | |
| 602 | keycon1 = WxKEYCON1_COLVAL(0xffffffff); |
| 603 | |
| 604 | writel(keycon0, ctx->regs + WKEYCON0_BASE(win)); |
| 605 | writel(keycon1, ctx->regs + WKEYCON1_BASE(win)); |
| 606 | } |
| 607 | |
Tomasz Figa | de7af10 | 2013-05-01 21:02:27 +0200 | [diff] [blame] | 608 | /** |
| 609 | * shadow_protect_win() - disable updating values from shadow registers at vsync |
| 610 | * |
| 611 | * @win: window to protect registers for |
| 612 | * @protect: 1 to protect (disable updates) |
| 613 | */ |
| 614 | static void fimd_shadow_protect_win(struct fimd_context *ctx, |
| 615 | int win, bool protect) |
| 616 | { |
| 617 | u32 reg, bits, val; |
| 618 | |
| 619 | if (ctx->driver_data->has_shadowcon) { |
| 620 | reg = SHADOWCON; |
| 621 | bits = SHADOWCON_WINx_PROTECT(win); |
| 622 | } else { |
| 623 | reg = PRTCON; |
| 624 | bits = PRTCON_PROTECT; |
| 625 | } |
| 626 | |
| 627 | val = readl(ctx->regs + reg); |
| 628 | if (protect) |
| 629 | val |= bits; |
| 630 | else |
| 631 | val &= ~bits; |
| 632 | writel(val, ctx->regs + reg); |
| 633 | } |
| 634 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 635 | static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 636 | { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 637 | struct fimd_context *ctx = mgr->ctx; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 638 | struct fimd_win_data *win_data; |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 639 | int win = zpos; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 640 | unsigned long val, alpha, size; |
Joonyoung Shim | f56aad3 | 2012-12-14 15:48:23 +0900 | [diff] [blame] | 641 | unsigned int last_x; |
| 642 | unsigned int last_y; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 643 | |
Inki Dae | e30d4bc | 2011-12-12 16:35:20 +0900 | [diff] [blame] | 644 | if (ctx->suspended) |
| 645 | return; |
| 646 | |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 647 | if (win == DEFAULT_ZPOS) |
| 648 | win = ctx->default_win; |
| 649 | |
Krzysztof Kozlowski | 37b006e | 2013-05-27 11:56:26 +0200 | [diff] [blame] | 650 | if (win < 0 || win >= WINDOWS_NR) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 651 | return; |
| 652 | |
| 653 | win_data = &ctx->win_data[win]; |
| 654 | |
Sean Paul | a43b933 | 2014-01-30 16:19:26 -0500 | [diff] [blame] | 655 | /* If suspended, enable this on resume */ |
| 656 | if (ctx->suspended) { |
| 657 | win_data->resume = true; |
| 658 | return; |
| 659 | } |
| 660 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 661 | /* |
Tomasz Figa | de7af10 | 2013-05-01 21:02:27 +0200 | [diff] [blame] | 662 | * SHADOWCON/PRTCON register is used for enabling timing. |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 663 | * |
| 664 | * for example, once only width value of a register is set, |
| 665 | * if the dma is started then fimd hardware could malfunction so |
| 666 | * with protect window setting, the register fields with prefix '_F' |
| 667 | * wouldn't be updated at vsync also but updated once unprotect window |
| 668 | * is set. |
| 669 | */ |
| 670 | |
| 671 | /* protect windows */ |
Tomasz Figa | de7af10 | 2013-05-01 21:02:27 +0200 | [diff] [blame] | 672 | fimd_shadow_protect_win(ctx, win, true); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 673 | |
| 674 | /* buffer start address */ |
Inki Dae | 2c87112 | 2011-11-12 15:23:32 +0900 | [diff] [blame] | 675 | val = (unsigned long)win_data->dma_addr; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 676 | writel(val, ctx->regs + VIDWx_BUF_START(win, 0)); |
| 677 | |
| 678 | /* buffer end address */ |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 679 | size = win_data->fb_width * win_data->ovl_height * (win_data->bpp >> 3); |
Inki Dae | 2c87112 | 2011-11-12 15:23:32 +0900 | [diff] [blame] | 680 | val = (unsigned long)(win_data->dma_addr + size); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 681 | writel(val, ctx->regs + VIDWx_BUF_END(win, 0)); |
| 682 | |
| 683 | DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", |
Inki Dae | 2c87112 | 2011-11-12 15:23:32 +0900 | [diff] [blame] | 684 | (unsigned long)win_data->dma_addr, val, size); |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 685 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", |
| 686 | win_data->ovl_width, win_data->ovl_height); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 687 | |
| 688 | /* buffer size */ |
| 689 | val = VIDW_BUF_SIZE_OFFSET(win_data->buf_offsize) | |
Joonyoung Shim | ca555e5 | 2012-12-14 15:48:24 +0900 | [diff] [blame] | 690 | VIDW_BUF_SIZE_PAGEWIDTH(win_data->line_size) | |
| 691 | VIDW_BUF_SIZE_OFFSET_E(win_data->buf_offsize) | |
| 692 | VIDW_BUF_SIZE_PAGEWIDTH_E(win_data->line_size); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 693 | writel(val, ctx->regs + VIDWx_BUF_SIZE(win, 0)); |
| 694 | |
| 695 | /* OSD position */ |
| 696 | val = VIDOSDxA_TOPLEFT_X(win_data->offset_x) | |
Joonyoung Shim | ca555e5 | 2012-12-14 15:48:24 +0900 | [diff] [blame] | 697 | VIDOSDxA_TOPLEFT_Y(win_data->offset_y) | |
| 698 | VIDOSDxA_TOPLEFT_X_E(win_data->offset_x) | |
| 699 | VIDOSDxA_TOPLEFT_Y_E(win_data->offset_y); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 700 | writel(val, ctx->regs + VIDOSD_A(win)); |
| 701 | |
Joonyoung Shim | f56aad3 | 2012-12-14 15:48:23 +0900 | [diff] [blame] | 702 | last_x = win_data->offset_x + win_data->ovl_width; |
| 703 | if (last_x) |
| 704 | last_x--; |
| 705 | last_y = win_data->offset_y + win_data->ovl_height; |
| 706 | if (last_y) |
| 707 | last_y--; |
| 708 | |
Joonyoung Shim | ca555e5 | 2012-12-14 15:48:24 +0900 | [diff] [blame] | 709 | val = VIDOSDxB_BOTRIGHT_X(last_x) | VIDOSDxB_BOTRIGHT_Y(last_y) | |
| 710 | VIDOSDxB_BOTRIGHT_X_E(last_x) | VIDOSDxB_BOTRIGHT_Y_E(last_y); |
| 711 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 712 | writel(val, ctx->regs + VIDOSD_B(win)); |
| 713 | |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 714 | DRM_DEBUG_KMS("osd pos: tx = %d, ty = %d, bx = %d, by = %d\n", |
Joonyoung Shim | f56aad3 | 2012-12-14 15:48:23 +0900 | [diff] [blame] | 715 | win_data->offset_x, win_data->offset_y, last_x, last_y); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 716 | |
| 717 | /* hardware window 0 doesn't support alpha channel. */ |
| 718 | if (win != 0) { |
| 719 | /* OSD alpha */ |
| 720 | alpha = VIDISD14C_ALPHA1_R(0xf) | |
| 721 | VIDISD14C_ALPHA1_G(0xf) | |
| 722 | VIDISD14C_ALPHA1_B(0xf); |
| 723 | |
| 724 | writel(alpha, ctx->regs + VIDOSD_C(win)); |
| 725 | } |
| 726 | |
| 727 | /* OSD size */ |
| 728 | if (win != 3 && win != 4) { |
| 729 | u32 offset = VIDOSD_D(win); |
| 730 | if (win == 0) |
Leela Krishna Amudala | 0f10cf1 | 2013-03-07 23:28:52 -0500 | [diff] [blame] | 731 | offset = VIDOSD_C(win); |
Inki Dae | 19c8b83 | 2011-10-14 13:29:46 +0900 | [diff] [blame] | 732 | val = win_data->ovl_width * win_data->ovl_height; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 733 | writel(val, ctx->regs + offset); |
| 734 | |
| 735 | DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); |
| 736 | } |
| 737 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 738 | fimd_win_set_pixfmt(ctx, win); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 739 | |
| 740 | /* hardware window 0 doesn't support color key. */ |
| 741 | if (win != 0) |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 742 | fimd_win_set_colkey(ctx, win); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 743 | |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 744 | /* wincon */ |
| 745 | val = readl(ctx->regs + WINCON(win)); |
| 746 | val |= WINCONx_ENWIN; |
| 747 | writel(val, ctx->regs + WINCON(win)); |
| 748 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 749 | /* Enable DMA channel and unprotect windows */ |
Tomasz Figa | de7af10 | 2013-05-01 21:02:27 +0200 | [diff] [blame] | 750 | fimd_shadow_protect_win(ctx, win, false); |
| 751 | |
| 752 | if (ctx->driver_data->has_shadowcon) { |
| 753 | val = readl(ctx->regs + SHADOWCON); |
| 754 | val |= SHADOWCON_CHx_ENABLE(win); |
| 755 | writel(val, ctx->regs + SHADOWCON); |
| 756 | } |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 757 | |
| 758 | win_data->enabled = true; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 759 | |
| 760 | if (ctx->i80_if) |
| 761 | atomic_set(&ctx->win_updated, 1); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 762 | } |
| 763 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 764 | static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 765 | { |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 766 | struct fimd_context *ctx = mgr->ctx; |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 767 | struct fimd_win_data *win_data; |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 768 | int win = zpos; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 769 | u32 val; |
| 770 | |
Joonyoung Shim | 864ee9e | 2011-12-08 17:54:07 +0900 | [diff] [blame] | 771 | if (win == DEFAULT_ZPOS) |
| 772 | win = ctx->default_win; |
| 773 | |
Krzysztof Kozlowski | 37b006e | 2013-05-27 11:56:26 +0200 | [diff] [blame] | 774 | if (win < 0 || win >= WINDOWS_NR) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 775 | return; |
| 776 | |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 777 | win_data = &ctx->win_data[win]; |
| 778 | |
Prathyush K | db7e55a | 2012-12-06 20:16:06 +0530 | [diff] [blame] | 779 | if (ctx->suspended) { |
| 780 | /* do not resume this window*/ |
| 781 | win_data->resume = false; |
| 782 | return; |
| 783 | } |
| 784 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 785 | /* protect windows */ |
Tomasz Figa | de7af10 | 2013-05-01 21:02:27 +0200 | [diff] [blame] | 786 | fimd_shadow_protect_win(ctx, win, true); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 787 | |
| 788 | /* wincon */ |
| 789 | val = readl(ctx->regs + WINCON(win)); |
| 790 | val &= ~WINCONx_ENWIN; |
| 791 | writel(val, ctx->regs + WINCON(win)); |
| 792 | |
| 793 | /* unprotect windows */ |
Tomasz Figa | de7af10 | 2013-05-01 21:02:27 +0200 | [diff] [blame] | 794 | if (ctx->driver_data->has_shadowcon) { |
| 795 | val = readl(ctx->regs + SHADOWCON); |
| 796 | val &= ~SHADOWCON_CHx_ENABLE(win); |
| 797 | writel(val, ctx->regs + SHADOWCON); |
| 798 | } |
| 799 | |
| 800 | fimd_shadow_protect_win(ctx, win, false); |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 801 | |
| 802 | win_data->enabled = false; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 803 | } |
| 804 | |
Sean Paul | a43b933 | 2014-01-30 16:19:26 -0500 | [diff] [blame] | 805 | static void fimd_window_suspend(struct exynos_drm_manager *mgr) |
| 806 | { |
| 807 | struct fimd_context *ctx = mgr->ctx; |
| 808 | struct fimd_win_data *win_data; |
| 809 | int i; |
| 810 | |
| 811 | for (i = 0; i < WINDOWS_NR; i++) { |
| 812 | win_data = &ctx->win_data[i]; |
| 813 | win_data->resume = win_data->enabled; |
| 814 | if (win_data->enabled) |
| 815 | fimd_win_disable(mgr, i); |
| 816 | } |
Sean Paul | a43b933 | 2014-01-30 16:19:26 -0500 | [diff] [blame] | 817 | } |
| 818 | |
| 819 | static void fimd_window_resume(struct exynos_drm_manager *mgr) |
| 820 | { |
| 821 | struct fimd_context *ctx = mgr->ctx; |
| 822 | struct fimd_win_data *win_data; |
| 823 | int i; |
| 824 | |
| 825 | for (i = 0; i < WINDOWS_NR; i++) { |
| 826 | win_data = &ctx->win_data[i]; |
| 827 | win_data->enabled = win_data->resume; |
| 828 | win_data->resume = false; |
| 829 | } |
| 830 | } |
| 831 | |
| 832 | static void fimd_apply(struct exynos_drm_manager *mgr) |
| 833 | { |
| 834 | struct fimd_context *ctx = mgr->ctx; |
| 835 | struct fimd_win_data *win_data; |
| 836 | int i; |
| 837 | |
| 838 | for (i = 0; i < WINDOWS_NR; i++) { |
| 839 | win_data = &ctx->win_data[i]; |
| 840 | if (win_data->enabled) |
| 841 | fimd_win_commit(mgr, i); |
Andrzej Hajda | d9b68d8 | 2014-06-09 16:10:59 +0200 | [diff] [blame] | 842 | else |
| 843 | fimd_win_disable(mgr, i); |
Sean Paul | a43b933 | 2014-01-30 16:19:26 -0500 | [diff] [blame] | 844 | } |
| 845 | |
| 846 | fimd_commit(mgr); |
| 847 | } |
| 848 | |
| 849 | static int fimd_poweron(struct exynos_drm_manager *mgr) |
| 850 | { |
| 851 | struct fimd_context *ctx = mgr->ctx; |
| 852 | int ret; |
| 853 | |
| 854 | if (!ctx->suspended) |
| 855 | return 0; |
| 856 | |
| 857 | ctx->suspended = false; |
| 858 | |
Sean Paul | af65c80 | 2014-01-30 16:19:27 -0500 | [diff] [blame] | 859 | pm_runtime_get_sync(ctx->dev); |
| 860 | |
Sean Paul | a43b933 | 2014-01-30 16:19:26 -0500 | [diff] [blame] | 861 | ret = clk_prepare_enable(ctx->bus_clk); |
| 862 | if (ret < 0) { |
| 863 | DRM_ERROR("Failed to prepare_enable the bus clk [%d]\n", ret); |
| 864 | goto bus_clk_err; |
| 865 | } |
| 866 | |
| 867 | ret = clk_prepare_enable(ctx->lcd_clk); |
| 868 | if (ret < 0) { |
| 869 | DRM_ERROR("Failed to prepare_enable the lcd clk [%d]\n", ret); |
| 870 | goto lcd_clk_err; |
| 871 | } |
| 872 | |
| 873 | /* if vblank was enabled status, enable it again. */ |
| 874 | if (test_and_clear_bit(0, &ctx->irq_flags)) { |
| 875 | ret = fimd_enable_vblank(mgr); |
| 876 | if (ret) { |
| 877 | DRM_ERROR("Failed to re-enable vblank [%d]\n", ret); |
| 878 | goto enable_vblank_err; |
| 879 | } |
| 880 | } |
| 881 | |
| 882 | fimd_window_resume(mgr); |
| 883 | |
| 884 | fimd_apply(mgr); |
| 885 | |
| 886 | return 0; |
| 887 | |
| 888 | enable_vblank_err: |
| 889 | clk_disable_unprepare(ctx->lcd_clk); |
| 890 | lcd_clk_err: |
| 891 | clk_disable_unprepare(ctx->bus_clk); |
| 892 | bus_clk_err: |
| 893 | ctx->suspended = true; |
| 894 | return ret; |
| 895 | } |
| 896 | |
| 897 | static int fimd_poweroff(struct exynos_drm_manager *mgr) |
| 898 | { |
| 899 | struct fimd_context *ctx = mgr->ctx; |
| 900 | |
| 901 | if (ctx->suspended) |
| 902 | return 0; |
| 903 | |
| 904 | /* |
| 905 | * We need to make sure that all windows are disabled before we |
| 906 | * suspend that connector. Otherwise we might try to scan from |
| 907 | * a destroyed buffer later. |
| 908 | */ |
| 909 | fimd_window_suspend(mgr); |
| 910 | |
| 911 | clk_disable_unprepare(ctx->lcd_clk); |
| 912 | clk_disable_unprepare(ctx->bus_clk); |
| 913 | |
Sean Paul | af65c80 | 2014-01-30 16:19:27 -0500 | [diff] [blame] | 914 | pm_runtime_put_sync(ctx->dev); |
| 915 | |
Sean Paul | a43b933 | 2014-01-30 16:19:26 -0500 | [diff] [blame] | 916 | ctx->suspended = true; |
| 917 | return 0; |
| 918 | } |
| 919 | |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 920 | static void fimd_dpms(struct exynos_drm_manager *mgr, int mode) |
| 921 | { |
Sean Paul | af65c80 | 2014-01-30 16:19:27 -0500 | [diff] [blame] | 922 | DRM_DEBUG_KMS("%s, %d\n", __FILE__, mode); |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 923 | |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 924 | switch (mode) { |
| 925 | case DRM_MODE_DPMS_ON: |
Sean Paul | af65c80 | 2014-01-30 16:19:27 -0500 | [diff] [blame] | 926 | fimd_poweron(mgr); |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 927 | break; |
| 928 | case DRM_MODE_DPMS_STANDBY: |
| 929 | case DRM_MODE_DPMS_SUSPEND: |
| 930 | case DRM_MODE_DPMS_OFF: |
Sean Paul | af65c80 | 2014-01-30 16:19:27 -0500 | [diff] [blame] | 931 | fimd_poweroff(mgr); |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 932 | break; |
| 933 | default: |
| 934 | DRM_DEBUG_KMS("unspecified mode %d\n", mode); |
| 935 | break; |
| 936 | } |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 937 | } |
| 938 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 939 | static void fimd_trigger(struct device *dev) |
| 940 | { |
| 941 | struct exynos_drm_manager *mgr = get_fimd_manager(dev); |
| 942 | struct fimd_context *ctx = mgr->ctx; |
| 943 | struct fimd_driver_data *driver_data = ctx->driver_data; |
| 944 | void *timing_base = ctx->regs + driver_data->timing_base; |
| 945 | u32 reg; |
| 946 | |
| 947 | atomic_set(&ctx->triggering, 1); |
| 948 | |
| 949 | reg = readl(ctx->regs + VIDINTCON0); |
| 950 | reg |= (VIDINTCON0_INT_ENABLE | VIDINTCON0_INT_I80IFDONE | |
| 951 | VIDINTCON0_INT_SYSMAINCON); |
| 952 | writel(reg, ctx->regs + VIDINTCON0); |
| 953 | |
| 954 | reg = readl(timing_base + TRIGCON); |
| 955 | reg |= (TRGMODE_I80_RGB_ENABLE_I80 | SWTRGCMD_I80_RGB_ENABLE); |
| 956 | writel(reg, timing_base + TRIGCON); |
| 957 | } |
| 958 | |
| 959 | static void fimd_te_handler(struct exynos_drm_manager *mgr) |
| 960 | { |
| 961 | struct fimd_context *ctx = mgr->ctx; |
| 962 | |
| 963 | /* Checks the crtc is detached already from encoder */ |
| 964 | if (ctx->pipe < 0 || !ctx->drm_dev) |
| 965 | return; |
| 966 | |
| 967 | /* |
| 968 | * Skips to trigger if in triggering state, because multiple triggering |
| 969 | * requests can cause panel reset. |
| 970 | */ |
| 971 | if (atomic_read(&ctx->triggering)) |
| 972 | return; |
| 973 | |
| 974 | /* |
| 975 | * If there is a page flip request, triggers and handles the page flip |
| 976 | * event so that current fb can be updated into panel GRAM. |
| 977 | */ |
| 978 | if (atomic_add_unless(&ctx->win_updated, -1, 0)) |
| 979 | fimd_trigger(ctx->dev); |
| 980 | |
| 981 | /* Wakes up vsync event queue */ |
| 982 | if (atomic_read(&ctx->wait_vsync_event)) { |
| 983 | atomic_set(&ctx->wait_vsync_event, 0); |
| 984 | wake_up(&ctx->wait_vsync_queue); |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 985 | } |
YoungJun Cho | b301ae2 | 2014-10-01 15:19:10 +0900 | [diff] [blame^] | 986 | |
| 987 | if (!atomic_read(&ctx->triggering)) |
| 988 | drm_handle_vblank(ctx->drm_dev, ctx->pipe); |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 989 | } |
| 990 | |
Sean Paul | 1c6244c | 2014-01-30 16:19:02 -0500 | [diff] [blame] | 991 | static struct exynos_drm_manager_ops fimd_manager_ops = { |
| 992 | .dpms = fimd_dpms, |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 993 | .mode_fixup = fimd_mode_fixup, |
| 994 | .mode_set = fimd_mode_set, |
Sean Paul | 1c6244c | 2014-01-30 16:19:02 -0500 | [diff] [blame] | 995 | .commit = fimd_commit, |
| 996 | .enable_vblank = fimd_enable_vblank, |
| 997 | .disable_vblank = fimd_disable_vblank, |
| 998 | .wait_for_vblank = fimd_wait_for_vblank, |
| 999 | .win_mode_set = fimd_win_mode_set, |
| 1000 | .win_commit = fimd_win_commit, |
| 1001 | .win_disable = fimd_win_disable, |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1002 | .te_handler = fimd_te_handler, |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1003 | }; |
| 1004 | |
Joonyoung Shim | 677e84c | 2012-04-05 20:49:27 +0900 | [diff] [blame] | 1005 | static struct exynos_drm_manager fimd_manager = { |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 1006 | .type = EXYNOS_DISPLAY_TYPE_LCD, |
| 1007 | .ops = &fimd_manager_ops, |
Joonyoung Shim | 677e84c | 2012-04-05 20:49:27 +0900 | [diff] [blame] | 1008 | }; |
| 1009 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1010 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) |
| 1011 | { |
| 1012 | struct fimd_context *ctx = (struct fimd_context *)dev_id; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1013 | u32 val, clear_bit; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1014 | |
| 1015 | val = readl(ctx->regs + VIDINTCON1); |
| 1016 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1017 | clear_bit = ctx->i80_if ? VIDINTCON1_INT_I80 : VIDINTCON1_INT_FRAME; |
| 1018 | if (val & clear_bit) |
| 1019 | writel(clear_bit, ctx->regs + VIDINTCON1); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1020 | |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 1021 | /* check the crtc is detached already from encoder */ |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 1022 | if (ctx->pipe < 0 || !ctx->drm_dev) |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 1023 | goto out; |
Inki Dae | 483b88f | 2011-11-11 21:28:00 +0900 | [diff] [blame] | 1024 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1025 | if (ctx->i80_if) { |
| 1026 | /* unset I80 frame done interrupt */ |
| 1027 | val = readl(ctx->regs + VIDINTCON0); |
| 1028 | val &= ~(VIDINTCON0_INT_I80IFDONE | VIDINTCON0_INT_SYSMAINCON); |
| 1029 | writel(val, ctx->regs + VIDINTCON0); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1030 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1031 | /* exit triggering mode */ |
| 1032 | atomic_set(&ctx->triggering, 0); |
| 1033 | |
| 1034 | drm_handle_vblank(ctx->drm_dev, ctx->pipe); |
| 1035 | exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe); |
| 1036 | } else { |
| 1037 | drm_handle_vblank(ctx->drm_dev, ctx->pipe); |
| 1038 | exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe); |
| 1039 | |
| 1040 | /* set wait vsync event to zero and wake up queue. */ |
| 1041 | if (atomic_read(&ctx->wait_vsync_event)) { |
| 1042 | atomic_set(&ctx->wait_vsync_event, 0); |
| 1043 | wake_up(&ctx->wait_vsync_queue); |
| 1044 | } |
Prathyush K | 01ce113 | 2012-12-06 20:16:04 +0530 | [diff] [blame] | 1045 | } |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1046 | |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 1047 | out: |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1048 | return IRQ_HANDLED; |
| 1049 | } |
| 1050 | |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 1051 | static int fimd_bind(struct device *dev, struct device *master, void *data) |
Andrzej Hajda | 562ad9f | 2013-08-21 16:22:03 +0200 | [diff] [blame] | 1052 | { |
Andrzej Hajda | 000cc92 | 2014-04-03 16:26:00 +0200 | [diff] [blame] | 1053 | struct fimd_context *ctx = fimd_manager.ctx; |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 1054 | struct drm_device *drm_dev = data; |
Andrzej Hajda | 000cc92 | 2014-04-03 16:26:00 +0200 | [diff] [blame] | 1055 | |
| 1056 | fimd_mgr_initialize(&fimd_manager, drm_dev); |
| 1057 | exynos_drm_crtc_create(&fimd_manager); |
| 1058 | if (ctx->display) |
| 1059 | exynos_drm_create_enc_conn(drm_dev, ctx->display); |
| 1060 | |
Andrzej Hajda | 000cc92 | 2014-04-03 16:26:00 +0200 | [diff] [blame] | 1061 | return 0; |
| 1062 | |
| 1063 | } |
| 1064 | |
| 1065 | static void fimd_unbind(struct device *dev, struct device *master, |
| 1066 | void *data) |
| 1067 | { |
| 1068 | struct exynos_drm_manager *mgr = dev_get_drvdata(dev); |
| 1069 | struct fimd_context *ctx = fimd_manager.ctx; |
Andrzej Hajda | 000cc92 | 2014-04-03 16:26:00 +0200 | [diff] [blame] | 1070 | |
| 1071 | fimd_dpms(mgr, DRM_MODE_DPMS_OFF); |
| 1072 | |
| 1073 | if (ctx->display) |
| 1074 | exynos_dpi_remove(dev); |
| 1075 | |
| 1076 | fimd_mgr_remove(mgr); |
Andrzej Hajda | 000cc92 | 2014-04-03 16:26:00 +0200 | [diff] [blame] | 1077 | } |
| 1078 | |
| 1079 | static const struct component_ops fimd_component_ops = { |
| 1080 | .bind = fimd_bind, |
| 1081 | .unbind = fimd_unbind, |
| 1082 | }; |
| 1083 | |
| 1084 | static int fimd_probe(struct platform_device *pdev) |
| 1085 | { |
| 1086 | struct device *dev = &pdev->dev; |
| 1087 | struct fimd_context *ctx; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1088 | struct device_node *i80_if_timings; |
Andrzej Hajda | 000cc92 | 2014-04-03 16:26:00 +0200 | [diff] [blame] | 1089 | struct resource *res; |
Andrzej Hajda | 562ad9f | 2013-08-21 16:22:03 +0200 | [diff] [blame] | 1090 | int ret = -EINVAL; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1091 | |
Inki Dae | df5225b | 2014-05-29 18:28:02 +0900 | [diff] [blame] | 1092 | ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CRTC, |
| 1093 | fimd_manager.type); |
| 1094 | if (ret) |
| 1095 | return ret; |
| 1096 | |
| 1097 | if (!dev->of_node) { |
| 1098 | ret = -ENODEV; |
| 1099 | goto err_del_component; |
| 1100 | } |
Sachin Kamat | 2d3f173 | 2013-08-28 10:47:58 +0530 | [diff] [blame] | 1101 | |
Seung-Woo Kim | d873ab9 | 2013-05-22 21:14:14 +0900 | [diff] [blame] | 1102 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
Inki Dae | df5225b | 2014-05-29 18:28:02 +0900 | [diff] [blame] | 1103 | if (!ctx) { |
| 1104 | ret = -ENOMEM; |
| 1105 | goto err_del_component; |
| 1106 | } |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1107 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 1108 | ctx->dev = dev; |
Sean Paul | a43b933 | 2014-01-30 16:19:26 -0500 | [diff] [blame] | 1109 | ctx->suspended = true; |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1110 | ctx->driver_data = drm_fimd_get_driver_data(pdev); |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 1111 | |
Sean Paul | 1417f10 | 2014-01-30 16:19:23 -0500 | [diff] [blame] | 1112 | if (of_property_read_bool(dev->of_node, "samsung,invert-vden")) |
| 1113 | ctx->vidcon1 |= VIDCON1_INV_VDEN; |
| 1114 | if (of_property_read_bool(dev->of_node, "samsung,invert-vclk")) |
| 1115 | ctx->vidcon1 |= VIDCON1_INV_VCLK; |
Andrzej Hajda | 562ad9f | 2013-08-21 16:22:03 +0200 | [diff] [blame] | 1116 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1117 | i80_if_timings = of_get_child_by_name(dev->of_node, "i80-if-timings"); |
| 1118 | if (i80_if_timings) { |
| 1119 | u32 val; |
| 1120 | |
| 1121 | ctx->i80_if = true; |
| 1122 | |
| 1123 | if (ctx->driver_data->has_vidoutcon) |
| 1124 | ctx->vidout_con |= VIDOUT_CON_F_I80_LDI0; |
| 1125 | else |
| 1126 | ctx->vidcon0 |= VIDCON0_VIDOUT_I80_LDI0; |
| 1127 | /* |
| 1128 | * The user manual describes that this "DSI_EN" bit is required |
| 1129 | * to enable I80 24-bit data interface. |
| 1130 | */ |
| 1131 | ctx->vidcon0 |= VIDCON0_DSI_EN; |
| 1132 | |
| 1133 | if (of_property_read_u32(i80_if_timings, "cs-setup", &val)) |
| 1134 | val = 0; |
| 1135 | ctx->i80ifcon = LCD_CS_SETUP(val); |
| 1136 | if (of_property_read_u32(i80_if_timings, "wr-setup", &val)) |
| 1137 | val = 0; |
| 1138 | ctx->i80ifcon |= LCD_WR_SETUP(val); |
| 1139 | if (of_property_read_u32(i80_if_timings, "wr-active", &val)) |
| 1140 | val = 1; |
| 1141 | ctx->i80ifcon |= LCD_WR_ACTIVE(val); |
| 1142 | if (of_property_read_u32(i80_if_timings, "wr-hold", &val)) |
| 1143 | val = 0; |
| 1144 | ctx->i80ifcon |= LCD_WR_HOLD(val); |
| 1145 | } |
| 1146 | of_node_put(i80_if_timings); |
| 1147 | |
| 1148 | ctx->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, |
| 1149 | "samsung,sysreg"); |
| 1150 | if (IS_ERR(ctx->sysreg)) { |
| 1151 | dev_warn(dev, "failed to get system register.\n"); |
| 1152 | ctx->sysreg = NULL; |
| 1153 | } |
| 1154 | |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 1155 | ctx->bus_clk = devm_clk_get(dev, "fimd"); |
| 1156 | if (IS_ERR(ctx->bus_clk)) { |
| 1157 | dev_err(dev, "failed to get bus clock\n"); |
Inki Dae | df5225b | 2014-05-29 18:28:02 +0900 | [diff] [blame] | 1158 | ret = PTR_ERR(ctx->bus_clk); |
| 1159 | goto err_del_component; |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 1160 | } |
| 1161 | |
| 1162 | ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd"); |
| 1163 | if (IS_ERR(ctx->lcd_clk)) { |
| 1164 | dev_err(dev, "failed to get lcd clock\n"); |
Inki Dae | df5225b | 2014-05-29 18:28:02 +0900 | [diff] [blame] | 1165 | ret = PTR_ERR(ctx->lcd_clk); |
| 1166 | goto err_del_component; |
Sean Paul | a968e72 | 2014-01-30 16:19:20 -0500 | [diff] [blame] | 1167 | } |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1168 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1169 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1170 | |
Seung-Woo Kim | d873ab9 | 2013-05-22 21:14:14 +0900 | [diff] [blame] | 1171 | ctx->regs = devm_ioremap_resource(dev, res); |
Inki Dae | df5225b | 2014-05-29 18:28:02 +0900 | [diff] [blame] | 1172 | if (IS_ERR(ctx->regs)) { |
| 1173 | ret = PTR_ERR(ctx->regs); |
| 1174 | goto err_del_component; |
| 1175 | } |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1176 | |
YoungJun Cho | 3854fab | 2014-07-17 18:01:21 +0900 | [diff] [blame] | 1177 | res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, |
| 1178 | ctx->i80_if ? "lcd_sys" : "vsync"); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1179 | if (!res) { |
| 1180 | dev_err(dev, "irq request failed.\n"); |
Inki Dae | df5225b | 2014-05-29 18:28:02 +0900 | [diff] [blame] | 1181 | ret = -ENXIO; |
| 1182 | goto err_del_component; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1183 | } |
| 1184 | |
Sean Paul | 055e0c0 | 2014-01-30 16:19:21 -0500 | [diff] [blame] | 1185 | ret = devm_request_irq(dev, res->start, fimd_irq_handler, |
Sachin Kamat | edc5726 | 2012-06-19 11:47:39 +0530 | [diff] [blame] | 1186 | 0, "drm_fimd", ctx); |
| 1187 | if (ret) { |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1188 | dev_err(dev, "irq request failed.\n"); |
Inki Dae | df5225b | 2014-05-29 18:28:02 +0900 | [diff] [blame] | 1189 | goto err_del_component; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1190 | } |
| 1191 | |
Daniel Vetter | 57ed0f7 | 2013-12-11 11:34:43 +0100 | [diff] [blame] | 1192 | init_waitqueue_head(&ctx->wait_vsync_queue); |
Prathyush K | 01ce113 | 2012-12-06 20:16:04 +0530 | [diff] [blame] | 1193 | atomic_set(&ctx->wait_vsync_event, 0); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1194 | |
Sean Paul | bb7704d | 2014-01-30 16:19:06 -0500 | [diff] [blame] | 1195 | platform_set_drvdata(pdev, &fimd_manager); |
Inki Dae | c32b06e | 2011-12-16 21:49:03 +0900 | [diff] [blame] | 1196 | |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 1197 | fimd_manager.ctx = ctx; |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 1198 | |
Andrzej Hajda | 000cc92 | 2014-04-03 16:26:00 +0200 | [diff] [blame] | 1199 | ctx->display = exynos_dpi_probe(dev); |
| 1200 | if (IS_ERR(ctx->display)) |
| 1201 | return PTR_ERR(ctx->display); |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 1202 | |
| 1203 | pm_runtime_enable(&pdev->dev); |
| 1204 | |
Inki Dae | df5225b | 2014-05-29 18:28:02 +0900 | [diff] [blame] | 1205 | ret = component_add(&pdev->dev, &fimd_component_ops); |
| 1206 | if (ret) |
| 1207 | goto err_disable_pm_runtime; |
| 1208 | |
| 1209 | return ret; |
| 1210 | |
| 1211 | err_disable_pm_runtime: |
| 1212 | pm_runtime_disable(&pdev->dev); |
| 1213 | |
| 1214 | err_del_component: |
| 1215 | exynos_drm_component_del(&pdev->dev, EXYNOS_DEVICE_TYPE_CRTC); |
| 1216 | return ret; |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 1217 | } |
| 1218 | |
| 1219 | static int fimd_remove(struct platform_device *pdev) |
| 1220 | { |
Sean Paul | af65c80 | 2014-01-30 16:19:27 -0500 | [diff] [blame] | 1221 | pm_runtime_disable(&pdev->dev); |
Joonyoung Shim | cb91f6a | 2011-12-09 16:52:11 +0900 | [diff] [blame] | 1222 | |
Inki Dae | df5225b | 2014-05-29 18:28:02 +0900 | [diff] [blame] | 1223 | component_del(&pdev->dev, &fimd_component_ops); |
| 1224 | exynos_drm_component_del(&pdev->dev, EXYNOS_DEVICE_TYPE_CRTC); |
| 1225 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1226 | return 0; |
| 1227 | } |
| 1228 | |
Joonyoung Shim | 132a5b9 | 2012-03-16 18:47:08 +0900 | [diff] [blame] | 1229 | struct platform_driver fimd_driver = { |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1230 | .probe = fimd_probe, |
Greg Kroah-Hartman | 56550d9 | 2012-12-21 15:09:25 -0800 | [diff] [blame] | 1231 | .remove = fimd_remove, |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1232 | .driver = { |
| 1233 | .name = "exynos4-fb", |
| 1234 | .owner = THIS_MODULE, |
Sachin Kamat | 2d3f173 | 2013-08-28 10:47:58 +0530 | [diff] [blame] | 1235 | .of_match_table = fimd_driver_dt_match, |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 1236 | }, |
| 1237 | }; |