diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2012-04-05 07:49:27 -0400 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2012-04-12 01:51:27 -0400 |
commit | 677e84c1b5c8533ea351a9556308071ca47a1eb2 (patch) | |
tree | 38ab6a72f214433ef294403b6c5cdb3dd25afb0a /drivers | |
parent | 578b6065adc8805a8774e4bf3145e18de123f8b2 (diff) |
drm/exynos: fix to pointer manager member of struct exynos_drm_subdrv
The struct exynos_drm_manager has to exist for exynos drm sub driver
using encoder and connector. If it isn't NULL to member of struct
exynos_drm_subdrv, will create encoder and connector else will not. And
the is_local member also doesn't need.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_core.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.h | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimd.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_vidi.c | 20 |
5 files changed, 46 insertions, 33 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 411832e8e17a..eaf630dc5dba 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c | |||
@@ -54,16 +54,18 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev, | |||
54 | * | 54 | * |
55 | * P.S. note that this driver is considered for modularization. | 55 | * P.S. note that this driver is considered for modularization. |
56 | */ | 56 | */ |
57 | ret = subdrv->probe(dev, subdrv->manager.dev); | 57 | ret = subdrv->probe(dev, subdrv->dev); |
58 | if (ret) | 58 | if (ret) |
59 | return ret; | 59 | return ret; |
60 | } | 60 | } |
61 | 61 | ||
62 | if (subdrv->is_local) | 62 | if (!subdrv->manager) |
63 | return 0; | 63 | return 0; |
64 | 64 | ||
65 | subdrv->manager->dev = subdrv->dev; | ||
66 | |||
65 | /* create and initialize a encoder for this sub driver. */ | 67 | /* create and initialize a encoder for this sub driver. */ |
66 | encoder = exynos_drm_encoder_create(dev, &subdrv->manager, | 68 | encoder = exynos_drm_encoder_create(dev, subdrv->manager, |
67 | (1 << MAX_CRTC) - 1); | 69 | (1 << MAX_CRTC) - 1); |
68 | if (!encoder) { | 70 | if (!encoder) { |
69 | DRM_ERROR("failed to create encoder\n"); | 71 | DRM_ERROR("failed to create encoder\n"); |
@@ -186,7 +188,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) | |||
186 | 188 | ||
187 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | 189 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
188 | if (subdrv->open) { | 190 | if (subdrv->open) { |
189 | ret = subdrv->open(dev, subdrv->manager.dev, file); | 191 | ret = subdrv->open(dev, subdrv->dev, file); |
190 | if (ret) | 192 | if (ret) |
191 | goto err; | 193 | goto err; |
192 | } | 194 | } |
@@ -197,7 +199,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) | |||
197 | err: | 199 | err: |
198 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { | 200 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { |
199 | if (subdrv->close) | 201 | if (subdrv->close) |
200 | subdrv->close(dev, subdrv->manager.dev, file); | 202 | subdrv->close(dev, subdrv->dev, file); |
201 | } | 203 | } |
202 | return ret; | 204 | return ret; |
203 | } | 205 | } |
@@ -209,7 +211,7 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) | |||
209 | 211 | ||
210 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | 212 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
211 | if (subdrv->close) | 213 | if (subdrv->close) |
212 | subdrv->close(dev, subdrv->manager.dev, file); | 214 | subdrv->close(dev, subdrv->dev, file); |
213 | } | 215 | } |
214 | } | 216 | } |
215 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); | 217 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index fbd0a232c93d..1d814175cd49 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -225,24 +225,25 @@ struct exynos_drm_private { | |||
225 | * Exynos drm sub driver structure. | 225 | * Exynos drm sub driver structure. |
226 | * | 226 | * |
227 | * @list: sub driver has its own list object to register to exynos drm driver. | 227 | * @list: sub driver has its own list object to register to exynos drm driver. |
228 | * @dev: pointer to device object for subdrv device driver. | ||
228 | * @drm_dev: pointer to drm_device and this pointer would be set | 229 | * @drm_dev: pointer to drm_device and this pointer would be set |
229 | * when sub driver calls exynos_drm_subdrv_register(). | 230 | * when sub driver calls exynos_drm_subdrv_register(). |
230 | * @is_local: appear encoder and connector disrelated device. | 231 | * @manager: subdrv has its own manager to control a hardware appropriately |
232 | * and we can access a hardware drawing on this manager. | ||
231 | * @probe: this callback would be called by exynos drm driver after | 233 | * @probe: this callback would be called by exynos drm driver after |
232 | * subdrv is registered to it. | 234 | * subdrv is registered to it. |
233 | * @remove: this callback is used to release resources created | 235 | * @remove: this callback is used to release resources created |
234 | * by probe callback. | 236 | * by probe callback. |
235 | * @open: this would be called with drm device file open. | 237 | * @open: this would be called with drm device file open. |
236 | * @close: this would be called with drm device file close. | 238 | * @close: this would be called with drm device file close. |
237 | * @manager: subdrv has its own manager to control a hardware appropriately | ||
238 | * and we can access a hardware drawing on this manager. | ||
239 | * @encoder: encoder object owned by this sub driver. | 239 | * @encoder: encoder object owned by this sub driver. |
240 | * @connector: connector object owned by this sub driver. | 240 | * @connector: connector object owned by this sub driver. |
241 | */ | 241 | */ |
242 | struct exynos_drm_subdrv { | 242 | struct exynos_drm_subdrv { |
243 | struct list_head list; | 243 | struct list_head list; |
244 | struct device *dev; | ||
244 | struct drm_device *drm_dev; | 245 | struct drm_device *drm_dev; |
245 | bool is_local; | 246 | struct exynos_drm_manager *manager; |
246 | 247 | ||
247 | int (*probe)(struct drm_device *drm_dev, struct device *dev); | 248 | int (*probe)(struct drm_device *drm_dev, struct device *dev); |
248 | void (*remove)(struct drm_device *dev); | 249 | void (*remove)(struct drm_device *dev); |
@@ -251,7 +252,6 @@ struct exynos_drm_subdrv { | |||
251 | void (*close)(struct drm_device *drm_dev, struct device *dev, | 252 | void (*close)(struct drm_device *drm_dev, struct device *dev, |
252 | struct drm_file *file); | 253 | struct drm_file *file); |
253 | 254 | ||
254 | struct exynos_drm_manager manager; | ||
255 | struct drm_encoder *encoder; | 255 | struct drm_encoder *encoder; |
256 | struct drm_connector *connector; | 256 | struct drm_connector *connector; |
257 | }; | 257 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index ecb6db229700..29fdbfeb43cb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -172,7 +172,7 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) | |||
172 | static void fimd_apply(struct device *subdrv_dev) | 172 | static void fimd_apply(struct device *subdrv_dev) |
173 | { | 173 | { |
174 | struct fimd_context *ctx = get_fimd_context(subdrv_dev); | 174 | struct fimd_context *ctx = get_fimd_context(subdrv_dev); |
175 | struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | 175 | struct exynos_drm_manager *mgr = ctx->subdrv.manager; |
176 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; | 176 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
177 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; | 177 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
178 | struct fimd_win_data *win_data; | 178 | struct fimd_win_data *win_data; |
@@ -577,6 +577,13 @@ static struct exynos_drm_overlay_ops fimd_overlay_ops = { | |||
577 | .disable = fimd_win_disable, | 577 | .disable = fimd_win_disable, |
578 | }; | 578 | }; |
579 | 579 | ||
580 | static struct exynos_drm_manager fimd_manager = { | ||
581 | .pipe = -1, | ||
582 | .ops = &fimd_manager_ops, | ||
583 | .overlay_ops = &fimd_overlay_ops, | ||
584 | .display_ops = &fimd_display_ops, | ||
585 | }; | ||
586 | |||
580 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) | 587 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) |
581 | { | 588 | { |
582 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | 589 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
@@ -628,7 +635,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | |||
628 | struct fimd_context *ctx = (struct fimd_context *)dev_id; | 635 | struct fimd_context *ctx = (struct fimd_context *)dev_id; |
629 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 636 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
630 | struct drm_device *drm_dev = subdrv->drm_dev; | 637 | struct drm_device *drm_dev = subdrv->drm_dev; |
631 | struct exynos_drm_manager *manager = &subdrv->manager; | 638 | struct exynos_drm_manager *manager = subdrv->manager; |
632 | u32 val; | 639 | u32 val; |
633 | 640 | ||
634 | val = readl(ctx->regs + VIDINTCON1); | 641 | val = readl(ctx->regs + VIDINTCON1); |
@@ -744,7 +751,7 @@ static void fimd_clear_win(struct fimd_context *ctx, int win) | |||
744 | static int fimd_power_on(struct fimd_context *ctx, bool enable) | 751 | static int fimd_power_on(struct fimd_context *ctx, bool enable) |
745 | { | 752 | { |
746 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 753 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
747 | struct device *dev = subdrv->manager.dev; | 754 | struct device *dev = subdrv->dev; |
748 | 755 | ||
749 | DRM_DEBUG_KMS("%s\n", __FILE__); | 756 | DRM_DEBUG_KMS("%s\n", __FILE__); |
750 | 757 | ||
@@ -867,13 +874,10 @@ static int __devinit fimd_probe(struct platform_device *pdev) | |||
867 | 874 | ||
868 | subdrv = &ctx->subdrv; | 875 | subdrv = &ctx->subdrv; |
869 | 876 | ||
877 | subdrv->dev = dev; | ||
878 | subdrv->manager = &fimd_manager; | ||
870 | subdrv->probe = fimd_subdrv_probe; | 879 | subdrv->probe = fimd_subdrv_probe; |
871 | subdrv->remove = fimd_subdrv_remove; | 880 | subdrv->remove = fimd_subdrv_remove; |
872 | subdrv->manager.pipe = -1; | ||
873 | subdrv->manager.ops = &fimd_manager_ops; | ||
874 | subdrv->manager.overlay_ops = &fimd_overlay_ops; | ||
875 | subdrv->manager.display_ops = &fimd_display_ops; | ||
876 | subdrv->manager.dev = dev; | ||
877 | 881 | ||
878 | mutex_init(&ctx->lock); | 882 | mutex_init(&ctx->lock); |
879 | 883 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 348048b766a9..3424463676e0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
@@ -117,7 +117,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) | |||
117 | { | 117 | { |
118 | struct drm_hdmi_context *ctx = to_context(subdrv_dev); | 118 | struct drm_hdmi_context *ctx = to_context(subdrv_dev); |
119 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 119 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
120 | struct exynos_drm_manager *manager = &subdrv->manager; | 120 | struct exynos_drm_manager *manager = subdrv->manager; |
121 | 121 | ||
122 | DRM_DEBUG_KMS("%s\n", __FILE__); | 122 | DRM_DEBUG_KMS("%s\n", __FILE__); |
123 | 123 | ||
@@ -251,6 +251,12 @@ static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { | |||
251 | .disable = drm_mixer_disable, | 251 | .disable = drm_mixer_disable, |
252 | }; | 252 | }; |
253 | 253 | ||
254 | static struct exynos_drm_manager hdmi_manager = { | ||
255 | .pipe = -1, | ||
256 | .ops = &drm_hdmi_manager_ops, | ||
257 | .overlay_ops = &drm_hdmi_overlay_ops, | ||
258 | .display_ops = &drm_hdmi_display_ops, | ||
259 | }; | ||
254 | 260 | ||
255 | static int hdmi_subdrv_probe(struct drm_device *drm_dev, | 261 | static int hdmi_subdrv_probe(struct drm_device *drm_dev, |
256 | struct device *dev) | 262 | struct device *dev) |
@@ -318,12 +324,9 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) | |||
318 | 324 | ||
319 | subdrv = &ctx->subdrv; | 325 | subdrv = &ctx->subdrv; |
320 | 326 | ||
327 | subdrv->dev = dev; | ||
328 | subdrv->manager = &hdmi_manager; | ||
321 | subdrv->probe = hdmi_subdrv_probe; | 329 | subdrv->probe = hdmi_subdrv_probe; |
322 | subdrv->manager.pipe = -1; | ||
323 | subdrv->manager.ops = &drm_hdmi_manager_ops; | ||
324 | subdrv->manager.overlay_ops = &drm_hdmi_overlay_ops; | ||
325 | subdrv->manager.display_ops = &drm_hdmi_display_ops; | ||
326 | subdrv->manager.dev = dev; | ||
327 | 330 | ||
328 | platform_set_drvdata(pdev, subdrv); | 331 | platform_set_drvdata(pdev, subdrv); |
329 | 332 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 8e1339f9fe1f..7b9c153dceb6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -199,7 +199,7 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) | |||
199 | static void vidi_apply(struct device *subdrv_dev) | 199 | static void vidi_apply(struct device *subdrv_dev) |
200 | { | 200 | { |
201 | struct vidi_context *ctx = get_vidi_context(subdrv_dev); | 201 | struct vidi_context *ctx = get_vidi_context(subdrv_dev); |
202 | struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | 202 | struct exynos_drm_manager *mgr = ctx->subdrv.manager; |
203 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; | 203 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
204 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; | 204 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
205 | struct vidi_win_data *win_data; | 205 | struct vidi_win_data *win_data; |
@@ -374,6 +374,13 @@ static struct exynos_drm_overlay_ops vidi_overlay_ops = { | |||
374 | .disable = vidi_win_disable, | 374 | .disable = vidi_win_disable, |
375 | }; | 375 | }; |
376 | 376 | ||
377 | static struct exynos_drm_manager vidi_manager = { | ||
378 | .pipe = -1, | ||
379 | .ops = &vidi_manager_ops, | ||
380 | .overlay_ops = &vidi_overlay_ops, | ||
381 | .display_ops = &vidi_display_ops, | ||
382 | }; | ||
383 | |||
377 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) | 384 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) |
378 | { | 385 | { |
379 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | 386 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
@@ -425,7 +432,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work) | |||
425 | struct vidi_context *ctx = container_of(work, struct vidi_context, | 432 | struct vidi_context *ctx = container_of(work, struct vidi_context, |
426 | work); | 433 | work); |
427 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 434 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
428 | struct exynos_drm_manager *manager = &subdrv->manager; | 435 | struct exynos_drm_manager *manager = subdrv->manager; |
429 | 436 | ||
430 | if (manager->pipe < 0) | 437 | if (manager->pipe < 0) |
431 | return; | 438 | return; |
@@ -471,7 +478,7 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev) | |||
471 | static int vidi_power_on(struct vidi_context *ctx, bool enable) | 478 | static int vidi_power_on(struct vidi_context *ctx, bool enable) |
472 | { | 479 | { |
473 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 480 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
474 | struct device *dev = subdrv->manager.dev; | 481 | struct device *dev = subdrv->dev; |
475 | 482 | ||
476 | DRM_DEBUG_KMS("%s\n", __FILE__); | 483 | DRM_DEBUG_KMS("%s\n", __FILE__); |
477 | 484 | ||
@@ -611,13 +618,10 @@ static int __devinit vidi_probe(struct platform_device *pdev) | |||
611 | ctx->raw_edid = (struct edid *)fake_edid_info; | 618 | ctx->raw_edid = (struct edid *)fake_edid_info; |
612 | 619 | ||
613 | subdrv = &ctx->subdrv; | 620 | subdrv = &ctx->subdrv; |
621 | subdrv->dev = dev; | ||
622 | subdrv->manager = &vidi_manager; | ||
614 | subdrv->probe = vidi_subdrv_probe; | 623 | subdrv->probe = vidi_subdrv_probe; |
615 | subdrv->remove = vidi_subdrv_remove; | 624 | subdrv->remove = vidi_subdrv_remove; |
616 | subdrv->manager.pipe = -1; | ||
617 | subdrv->manager.ops = &vidi_manager_ops; | ||
618 | subdrv->manager.overlay_ops = &vidi_overlay_ops; | ||
619 | subdrv->manager.display_ops = &vidi_display_ops; | ||
620 | subdrv->manager.dev = dev; | ||
621 | 625 | ||
622 | mutex_init(&ctx->lock); | 626 | mutex_init(&ctx->lock); |
623 | 627 | ||