Commit 677e84c1 authored by Joonyoung Shim's avatar Joonyoung Shim Committed by Inki Dae

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: default avatarJoonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 578b6065
...@@ -54,16 +54,18 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev, ...@@ -54,16 +54,18 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev,
* *
* P.S. note that this driver is considered for modularization. * P.S. note that this driver is considered for modularization.
*/ */
ret = subdrv->probe(dev, subdrv->manager.dev); ret = subdrv->probe(dev, subdrv->dev);
if (ret) if (ret)
return ret; return ret;
} }
if (subdrv->is_local) if (!subdrv->manager)
return 0; return 0;
subdrv->manager->dev = subdrv->dev;
/* create and initialize a encoder for this sub driver. */ /* create and initialize a encoder for this sub driver. */
encoder = exynos_drm_encoder_create(dev, &subdrv->manager, encoder = exynos_drm_encoder_create(dev, subdrv->manager,
(1 << MAX_CRTC) - 1); (1 << MAX_CRTC) - 1);
if (!encoder) { if (!encoder) {
DRM_ERROR("failed to create encoder\n"); 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,7 +188,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file)
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) {
if (subdrv->open) { if (subdrv->open) {
ret = subdrv->open(dev, subdrv->manager.dev, file); ret = subdrv->open(dev, subdrv->dev, file);
if (ret) if (ret)
goto err; goto err;
} }
...@@ -197,7 +199,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) ...@@ -197,7 +199,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file)
err: err:
list_for_each_entry_reverse(subdrv, &subdrv->list, list) { list_for_each_entry_reverse(subdrv, &subdrv->list, list) {
if (subdrv->close) if (subdrv->close)
subdrv->close(dev, subdrv->manager.dev, file); subdrv->close(dev, subdrv->dev, file);
} }
return ret; return ret;
} }
...@@ -209,7 +211,7 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) ...@@ -209,7 +211,7 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file)
list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) {
if (subdrv->close) if (subdrv->close)
subdrv->close(dev, subdrv->manager.dev, file); subdrv->close(dev, subdrv->dev, file);
} }
} }
EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close);
...@@ -225,24 +225,25 @@ struct exynos_drm_private { ...@@ -225,24 +225,25 @@ struct exynos_drm_private {
* Exynos drm sub driver structure. * Exynos drm sub driver structure.
* *
* @list: sub driver has its own list object to register to exynos drm driver. * @list: sub driver has its own list object to register to exynos drm driver.
* @dev: pointer to device object for subdrv device driver.
* @drm_dev: pointer to drm_device and this pointer would be set * @drm_dev: pointer to drm_device and this pointer would be set
* when sub driver calls exynos_drm_subdrv_register(). * when sub driver calls exynos_drm_subdrv_register().
* @is_local: appear encoder and connector disrelated device. * @manager: subdrv has its own manager to control a hardware appropriately
* and we can access a hardware drawing on this manager.
* @probe: this callback would be called by exynos drm driver after * @probe: this callback would be called by exynos drm driver after
* subdrv is registered to it. * subdrv is registered to it.
* @remove: this callback is used to release resources created * @remove: this callback is used to release resources created
* by probe callback. * by probe callback.
* @open: this would be called with drm device file open. * @open: this would be called with drm device file open.
* @close: this would be called with drm device file close. * @close: this would be called with drm device file close.
* @manager: subdrv has its own manager to control a hardware appropriately
* and we can access a hardware drawing on this manager.
* @encoder: encoder object owned by this sub driver. * @encoder: encoder object owned by this sub driver.
* @connector: connector object owned by this sub driver. * @connector: connector object owned by this sub driver.
*/ */
struct exynos_drm_subdrv { struct exynos_drm_subdrv {
struct list_head list; struct list_head list;
struct device *dev;
struct drm_device *drm_dev; struct drm_device *drm_dev;
bool is_local; struct exynos_drm_manager *manager;
int (*probe)(struct drm_device *drm_dev, struct device *dev); int (*probe)(struct drm_device *drm_dev, struct device *dev);
void (*remove)(struct drm_device *dev); void (*remove)(struct drm_device *dev);
...@@ -251,7 +252,6 @@ struct exynos_drm_subdrv { ...@@ -251,7 +252,6 @@ struct exynos_drm_subdrv {
void (*close)(struct drm_device *drm_dev, struct device *dev, void (*close)(struct drm_device *drm_dev, struct device *dev,
struct drm_file *file); struct drm_file *file);
struct exynos_drm_manager manager;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_connector *connector; struct drm_connector *connector;
}; };
......
...@@ -172,7 +172,7 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) ...@@ -172,7 +172,7 @@ static void fimd_dpms(struct device *subdrv_dev, int mode)
static void fimd_apply(struct device *subdrv_dev) static void fimd_apply(struct device *subdrv_dev)
{ {
struct fimd_context *ctx = get_fimd_context(subdrv_dev); struct fimd_context *ctx = get_fimd_context(subdrv_dev);
struct exynos_drm_manager *mgr = &ctx->subdrv.manager; struct exynos_drm_manager *mgr = ctx->subdrv.manager;
struct exynos_drm_manager_ops *mgr_ops = mgr->ops; struct exynos_drm_manager_ops *mgr_ops = mgr->ops;
struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops;
struct fimd_win_data *win_data; struct fimd_win_data *win_data;
...@@ -577,6 +577,13 @@ static struct exynos_drm_overlay_ops fimd_overlay_ops = { ...@@ -577,6 +577,13 @@ static struct exynos_drm_overlay_ops fimd_overlay_ops = {
.disable = fimd_win_disable, .disable = fimd_win_disable,
}; };
static struct exynos_drm_manager fimd_manager = {
.pipe = -1,
.ops = &fimd_manager_ops,
.overlay_ops = &fimd_overlay_ops,
.display_ops = &fimd_display_ops,
};
static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc)
{ {
struct exynos_drm_private *dev_priv = drm_dev->dev_private; 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,7 +635,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
struct fimd_context *ctx = (struct fimd_context *)dev_id; struct fimd_context *ctx = (struct fimd_context *)dev_id;
struct exynos_drm_subdrv *subdrv = &ctx->subdrv; struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
struct drm_device *drm_dev = subdrv->drm_dev; struct drm_device *drm_dev = subdrv->drm_dev;
struct exynos_drm_manager *manager = &subdrv->manager; struct exynos_drm_manager *manager = subdrv->manager;
u32 val; u32 val;
val = readl(ctx->regs + VIDINTCON1); val = readl(ctx->regs + VIDINTCON1);
...@@ -744,7 +751,7 @@ static void fimd_clear_win(struct fimd_context *ctx, int win) ...@@ -744,7 +751,7 @@ static void fimd_clear_win(struct fimd_context *ctx, int win)
static int fimd_power_on(struct fimd_context *ctx, bool enable) static int fimd_power_on(struct fimd_context *ctx, bool enable)
{ {
struct exynos_drm_subdrv *subdrv = &ctx->subdrv; struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
struct device *dev = subdrv->manager.dev; struct device *dev = subdrv->dev;
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
...@@ -867,13 +874,10 @@ static int __devinit fimd_probe(struct platform_device *pdev) ...@@ -867,13 +874,10 @@ static int __devinit fimd_probe(struct platform_device *pdev)
subdrv = &ctx->subdrv; subdrv = &ctx->subdrv;
subdrv->dev = dev;
subdrv->manager = &fimd_manager;
subdrv->probe = fimd_subdrv_probe; subdrv->probe = fimd_subdrv_probe;
subdrv->remove = fimd_subdrv_remove; subdrv->remove = fimd_subdrv_remove;
subdrv->manager.pipe = -1;
subdrv->manager.ops = &fimd_manager_ops;
subdrv->manager.overlay_ops = &fimd_overlay_ops;
subdrv->manager.display_ops = &fimd_display_ops;
subdrv->manager.dev = dev;
mutex_init(&ctx->lock); mutex_init(&ctx->lock);
......
...@@ -117,7 +117,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) ...@@ -117,7 +117,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = to_context(subdrv_dev);
struct exynos_drm_subdrv *subdrv = &ctx->subdrv; struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
struct exynos_drm_manager *manager = &subdrv->manager; struct exynos_drm_manager *manager = subdrv->manager;
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
...@@ -251,6 +251,12 @@ static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { ...@@ -251,6 +251,12 @@ static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = {
.disable = drm_mixer_disable, .disable = drm_mixer_disable,
}; };
static struct exynos_drm_manager hdmi_manager = {
.pipe = -1,
.ops = &drm_hdmi_manager_ops,
.overlay_ops = &drm_hdmi_overlay_ops,
.display_ops = &drm_hdmi_display_ops,
};
static int hdmi_subdrv_probe(struct drm_device *drm_dev, static int hdmi_subdrv_probe(struct drm_device *drm_dev,
struct device *dev) struct device *dev)
...@@ -318,12 +324,9 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) ...@@ -318,12 +324,9 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev)
subdrv = &ctx->subdrv; subdrv = &ctx->subdrv;
subdrv->dev = dev;
subdrv->manager = &hdmi_manager;
subdrv->probe = hdmi_subdrv_probe; subdrv->probe = hdmi_subdrv_probe;
subdrv->manager.pipe = -1;
subdrv->manager.ops = &drm_hdmi_manager_ops;
subdrv->manager.overlay_ops = &drm_hdmi_overlay_ops;
subdrv->manager.display_ops = &drm_hdmi_display_ops;
subdrv->manager.dev = dev;
platform_set_drvdata(pdev, subdrv); platform_set_drvdata(pdev, subdrv);
......
...@@ -199,7 +199,7 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) ...@@ -199,7 +199,7 @@ static void vidi_dpms(struct device *subdrv_dev, int mode)
static void vidi_apply(struct device *subdrv_dev) static void vidi_apply(struct device *subdrv_dev)
{ {
struct vidi_context *ctx = get_vidi_context(subdrv_dev); struct vidi_context *ctx = get_vidi_context(subdrv_dev);
struct exynos_drm_manager *mgr = &ctx->subdrv.manager; struct exynos_drm_manager *mgr = ctx->subdrv.manager;
struct exynos_drm_manager_ops *mgr_ops = mgr->ops; struct exynos_drm_manager_ops *mgr_ops = mgr->ops;
struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops;
struct vidi_win_data *win_data; struct vidi_win_data *win_data;
...@@ -374,6 +374,13 @@ static struct exynos_drm_overlay_ops vidi_overlay_ops = { ...@@ -374,6 +374,13 @@ static struct exynos_drm_overlay_ops vidi_overlay_ops = {
.disable = vidi_win_disable, .disable = vidi_win_disable,
}; };
static struct exynos_drm_manager vidi_manager = {
.pipe = -1,
.ops = &vidi_manager_ops,
.overlay_ops = &vidi_overlay_ops,
.display_ops = &vidi_display_ops,
};
static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc)
{ {
struct exynos_drm_private *dev_priv = drm_dev->dev_private; 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,7 +432,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work)
struct vidi_context *ctx = container_of(work, struct vidi_context, struct vidi_context *ctx = container_of(work, struct vidi_context,
work); work);
struct exynos_drm_subdrv *subdrv = &ctx->subdrv; struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
struct exynos_drm_manager *manager = &subdrv->manager; struct exynos_drm_manager *manager = subdrv->manager;
if (manager->pipe < 0) if (manager->pipe < 0)
return; return;
...@@ -471,7 +478,7 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev) ...@@ -471,7 +478,7 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev)
static int vidi_power_on(struct vidi_context *ctx, bool enable) static int vidi_power_on(struct vidi_context *ctx, bool enable)
{ {
struct exynos_drm_subdrv *subdrv = &ctx->subdrv; struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
struct device *dev = subdrv->manager.dev; struct device *dev = subdrv->dev;
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
...@@ -611,13 +618,10 @@ static int __devinit vidi_probe(struct platform_device *pdev) ...@@ -611,13 +618,10 @@ static int __devinit vidi_probe(struct platform_device *pdev)
ctx->raw_edid = (struct edid *)fake_edid_info; ctx->raw_edid = (struct edid *)fake_edid_info;
subdrv = &ctx->subdrv; subdrv = &ctx->subdrv;
subdrv->dev = dev;
subdrv->manager = &vidi_manager;
subdrv->probe = vidi_subdrv_probe; subdrv->probe = vidi_subdrv_probe;
subdrv->remove = vidi_subdrv_remove; subdrv->remove = vidi_subdrv_remove;
subdrv->manager.pipe = -1;
subdrv->manager.ops = &vidi_manager_ops;
subdrv->manager.overlay_ops = &vidi_overlay_ops;
subdrv->manager.display_ops = &vidi_display_ops;
subdrv->manager.dev = dev;
mutex_init(&ctx->lock); mutex_init(&ctx->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment