diff options
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 51 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_hdmi.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_mixer.c | 3 | ||||
| -rw-r--r-- | include/drm/exynos_drm.h | 14 |
5 files changed, 34 insertions, 39 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 0584132dc608..85304c46a8cd 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
| @@ -29,6 +29,11 @@ | |||
| 29 | #define get_ctx_from_subdrv(subdrv) container_of(subdrv,\ | 29 | #define get_ctx_from_subdrv(subdrv) container_of(subdrv,\ |
| 30 | struct drm_hdmi_context, subdrv); | 30 | struct drm_hdmi_context, subdrv); |
| 31 | 31 | ||
| 32 | /* Common hdmi subdrv needs to access the hdmi and mixer though context. | ||
| 33 | * These should be initialied by the repective drivers */ | ||
| 34 | static struct exynos_drm_hdmi_context *hdmi_ctx; | ||
| 35 | static struct exynos_drm_hdmi_context *mixer_ctx; | ||
| 36 | |||
| 32 | /* these callback points shoud be set by specific drivers. */ | 37 | /* these callback points shoud be set by specific drivers. */ |
| 33 | static struct exynos_hdmi_ops *hdmi_ops; | 38 | static struct exynos_hdmi_ops *hdmi_ops; |
| 34 | static struct exynos_mixer_ops *mixer_ops; | 39 | static struct exynos_mixer_ops *mixer_ops; |
| @@ -41,6 +46,18 @@ struct drm_hdmi_context { | |||
| 41 | bool enabled[MIXER_WIN_NR]; | 46 | bool enabled[MIXER_WIN_NR]; |
| 42 | }; | 47 | }; |
| 43 | 48 | ||
| 49 | void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx) | ||
| 50 | { | ||
| 51 | if (ctx) | ||
| 52 | hdmi_ctx = ctx; | ||
| 53 | } | ||
| 54 | |||
| 55 | void exynos_mixer_drv_attach(struct exynos_drm_hdmi_context *ctx) | ||
| 56 | { | ||
| 57 | if (ctx) | ||
| 58 | mixer_ctx = ctx; | ||
| 59 | } | ||
| 60 | |||
| 44 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops) | 61 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops) |
| 45 | { | 62 | { |
| 46 | DRM_DEBUG_KMS("%s\n", __FILE__); | 63 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| @@ -303,46 +320,30 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev, | |||
| 303 | { | 320 | { |
| 304 | struct exynos_drm_subdrv *subdrv = to_subdrv(dev); | 321 | struct exynos_drm_subdrv *subdrv = to_subdrv(dev); |
| 305 | struct drm_hdmi_context *ctx; | 322 | struct drm_hdmi_context *ctx; |
| 306 | struct platform_device *pdev = to_platform_device(dev); | ||
| 307 | struct exynos_drm_common_hdmi_pd *pd; | ||
| 308 | 323 | ||
| 309 | DRM_DEBUG_KMS("%s\n", __FILE__); | 324 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 310 | 325 | ||
| 311 | pd = pdev->dev.platform_data; | 326 | if (!hdmi_ctx) { |
| 312 | 327 | DRM_ERROR("hdmi context not initialized.\n"); | |
| 313 | if (!pd) { | ||
| 314 | DRM_DEBUG_KMS("platform data is null.\n"); | ||
| 315 | return -EFAULT; | 328 | return -EFAULT; |
| 316 | } | 329 | } |
| 317 | 330 | ||
| 318 | if (!pd->hdmi_dev) { | 331 | if (!mixer_ctx) { |
| 319 | DRM_DEBUG_KMS("hdmi device is null.\n"); | 332 | DRM_ERROR("mixer context not initialized.\n"); |
| 320 | return -EFAULT; | ||
| 321 | } | ||
| 322 | |||
| 323 | if (!pd->mixer_dev) { | ||
| 324 | DRM_DEBUG_KMS("mixer device is null.\n"); | ||
| 325 | return -EFAULT; | 333 | return -EFAULT; |
| 326 | } | 334 | } |
| 327 | 335 | ||
| 328 | ctx = get_ctx_from_subdrv(subdrv); | 336 | ctx = get_ctx_from_subdrv(subdrv); |
| 329 | 337 | ||
| 330 | ctx->hdmi_ctx = (struct exynos_drm_hdmi_context *) | 338 | if (!ctx) { |
| 331 | to_context(pd->hdmi_dev); | 339 | DRM_ERROR("no drm hdmi context.\n"); |
| 332 | if (!ctx->hdmi_ctx) { | ||
| 333 | DRM_DEBUG_KMS("hdmi context is null.\n"); | ||
| 334 | return -EFAULT; | 340 | return -EFAULT; |
| 335 | } | 341 | } |
| 336 | 342 | ||
| 337 | ctx->hdmi_ctx->drm_dev = drm_dev; | 343 | ctx->hdmi_ctx = hdmi_ctx; |
| 338 | 344 | ctx->mixer_ctx = mixer_ctx; | |
| 339 | ctx->mixer_ctx = (struct exynos_drm_hdmi_context *) | ||
| 340 | to_context(pd->mixer_dev); | ||
| 341 | if (!ctx->mixer_ctx) { | ||
| 342 | DRM_DEBUG_KMS("mixer context is null.\n"); | ||
| 343 | return -EFAULT; | ||
| 344 | } | ||
| 345 | 345 | ||
| 346 | ctx->hdmi_ctx->drm_dev = drm_dev; | ||
| 346 | ctx->mixer_ctx->drm_dev = drm_dev; | 347 | ctx->mixer_ctx->drm_dev = drm_dev; |
| 347 | 348 | ||
| 348 | return 0; | 349 | return 0; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index d9f9e9fcc2b6..2da5ffd3a059 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h | |||
| @@ -73,6 +73,8 @@ struct exynos_mixer_ops { | |||
| 73 | void (*win_disable)(void *ctx, int zpos); | 73 | void (*win_disable)(void *ctx, int zpos); |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx); | ||
| 77 | void exynos_mixer_drv_attach(struct exynos_drm_hdmi_context *ctx); | ||
| 76 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops); | 78 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops); |
| 77 | void exynos_mixer_ops_register(struct exynos_mixer_ops *ops); | 79 | void exynos_mixer_ops_register(struct exynos_mixer_ops *ops); |
| 78 | #endif | 80 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 5caf49f366e3..e6b784d1527d 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
| @@ -2454,6 +2454,9 @@ static int __devinit hdmi_probe(struct platform_device *pdev) | |||
| 2454 | goto err_free_irq; | 2454 | goto err_free_irq; |
| 2455 | } | 2455 | } |
| 2456 | 2456 | ||
| 2457 | /* Attach HDMI Driver to common hdmi. */ | ||
| 2458 | exynos_hdmi_drv_attach(drm_hdmi_ctx); | ||
| 2459 | |||
| 2457 | /* register specific callbacks to common hdmi. */ | 2460 | /* register specific callbacks to common hdmi. */ |
| 2458 | exynos_hdmi_ops_register(&hdmi_ops); | 2461 | exynos_hdmi_ops_register(&hdmi_ops); |
| 2459 | 2462 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 39d2b95087ae..1a319e4431d8 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
| @@ -1171,6 +1171,9 @@ static int __devinit mixer_probe(struct platform_device *pdev) | |||
| 1171 | } | 1171 | } |
| 1172 | } | 1172 | } |
| 1173 | 1173 | ||
| 1174 | /* attach mixer driver to common hdmi. */ | ||
| 1175 | exynos_mixer_drv_attach(drm_hdmi_ctx); | ||
| 1176 | |||
| 1174 | /* register specific callback point to common hdmi. */ | 1177 | /* register specific callback point to common hdmi. */ |
| 1175 | exynos_mixer_ops_register(&mixer_ops); | 1178 | exynos_mixer_ops_register(&mixer_ops); |
| 1176 | 1179 | ||
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index 8bdd49a0abd0..8ac4079e6458 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h | |||
| @@ -240,19 +240,5 @@ struct exynos_drm_fimd_pdata { | |||
| 240 | unsigned int bpp; | 240 | unsigned int bpp; |
| 241 | }; | 241 | }; |
| 242 | 242 | ||
| 243 | /** | ||
| 244 | * Platform Specific Structure for DRM based HDMI. | ||
| 245 | * | ||
| 246 | * @hdmi_dev: device point to specific hdmi driver. | ||
| 247 | * @mixer_dev: device point to specific mixer driver. | ||
| 248 | * | ||
| 249 | * this structure is used for common hdmi driver and each device object | ||
| 250 | * would be used to access specific device driver(hdmi or mixer driver) | ||
| 251 | */ | ||
| 252 | struct exynos_drm_common_hdmi_pd { | ||
| 253 | struct device *hdmi_dev; | ||
| 254 | struct device *mixer_dev; | ||
| 255 | }; | ||
| 256 | |||
| 257 | #endif /* __KERNEL__ */ | 243 | #endif /* __KERNEL__ */ |
| 258 | #endif /* _EXYNOS_DRM_H_ */ | 244 | #endif /* _EXYNOS_DRM_H_ */ |
