aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLeela Krishna Amudala <l.krishna@samsung.com>2012-09-21 07:22:15 -0400
committerInki Dae <inki.dae@samsung.com>2012-10-03 21:06:01 -0400
commite2e1338900208ab36e3b86349ffdb3eba52302f8 (patch)
tree425cec98902809eee0ced2e1569f0b0bc2b3c2b5 /drivers/gpu
parent53bd5556547d72fb9c572d66c3b7bfe0f096972b (diff)
drm/exynos: add platform_device_id table and driver data for drm fimd
Two device ids are created for exynos4-fb and exynos5-fb. Also, added driver data for exynos4 and exynos5 to pick the timing base address at runtime to write data into appropriate register address. Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 1da741fc7460..73c52ed040fa 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -57,6 +57,18 @@
57 57
58#define get_fimd_context(dev) platform_get_drvdata(to_platform_device(dev)) 58#define get_fimd_context(dev) platform_get_drvdata(to_platform_device(dev))
59 59
60struct fimd_driver_data {
61 unsigned int timing_base;
62};
63
64struct fimd_driver_data exynos4_fimd_driver_data = {
65 .timing_base = 0x0,
66};
67
68struct fimd_driver_data exynos5_fimd_driver_data = {
69 .timing_base = 0x20000,
70};
71
60struct fimd_win_data { 72struct fimd_win_data {
61 unsigned int offset_x; 73 unsigned int offset_x;
62 unsigned int offset_y; 74 unsigned int offset_y;
@@ -91,6 +103,13 @@ struct fimd_context {
91 struct exynos_drm_panel_info *panel; 103 struct exynos_drm_panel_info *panel;
92}; 104};
93 105
106static inline struct fimd_driver_data *drm_fimd_get_driver_data(
107 struct platform_device *pdev)
108{
109 return (struct fimd_driver_data *)
110 platform_get_device_id(pdev)->driver_data;
111}
112
94static bool fimd_display_is_connected(struct device *dev) 113static bool fimd_display_is_connected(struct device *dev)
95{ 114{
96 DRM_DEBUG_KMS("%s\n", __FILE__); 115 DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -194,32 +213,35 @@ static void fimd_commit(struct device *dev)
194 struct fimd_context *ctx = get_fimd_context(dev); 213 struct fimd_context *ctx = get_fimd_context(dev);
195 struct exynos_drm_panel_info *panel = ctx->panel; 214 struct exynos_drm_panel_info *panel = ctx->panel;
196 struct fb_videomode *timing = &panel->timing; 215 struct fb_videomode *timing = &panel->timing;
216 struct fimd_driver_data *driver_data;
217 struct platform_device *pdev = to_platform_device(dev);
197 u32 val; 218 u32 val;
198 219
220 driver_data = drm_fimd_get_driver_data(pdev);
199 if (ctx->suspended) 221 if (ctx->suspended)
200 return; 222 return;
201 223
202 DRM_DEBUG_KMS("%s\n", __FILE__); 224 DRM_DEBUG_KMS("%s\n", __FILE__);
203 225
204 /* setup polarity values from machine code. */ 226 /* setup polarity values from machine code. */
205 writel(ctx->vidcon1, ctx->regs + VIDCON1); 227 writel(ctx->vidcon1, ctx->regs + driver_data->timing_base + VIDCON1);
206 228
207 /* setup vertical timing values. */ 229 /* setup vertical timing values. */
208 val = VIDTCON0_VBPD(timing->upper_margin - 1) | 230 val = VIDTCON0_VBPD(timing->upper_margin - 1) |
209 VIDTCON0_VFPD(timing->lower_margin - 1) | 231 VIDTCON0_VFPD(timing->lower_margin - 1) |
210 VIDTCON0_VSPW(timing->vsync_len - 1); 232 VIDTCON0_VSPW(timing->vsync_len - 1);
211 writel(val, ctx->regs + VIDTCON0); 233 writel(val, ctx->regs + driver_data->timing_base + VIDTCON0);
212 234
213 /* setup horizontal timing values. */ 235 /* setup horizontal timing values. */
214 val = VIDTCON1_HBPD(timing->left_margin - 1) | 236 val = VIDTCON1_HBPD(timing->left_margin - 1) |
215 VIDTCON1_HFPD(timing->right_margin - 1) | 237 VIDTCON1_HFPD(timing->right_margin - 1) |
216 VIDTCON1_HSPW(timing->hsync_len - 1); 238 VIDTCON1_HSPW(timing->hsync_len - 1);
217 writel(val, ctx->regs + VIDTCON1); 239 writel(val, ctx->regs + driver_data->timing_base + VIDTCON1);
218 240
219 /* setup horizontal and vertical display size. */ 241 /* setup horizontal and vertical display size. */
220 val = VIDTCON2_LINEVAL(timing->yres - 1) | 242 val = VIDTCON2_LINEVAL(timing->yres - 1) |
221 VIDTCON2_HOZVAL(timing->xres - 1); 243 VIDTCON2_HOZVAL(timing->xres - 1);
222 writel(val, ctx->regs + VIDTCON2); 244 writel(val, ctx->regs + driver_data->timing_base + VIDTCON2);
223 245
224 /* setup clock source, clock divider, enable dma. */ 246 /* setup clock source, clock divider, enable dma. */
225 val = ctx->vidcon0; 247 val = ctx->vidcon0;
@@ -1009,6 +1031,18 @@ static int fimd_runtime_resume(struct device *dev)
1009} 1031}
1010#endif 1032#endif
1011 1033
1034static struct platform_device_id fimd_driver_ids[] = {
1035 {
1036 .name = "exynos4-fb",
1037 .driver_data = (unsigned long)&exynos4_fimd_driver_data,
1038 }, {
1039 .name = "exynos5-fb",
1040 .driver_data = (unsigned long)&exynos5_fimd_driver_data,
1041 },
1042 {},
1043};
1044MODULE_DEVICE_TABLE(platform, fimd_driver_ids);
1045
1012static const struct dev_pm_ops fimd_pm_ops = { 1046static const struct dev_pm_ops fimd_pm_ops = {
1013 SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume) 1047 SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
1014 SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL) 1048 SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
@@ -1017,6 +1051,7 @@ static const struct dev_pm_ops fimd_pm_ops = {
1017struct platform_driver fimd_driver = { 1051struct platform_driver fimd_driver = {
1018 .probe = fimd_probe, 1052 .probe = fimd_probe,
1019 .remove = __devexit_p(fimd_remove), 1053 .remove = __devexit_p(fimd_remove),
1054 .id_table = fimd_driver_ids,
1020 .driver = { 1055 .driver = {
1021 .name = "exynos4-fb", 1056 .name = "exynos4-fb",
1022 .owner = THIS_MODULE, 1057 .owner = THIS_MODULE,