Message ID | 1382967331-6243-1-git-send-email-inki.dae@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Oct 28, 2013 at 9:35 AM, Inki Dae <inki.dae@samsung.com> wrote: > This patch makes callback funtions of each sub driver to be called > with device object instead of display and manager. > > Exynos drm framework doesn't need to pass a manager or a display > when calling callback function of each sub driver, and each sub > driver can get its own context from device object. So this patch > hides sub driver's context from framework. > Inki, The reason I don't like this patch is that it moves us further away from a flat drm driver. When I originally wrote the code for these hooks to accept exynos_drm_manager/exynos_drm_display, it's because they convert almost 1:1 to drm_crtc/drm_[encoder|connector]. The drm_crtc_funcs/drm_encoder_funcs/drm_connector_funcs all take drm_crtc/drm_encoder/drm_connector directly, not a device pointer. Another benefit of keeping it as-is is that the managers and displays need not necessarily be their own device drivers, they could easily be something like ptn3460 where they just hang off the root drm driver. Sean > Signed-off-by: Inki Dae <inki.dae@samsung.com> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> > --- > drivers/gpu/drm/exynos/exynos_drm_connector.c | 10 +-- > drivers/gpu/drm/exynos/exynos_drm_core.c | 8 +- > drivers/gpu/drm/exynos/exynos_drm_crtc.c | 23 ++--- > drivers/gpu/drm/exynos/exynos_drm_drv.h | 62 +++++++------- > drivers/gpu/drm/exynos/exynos_drm_encoder.c | 10 +-- > drivers/gpu/drm/exynos/exynos_drm_fimd.c | 114 ++++++++++++------------- > drivers/gpu/drm/exynos/exynos_hdmi.c | 64 +++++++------- > drivers/gpu/drm/exynos/exynos_mixer.c | 70 +++++++-------- > 8 files changed, 177 insertions(+), 184 deletions(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c > index 9a16dbe..d13f637 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c > @@ -46,7 +46,7 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) > * because lcd panel has only one mode. > */ > if (display->ops->get_edid) { > - edid = display->ops->get_edid(display, connector); > + edid = display->ops->get_edid(display->dev, connector); > if (IS_ERR_OR_NULL(edid)) { > ret = PTR_ERR(edid); > edid = NULL; > @@ -70,7 +70,7 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) > } > > if (display->ops->get_panel) > - panel = display->ops->get_panel(display); > + panel = display->ops->get_panel(display->dev); > else { > drm_mode_destroy(connector->dev, mode); > return 0; > @@ -105,7 +105,7 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector, > DRM_DEBUG_KMS("%s\n", __FILE__); > > if (display->ops->check_mode) > - if (!display->ops->check_mode(display, mode)) > + if (!display->ops->check_mode(display->dev, mode)) > ret = MODE_OK; > > return ret; > @@ -155,7 +155,7 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector, > * resolution then get max width and height from that driver. > */ > if (display->ops->get_max_resol) > - display->ops->get_max_resol(display, &width, &height); > + display->ops->get_max_resol(display->dev, &width, &height); > > return drm_helper_probe_single_connector_modes(connector, width, > height); > @@ -171,7 +171,7 @@ exynos_drm_connector_detect(struct drm_connector *connector, bool force) > enum drm_connector_status status = connector_status_disconnected; > > if (display->ops->is_connected) { > - if (display->ops->is_connected(display)) > + if (display->ops->is_connected(display->dev)) > status = connector_status_connected; > else > status = connector_status_disconnected; > diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c > index 0e11754..d59691d 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_core.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c > @@ -103,7 +103,7 @@ int exynos_drm_initialize_managers(struct drm_device *dev) > > list_for_each_entry(manager, &exynos_drm_manager_list, list) { > if (manager->ops->initialize) { > - ret = manager->ops->initialize(manager, dev, pipe); > + ret = manager->ops->initialize(manager->dev, dev, pipe); > if (ret) { > DRM_ERROR("Mgr init [%d] failed with %d\n", > manager->type, ret); > @@ -148,7 +148,7 @@ int exynos_drm_initialize_displays(struct drm_device *dev) > > list_for_each_entry(display, &exynos_drm_display_list, list) { > if (display->ops->initialize) { > - ret = display->ops->initialize(display, dev); > + ret = display->ops->initialize(display->dev, dev); > if (ret) { > DRM_ERROR("Display init [%d] failed with %d\n", > display->type, ret); > @@ -233,7 +233,7 @@ int exynos_drm_manager_register(struct exynos_drm_manager *manager) > int exynos_drm_manager_unregister(struct exynos_drm_manager *manager) > { > if (manager->ops->remove) > - manager->ops->remove(manager); > + manager->ops->remove(manager->dev); > > list_del(&manager->list); > return 0; > @@ -249,7 +249,7 @@ int exynos_drm_display_register(struct exynos_drm_display *display) > int exynos_drm_display_unregister(struct exynos_drm_display *display) > { > if (display->ops->remove) > - display->ops->remove(display); > + display->ops->remove(display->dev); > > list_del(&display->list); > return 0; > diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c > index 100a561..f2f232e 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c > @@ -75,7 +75,7 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) > } > > if (manager->ops->dpms) > - manager->ops->dpms(manager, mode); > + manager->ops->dpms(manager->dev, mode); > > exynos_crtc->dpms = mode; > } > @@ -95,7 +95,7 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc) > exynos_plane_commit(exynos_crtc->plane); > > if (manager->ops->commit) > - manager->ops->commit(manager); > + manager->ops->commit(manager->dev); > > exynos_plane_dpms(exynos_crtc->plane, DRM_MODE_DPMS_ON); > } > @@ -109,7 +109,8 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc, > struct exynos_drm_manager *manager = exynos_crtc->manager; > > if (manager->ops->mode_fixup) > - return manager->ops->mode_fixup(manager, mode, adjusted_mode); > + return manager->ops->mode_fixup(manager->dev, mode, > + adjusted_mode); > > return true; > } > @@ -136,7 +137,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, > crtc_h = crtc->fb->height - y; > > if (manager->ops->mode_set) > - manager->ops->mode_set(manager, &crtc->mode); > + manager->ops->mode_set(manager->dev, &crtc->mode); > > ret = exynos_plane_mode_set(plane, crtc, crtc->fb, 0, 0, crtc_w, crtc_h, > x, y, crtc_w, crtc_h); > @@ -390,7 +391,7 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe) > return -EPERM; > > if (manager->ops->enable_vblank) > - manager->ops->enable_vblank(manager); > + manager->ops->enable_vblank(manager->dev); > > return 0; > } > @@ -406,7 +407,7 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe) > return; > > if (manager->ops->disable_vblank) > - manager->ops->disable_vblank(manager); > + manager->ops->disable_vblank(manager->dev); > } > > void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe) > @@ -441,7 +442,7 @@ void exynos_drm_crtc_plane_mode_set(struct drm_crtc *crtc, > struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager; > > if (manager->ops->win_mode_set) > - manager->ops->win_mode_set(manager, overlay); > + manager->ops->win_mode_set(manager->dev, overlay); > } > > void exynos_drm_crtc_plane_commit(struct drm_crtc *crtc, int zpos) > @@ -449,7 +450,7 @@ void exynos_drm_crtc_plane_commit(struct drm_crtc *crtc, int zpos) > struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager; > > if (manager->ops->win_commit) > - manager->ops->win_commit(manager, zpos); > + manager->ops->win_commit(manager->dev, zpos); > } > > void exynos_drm_crtc_plane_enable(struct drm_crtc *crtc, int zpos) > @@ -457,7 +458,7 @@ void exynos_drm_crtc_plane_enable(struct drm_crtc *crtc, int zpos) > struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager; > > if (manager->ops->win_enable) > - manager->ops->win_enable(manager, zpos); > + manager->ops->win_enable(manager->dev, zpos); > } > > void exynos_drm_crtc_plane_disable(struct drm_crtc *crtc, int zpos) > @@ -465,7 +466,7 @@ void exynos_drm_crtc_plane_disable(struct drm_crtc *crtc, int zpos) > struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager; > > if (manager->ops->win_disable) > - manager->ops->win_disable(manager, zpos); > + manager->ops->win_disable(manager->dev, zpos); > } > > void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb) > @@ -487,6 +488,6 @@ void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb) > * real hardware. > */ > if (manager->ops->wait_for_vblank) > - manager->ops->wait_for_vblank(manager); > + manager->ops->wait_for_vblank(manager->dev); > } > } > diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h > index 97bdfcc..d92c9f9 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h > +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h > @@ -137,26 +137,22 @@ struct exynos_drm_overlay { > */ > struct exynos_drm_display; > struct exynos_drm_display_ops { > - int (*initialize)(struct exynos_drm_display *display, > + int (*initialize)(struct device *dev, > struct drm_device *drm_dev); > - void (*remove)(struct exynos_drm_display *display); > - bool (*is_connected)(struct exynos_drm_display *display); > - void (*get_max_resol)(struct exynos_drm_display *display, > - unsigned int *width, > + void (*remove)(struct device *dev); > + bool (*is_connected)(struct device *dev); > + void (*get_max_resol)(struct device *dev, unsigned int *width, > unsigned int *height); > - struct edid *(*get_edid)(struct exynos_drm_display *display, > + struct edid *(*get_edid)(struct device *dev, > struct drm_connector *connector); > - void *(*get_panel)(struct exynos_drm_display *display); > - void (*mode_fixup)(struct exynos_drm_display *display, > - struct drm_connector *connector, > + void *(*get_panel)(struct device *dev); > + void (*mode_fixup)(struct device *dev, struct drm_connector *connector, > const struct drm_display_mode *mode, > struct drm_display_mode *adjusted_mode); > - void (*mode_set)(struct exynos_drm_display *display, > - struct drm_display_mode *mode); > - int (*check_mode)(struct exynos_drm_display *display, > - struct drm_display_mode *mode); > - void (*dpms)(struct exynos_drm_display *display, int mode); > - void (*commit)(struct exynos_drm_display *display); > + void (*mode_set)(struct device *dev, struct drm_display_mode *mode); > + int (*check_mode)(struct device *dev, struct drm_display_mode *mode); > + void (*dpms)(struct device *dev, int mode); > + void (*commit)(struct device *dev); > }; > > /* > @@ -167,7 +163,7 @@ struct exynos_drm_display_ops { > * @encoder: encoder object this display maps to > * @connector: connector object this display maps to > * @ops: pointer to callbacks for exynos drm specific functionality > - * @ctx: A pointer to the display's implementation specific context > + * @dev: device object of display device driver > */ > struct exynos_drm_display { > struct list_head list; > @@ -175,7 +171,7 @@ struct exynos_drm_display { > struct drm_encoder *encoder; > struct drm_connector *connector; > struct exynos_drm_display_ops *ops; > - void *ctx; > + struct device *dev; > }; > > /* > @@ -198,24 +194,24 @@ struct exynos_drm_display { > */ > struct exynos_drm_manager; > struct exynos_drm_manager_ops { > - int (*initialize)(struct exynos_drm_manager *mgr, > - struct drm_device *drm_dev, int pipe); > - void (*remove)(struct exynos_drm_manager *mgr); > - void (*dpms)(struct exynos_drm_manager *mgr, int mode); > - bool (*mode_fixup)(struct exynos_drm_manager *mgr, > + int (*initialize)(struct device *dev, struct drm_device *drm_dev, > + int pipe); > + void (*remove)(struct device *dev); > + void (*dpms)(struct device *dev, int mode); > + bool (*mode_fixup)(struct device *dev, > const struct drm_display_mode *mode, > struct drm_display_mode *adjusted_mode); > - void (*mode_set)(struct exynos_drm_manager *mgr, > + void (*mode_set)(struct device *dev, > const struct drm_display_mode *mode); > - void (*commit)(struct exynos_drm_manager *mgr); > - int (*enable_vblank)(struct exynos_drm_manager *mgr); > - void (*disable_vblank)(struct exynos_drm_manager *mgr); > - void (*wait_for_vblank)(struct exynos_drm_manager *mgr); > - void (*win_mode_set)(struct exynos_drm_manager *mgr, > + void (*commit)(struct device *dev); > + int (*enable_vblank)(struct device *dev); > + void (*disable_vblank)(struct device *dev); > + void (*wait_for_vblank)(struct device *dev); > + void (*win_mode_set)(struct device *dev, > struct exynos_drm_overlay *overlay); > - void (*win_commit)(struct exynos_drm_manager *mgr, int zpos); > - void (*win_enable)(struct exynos_drm_manager *mgr, int zpos); > - void (*win_disable)(struct exynos_drm_manager *mgr, int zpos); > + void (*win_commit)(struct device *dev, int zpos); > + void (*win_enable)(struct device *dev, int zpos); > + void (*win_disable)(struct device *dev, int zpos); > }; > > /* > @@ -226,7 +222,7 @@ struct exynos_drm_manager_ops { > * @drm_dev: pointer to the drm device > * @pipe: the pipe number for this crtc/manager > * @ops: pointer to callbacks for exynos drm specific functionality > - * @ctx: A pointer to the manager's implementation specific context > + * @dev: device object of manager device driver > */ > struct exynos_drm_manager { > struct list_head list; > @@ -234,7 +230,7 @@ struct exynos_drm_manager { > struct drm_device *drm_dev; > int pipe; > struct exynos_drm_manager_ops *ops; > - void *ctx; > + struct device *dev; > }; > > struct exynos_drm_g2d_private { > diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c > index bfa2f17..5a7342c 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c > @@ -41,7 +41,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) > DRM_DEBUG_KMS("encoder dpms: %d\n", mode); > > if (display->ops->dpms) > - display->ops->dpms(display, mode); > + display->ops->dpms(display->dev, mode); > } > > static bool > @@ -59,7 +59,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, > continue; > > if (display->ops->mode_fixup) > - display->ops->mode_fixup(display, connector, mode, > + display->ops->mode_fixup(display->dev, connector, mode, > adjusted_mode); > } > > @@ -74,7 +74,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, > struct exynos_drm_display *display = exynos_encoder->display; > > if (display->ops->mode_set) > - display->ops->mode_set(display, adjusted_mode); > + display->ops->mode_set(display->dev, adjusted_mode); > } > > static void exynos_drm_encoder_prepare(struct drm_encoder *encoder) > @@ -88,10 +88,10 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder) > struct exynos_drm_display *display = exynos_encoder->display; > > if (display->ops->dpms) > - display->ops->dpms(display, DRM_MODE_DPMS_ON); > + display->ops->dpms(display->dev, DRM_MODE_DPMS_ON); > > if (display->ops->commit) > - display->ops->commit(display); > + display->ops->commit(display->dev); > } > > static void exynos_drm_encoder_disable(struct drm_encoder *encoder) > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c > index 03657b2..384e53b 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c > @@ -62,7 +62,7 @@ > /* FIMD has totally five hardware windows. */ > #define WINDOWS_NR 5 > > -#define get_fimd_manager(mgr) platform_get_drvdata(to_platform_device(dev)) > +#define get_fimd_context(dev) platform_get_drvdata(to_platform_device(dev)) > > struct fimd_driver_data { > unsigned int timing_base; > @@ -158,22 +158,21 @@ static inline struct fimd_driver_data *drm_fimd_get_driver_data( > return (struct fimd_driver_data *)of_id->data; > } > > -static bool fimd_display_is_connected(struct exynos_drm_display *display) > +static bool fimd_display_is_connected(struct device *dev) > { > /* TODO. */ > > return true; > } > > -static void *fimd_get_panel(struct exynos_drm_display *display) > +static void *fimd_get_panel(struct device *dev) > { > - struct fimd_context *ctx = display->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > > return &ctx->panel; > } > > -static int fimd_check_mode(struct exynos_drm_display *display, > - struct drm_display_mode *mode) > +static int fimd_check_mode(struct device *dev, struct drm_display_mode *mode) > { > /* TODO. */ > > @@ -191,10 +190,10 @@ static struct exynos_drm_display fimd_display = { > .ops = &fimd_display_ops, > }; > > -static void fimd_win_mode_set(struct exynos_drm_manager *mgr, > - struct exynos_drm_overlay *overlay) > +static void fimd_win_mode_set(struct device *dev, > + struct exynos_drm_overlay *overlay) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > struct fimd_win_data *win_data; > int win; > unsigned long offset; > @@ -337,9 +336,9 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx, > writel(val, ctx->regs + reg); > } > > -static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos) > +static void fimd_win_commit(struct device *dev, int zpos) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > struct fimd_win_data *win_data; > int win = zpos; > unsigned long val, alpha, size; > @@ -463,9 +462,9 @@ static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos) > win_data->enabled = true; > } > > -static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos) > +static void fimd_win_disable(struct device *dev, int zpos) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > struct fimd_win_data *win_data; > int win = zpos; > u32 val; > @@ -504,10 +503,10 @@ static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos) > win_data->enabled = false; > } > > -static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, > - struct drm_device *drm_dev, int pipe) > +static int fimd_mgr_initialize(struct device *dev, struct drm_device *drm_dev, > + int pipe) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > > ctx->drm_dev = drm_dev; > ctx->pipe = pipe; > @@ -536,9 +535,9 @@ static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, > return 0; > } > > -static void fimd_mgr_remove(struct exynos_drm_manager *mgr) > +static void fimd_mgr_remove(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > > if (is_drm_iommu_supported(ctx->drm_dev)) > drm_iommu_detach_device(ctx->drm_dev, ctx->dev); > @@ -556,9 +555,9 @@ static u32 fimd_calc_clkdiv(struct fimd_context *ctx, > return (clkdiv < 0x100) ? clkdiv : 0xff; > } > > -static bool fimd_mode_fixup(struct exynos_drm_manager *mgr, > - const struct drm_display_mode *mode, > - struct drm_display_mode *adjusted_mode) > +static bool fimd_mode_fixup(struct device *dev, > + const struct drm_display_mode *mode, > + struct drm_display_mode *adjusted_mode) > { > if (adjusted_mode->vrefresh == 0) > adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE; > @@ -566,10 +565,10 @@ static bool fimd_mode_fixup(struct exynos_drm_manager *mgr, > return true; > } > > -static void fimd_mode_set(struct exynos_drm_manager *mgr, > +static void fimd_mode_set(struct device *dev, > const struct drm_display_mode *in_mode) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > struct fimd_mode_data *mode = &ctx->mode; > int hblank, vblank; > > @@ -590,9 +589,9 @@ static void fimd_mode_set(struct exynos_drm_manager *mgr, > mode->clkdiv = fimd_calc_clkdiv(ctx, in_mode); > } > > -static void fimd_commit(struct exynos_drm_manager *mgr) > +static void fimd_commit(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > struct fimd_mode_data *mode = &ctx->mode; > struct fimd_driver_data *driver_data; > u32 val; > @@ -649,24 +648,24 @@ static void fimd_commit(struct exynos_drm_manager *mgr) > writel(val, ctx->regs + VIDCON0); > } > > -static void fimd_apply(struct exynos_drm_manager *mgr) > +static void fimd_apply(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > struct fimd_win_data *win_data; > int i; > > for (i = 0; i < WINDOWS_NR; i++) { > win_data = &ctx->win_data[i]; > if (win_data->enabled) > - fimd_win_commit(mgr, i); > + fimd_win_commit(dev, i); > } > > - fimd_commit(mgr); > + fimd_commit(dev); > } > > -static int fimd_enable_vblank(struct exynos_drm_manager *mgr) > +static int fimd_enable_vblank(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > u32 val; > > if (ctx->suspended) > @@ -689,9 +688,9 @@ static int fimd_enable_vblank(struct exynos_drm_manager *mgr) > return 0; > } > > -static void fimd_disable_vblank(struct exynos_drm_manager *mgr) > +static void fimd_disable_vblank(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > u32 val; > > if (ctx->suspended) > @@ -707,9 +706,9 @@ static void fimd_disable_vblank(struct exynos_drm_manager *mgr) > } > } > > -static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr) > +static void fimd_wait_for_vblank(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > > if (ctx->suspended) > return; > @@ -726,9 +725,9 @@ static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr) > DRM_DEBUG_KMS("vblank wait timed out.\n"); > } > > -static void fimd_window_suspend(struct exynos_drm_manager *mgr) > +static void fimd_window_suspend(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > struct fimd_win_data *win_data; > int i; > > @@ -736,14 +735,14 @@ static void fimd_window_suspend(struct exynos_drm_manager *mgr) > win_data = &ctx->win_data[i]; > win_data->resume = win_data->enabled; > if (win_data->enabled) > - fimd_win_disable(mgr, i); > + fimd_win_disable(dev, i); > } > - fimd_wait_for_vblank(mgr); > + fimd_wait_for_vblank(dev); > } > > -static void fimd_window_resume(struct exynos_drm_manager *mgr) > +static void fimd_window_resume(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > struct fimd_win_data *win_data; > int i; > > @@ -754,9 +753,9 @@ static void fimd_window_resume(struct exynos_drm_manager *mgr) > } > } > > -static int fimd_poweron(struct exynos_drm_manager *mgr) > +static int fimd_poweron(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > int ret; > > if (!ctx->suspended) > @@ -780,16 +779,16 @@ static int fimd_poweron(struct exynos_drm_manager *mgr) > > /* if vblank was enabled status, enable it again. */ > if (test_and_clear_bit(0, &ctx->irq_flags)) { > - ret = fimd_enable_vblank(mgr); > + ret = fimd_enable_vblank(dev); > if (ret) { > DRM_ERROR("Failed to re-enable vblank [%d]\n", ret); > goto enable_vblank_err; > } > } > > - fimd_window_resume(mgr); > + fimd_window_resume(dev); > > - fimd_apply(mgr); > + fimd_apply(dev); > > return 0; > > @@ -802,9 +801,9 @@ bus_clk_err: > return ret; > } > > -static int fimd_poweroff(struct exynos_drm_manager *mgr) > +static int fimd_poweroff(struct device *dev) > { > - struct fimd_context *ctx = mgr->ctx; > + struct fimd_context *ctx = get_fimd_context(dev); > > if (ctx->suspended) > return 0; > @@ -814,7 +813,7 @@ static int fimd_poweroff(struct exynos_drm_manager *mgr) > * suspend that connector. Otherwise we might try to scan from > * a destroyed buffer later. > */ > - fimd_window_suspend(mgr); > + fimd_window_suspend(dev); > > clk_disable_unprepare(ctx->lcd_clk); > clk_disable_unprepare(ctx->bus_clk); > @@ -825,18 +824,18 @@ static int fimd_poweroff(struct exynos_drm_manager *mgr) > return 0; > } > > -static void fimd_dpms(struct exynos_drm_manager *mgr, int mode) > +static void fimd_dpms(struct device *dev, int mode) > { > DRM_DEBUG_KMS("%s, %d\n", __FILE__, mode); > > switch (mode) { > case DRM_MODE_DPMS_ON: > - fimd_poweron(mgr); > + fimd_poweron(dev); > break; > case DRM_MODE_DPMS_STANDBY: > case DRM_MODE_DPMS_SUSPEND: > case DRM_MODE_DPMS_OFF: > - fimd_poweroff(mgr); > + fimd_poweroff(dev); > break; > default: > DRM_DEBUG_KMS("unspecified mode %d\n", mode); > @@ -985,12 +984,12 @@ static int fimd_probe(struct platform_device *pdev) > DRM_INIT_WAITQUEUE(&ctx->wait_vsync_queue); > atomic_set(&ctx->wait_vsync_event, 0); > > - platform_set_drvdata(pdev, &fimd_manager); > + platform_set_drvdata(pdev, ctx); > > - fimd_manager.ctx = ctx; > + fimd_manager.dev = dev; > exynos_drm_manager_register(&fimd_manager); > > - fimd_display.ctx = ctx; > + fimd_display.dev = dev; > exynos_drm_display_register(&fimd_display); > > /* > @@ -1010,12 +1009,13 @@ static int fimd_probe(struct platform_device *pdev) > > static int fimd_remove(struct platform_device *pdev) > { > - struct exynos_drm_manager *mgr = platform_get_drvdata(pdev); > + struct device *dev = &pdev->dev; > + struct fimd_context *ctx = platform_get_drvdata(pdev); > > exynos_drm_display_unregister(&fimd_display); > exynos_drm_manager_unregister(&fimd_manager); > > - fimd_dpms(mgr, DRM_MODE_DPMS_OFF); > + fimd_dpms(dev, DRM_MODE_DPMS_OFF); > > pm_runtime_disable(&pdev->dev); > > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c > index 130b109..32ce9a6 100644 > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c > @@ -45,7 +45,7 @@ > > #define MAX_WIDTH 1920 > #define MAX_HEIGHT 1080 > -#define get_hdmi_display(dev) platform_get_drvdata(to_platform_device(dev)) > +#define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) > > /* AVI header and aspect ratio */ > #define HDMI_AVI_VERSION 0x02 > @@ -739,28 +739,27 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, > } > } > > -static int hdmi_initialize(struct exynos_drm_display *display, > - struct drm_device *drm_dev) > +static int hdmi_initialize(struct device *dev, struct drm_device *drm_dev) > { > - struct hdmi_context *hdata = display->ctx; > + struct hdmi_context *hdata = get_hdmi_context(dev); > > hdata->drm_dev = drm_dev; > > return 0; > } > > -static bool hdmi_is_connected(struct exynos_drm_display *display) > +static bool hdmi_is_connected(struct device *dev) > { > - struct hdmi_context *hdata = display->ctx; > + struct hdmi_context *hdata = get_hdmi_context(dev); > > return hdata->hpd; > } > > -static struct edid *hdmi_get_edid(struct exynos_drm_display *display, > - struct drm_connector *connector) > +static struct edid *hdmi_get_edid(struct device *dev, > + struct drm_connector *connector) > { > struct edid *raw_edid; > - struct hdmi_context *hdata = display->ctx; > + struct hdmi_context *hdata = get_hdmi_context(dev); > > if (!hdata->ddc_port) > return ERR_PTR(-ENODEV); > @@ -799,10 +798,10 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock) > return -EINVAL; > } > > -static int hdmi_check_mode(struct exynos_drm_display *display, > +static int hdmi_check_mode(struct device *dev, > struct drm_display_mode *mode) > { > - struct hdmi_context *hdata = display->ctx; > + struct hdmi_context *hdata = get_hdmi_context(dev); > int ret; > > DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", > @@ -820,8 +819,7 @@ static int hdmi_check_mode(struct exynos_drm_display *display, > return 0; > } > > -static void hdmi_mode_fixup(struct exynos_drm_display *display, > - struct drm_connector *connector, > +static void hdmi_mode_fixup(struct device *dev, struct drm_connector *connector, > const struct drm_display_mode *mode, > struct drm_display_mode *adjusted_mode) > { > @@ -832,7 +830,7 @@ static void hdmi_mode_fixup(struct exynos_drm_display *display, > > drm_mode_set_crtcinfo(adjusted_mode, 0); > > - mode_ok = hdmi_check_mode(display, adjusted_mode); > + mode_ok = hdmi_check_mode(dev, adjusted_mode); > > /* just return if user desired mode exists. */ > if (mode_ok == 0) > @@ -843,7 +841,7 @@ static void hdmi_mode_fixup(struct exynos_drm_display *display, > * to adjusted_mode. > */ > list_for_each_entry(m, &connector->modes, head) { > - mode_ok = hdmi_check_mode(display, m); > + mode_ok = hdmi_check_mode(dev, m); > > if (mode_ok == 0) { > DRM_INFO("desired mode doesn't exist so\n"); > @@ -1683,10 +1681,9 @@ static void hdmi_v14_mode_set(struct hdmi_context *hdata, > hdmi_set_reg(tg->tg_3d, 1, 0x0); > } > > -static void hdmi_mode_set(struct exynos_drm_display *display, > - struct drm_display_mode *mode) > +static void hdmi_mode_set(struct device *dev, struct drm_display_mode *mode) > { > - struct hdmi_context *hdata = display->ctx; > + struct hdmi_context *hdata = get_hdmi_context(dev); > struct drm_display_mode *m = mode; > > DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%s\n", > @@ -1700,16 +1697,16 @@ static void hdmi_mode_set(struct exynos_drm_display *display, > hdmi_v14_mode_set(hdata, mode); > } > > -static void hdmi_get_max_resol(struct exynos_drm_display *display, > - unsigned int *width, unsigned int *height) > +static void hdmi_get_max_resol(struct device *dev, unsigned int *width, > + unsigned int *height) > { > *width = MAX_WIDTH; > *height = MAX_HEIGHT; > } > > -static void hdmi_commit(struct exynos_drm_display *display) > +static void hdmi_commit(struct device *dev) > { > - struct hdmi_context *hdata = display->ctx; > + struct hdmi_context *hdata = get_hdmi_context(dev); > > mutex_lock(&hdata->hdmi_mutex); > if (!hdata->powered) { > @@ -1721,9 +1718,9 @@ static void hdmi_commit(struct exynos_drm_display *display) > hdmi_conf_apply(hdata); > } > > -static void hdmi_poweron(struct exynos_drm_display *display) > +static void hdmi_poweron(struct device *dev) > { > - struct hdmi_context *hdata = display->ctx; > + struct hdmi_context *hdata = get_hdmi_context(dev); > struct hdmi_resources *res = &hdata->res; > > mutex_lock(&hdata->hdmi_mutex); > @@ -1744,12 +1741,12 @@ static void hdmi_poweron(struct exynos_drm_display *display) > clk_prepare_enable(res->sclk_hdmi); > > hdmiphy_poweron(hdata); > - hdmi_commit(display); > + hdmi_commit(dev); > } > > -static void hdmi_poweroff(struct exynos_drm_display *display) > +static void hdmi_poweroff(struct device *dev) > { > - struct hdmi_context *hdata = display->ctx; > + struct hdmi_context *hdata = get_hdmi_context(dev); > struct hdmi_resources *res = &hdata->res; > > mutex_lock(&hdata->hdmi_mutex); > @@ -1776,18 +1773,18 @@ out: > mutex_unlock(&hdata->hdmi_mutex); > } > > -static void hdmi_dpms(struct exynos_drm_display *display, int mode) > +static void hdmi_dpms(struct device *dev, int mode) > { > DRM_DEBUG_KMS("mode %d\n", mode); > > switch (mode) { > case DRM_MODE_DPMS_ON: > - hdmi_poweron(display); > + hdmi_poweron(dev); > break; > case DRM_MODE_DPMS_STANDBY: > case DRM_MODE_DPMS_SUSPEND: > case DRM_MODE_DPMS_OFF: > - hdmi_poweroff(display); > + hdmi_poweroff(dev); > break; > default: > DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); > @@ -1956,7 +1953,7 @@ static int hdmi_probe(struct platform_device *pdev) > > mutex_init(&hdata->hdmi_mutex); > > - platform_set_drvdata(pdev, &hdmi_display); > + platform_set_drvdata(pdev, hdata); > > match = of_match_node(hdmi_match_types, dev->of_node); > if (!match) > @@ -2027,7 +2024,7 @@ static int hdmi_probe(struct platform_device *pdev) > goto err_hdmiphy; > } > > - hdmi_display.ctx = hdata; > + hdmi_display.dev = dev; > exynos_drm_display_register(&hdmi_display); > > return 0; > @@ -2042,8 +2039,7 @@ err_ddc: > static int hdmi_remove(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > - struct exynos_drm_display *display = get_hdmi_display(dev); > - struct hdmi_context *hdata = display->ctx; > + struct hdmi_context *hdata = get_hdmi_context(dev); > > put_device(&hdata->hdmiphy_port->dev); > put_device(&hdata->ddc_port->dev); > diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c > index 985391d..2e8c0e8 100644 > --- a/drivers/gpu/drm/exynos/exynos_mixer.c > +++ b/drivers/gpu/drm/exynos/exynos_mixer.c > @@ -39,7 +39,7 @@ > #include "exynos_drm_iommu.h" > #include "exynos_mixer.h" > > -#define get_mixer_manager(dev) platform_get_drvdata(to_platform_device(dev)) > +#define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) > > #define MIXER_WIN_NR 3 > #define MIXER_DEFAULT_WIN 0 > @@ -687,10 +687,10 @@ static void mixer_win_reset(struct mixer_context *ctx) > spin_unlock_irqrestore(&res->reg_slock, flags); > } > > -static int mixer_initialize(struct exynos_drm_manager *mgr, > - struct drm_device *drm_dev, int pipe) > +static int mixer_initialize(struct device *dev, struct drm_device *drm_dev, > + int pipe) > { > - struct mixer_context *mixer_ctx = mgr->ctx; > + struct mixer_context *mixer_ctx = get_mixer_context(dev); > > mixer_ctx->drm_dev = drm_dev; > mixer_ctx->pipe = pipe; > @@ -701,17 +701,17 @@ static int mixer_initialize(struct exynos_drm_manager *mgr, > return drm_iommu_attach_device(mixer_ctx->drm_dev, mixer_ctx->dev); > } > > -static void mixer_mgr_remove(struct exynos_drm_manager *mgr) > +static void mixer_mgr_remove(struct device *dev) > { > - struct mixer_context *mixer_ctx = mgr->ctx; > + struct mixer_context *mixer_ctx = get_mixer_context(dev); > > if (is_drm_iommu_supported(mixer_ctx->drm_dev)) > drm_iommu_detach_device(mixer_ctx->drm_dev, mixer_ctx->dev); > } > > -static int mixer_enable_vblank(struct exynos_drm_manager *mgr) > +static int mixer_enable_vblank(struct device *dev) > { > - struct mixer_context *mixer_ctx = mgr->ctx; > + struct mixer_context *mixer_ctx = get_mixer_context(dev); > struct mixer_resources *res = &mixer_ctx->mixer_res; > > if (!mixer_ctx->powered) { > @@ -726,19 +726,19 @@ static int mixer_enable_vblank(struct exynos_drm_manager *mgr) > return 0; > } > > -static void mixer_disable_vblank(struct exynos_drm_manager *mgr) > +static void mixer_disable_vblank(struct device *dev) > { > - struct mixer_context *mixer_ctx = mgr->ctx; > + struct mixer_context *mixer_ctx = get_mixer_context(dev); > struct mixer_resources *res = &mixer_ctx->mixer_res; > > /* disable vsync interrupt */ > mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC); > } > > -static void mixer_win_mode_set(struct exynos_drm_manager *mgr, > +static void mixer_win_mode_set(struct device *dev, > struct exynos_drm_overlay *overlay) > { > - struct mixer_context *mixer_ctx = mgr->ctx; > + struct mixer_context *mixer_ctx = get_mixer_context(dev); > struct hdmi_win_data *win_data; > int win; > > @@ -787,9 +787,9 @@ static void mixer_win_mode_set(struct exynos_drm_manager *mgr, > win_data->scan_flags = overlay->scan_flag; > } > > -static void mixer_win_commit(struct exynos_drm_manager *mgr, int zpos) > +static void mixer_win_commit(struct device *dev, int zpos) > { > - struct mixer_context *mixer_ctx = mgr->ctx; > + struct mixer_context *mixer_ctx = get_mixer_context(dev); > int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos; > > DRM_DEBUG_KMS("win: %d\n", win); > @@ -809,9 +809,9 @@ static void mixer_win_commit(struct exynos_drm_manager *mgr, int zpos) > mixer_ctx->win_data[win].enabled = true; > } > > -static void mixer_win_disable(struct exynos_drm_manager *mgr, int zpos) > +static void mixer_win_disable(struct device *dev, int zpos) > { > - struct mixer_context *mixer_ctx = mgr->ctx; > + struct mixer_context *mixer_ctx = get_mixer_context(dev); > struct mixer_resources *res = &mixer_ctx->mixer_res; > int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos; > unsigned long flags; > @@ -837,9 +837,9 @@ static void mixer_win_disable(struct exynos_drm_manager *mgr, int zpos) > mixer_ctx->win_data[win].enabled = false; > } > > -static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) > +static void mixer_wait_for_vblank(struct device *dev) > { > - struct mixer_context *mixer_ctx = mgr->ctx; > + struct mixer_context *mixer_ctx = get_mixer_context(dev); > > mutex_lock(&mixer_ctx->mixer_mutex); > if (!mixer_ctx->powered) { > @@ -860,23 +860,23 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) > DRM_DEBUG_KMS("vblank wait timed out.\n"); > } > > -static void mixer_window_suspend(struct exynos_drm_manager *mgr) > +static void mixer_window_suspend(struct device *dev) > { > - struct mixer_context *ctx = mgr->ctx; > + struct mixer_context *ctx = get_mixer_context(dev); > struct hdmi_win_data *win_data; > int i; > > for (i = 0; i < MIXER_WIN_NR; i++) { > win_data = &ctx->win_data[i]; > win_data->resume = win_data->enabled; > - mixer_win_disable(mgr, i); > + mixer_win_disable(dev, i); > } > - mixer_wait_for_vblank(mgr); > + mixer_wait_for_vblank(dev); > } > > -static void mixer_window_resume(struct exynos_drm_manager *mgr) > +static void mixer_window_resume(struct device *dev) > { > - struct mixer_context *ctx = mgr->ctx; > + struct mixer_context *ctx = get_mixer_context(dev); > struct hdmi_win_data *win_data; > int i; > > @@ -885,13 +885,13 @@ static void mixer_window_resume(struct exynos_drm_manager *mgr) > win_data->enabled = win_data->resume; > win_data->resume = false; > if (win_data->enabled) > - mixer_win_commit(mgr, i); > + mixer_win_commit(dev, i); > } > } > > -static void mixer_poweron(struct exynos_drm_manager *mgr) > +static void mixer_poweron(struct device *dev) > { > - struct mixer_context *ctx = mgr->ctx; > + struct mixer_context *ctx = get_mixer_context(dev); > struct mixer_resources *res = &ctx->mixer_res; > > mutex_lock(&ctx->mixer_mutex); > @@ -913,12 +913,12 @@ static void mixer_poweron(struct exynos_drm_manager *mgr) > mixer_reg_write(res, MXR_INT_EN, ctx->int_en); > mixer_win_reset(ctx); > > - mixer_window_resume(mgr); > + mixer_window_resume(dev); > } > > -static void mixer_poweroff(struct exynos_drm_manager *mgr) > +static void mixer_poweroff(struct device *dev) > { > - struct mixer_context *ctx = mgr->ctx; > + struct mixer_context *ctx = get_mixer_context(dev); > struct mixer_resources *res = &ctx->mixer_res; > > mutex_lock(&ctx->mixer_mutex); > @@ -926,7 +926,7 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) > goto out; > mutex_unlock(&ctx->mixer_mutex); > > - mixer_window_suspend(mgr); > + mixer_window_suspend(dev); > > ctx->int_en = mixer_reg_read(res, MXR_INT_EN); > > @@ -945,16 +945,16 @@ out: > mutex_unlock(&ctx->mixer_mutex); > } > > -static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) > +static void mixer_dpms(struct device *dev, int mode) > { > switch (mode) { > case DRM_MODE_DPMS_ON: > - mixer_poweron(mgr); > + mixer_poweron(dev); > break; > case DRM_MODE_DPMS_STANDBY: > case DRM_MODE_DPMS_SUSPEND: > case DRM_MODE_DPMS_OFF: > - mixer_poweroff(mgr); > + mixer_poweroff(dev); > break; > default: > DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); > @@ -1235,7 +1235,7 @@ static int mixer_probe(struct platform_device *pdev) > } > } > > - mixer_manager.ctx = ctx; > + mixer_manager.dev = ctx->dev; > platform_set_drvdata(pdev, &mixer_manager); > exynos_drm_manager_register(&mixer_manager); > > -- > 1.7.9.5 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
On Mon, Oct 28, 2013 at 6:35 AM, Inki Dae <inki.dae@samsung.com> wrote: > This patch makes callback funtions of each sub driver to be called > with device object instead of display and manager. > > Exynos drm framework doesn't need to pass a manager or a display > when calling callback function of each sub driver, and each sub > driver can get its own context from device object. So this patch > hides sub driver's context from framework. This is a step backwards. There should be no need to have every driver have a full struct device associated with it, so removing the requirement to have a struct device is the right thing to do (and this patch undoes that). Sticking to the strict driver model on all display IP on SoCs is making things overly complicated. Sean is clearly moving the Exynos DRM in the right direction with his restructuring, so please don't undo his work like this. Especially not without cc:ing him on the patches. -Olof
2013/10/28 Sean Paul <seanpaul@chromium.org>: > On Mon, Oct 28, 2013 at 9:35 AM, Inki Dae <inki.dae@samsung.com> wrote: >> This patch makes callback funtions of each sub driver to be called >> with device object instead of display and manager. >> >> Exynos drm framework doesn't need to pass a manager or a display >> when calling callback function of each sub driver, and each sub >> driver can get its own context from device object. So this patch >> hides sub driver's context from framework. >> > > Inki, > The reason I don't like this patch is that it moves us further away > from a flat drm driver. When I originally wrote the code for these > hooks to accept exynos_drm_manager/exynos_drm_display, it's because > they convert almost 1:1 to drm_crtc/drm_[encoder|connector]. The > drm_crtc_funcs/drm_encoder_funcs/drm_connector_funcs all take > drm_crtc/drm_encoder/drm_connector directly, not a device pointer. > > Another benefit of keeping it as-is is that the managers and displays > need not necessarily be their own device drivers, they could easily be > something like ptn3460 where they just hang off the root drm driver. > I don't think that passing device object into each sub driver makes us futher away from a flat drm driver. And I think I already commented enough before to you about why passing manager and display is not reasonable. I guess the reason you are trying to pass manager and display is that you want to use lvds bridge driver, ptn3460, including tricky codes that make DT binding of ptn3460 to be done in Exynos drm framework, not real device driver. Thanks, Inki Dae > Sean > > >> Signed-off-by: Inki Dae <inki.dae@samsung.com> >> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> >> --- >> drivers/gpu/drm/exynos/exynos_drm_connector.c | 10 +-- >> drivers/gpu/drm/exynos/exynos_drm_core.c | 8 +- >> drivers/gpu/drm/exynos/exynos_drm_crtc.c | 23 ++--- >> drivers/gpu/drm/exynos/exynos_drm_drv.h | 62 +++++++------- >> drivers/gpu/drm/exynos/exynos_drm_encoder.c | 10 +-- >> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 114 >> ++++++++++++------------- >> drivers/gpu/drm/exynos/exynos_hdmi.c | 64 +++++++------- >> drivers/gpu/drm/exynos/exynos_mixer.c | 70 +++++++-------- >> 8 files changed, 177 insertions(+), 184 deletions(-) >> >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c >> b/drivers/gpu/drm/exynos/exynos_drm_connector.c >> index 9a16dbe..d13f637 100644 >> --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c >> +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c >> @@ -46,7 +46,7 @@ static int exynos_drm_connector_get_modes(struct >> drm_connector *connector) >> * because lcd panel has only one mode. >> */ >> if (display->ops->get_edid) { >> - edid = display->ops->get_edid(display, connector); >> + edid = display->ops->get_edid(display->dev, connector); >> if (IS_ERR_OR_NULL(edid)) { >> ret = PTR_ERR(edid); >> edid = NULL; >> @@ -70,7 +70,7 @@ static int exynos_drm_connector_get_modes(struct >> drm_connector *connector) >> } >> >> if (display->ops->get_panel) >> - panel = display->ops->get_panel(display); >> + panel = display->ops->get_panel(display->dev); >> else { >> drm_mode_destroy(connector->dev, mode); >> return 0; >> @@ -105,7 +105,7 @@ static int exynos_drm_connector_mode_valid(struct >> drm_connector *connector, >> DRM_DEBUG_KMS("%s\n", __FILE__); >> >> if (display->ops->check_mode) >> - if (!display->ops->check_mode(display, mode)) >> + if (!display->ops->check_mode(display->dev, mode)) >> ret = MODE_OK; >> >> return ret; >> @@ -155,7 +155,7 @@ static int exynos_drm_connector_fill_modes(struct >> drm_connector *connector, >> * resolution then get max width and height from that driver. >> */ >> if (display->ops->get_max_resol) >> - display->ops->get_max_resol(display, &width, &height); >> + display->ops->get_max_resol(display->dev, &width, >> &height); >> >> return drm_helper_probe_single_connector_modes(connector, width, >> height); >> @@ -171,7 +171,7 @@ exynos_drm_connector_detect(struct drm_connector >> *connector, bool force) >> enum drm_connector_status status = connector_status_disconnected; >> >> if (display->ops->is_connected) { >> - if (display->ops->is_connected(display)) >> + if (display->ops->is_connected(display->dev)) >> status = connector_status_connected; >> else >> status = connector_status_disconnected; >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c >> b/drivers/gpu/drm/exynos/exynos_drm_core.c >> index 0e11754..d59691d 100644 >> --- a/drivers/gpu/drm/exynos/exynos_drm_core.c >> +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c >> @@ -103,7 +103,7 @@ int exynos_drm_initialize_managers(struct drm_device >> *dev) >> >> list_for_each_entry(manager, &exynos_drm_manager_list, list) { >> if (manager->ops->initialize) { >> - ret = manager->ops->initialize(manager, dev, >> pipe); >> + ret = manager->ops->initialize(manager->dev, dev, >> pipe); >> if (ret) { >> DRM_ERROR("Mgr init [%d] failed with >> %d\n", >> manager->type, ret); >> @@ -148,7 +148,7 @@ int exynos_drm_initialize_displays(struct drm_device >> *dev) >> >> list_for_each_entry(display, &exynos_drm_display_list, list) { >> if (display->ops->initialize) { >> - ret = display->ops->initialize(display, dev); >> + ret = display->ops->initialize(display->dev, >> dev); >> if (ret) { >> DRM_ERROR("Display init [%d] failed with >> %d\n", >> display->type, ret); >> @@ -233,7 +233,7 @@ int exynos_drm_manager_register(struct >> exynos_drm_manager *manager) >> int exynos_drm_manager_unregister(struct exynos_drm_manager *manager) >> { >> if (manager->ops->remove) >> - manager->ops->remove(manager); >> + manager->ops->remove(manager->dev); >> >> list_del(&manager->list); >> return 0; >> @@ -249,7 +249,7 @@ int exynos_drm_display_register(struct >> exynos_drm_display *display) >> int exynos_drm_display_unregister(struct exynos_drm_display *display) >> { >> if (display->ops->remove) >> - display->ops->remove(display); >> + display->ops->remove(display->dev); >> >> list_del(&display->list); >> return 0; >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c >> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c >> index 100a561..f2f232e 100644 >> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c >> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c >> @@ -75,7 +75,7 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, >> int mode) >> } >> >> if (manager->ops->dpms) >> - manager->ops->dpms(manager, mode); >> + manager->ops->dpms(manager->dev, mode); >> >> exynos_crtc->dpms = mode; >> } >> @@ -95,7 +95,7 @@ static void exynos_drm_crtc_commit(struct drm_crtc >> *crtc) >> exynos_plane_commit(exynos_crtc->plane); >> >> if (manager->ops->commit) >> - manager->ops->commit(manager); >> + manager->ops->commit(manager->dev); >> >> exynos_plane_dpms(exynos_crtc->plane, DRM_MODE_DPMS_ON); >> } >> @@ -109,7 +109,8 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc, >> struct exynos_drm_manager *manager = exynos_crtc->manager; >> >> if (manager->ops->mode_fixup) >> - return manager->ops->mode_fixup(manager, mode, >> adjusted_mode); >> + return manager->ops->mode_fixup(manager->dev, mode, >> + adjusted_mode); >> >> return true; >> } >> @@ -136,7 +137,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, >> struct drm_display_mode *mode, >> crtc_h = crtc->fb->height - y; >> >> if (manager->ops->mode_set) >> - manager->ops->mode_set(manager, &crtc->mode); >> + manager->ops->mode_set(manager->dev, &crtc->mode); >> >> ret = exynos_plane_mode_set(plane, crtc, crtc->fb, 0, 0, crtc_w, >> crtc_h, >> x, y, crtc_w, crtc_h); >> @@ -390,7 +391,7 @@ int exynos_drm_crtc_enable_vblank(struct drm_device >> *dev, int pipe) >> return -EPERM; >> >> if (manager->ops->enable_vblank) >> - manager->ops->enable_vblank(manager); >> + manager->ops->enable_vblank(manager->dev); >> >> return 0; >> } >> @@ -406,7 +407,7 @@ void exynos_drm_crtc_disable_vblank(struct drm_device >> *dev, int pipe) >> return; >> >> if (manager->ops->disable_vblank) >> - manager->ops->disable_vblank(manager); >> + manager->ops->disable_vblank(manager->dev); >> } >> >> void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe) >> @@ -441,7 +442,7 @@ void exynos_drm_crtc_plane_mode_set(struct drm_crtc >> *crtc, >> struct exynos_drm_manager *manager = >> to_exynos_crtc(crtc)->manager; >> >> if (manager->ops->win_mode_set) >> - manager->ops->win_mode_set(manager, overlay); >> + manager->ops->win_mode_set(manager->dev, overlay); >> } >> >> void exynos_drm_crtc_plane_commit(struct drm_crtc *crtc, int zpos) >> @@ -449,7 +450,7 @@ void exynos_drm_crtc_plane_commit(struct drm_crtc >> *crtc, int zpos) >> struct exynos_drm_manager *manager = >> to_exynos_crtc(crtc)->manager; >> >> if (manager->ops->win_commit) >> - manager->ops->win_commit(manager, zpos); >> + manager->ops->win_commit(manager->dev, zpos); >> } >> >> void exynos_drm_crtc_plane_enable(struct drm_crtc *crtc, int zpos) >> @@ -457,7 +458,7 @@ void exynos_drm_crtc_plane_enable(struct drm_crtc >> *crtc, int zpos) >> struct exynos_drm_manager *manager = >> to_exynos_crtc(crtc)->manager; >> >> if (manager->ops->win_enable) >> - manager->ops->win_enable(manager, zpos); >> + manager->ops->win_enable(manager->dev, zpos); >> } >> >> void exynos_drm_crtc_plane_disable(struct drm_crtc *crtc, int zpos) >> @@ -465,7 +466,7 @@ void exynos_drm_crtc_plane_disable(struct drm_crtc >> *crtc, int zpos) >> struct exynos_drm_manager *manager = >> to_exynos_crtc(crtc)->manager; >> >> if (manager->ops->win_disable) >> - manager->ops->win_disable(manager, zpos); >> + manager->ops->win_disable(manager->dev, zpos); >> } >> >> void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb) >> @@ -487,6 +488,6 @@ void exynos_drm_crtc_complete_scanout(struct >> drm_framebuffer *fb) >> * real hardware. >> */ >> if (manager->ops->wait_for_vblank) >> - manager->ops->wait_for_vblank(manager); >> + manager->ops->wait_for_vblank(manager->dev); >> } >> } >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h >> b/drivers/gpu/drm/exynos/exynos_drm_drv.h >> index 97bdfcc..d92c9f9 100644 >> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h >> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h >> @@ -137,26 +137,22 @@ struct exynos_drm_overlay { >> */ >> struct exynos_drm_display; >> struct exynos_drm_display_ops { >> - int (*initialize)(struct exynos_drm_display *display, >> + int (*initialize)(struct device *dev, >> struct drm_device *drm_dev); >> - void (*remove)(struct exynos_drm_display *display); >> - bool (*is_connected)(struct exynos_drm_display *display); >> - void (*get_max_resol)(struct exynos_drm_display *display, >> - unsigned int *width, >> + void (*remove)(struct device *dev); >> + bool (*is_connected)(struct device *dev); >> + void (*get_max_resol)(struct device *dev, unsigned int *width, >> unsigned int *height); >> - struct edid *(*get_edid)(struct exynos_drm_display *display, >> + struct edid *(*get_edid)(struct device *dev, >> struct drm_connector *connector); >> - void *(*get_panel)(struct exynos_drm_display *display); >> - void (*mode_fixup)(struct exynos_drm_display *display, >> - struct drm_connector *connector, >> + void *(*get_panel)(struct device *dev); >> + void (*mode_fixup)(struct device *dev, struct drm_connector >> *connector, >> const struct drm_display_mode *mode, >> struct drm_display_mode *adjusted_mode); >> - void (*mode_set)(struct exynos_drm_display *display, >> - struct drm_display_mode *mode); >> - int (*check_mode)(struct exynos_drm_display *display, >> - struct drm_display_mode *mode); >> - void (*dpms)(struct exynos_drm_display *display, int mode); >> - void (*commit)(struct exynos_drm_display *display); >> + void (*mode_set)(struct device *dev, struct drm_display_mode >> *mode); >> + int (*check_mode)(struct device *dev, struct drm_display_mode >> *mode); >> + void (*dpms)(struct device *dev, int mode); >> + void (*commit)(struct device *dev); >> }; >> >> /* >> @@ -167,7 +163,7 @@ struct exynos_drm_display_ops { >> * @encoder: encoder object this display maps to >> * @connector: connector object this display maps to >> * @ops: pointer to callbacks for exynos drm specific functionality >> - * @ctx: A pointer to the display's implementation specific context >> + * @dev: device object of display device driver >> */ >> struct exynos_drm_display { >> struct list_head list; >> @@ -175,7 +171,7 @@ struct exynos_drm_display { >> struct drm_encoder *encoder; >> struct drm_connector *connector; >> struct exynos_drm_display_ops *ops; >> - void *ctx; >> + struct device *dev; >> }; >> >> /* >> @@ -198,24 +194,24 @@ struct exynos_drm_display { >> */ >> struct exynos_drm_manager; >> struct exynos_drm_manager_ops { >> - int (*initialize)(struct exynos_drm_manager *mgr, >> - struct drm_device *drm_dev, int pipe); >> - void (*remove)(struct exynos_drm_manager *mgr); >> - void (*dpms)(struct exynos_drm_manager *mgr, int mode); >> - bool (*mode_fixup)(struct exynos_drm_manager *mgr, >> + int (*initialize)(struct device *dev, struct drm_device *drm_dev, >> + int pipe); >> + void (*remove)(struct device *dev); >> + void (*dpms)(struct device *dev, int mode); >> + bool (*mode_fixup)(struct device *dev, >> const struct drm_display_mode *mode, >> struct drm_display_mode *adjusted_mode); >> - void (*mode_set)(struct exynos_drm_manager *mgr, >> + void (*mode_set)(struct device *dev, >> const struct drm_display_mode *mode); >> - void (*commit)(struct exynos_drm_manager *mgr); >> - int (*enable_vblank)(struct exynos_drm_manager *mgr); >> - void (*disable_vblank)(struct exynos_drm_manager *mgr); >> - void (*wait_for_vblank)(struct exynos_drm_manager *mgr); >> - void (*win_mode_set)(struct exynos_drm_manager *mgr, >> + void (*commit)(struct device *dev); >> + int (*enable_vblank)(struct device *dev); >> + void (*disable_vblank)(struct device *dev); >> + void (*wait_for_vblank)(struct device *dev); >> + void (*win_mode_set)(struct device *dev, >> struct exynos_drm_overlay *overlay); >> - void (*win_commit)(struct exynos_drm_manager *mgr, int zpos); >> - void (*win_enable)(struct exynos_drm_manager *mgr, int zpos); >> - void (*win_disable)(struct exynos_drm_manager *mgr, int zpos); >> + void (*win_commit)(struct device *dev, int zpos); >> + void (*win_enable)(struct device *dev, int zpos); >> + void (*win_disable)(struct device *dev, int zpos); >> }; >> >> /* >> @@ -226,7 +222,7 @@ struct exynos_drm_manager_ops { >> * @drm_dev: pointer to the drm device >> * @pipe: the pipe number for this crtc/manager >> * @ops: pointer to callbacks for exynos drm specific functionality >> - * @ctx: A pointer to the manager's implementation specific context >> + * @dev: device object of manager device driver >> */ >> struct exynos_drm_manager { >> struct list_head list; >> @@ -234,7 +230,7 @@ struct exynos_drm_manager { >> struct drm_device *drm_dev; >> int pipe; >> struct exynos_drm_manager_ops *ops; >> - void *ctx; >> + struct device *dev; >> }; >> >> struct exynos_drm_g2d_private { >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c >> b/drivers/gpu/drm/exynos/exynos_drm_encoder.c >> index bfa2f17..5a7342c 100644 >> --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c >> +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c >> @@ -41,7 +41,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder >> *encoder, int mode) >> DRM_DEBUG_KMS("encoder dpms: %d\n", mode); >> >> if (display->ops->dpms) >> - display->ops->dpms(display, mode); >> + display->ops->dpms(display->dev, mode); >> } >> >> static bool >> @@ -59,7 +59,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder >> *encoder, >> continue; >> >> if (display->ops->mode_fixup) >> - display->ops->mode_fixup(display, connector, >> mode, >> + display->ops->mode_fixup(display->dev, connector, >> mode, >> adjusted_mode); >> } >> >> @@ -74,7 +74,7 @@ static void exynos_drm_encoder_mode_set(struct >> drm_encoder *encoder, >> struct exynos_drm_display *display = exynos_encoder->display; >> >> if (display->ops->mode_set) >> - display->ops->mode_set(display, adjusted_mode); >> + display->ops->mode_set(display->dev, adjusted_mode); >> } >> >> static void exynos_drm_encoder_prepare(struct drm_encoder *encoder) >> @@ -88,10 +88,10 @@ static void exynos_drm_encoder_commit(struct >> drm_encoder *encoder) >> struct exynos_drm_display *display = exynos_encoder->display; >> >> if (display->ops->dpms) >> - display->ops->dpms(display, DRM_MODE_DPMS_ON); >> + display->ops->dpms(display->dev, DRM_MODE_DPMS_ON); >> >> if (display->ops->commit) >> - display->ops->commit(display); >> + display->ops->commit(display->dev); >> } >> >> static void exynos_drm_encoder_disable(struct drm_encoder *encoder) >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c >> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c >> index 03657b2..384e53b 100644 >> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c >> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c >> @@ -62,7 +62,7 @@ >> /* FIMD has totally five hardware windows. */ >> #define WINDOWS_NR 5 >> >> -#define get_fimd_manager(mgr) >> platform_get_drvdata(to_platform_device(dev)) >> +#define get_fimd_context(dev) >> platform_get_drvdata(to_platform_device(dev)) >> >> struct fimd_driver_data { >> unsigned int timing_base; >> @@ -158,22 +158,21 @@ static inline struct fimd_driver_data >> *drm_fimd_get_driver_data( >> return (struct fimd_driver_data *)of_id->data; >> } >> >> -static bool fimd_display_is_connected(struct exynos_drm_display >> *display) >> +static bool fimd_display_is_connected(struct device *dev) >> { >> /* TODO. */ >> >> return true; >> } >> >> -static void *fimd_get_panel(struct exynos_drm_display *display) >> +static void *fimd_get_panel(struct device *dev) >> { >> - struct fimd_context *ctx = display->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> >> return &ctx->panel; >> } >> >> -static int fimd_check_mode(struct exynos_drm_display *display, >> - struct drm_display_mode *mode) >> +static int fimd_check_mode(struct device *dev, struct drm_display_mode >> *mode) >> { >> /* TODO. */ >> >> @@ -191,10 +190,10 @@ static struct exynos_drm_display fimd_display = { >> .ops = &fimd_display_ops, >> }; >> >> -static void fimd_win_mode_set(struct exynos_drm_manager *mgr, >> - struct exynos_drm_overlay *overlay) >> +static void fimd_win_mode_set(struct device *dev, >> + struct exynos_drm_overlay *overlay) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> struct fimd_win_data *win_data; >> int win; >> unsigned long offset; >> @@ -337,9 +336,9 @@ static void fimd_shadow_protect_win(struct >> fimd_context *ctx, >> writel(val, ctx->regs + reg); >> } >> >> -static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos) >> +static void fimd_win_commit(struct device *dev, int zpos) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> struct fimd_win_data *win_data; >> int win = zpos; >> unsigned long val, alpha, size; >> @@ -463,9 +462,9 @@ static void fimd_win_commit(struct exynos_drm_manager >> *mgr, int zpos) >> win_data->enabled = true; >> } >> >> -static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos) >> +static void fimd_win_disable(struct device *dev, int zpos) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> struct fimd_win_data *win_data; >> int win = zpos; >> u32 val; >> @@ -504,10 +503,10 @@ static void fimd_win_disable(struct >> exynos_drm_manager *mgr, int zpos) >> win_data->enabled = false; >> } >> >> -static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, >> - struct drm_device *drm_dev, int pipe) >> +static int fimd_mgr_initialize(struct device *dev, struct drm_device >> *drm_dev, >> + int pipe) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> >> ctx->drm_dev = drm_dev; >> ctx->pipe = pipe; >> @@ -536,9 +535,9 @@ static int fimd_mgr_initialize(struct >> exynos_drm_manager *mgr, >> return 0; >> } >> >> -static void fimd_mgr_remove(struct exynos_drm_manager *mgr) >> +static void fimd_mgr_remove(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> >> if (is_drm_iommu_supported(ctx->drm_dev)) >> drm_iommu_detach_device(ctx->drm_dev, ctx->dev); >> @@ -556,9 +555,9 @@ static u32 fimd_calc_clkdiv(struct fimd_context *ctx, >> return (clkdiv < 0x100) ? clkdiv : 0xff; >> } >> >> -static bool fimd_mode_fixup(struct exynos_drm_manager *mgr, >> - const struct drm_display_mode *mode, >> - struct drm_display_mode *adjusted_mode) >> +static bool fimd_mode_fixup(struct device *dev, >> + const struct drm_display_mode *mode, >> + struct drm_display_mode *adjusted_mode) >> { >> if (adjusted_mode->vrefresh == 0) >> adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE; >> @@ -566,10 +565,10 @@ static bool fimd_mode_fixup(struct >> exynos_drm_manager *mgr, >> return true; >> } >> >> -static void fimd_mode_set(struct exynos_drm_manager *mgr, >> +static void fimd_mode_set(struct device *dev, >> const struct drm_display_mode *in_mode) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> struct fimd_mode_data *mode = &ctx->mode; >> int hblank, vblank; >> >> @@ -590,9 +589,9 @@ static void fimd_mode_set(struct exynos_drm_manager >> *mgr, >> mode->clkdiv = fimd_calc_clkdiv(ctx, in_mode); >> } >> >> -static void fimd_commit(struct exynos_drm_manager *mgr) >> +static void fimd_commit(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> struct fimd_mode_data *mode = &ctx->mode; >> struct fimd_driver_data *driver_data; >> u32 val; >> @@ -649,24 +648,24 @@ static void fimd_commit(struct exynos_drm_manager >> *mgr) >> writel(val, ctx->regs + VIDCON0); >> } >> >> -static void fimd_apply(struct exynos_drm_manager *mgr) >> +static void fimd_apply(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> struct fimd_win_data *win_data; >> int i; >> >> for (i = 0; i < WINDOWS_NR; i++) { >> win_data = &ctx->win_data[i]; >> if (win_data->enabled) >> - fimd_win_commit(mgr, i); >> + fimd_win_commit(dev, i); >> } >> >> - fimd_commit(mgr); >> + fimd_commit(dev); >> } >> >> -static int fimd_enable_vblank(struct exynos_drm_manager *mgr) >> +static int fimd_enable_vblank(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> u32 val; >> >> if (ctx->suspended) >> @@ -689,9 +688,9 @@ static int fimd_enable_vblank(struct >> exynos_drm_manager *mgr) >> return 0; >> } >> >> -static void fimd_disable_vblank(struct exynos_drm_manager *mgr) >> +static void fimd_disable_vblank(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> u32 val; >> >> if (ctx->suspended) >> @@ -707,9 +706,9 @@ static void fimd_disable_vblank(struct >> exynos_drm_manager *mgr) >> } >> } >> >> -static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr) >> +static void fimd_wait_for_vblank(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> >> if (ctx->suspended) >> return; >> @@ -726,9 +725,9 @@ static void fimd_wait_for_vblank(struct >> exynos_drm_manager *mgr) >> DRM_DEBUG_KMS("vblank wait timed out.\n"); >> } >> >> -static void fimd_window_suspend(struct exynos_drm_manager *mgr) >> +static void fimd_window_suspend(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> struct fimd_win_data *win_data; >> int i; >> >> @@ -736,14 +735,14 @@ static void fimd_window_suspend(struct >> exynos_drm_manager *mgr) >> win_data = &ctx->win_data[i]; >> win_data->resume = win_data->enabled; >> if (win_data->enabled) >> - fimd_win_disable(mgr, i); >> + fimd_win_disable(dev, i); >> } >> - fimd_wait_for_vblank(mgr); >> + fimd_wait_for_vblank(dev); >> } >> >> -static void fimd_window_resume(struct exynos_drm_manager *mgr) >> +static void fimd_window_resume(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> struct fimd_win_data *win_data; >> int i; >> >> @@ -754,9 +753,9 @@ static void fimd_window_resume(struct >> exynos_drm_manager *mgr) >> } >> } >> >> -static int fimd_poweron(struct exynos_drm_manager *mgr) >> +static int fimd_poweron(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> int ret; >> >> if (!ctx->suspended) >> @@ -780,16 +779,16 @@ static int fimd_poweron(struct exynos_drm_manager >> *mgr) >> >> /* if vblank was enabled status, enable it again. */ >> if (test_and_clear_bit(0, &ctx->irq_flags)) { >> - ret = fimd_enable_vblank(mgr); >> + ret = fimd_enable_vblank(dev); >> if (ret) { >> DRM_ERROR("Failed to re-enable vblank [%d]\n", >> ret); >> goto enable_vblank_err; >> } >> } >> >> - fimd_window_resume(mgr); >> + fimd_window_resume(dev); >> >> - fimd_apply(mgr); >> + fimd_apply(dev); >> >> return 0; >> >> @@ -802,9 +801,9 @@ bus_clk_err: >> return ret; >> } >> >> -static int fimd_poweroff(struct exynos_drm_manager *mgr) >> +static int fimd_poweroff(struct device *dev) >> { >> - struct fimd_context *ctx = mgr->ctx; >> + struct fimd_context *ctx = get_fimd_context(dev); >> >> if (ctx->suspended) >> return 0; >> @@ -814,7 +813,7 @@ static int fimd_poweroff(struct exynos_drm_manager >> *mgr) >> * suspend that connector. Otherwise we might try to scan from >> * a destroyed buffer later. >> */ >> - fimd_window_suspend(mgr); >> + fimd_window_suspend(dev); >> >> clk_disable_unprepare(ctx->lcd_clk); >> clk_disable_unprepare(ctx->bus_clk); >> @@ -825,18 +824,18 @@ static int fimd_poweroff(struct exynos_drm_manager >> *mgr) >> return 0; >> } >> >> -static void fimd_dpms(struct exynos_drm_manager *mgr, int mode) >> +static void fimd_dpms(struct device *dev, int mode) >> { >> DRM_DEBUG_KMS("%s, %d\n", __FILE__, mode); >> >> switch (mode) { >> case DRM_MODE_DPMS_ON: >> - fimd_poweron(mgr); >> + fimd_poweron(dev); >> break; >> case DRM_MODE_DPMS_STANDBY: >> case DRM_MODE_DPMS_SUSPEND: >> case DRM_MODE_DPMS_OFF: >> - fimd_poweroff(mgr); >> + fimd_poweroff(dev); >> break; >> default: >> DRM_DEBUG_KMS("unspecified mode %d\n", mode); >> @@ -985,12 +984,12 @@ static int fimd_probe(struct platform_device *pdev) >> DRM_INIT_WAITQUEUE(&ctx->wait_vsync_queue); >> atomic_set(&ctx->wait_vsync_event, 0); >> >> - platform_set_drvdata(pdev, &fimd_manager); >> + platform_set_drvdata(pdev, ctx); >> >> - fimd_manager.ctx = ctx; >> + fimd_manager.dev = dev; >> exynos_drm_manager_register(&fimd_manager); >> >> - fimd_display.ctx = ctx; >> + fimd_display.dev = dev; >> exynos_drm_display_register(&fimd_display); >> >> /* >> @@ -1010,12 +1009,13 @@ static int fimd_probe(struct platform_device >> *pdev) >> >> static int fimd_remove(struct platform_device *pdev) >> { >> - struct exynos_drm_manager *mgr = platform_get_drvdata(pdev); >> + struct device *dev = &pdev->dev; >> + struct fimd_context *ctx = platform_get_drvdata(pdev); >> >> exynos_drm_display_unregister(&fimd_display); >> exynos_drm_manager_unregister(&fimd_manager); >> >> - fimd_dpms(mgr, DRM_MODE_DPMS_OFF); >> + fimd_dpms(dev, DRM_MODE_DPMS_OFF); >> >> pm_runtime_disable(&pdev->dev); >> >> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c >> b/drivers/gpu/drm/exynos/exynos_hdmi.c >> index 130b109..32ce9a6 100644 >> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c >> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c >> @@ -45,7 +45,7 @@ >> >> #define MAX_WIDTH 1920 >> #define MAX_HEIGHT 1080 >> -#define get_hdmi_display(dev) >> platform_get_drvdata(to_platform_device(dev)) >> +#define get_hdmi_context(dev) >> platform_get_drvdata(to_platform_device(dev)) >> >> /* AVI header and aspect ratio */ >> #define HDMI_AVI_VERSION 0x02 >> @@ -739,28 +739,27 @@ static void hdmi_reg_infoframe(struct hdmi_context >> *hdata, >> } >> } >> >> -static int hdmi_initialize(struct exynos_drm_display *display, >> - struct drm_device *drm_dev) >> +static int hdmi_initialize(struct device *dev, struct drm_device >> *drm_dev) >> { >> - struct hdmi_context *hdata = display->ctx; >> + struct hdmi_context *hdata = get_hdmi_context(dev); >> >> hdata->drm_dev = drm_dev; >> >> return 0; >> } >> >> -static bool hdmi_is_connected(struct exynos_drm_display *display) >> +static bool hdmi_is_connected(struct device *dev) >> { >> - struct hdmi_context *hdata = display->ctx; >> + struct hdmi_context *hdata = get_hdmi_context(dev); >> >> return hdata->hpd; >> } >> >> -static struct edid *hdmi_get_edid(struct exynos_drm_display *display, >> - struct drm_connector *connector) >> +static struct edid *hdmi_get_edid(struct device *dev, >> + struct drm_connector *connector) >> { >> struct edid *raw_edid; >> - struct hdmi_context *hdata = display->ctx; >> + struct hdmi_context *hdata = get_hdmi_context(dev); >> >> if (!hdata->ddc_port) >> return ERR_PTR(-ENODEV); >> @@ -799,10 +798,10 @@ static int hdmi_find_phy_conf(struct hdmi_context >> *hdata, u32 pixel_clock) >> return -EINVAL; >> } >> >> -static int hdmi_check_mode(struct exynos_drm_display *display, >> +static int hdmi_check_mode(struct device *dev, >> struct drm_display_mode *mode) >> { >> - struct hdmi_context *hdata = display->ctx; >> + struct hdmi_context *hdata = get_hdmi_context(dev); >> int ret; >> >> DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", >> @@ -820,8 +819,7 @@ static int hdmi_check_mode(struct exynos_drm_display >> *display, >> return 0; >> } >> >> -static void hdmi_mode_fixup(struct exynos_drm_display *display, >> - struct drm_connector *connector, >> +static void hdmi_mode_fixup(struct device *dev, struct drm_connector >> *connector, >> const struct drm_display_mode *mode, >> struct drm_display_mode *adjusted_mode) >> { >> @@ -832,7 +830,7 @@ static void hdmi_mode_fixup(struct exynos_drm_display >> *display, >> >> drm_mode_set_crtcinfo(adjusted_mode, 0); >> >> - mode_ok = hdmi_check_mode(display, adjusted_mode); >> + mode_ok = hdmi_check_mode(dev, adjusted_mode); >> >> /* just return if user desired mode exists. */ >> if (mode_ok == 0) >> @@ -843,7 +841,7 @@ static void hdmi_mode_fixup(struct exynos_drm_display >> *display, >> * to adjusted_mode. >> */ >> list_for_each_entry(m, &connector->modes, head) { >> - mode_ok = hdmi_check_mode(display, m); >> + mode_ok = hdmi_check_mode(dev, m); >> >> if (mode_ok == 0) { >> DRM_INFO("desired mode doesn't exist so\n"); >> @@ -1683,10 +1681,9 @@ static void hdmi_v14_mode_set(struct hdmi_context >> *hdata, >> hdmi_set_reg(tg->tg_3d, 1, 0x0); >> } >> >> -static void hdmi_mode_set(struct exynos_drm_display *display, >> - struct drm_display_mode *mode) >> +static void hdmi_mode_set(struct device *dev, struct drm_display_mode >> *mode) >> { >> - struct hdmi_context *hdata = display->ctx; >> + struct hdmi_context *hdata = get_hdmi_context(dev); >> struct drm_display_mode *m = mode; >> >> DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%s\n", >> @@ -1700,16 +1697,16 @@ static void hdmi_mode_set(struct >> exynos_drm_display *display, >> hdmi_v14_mode_set(hdata, mode); >> } >> >> -static void hdmi_get_max_resol(struct exynos_drm_display *display, >> - unsigned int *width, unsigned int *height) >> +static void hdmi_get_max_resol(struct device *dev, unsigned int *width, >> + unsigned int *height) >> { >> *width = MAX_WIDTH; >> *height = MAX_HEIGHT; >> } >> >> -static void hdmi_commit(struct exynos_drm_display *display) >> +static void hdmi_commit(struct device *dev) >> { >> - struct hdmi_context *hdata = display->ctx; >> + struct hdmi_context *hdata = get_hdmi_context(dev); >> >> mutex_lock(&hdata->hdmi_mutex); >> if (!hdata->powered) { >> @@ -1721,9 +1718,9 @@ static void hdmi_commit(struct exynos_drm_display >> *display) >> hdmi_conf_apply(hdata); >> } >> >> -static void hdmi_poweron(struct exynos_drm_display *display) >> +static void hdmi_poweron(struct device *dev) >> { >> - struct hdmi_context *hdata = display->ctx; >> + struct hdmi_context *hdata = get_hdmi_context(dev); >> struct hdmi_resources *res = &hdata->res; >> >> mutex_lock(&hdata->hdmi_mutex); >> @@ -1744,12 +1741,12 @@ static void hdmi_poweron(struct >> exynos_drm_display *display) >> clk_prepare_enable(res->sclk_hdmi); >> >> hdmiphy_poweron(hdata); >> - hdmi_commit(display); >> + hdmi_commit(dev); >> } >> >> -static void hdmi_poweroff(struct exynos_drm_display *display) >> +static void hdmi_poweroff(struct device *dev) >> { >> - struct hdmi_context *hdata = display->ctx; >> + struct hdmi_context *hdata = get_hdmi_context(dev); >> struct hdmi_resources *res = &hdata->res; >> >> mutex_lock(&hdata->hdmi_mutex); >> @@ -1776,18 +1773,18 @@ out: >> mutex_unlock(&hdata->hdmi_mutex); >> } >> >> -static void hdmi_dpms(struct exynos_drm_display *display, int mode) >> +static void hdmi_dpms(struct device *dev, int mode) >> { >> DRM_DEBUG_KMS("mode %d\n", mode); >> >> switch (mode) { >> case DRM_MODE_DPMS_ON: >> - hdmi_poweron(display); >> + hdmi_poweron(dev); >> break; >> case DRM_MODE_DPMS_STANDBY: >> case DRM_MODE_DPMS_SUSPEND: >> case DRM_MODE_DPMS_OFF: >> - hdmi_poweroff(display); >> + hdmi_poweroff(dev); >> break; >> default: >> DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); >> @@ -1956,7 +1953,7 @@ static int hdmi_probe(struct platform_device *pdev) >> >> mutex_init(&hdata->hdmi_mutex); >> >> - platform_set_drvdata(pdev, &hdmi_display); >> + platform_set_drvdata(pdev, hdata); >> >> match = of_match_node(hdmi_match_types, dev->of_node); >> if (!match) >> @@ -2027,7 +2024,7 @@ static int hdmi_probe(struct platform_device *pdev) >> goto err_hdmiphy; >> } >> >> - hdmi_display.ctx = hdata; >> + hdmi_display.dev = dev; >> exynos_drm_display_register(&hdmi_display); >> >> return 0; >> @@ -2042,8 +2039,7 @@ err_ddc: >> static int hdmi_remove(struct platform_device *pdev) >> { >> struct device *dev = &pdev->dev; >> - struct exynos_drm_display *display = get_hdmi_display(dev); >> - struct hdmi_context *hdata = display->ctx; >> + struct hdmi_context *hdata = get_hdmi_context(dev); >> >> put_device(&hdata->hdmiphy_port->dev); >> put_device(&hdata->ddc_port->dev); >> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c >> b/drivers/gpu/drm/exynos/exynos_mixer.c >> index 985391d..2e8c0e8 100644 >> --- a/drivers/gpu/drm/exynos/exynos_mixer.c >> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c >> @@ -39,7 +39,7 @@ >> #include "exynos_drm_iommu.h" >> #include "exynos_mixer.h" >> >> -#define get_mixer_manager(dev) >> platform_get_drvdata(to_platform_device(dev)) >> +#define get_mixer_context(dev) >> platform_get_drvdata(to_platform_device(dev)) >> >> #define MIXER_WIN_NR 3 >> #define MIXER_DEFAULT_WIN 0 >> @@ -687,10 +687,10 @@ static void mixer_win_reset(struct mixer_context >> *ctx) >> spin_unlock_irqrestore(&res->reg_slock, flags); >> } >> >> -static int mixer_initialize(struct exynos_drm_manager *mgr, >> - struct drm_device *drm_dev, int pipe) >> +static int mixer_initialize(struct device *dev, struct drm_device >> *drm_dev, >> + int pipe) >> { >> - struct mixer_context *mixer_ctx = mgr->ctx; >> + struct mixer_context *mixer_ctx = get_mixer_context(dev); >> >> mixer_ctx->drm_dev = drm_dev; >> mixer_ctx->pipe = pipe; >> @@ -701,17 +701,17 @@ static int mixer_initialize(struct >> exynos_drm_manager *mgr, >> return drm_iommu_attach_device(mixer_ctx->drm_dev, >> mixer_ctx->dev); >> } >> >> -static void mixer_mgr_remove(struct exynos_drm_manager *mgr) >> +static void mixer_mgr_remove(struct device *dev) >> { >> - struct mixer_context *mixer_ctx = mgr->ctx; >> + struct mixer_context *mixer_ctx = get_mixer_context(dev); >> >> if (is_drm_iommu_supported(mixer_ctx->drm_dev)) >> drm_iommu_detach_device(mixer_ctx->drm_dev, >> mixer_ctx->dev); >> } >> >> -static int mixer_enable_vblank(struct exynos_drm_manager *mgr) >> +static int mixer_enable_vblank(struct device *dev) >> { >> - struct mixer_context *mixer_ctx = mgr->ctx; >> + struct mixer_context *mixer_ctx = get_mixer_context(dev); >> struct mixer_resources *res = &mixer_ctx->mixer_res; >> >> if (!mixer_ctx->powered) { >> @@ -726,19 +726,19 @@ static int mixer_enable_vblank(struct >> exynos_drm_manager *mgr) >> return 0; >> } >> >> -static void mixer_disable_vblank(struct exynos_drm_manager *mgr) >> +static void mixer_disable_vblank(struct device *dev) >> { >> - struct mixer_context *mixer_ctx = mgr->ctx; >> + struct mixer_context *mixer_ctx = get_mixer_context(dev); >> struct mixer_resources *res = &mixer_ctx->mixer_res; >> >> /* disable vsync interrupt */ >> mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC); >> } >> >> -static void mixer_win_mode_set(struct exynos_drm_manager *mgr, >> +static void mixer_win_mode_set(struct device *dev, >> struct exynos_drm_overlay *overlay) >> { >> - struct mixer_context *mixer_ctx = mgr->ctx; >> + struct mixer_context *mixer_ctx = get_mixer_context(dev); >> struct hdmi_win_data *win_data; >> int win; >> >> @@ -787,9 +787,9 @@ static void mixer_win_mode_set(struct >> exynos_drm_manager *mgr, >> win_data->scan_flags = overlay->scan_flag; >> } >> >> -static void mixer_win_commit(struct exynos_drm_manager *mgr, int zpos) >> +static void mixer_win_commit(struct device *dev, int zpos) >> { >> - struct mixer_context *mixer_ctx = mgr->ctx; >> + struct mixer_context *mixer_ctx = get_mixer_context(dev); >> int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos; >> >> DRM_DEBUG_KMS("win: %d\n", win); >> @@ -809,9 +809,9 @@ static void mixer_win_commit(struct >> exynos_drm_manager *mgr, int zpos) >> mixer_ctx->win_data[win].enabled = true; >> } >> >> -static void mixer_win_disable(struct exynos_drm_manager *mgr, int zpos) >> +static void mixer_win_disable(struct device *dev, int zpos) >> { >> - struct mixer_context *mixer_ctx = mgr->ctx; >> + struct mixer_context *mixer_ctx = get_mixer_context(dev); >> struct mixer_resources *res = &mixer_ctx->mixer_res; >> int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos; >> unsigned long flags; >> @@ -837,9 +837,9 @@ static void mixer_win_disable(struct >> exynos_drm_manager *mgr, int zpos) >> mixer_ctx->win_data[win].enabled = false; >> } >> >> -static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) >> +static void mixer_wait_for_vblank(struct device *dev) >> { >> - struct mixer_context *mixer_ctx = mgr->ctx; >> + struct mixer_context *mixer_ctx = get_mixer_context(dev); >> >> mutex_lock(&mixer_ctx->mixer_mutex); >> if (!mixer_ctx->powered) { >> @@ -860,23 +860,23 @@ static void mixer_wait_for_vblank(struct >> exynos_drm_manager *mgr) >> DRM_DEBUG_KMS("vblank wait timed out.\n"); >> } >> >> -static void mixer_window_suspend(struct exynos_drm_manager *mgr) >> +static void mixer_window_suspend(struct device *dev) >> { >> - struct mixer_context *ctx = mgr->ctx; >> + struct mixer_context *ctx = get_mixer_context(dev); >> struct hdmi_win_data *win_data; >> int i; >> >> for (i = 0; i < MIXER_WIN_NR; i++) { >> win_data = &ctx->win_data[i]; >> win_data->resume = win_data->enabled; >> - mixer_win_disable(mgr, i); >> + mixer_win_disable(dev, i); >> } >> - mixer_wait_for_vblank(mgr); >> + mixer_wait_for_vblank(dev); >> } >> >> -static void mixer_window_resume(struct exynos_drm_manager *mgr) >> +static void mixer_window_resume(struct device *dev) >> { >> - struct mixer_context *ctx = mgr->ctx; >> + struct mixer_context *ctx = get_mixer_context(dev); >> struct hdmi_win_data *win_data; >> int i; >> >> @@ -885,13 +885,13 @@ static void mixer_window_resume(struct >> exynos_drm_manager *mgr) >> win_data->enabled = win_data->resume; >> win_data->resume = false; >> if (win_data->enabled) >> - mixer_win_commit(mgr, i); >> + mixer_win_commit(dev, i); >> } >> } >> >> -static void mixer_poweron(struct exynos_drm_manager *mgr) >> +static void mixer_poweron(struct device *dev) >> { >> - struct mixer_context *ctx = mgr->ctx; >> + struct mixer_context *ctx = get_mixer_context(dev); >> struct mixer_resources *res = &ctx->mixer_res; >> >> mutex_lock(&ctx->mixer_mutex); >> @@ -913,12 +913,12 @@ static void mixer_poweron(struct exynos_drm_manager >> *mgr) >> mixer_reg_write(res, MXR_INT_EN, ctx->int_en); >> mixer_win_reset(ctx); >> >> - mixer_window_resume(mgr); >> + mixer_window_resume(dev); >> } >> >> -static void mixer_poweroff(struct exynos_drm_manager *mgr) >> +static void mixer_poweroff(struct device *dev) >> { >> - struct mixer_context *ctx = mgr->ctx; >> + struct mixer_context *ctx = get_mixer_context(dev); >> struct mixer_resources *res = &ctx->mixer_res; >> >> mutex_lock(&ctx->mixer_mutex); >> @@ -926,7 +926,7 @@ static void mixer_poweroff(struct exynos_drm_manager >> *mgr) >> goto out; >> mutex_unlock(&ctx->mixer_mutex); >> >> - mixer_window_suspend(mgr); >> + mixer_window_suspend(dev); >> >> ctx->int_en = mixer_reg_read(res, MXR_INT_EN); >> >> @@ -945,16 +945,16 @@ out: >> mutex_unlock(&ctx->mixer_mutex); >> } >> >> -static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) >> +static void mixer_dpms(struct device *dev, int mode) >> { >> switch (mode) { >> case DRM_MODE_DPMS_ON: >> - mixer_poweron(mgr); >> + mixer_poweron(dev); >> break; >> case DRM_MODE_DPMS_STANDBY: >> case DRM_MODE_DPMS_SUSPEND: >> case DRM_MODE_DPMS_OFF: >> - mixer_poweroff(mgr); >> + mixer_poweroff(dev); >> break; >> default: >> DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); >> @@ -1235,7 +1235,7 @@ static int mixer_probe(struct platform_device >> *pdev) >> } >> } >> >> - mixer_manager.ctx = ctx; >> + mixer_manager.dev = ctx->dev; >> platform_set_drvdata(pdev, &mixer_manager); >> exynos_drm_manager_register(&mixer_manager); >> >> -- >> 1.7.9.5 >> >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/dri-devel > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi, 2013/10/29 Olof Johansson <olof@lixom.net>: > On Mon, Oct 28, 2013 at 6:35 AM, Inki Dae <inki.dae@samsung.com> wrote: >> This patch makes callback funtions of each sub driver to be called >> with device object instead of display and manager. >> >> Exynos drm framework doesn't need to pass a manager or a display >> when calling callback function of each sub driver, and each sub >> driver can get its own context from device object. So this patch >> hides sub driver's context from framework. > > This is a step backwards. There should be no need to have every driver > have a full struct device associated with it, so removing the > requirement to have a struct device is the right thing to do (and this > patch undoes that). Did you look into Sean patch set? most patch set is great but some part of that patch set makes us to use tricky codes. So below is my question, 1. Where DT binding of a real device should be done in? in real device driver? or don't care wherever? My answer is that DT binding should be done in real device driver. However, now Sean patch set makes some tricky codes to be used in Exynos drm framework. I'm not sure that you had already looked into the ptn3460 lvds bridge driver but in Sean patch set, DT binding of the ptn3460 driver will be done in Exynos drm framework, not real device driver. Is that reasonable to you? And I guess the reason Sean is trying to pass manager and display into sub driver, is for using the ptn3460 driver including some tricky codes. 2. ARM SoC based DRM driver can be perfect single driver? I think most ARM SoC have separated hw resources so DRM driver for ARM couldn't be a perfect single driver. So ARM based DRM driver includes some separated device drivers, and is just used as a single driver. If you don't think so, Could you remove all stuff related to platform device from KMS drivers? If so, Where DT binding of each KMS driver should be done in? So if ARM based DRM driver cannot be a perfect single driver, and we should use DRM driver including separated device drivers then shouldn't we deal with the rule that other frameworks call some driver's callback with device object, and each device driver sets its own context into driver_data, not manager. If there is my missing something, plese give me your comments. > Sticking to the strict driver model on all display IP on SoCs is > making things overly complicated. Sean is clearly moving the Exynos > DRM in the right direction with his restructuring, so please don't > undo his work like this. Especially not without cc:ing him on the > patches. I think we had have discussions enough about this patch with Sean at other email threads, and In the email threads, I told Sean that I will post fixed patch instead of Sean. Anyway, I missed ccing him. Sorry about that. Thanks, Inki Dae > > > -Olof > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
On Tue, Oct 29, 2013 at 12:56 PM, Inki Dae <inki.dae@samsung.com> wrote: > Hi, > > 2013/10/29 Olof Johansson <olof@lixom.net>: >> On Mon, Oct 28, 2013 at 6:35 AM, Inki Dae <inki.dae@samsung.com> wrote: >>> This patch makes callback funtions of each sub driver to be called >>> with device object instead of display and manager. >>> >>> Exynos drm framework doesn't need to pass a manager or a display >>> when calling callback function of each sub driver, and each sub >>> driver can get its own context from device object. So this patch >>> hides sub driver's context from framework. >> >> This is a step backwards. There should be no need to have every driver >> have a full struct device associated with it, so removing the >> requirement to have a struct device is the right thing to do (and this >> patch undoes that). > > Did you look into Sean patch set? most patch set is great but some > part of that patch set makes us to use tricky codes. > I talked with a lot of people last week at Kernel Summit and I'll send a summary of it really soon, I think we should move exynos in that direction, but I'll just point out below, > So below is my question, > > 1. Where DT binding of a real device should be done in? in real device > driver? or don't care wherever? My answer is that DT binding should be > done in real device driver. However, now Sean patch set makes some > tricky codes to be used in Exynos drm framework. I'm not sure that you > had already looked into the ptn3460 lvds bridge driver but in Sean > patch set, DT binding of the ptn3460 driver will be done in Exynos drm > framework, not real device driver. Is that reasonable to you? And I > guess the reason Sean is trying to pass manager and display into sub > driver, is for using the ptn3460 driver including some tricky codes. There is no need to bind a Linux device to each DT node, having a separate device driver per-DT node isn't a requirement and tying the Linux device model so closely to the DT binding is a bad idea. For something like exynos (also imx, msm etc) we have a very specific set of IP blocks per SoC and a single driver that just enumerates what blocks are required using DT and gets the configuration information for the blocks from DT without binding should be fine. So if you have off-chip blocks that are separable then we would possibly do bindings to DT nodes, but it isn't essential. So I'd like to move away from the 1:1 DT node/driver model as it seriously over complicates things. We have agreed we should possibly add a display virtual node in the DT bindings for a single driver to use as a binding point. > 2. ARM SoC based DRM driver can be perfect single driver? I think most > ARM SoC have separated hw resources so DRM driver for ARM couldn't be > a perfect single driver. So ARM based DRM driver includes some > separated device drivers, and is just used as a single driver. If you > don't think so, Could you remove all stuff related to platform device > from KMS drivers? If so, Where DT binding of each KMS driver should be > done in? So if ARM based DRM driver cannot be a perfect single > driver, and we should use DRM driver including separated device > drivers then shouldn't we deal with the rule that other frameworks > call some driver's callback with device object, and each device driver > sets its own context into driver_data, not manager. > > If there is my missing something, plese give me your comments. > I'll follow up later, but yes a single driver is what we should aim for in cases where the blocks are quite coherent and all from a single source. Dave.
Hi Dave, 2013/10/29 Dave Airlie <airlied@gmail.com>: > On Tue, Oct 29, 2013 at 12:56 PM, Inki Dae <inki.dae@samsung.com> wrote: >> Hi, >> >> 2013/10/29 Olof Johansson <olof@lixom.net>: >>> On Mon, Oct 28, 2013 at 6:35 AM, Inki Dae <inki.dae@samsung.com> wrote: >>>> This patch makes callback funtions of each sub driver to be called >>>> with device object instead of display and manager. >>>> >>>> Exynos drm framework doesn't need to pass a manager or a display >>>> when calling callback function of each sub driver, and each sub >>>> driver can get its own context from device object. So this patch >>>> hides sub driver's context from framework. >>> >>> This is a step backwards. There should be no need to have every driver >>> have a full struct device associated with it, so removing the >>> requirement to have a struct device is the right thing to do (and this >>> patch undoes that). >> >> Did you look into Sean patch set? most patch set is great but some >> part of that patch set makes us to use tricky codes. >> > > I talked with a lot of people last week at Kernel Summit and I'll send > a summary of it really soon, > > I think we should move exynos in that direction, but I'll just point out below, >> So below is my question, >> >> 1. Where DT binding of a real device should be done in? in real device >> driver? or don't care wherever? My answer is that DT binding should be >> done in real device driver. However, now Sean patch set makes some >> tricky codes to be used in Exynos drm framework. I'm not sure that you >> had already looked into the ptn3460 lvds bridge driver but in Sean >> patch set, DT binding of the ptn3460 driver will be done in Exynos drm >> framework, not real device driver. Is that reasonable to you? And I >> guess the reason Sean is trying to pass manager and display into sub >> driver, is for using the ptn3460 driver including some tricky codes. > > There is no need to bind a Linux device to each DT node, having a separate > device driver per-DT node isn't a requirement and tying the Linux device model > so closely to the DT binding is a bad idea. For something like exynos (also imx, > msm etc) we have a very specific set of IP blocks per SoC and a single driver > that just enumerates what blocks are required using DT and gets the > configuration > information for the blocks from DT without binding should be fine. > > So if you have off-chip blocks that are separable then we would > possibly do bindings Yes, We have no the off-chip blocks. > to DT nodes, but it isn't essential. So I'd like to move away from the > 1:1 DT node/driver > model as it seriously over complicates things. We have agreed we > should possibly add > a display virtual node in the DT bindings for a single driver to use > as a binding point. Got it and thanks you for comments. The display virtual node seems similar to super node posted by Russell King so just my concern is that the display virtual node can be accepted by device tree people. Anyway, I'll remove this patch. I really wish that the display virtual node can lead us to more perfect world. Thanks, Inki Dae > > >> 2. ARM SoC based DRM driver can be perfect single driver? I think most >> ARM SoC have separated hw resources so DRM driver for ARM couldn't be >> a perfect single driver. So ARM based DRM driver includes some >> separated device drivers, and is just used as a single driver. If you >> don't think so, Could you remove all stuff related to platform device >> from KMS drivers? If so, Where DT binding of each KMS driver should be >> done in? So if ARM based DRM driver cannot be a perfect single >> driver, and we should use DRM driver including separated device >> drivers then shouldn't we deal with the rule that other frameworks >> call some driver's callback with device object, and each device driver >> sets its own context into driver_data, not manager. >> >> If there is my missing something, plese give me your comments. >> > I'll follow up later, but yes a single driver is what we should aim for in > cases where the blocks are quite coherent and all from a single source. > > Dave. > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> >> to DT nodes, but it isn't essential. So I'd like to move away from the >> 1:1 DT node/driver >> model as it seriously over complicates things. We have agreed we >> should possibly add >> a display virtual node in the DT bindings for a single driver to use >> as a binding point. > > Got it and thanks you for comments. The display virtual node seems > similar to super node posted by Russell King so just my concern is > that the display virtual node can be accepted by device tree people. > Anyway, I'll remove this patch. I really wish that the display virtual > node can lead us to more perfect world. Just to confirm, Grant Likely was in the room for the discussion was quite happy to add them. Dave.
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 9a16dbe..d13f637 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c @@ -46,7 +46,7 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) * because lcd panel has only one mode. */ if (display->ops->get_edid) { - edid = display->ops->get_edid(display, connector); + edid = display->ops->get_edid(display->dev, connector); if (IS_ERR_OR_NULL(edid)) { ret = PTR_ERR(edid); edid = NULL; @@ -70,7 +70,7 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) } if (display->ops->get_panel) - panel = display->ops->get_panel(display); + panel = display->ops->get_panel(display->dev); else { drm_mode_destroy(connector->dev, mode); return 0; @@ -105,7 +105,7 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector, DRM_DEBUG_KMS("%s\n", __FILE__); if (display->ops->check_mode) - if (!display->ops->check_mode(display, mode)) + if (!display->ops->check_mode(display->dev, mode)) ret = MODE_OK; return ret; @@ -155,7 +155,7 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector, * resolution then get max width and height from that driver. */ if (display->ops->get_max_resol) - display->ops->get_max_resol(display, &width, &height); + display->ops->get_max_resol(display->dev, &width, &height); return drm_helper_probe_single_connector_modes(connector, width, height); @@ -171,7 +171,7 @@ exynos_drm_connector_detect(struct drm_connector *connector, bool force) enum drm_connector_status status = connector_status_disconnected; if (display->ops->is_connected) { - if (display->ops->is_connected(display)) + if (display->ops->is_connected(display->dev)) status = connector_status_connected; else status = connector_status_disconnected; diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 0e11754..d59691d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -103,7 +103,7 @@ int exynos_drm_initialize_managers(struct drm_device *dev) list_for_each_entry(manager, &exynos_drm_manager_list, list) { if (manager->ops->initialize) { - ret = manager->ops->initialize(manager, dev, pipe); + ret = manager->ops->initialize(manager->dev, dev, pipe); if (ret) { DRM_ERROR("Mgr init [%d] failed with %d\n", manager->type, ret); @@ -148,7 +148,7 @@ int exynos_drm_initialize_displays(struct drm_device *dev) list_for_each_entry(display, &exynos_drm_display_list, list) { if (display->ops->initialize) { - ret = display->ops->initialize(display, dev); + ret = display->ops->initialize(display->dev, dev); if (ret) { DRM_ERROR("Display init [%d] failed with %d\n", display->type, ret); @@ -233,7 +233,7 @@ int exynos_drm_manager_register(struct exynos_drm_manager *manager) int exynos_drm_manager_unregister(struct exynos_drm_manager *manager) { if (manager->ops->remove) - manager->ops->remove(manager); + manager->ops->remove(manager->dev); list_del(&manager->list); return 0; @@ -249,7 +249,7 @@ int exynos_drm_display_register(struct exynos_drm_display *display) int exynos_drm_display_unregister(struct exynos_drm_display *display) { if (display->ops->remove) - display->ops->remove(display); + display->ops->remove(display->dev); list_del(&display->list); return 0; diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 100a561..f2f232e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -75,7 +75,7 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) } if (manager->ops->dpms) - manager->ops->dpms(manager, mode); + manager->ops->dpms(manager->dev, mode); exynos_crtc->dpms = mode; } @@ -95,7 +95,7 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc) exynos_plane_commit(exynos_crtc->plane); if (manager->ops->commit) - manager->ops->commit(manager); + manager->ops->commit(manager->dev); exynos_plane_dpms(exynos_crtc->plane, DRM_MODE_DPMS_ON); } @@ -109,7 +109,8 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc, struct exynos_drm_manager *manager = exynos_crtc->manager; if (manager->ops->mode_fixup) - return manager->ops->mode_fixup(manager, mode, adjusted_mode); + return manager->ops->mode_fixup(manager->dev, mode, + adjusted_mode); return true; } @@ -136,7 +137,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, crtc_h = crtc->fb->height - y; if (manager->ops->mode_set) - manager->ops->mode_set(manager, &crtc->mode); + manager->ops->mode_set(manager->dev, &crtc->mode); ret = exynos_plane_mode_set(plane, crtc, crtc->fb, 0, 0, crtc_w, crtc_h, x, y, crtc_w, crtc_h); @@ -390,7 +391,7 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe) return -EPERM; if (manager->ops->enable_vblank) - manager->ops->enable_vblank(manager); + manager->ops->enable_vblank(manager->dev); return 0; } @@ -406,7 +407,7 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe) return; if (manager->ops->disable_vblank) - manager->ops->disable_vblank(manager); + manager->ops->disable_vblank(manager->dev); } void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe) @@ -441,7 +442,7 @@ void exynos_drm_crtc_plane_mode_set(struct drm_crtc *crtc, struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager; if (manager->ops->win_mode_set) - manager->ops->win_mode_set(manager, overlay); + manager->ops->win_mode_set(manager->dev, overlay); } void exynos_drm_crtc_plane_commit(struct drm_crtc *crtc, int zpos) @@ -449,7 +450,7 @@ void exynos_drm_crtc_plane_commit(struct drm_crtc *crtc, int zpos) struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager; if (manager->ops->win_commit) - manager->ops->win_commit(manager, zpos); + manager->ops->win_commit(manager->dev, zpos); } void exynos_drm_crtc_plane_enable(struct drm_crtc *crtc, int zpos) @@ -457,7 +458,7 @@ void exynos_drm_crtc_plane_enable(struct drm_crtc *crtc, int zpos) struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager; if (manager->ops->win_enable) - manager->ops->win_enable(manager, zpos); + manager->ops->win_enable(manager->dev, zpos); } void exynos_drm_crtc_plane_disable(struct drm_crtc *crtc, int zpos) @@ -465,7 +466,7 @@ void exynos_drm_crtc_plane_disable(struct drm_crtc *crtc, int zpos) struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager; if (manager->ops->win_disable) - manager->ops->win_disable(manager, zpos); + manager->ops->win_disable(manager->dev, zpos); } void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb) @@ -487,6 +488,6 @@ void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb) * real hardware. */ if (manager->ops->wait_for_vblank) - manager->ops->wait_for_vblank(manager); + manager->ops->wait_for_vblank(manager->dev); } } diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 97bdfcc..d92c9f9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -137,26 +137,22 @@ struct exynos_drm_overlay { */ struct exynos_drm_display; struct exynos_drm_display_ops { - int (*initialize)(struct exynos_drm_display *display, + int (*initialize)(struct device *dev, struct drm_device *drm_dev); - void (*remove)(struct exynos_drm_display *display); - bool (*is_connected)(struct exynos_drm_display *display); - void (*get_max_resol)(struct exynos_drm_display *display, - unsigned int *width, + void (*remove)(struct device *dev); + bool (*is_connected)(struct device *dev); + void (*get_max_resol)(struct device *dev, unsigned int *width, unsigned int *height); - struct edid *(*get_edid)(struct exynos_drm_display *display, + struct edid *(*get_edid)(struct device *dev, struct drm_connector *connector); - void *(*get_panel)(struct exynos_drm_display *display); - void (*mode_fixup)(struct exynos_drm_display *display, - struct drm_connector *connector, + void *(*get_panel)(struct device *dev); + void (*mode_fixup)(struct device *dev, struct drm_connector *connector, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); - void (*mode_set)(struct exynos_drm_display *display, - struct drm_display_mode *mode); - int (*check_mode)(struct exynos_drm_display *display, - struct drm_display_mode *mode); - void (*dpms)(struct exynos_drm_display *display, int mode); - void (*commit)(struct exynos_drm_display *display); + void (*mode_set)(struct device *dev, struct drm_display_mode *mode); + int (*check_mode)(struct device *dev, struct drm_display_mode *mode); + void (*dpms)(struct device *dev, int mode); + void (*commit)(struct device *dev); }; /* @@ -167,7 +163,7 @@ struct exynos_drm_display_ops { * @encoder: encoder object this display maps to * @connector: connector object this display maps to * @ops: pointer to callbacks for exynos drm specific functionality - * @ctx: A pointer to the display's implementation specific context + * @dev: device object of display device driver */ struct exynos_drm_display { struct list_head list; @@ -175,7 +171,7 @@ struct exynos_drm_display { struct drm_encoder *encoder; struct drm_connector *connector; struct exynos_drm_display_ops *ops; - void *ctx; + struct device *dev; }; /* @@ -198,24 +194,24 @@ struct exynos_drm_display { */ struct exynos_drm_manager; struct exynos_drm_manager_ops { - int (*initialize)(struct exynos_drm_manager *mgr, - struct drm_device *drm_dev, int pipe); - void (*remove)(struct exynos_drm_manager *mgr); - void (*dpms)(struct exynos_drm_manager *mgr, int mode); - bool (*mode_fixup)(struct exynos_drm_manager *mgr, + int (*initialize)(struct device *dev, struct drm_device *drm_dev, + int pipe); + void (*remove)(struct device *dev); + void (*dpms)(struct device *dev, int mode); + bool (*mode_fixup)(struct device *dev, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); - void (*mode_set)(struct exynos_drm_manager *mgr, + void (*mode_set)(struct device *dev, const struct drm_display_mode *mode); - void (*commit)(struct exynos_drm_manager *mgr); - int (*enable_vblank)(struct exynos_drm_manager *mgr); - void (*disable_vblank)(struct exynos_drm_manager *mgr); - void (*wait_for_vblank)(struct exynos_drm_manager *mgr); - void (*win_mode_set)(struct exynos_drm_manager *mgr, + void (*commit)(struct device *dev); + int (*enable_vblank)(struct device *dev); + void (*disable_vblank)(struct device *dev); + void (*wait_for_vblank)(struct device *dev); + void (*win_mode_set)(struct device *dev, struct exynos_drm_overlay *overlay); - void (*win_commit)(struct exynos_drm_manager *mgr, int zpos); - void (*win_enable)(struct exynos_drm_manager *mgr, int zpos); - void (*win_disable)(struct exynos_drm_manager *mgr, int zpos); + void (*win_commit)(struct device *dev, int zpos); + void (*win_enable)(struct device *dev, int zpos); + void (*win_disable)(struct device *dev, int zpos); }; /* @@ -226,7 +222,7 @@ struct exynos_drm_manager_ops { * @drm_dev: pointer to the drm device * @pipe: the pipe number for this crtc/manager * @ops: pointer to callbacks for exynos drm specific functionality - * @ctx: A pointer to the manager's implementation specific context + * @dev: device object of manager device driver */ struct exynos_drm_manager { struct list_head list; @@ -234,7 +230,7 @@ struct exynos_drm_manager { struct drm_device *drm_dev; int pipe; struct exynos_drm_manager_ops *ops; - void *ctx; + struct device *dev; }; struct exynos_drm_g2d_private { diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index bfa2f17..5a7342c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -41,7 +41,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) DRM_DEBUG_KMS("encoder dpms: %d\n", mode); if (display->ops->dpms) - display->ops->dpms(display, mode); + display->ops->dpms(display->dev, mode); } static bool @@ -59,7 +59,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, continue; if (display->ops->mode_fixup) - display->ops->mode_fixup(display, connector, mode, + display->ops->mode_fixup(display->dev, connector, mode, adjusted_mode); } @@ -74,7 +74,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, struct exynos_drm_display *display = exynos_encoder->display; if (display->ops->mode_set) - display->ops->mode_set(display, adjusted_mode); + display->ops->mode_set(display->dev, adjusted_mode); } static void exynos_drm_encoder_prepare(struct drm_encoder *encoder) @@ -88,10 +88,10 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder) struct exynos_drm_display *display = exynos_encoder->display; if (display->ops->dpms) - display->ops->dpms(display, DRM_MODE_DPMS_ON); + display->ops->dpms(display->dev, DRM_MODE_DPMS_ON); if (display->ops->commit) - display->ops->commit(display); + display->ops->commit(display->dev); } static void exynos_drm_encoder_disable(struct drm_encoder *encoder) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 03657b2..384e53b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -62,7 +62,7 @@ /* FIMD has totally five hardware windows. */ #define WINDOWS_NR 5 -#define get_fimd_manager(mgr) platform_get_drvdata(to_platform_device(dev)) +#define get_fimd_context(dev) platform_get_drvdata(to_platform_device(dev)) struct fimd_driver_data { unsigned int timing_base; @@ -158,22 +158,21 @@ static inline struct fimd_driver_data *drm_fimd_get_driver_data( return (struct fimd_driver_data *)of_id->data; } -static bool fimd_display_is_connected(struct exynos_drm_display *display) +static bool fimd_display_is_connected(struct device *dev) { /* TODO. */ return true; } -static void *fimd_get_panel(struct exynos_drm_display *display) +static void *fimd_get_panel(struct device *dev) { - struct fimd_context *ctx = display->ctx; + struct fimd_context *ctx = get_fimd_context(dev); return &ctx->panel; } -static int fimd_check_mode(struct exynos_drm_display *display, - struct drm_display_mode *mode) +static int fimd_check_mode(struct device *dev, struct drm_display_mode *mode) { /* TODO. */ @@ -191,10 +190,10 @@ static struct exynos_drm_display fimd_display = { .ops = &fimd_display_ops, }; -static void fimd_win_mode_set(struct exynos_drm_manager *mgr, - struct exynos_drm_overlay *overlay) +static void fimd_win_mode_set(struct device *dev, + struct exynos_drm_overlay *overlay) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); struct fimd_win_data *win_data; int win; unsigned long offset; @@ -337,9 +336,9 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx, writel(val, ctx->regs + reg); } -static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos) +static void fimd_win_commit(struct device *dev, int zpos) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); struct fimd_win_data *win_data; int win = zpos; unsigned long val, alpha, size; @@ -463,9 +462,9 @@ static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos) win_data->enabled = true; } -static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos) +static void fimd_win_disable(struct device *dev, int zpos) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); struct fimd_win_data *win_data; int win = zpos; u32 val; @@ -504,10 +503,10 @@ static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos) win_data->enabled = false; } -static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, - struct drm_device *drm_dev, int pipe) +static int fimd_mgr_initialize(struct device *dev, struct drm_device *drm_dev, + int pipe) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); ctx->drm_dev = drm_dev; ctx->pipe = pipe; @@ -536,9 +535,9 @@ static int fimd_mgr_initialize(struct exynos_drm_manager *mgr, return 0; } -static void fimd_mgr_remove(struct exynos_drm_manager *mgr) +static void fimd_mgr_remove(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); if (is_drm_iommu_supported(ctx->drm_dev)) drm_iommu_detach_device(ctx->drm_dev, ctx->dev); @@ -556,9 +555,9 @@ static u32 fimd_calc_clkdiv(struct fimd_context *ctx, return (clkdiv < 0x100) ? clkdiv : 0xff; } -static bool fimd_mode_fixup(struct exynos_drm_manager *mgr, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static bool fimd_mode_fixup(struct device *dev, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) { if (adjusted_mode->vrefresh == 0) adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE; @@ -566,10 +565,10 @@ static bool fimd_mode_fixup(struct exynos_drm_manager *mgr, return true; } -static void fimd_mode_set(struct exynos_drm_manager *mgr, +static void fimd_mode_set(struct device *dev, const struct drm_display_mode *in_mode) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); struct fimd_mode_data *mode = &ctx->mode; int hblank, vblank; @@ -590,9 +589,9 @@ static void fimd_mode_set(struct exynos_drm_manager *mgr, mode->clkdiv = fimd_calc_clkdiv(ctx, in_mode); } -static void fimd_commit(struct exynos_drm_manager *mgr) +static void fimd_commit(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); struct fimd_mode_data *mode = &ctx->mode; struct fimd_driver_data *driver_data; u32 val; @@ -649,24 +648,24 @@ static void fimd_commit(struct exynos_drm_manager *mgr) writel(val, ctx->regs + VIDCON0); } -static void fimd_apply(struct exynos_drm_manager *mgr) +static void fimd_apply(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); struct fimd_win_data *win_data; int i; for (i = 0; i < WINDOWS_NR; i++) { win_data = &ctx->win_data[i]; if (win_data->enabled) - fimd_win_commit(mgr, i); + fimd_win_commit(dev, i); } - fimd_commit(mgr); + fimd_commit(dev); } -static int fimd_enable_vblank(struct exynos_drm_manager *mgr) +static int fimd_enable_vblank(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); u32 val; if (ctx->suspended) @@ -689,9 +688,9 @@ static int fimd_enable_vblank(struct exynos_drm_manager *mgr) return 0; } -static void fimd_disable_vblank(struct exynos_drm_manager *mgr) +static void fimd_disable_vblank(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); u32 val; if (ctx->suspended) @@ -707,9 +706,9 @@ static void fimd_disable_vblank(struct exynos_drm_manager *mgr) } } -static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr) +static void fimd_wait_for_vblank(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); if (ctx->suspended) return; @@ -726,9 +725,9 @@ static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr) DRM_DEBUG_KMS("vblank wait timed out.\n"); } -static void fimd_window_suspend(struct exynos_drm_manager *mgr) +static void fimd_window_suspend(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); struct fimd_win_data *win_data; int i; @@ -736,14 +735,14 @@ static void fimd_window_suspend(struct exynos_drm_manager *mgr) win_data = &ctx->win_data[i]; win_data->resume = win_data->enabled; if (win_data->enabled) - fimd_win_disable(mgr, i); + fimd_win_disable(dev, i); } - fimd_wait_for_vblank(mgr); + fimd_wait_for_vblank(dev); } -static void fimd_window_resume(struct exynos_drm_manager *mgr) +static void fimd_window_resume(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); struct fimd_win_data *win_data; int i; @@ -754,9 +753,9 @@ static void fimd_window_resume(struct exynos_drm_manager *mgr) } } -static int fimd_poweron(struct exynos_drm_manager *mgr) +static int fimd_poweron(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); int ret; if (!ctx->suspended) @@ -780,16 +779,16 @@ static int fimd_poweron(struct exynos_drm_manager *mgr) /* if vblank was enabled status, enable it again. */ if (test_and_clear_bit(0, &ctx->irq_flags)) { - ret = fimd_enable_vblank(mgr); + ret = fimd_enable_vblank(dev); if (ret) { DRM_ERROR("Failed to re-enable vblank [%d]\n", ret); goto enable_vblank_err; } } - fimd_window_resume(mgr); + fimd_window_resume(dev); - fimd_apply(mgr); + fimd_apply(dev); return 0; @@ -802,9 +801,9 @@ bus_clk_err: return ret; } -static int fimd_poweroff(struct exynos_drm_manager *mgr) +static int fimd_poweroff(struct device *dev) { - struct fimd_context *ctx = mgr->ctx; + struct fimd_context *ctx = get_fimd_context(dev); if (ctx->suspended) return 0; @@ -814,7 +813,7 @@ static int fimd_poweroff(struct exynos_drm_manager *mgr) * suspend that connector. Otherwise we might try to scan from * a destroyed buffer later. */ - fimd_window_suspend(mgr); + fimd_window_suspend(dev); clk_disable_unprepare(ctx->lcd_clk); clk_disable_unprepare(ctx->bus_clk); @@ -825,18 +824,18 @@ static int fimd_poweroff(struct exynos_drm_manager *mgr) return 0; } -static void fimd_dpms(struct exynos_drm_manager *mgr, int mode) +static void fimd_dpms(struct device *dev, int mode) { DRM_DEBUG_KMS("%s, %d\n", __FILE__, mode); switch (mode) { case DRM_MODE_DPMS_ON: - fimd_poweron(mgr); + fimd_poweron(dev); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - fimd_poweroff(mgr); + fimd_poweroff(dev); break; default: DRM_DEBUG_KMS("unspecified mode %d\n", mode); @@ -985,12 +984,12 @@ static int fimd_probe(struct platform_device *pdev) DRM_INIT_WAITQUEUE(&ctx->wait_vsync_queue); atomic_set(&ctx->wait_vsync_event, 0); - platform_set_drvdata(pdev, &fimd_manager); + platform_set_drvdata(pdev, ctx); - fimd_manager.ctx = ctx; + fimd_manager.dev = dev; exynos_drm_manager_register(&fimd_manager); - fimd_display.ctx = ctx; + fimd_display.dev = dev; exynos_drm_display_register(&fimd_display); /* @@ -1010,12 +1009,13 @@ static int fimd_probe(struct platform_device *pdev) static int fimd_remove(struct platform_device *pdev) { - struct exynos_drm_manager *mgr = platform_get_drvdata(pdev); + struct device *dev = &pdev->dev; + struct fimd_context *ctx = platform_get_drvdata(pdev); exynos_drm_display_unregister(&fimd_display); exynos_drm_manager_unregister(&fimd_manager); - fimd_dpms(mgr, DRM_MODE_DPMS_OFF); + fimd_dpms(dev, DRM_MODE_DPMS_OFF); pm_runtime_disable(&pdev->dev); diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 130b109..32ce9a6 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -45,7 +45,7 @@ #define MAX_WIDTH 1920 #define MAX_HEIGHT 1080 -#define get_hdmi_display(dev) platform_get_drvdata(to_platform_device(dev)) +#define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) /* AVI header and aspect ratio */ #define HDMI_AVI_VERSION 0x02 @@ -739,28 +739,27 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, } } -static int hdmi_initialize(struct exynos_drm_display *display, - struct drm_device *drm_dev) +static int hdmi_initialize(struct device *dev, struct drm_device *drm_dev) { - struct hdmi_context *hdata = display->ctx; + struct hdmi_context *hdata = get_hdmi_context(dev); hdata->drm_dev = drm_dev; return 0; } -static bool hdmi_is_connected(struct exynos_drm_display *display) +static bool hdmi_is_connected(struct device *dev) { - struct hdmi_context *hdata = display->ctx; + struct hdmi_context *hdata = get_hdmi_context(dev); return hdata->hpd; } -static struct edid *hdmi_get_edid(struct exynos_drm_display *display, - struct drm_connector *connector) +static struct edid *hdmi_get_edid(struct device *dev, + struct drm_connector *connector) { struct edid *raw_edid; - struct hdmi_context *hdata = display->ctx; + struct hdmi_context *hdata = get_hdmi_context(dev); if (!hdata->ddc_port) return ERR_PTR(-ENODEV); @@ -799,10 +798,10 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock) return -EINVAL; } -static int hdmi_check_mode(struct exynos_drm_display *display, +static int hdmi_check_mode(struct device *dev, struct drm_display_mode *mode) { - struct hdmi_context *hdata = display->ctx; + struct hdmi_context *hdata = get_hdmi_context(dev); int ret; DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", @@ -820,8 +819,7 @@ static int hdmi_check_mode(struct exynos_drm_display *display, return 0; } -static void hdmi_mode_fixup(struct exynos_drm_display *display, - struct drm_connector *connector, +static void hdmi_mode_fixup(struct device *dev, struct drm_connector *connector, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { @@ -832,7 +830,7 @@ static void hdmi_mode_fixup(struct exynos_drm_display *display, drm_mode_set_crtcinfo(adjusted_mode, 0); - mode_ok = hdmi_check_mode(display, adjusted_mode); + mode_ok = hdmi_check_mode(dev, adjusted_mode); /* just return if user desired mode exists. */ if (mode_ok == 0) @@ -843,7 +841,7 @@ static void hdmi_mode_fixup(struct exynos_drm_display *display, * to adjusted_mode. */ list_for_each_entry(m, &connector->modes, head) { - mode_ok = hdmi_check_mode(display, m); + mode_ok = hdmi_check_mode(dev, m); if (mode_ok == 0) { DRM_INFO("desired mode doesn't exist so\n"); @@ -1683,10 +1681,9 @@ static void hdmi_v14_mode_set(struct hdmi_context *hdata, hdmi_set_reg(tg->tg_3d, 1, 0x0); } -static void hdmi_mode_set(struct exynos_drm_display *display, - struct drm_display_mode *mode) +static void hdmi_mode_set(struct device *dev, struct drm_display_mode *mode) { - struct hdmi_context *hdata = display->ctx; + struct hdmi_context *hdata = get_hdmi_context(dev); struct drm_display_mode *m = mode; DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%s\n", @@ -1700,16 +1697,16 @@ static void hdmi_mode_set(struct exynos_drm_display *display, hdmi_v14_mode_set(hdata, mode); } -static void hdmi_get_max_resol(struct exynos_drm_display *display, - unsigned int *width, unsigned int *height) +static void hdmi_get_max_resol(struct device *dev, unsigned int *width, + unsigned int *height) { *width = MAX_WIDTH; *height = MAX_HEIGHT; } -static void hdmi_commit(struct exynos_drm_display *display) +static void hdmi_commit(struct device *dev) { - struct hdmi_context *hdata = display->ctx; + struct hdmi_context *hdata = get_hdmi_context(dev); mutex_lock(&hdata->hdmi_mutex); if (!hdata->powered) { @@ -1721,9 +1718,9 @@ static void hdmi_commit(struct exynos_drm_display *display) hdmi_conf_apply(hdata); } -static void hdmi_poweron(struct exynos_drm_display *display) +static void hdmi_poweron(struct device *dev) { - struct hdmi_context *hdata = display->ctx; + struct hdmi_context *hdata = get_hdmi_context(dev); struct hdmi_resources *res = &hdata->res; mutex_lock(&hdata->hdmi_mutex); @@ -1744,12 +1741,12 @@ static void hdmi_poweron(struct exynos_drm_display *display) clk_prepare_enable(res->sclk_hdmi); hdmiphy_poweron(hdata); - hdmi_commit(display); + hdmi_commit(dev); } -static void hdmi_poweroff(struct exynos_drm_display *display) +static void hdmi_poweroff(struct device *dev) { - struct hdmi_context *hdata = display->ctx; + struct hdmi_context *hdata = get_hdmi_context(dev); struct hdmi_resources *res = &hdata->res; mutex_lock(&hdata->hdmi_mutex); @@ -1776,18 +1773,18 @@ out: mutex_unlock(&hdata->hdmi_mutex); } -static void hdmi_dpms(struct exynos_drm_display *display, int mode) +static void hdmi_dpms(struct device *dev, int mode) { DRM_DEBUG_KMS("mode %d\n", mode); switch (mode) { case DRM_MODE_DPMS_ON: - hdmi_poweron(display); + hdmi_poweron(dev); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - hdmi_poweroff(display); + hdmi_poweroff(dev); break; default: DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); @@ -1956,7 +1953,7 @@ static int hdmi_probe(struct platform_device *pdev) mutex_init(&hdata->hdmi_mutex); - platform_set_drvdata(pdev, &hdmi_display); + platform_set_drvdata(pdev, hdata); match = of_match_node(hdmi_match_types, dev->of_node); if (!match) @@ -2027,7 +2024,7 @@ static int hdmi_probe(struct platform_device *pdev) goto err_hdmiphy; } - hdmi_display.ctx = hdata; + hdmi_display.dev = dev; exynos_drm_display_register(&hdmi_display); return 0; @@ -2042,8 +2039,7 @@ err_ddc: static int hdmi_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct exynos_drm_display *display = get_hdmi_display(dev); - struct hdmi_context *hdata = display->ctx; + struct hdmi_context *hdata = get_hdmi_context(dev); put_device(&hdata->hdmiphy_port->dev); put_device(&hdata->ddc_port->dev); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 985391d..2e8c0e8 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -39,7 +39,7 @@ #include "exynos_drm_iommu.h" #include "exynos_mixer.h" -#define get_mixer_manager(dev) platform_get_drvdata(to_platform_device(dev)) +#define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) #define MIXER_WIN_NR 3 #define MIXER_DEFAULT_WIN 0 @@ -687,10 +687,10 @@ static void mixer_win_reset(struct mixer_context *ctx) spin_unlock_irqrestore(&res->reg_slock, flags); } -static int mixer_initialize(struct exynos_drm_manager *mgr, - struct drm_device *drm_dev, int pipe) +static int mixer_initialize(struct device *dev, struct drm_device *drm_dev, + int pipe) { - struct mixer_context *mixer_ctx = mgr->ctx; + struct mixer_context *mixer_ctx = get_mixer_context(dev); mixer_ctx->drm_dev = drm_dev; mixer_ctx->pipe = pipe; @@ -701,17 +701,17 @@ static int mixer_initialize(struct exynos_drm_manager *mgr, return drm_iommu_attach_device(mixer_ctx->drm_dev, mixer_ctx->dev); } -static void mixer_mgr_remove(struct exynos_drm_manager *mgr) +static void mixer_mgr_remove(struct device *dev) { - struct mixer_context *mixer_ctx = mgr->ctx; + struct mixer_context *mixer_ctx = get_mixer_context(dev); if (is_drm_iommu_supported(mixer_ctx->drm_dev)) drm_iommu_detach_device(mixer_ctx->drm_dev, mixer_ctx->dev); } -static int mixer_enable_vblank(struct exynos_drm_manager *mgr) +static int mixer_enable_vblank(struct device *dev) { - struct mixer_context *mixer_ctx = mgr->ctx; + struct mixer_context *mixer_ctx = get_mixer_context(dev); struct mixer_resources *res = &mixer_ctx->mixer_res; if (!mixer_ctx->powered) { @@ -726,19 +726,19 @@ static int mixer_enable_vblank(struct exynos_drm_manager *mgr) return 0; } -static void mixer_disable_vblank(struct exynos_drm_manager *mgr) +static void mixer_disable_vblank(struct device *dev) { - struct mixer_context *mixer_ctx = mgr->ctx; + struct mixer_context *mixer_ctx = get_mixer_context(dev); struct mixer_resources *res = &mixer_ctx->mixer_res; /* disable vsync interrupt */ mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC); } -static void mixer_win_mode_set(struct exynos_drm_manager *mgr, +static void mixer_win_mode_set(struct device *dev, struct exynos_drm_overlay *overlay) { - struct mixer_context *mixer_ctx = mgr->ctx; + struct mixer_context *mixer_ctx = get_mixer_context(dev); struct hdmi_win_data *win_data; int win; @@ -787,9 +787,9 @@ static void mixer_win_mode_set(struct exynos_drm_manager *mgr, win_data->scan_flags = overlay->scan_flag; } -static void mixer_win_commit(struct exynos_drm_manager *mgr, int zpos) +static void mixer_win_commit(struct device *dev, int zpos) { - struct mixer_context *mixer_ctx = mgr->ctx; + struct mixer_context *mixer_ctx = get_mixer_context(dev); int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos; DRM_DEBUG_KMS("win: %d\n", win); @@ -809,9 +809,9 @@ static void mixer_win_commit(struct exynos_drm_manager *mgr, int zpos) mixer_ctx->win_data[win].enabled = true; } -static void mixer_win_disable(struct exynos_drm_manager *mgr, int zpos) +static void mixer_win_disable(struct device *dev, int zpos) { - struct mixer_context *mixer_ctx = mgr->ctx; + struct mixer_context *mixer_ctx = get_mixer_context(dev); struct mixer_resources *res = &mixer_ctx->mixer_res; int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos; unsigned long flags; @@ -837,9 +837,9 @@ static void mixer_win_disable(struct exynos_drm_manager *mgr, int zpos) mixer_ctx->win_data[win].enabled = false; } -static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) +static void mixer_wait_for_vblank(struct device *dev) { - struct mixer_context *mixer_ctx = mgr->ctx; + struct mixer_context *mixer_ctx = get_mixer_context(dev); mutex_lock(&mixer_ctx->mixer_mutex); if (!mixer_ctx->powered) { @@ -860,23 +860,23 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) DRM_DEBUG_KMS("vblank wait timed out.\n"); } -static void mixer_window_suspend(struct exynos_drm_manager *mgr) +static void mixer_window_suspend(struct device *dev) { - struct mixer_context *ctx = mgr->ctx; + struct mixer_context *ctx = get_mixer_context(dev); struct hdmi_win_data *win_data; int i; for (i = 0; i < MIXER_WIN_NR; i++) { win_data = &ctx->win_data[i]; win_data->resume = win_data->enabled; - mixer_win_disable(mgr, i); + mixer_win_disable(dev, i); } - mixer_wait_for_vblank(mgr); + mixer_wait_for_vblank(dev); } -static void mixer_window_resume(struct exynos_drm_manager *mgr) +static void mixer_window_resume(struct device *dev) { - struct mixer_context *ctx = mgr->ctx; + struct mixer_context *ctx = get_mixer_context(dev); struct hdmi_win_data *win_data; int i; @@ -885,13 +885,13 @@ static void mixer_window_resume(struct exynos_drm_manager *mgr) win_data->enabled = win_data->resume; win_data->resume = false; if (win_data->enabled) - mixer_win_commit(mgr, i); + mixer_win_commit(dev, i); } } -static void mixer_poweron(struct exynos_drm_manager *mgr) +static void mixer_poweron(struct device *dev) { - struct mixer_context *ctx = mgr->ctx; + struct mixer_context *ctx = get_mixer_context(dev); struct mixer_resources *res = &ctx->mixer_res; mutex_lock(&ctx->mixer_mutex); @@ -913,12 +913,12 @@ static void mixer_poweron(struct exynos_drm_manager *mgr) mixer_reg_write(res, MXR_INT_EN, ctx->int_en); mixer_win_reset(ctx); - mixer_window_resume(mgr); + mixer_window_resume(dev); } -static void mixer_poweroff(struct exynos_drm_manager *mgr) +static void mixer_poweroff(struct device *dev) { - struct mixer_context *ctx = mgr->ctx; + struct mixer_context *ctx = get_mixer_context(dev); struct mixer_resources *res = &ctx->mixer_res; mutex_lock(&ctx->mixer_mutex); @@ -926,7 +926,7 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) goto out; mutex_unlock(&ctx->mixer_mutex); - mixer_window_suspend(mgr); + mixer_window_suspend(dev); ctx->int_en = mixer_reg_read(res, MXR_INT_EN); @@ -945,16 +945,16 @@ out: mutex_unlock(&ctx->mixer_mutex); } -static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) +static void mixer_dpms(struct device *dev, int mode) { switch (mode) { case DRM_MODE_DPMS_ON: - mixer_poweron(mgr); + mixer_poweron(dev); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - mixer_poweroff(mgr); + mixer_poweroff(dev); break; default: DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); @@ -1235,7 +1235,7 @@ static int mixer_probe(struct platform_device *pdev) } } - mixer_manager.ctx = ctx; + mixer_manager.dev = ctx->dev; platform_set_drvdata(pdev, &mixer_manager); exynos_drm_manager_register(&mixer_manager);