drm/exynos: Refactor parts of the exynos driver
Subsystems (6)
cover drm/exynos: Refactor parts of the exynos driver
This patchset refactors parts of the exynos driver to move it closer to a proper drm driver (rather than just implementing a drm layer on top of the hardware drivers). The hope is to get to a point where the dp/hdmi drivers can implement drm_connector/drm_encoder directly, and fimd/mixer can directly implement drm_crtc.
The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic manager/display handling
Sean
Daniel Kurtz (1):
drm/exynos: hdmi: remove the i2c drivers and use devtree
Sean Paul (21):
drm/exynos: Merge overlay_ops into manager_ops drm/exynos: Add an initialize function to manager and display drm/exynos: Use manager_op initialize in fimd drm/exynos: hdmi: Implement initialize op for hdmi drm/exynos: Pass context in manager ops instead of dev drm/exynos: Pass context in display_ops instead of dev drm/exynos: Remove dpms link between encoder/connector drm/exynos: Rename display_op power_on to dpms drm/exynos: Don't keep dpms state in encoder drm/exynos: Use unsigned long for possible_crtcs drm/exynos: Split manager/display/subdrv drm/exynos: Remove exynos_drm_hdmi shim
drm/exynos: Use drm_mode_copy to copy modes drm/exynos: Disable unused crtc planes from crtc drm/exynos: Add mode_set manager operation drm/exynos: Implement mode_fixup manager operation drm/exynos: Use mode_set to configure fimd drm/exynos: Remove unused/useless fimd_context members drm/exynos: Move dp driver from video/ to drm/ drm/exynos: Move display implementation into dp
ARM: dts: Move display-timings node from fimd to dp
Stéphane Marchesin (1):
drm/exynos: Remove useless slab.h include
.../devicetree/bindings/video/exynos_dp.txt | 17 + .../devicetree/bindings/video/samsung-fimd.txt | 2 + arch/arm/boot/dts/exynos5250-arndale.dts | 7 +- arch/arm/boot/dts/exynos5250-smdk5250.dts | 7 +- arch/arm/boot/dts/exynos5250-snow.dts | 7 +- arch/arm/boot/dts/exynos5420-smdk5420.dts | 7 +- drivers/gpu/drm/exynos/Kconfig | 7 + drivers/gpu/drm/exynos/Makefile | 5 +- drivers/gpu/drm/exynos/exynos_ddc.c | 63 - drivers/gpu/drm/exynos/exynos_dp_core.c | 1281 ++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_dp_core.h | 215 ++++ drivers/gpu/drm/exynos/exynos_dp_reg.c | 1245 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_dp_reg.h | 366 ++++++ drivers/gpu/drm/exynos/exynos_drm_connector.c | 92 +- drivers/gpu/drm/exynos/exynos_drm_connector.h | 4 - drivers/gpu/drm/exynos/exynos_drm_core.c | 181 ++- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 140 ++- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 20 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 58 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 147 ++- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 356 +----- drivers/gpu/drm/exynos/exynos_drm_encoder.h | 18 +- drivers/gpu/drm/exynos/exynos_drm_fb.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 699 +++++------ drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 439 ------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 67 - drivers/gpu/drm/exynos/exynos_drm_plane.c | 17 +- drivers/gpu/drm/exynos/exynos_drm_plane.h | 2 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 97 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 169 +-- drivers/gpu/drm/exynos/exynos_hdmi.h | 23 - drivers/gpu/drm/exynos/exynos_hdmiphy.c | 65 - drivers/gpu/drm/exynos/exynos_mixer.c | 165 ++- drivers/gpu/drm/exynos/exynos_mixer.h | 20 + drivers/video/exynos/Kconfig | 7 - drivers/video/exynos/Makefile | 1 - drivers/video/exynos/exynos_dp_core.c | 1214 ------------------- drivers/video/exynos/exynos_dp_core.h | 210 ---- drivers/video/exynos/exynos_dp_reg.c | 1245 ------------------- drivers/video/exynos/exynos_dp_reg.h | 366 ------ 40 files changed, 4162 insertions(+), 4893 deletions(-) delete mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.c create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.h create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.c create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.h delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.c delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.h delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c create mode 100644 drivers/gpu/drm/exynos/exynos_mixer.h delete mode 100644 drivers/video/exynos/exynos_dp_core.c delete mode 100644 drivers/video/exynos/exynos_dp_core.h delete mode 100644 drivers/video/exynos/exynos_dp_reg.c delete mode 100644 drivers/video/exynos/exynos_dp_reg.h
Signature · 6 lines
1.8.4 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/23 drm/exynos: Remove useless slab.h include
From: Stéphane Marchesin <[email protected]>
--- drivers/video/exynos/exynos_dp_core.c | 1 - 1 file changed, 1 deletion(-)
drivers/video/exynos/exynos_dp_core.c +0 -1
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/platform_device.h> -#include <linux/slab.h> #include <linux/err.h> #include <linux/clk.h> #include <linux/io.h>
Signature · 6 lines
1.8.4 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/23 drm/exynos: Merge overlay_ops into manager_ops
In reply to Sean PaulThis patch merges overlay_ops into manager_ops. In all cases, overlay_ops is implemented in the same place as manager ops, it doesn't serve a functional purpose, and doesn't make things more clear.
--- drivers/gpu/drm/exynos/exynos_drm_drv.h | 29 +-- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 26 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 363 ++++++++++++++-------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 36 ++- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 29 +-- drivers/gpu/drm/exynos/exynos_mixer.c | 2 - 6 files changed, 229 insertions(+), 256 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.h +9 -20
@@ -54,22 +54,6 @@ enum exynos_drm_output_type { };/* -* Exynos drm overlay ops structure. -* -* @mode_set: copy drm overlay info to hw specific overlay info. -* @commit: apply hardware specific overlay data to registers. -* @enable: enable hardware specific overlay. -* @disable: disable hardware specific overlay. -*/ -struct exynos_drm_overlay_ops { -void (*mode_set)(struct device *subdrv_dev, -struct exynos_drm_overlay *overlay); -void (*commit)(struct device *subdrv_dev,int zpos); -void (*enable)(struct device *subdrv_dev,int zpos); -void (*disable)(struct device *subdrv_dev,int zpos); -}; - -/* * Exynos drm common overlay structure. * * @fb_x: offset x on a framebuffer to be displayed.
@@ -169,6 +153,10 @@ struct exynos_drm_display_ops {* @disable_vblank: specific driver callback for disabling vblank interrupt. * @wait_for_vblank: wait for vblank interrupt to make sure that * hardware overlay is updated. +* @win_mode_set: copy drm overlay info to hw specific overlay info. +* @win_commit: apply hardware specific overlay data to registers. +* @win_enable: enable hardware specific overlay. +* @win_disable: disable hardware specific overlay. */ struct exynos_drm_manager_ops {void (*dpms)(struct device *subdrv_dev,int mode);
@@ -184,6 +172,11 @@ struct exynos_drm_manager_ops {int (*enable_vblank)(struct device *subdrv_dev);void (*disable_vblank)(struct device *subdrv_dev);void (*wait_for_vblank)(struct device *subdrv_dev); +void (*win_mode_set)(struct device *subdrv_dev, +struct exynos_drm_overlay *overlay); +void (*win_commit)(struct device *subdrv_dev,int zpos); +void (*win_enable)(struct device *subdrv_dev,int zpos); +void (*win_disable)(struct device *subdrv_dev,int zpos); };/*
@@ -195,9 +188,6 @@ struct exynos_drm_manager_ops {* @ops: pointer to callbacks for exynos drm specific framebuffer. * these callbacks should be set by specific drivers such fimd * or hdmi driver and are used to control hardware global registers. -* @overlay_ops: pointer to callbacks for exynos drm specific framebuffer. -* these callbacks should be set by specific drivers such fimd -* or hdmi driver and are used to control hardware overlay reigsters. * @display: pointer to callbacks for exynos drm specific framebuffer. * these callbacks should be set by specific drivers such fimd * or hdmi driver and are used to control display devices such as
@@ -207,7 +197,6 @@ struct exynos_drm_manager {struct device *dev;int pipe;struct exynos_drm_manager_ops *ops; -struct exynos_drm_overlay_ops *overlay_ops;struct exynos_drm_display_ops *display_ops; };
drivers/gpu/drm/exynos/exynos_drm_encoder.c +13 -13
@@ -133,7 +133,7 @@ static void disable_plane_to_crtc(struct drm_device *dev,* * plane->funcs->disable_plane call checks * if encoder->crtc is same as plane->crtc and if same -* then overlay_ops->disable callback will be called +* then manager_ops->win_disable callback will be called * to diasble current hw overlay so plane->crtc should * have new_crtc because new_crtc was set to * encoder->crtc in advance.
@@ -442,51 +442,51 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data) {struct exynos_drm_manager *manager =to_exynos_encoder (encoder)->manager; -struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; +struct exynos_drm_manager_ops *manager_ops = manager->ops;struct exynos_drm_overlay *overlay = data; -if (overlay_ops && overlay_ops->mode_set) - overlay_ops->mode_set (manager->dev, overlay); +if (manager_ops && manager_ops->win_mode_set) + manager_ops->win_mode_set (manager->dev, overlay); }void exynos_drm_encoder_plane_commit (struct drm_encoder *encoder,void *data) {struct exynos_drm_manager *manager =to_exynos_encoder (encoder)->manager; -struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; +struct exynos_drm_manager_ops *manager_ops = manager->ops;int zpos =DEFAULT_ZPOS ;if (data) zpos = *(int *)data; -if (overlay_ops && overlay_ops->commit) - overlay_ops->commit (manager->dev, zpos); +if (manager_ops && manager_ops->win_commit) + manager_ops->win_commit (manager->dev, zpos); }void exynos_drm_encoder_plane_enable (struct drm_encoder *encoder,void *data) {struct exynos_drm_manager *manager =to_exynos_encoder (encoder)->manager; -struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; +struct exynos_drm_manager_ops *manager_ops = manager->ops;int zpos =DEFAULT_ZPOS ;if (data) zpos = *(int *)data; -if (overlay_ops && overlay_ops->enable) - overlay_ops->enable (manager->dev, zpos); +if (manager_ops && manager_ops->win_enable) + manager_ops->win_enable (manager->dev, zpos); }void exynos_drm_encoder_plane_disable (struct drm_encoder *encoder,void *data) {struct exynos_drm_manager *manager =to_exynos_encoder (encoder)->manager; -struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; +struct exynos_drm_manager_ops *manager_ops = manager->ops;int zpos =DEFAULT_ZPOS ;if (data) zpos = *(int *)data; -if (overlay_ops && overlay_ops->disable) - overlay_ops->disable (manager->dev, zpos); +if (manager_ops && manager_ops->win_disable) + manager_ops->win_disable (manager->dev, zpos); }
drivers/gpu/drm/exynos/exynos_drm_fimd.c +179 -184
380 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +16 -20
@@ -284,19 +284,7 @@ static void drm_hdmi_apply(struct device *subdrv_dev) hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static struct exynos_drm_manager_ops drm_hdmi_manager_ops = { - .dpms = drm_hdmi_dpms, - .apply = drm_hdmi_apply, - .enable_vblank = drm_hdmi_enable_vblank, - .disable_vblank = drm_hdmi_disable_vblank, - .wait_for_vblank = drm_hdmi_wait_for_vblank, - .mode_fixup = drm_hdmi_mode_fixup, - .mode_set = drm_hdmi_mode_set, - .get_max_resol = drm_hdmi_get_max_resol, - .commit = drm_hdmi_commit, -}; - -static void drm_mixer_mode_set (struct device *subdrv_dev, +static void drm_mixer_win_mode_set (struct device *subdrv_dev,struct exynos_drm_overlay *overlay) {struct drm_hdmi_context *ctx =to_context (subdrv_dev);
@@ -305,7 +293,7 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, mixer_ops->win_mode_set (ctx->mixer_ctx->ctx, overlay); } -static void drm_mixer_commit (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_commit (struct device *subdrv_dev,int zpos) {struct drm_hdmi_context *ctx =to_context (subdrv_dev);int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;
@@ -321,7 +309,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) ctx->enabled[win] = true; } -static void drm_mixer_disable (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_disable (struct device *subdrv_dev,int zpos) {struct drm_hdmi_context *ctx =to_context (subdrv_dev);int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;
@@ -337,16 +325,24 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) ctx->enabled[win] = false; } -static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { - .mode_set = drm_mixer_mode_set, - .commit = drm_mixer_commit, - .disable = drm_mixer_disable, +static struct exynos_drm_manager_ops drm_hdmi_manager_ops = { + .dpms = drm_hdmi_dpms, + .apply = drm_hdmi_apply, + .enable_vblank = drm_hdmi_enable_vblank, + .disable_vblank = drm_hdmi_disable_vblank, + .wait_for_vblank = drm_hdmi_wait_for_vblank, + .mode_fixup = drm_hdmi_mode_fixup, + .mode_set = drm_hdmi_mode_set, + .get_max_resol = drm_hdmi_get_max_resol, + .commit = drm_hdmi_commit, + .win_mode_set = drm_mixer_win_mode_set, + .win_commit = drm_mixer_win_commit, + .win_disable = drm_mixer_win_disable, };static struct exynos_drm_manager hdmi_manager = { .pipe =-1 , .ops = &drm_hdmi_manager_ops, - .overlay_ops = &drm_hdmi_overlay_ops, .display_ops = &drm_hdmi_display_ops, };
drivers/gpu/drm/exynos/exynos_drm_vidi.c +12 -17
@@ -182,14 +182,13 @@ static void vidi_apply(struct device *subdrv_dev)struct vidi_context *ctx =get_vidi_context (subdrv_dev);struct exynos_drm_manager *mgr = ctx->subdrv.manager;struct exynos_drm_manager_ops *mgr_ops = mgr->ops; -struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops;struct vidi_win_data *win_data;int i;for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i]; -if (win_data->enabled && (ovl_ops && ovl_ops->commit)) - ovl_ops->commit (subdrv_dev, i); +if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) + mgr_ops->win_commit (subdrv_dev, i); }if (mgr_ops && mgr_ops->commit)
@@ -219,7 +218,7 @@ static int vidi_enable_vblank(struct device *dev)/* * in case of page flip request, vidi_finish_pageflip function * will not be called because direct_vblank is true and then -* that function will be called by overlay_ops->commit callback +* that function will be called by manager_ops->win_commit callback */ schedule_work (&ctx->work);
@@ -237,14 +236,6 @@ static void vidi_disable_vblank(struct device *dev) ctx->vblank_on = false; } -static struct exynos_drm_manager_ops vidi_manager_ops = { - .dpms = vidi_dpms, - .apply = vidi_apply, - .commit = vidi_commit, - .enable_vblank = vidi_enable_vblank, - .disable_vblank = vidi_disable_vblank, -}; -static void vidi_win_mode_set (struct device *dev,struct exynos_drm_overlay *overlay) {
@@ -341,16 +332,20 @@ static void vidi_win_disable(struct device *dev, int zpos)/* TODO. */ } -static struct exynos_drm_overlay_ops vidi_overlay_ops = { - .mode_set = vidi_win_mode_set, - .commit = vidi_win_commit, - .disable = vidi_win_disable, +static struct exynos_drm_manager_ops vidi_manager_ops = { + .dpms = vidi_dpms, + .apply = vidi_apply, + .commit = vidi_commit, + .enable_vblank = vidi_enable_vblank, + .disable_vblank = vidi_disable_vblank, + .win_mode_set = vidi_win_mode_set, + .win_commit = vidi_win_commit, + .win_disable = vidi_win_disable, };static struct exynos_drm_manager vidi_manager = { .pipe =-1 , .ops = &vidi_manager_ops, - .overlay_ops = &vidi_overlay_ops, .display_ops = &vidi_display_ops, };
drivers/gpu/drm/exynos/exynos_mixer.c +0 -2
@@ -975,8 +975,6 @@ static struct exynos_mixer_ops mixer_ops = { .disable_vblank = mixer_disable_vblank, .wait_for_vblank = mixer_wait_for_vblank, .dpms = mixer_dpms, - -/* overlay */ .win_mode_set = mixer_win_mode_set, .win_commit = mixer_win_commit, .win_disable = mixer_win_disable,
Signature · 1 line
1.8.4
PATCH 3/23 drm/exynos: Add an initialize function to manager and display
In reply to Sean PaulThis patch adds an initialize function to the manager and display operations. This allows them to keep track of drm_device in their local context, as well as adds an initialization hook right after the encoder is created.
--- drivers/gpu/drm/exynos/exynos_drm_drv.h | 5 +++++ drivers/gpu/drm/exynos/exynos_drm_encoder.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_drv.h +5 -0
@@ -123,6 +123,7 @@ struct exynos_drm_overlay {* - this structure is common to analog tv, digital tv and lcd panel. * * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI. +* @initialize: initializes the display with drm_dev * @is_connected: check for that display is connected or not. * @get_edid: get edid modes from display driver. * @get_panel: get panel object from display driver.
@@ -131,6 +132,7 @@ struct exynos_drm_overlay {*/ struct exynos_drm_display_ops {enum exynos_drm_output_type type; +int (*initialize)(struct device *dev,struct drm_device *drm_dev);bool (*is_connected)(struct device *dev);struct edid *(*get_edid)(struct device *dev,struct drm_connector *connector);
@@ -142,6 +144,7 @@ struct exynos_drm_display_ops {/* * Exynos drm manager ops * +* @initialize: initializes the manager with drm_dev * @dpms: control device power. * @apply: set timing, vblank and overlay data to registers. * @mode_fixup: fix mode data comparing to hw specific display mode.
@@ -159,6 +162,8 @@ struct exynos_drm_display_ops {* @win_disable: disable hardware specific overlay. */ struct exynos_drm_manager_ops { +int (*initialize)(struct device *subdrv_dev, +struct drm_device *drm_dev);void (*dpms)(struct device *subdrv_dev,int mode);void (*apply)(struct device *subdrv_dev); void (*mode_fixup)(struct device *subdrv_dev,
drivers/gpu/drm/exynos/exynos_drm_encoder.c +21 -0
@@ -316,6 +316,7 @@ exynos_drm_encoder_create(struct drm_device *dev, {struct drm_encoder *encoder;struct exynos_drm_encoder *exynos_encoder; +int ret;if (!manager || !possible_crtcs)return NULL ;
@@ -339,9 +340,29 @@ exynos_drm_encoder_create(struct drm_device *dev,drm_encoder_helper_add (encoder, &exynos_encoder_helper_funcs); +if (manager->ops && manager->ops->initialize) { + ret = manager->ops->initialize (manager->dev, dev); +if (ret) { +DRM_ERROR ("Manager initialize failed %d\n" , ret); + goto error; + } + } + +if (manager->display_ops && manager->display_ops->initialize) { + ret = manager->display_ops->initialize (manager->dev, dev); +if (ret) { +DRM_ERROR ("Display initialize failed %d\n" , ret); + goto error; + } + } +DRM_DEBUG_KMS ("encoder has been created\n" );return encoder; + +error: +exynos_drm_encoder_destroy (&exynos_encoder->drm_encoder); +return NULL ; }struct exynos_drm_manager *exynos_drm_get_manager (struct drm_encoder *encoder)
Signature · 1 line
1.8.4
PATCH 4/23 drm/exynos: Use manager_op initialize in fimd
In reply to Sean PaulThis patch implements the intitialize manager op in fimd.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +15 -4
@@ -106,6 +106,7 @@ struct fimd_win_data {struct fimd_context {struct exynos_drm_subdrv subdrv; +struct drm_device *drm_dev;int irq;struct drm_crtc *crtc;struct clk *bus_clk;
@@ -490,6 +491,16 @@ static void fimd_win_disable(struct device *dev, int zpos) win_data->enabled = false; } +static int fimd_mgr_initialize (struct device *subdrv_dev, +struct drm_device *drm_dev) +{ +struct fimd_context *ctx =get_fimd_context (subdrv_dev); + + ctx->drm_dev = drm_dev; + +return 0 ; +} +static void fimd_dpms (struct device *subdrv_dev,int mode) {struct fimd_context *ctx =get_fimd_context (subdrv_dev);
@@ -660,6 +671,7 @@ static void fimd_wait_for_vblank(struct device *dev) }static struct exynos_drm_manager_ops fimd_manager_ops = { + .initialize = fimd_mgr_initialize, .dpms = fimd_dpms, .apply = fimd_apply, .commit = fimd_commit,
@@ -681,7 +693,6 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) {struct fimd_context *ctx = (struct fimd_context *)dev_id;struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct drm_device *drm_dev = subdrv->drm_dev;struct exynos_drm_manager *manager = subdrv->manager;u32 val;
@@ -692,11 +703,11 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)writel (VIDINTCON1_INT_FRAME , ctx->regs +VIDINTCON1 );/* check the crtc is detached already from encoder */ -if (manager->pipe <0 ) +if (manager->pipe <0 || !ctx->drm_dev) goto out; -drm_handle_vblank (drm_dev, manager->pipe); -exynos_drm_crtc_finish_pageflip (drm_dev, manager->pipe); +drm_handle_vblank (ctx->drm_dev, manager->pipe); +exynos_drm_crtc_finish_pageflip (ctx->drm_dev, manager->pipe);/* set wait vsync event to zero and wake up queue. */ if (atomic_read (&ctx->wait_vsync_event)) {
Signature · 1 line
1.8.4
PATCH 5/23 drm/exynos: hdmi: Implement initialize op for hdmi
In reply to Sean PaulThis patch implements the initialize callback in the hdmi and mixer manager. This allows us to get rid of drm_dev in the drm_hdmi level and track it in the mixer and hdmi drivers. This is one of the things holding back the complete removal of the drm_hdmi layer.
--- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 35 ++++++++++++++++++++++++++------ drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 3 ++- drivers/gpu/drm/exynos/exynos_hdmi.c | 18 ++++++++++++---- drivers/gpu/drm/exynos/exynos_mixer.c | 35 +++++++++++++++++++------------- 4 files changed, 66 insertions(+), 25 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +29 -6
@@ -97,6 +97,18 @@ void exynos_mixer_ops_register(struct exynos_mixer_ops *ops) mixer_ops = ops; } +static int drm_hdmi_display_initialize (struct device *dev, +struct drm_device *drm_dev) +{ +struct drm_hdmi_context *ctx =to_context (dev); + +if (hdmi_ops && hdmi_ops->initialize) +return hdmi_ops->initialize (ctx->hdmi_ctx->ctx, drm_dev); + +return 0 ; +} + +static bool drm_hdmi_is_connected (struct device *dev) {struct drm_hdmi_context *ctx =to_context (dev);
@@ -153,6 +165,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode)static struct exynos_drm_display_ops drm_hdmi_display_ops = { .type =EXYNOS_DISPLAY_TYPE_HDMI , + .initialize = drm_hdmi_display_initialize, .is_connected = drm_hdmi_is_connected, .get_edid = drm_hdmi_get_edid, .check_mode = drm_hdmi_check_mode,
@@ -257,6 +270,21 @@ static void drm_hdmi_commit(struct device *subdrv_dev) hdmi_ops->commit (ctx->hdmi_ctx->ctx); } +static int drm_hdmi_mgr_initialize (struct device *subdrv_dev, +struct drm_device *drm_dev) +{ +struct drm_hdmi_context *ctx =to_context (subdrv_dev); +int ret =0 ; + +if (mixer_ops && mixer_ops->initialize) + ret = mixer_ops->initialize (ctx->mixer_ctx->ctx, drm_dev); + +if (mixer_ops->iommu_on) + mixer_ops->iommu_on (ctx->mixer_ctx->ctx, true); + +return ret; +} +static void drm_hdmi_dpms (struct device *subdrv_dev,int mode) {struct drm_hdmi_context *ctx =to_context (subdrv_dev);
@@ -326,6 +354,7 @@ static void drm_mixer_win_disable(struct device *subdrv_dev, int zpos) }static struct exynos_drm_manager_ops drm_hdmi_manager_ops = { + .initialize = drm_hdmi_mgr_initialize, .dpms = drm_hdmi_dpms, .apply = drm_hdmi_apply, .enable_vblank = drm_hdmi_enable_vblank,
@@ -372,12 +401,6 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev, ctx->hdmi_ctx = hdmi_ctx; ctx->mixer_ctx = mixer_ctx; - ctx->hdmi_ctx->drm_dev = drm_dev; - ctx->mixer_ctx->drm_dev = drm_dev; - -if (mixer_ops->iommu_on) - mixer_ops->iommu_on (ctx->mixer_ctx->ctx, true); -return 0 ; }
drivers/gpu/drm/exynos/exynos_drm_hdmi.h +2 -1
@@ -23,12 +23,12 @@* this context should be hdmi_context or mixer_context. */ struct exynos_drm_hdmi_context { -struct drm_device *drm_dev;void *ctx; };struct exynos_hdmi_ops {/* display */ +int (*initialize)(void *ctx,struct drm_device *drm_dev);bool (*is_connected)(void *ctx);struct edid *(*get_edid)(void *ctx,struct drm_connector *connector);
@@ -45,6 +45,7 @@ struct exynos_hdmi_ops {struct exynos_mixer_ops {/* manager */ +int (*initialize)(void *ctx,struct drm_device *drm_dev);int (*iommu_on)(void *ctx,bool enable);int (*enable_vblank)(void *ctx,int pipe);void (*disable_vblank)(void *ctx);
drivers/gpu/drm/exynos/exynos_hdmi.c +14 -4
@@ -742,6 +742,15 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, } } +static int hdmi_initialize (void *ctx,struct drm_device *drm_dev) +{ +struct hdmi_context *hdata = ctx; + + hdata->drm_dev = drm_dev; + +return 0 ; +} +static bool hdmi_is_connected (void *ctx) {struct hdmi_context *hdata = ctx;
@@ -1747,6 +1756,7 @@ static void hdmi_dpms(void *ctx, int mode)static struct exynos_hdmi_ops hdmi_ops = {/* display */ + .initialize = hdmi_initialize, .is_connected = hdmi_is_connected, .get_edid = hdmi_get_edid, .check_mode = hdmi_check_mode,
@@ -1767,8 +1777,8 @@ static irqreturn_t hdmi_irq_thread(int irq, void *arg) hdata->hpd =gpio_get_value (hdata->hpd_gpio);mutex_unlock (&hdata->hdmi_mutex); -if (ctx->drm_dev) -drm_helper_hpd_irq_event (ctx->drm_dev); +if (hdata->drm_dev) +drm_helper_hpd_irq_event (hdata->drm_dev);return IRQ_HANDLED ; }
@@ -2026,8 +2036,8 @@ static int hdmi_suspend(struct device *dev)disable_irq (hdata->irq); hdata->hpd = false; -if (ctx->drm_dev) -drm_helper_hpd_irq_event (ctx->drm_dev); +if (hdata->drm_dev) +drm_helper_hpd_irq_event (hdata->drm_dev);if (pm_runtime_suspended (dev)) {DRM_DEBUG_KMS ("Already suspended\n" );
drivers/gpu/drm/exynos/exynos_mixer.c +21 -14
@@ -685,20 +685,25 @@ static void mixer_win_reset(struct mixer_context *ctx)spin_unlock_irqrestore (&res->reg_slock, flags); } +static int mixer_initialize (void *ctx,struct drm_device *drm_dev) +{ +struct mixer_context *mixer_ctx = ctx; + + mixer_ctx->drm_dev = drm_dev; + +return 0 ; +} +static int mixer_iommu_on (void *ctx,bool enable) { -struct exynos_drm_hdmi_context *drm_hdmi_ctx;struct mixer_context *mdata = ctx; -struct drm_device *drm_dev; - - drm_hdmi_ctx = mdata->parent_ctx; - drm_dev = drm_hdmi_ctx->drm_dev; -if (is_drm_iommu_supported (drm_dev)) { +if (is_drm_iommu_supported (mdata->drm_dev)) {if (enable) -return drm_iommu_attach_device (drm_dev, mdata->dev); +return drm_iommu_attach_device (mdata->drm_dev, + mdata->dev); -drm_iommu_detach_device (drm_dev, mdata->dev); +drm_iommu_detach_device (mdata->drm_dev, mdata->dev); }return 0 ; }
@@ -970,6 +975,7 @@ static void mixer_dpms(void *ctx, int mode)static struct exynos_mixer_ops mixer_ops = {/* manager */ + .initialize = mixer_initialize, .iommu_on = mixer_iommu_on, .enable_vblank = mixer_enable_vblank, .disable_vblank = mixer_disable_vblank,
@@ -985,8 +991,7 @@ static struct exynos_mixer_ops mixer_ops = {static irqreturn_t mixer_irq_handler (int irq,void *arg) { -struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; -struct mixer_context *ctx = drm_hdmi_ctx->ctx; +struct mixer_context *ctx = arg;struct mixer_resources *res = &ctx->mixer_res;u32 val, base, shadow;
@@ -995,6 +1000,9 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg)/* read interrupt status for handling and clearing flags for VSYNC */ val =mixer_reg_read (res,MXR_INT_STATUS ); +if (!ctx->drm_dev) + goto out; +/* handling VSYNC */ if (val &MXR_INT_STATUS_VSYNC ) {/* interlace scan need to check shadow register */
@@ -1010,9 +1018,8 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg) goto out; } -drm_handle_vblank (drm_hdmi_ctx->drm_dev, ctx->pipe); -exynos_drm_crtc_finish_pageflip (drm_hdmi_ctx->drm_dev, - ctx->pipe); +drm_handle_vblank (ctx->drm_dev, ctx->pipe); +exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe);/* set wait vsync event to zero and wake up queue. */ if (atomic_read (&ctx->wait_vsync_event)) {
@@ -1077,7 +1084,7 @@ static int mixer_resources_init(struct exynos_drm_hdmi_context *ctx, } ret =devm_request_irq (dev, res->start, mixer_irq_handler, -0 ,"drm_mixer" , ctx); +0 ,"drm_mixer" , mixer_ctx);if (ret) {dev_err (dev,"request interrupt failed.\n" );return ret;
Signature · 1 line
1.8.4
PATCH 6/23 drm/exynos: Pass context in manager ops instead of dev
In reply to Sean PaulThis patch changes the manager ops callbacks from accepting the subdrv device pointer to taking a context pointer. This will allow us to move closer to decoupling manager/display from subdrv, and subsequently decoupling the crtc/plane from the encoder.
--- drivers/gpu/drm/exynos/exynos_drm_connector.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 33 ++++++------ drivers/gpu/drm/exynos/exynos_drm_encoder.c | 24 ++++----- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 71 +++++++++++++------------ drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 75 +++++++++++++++------------ drivers/gpu/drm/exynos/exynos_drm_vidi.c | 49 ++++++++--------- 6 files changed, 130 insertions(+), 124 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_connector.c +1 -1
@@ -198,7 +198,7 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector,* resolution then get max width and height from that driver. */ if (ops && ops->get_max_resol) - ops->get_max_resol (manager->dev, &width, &height); + ops->get_max_resol (manager->ctx, &width, &height);return drm_helper_probe_single_connector_modes (connector, width, height);
drivers/gpu/drm/exynos/exynos_drm_drv.h +16 -17
@@ -162,26 +162,23 @@ struct exynos_drm_display_ops {* @win_disable: disable hardware specific overlay. */ struct exynos_drm_manager_ops { -int (*initialize)(struct device *subdrv_dev, -struct drm_device *drm_dev); -void (*dpms)(struct device *subdrv_dev,int mode); -void (*apply)(struct device *subdrv_dev); -void (*mode_fixup)(struct device *subdrv_dev, -struct drm_connector *connector, +int (*initialize)(void *ctx,struct drm_device *drm_dev); +void (*dpms)(void *ctx,int mode); +void (*apply)(void *ctx); +void (*mode_fixup)(void *ctx,struct drm_connector *connector,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode); -void (*mode_set)(struct device *subdrv_dev,void *mode); -void (*get_max_resol)(struct device *subdrv_dev,unsigned int *width, +void (*mode_set)(void *ctx,void *mode); +void (*get_max_resol)(void *ctx,unsigned int *width,unsigned int *height); -void (*commit)(struct device *subdrv_dev); -int (*enable_vblank)(struct device *subdrv_dev); -void (*disable_vblank)(struct device *subdrv_dev); -void (*wait_for_vblank)(struct device *subdrv_dev); -void (*win_mode_set)(struct device *subdrv_dev, -struct exynos_drm_overlay *overlay); -void (*win_commit)(struct device *subdrv_dev,int zpos); -void (*win_enable)(struct device *subdrv_dev,int zpos); -void (*win_disable)(struct device *subdrv_dev,int zpos); +void (*commit)(void *ctx); +int (*enable_vblank)(void *ctx); +void (*disable_vblank)(void *ctx); +void (*wait_for_vblank)(void *ctx); +void (*win_mode_set)(void *ctx,struct exynos_drm_overlay *overlay); +void (*win_commit)(void *ctx,int zpos); +void (*win_enable)(void *ctx,int zpos); +void (*win_disable)(void *ctx,int zpos); };/*
@@ -197,12 +194,14 @@ struct exynos_drm_manager_ops {* these callbacks should be set by specific drivers such fimd * or hdmi driver and are used to control display devices such as * analog tv, digital tv and lcd panel and also get timing data for them. +* @ctx: A pointer to the manager's implementation specific context */ struct exynos_drm_manager {struct device *dev;int pipe;struct exynos_drm_manager_ops *ops;struct exynos_drm_display_ops *display_ops; +void *ctx; };struct exynos_drm_g2d_private {
drivers/gpu/drm/exynos/exynos_drm_encoder.c +12 -12
@@ -74,7 +74,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)case DRM_MODE_DPMS_ON :if (manager_ops && manager_ops->apply)if (!exynos_encoder->updated) - manager_ops->apply (manager->dev); + manager_ops->apply (manager->ctx);exynos_drm_connector_power (encoder, mode); exynos_encoder->dpms = mode;
@@ -107,7 +107,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder,list_for_each_entry (connector, &dev->mode_config.connector_list, head) {if (connector->encoder == encoder)if (manager_ops && manager_ops->mode_fixup) - manager_ops->mode_fixup (manager->dev, connector, + manager_ops->mode_fixup (manager->ctx, connector, mode, adjusted_mode); }
@@ -175,7 +175,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, manager_ops = manager->ops;if (manager_ops && manager_ops->mode_set) - manager_ops->mode_set (manager->dev, + manager_ops->mode_set (manager->ctx, adjusted_mode); exynos_encoder->old_crtc = encoder->crtc;
@@ -195,7 +195,7 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)struct exynos_drm_manager_ops *manager_ops = manager->ops;if (manager_ops && manager_ops->commit) - manager_ops->commit (manager->dev); + manager_ops->commit (manager->ctx);/* * this will avoid one issue that overlay data is updated to
@@ -341,7 +341,7 @@ exynos_drm_encoder_create(struct drm_device *dev,drm_encoder_helper_add (encoder, &exynos_encoder_helper_funcs);if (manager->ops && manager->ops->initialize) { - ret = manager->ops->initialize (manager->dev, dev); + ret = manager->ops->initialize (manager->ctx, dev);if (ret) {DRM_ERROR ("Manager initialize failed %d\n" , ret); goto error;
@@ -408,7 +408,7 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data)return ;if (manager_ops->enable_vblank) - manager_ops->enable_vblank (manager->dev); + manager_ops->enable_vblank (manager->ctx); }void exynos_drm_disable_vblank (struct drm_encoder *encoder,void *data)
@@ -422,7 +422,7 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)return ;if (manager_ops->disable_vblank) - manager_ops->disable_vblank (manager->dev); + manager_ops->disable_vblank (manager->ctx); }void exynos_drm_encoder_crtc_dpms (struct drm_encoder *encoder,void *data)
@@ -433,7 +433,7 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)int mode = *(int *)data;if (manager_ops && manager_ops->dpms) - manager_ops->dpms (manager->dev, mode); + manager_ops->dpms (manager->ctx, mode);/* * if this condition is ok then it means that the crtc is already
@@ -467,7 +467,7 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data)struct exynos_drm_overlay *overlay = data;if (manager_ops && manager_ops->win_mode_set) - manager_ops->win_mode_set (manager->dev, overlay); + manager_ops->win_mode_set (manager->ctx, overlay); }void exynos_drm_encoder_plane_commit (struct drm_encoder *encoder,void *data)
@@ -481,7 +481,7 @@ void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_commit) - manager_ops->win_commit (manager->dev, zpos); + manager_ops->win_commit (manager->ctx, zpos); }void exynos_drm_encoder_plane_enable (struct drm_encoder *encoder,void *data)
@@ -495,7 +495,7 @@ void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_enable) - manager_ops->win_enable (manager->dev, zpos); + manager_ops->win_enable (manager->ctx, zpos); }void exynos_drm_encoder_plane_disable (struct drm_encoder *encoder,void *data)
@@ -509,5 +509,5 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_disable) - manager_ops->win_disable (manager->dev, zpos); + manager_ops->win_disable (manager->ctx, zpos); }
drivers/gpu/drm/exynos/exynos_drm_fimd.c +35 -36
210 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +41 -34
193 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_vidi.c +25 -24
127 lines not on this page · raw message
Signature · 1 line
1.8.4
Inki Dae
maintainerRE: [PATCH 06/23] drm/exynos: Pass context in manager ops instead of dev
Quoted 27 lines
void exynos_drm_encoder_plane_enable(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -495,7 +495,7 @@ void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_enable) - manager_ops->win_enable (manager->dev, zpos); + manager_ops->win_enable (manager->ctx, zpos); }void exynos_drm_encoder_plane_disable(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -509,5 +509,5 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_disable) - manager_ops->win_disable (manager->dev, zpos); + manager_ops->win_disable (manager->ctx, zpos);}
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0
drivers/gpu/drm/exynos/exynos_drm_fimd.c struct fimd_win_data { · line 109
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-0@@ -106,6 +106,7 @@ struct fimd_win_data {struct fimd_context {struct exynos_drm_subdrv subdrv; +struct device *dev;
Where device object is set to ctx->dev? And we already have device object in subdrv. And why did you add dev?
And you are making driver callbacks to be called with its own context. Why framework should know the context of each driver? The framework knows the device object of each device driver since the sub driver of each device driver is registered to the framework. And the device driver can get its own context from the device object driver-internally. The framework should call some callbacks of each device driver _with_device_object_, and this way is more generic.
The context is a_thing_only_for_the_device_driver.
Quoted 117 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3
-4struct drm_device *drm_dev;int irq;struct drm_crtc *crtc;@@ -182,16 +183,15 @@ static struct exynos_drm_display_ops fimd_display_ops = { .power_on = fimd_display_power_on, }; -static void fimd_win_mode_set (struct device *dev, -struct exynos_drm_overlay *overlay) +static void fimd_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win;unsigned long offset;if (!overlay) { -dev_err (dev,"overlay is NULL\n" ); +DRM_ERROR ("overlay is NULL\n" );return ;drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-4}@@ -231,9 +231,8 @@ static void fimd_win_mode_set(struct device *dev, overlay->fb_width, overlay->crtc_width); } -static void fimd_win_set_pixfmt (struct device *dev,unsigned int win) +static void fimd_win_set_pixfmt (struct fimd_context *ctx,unsigned int win) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data = &ctx->win_data[win];unsigned long val;@@ -289,9 +288,8 @@ static void fimd_win_set_pixfmt(struct device *dev, unsigned int win) writel(val, ctx->regs + WINCON(win)); } -static void fimd_win_set_colkey (struct device *dev,unsigned int win) +static void fimd_win_set_colkey (struct fimd_context *ctx,unsigned int win) { -struct fimd_context *ctx =get_fimd_context (dev);unsigned int keycon0 =0 , keycon1 =0 ;drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2keycon0 = ~(WxKEYCON0_KEYBL_EN | WxKEYCON0_KEYEN_F |@@ -330,9 +328,9 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx,writel (val, ctx->regs + reg); } -static void fimd_win_commit (struct device *dev,int zpos) +static void fimd_win_commit (void *in_ctx,int zpos) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win = zpos;drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2unsigned long val, alpha, size;@@ -427,11 +425,11 @@ static void fimd_win_commit(struct device *dev, int zpos) DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); } -fimd_win_set_pixfmt (dev, win); +fimd_win_set_pixfmt (ctx, win);/* hardware window 0 doesn't support color key. */ if (win !=0 ) -fimd_win_set_colkey (dev, win); +fimd_win_set_colkey (ctx, win);/* wincon */ drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2val =readl (ctx->regs +WINCON (win));@@ -450,9 +448,9 @@ static void fimd_win_commit(struct device *dev, int zpos) win_data->enabled = true; } -static void fimd_win_disable (struct device *dev,int zpos) +static void fimd_win_disable (void *in_ctx,int zpos) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win = zpos;drivers/gpu/drm/exynos/exynos_drm_fimd.c +4
-5u32 val;@@ -491,19 +489,18 @@ static void fimd_win_disable(struct device *dev, int zpos) win_data->enabled = false; } -static int fimd_mgr_initialize (struct device *subdrv_dev, -struct drm_device *drm_dev) +static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx; ctx->drm_dev = drm_dev;return 0 ; } -static void fimd_dpms (struct device *subdrv_dev,int mode) +static void fimd_dpms (void *in_ctx,int mode) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx;DRM_DEBUG_KMS ("%d\n" , mode);
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_dpms(struct device *subdrv_dev, int · line 519
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-1@@ -518,13 +515,13 @@ static void fimd_dpms(struct device *subdrv_dev, intmode) * clk_enable could be called double time. */ if (ctx->suspended) -pm_runtime_get_sync (subdrv_dev); +pm_runtime_get_sync (ctx->dev);
Maybe invalid memory access to ctx->dev. So Shoulnd't it ctx->subdrv.dev?
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_dpms(struct device *subdrv_dev, int mode) · line 524
Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-1break ;case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :case DRM_MODE_DPMS_OFF :if (!ctx->suspended) -pm_runtime_put_sync (subdrv_dev); +pm_runtime_put_sync (ctx->dev);
Ditto
drivers/gpu/drm/exynos/exynos_drm_hdmi.c static void drm_hdmi_apply(struct device
Quoted 277 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0break ;default :drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2DRM_DEBUG_KMS ("unspecified mode %d\n" , mode);@@ -534,9 +531,9 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) mutex_unlock(&ctx->lock); } -static void fimd_apply (struct device *subdrv_dev) +static void fimd_apply (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx;struct exynos_drm_manager *mgr = ctx->subdrv.manager;struct exynos_drm_manager_ops *mgr_ops = mgr->ops;drivers/gpu/drm/exynos/exynos_drm_fimd.c +15
-13struct fimd_win_data *win_data;@@ -545,16 +542,16 @@ static void fimd_apply(struct device *subdrv_dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i];if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (subdrv_dev, i); + mgr_ops->win_commit (ctx, i); }if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (subdrv_dev); + mgr_ops->commit (ctx); } -static void fimd_commit (struct device *dev) +static void fimd_commit (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct exynos_drm_panel_info *panel = &ctx->panel;struct videomode *vm = &panel->vm;struct fimd_driver_data *driver_data;@@ -608,9 +605,9 @@ static void fimd_commit(struct device *dev)writel (val, ctx->regs +VIDCON0 ); } -static int fimd_enable_vblank (struct device *dev) +static int fimd_enable_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;u32 val;if (ctx->suspended)@@ -633,9 +630,9 @@ static int fimd_enable_vblank(struct device *dev)return 0 ; } -static void fimd_disable_vblank (struct device *dev) +static void fimd_disable_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;u32 val;if (ctx->suspended)@@ -651,9 +648,9 @@ static void fimd_disable_vblank(struct device *dev) } } -static void fimd_wait_for_vblank (struct device *dev) +static void fimd_wait_for_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;if (ctx->suspended)return ;@@ -845,9 +842,9 @@ static void fimd_window_suspend(struct device *dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i]; win_data->resume = win_data->enabled; -fimd_win_disable (dev, i); +fimd_win_disable (ctx, i); } -fimd_wait_for_vblank (dev); +fimd_wait_for_vblank (ctx); }static void fimd_window_resume (struct device *dev)@@ -963,6 +960,8 @@ static int fimd_probe(struct platform_device *pdev)DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); + fimd_manager.ctx = ctx; + subdrv = &ctx->subdrv; subdrv->dev = dev;@@ -1042,7 +1041,7 @@ static int fimd_resume(struct device *dev)* registers but in case of sleep wakeup, it's not. * so fimd_apply function should be called at here. */ -fimd_apply (dev); +fimd_apply (ctx); }return 0 ;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +1
-3@@ -129,11 +129,9 @@ static struct edid *drm_hdmi_get_edid(struct device *dev, return NULL; } - -static int drm_hdmi_check_mode (struct device *dev, +static int drm_hdmi_check_mode_ctx (struct drm_hdmi_context *ctx,struct drm_display_mode *mode) { -struct drm_hdmi_context *ctx =to_context (dev);int ret =0 ;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +17
-9/* @@ -153,6 +151,14 @@ static int drm_hdmi_check_mode(struct device *dev,return 0 ; } +static int drm_hdmi_check_mode (struct device *dev, +struct drm_display_mode *mode) +{ +struct drm_hdmi_context *ctx =to_context (dev); + +return drm_hdmi_check_mode_ctx (ctx, mode); +} +static int drm_hdmi_power_on (struct device *dev,int mode) {struct drm_hdmi_context *ctx =to_context (dev);@@ -172,9 +178,9 @@ static struct exynos_drm_display_ops drm_hdmi_display_ops = { .power_on = drm_hdmi_power_on, }; -static int drm_hdmi_enable_vblank (struct device *subdrv_dev) +static int drm_hdmi_enable_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;struct exynos_drm_subdrv *subdrv = &ctx->subdrv;struct exynos_drm_manager *manager = subdrv->manager;@@ -185,33 +191,33 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev)return 0 ; } -static void drm_hdmi_disable_vblank (struct device *subdrv_dev) +static void drm_hdmi_disable_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->disable_vblank)return mixer_ops->disable_vblank (ctx->mixer_ctx->ctx); } -static void drm_hdmi_wait_for_vblank (struct device *subdrv_dev) +static void drm_hdmi_wait_for_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->wait_for_vblank) mixer_ops->wait_for_vblank (ctx->mixer_ctx->ctx); } -static void drm_hdmi_mode_fixup (struct device *subdrv_dev, -struct drm_connector *connector, +static void drm_hdmi_mode_fixup (void *in_ctx,struct drm_connector *connector,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) { +struct drm_hdmi_context *ctx = in_ctx;struct drm_display_mode *m;int mode_ok;drm_mode_set_crtcinfo (adjusted_mode,0 ); - mode_ok =drm_hdmi_check_mode (subdrv_dev, adjusted_mode); + mode_ok =drm_hdmi_check_mode_ctx (ctx, adjusted_mode);drivers/gpu/drm/exynos/exynos_drm_hdmi.c +1
-1/* just return if user desired mode exists. */ if (mode_ok ==0 )@@ -222,7 +228,7 @@ static void drm_hdmi_mode_fixup(struct device*subdrv_dev, * to adjusted_mode. */ list_for_each_entry (m, &connector->modes, head) { - mode_ok =drm_hdmi_check_mode (subdrv_dev, m); + mode_ok =drm_hdmi_check_mode_ctx (ctx, m);if (mode_ok ==0 ) {drivers/gpu/drm/exynos/exynos_drm_hdmi.c +9
-10struct drm_mode_object base;@@ -245,35 +251,34 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, } } -static void drm_hdmi_mode_set (struct device *subdrv_dev,void *mode) +static void drm_hdmi_mode_set (void *in_ctx,void *mode) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->mode_set) hdmi_ops->mode_set (ctx->hdmi_ctx->ctx, mode); } -static void drm_hdmi_get_max_resol (struct device *subdrv_dev, -unsigned int *width,unsigned int *height) +static void drm_hdmi_get_max_resol (void *in_ctx,unsigned int *width, +unsigned int *height) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->get_max_resol) hdmi_ops->get_max_resol (ctx->hdmi_ctx->ctx, width, height); } -static void drm_hdmi_commit (struct device *subdrv_dev) +static void drm_hdmi_commit (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->commit) hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static int drm_hdmi_mgr_initialize (struct device *subdrv_dev, -struct drm_device *drm_dev) +static int drm_hdmi_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int ret =0 ;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-2if (mixer_ops && mixer_ops->initialize)@@ -285,9 +290,9 @@ static int drm_hdmi_mgr_initialize(struct device *subdrv_dev, return ret; } -static void drm_hdmi_dpms (struct device *subdrv_dev,int mode) +static void drm_hdmi_dpms (void *in_ctx,int mode) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->dpms)drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-2mixer_ops->dpms (ctx->mixer_ctx->ctx, mode);@@ -296,9 +301,9 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode); } -static void drm_hdmi_apply (struct device *subdrv_dev) +static void drm_hdmi_apply (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int i;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +0
-0for (i =0 ; i <MIXER_WIN_NR ; i++) {@@ -312,18 +317,18 @@ static void drm_hdmi_apply(struct device
*subdrv_dev)
Quoted 193 lines
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +7
-7hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static void drm_mixer_win_mode_set (struct device *subdrv_dev, -struct exynos_drm_overlay *overlay) +static void drm_mixer_win_mode_set (void *in_ctx, +struct exynos_drm_overlay *overlay) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->win_mode_set) mixer_ops->win_mode_set (ctx->mixer_ctx->ctx, overlay); } -static void drm_mixer_win_commit (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_commit (void *in_ctx,int zpos) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;if (win <0 || win >=MIXER_WIN_NR ) {@@ -337,9 +342,9 @@ static void drm_mixer_win_commit(struct device *subdrv_dev, int zpos) ctx->enabled[win] = true; } -static void drm_mixer_win_disable (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_disable (void *in_ctx,int zpos) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-0if (win <0 || win >=MIXER_WIN_NR ) {@@ -425,6 +430,8 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev)if (!ctx)return -ENOMEM ; + hdmi_manager.ctx = ctx; + subdrv = &ctx->subdrv;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +0
-0subdrv->dev = dev;drivers/gpu/drm/exynos/exynos_drm_vidi.c +4
-4@@ -152,9 +152,9 @@ static struct exynos_drm_display_ops vidi_display_ops = { .power_on = vidi_display_power_on, }; -static void vidi_dpms (struct device *subdrv_dev,int mode) +static void vidi_dpms (void *in_ctx,int mode) { -struct vidi_context *ctx =get_vidi_context (subdrv_dev); +struct vidi_context *ctx = in_ctx;DRM_DEBUG_KMS ("%d\n" , mode);@@ -177,9 +177,9 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) mutex_unlock(&ctx->lock); } -static void vidi_apply (struct device *subdrv_dev) +static void vidi_apply (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (subdrv_dev); +struct vidi_context *ctx = in_ctx;struct exynos_drm_manager *mgr = ctx->subdrv.manager;struct exynos_drm_manager_ops *mgr_ops = mgr->ops;drivers/gpu/drm/exynos/exynos_drm_vidi.c +21
-20struct vidi_win_data *win_data;@@ -188,24 +188,24 @@ static void vidi_apply(struct device *subdrv_dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i];if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (subdrv_dev, i); + mgr_ops->win_commit (ctx, i); }if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (subdrv_dev); + mgr_ops->commit (ctx); } -static void vidi_commit (struct device *dev) +static void vidi_commit (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return ; } -static int vidi_enable_vblank (struct device *dev) +static int vidi_enable_vblank (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return -EPERM ;@@ -225,9 +225,9 @@ static int vidi_enable_vblank(struct device *dev)return 0 ; } -static void vidi_disable_vblank (struct device *dev) +static void vidi_disable_vblank (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return ;@@ -236,16 +236,15 @@ static void vidi_disable_vblank(struct device *dev) ctx->vblank_on = false; } -static void vidi_win_mode_set (struct device *dev, -struct exynos_drm_overlay *overlay) +static void vidi_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win;unsigned long offset;if (!overlay) { -dev_err (dev,"overlay is NULL\n" ); +DRM_ERROR ("overlay is NULL\n" );return ; }@@ -289,9 +288,9 @@ static void vidi_win_mode_set(struct device *dev, overlay->fb_width, overlay->crtc_width); } -static void vidi_win_commit (struct device *dev,int zpos) +static void vidi_win_commit (void *in_ctx,int zpos) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win = zpos;@@ -314,9 +313,9 @@ static void vidi_win_commit(struct device *dev, int zpos) schedule_work(&ctx->work); } -static void vidi_win_disable (struct device *dev,int zpos) +static void vidi_win_disable (void *in_ctx,int zpos) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win = zpos;@@ -405,17 +404,19 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev, struct device *dev)static int vidi_power_on (struct vidi_context *ctx,bool enable) { -struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct device *dev = subdrv->dev; +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +if (enable != false && enable != true) +return -EINVAL ;if (enable) { ctx->suspended = false;/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit (0 , &ctx->irq_flags)) -vidi_enable_vblank (dev); +vidi_enable_vblank (ctx); -vidi_apply (dev); +vidi_apply (ctx); }else { ctx->suspended = true;}
--
1.8.4
Inki Dae
maintainerRE: [PATCH 06/23] drm/exynos: Pass context in manager ops instead of dev
In reply to Sean PaulHi, Sean.
It's a great patch set.:) That's exactly what we want. So I'd like to merge all patch set to exynos-drm-next if there is no design issue about next week. And then we can add additional minor patches from others.
Before that, can you re-send all patch set like below?
1. Do not rebase them at top of lvds-bridge patch set.
2. Change all patch set for callbacks to be called_with_device_object instead of ctx.
The below is my comments.
Thanks for your contributions,
Inki Dae
Quoted 14 lines
-----Original Message-----
From: Sean Paul [mailto:[email protected]]
Sent: Friday, October 11, 2013 9:30 AM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Sean Paul
Subject: [PATCH 06/23] drm/exynos: Pass context in manager ops instead of devThis patch changes the manager ops callbacks from accepting the subdrv device pointer to taking a context pointer. This will allow us to move closer to decoupling manager/display from subdrv, and subsequently decoupling the crtc/plane from the encoder.
Quoted 6 lines
Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_connector.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 33 ++++++------ drivers/gpu/drm/exynos/exynos_drm_encoder.c | 24 ++++----- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 71
+++++++++++++----------
Quoted 2 lines
--
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 75
+++++++++++++++--------
Quoted 74 lines
----
drivers/gpu/drm/exynos/exynos_drm_vidi.c | 49 ++++++++--------- 6 files changed, 130 insertions(+), 124 deletions(-)drivers/gpu/drm/exynos/exynos_drm_connector.c +1
-1@@ -198,7 +198,7 @@ static int exynos_drm_connector_fill_modes(structdrm_connector *connector, * resolution then get max width and height from that driver. */ if (ops && ops->get_max_resol) - ops->get_max_resol (manager->dev, &width, &height); + ops->get_max_resol (manager->ctx, &width, &height); return drm_helper_probe_single_connector_modes(connector, width,drivers/gpu/drm/exynos/exynos_drm_connector.c +0
-0height);drivers/gpu/drm/exynos/exynos_drm_drv.h +14
-17@@ -162,26 +162,23 @@ struct exynos_drm_display_ops {* @win_disable: disable hardware specific overlay. */ struct exynos_drm_manager_ops { -int (*initialize)(struct device *subdrv_dev, -struct drm_device *drm_dev); -void (*dpms)(struct device *subdrv_dev,int mode); -void (*apply)(struct device *subdrv_dev); -void (*mode_fixup)(struct device *subdrv_dev, -struct drm_connector *connector, +int (*initialize)(void *ctx,struct drm_device *drm_dev); +void (*dpms)(void *ctx,int mode); +void (*apply)(void *ctx); +void (*mode_fixup)(void *ctx,struct drm_connector *connector,const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); -void (*mode_set)(struct device *subdrv_dev,void *mode); -void (*get_max_resol)(struct device *subdrv_dev,unsigned int *width, + void (*mode_set)(void *ctx, void *mode); +void (*get_max_resol)(void *ctx,unsigned int *width,unsigned int *height); -void (*commit)(struct device *subdrv_dev); -int (*enable_vblank)(struct device *subdrv_dev); -void (*disable_vblank)(struct device *subdrv_dev); -void (*wait_for_vblank)(struct device *subdrv_dev); -void (*win_mode_set)(struct device *subdrv_dev, -struct exynos_drm_overlay *overlay); -void (*win_commit)(struct device *subdrv_dev,int zpos); -void (*win_enable)(struct device *subdrv_dev,int zpos); -void (*win_disable)(struct device *subdrv_dev,int zpos); +void (*commit)(void *ctx); +int (*enable_vblank)(void *ctx); +void (*disable_vblank)(void *ctx); +void (*wait_for_vblank)(void *ctx); +void (*win_mode_set)(void *ctx,struct exynos_drm_overlay *overlay); +void (*win_commit)(void *ctx,int zpos); +void (*win_enable)(void *ctx,int zpos); +void (*win_disable)(void *ctx,int zpos); };/*
drivers/gpu/drm/exynos/exynos_drm_drv.h +0
-0@@ -197,12 +194,14 @@ struct exynos_drm_manager_ops {* these callbacks should be set by specific drivers such fimd * or hdmi driver and are used to control display devices such as * analog tv, digital tv and lcd panel and also get timing data for them.
+ * @ctx: A pointer to the manager's implementation specific context */
structexynos_drm_manager{
drivers/gpu/drm/exynos/exynos_drm_drv.h struct exynos_drm_manager_ops { · line 204
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_drv.h +1
-0struct device *dev;int pipe;struct exynos_drm_manager_ops *ops;struct exynos_drm_display_ops *display_ops; +void *ctx;
Plz, remove ctx we can use dev instead.
Quoted 19 lines
};
struct
exynos_drm_g2d_private{drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -74,7 +74,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)case DRM_MODE_DPMS_ON :if (manager_ops && manager_ops->apply)if (!exynos_encoder->updated) - manager_ops->apply (manager->dev); + manager_ops->apply (manager->ctx);exynos_drm_connector_power (encoder, mode);drivers/gpu/drm/exynos/exynos_drm_encoder.c +0
-0exynos_encoder->dpms = mode;
drivers/gpu/drm/exynos/exynos_drm_encoder.c exynos_drm_encoder_mode_fixup(struct drm_encoder · line 112
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0
-1@@ -107,7 +107,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, list_for_each_entry(connector, &dev->mode_config.connector_list, head) {if (connector->encoder == encoder)if (manager_ops && manager_ops->mode_fixup) - manager_ops->mode_fixup(manager->dev,
connector,
drivers/gpu/drm/exynos/exynos_drm_encoder.c exynos_drm_encoder_mode_fixup(struct drm_encoder · line 112
Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-0+ manager_ops->mode_fixup(manager->ctx,
connector,
drivers/gpu/drm/exynos/exynos_drm_encoder.c exynos_drm_encoder_mode_fixup(struct drm_encoder · line 113
Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0
-0mode,
adjusted_mode);
Quoted 50 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1}@@ -175,7 +175,7 @@ static void exynos_drm_encoder_mode_set(structdrm_encoder *encoder, manager_ops = manager->ops;if (manager_ops && manager_ops->mode_set) - manager_ops->mode_set (manager->dev, + manager_ops->mode_set (manager->ctx, adjusted_mode);drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1exynos_encoder->old_crtc = encoder->crtc;@@ -195,7 +195,7 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)struct exynos_drm_manager_ops *manager_ops = manager->ops;if (manager_ops && manager_ops->commit) - manager_ops->commit (manager->dev); + manager_ops->commit (manager->ctx);/* drivers/gpu/drm/exynos/exynos_drm_encoder.c +2
-2* this will avoid one issue that overlay data is updated to @@ -341,7 +341,7 @@ exynos_drm_encoder_create(struct drm_device *dev,drm_encoder_helper_add (encoder, &exynos_encoder_helper_funcs);if (manager->ops && manager->ops->initialize) { - ret = manager->ops->initialize (manager->dev, dev); + ret = manager->ops->initialize (manager->ctx, dev);if (ret) {DRM_ERROR ("Manager initialize failed %d\n" , ret); goto error;@@ -408,7 +408,7 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data)return ;if (manager_ops->enable_vblank) - manager_ops->enable_vblank (manager->dev); + manager_ops->enable_vblank (manager->ctx); }void
exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -422,7 +422,7 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)return ;if (manager_ops->disable_vblank) - manager_ops->disable_vblank (manager->dev); + manager_ops->disable_vblank (manager->ctx); }
Quoted 1 line
void exynos_drm_encoder_crtc_dpms(struct
drm_encoder*encoder, void
*data)
Quoted 57 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -433,7 +433,7 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)int mode = *(int *)data;if (manager_ops && manager_ops->dpms) - manager_ops->dpms (manager->dev, mode); + manager_ops->dpms (manager->ctx, mode);/* drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1* if this condition is ok then it means that the crtc is already @@ -467,7 +467,7 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data)struct exynos_drm_overlay *overlay = data;if (manager_ops && manager_ops->win_mode_set) - manager_ops->win_mode_set (manager->dev, overlay); + manager_ops->win_mode_set (manager->ctx, overlay); }void exynos_drm_encoder_plane_commit(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -481,7 +481,7 @@ void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_commit) - manager_ops->win_commit (manager->dev, zpos); + manager_ops->win_commit (manager->ctx, zpos); }void exynos_drm_encoder_plane_enable(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -495,7 +495,7 @@ void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_enable) - manager_ops->win_enable (manager->dev, zpos); + manager_ops->win_enable (manager->ctx, zpos); }void exynos_drm_encoder_plane_disable(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -509,5 +509,5 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_disable) - manager_ops->win_disable (manager->dev, zpos); + manager_ops->win_disable (manager->ctx, zpos);}
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0
drivers/gpu/drm/exynos/exynos_drm_fimd.c struct fimd_win_data { · line 108
Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -106,6 +106,7 @@ struct fimd_win_data {struct fimd_context {struct exynos_drm_subdrv subdrv;
It seems that crtc device drivers such as fimd and hdmi mixer don't need to register subdrv. So remove?
drivers/gpu/drm/exynos/exynos_drm_hdmi.c static void drm_hdmi_apply(struct device
Quoted 408 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4
-4+struct device *dev;struct drm_device *drm_dev;int irq;struct drm_crtc *crtc;@@ -182,16 +183,15 @@ static struct exynos_drm_display_ops fimd_display_ops = { .power_on = fimd_display_power_on, }; -static void fimd_win_mode_set (struct device *dev, -struct exynos_drm_overlay *overlay) +static void fimd_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win;unsigned long offset;if (!overlay) { -dev_err (dev,"overlay is NULL\n" ); +DRM_ERROR ("overlay is NULL\n" );return ;drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-4}@@ -231,9 +231,8 @@ static void fimd_win_mode_set(struct device *dev, overlay->fb_width, overlay->crtc_width); } -static void fimd_win_set_pixfmt (struct device *dev,unsigned int win) +static void fimd_win_set_pixfmt (struct fimd_context *ctx,unsigned int win) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data = &ctx->win_data[win];unsigned long val;@@ -289,9 +288,8 @@ static void fimd_win_set_pixfmt(struct device *dev, unsigned int win) writel(val, ctx->regs + WINCON(win)); } -static void fimd_win_set_colkey (struct device *dev,unsigned int win) +static void fimd_win_set_colkey (struct fimd_context *ctx,unsigned int win) { -struct fimd_context *ctx =get_fimd_context (dev);unsigned int keycon0 =0 , keycon1 =0 ;drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2keycon0 = ~(WxKEYCON0_KEYBL_EN | WxKEYCON0_KEYEN_F |@@ -330,9 +328,9 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx,writel (val, ctx->regs + reg); } -static void fimd_win_commit (struct device *dev,int zpos) +static void fimd_win_commit (void *in_ctx,int zpos) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win = zpos;drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2unsigned long val, alpha, size;@@ -427,11 +425,11 @@ static void fimd_win_commit(struct device *dev, int zpos) DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); } -fimd_win_set_pixfmt (dev, win); +fimd_win_set_pixfmt (ctx, win);/* hardware window 0 doesn't support color key. */ if (win !=0 ) -fimd_win_set_colkey (dev, win); +fimd_win_set_colkey (ctx, win);/* wincon */ drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2val =readl (ctx->regs +WINCON (win));@@ -450,9 +448,9 @@ static void fimd_win_commit(struct device *dev, int zpos) win_data->enabled = true; } -static void fimd_win_disable (struct device *dev,int zpos) +static void fimd_win_disable (void *in_ctx,int zpos) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win = zpos;drivers/gpu/drm/exynos/exynos_drm_fimd.c +6
-7u32 val;@@ -491,19 +489,18 @@ static void fimd_win_disable(struct device *dev, int zpos) win_data->enabled = false; } -static int fimd_mgr_initialize (struct device *subdrv_dev, -struct drm_device *drm_dev) +static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx; ctx->drm_dev = drm_dev;return 0 ; } -static void fimd_dpms (struct device *subdrv_dev,int mode) +static void fimd_dpms (void *in_ctx,int mode) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx;DRM_DEBUG_KMS ("%d\n" , mode);@@ -518,13 +515,13 @@ static void fimd_dpms(struct device *subdrv_dev, intmode) * clk_enable could be called double time. */ if (ctx->suspended) -pm_runtime_get_sync (subdrv_dev); +pm_runtime_get_sync (ctx->dev);break ;case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :case DRM_MODE_DPMS_OFF :if (!ctx->suspended) -pm_runtime_put_sync (subdrv_dev); +pm_runtime_put_sync (ctx->dev);break ;default :drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2DRM_DEBUG_KMS ("unspecified mode %d\n" , mode);@@ -534,9 +531,9 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) mutex_unlock(&ctx->lock); } -static void fimd_apply (struct device *subdrv_dev) +static void fimd_apply (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx;struct exynos_drm_manager *mgr = ctx->subdrv.manager;struct exynos_drm_manager_ops *mgr_ops = mgr->ops;drivers/gpu/drm/exynos/exynos_drm_fimd.c +15
-13struct fimd_win_data *win_data;@@ -545,16 +542,16 @@ static void fimd_apply(struct device *subdrv_dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i];if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (subdrv_dev, i); + mgr_ops->win_commit (ctx, i); }if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (subdrv_dev); + mgr_ops->commit (ctx); } -static void fimd_commit (struct device *dev) +static void fimd_commit (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct exynos_drm_panel_info *panel = &ctx->panel;struct videomode *vm = &panel->vm;struct fimd_driver_data *driver_data;@@ -608,9 +605,9 @@ static void fimd_commit(struct device *dev)writel (val, ctx->regs +VIDCON0 ); } -static int fimd_enable_vblank (struct device *dev) +static int fimd_enable_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;u32 val;if (ctx->suspended)@@ -633,9 +630,9 @@ static int fimd_enable_vblank(struct device *dev)return 0 ; } -static void fimd_disable_vblank (struct device *dev) +static void fimd_disable_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;u32 val;if (ctx->suspended)@@ -651,9 +648,9 @@ static void fimd_disable_vblank(struct device *dev) } } -static void fimd_wait_for_vblank (struct device *dev) +static void fimd_wait_for_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;if (ctx->suspended)return ;@@ -845,9 +842,9 @@ static void fimd_window_suspend(struct device *dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i]; win_data->resume = win_data->enabled; -fimd_win_disable (dev, i); +fimd_win_disable (ctx, i); } -fimd_wait_for_vblank (dev); +fimd_wait_for_vblank (ctx); }static void fimd_window_resume (struct device *dev)@@ -963,6 +960,8 @@ static int fimd_probe(struct platform_device *pdev)DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); + fimd_manager.ctx = ctx; + subdrv = &ctx->subdrv; subdrv->dev = dev;@@ -1042,7 +1041,7 @@ static int fimd_resume(struct device *dev)* registers but in case of sleep wakeup, it's not. * so fimd_apply function should be called at here. */ -fimd_apply (dev); +fimd_apply (ctx); }return 0 ;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +1
-3@@ -129,11 +129,9 @@ static struct edid *drm_hdmi_get_edid(struct device *dev, return NULL; } - -static int drm_hdmi_check_mode (struct device *dev, +static int drm_hdmi_check_mode_ctx (struct drm_hdmi_context *ctx,struct drm_display_mode *mode) { -struct drm_hdmi_context *ctx =to_context (dev);int ret =0 ;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +17
-9/* @@ -153,6 +151,14 @@ static int drm_hdmi_check_mode(struct device *dev,return 0 ; } +static int drm_hdmi_check_mode (struct device *dev, +struct drm_display_mode *mode) +{ +struct drm_hdmi_context *ctx =to_context (dev); + +return drm_hdmi_check_mode_ctx (ctx, mode); +} +static int drm_hdmi_power_on (struct device *dev,int mode) {struct drm_hdmi_context *ctx =to_context (dev);@@ -172,9 +178,9 @@ static struct exynos_drm_display_ops drm_hdmi_display_ops = { .power_on = drm_hdmi_power_on, }; -static int drm_hdmi_enable_vblank (struct device *subdrv_dev) +static int drm_hdmi_enable_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;struct exynos_drm_subdrv *subdrv = &ctx->subdrv;struct exynos_drm_manager *manager = subdrv->manager;@@ -185,33 +191,33 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev)return 0 ; } -static void drm_hdmi_disable_vblank (struct device *subdrv_dev) +static void drm_hdmi_disable_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->disable_vblank)return mixer_ops->disable_vblank (ctx->mixer_ctx->ctx); } -static void drm_hdmi_wait_for_vblank (struct device *subdrv_dev) +static void drm_hdmi_wait_for_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->wait_for_vblank) mixer_ops->wait_for_vblank (ctx->mixer_ctx->ctx); } -static void drm_hdmi_mode_fixup (struct device *subdrv_dev, -struct drm_connector *connector, +static void drm_hdmi_mode_fixup (void *in_ctx,struct drm_connector *connector,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) { +struct drm_hdmi_context *ctx = in_ctx;struct drm_display_mode *m;int mode_ok;drm_mode_set_crtcinfo (adjusted_mode,0 ); - mode_ok =drm_hdmi_check_mode (subdrv_dev, adjusted_mode); + mode_ok =drm_hdmi_check_mode_ctx (ctx, adjusted_mode);drivers/gpu/drm/exynos/exynos_drm_hdmi.c +1
-1/* just return if user desired mode exists. */ if (mode_ok ==0 )@@ -222,7 +228,7 @@ static void drm_hdmi_mode_fixup(struct device*subdrv_dev, * to adjusted_mode. */ list_for_each_entry (m, &connector->modes, head) { - mode_ok =drm_hdmi_check_mode (subdrv_dev, m); + mode_ok =drm_hdmi_check_mode_ctx (ctx, m);if (mode_ok ==0 ) {drivers/gpu/drm/exynos/exynos_drm_hdmi.c +9
-10struct drm_mode_object base;@@ -245,35 +251,34 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, } } -static void drm_hdmi_mode_set (struct device *subdrv_dev,void *mode) +static void drm_hdmi_mode_set (void *in_ctx,void *mode) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->mode_set) hdmi_ops->mode_set (ctx->hdmi_ctx->ctx, mode); } -static void drm_hdmi_get_max_resol (struct device *subdrv_dev, -unsigned int *width,unsigned int *height) +static void drm_hdmi_get_max_resol (void *in_ctx,unsigned int *width, +unsigned int *height) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->get_max_resol) hdmi_ops->get_max_resol (ctx->hdmi_ctx->ctx, width, height); } -static void drm_hdmi_commit (struct device *subdrv_dev) +static void drm_hdmi_commit (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->commit) hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static int drm_hdmi_mgr_initialize (struct device *subdrv_dev, -struct drm_device *drm_dev) +static int drm_hdmi_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int ret =0 ;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-2if (mixer_ops && mixer_ops->initialize)@@ -285,9 +290,9 @@ static int drm_hdmi_mgr_initialize(struct device *subdrv_dev, return ret; } -static void drm_hdmi_dpms (struct device *subdrv_dev,int mode) +static void drm_hdmi_dpms (void *in_ctx,int mode) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->dpms)drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-2mixer_ops->dpms (ctx->mixer_ctx->ctx, mode);@@ -296,9 +301,9 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode); } -static void drm_hdmi_apply (struct device *subdrv_dev) +static void drm_hdmi_apply (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int i;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +0
-0for (i =0 ; i <MIXER_WIN_NR ; i++) {@@ -312,18 +317,18 @@ static void drm_hdmi_apply(struct device
*subdrv_dev)
Quoted 193 lines
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +7
-7hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static void drm_mixer_win_mode_set (struct device *subdrv_dev, -struct exynos_drm_overlay *overlay) +static void drm_mixer_win_mode_set (void *in_ctx, +struct exynos_drm_overlay *overlay) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->win_mode_set) mixer_ops->win_mode_set (ctx->mixer_ctx->ctx, overlay); } -static void drm_mixer_win_commit (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_commit (void *in_ctx,int zpos) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;if (win <0 || win >=MIXER_WIN_NR ) {@@ -337,9 +342,9 @@ static void drm_mixer_win_commit(struct device *subdrv_dev, int zpos) ctx->enabled[win] = true; } -static void drm_mixer_win_disable (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_disable (void *in_ctx,int zpos) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-0if (win <0 || win >=MIXER_WIN_NR ) {@@ -425,6 +430,8 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev)if (!ctx)return -ENOMEM ; + hdmi_manager.ctx = ctx; + subdrv = &ctx->subdrv;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +0
-0subdrv->dev = dev;drivers/gpu/drm/exynos/exynos_drm_vidi.c +4
-4@@ -152,9 +152,9 @@ static struct exynos_drm_display_ops vidi_display_ops = { .power_on = vidi_display_power_on, }; -static void vidi_dpms (struct device *subdrv_dev,int mode) +static void vidi_dpms (void *in_ctx,int mode) { -struct vidi_context *ctx =get_vidi_context (subdrv_dev); +struct vidi_context *ctx = in_ctx;DRM_DEBUG_KMS ("%d\n" , mode);@@ -177,9 +177,9 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) mutex_unlock(&ctx->lock); } -static void vidi_apply (struct device *subdrv_dev) +static void vidi_apply (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (subdrv_dev); +struct vidi_context *ctx = in_ctx;struct exynos_drm_manager *mgr = ctx->subdrv.manager;struct exynos_drm_manager_ops *mgr_ops = mgr->ops;drivers/gpu/drm/exynos/exynos_drm_vidi.c +21
-20struct vidi_win_data *win_data;@@ -188,24 +188,24 @@ static void vidi_apply(struct device *subdrv_dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i];if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (subdrv_dev, i); + mgr_ops->win_commit (ctx, i); }if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (subdrv_dev); + mgr_ops->commit (ctx); } -static void vidi_commit (struct device *dev) +static void vidi_commit (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return ; } -static int vidi_enable_vblank (struct device *dev) +static int vidi_enable_vblank (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return -EPERM ;@@ -225,9 +225,9 @@ static int vidi_enable_vblank(struct device *dev)return 0 ; } -static void vidi_disable_vblank (struct device *dev) +static void vidi_disable_vblank (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return ;@@ -236,16 +236,15 @@ static void vidi_disable_vblank(struct device *dev) ctx->vblank_on = false; } -static void vidi_win_mode_set (struct device *dev, -struct exynos_drm_overlay *overlay) +static void vidi_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win;unsigned long offset;if (!overlay) { -dev_err (dev,"overlay is NULL\n" ); +DRM_ERROR ("overlay is NULL\n" );return ; }@@ -289,9 +288,9 @@ static void vidi_win_mode_set(struct device *dev, overlay->fb_width, overlay->crtc_width); } -static void vidi_win_commit (struct device *dev,int zpos) +static void vidi_win_commit (void *in_ctx,int zpos) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win = zpos;@@ -314,9 +313,9 @@ static void vidi_win_commit(struct device *dev, int zpos) schedule_work(&ctx->work); } -static void vidi_win_disable (struct device *dev,int zpos) +static void vidi_win_disable (void *in_ctx,int zpos) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win = zpos;@@ -405,17 +404,19 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev, struct device *dev)static int vidi_power_on (struct vidi_context *ctx,bool enable) { -struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct device *dev = subdrv->dev; +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +if (enable != false && enable != true) +return -EINVAL ;if (enable) { ctx->suspended = false;/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit (0 , &ctx->irq_flags)) -vidi_enable_vblank (dev); +vidi_enable_vblank (ctx); -vidi_apply (dev); +vidi_apply (ctx); }else { ctx->suspended = true;}
--
1.8.4
Re: [PATCH 06/23] drm/exynos: Pass context in manager ops instead of dev
Quoted 106 lines · Inki Dae
Hi, Sean.
It's a great patch set.:) That's exactly what we want. So I'd like to merge all patch set to exynos-drm-next if there is no design issue about next week. And then we can add additional minor patches from others.
Before that, can you re-send all patch set like below?
1. Do not rebase them at top of lvds-bridge patch set.
2. Change all patch set for callbacks to be called_with_device_objectinstead of ctx.The below is my comments.
Thanks for your contributions,
Inki DaeQuoted 14 lines
-----Original Message-----
From: Sean Paul [mailto:[email protected]]
Sent: Friday, October 11, 2013 9:30 AM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Sean Paul
Subject: [PATCH 06/23] drm/exynos: Pass context in manager ops instead of devThis patch changes the manager ops callbacks from accepting the subdrv device pointer to taking a context pointer. This will allow us to move closer to decoupling manager/display from subdrv, and subsequently decoupling the crtc/plane from the encoder.
Quoted 6 lines
Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_connector.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 33 ++++++------ drivers/gpu/drm/exynos/exynos_drm_encoder.c | 24 ++++----- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 71+++++++++++++----------
Quoted 2 lines
--
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 75+++++++++++++++--------
Quoted 65 lines
----
drivers/gpu/drm/exynos/exynos_drm_vidi.c | 49 ++++++++--------- 6 files changed, 130 insertions(+), 124 deletions(-)drivers/gpu/drm/exynos/exynos_drm_connector.c +1
-1@@ -198,7 +198,7 @@ static int exynos_drm_connector_fill_modes(structdrm_connector *connector, * resolution then get max width and height from that driver. */ if (ops && ops->get_max_resol) - ops->get_max_resol (manager->dev, &width, &height); + ops->get_max_resol (manager->ctx, &width, &height); return drm_helper_probe_single_connector_modes(connector, width,height);drivers/gpu/drm/exynos/exynos_drm_drv.h +14
-17@@ -162,26 +162,23 @@ struct exynos_drm_display_ops {* @win_disable: disable hardware specific overlay. */ struct exynos_drm_manager_ops { -int (*initialize)(struct device *subdrv_dev, -struct drm_device *drm_dev); -void (*dpms)(struct device *subdrv_dev,int mode); -void (*apply)(struct device *subdrv_dev); -void (*mode_fixup)(struct device *subdrv_dev, -struct drm_connector *connector, +int (*initialize)(void *ctx,struct drm_device *drm_dev); +void (*dpms)(void *ctx,int mode); +void (*apply)(void *ctx); +void (*mode_fixup)(void *ctx,struct drm_connector *connector,const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); -void (*mode_set)(struct device *subdrv_dev,void *mode); -void (*get_max_resol)(struct device *subdrv_dev,unsigned int *width, + void (*mode_set)(void *ctx, void *mode); +void (*get_max_resol)(void *ctx,unsigned int *width,unsigned int *height); -void (*commit)(struct device *subdrv_dev); -int (*enable_vblank)(struct device *subdrv_dev); -void (*disable_vblank)(struct device *subdrv_dev); -void (*wait_for_vblank)(struct device *subdrv_dev); -void (*win_mode_set)(struct device *subdrv_dev, -struct exynos_drm_overlay *overlay); -void (*win_commit)(struct device *subdrv_dev,int zpos); -void (*win_enable)(struct device *subdrv_dev,int zpos); -void (*win_disable)(struct device *subdrv_dev,int zpos); +void (*commit)(void *ctx); +int (*enable_vblank)(void *ctx); +void (*disable_vblank)(void *ctx); +void (*wait_for_vblank)(void *ctx); +void (*win_mode_set)(void *ctx,struct exynos_drm_overlay *overlay); +void (*win_commit)(void *ctx,int zpos); +void (*win_enable)(void *ctx,int zpos); +void (*win_disable)(void *ctx,int zpos); };
Quoted 17 lines
Quoted 8 lines
/*
drivers/gpu/drm/exynos/exynos_drm_drv.h +0
-0@@ -197,12 +194,14 @@ struct exynos_drm_manager_ops {* these callbacks should be set by specific drivers such fimd * or hdmi driver and are used to control display devices such as * analog tv, digital tv and lcd panel and also get timing data for them.
+ * @ctx: A pointer to the manager's implementation specific context */Quoted 6 lines
struct exynos_drm_manager { struct device *dev; int pipe; struct exynos_drm_manager_ops *ops; struct exynos_drm_display_ops *display_ops;+ void *ctx;
Plz, remove ctx we can use dev instead.
I'd rather not use dev, tbh. I think a good solution would be to pass exynos_drm_manager && exynos_drm_display through the exynos hooks instead. This will give us type checking in the compiler, as well as keeping the ctx pointers out of the abstraction layer. Sound good?
Quoted 140 lines
Quoted 19 lines
};
struct
exynos_drm_g2d_private{drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -74,7 +74,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)case DRM_MODE_DPMS_ON :if (manager_ops && manager_ops->apply)if (!exynos_encoder->updated) - manager_ops->apply (manager->dev); + manager_ops->apply (manager->ctx);exynos_drm_connector_power (encoder, mode);exynos_encoder->dpms = mode;drivers/gpu/drm/exynos/exynos_drm_encoder.c exynos_drm_encoder_mode_fixup(struct drm_encoder · line 112
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0
-1@@ -107,7 +107,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, list_for_each_entry(connector, &dev->mode_config.connector_list, head) {if (connector->encoder == encoder)if (manager_ops && manager_ops->mode_fixup) - manager_ops->mode_fixup(manager->dev,connector,
drivers/gpu/drm/exynos/exynos_drm_encoder.c exynos_drm_encoder_mode_fixup(struct drm_encoder · line 112
Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-0+ manager_ops->mode_fixup(manager->ctx,connector,
drivers/gpu/drm/exynos/exynos_drm_encoder.c exynos_drm_encoder_mode_fixup(struct drm_encoder · line 113
Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0
-0mode,
adjusted_mode);Quoted 50 lines
}drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -175,7 +175,7 @@ static void exynos_drm_encoder_mode_set(structdrm_encoder *encoder, manager_ops = manager->ops;if (manager_ops && manager_ops->mode_set) - manager_ops->mode_set (manager->dev, + manager_ops->mode_set (manager->ctx, adjusted_mode);exynos_encoder->old_crtc = encoder->crtc;drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -195,7 +195,7 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)struct exynos_drm_manager_ops *manager_ops = manager->ops;if (manager_ops && manager_ops->commit) - manager_ops->commit (manager->dev); + manager_ops->commit (manager->ctx);/* * this will avoid one issue that overlay data is updated to
drivers/gpu/drm/exynos/exynos_drm_encoder.c +2
-2@@ -341,7 +341,7 @@ exynos_drm_encoder_create(struct drm_device *dev,drm_encoder_helper_add (encoder, &exynos_encoder_helper_funcs);if (manager->ops && manager->ops->initialize) { - ret = manager->ops->initialize (manager->dev, dev); + ret = manager->ops->initialize (manager->ctx, dev);if (ret) {DRM_ERROR ("Manager initialize failed %d\n" , ret); goto error;@@ -408,7 +408,7 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data)return ;if (manager_ops->enable_vblank) - manager_ops->enable_vblank (manager->dev); + manager_ops->enable_vblank (manager->ctx); }void
exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -422,7 +422,7 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)return ;if (manager_ops->disable_vblank) - manager_ops->disable_vblank (manager->dev); + manager_ops->disable_vblank (manager->ctx); }Quoted 1 line
void exynos_drm_encoder_crtc_dpms(struct
drm_encoder*encoder, void*data)
Quoted 58 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -433,7 +433,7 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)int mode = *(int *)data;if (manager_ops && manager_ops->dpms) - manager_ops->dpms (manager->dev, mode); + manager_ops->dpms (manager->ctx, mode);/* * if this condition is ok then it means that the crtc is already
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -467,7 +467,7 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data)struct exynos_drm_overlay *overlay = data;if (manager_ops && manager_ops->win_mode_set) - manager_ops->win_mode_set (manager->dev, overlay); + manager_ops->win_mode_set (manager->ctx, overlay); }void exynos_drm_encoder_plane_commit(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -481,7 +481,7 @@ void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_commit) - manager_ops->win_commit (manager->dev, zpos); + manager_ops->win_commit (manager->ctx, zpos); }void exynos_drm_encoder_plane_enable(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -495,7 +495,7 @@ void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_enable) - manager_ops->win_enable (manager->dev, zpos); + manager_ops->win_enable (manager->ctx, zpos); }void exynos_drm_encoder_plane_disable(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -509,5 +509,5 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_disable) - manager_ops->win_disable (manager->dev, zpos); + manager_ops->win_disable (manager->ctx, zpos);}
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -106,6 +106,7 @@ struct fimd_win_data {
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c struct fimd_win_data { · line 108
Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0struct fimd_context {struct exynos_drm_subdrv subdrv;It seems that crtc device drivers such as fimd and hdmi mixer don't need to register subdrv. So remove?
Yeah, good catch, this is no longer needed.
Quoted 603 lines
drivers/gpu/drm/exynos/exynos_drm_hdmi.c static void drm_hdmi_apply(struct device
Quoted 408 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4
-4+struct device *dev;struct drm_device *drm_dev;int irq;struct drm_crtc *crtc;@@ -182,16 +183,15 @@ static struct exynos_drm_display_ops fimd_display_ops = { .power_on = fimd_display_power_on, }; -static void fimd_win_mode_set (struct device *dev, -struct exynos_drm_overlay *overlay) +static void fimd_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win;unsigned long offset;if (!overlay) { -dev_err (dev,"overlay is NULL\n" ); +DRM_ERROR ("overlay is NULL\n" );return ;}drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-4@@ -231,9 +231,8 @@ static void fimd_win_mode_set(struct device *dev, overlay->fb_width, overlay->crtc_width); } -static void fimd_win_set_pixfmt (struct device *dev,unsigned int win) +static void fimd_win_set_pixfmt (struct fimd_context *ctx,unsigned int win) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data = &ctx->win_data[win];unsigned long val;@@ -289,9 +288,8 @@ static void fimd_win_set_pixfmt(struct device *dev, unsigned int win) writel(val, ctx->regs + WINCON(win)); } -static void fimd_win_set_colkey (struct device *dev,unsigned int win) +static void fimd_win_set_colkey (struct fimd_context *ctx,unsigned int win) { -struct fimd_context *ctx =get_fimd_context (dev);unsigned int keycon0 =0 , keycon1 =0 ;keycon0 = ~(WxKEYCON0_KEYBL_EN |
WxKEYCON0_KEYEN_F|drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2@@ -330,9 +328,9 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx,writel (val, ctx->regs + reg); } -static void fimd_win_commit (struct device *dev,int zpos) +static void fimd_win_commit (void *in_ctx,int zpos) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win = zpos;unsigned long val, alpha, size;drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2@@ -427,11 +425,11 @@ static void fimd_win_commit(struct device *dev, int zpos) DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); } -fimd_win_set_pixfmt (dev, win); +fimd_win_set_pixfmt (ctx, win);/* hardware window 0 doesn't support color key. */ if (win !=0 ) -fimd_win_set_colkey (dev, win); +fimd_win_set_colkey (ctx, win);/* wincon */ val = readl(ctx->regs + WINCON(win));drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2@@ -450,9 +448,9 @@ static void fimd_win_commit(struct device *dev, int zpos) win_data->enabled = true; } -static void fimd_win_disable (struct device *dev,int zpos) +static void fimd_win_disable (void *in_ctx,int zpos) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win = zpos;u32 val;drivers/gpu/drm/exynos/exynos_drm_fimd.c +6
-7@@ -491,19 +489,18 @@ static void fimd_win_disable(struct device *dev, int zpos) win_data->enabled = false; } -static int fimd_mgr_initialize (struct device *subdrv_dev, -struct drm_device *drm_dev) +static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx; ctx->drm_dev = drm_dev;return 0 ; } -static void fimd_dpms (struct device *subdrv_dev,int mode) +static void fimd_dpms (void *in_ctx,int mode) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx;DRM_DEBUG_KMS ("%d\n" , mode);@@ -518,13 +515,13 @@ static void fimd_dpms(struct device *subdrv_dev, intmode) * clk_enable could be called double time. */ if (ctx->suspended) -pm_runtime_get_sync (subdrv_dev); +pm_runtime_get_sync (ctx->dev);break ;case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :case DRM_MODE_DPMS_OFF :if (!ctx->suspended) -pm_runtime_put_sync (subdrv_dev); +pm_runtime_put_sync (ctx->dev);break ;default :DRM_DEBUG_KMS("unspecified mode %d\n", mode);drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2@@ -534,9 +531,9 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) mutex_unlock(&ctx->lock); } -static void fimd_apply (struct device *subdrv_dev) +static void fimd_apply (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx;struct exynos_drm_manager *mgr = ctx->subdrv.manager;struct exynos_drm_manager_ops *mgr_ops = mgr->ops;struct fimd_win_data *win_data;drivers/gpu/drm/exynos/exynos_drm_fimd.c +15
-13@@ -545,16 +542,16 @@ static void fimd_apply(struct device *subdrv_dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i];if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (subdrv_dev, i); + mgr_ops->win_commit (ctx, i); }if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (subdrv_dev); + mgr_ops->commit (ctx); } -static void fimd_commit (struct device *dev) +static void fimd_commit (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct exynos_drm_panel_info *panel = &ctx->panel;struct videomode *vm = &panel->vm;struct fimd_driver_data *driver_data;@@ -608,9 +605,9 @@ static void fimd_commit(struct device *dev)writel (val, ctx->regs +VIDCON0 ); } -static int fimd_enable_vblank (struct device *dev) +static int fimd_enable_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;u32 val;if (ctx->suspended)@@ -633,9 +630,9 @@ static int fimd_enable_vblank(struct device *dev)return 0 ; } -static void fimd_disable_vblank (struct device *dev) +static void fimd_disable_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;u32 val;if (ctx->suspended)@@ -651,9 +648,9 @@ static void fimd_disable_vblank(struct device *dev) } } -static void fimd_wait_for_vblank (struct device *dev) +static void fimd_wait_for_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;if (ctx->suspended)return ;@@ -845,9 +842,9 @@ static void fimd_window_suspend(struct device *dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i]; win_data->resume = win_data->enabled; -fimd_win_disable (dev, i); +fimd_win_disable (ctx, i); } -fimd_wait_for_vblank (dev); +fimd_wait_for_vblank (ctx); }static void fimd_window_resume (struct device *dev)@@ -963,6 +960,8 @@ static int fimd_probe(struct platform_device *pdev)DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); + fimd_manager.ctx = ctx; + subdrv = &ctx->subdrv; subdrv->dev = dev;@@ -1042,7 +1041,7 @@ static int fimd_resume(struct device *dev)* registers but in case of sleep wakeup, it's not. * so fimd_apply function should be called at here. */ -fimd_apply (dev); +fimd_apply (ctx); }return 0 ;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +1
-3@@ -129,11 +129,9 @@ static struct edid *drm_hdmi_get_edid(struct device *dev, return NULL; } - -static int drm_hdmi_check_mode (struct device *dev, +static int drm_hdmi_check_mode_ctx (struct drm_hdmi_context *ctx,struct drm_display_mode *mode) { -struct drm_hdmi_context *ctx =to_context (dev);int ret =0 ;/*drivers/gpu/drm/exynos/exynos_drm_hdmi.c +17
-9@@ -153,6 +151,14 @@ static int drm_hdmi_check_mode(struct device *dev,return 0 ; } +static int drm_hdmi_check_mode (struct device *dev, +struct drm_display_mode *mode) +{ +struct drm_hdmi_context *ctx =to_context (dev); + +return drm_hdmi_check_mode_ctx (ctx, mode); +} +static int drm_hdmi_power_on (struct device *dev,int mode) {struct drm_hdmi_context *ctx =to_context (dev);@@ -172,9 +178,9 @@ static struct exynos_drm_display_ops drm_hdmi_display_ops = { .power_on = drm_hdmi_power_on, }; -static int drm_hdmi_enable_vblank (struct device *subdrv_dev) +static int drm_hdmi_enable_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;struct exynos_drm_subdrv *subdrv = &ctx->subdrv;struct exynos_drm_manager *manager = subdrv->manager;@@ -185,33 +191,33 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev)return 0 ; } -static void drm_hdmi_disable_vblank (struct device *subdrv_dev) +static void drm_hdmi_disable_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->disable_vblank)return mixer_ops->disable_vblank (ctx->mixer_ctx->ctx); } -static void drm_hdmi_wait_for_vblank (struct device *subdrv_dev) +static void drm_hdmi_wait_for_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->wait_for_vblank) mixer_ops->wait_for_vblank (ctx->mixer_ctx->ctx); } -static void drm_hdmi_mode_fixup (struct device *subdrv_dev, -struct drm_connector *connector, +static void drm_hdmi_mode_fixup (void *in_ctx,struct drm_connector *connector,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) { +struct drm_hdmi_context *ctx = in_ctx;struct drm_display_mode *m;int mode_ok;drm_mode_set_crtcinfo (adjusted_mode,0 ); - mode_ok =drm_hdmi_check_mode (subdrv_dev, adjusted_mode); + mode_ok =drm_hdmi_check_mode_ctx (ctx, adjusted_mode);/* just return if user desired mode exists. */ if (mode_ok == 0)drivers/gpu/drm/exynos/exynos_drm_hdmi.c +1
-1@@ -222,7 +228,7 @@ static void drm_hdmi_mode_fixup(struct device*subdrv_dev, * to adjusted_mode. */ list_for_each_entry (m, &connector->modes, head) { - mode_ok =drm_hdmi_check_mode (subdrv_dev, m); + mode_ok =drm_hdmi_check_mode_ctx (ctx, m);if (mode_ok ==0 ) {struct drm_mode_object base;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +9
-10@@ -245,35 +251,34 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, } } -static void drm_hdmi_mode_set (struct device *subdrv_dev,void *mode) +static void drm_hdmi_mode_set (void *in_ctx,void *mode) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->mode_set) hdmi_ops->mode_set (ctx->hdmi_ctx->ctx, mode); } -static void drm_hdmi_get_max_resol (struct device *subdrv_dev, -unsigned int *width,unsigned int *height) +static void drm_hdmi_get_max_resol (void *in_ctx,unsigned int *width, +unsigned int *height) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->get_max_resol) hdmi_ops->get_max_resol (ctx->hdmi_ctx->ctx, width, height); } -static void drm_hdmi_commit (struct device *subdrv_dev) +static void drm_hdmi_commit (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->commit) hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static int drm_hdmi_mgr_initialize (struct device *subdrv_dev, -struct drm_device *drm_dev) +static int drm_hdmi_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int ret =0 ;if (mixer_ops && mixer_ops->initialize)drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-2@@ -285,9 +290,9 @@ static int drm_hdmi_mgr_initialize(struct device *subdrv_dev, return ret; } -static void drm_hdmi_dpms (struct device *subdrv_dev,int mode) +static void drm_hdmi_dpms (void *in_ctx,int mode) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->dpms)mixer_ops->dpms(ctx->mixer_ctx->ctx, mode);drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-2@@ -296,9 +301,9 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode); } -static void drm_hdmi_apply (struct device *subdrv_dev) +static void drm_hdmi_apply (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int i;for (i = 0; i < MIXER_WIN_NR; i++) {drivers/gpu/drm/exynos/exynos_drm_hdmi.c +0
-0@@ -312,18 +317,18 @@ static void drm_hdmi_apply(struct device
*subdrv_dev)Quoted 193 lines
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +7
-7hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static void drm_mixer_win_mode_set (struct device *subdrv_dev, -struct exynos_drm_overlay *overlay) +static void drm_mixer_win_mode_set (void *in_ctx, +struct exynos_drm_overlay *overlay) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->win_mode_set) mixer_ops->win_mode_set (ctx->mixer_ctx->ctx, overlay); } -static void drm_mixer_win_commit (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_commit (void *in_ctx,int zpos) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;if (win <0 || win >=MIXER_WIN_NR ) {@@ -337,9 +342,9 @@ static void drm_mixer_win_commit(struct device *subdrv_dev, int zpos) ctx->enabled[win] = true; } -static void drm_mixer_win_disable (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_disable (void *in_ctx,int zpos) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;if (win < 0 || win >= MIXER_WIN_NR) {drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-0@@ -425,6 +430,8 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev)if (!ctx)return -ENOMEM ; + hdmi_manager.ctx = ctx; + subdrv = &ctx->subdrv;subdrv->dev = dev;drivers/gpu/drm/exynos/exynos_drm_vidi.c +4
-4@@ -152,9 +152,9 @@ static struct exynos_drm_display_ops vidi_display_ops = { .power_on = vidi_display_power_on, }; -static void vidi_dpms (struct device *subdrv_dev,int mode) +static void vidi_dpms (void *in_ctx,int mode) { -struct vidi_context *ctx =get_vidi_context (subdrv_dev); +struct vidi_context *ctx = in_ctx;DRM_DEBUG_KMS ("%d\n" , mode);@@ -177,9 +177,9 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) mutex_unlock(&ctx->lock); } -static void vidi_apply (struct device *subdrv_dev) +static void vidi_apply (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (subdrv_dev); +struct vidi_context *ctx = in_ctx;struct exynos_drm_manager *mgr = ctx->subdrv.manager;struct exynos_drm_manager_ops *mgr_ops = mgr->ops;struct vidi_win_data *win_data;drivers/gpu/drm/exynos/exynos_drm_vidi.c +21
-20@@ -188,24 +188,24 @@ static void vidi_apply(struct device *subdrv_dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i];if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (subdrv_dev, i); + mgr_ops->win_commit (ctx, i); }if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (subdrv_dev); + mgr_ops->commit (ctx); } -static void vidi_commit (struct device *dev) +static void vidi_commit (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return ; } -static int vidi_enable_vblank (struct device *dev) +static int vidi_enable_vblank (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return -EPERM ;@@ -225,9 +225,9 @@ static int vidi_enable_vblank(struct device *dev)return 0 ; } -static void vidi_disable_vblank (struct device *dev) +static void vidi_disable_vblank (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return ;@@ -236,16 +236,15 @@ static void vidi_disable_vblank(struct device *dev) ctx->vblank_on = false; } -static void vidi_win_mode_set (struct device *dev, -struct exynos_drm_overlay *overlay) +static void vidi_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win;unsigned long offset;if (!overlay) { -dev_err (dev,"overlay is NULL\n" ); +DRM_ERROR ("overlay is NULL\n" );return ; }@@ -289,9 +288,9 @@ static void vidi_win_mode_set(struct device *dev, overlay->fb_width, overlay->crtc_width); } -static void vidi_win_commit (struct device *dev,int zpos) +static void vidi_win_commit (void *in_ctx,int zpos) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win = zpos;@@ -314,9 +313,9 @@ static void vidi_win_commit(struct device *dev, int zpos) schedule_work(&ctx->work); } -static void vidi_win_disable (struct device *dev,int zpos) +static void vidi_win_disable (void *in_ctx,int zpos) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win = zpos;@@ -405,17 +404,19 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev, struct device *dev)static int vidi_power_on (struct vidi_context *ctx,bool enable) { -struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct device *dev = subdrv->dev; +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +if (enable != false && enable != true) +return -EINVAL ;if (enable) { ctx->suspended = false;/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit (0 , &ctx->irq_flags)) -vidi_enable_vblank (dev); +vidi_enable_vblank (ctx); -vidi_apply (dev); +vidi_apply (ctx); }else { ctx->suspended = true;}--
1.8.4
Inki Dae
maintainerRe: [PATCH 06/23] drm/exynos: Pass context in manager ops instead of dev
2013/10/14 Sean Paul <[email protected]>:
Quoted 125 lines · Inki Dae
Quoted 106 lines
Hi, Sean.
It's a great patch set.:) That's exactly what we want. So I'd like to merge all patch set to exynos-drm-next if there is no design issue about next week. And then we can add additional minor patches from others.
Before that, can you re-send all patch set like below?
1. Do not rebase them at top of lvds-bridge patch set.
2. Change all patch set for callbacks to be called_with_device_objectinstead of ctx.The below is my comments.
Thanks for your contributions,
Inki DaeQuoted 14 lines
-----Original Message-----
From: Sean Paul [mailto:[email protected]]
Sent: Friday, October 11, 2013 9:30 AM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Sean Paul
Subject: [PATCH 06/23] drm/exynos: Pass context in manager ops instead of devThis patch changes the manager ops callbacks from accepting the subdrv device pointer to taking a context pointer. This will allow us to move closer to decoupling manager/display from subdrv, and subsequently decoupling the crtc/plane from the encoder.
Quoted 6 lines
Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_connector.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 33 ++++++------ drivers/gpu/drm/exynos/exynos_drm_encoder.c | 24 ++++----- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 71+++++++++++++----------
Quoted 2 lines
--
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 75+++++++++++++++--------
Quoted 65 lines
----
drivers/gpu/drm/exynos/exynos_drm_vidi.c | 49 ++++++++--------- 6 files changed, 130 insertions(+), 124 deletions(-)drivers/gpu/drm/exynos/exynos_drm_connector.c +1
-1@@ -198,7 +198,7 @@ static int exynos_drm_connector_fill_modes(structdrm_connector *connector, * resolution then get max width and height from that driver. */ if (ops && ops->get_max_resol) - ops->get_max_resol (manager->dev, &width, &height); + ops->get_max_resol (manager->ctx, &width, &height); return drm_helper_probe_single_connector_modes(connector, width,height);drivers/gpu/drm/exynos/exynos_drm_drv.h +14
-17@@ -162,26 +162,23 @@ struct exynos_drm_display_ops {* @win_disable: disable hardware specific overlay. */ struct exynos_drm_manager_ops { -int (*initialize)(struct device *subdrv_dev, -struct drm_device *drm_dev); -void (*dpms)(struct device *subdrv_dev,int mode); -void (*apply)(struct device *subdrv_dev); -void (*mode_fixup)(struct device *subdrv_dev, -struct drm_connector *connector, +int (*initialize)(void *ctx,struct drm_device *drm_dev); +void (*dpms)(void *ctx,int mode); +void (*apply)(void *ctx); +void (*mode_fixup)(void *ctx,struct drm_connector *connector,const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); -void (*mode_set)(struct device *subdrv_dev,void *mode); -void (*get_max_resol)(struct device *subdrv_dev,unsigned int *width, + void (*mode_set)(void *ctx, void *mode); +void (*get_max_resol)(void *ctx,unsigned int *width,unsigned int *height); -void (*commit)(struct device *subdrv_dev); -int (*enable_vblank)(struct device *subdrv_dev); -void (*disable_vblank)(struct device *subdrv_dev); -void (*wait_for_vblank)(struct device *subdrv_dev); -void (*win_mode_set)(struct device *subdrv_dev, -struct exynos_drm_overlay *overlay); -void (*win_commit)(struct device *subdrv_dev,int zpos); -void (*win_enable)(struct device *subdrv_dev,int zpos); -void (*win_disable)(struct device *subdrv_dev,int zpos); +void (*commit)(void *ctx); +int (*enable_vblank)(void *ctx); +void (*disable_vblank)(void *ctx); +void (*wait_for_vblank)(void *ctx); +void (*win_mode_set)(void *ctx,struct exynos_drm_overlay *overlay); +void (*win_commit)(void *ctx,int zpos); +void (*win_enable)(void *ctx,int zpos); +void (*win_disable)(void *ctx,int zpos); };Quoted 17 lines
Quoted 8 lines
/*
drivers/gpu/drm/exynos/exynos_drm_drv.h +0
-0@@ -197,12 +194,14 @@ struct exynos_drm_manager_ops {* these callbacks should be set by specific drivers such fimd * or hdmi driver and are used to control display devices such as * analog tv, digital tv and lcd panel and also get timing data for them.
+ * @ctx: A pointer to the manager's implementation specific context */Quoted 6 lines
struct exynos_drm_manager { struct device *dev; int pipe; struct exynos_drm_manager_ops *ops; struct exynos_drm_display_ops *display_ops;+ void *ctx;
Plz, remove ctx we can use dev instead.
Quoted 4 lines
I'd rather not use dev, tbh. I think a good solution would be to pass
exynos_drm_manager&&exynos_drm_displaythrough the exynos hooks instead. This will give us type checking in the compiler, as well as keeping the ctx pointers out of the abstraction layer. Sound good?
manager->ops->xxx(manager, ...);display->ops->xxx(display, ...);
Agree.
Quoted 757 lines
Quoted 141 lines
Quoted 20 lines
};
struct
exynos_drm_g2d_private{drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -74,7 +74,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)case DRM_MODE_DPMS_ON :if (manager_ops && manager_ops->apply)if (!exynos_encoder->updated) - manager_ops->apply (manager->dev); + manager_ops->apply (manager->ctx);exynos_drm_connector_power (encoder, mode);exynos_encoder->dpms = mode;drivers/gpu/drm/exynos/exynos_drm_encoder.c exynos_drm_encoder_mode_fixup(struct drm_encoder · line 112
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0
-1@@ -107,7 +107,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, list_for_each_entry(connector, &dev->mode_config.connector_list, head) {if (connector->encoder == encoder)if (manager_ops && manager_ops->mode_fixup) - manager_ops->mode_fixup(manager->dev,connector,
drivers/gpu/drm/exynos/exynos_drm_encoder.c exynos_drm_encoder_mode_fixup(struct drm_encoder · line 112
Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-0+ manager_ops->mode_fixup(manager->ctx,connector,
drivers/gpu/drm/exynos/exynos_drm_encoder.c exynos_drm_encoder_mode_fixup(struct drm_encoder · line 113
Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0
-0mode,
adjusted_mode);Quoted 50 lines
}drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -175,7 +175,7 @@ static void exynos_drm_encoder_mode_set(structdrm_encoder *encoder, manager_ops = manager->ops;if (manager_ops && manager_ops->mode_set) - manager_ops->mode_set (manager->dev, + manager_ops->mode_set (manager->ctx, adjusted_mode);exynos_encoder->old_crtc = encoder->crtc;drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -195,7 +195,7 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)struct exynos_drm_manager_ops *manager_ops = manager->ops;if (manager_ops && manager_ops->commit) - manager_ops->commit (manager->dev); + manager_ops->commit (manager->ctx);/* * this will avoid one issue that overlay data is updated to
drivers/gpu/drm/exynos/exynos_drm_encoder.c +2
-2@@ -341,7 +341,7 @@ exynos_drm_encoder_create(struct drm_device *dev,drm_encoder_helper_add (encoder, &exynos_encoder_helper_funcs);if (manager->ops && manager->ops->initialize) { - ret = manager->ops->initialize (manager->dev, dev); + ret = manager->ops->initialize (manager->ctx, dev);if (ret) {DRM_ERROR ("Manager initialize failed %d\n" , ret); goto error;@@ -408,7 +408,7 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data)return ;if (manager_ops->enable_vblank) - manager_ops->enable_vblank (manager->dev); + manager_ops->enable_vblank (manager->ctx); }void
exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -422,7 +422,7 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)return ;if (manager_ops->disable_vblank) - manager_ops->disable_vblank (manager->dev); + manager_ops->disable_vblank (manager->ctx); }Quoted 1 line
void exynos_drm_encoder_crtc_dpms(struct
drm_encoder*encoder, void*data)
Quoted 58 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -433,7 +433,7 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)int mode = *(int *)data;if (manager_ops && manager_ops->dpms) - manager_ops->dpms (manager->dev, mode); + manager_ops->dpms (manager->ctx, mode);/* * if this condition is ok then it means that the crtc is already
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -467,7 +467,7 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data)struct exynos_drm_overlay *overlay = data;if (manager_ops && manager_ops->win_mode_set) - manager_ops->win_mode_set (manager->dev, overlay); + manager_ops->win_mode_set (manager->ctx, overlay); }void exynos_drm_encoder_plane_commit(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -481,7 +481,7 @@ void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_commit) - manager_ops->win_commit (manager->dev, zpos); + manager_ops->win_commit (manager->ctx, zpos); }void exynos_drm_encoder_plane_enable(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -495,7 +495,7 @@ void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_enable) - manager_ops->win_enable (manager->dev, zpos); + manager_ops->win_enable (manager->ctx, zpos); }void exynos_drm_encoder_plane_disable(struct
drm_encoder*encoder, void
*data)drivers/gpu/drm/exynos/exynos_drm_encoder.c +1
-1@@ -509,5 +509,5 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data) zpos = *(int *)data;if (manager_ops && manager_ops->win_disable) - manager_ops->win_disable (manager->dev, zpos); + manager_ops->win_disable (manager->ctx, zpos);}
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -106,6 +106,7 @@ struct fimd_win_data {Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c struct fimd_win_data { · line 108
Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0struct fimd_context {struct exynos_drm_subdrv subdrv;It seems that crtc device drivers such as fimd and hdmi mixer don't need to register subdrv. So remove?
Yeah, good catch, this is no longer needed.
Quoted 595 lines
drivers/gpu/drm/exynos/exynos_drm_hdmi.c static void drm_hdmi_apply(struct device
Quoted 408 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4
-4+struct device *dev;struct drm_device *drm_dev;int irq;struct drm_crtc *crtc;@@ -182,16 +183,15 @@ static struct exynos_drm_display_ops fimd_display_ops = { .power_on = fimd_display_power_on, }; -static void fimd_win_mode_set (struct device *dev, -struct exynos_drm_overlay *overlay) +static void fimd_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win;unsigned long offset;if (!overlay) { -dev_err (dev,"overlay is NULL\n" ); +DRM_ERROR ("overlay is NULL\n" );return ;}drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-4@@ -231,9 +231,8 @@ static void fimd_win_mode_set(struct device *dev, overlay->fb_width, overlay->crtc_width); } -static void fimd_win_set_pixfmt (struct device *dev,unsigned int win) +static void fimd_win_set_pixfmt (struct fimd_context *ctx,unsigned int win) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data = &ctx->win_data[win];unsigned long val;@@ -289,9 +288,8 @@ static void fimd_win_set_pixfmt(struct device *dev, unsigned int win) writel(val, ctx->regs + WINCON(win)); } -static void fimd_win_set_colkey (struct device *dev,unsigned int win) +static void fimd_win_set_colkey (struct fimd_context *ctx,unsigned int win) { -struct fimd_context *ctx =get_fimd_context (dev);unsigned int keycon0 =0 , keycon1 =0 ;keycon0 = ~(WxKEYCON0_KEYBL_EN |
WxKEYCON0_KEYEN_F|drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2@@ -330,9 +328,9 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx,writel (val, ctx->regs + reg); } -static void fimd_win_commit (struct device *dev,int zpos) +static void fimd_win_commit (void *in_ctx,int zpos) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win = zpos;unsigned long val, alpha, size;drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2@@ -427,11 +425,11 @@ static void fimd_win_commit(struct device *dev, int zpos) DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); } -fimd_win_set_pixfmt (dev, win); +fimd_win_set_pixfmt (ctx, win);/* hardware window 0 doesn't support color key. */ if (win !=0 ) -fimd_win_set_colkey (dev, win); +fimd_win_set_colkey (ctx, win);/* wincon */ val = readl(ctx->regs + WINCON(win));drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2@@ -450,9 +448,9 @@ static void fimd_win_commit(struct device *dev, int zpos) win_data->enabled = true; } -static void fimd_win_disable (struct device *dev,int zpos) +static void fimd_win_disable (void *in_ctx,int zpos) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct fimd_win_data *win_data;int win = zpos;u32 val;drivers/gpu/drm/exynos/exynos_drm_fimd.c +6
-7@@ -491,19 +489,18 @@ static void fimd_win_disable(struct device *dev, int zpos) win_data->enabled = false; } -static int fimd_mgr_initialize (struct device *subdrv_dev, -struct drm_device *drm_dev) +static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx; ctx->drm_dev = drm_dev;return 0 ; } -static void fimd_dpms (struct device *subdrv_dev,int mode) +static void fimd_dpms (void *in_ctx,int mode) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx;DRM_DEBUG_KMS ("%d\n" , mode);@@ -518,13 +515,13 @@ static void fimd_dpms(struct device *subdrv_dev, intmode) * clk_enable could be called double time. */ if (ctx->suspended) -pm_runtime_get_sync (subdrv_dev); +pm_runtime_get_sync (ctx->dev);break ;case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :case DRM_MODE_DPMS_OFF :if (!ctx->suspended) -pm_runtime_put_sync (subdrv_dev); +pm_runtime_put_sync (ctx->dev);break ;default :DRM_DEBUG_KMS("unspecified mode %d\n", mode);drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2@@ -534,9 +531,9 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) mutex_unlock(&ctx->lock); } -static void fimd_apply (struct device *subdrv_dev) +static void fimd_apply (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (subdrv_dev); +struct fimd_context *ctx = in_ctx;struct exynos_drm_manager *mgr = ctx->subdrv.manager;struct exynos_drm_manager_ops *mgr_ops = mgr->ops;struct fimd_win_data *win_data;drivers/gpu/drm/exynos/exynos_drm_fimd.c +15
-13@@ -545,16 +542,16 @@ static void fimd_apply(struct device *subdrv_dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i];if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (subdrv_dev, i); + mgr_ops->win_commit (ctx, i); }if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (subdrv_dev); + mgr_ops->commit (ctx); } -static void fimd_commit (struct device *dev) +static void fimd_commit (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;struct exynos_drm_panel_info *panel = &ctx->panel;struct videomode *vm = &panel->vm;struct fimd_driver_data *driver_data;@@ -608,9 +605,9 @@ static void fimd_commit(struct device *dev)writel (val, ctx->regs +VIDCON0 ); } -static int fimd_enable_vblank (struct device *dev) +static int fimd_enable_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;u32 val;if (ctx->suspended)@@ -633,9 +630,9 @@ static int fimd_enable_vblank(struct device *dev)return 0 ; } -static void fimd_disable_vblank (struct device *dev) +static void fimd_disable_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;u32 val;if (ctx->suspended)@@ -651,9 +648,9 @@ static void fimd_disable_vblank(struct device *dev) } } -static void fimd_wait_for_vblank (struct device *dev) +static void fimd_wait_for_vblank (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;if (ctx->suspended)return ;@@ -845,9 +842,9 @@ static void fimd_window_suspend(struct device *dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i]; win_data->resume = win_data->enabled; -fimd_win_disable (dev, i); +fimd_win_disable (ctx, i); } -fimd_wait_for_vblank (dev); +fimd_wait_for_vblank (ctx); }static void fimd_window_resume (struct device *dev)@@ -963,6 +960,8 @@ static int fimd_probe(struct platform_device *pdev)DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); + fimd_manager.ctx = ctx; + subdrv = &ctx->subdrv; subdrv->dev = dev;@@ -1042,7 +1041,7 @@ static int fimd_resume(struct device *dev)* registers but in case of sleep wakeup, it's not. * so fimd_apply function should be called at here. */ -fimd_apply (dev); +fimd_apply (ctx); }return 0 ;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +1
-3@@ -129,11 +129,9 @@ static struct edid *drm_hdmi_get_edid(struct device *dev, return NULL; } - -static int drm_hdmi_check_mode (struct device *dev, +static int drm_hdmi_check_mode_ctx (struct drm_hdmi_context *ctx,struct drm_display_mode *mode) { -struct drm_hdmi_context *ctx =to_context (dev);int ret =0 ;/*drivers/gpu/drm/exynos/exynos_drm_hdmi.c +17
-9@@ -153,6 +151,14 @@ static int drm_hdmi_check_mode(struct device *dev,return 0 ; } +static int drm_hdmi_check_mode (struct device *dev, +struct drm_display_mode *mode) +{ +struct drm_hdmi_context *ctx =to_context (dev); + +return drm_hdmi_check_mode_ctx (ctx, mode); +} +static int drm_hdmi_power_on (struct device *dev,int mode) {struct drm_hdmi_context *ctx =to_context (dev);@@ -172,9 +178,9 @@ static struct exynos_drm_display_ops drm_hdmi_display_ops = { .power_on = drm_hdmi_power_on, }; -static int drm_hdmi_enable_vblank (struct device *subdrv_dev) +static int drm_hdmi_enable_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;struct exynos_drm_subdrv *subdrv = &ctx->subdrv;struct exynos_drm_manager *manager = subdrv->manager;@@ -185,33 +191,33 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev)return 0 ; } -static void drm_hdmi_disable_vblank (struct device *subdrv_dev) +static void drm_hdmi_disable_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->disable_vblank)return mixer_ops->disable_vblank (ctx->mixer_ctx->ctx); } -static void drm_hdmi_wait_for_vblank (struct device *subdrv_dev) +static void drm_hdmi_wait_for_vblank (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->wait_for_vblank) mixer_ops->wait_for_vblank (ctx->mixer_ctx->ctx); } -static void drm_hdmi_mode_fixup (struct device *subdrv_dev, -struct drm_connector *connector, +static void drm_hdmi_mode_fixup (void *in_ctx,struct drm_connector *connector,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) { +struct drm_hdmi_context *ctx = in_ctx;struct drm_display_mode *m;int mode_ok;drm_mode_set_crtcinfo (adjusted_mode,0 ); - mode_ok =drm_hdmi_check_mode (subdrv_dev, adjusted_mode); + mode_ok =drm_hdmi_check_mode_ctx (ctx, adjusted_mode);/* just return if user desired mode exists. */ if (mode_ok == 0)drivers/gpu/drm/exynos/exynos_drm_hdmi.c +1
-1@@ -222,7 +228,7 @@ static void drm_hdmi_mode_fixup(struct device*subdrv_dev, * to adjusted_mode. */ list_for_each_entry (m, &connector->modes, head) { - mode_ok =drm_hdmi_check_mode (subdrv_dev, m); + mode_ok =drm_hdmi_check_mode_ctx (ctx, m);if (mode_ok ==0 ) {struct drm_mode_object base;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +9
-10@@ -245,35 +251,34 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, } } -static void drm_hdmi_mode_set (struct device *subdrv_dev,void *mode) +static void drm_hdmi_mode_set (void *in_ctx,void *mode) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->mode_set) hdmi_ops->mode_set (ctx->hdmi_ctx->ctx, mode); } -static void drm_hdmi_get_max_resol (struct device *subdrv_dev, -unsigned int *width,unsigned int *height) +static void drm_hdmi_get_max_resol (void *in_ctx,unsigned int *width, +unsigned int *height) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->get_max_resol) hdmi_ops->get_max_resol (ctx->hdmi_ctx->ctx, width, height); } -static void drm_hdmi_commit (struct device *subdrv_dev) +static void drm_hdmi_commit (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->commit) hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static int drm_hdmi_mgr_initialize (struct device *subdrv_dev, -struct drm_device *drm_dev) +static int drm_hdmi_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int ret =0 ;if (mixer_ops && mixer_ops->initialize)drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-2@@ -285,9 +290,9 @@ static int drm_hdmi_mgr_initialize(struct device *subdrv_dev, return ret; } -static void drm_hdmi_dpms (struct device *subdrv_dev,int mode) +static void drm_hdmi_dpms (void *in_ctx,int mode) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->dpms)mixer_ops->dpms(ctx->mixer_ctx->ctx, mode);drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-2@@ -296,9 +301,9 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode); } -static void drm_hdmi_apply (struct device *subdrv_dev) +static void drm_hdmi_apply (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int i;for (i = 0; i < MIXER_WIN_NR; i++) {drivers/gpu/drm/exynos/exynos_drm_hdmi.c +0
-0@@ -312,18 +317,18 @@ static void drm_hdmi_apply(struct device
*subdrv_dev)Quoted 186 lines
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +7
-7hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static void drm_mixer_win_mode_set (struct device *subdrv_dev, -struct exynos_drm_overlay *overlay) +static void drm_mixer_win_mode_set (void *in_ctx, +struct exynos_drm_overlay *overlay) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;if (mixer_ops && mixer_ops->win_mode_set) mixer_ops->win_mode_set (ctx->mixer_ctx->ctx, overlay); } -static void drm_mixer_win_commit (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_commit (void *in_ctx,int zpos) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;if (win <0 || win >=MIXER_WIN_NR ) {@@ -337,9 +342,9 @@ static void drm_mixer_win_commit(struct device *subdrv_dev, int zpos) ctx->enabled[win] = true; } -static void drm_mixer_win_disable (struct device *subdrv_dev,int zpos) +static void drm_mixer_win_disable (void *in_ctx,int zpos) { -struct drm_hdmi_context *ctx =to_context (subdrv_dev); +struct drm_hdmi_context *ctx = in_ctx;int win = (zpos ==DEFAULT_ZPOS ) ?MIXER_DEFAULT_WIN : zpos;if (win < 0 || win >= MIXER_WIN_NR) {drivers/gpu/drm/exynos/exynos_drm_hdmi.c +2
-0@@ -425,6 +430,8 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev)if (!ctx)return -ENOMEM ; + hdmi_manager.ctx = ctx; + subdrv = &ctx->subdrv;subdrv->dev = dev;drivers/gpu/drm/exynos/exynos_drm_vidi.c +4
-4@@ -152,9 +152,9 @@ static struct exynos_drm_display_ops vidi_display_ops = { .power_on = vidi_display_power_on, }; -static void vidi_dpms (struct device *subdrv_dev,int mode) +static void vidi_dpms (void *in_ctx,int mode) { -struct vidi_context *ctx =get_vidi_context (subdrv_dev); +struct vidi_context *ctx = in_ctx;DRM_DEBUG_KMS ("%d\n" , mode);@@ -177,9 +177,9 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) mutex_unlock(&ctx->lock); } -static void vidi_apply (struct device *subdrv_dev) +static void vidi_apply (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (subdrv_dev); +struct vidi_context *ctx = in_ctx;struct exynos_drm_manager *mgr = ctx->subdrv.manager;struct exynos_drm_manager_ops *mgr_ops = mgr->ops;struct vidi_win_data *win_data;drivers/gpu/drm/exynos/exynos_drm_vidi.c +20
-19@@ -188,24 +188,24 @@ static void vidi_apply(struct device *subdrv_dev)for (i =0 ; i <WINDOWS_NR ; i++) { win_data = &ctx->win_data[i];if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (subdrv_dev, i); + mgr_ops->win_commit (ctx, i); }if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (subdrv_dev); + mgr_ops->commit (ctx); } -static void vidi_commit (struct device *dev) +static void vidi_commit (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return ; } -static int vidi_enable_vblank (struct device *dev) +static int vidi_enable_vblank (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return -EPERM ;@@ -225,9 +225,9 @@ static int vidi_enable_vblank(struct device *dev)return 0 ; } -static void vidi_disable_vblank (struct device *dev) +static void vidi_disable_vblank (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;if (ctx->suspended)return ;@@ -236,16 +236,15 @@ static void vidi_disable_vblank(struct device *dev) ctx->vblank_on = false; } -static void vidi_win_mode_set (struct device *dev, -struct exynos_drm_overlay *overlay) +static void vidi_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win;unsigned long offset;if (!overlay) { -dev_err (dev,"overlay is NULL\n" ); +DRM_ERROR ("overlay is NULL\n" );return ; }@@ -289,9 +288,9 @@ static void vidi_win_mode_set(struct device *dev, overlay->fb_width, overlay->crtc_width); } -static void vidi_win_commit (struct device *dev,int zpos) +static void vidi_win_commit (void *in_ctx,int zpos) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win = zpos;@@ -314,9 +313,9 @@ static void vidi_win_commit(struct device *dev, int zpos) schedule_work(&ctx->work); } -static void vidi_win_disable (struct device *dev,int zpos) +static void vidi_win_disable (void *in_ctx,int zpos) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct vidi_win_data *win_data;int win = zpos;@@ -405,17 +404,19 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev, struct device *dev)static int vidi_power_on (struct vidi_context *ctx,bool enable) { -struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct device *dev = subdrv->dev; +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +if (enable != false && enable != true) +return -EINVAL ;if (enable) { ctx->suspended = false;/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit (0 , &ctx->irq_flags)) -vidi_enable_vblank (dev); +vidi_enable_vblank (ctx);Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c +1
-1-vidi_apply (dev); +vidi_apply (ctx); }else { ctx->suspended = true;}--
1.8.4_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/23 drm/exynos: Pass context in display_ops instead of dev
In reply to Sean PaulThis patch changes the argument of the display_ops from subdrv device to context. This will allow us to decouple manager and display from subdrv, as well as decouple crtc from encoder.
--- drivers/gpu/drm/exynos/exynos_drm_connector.c | 8 +++---- drivers/gpu/drm/exynos/exynos_drm_drv.h | 13 +++++----- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 10 ++++---- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 34 ++++++++++----------------- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 15 ++++++------ 6 files changed, 36 insertions(+), 46 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_connector.c +4 -4
@@ -53,7 +53,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 (manager->dev, connector); + edid = display_ops->get_edid (manager->ctx, connector);if (IS_ERR_OR_NULL (edid)) { ret =PTR_ERR (edid); edid =NULL ;
@@ -77,7 +77,7 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) }if (display_ops->get_panel) - panel = display_ops->get_panel (manager->dev); + panel = display_ops->get_panel (manager->ctx);else {drm_mode_destroy (connector->dev, mode);return 0 ;
@@ -113,7 +113,7 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector,DRM_DEBUG_KMS ("%s\n" , __FILE__);if (display_ops && display_ops->check_mode) -if (!display_ops->check_mode (manager->dev, mode)) +if (!display_ops->check_mode (manager->ctx, mode)) ret =MODE_OK ;return ret;
@@ -216,7 +216,7 @@ exynos_drm_connector_detect(struct drm_connector *connector, bool force)enum drm_connector_status status = connector_status_disconnected;if (display_ops && display_ops->is_connected) { -if (display_ops->is_connected (manager->dev)) +if (display_ops->is_connected (manager->ctx)) status = connector_status_connected;else status = connector_status_disconnected;
drivers/gpu/drm/exynos/exynos_drm_drv.h +6 -7
@@ -132,13 +132,12 @@ struct exynos_drm_overlay {*/ struct exynos_drm_display_ops {enum exynos_drm_output_type type; -int (*initialize)(struct device *dev,struct drm_device *drm_dev); -bool (*is_connected)(struct device *dev); -struct edid *(*get_edid)(struct device *dev, -struct drm_connector *connector); -void *(*get_panel)(struct device *dev); -int (*check_mode)(struct device *dev,struct drm_display_mode *mode); -int (*power_on)(struct device *dev,int mode); +int (*initialize)(void *ctx,struct drm_device *drm_dev); +bool (*is_connected)(void *ctx); +struct edid *(*get_edid)(void *ctx,struct drm_connector *connector); +void *(*get_panel)(void *ctx); +int (*check_mode)(void *ctx,struct drm_display_mode *mode); +int (*power_on)(void *ctx,int mode); };/*
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1 -1
@@ -349,7 +349,7 @@ exynos_drm_encoder_create(struct drm_device *dev, }if (manager->display_ops && manager->display_ops->initialize) { - ret = manager->display_ops->initialize (manager->dev, dev); + ret = manager->display_ops->initialize (manager->ctx, dev);if (ret) {DRM_ERROR ("Display initialize failed %d\n" , ret); goto error;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -5
@@ -147,28 +147,28 @@ 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 device *dev) +static bool fimd_display_is_connected (void *in_ctx) {/* TODO. */ return true; } -static void *fimd_get_panel (struct device *dev) +static void *fimd_get_panel (void *in_ctx) { -struct fimd_context *ctx =get_fimd_context (dev); +struct fimd_context *ctx = in_ctx;return &ctx->panel; } -static int fimd_check_mode (struct device *dev,struct drm_display_mode *mode) +static int fimd_check_mode (void *in_ctx,struct drm_display_mode *mode) {/* TODO. */ return 0 ; } -static int fimd_display_power_on (struct device *dev,int mode) +static int fimd_display_power_on (void *in_ctx,int mode) {/* TODO */
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +13 -21
@@ -97,10 +97,9 @@ void exynos_mixer_ops_register(struct exynos_mixer_ops *ops) mixer_ops = ops; } -static int drm_hdmi_display_initialize (struct device *dev, -struct drm_device *drm_dev) +static int drm_hdmi_display_initialize (void *in_ctx,struct drm_device *drm_dev) { -struct drm_hdmi_context *ctx =to_context (dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->initialize)return hdmi_ops->initialize (ctx->hdmi_ctx->ctx, drm_dev);
@@ -109,9 +108,9 @@ static int drm_hdmi_display_initialize(struct device *dev, } -static bool drm_hdmi_is_connected (struct device *dev) +static bool drm_hdmi_is_connected (void *in_ctx) { -struct drm_hdmi_context *ctx =to_context (dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->is_connected)return hdmi_ops->is_connected (ctx->hdmi_ctx->ctx);
@@ -119,19 +118,20 @@ static bool drm_hdmi_is_connected(struct device *dev)return false; } -static struct edid *drm_hdmi_get_edid (struct device *dev, +static struct edid *drm_hdmi_get_edid (void *in_ctx,struct drm_connector *connector) { -struct drm_hdmi_context *ctx =to_context (dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->get_edid)return hdmi_ops->get_edid (ctx->hdmi_ctx->ctx, connector);return NULL ; } -static int drm_hdmi_check_mode_ctx (struct drm_hdmi_context *ctx, -struct drm_display_mode *mode) + +static int drm_hdmi_check_mode (void *in_ctx,struct drm_display_mode *mode) { +struct drm_hdmi_context *ctx = in_ctx;int ret =0 ;/*
@@ -151,17 +151,9 @@ static int drm_hdmi_check_mode_ctx(struct drm_hdmi_context *ctx,return 0 ; } -static int drm_hdmi_check_mode (struct device *dev, -struct drm_display_mode *mode) +static int drm_hdmi_power_on (void *in_ctx,int mode) { -struct drm_hdmi_context *ctx =to_context (dev); - -return drm_hdmi_check_mode_ctx (ctx, mode); -} - -static int drm_hdmi_power_on (struct device *dev,int mode) -{ -struct drm_hdmi_context *ctx =to_context (dev); +struct drm_hdmi_context *ctx = in_ctx;if (hdmi_ops && hdmi_ops->power_on)return hdmi_ops->power_on (ctx->hdmi_ctx->ctx, mode);
@@ -217,7 +209,7 @@ static void drm_hdmi_mode_fixup(void *in_ctx, struct drm_connector *connector,drm_mode_set_crtcinfo (adjusted_mode,0 ); - mode_ok =drm_hdmi_check_mode_ctx (ctx, adjusted_mode); + mode_ok =drm_hdmi_check_mode (ctx, adjusted_mode);/* just return if user desired mode exists. */ if (mode_ok ==0 )
@@ -228,7 +220,7 @@ static void drm_hdmi_mode_fixup(void *in_ctx, struct drm_connector *connector,* to adjusted_mode. */ list_for_each_entry (m, &connector->modes, head) { - mode_ok =drm_hdmi_check_mode_ctx (ctx, m); + mode_ok =drm_hdmi_check_mode (ctx, m);if (mode_ok ==0 ) {struct drm_mode_object base;
drivers/gpu/drm/exynos/exynos_drm_vidi.c +7 -8
@@ -85,9 +85,9 @@ static const char fake_edid_info[] = { 0x00, 0x00, 0x00, 0x06 }; -static bool vidi_display_is_connected (struct device *dev) +static bool vidi_display_is_connected (void *in_ctx) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;/* * connection request would come from user side
@@ -96,10 +96,9 @@ static bool vidi_display_is_connected(struct device *dev)return ctx->connected ? true : false; } -static struct edid *vidi_get_edid (struct device *dev, -struct drm_connector *connector) +static struct edid *vidi_get_edid (void *in_ctx,struct drm_connector *connector) { -struct vidi_context *ctx =get_vidi_context (dev); +struct vidi_context *ctx = in_ctx;struct edid *edid;int edid_len;
@@ -122,21 +121,21 @@ static struct edid *vidi_get_edid(struct device *dev,return edid; } -static void *vidi_get_panel (struct device *dev) +static void *vidi_get_panel (void *in_ctx) {/* TODO. */ return NULL ; } -static int vidi_check_mode (struct device *dev,struct drm_display_mode *mode) +static int vidi_check_mode (void *in_ctx,struct drm_display_mode *mode) {/* TODO. */ return 0 ; } -static int vidi_display_power_on (struct device *dev,int mode) +static int vidi_display_power_on (void *in_ctx,int mode) {/* TODO */
Signature · 1 line
1.8.4
PATCH 8/23 drm/exynos: Remove dpms link between encoder/connector
In reply to Sean PaulThis patch removes the call from encoder dpms into connector dpms (which will then call back into encoder dpms through the helper function). The callback is likely to keep connector->dpms in the right state when initiating dpms from crtc or encoder, but this isn't the right way to do it. This patch is the first step towards rationalizing power management in the exynos drm driver.
This patch also removes the apply() callback from the dpms path. It's incorrect to assume apply should be called from dpms. If it's a requirement for the individual hardware drivers, they should call it internally.
--- drivers/gpu/drm/exynos/exynos_drm_connector.c | 42 ++------------------- drivers/gpu/drm/exynos/exynos_drm_connector.h | 4 -- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 53 ++------------------------- 3 files changed, 7 insertions(+), 92 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_connector.c +3 -39
@@ -26,7 +26,6 @@ struct exynos_drm_connector {struct drm_connector drm_connector;uint32_t encoder_id;struct exynos_drm_manager *manager; -uint32_t dpms; };static int exynos_drm_connector_get_modes (struct drm_connector *connector)
@@ -119,7 +118,8 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector,return ret; } -struct drm_encoder *exynos_drm_best_encoder (struct drm_connector *connector) +static struct drm_encoder *exynos_drm_best_encoder ( +struct drm_connector *connector) {struct drm_device *dev = connector->dev; struct exynos_drm_connector *exynos_connector =
@@ -146,41 +146,6 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { .best_encoder = exynos_drm_best_encoder, }; -void exynos_drm_display_power (struct drm_connector *connector,int mode) -{ -struct drm_encoder *encoder =exynos_drm_best_encoder (connector); -struct exynos_drm_connector *exynos_connector; -struct exynos_drm_manager *manager =exynos_drm_get_manager (encoder); -struct exynos_drm_display_ops *display_ops = manager->display_ops; - - exynos_connector =to_exynos_connector (connector); - -if (exynos_connector->dpms == mode) { -DRM_DEBUG_KMS ("desired dpms mode is same as previous one.\n" ); -return ; - } - -if (display_ops && display_ops->power_on) - display_ops->power_on (manager->dev, mode); - - exynos_connector->dpms = mode; -} - -static void exynos_drm_connector_dpms (struct drm_connector *connector, -int mode) -{ -/* -* in case that drm_crtc_helper_set_mode() is called, -* encoder/crtc->funcs->dpms() will be just returned -* because they already were DRM_MODE_DPMS_ON so only -* exynos_drm_display_power() will be called. -*/ -drm_helper_connector_dpms (connector, mode); - -exynos_drm_display_power (connector, mode); - -} -static int exynos_drm_connector_fill_modes (struct drm_connector *connector,unsigned int max_width,unsigned int max_height) {
@@ -236,7 +201,7 @@ static void exynos_drm_connector_destroy(struct drm_connector *connector) }static struct drm_connector_funcs exynos_connector_funcs = { - .dpms = exynos_drm_connector_dpms, + .dpms = drm_helper_connector_dpms, .fill_modes = exynos_drm_connector_fill_modes, .detect = exynos_drm_connector_detect, .destroy = exynos_drm_connector_destroy,
@@ -281,7 +246,6 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, exynos_connector->encoder_id = encoder->base.id; exynos_connector->manager = manager; - exynos_connector->dpms =DRM_MODE_DPMS_OFF ; connector->dpms =DRM_MODE_DPMS_OFF ; connector->encoder = encoder;
drivers/gpu/drm/exynos/exynos_drm_connector.h +0 -4
@@ -17,8 +17,4 @@struct drm_connector *exynos_drm_connector_create (struct drm_device *dev,struct drm_encoder *encoder); -struct drm_encoder *exynos_drm_best_encoder (struct drm_connector *connector); - -void exynos_drm_display_power (struct drm_connector *connector,int mode); -#endif
drivers/gpu/drm/exynos/exynos_drm_encoder.c +4 -49
85 lines not on this page · raw message
Signature · 1 line
1.8.4
PATCH 9/23 drm/exynos: Rename display_op power_on to dpms
In reply to Sean PaulThis patch renames the display_op power_on to dpms to accurately reflect what the function does.
The side-effect of this patch is that the new hdmi dpms callback is now invoked twice in the dpms path. This is safe and will be dealt with when the exynos_drm shim goes away.
--- drivers/gpu/drm/exynos/exynos_drm_drv.h | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 8 -------- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 10 ++++------ drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 3 +-- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 -------- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +- 7 files changed, 10 insertions(+), 29 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.h +2 -2
@@ -128,7 +128,7 @@ struct exynos_drm_overlay {* @get_edid: get edid modes from display driver. * @get_panel: get panel object from display driver. * @check_mode: check if mode is valid or not. -* @power_on: display device on or off. +* @dpms: display device on or off. */ struct exynos_drm_display_ops {enum exynos_drm_output_type type;
@@ -137,7 +137,7 @@ struct exynos_drm_display_ops {struct edid *(*get_edid)(void *ctx,struct drm_connector *connector);void *(*get_panel)(void *ctx);int (*check_mode)(void *ctx,struct drm_display_mode *mode); -int (*power_on)(void *ctx,int mode); +void (*dpms)(void *ctx,int mode); };/*
drivers/gpu/drm/exynos/exynos_drm_encoder.c +2 -2
@@ -51,8 +51,8 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)return ; } -if (display_ops && display_ops->power_on) - display_ops->power_on (manager->ctx, mode); +if (display_ops && display_ops->dpms) + display_ops->dpms (manager->ctx, mode); exynos_encoder->dpms = mode; }
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -8
@@ -168,19 +168,11 @@ static int fimd_check_mode(void *in_ctx, struct drm_display_mode *mode)return 0 ; } -static int fimd_display_power_on (void *in_ctx,int mode) -{ -/* TODO */ - -return 0 ; -} -static struct exynos_drm_display_ops fimd_display_ops = { .type =EXYNOS_DISPLAY_TYPE_LCD , .is_connected = fimd_display_is_connected, .get_panel = fimd_get_panel, .check_mode = fimd_check_mode, - .power_on = fimd_display_power_on, };static void fimd_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay)
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +4 -6
@@ -151,14 +151,12 @@ static int drm_hdmi_check_mode(void *in_ctx, struct drm_display_mode *mode)return 0 ; } -static int drm_hdmi_power_on (void *in_ctx,int mode) +static void drm_hdmi_display_dpms (void *in_ctx,int mode) {struct drm_hdmi_context *ctx = in_ctx; -if (hdmi_ops && hdmi_ops->power_on) -return hdmi_ops->power_on (ctx->hdmi_ctx->ctx, mode); - -return 0 ; +if (hdmi_ops && hdmi_ops->dpms) + hdmi_ops->dpms (ctx->hdmi_ctx->ctx, mode); }static struct exynos_drm_display_ops drm_hdmi_display_ops = {
@@ -167,7 +165,7 @@ static struct exynos_drm_display_ops drm_hdmi_display_ops = { .is_connected = drm_hdmi_is_connected, .get_edid = drm_hdmi_get_edid, .check_mode = drm_hdmi_check_mode, - .power_on = drm_hdmi_power_on, + .dpms = drm_hdmi_display_dpms, };static int drm_hdmi_enable_vblank (void *in_ctx)
drivers/gpu/drm/exynos/exynos_drm_hdmi.h +1 -2
@@ -33,14 +33,13 @@ struct exynos_hdmi_ops {struct edid *(*get_edid)(void *ctx,struct drm_connector *connector);int (*check_mode)(void *ctx,struct drm_display_mode *mode); -int (*power_on)(void *ctx,int mode); +void (*dpms)(void *ctx,int mode);/* manager */ void (*mode_set)(void *ctx,struct drm_display_mode *mode);void (*get_max_resol)(void *ctx,unsigned int *width,unsigned int *height);void (*commit)(void *ctx); -void (*dpms)(void *ctx,int mode); };struct exynos_mixer_ops {
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0 -8
@@ -135,20 +135,12 @@ static int vidi_check_mode(void *in_ctx, struct drm_display_mode *mode)return 0 ; } -static int vidi_display_power_on (void *in_ctx,int mode) -{ -/* TODO */ - -return 0 ; -} -static struct exynos_drm_display_ops vidi_display_ops = { .type =EXYNOS_DISPLAY_TYPE_VIDI , .is_connected = vidi_display_is_connected, .get_edid = vidi_get_edid, .get_panel = vidi_get_panel, .check_mode = vidi_check_mode, - .power_on = vidi_display_power_on, };static void vidi_dpms (void *in_ctx,int mode)
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -1
@@ -1760,12 +1760,12 @@ static struct exynos_hdmi_ops hdmi_ops = { .is_connected = hdmi_is_connected, .get_edid = hdmi_get_edid, .check_mode = hdmi_check_mode, + .dpms = hdmi_dpms,/* manager */ .mode_set = hdmi_mode_set, .get_max_resol = hdmi_get_max_resol, .commit = hdmi_commit, - .dpms = hdmi_dpms, };static irqreturn_t hdmi_irq_thread (int irq,void *arg)
Signature · 1 line
1.8.4
PATCH 10/23 drm/exynos: Don't keep dpms state in encoder
In reply to Sean PaulThis patch removes the dpms state tracking in encoder. This state is at best confusing and at worst incorrect since the display drivers can turn on and off without propagating the value.
--- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0 -18
@@ -28,33 +28,22 @@* @drm_encoder: encoder object. * @manager: specific encoder has its own manager to control a hardware * appropriately and we can access a hardware drawing on this manager. -* @dpms: store the encoder dpms value. */ struct exynos_drm_encoder {struct drm_crtc *old_crtc;struct drm_encoder drm_encoder;struct exynos_drm_manager *manager; -int dpms; };static void exynos_drm_encoder_dpms (struct drm_encoder *encoder,int mode) { -struct drm_device *dev = encoder->dev;struct exynos_drm_manager *manager =exynos_drm_get_manager (encoder); -struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder);struct exynos_drm_display_ops *display_ops = manager->display_ops;DRM_DEBUG_KMS ("encoder dpms: %d\n" , mode); -if (exynos_encoder->dpms == mode) { -DRM_DEBUG_KMS ("desired dpms mode is same as previous one.\n" ); -return ; - } -if (display_ops && display_ops->dpms) display_ops->dpms (manager->ctx, mode); - - exynos_encoder->dpms = mode; } static bool
@@ -159,12 +148,6 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)if (manager_ops && manager_ops->commit) manager_ops->commit (manager->ctx); - -/* -* In case of setcrtc, there is no way to update encoder's dpms -* so update it here. -*/ - exynos_encoder->dpms =DRM_MODE_DPMS_ON ; }void exynos_drm_encoder_complete_scanout (struct drm_framebuffer *fb)
@@ -283,7 +266,6 @@ exynos_drm_encoder_create(struct drm_device *dev,if (!exynos_encoder)return NULL ; - exynos_encoder->dpms =DRM_MODE_DPMS_OFF ; exynos_encoder->manager = manager; encoder = &exynos_encoder->drm_encoder; encoder->possible_crtcs = possible_crtcs;
Signature · 1 line
1.8.4
PATCH 11/23 drm/exynos: Use unsigned long for possible_crtcs
In reply to Sean PaulChange all instances of possible_crtcs in the exynos drm driver to be unsigned long. This matches the type used in the drm layer.
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_encoder.h | 2 +- drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_plane.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -1
@@ -84,7 +84,7 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)for (nr =0 ; nr <MAX_PLANE ; nr++) {struct drm_plane *plane; -unsigned int possible_crtcs = (1 <<MAX_CRTC ) -1 ; +unsigned long possible_crtcs = (1 <<MAX_CRTC ) -1 ; plane =exynos_plane_init (dev, possible_crtcs, false);if (!plane)
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1 -1
@@ -250,7 +250,7 @@ void exynos_drm_encoder_setup(struct drm_device *dev)struct drm_encoder *exynos_drm_encoder_create (struct drm_device *dev,struct exynos_drm_manager *manager, -unsigned int possible_crtcs) +unsigned long possible_crtcs) {struct drm_encoder *encoder;struct exynos_drm_encoder *exynos_encoder;
drivers/gpu/drm/exynos/exynos_drm_encoder.h +1 -1
@@ -19,7 +19,7 @@ struct exynos_drm_manager;void exynos_drm_encoder_setup (struct drm_device *dev);struct drm_encoder *exynos_drm_encoder_create (struct drm_device *dev,struct exynos_drm_manager *mgr, -unsigned int possible_crtcs); +unsigned long possible_crtcs);struct exynos_drm_manager *exynos_drm_get_manager (struct drm_encoder *encoder); void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data,
drivers/gpu/drm/exynos/exynos_drm_plane.c +1 -1
@@ -259,7 +259,7 @@ static void exynos_plane_attach_zpos_property(struct drm_plane *plane) }struct drm_plane *exynos_plane_init (struct drm_device *dev, -unsigned int possible_crtcs,bool priv) +unsigned long possible_crtcs,bool priv) {struct exynos_plane *exynos_plane;int err;
drivers/gpu/drm/exynos/exynos_drm_plane.h +1 -1
@@ -17,4 +17,4 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,void exynos_plane_commit (struct drm_plane *plane);void exynos_plane_dpms (struct drm_plane *plane,int mode);struct drm_plane *exynos_plane_init (struct drm_device *dev, -unsigned int possible_crtcs,bool priv); +unsigned long possible_crtcs,bool priv);
Signature · 1 line
1.8.4
PATCH 12/23 drm/exynos: Split manager/display/subdrv
In reply to Sean PaulThis patch splits display and manager from subdrv. The result is that crtc functions can directly call into manager callbacks and encoder functions can directly call into display callbacks. This will allow us to remove the exynos_drm_hdmi shim and support mixer/hdmi & fimd/dp with common code.
--- drivers/gpu/drm/exynos/exynos_drm_connector.c | 50 ++--- drivers/gpu/drm/exynos/exynos_drm_core.c | 181 +++++++++++++----- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 115 +++++++++--- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 20 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 29 +-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 87 +++++---- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 257 ++++---------------------- drivers/gpu/drm/exynos/exynos_drm_encoder.h | 18 +- drivers/gpu/drm/exynos/exynos_drm_fb.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 153 +++++++-------- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 218 ++++++++++------------ drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 2 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 15 +- 13 files changed, 547 insertions(+), 602 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_connector.c +20 -30
@@ -23,26 +23,20 @@ drm_connector)struct exynos_drm_connector { -struct drm_connector drm_connector; -uint32_t encoder_id; -struct exynos_drm_manager *manager; +struct drm_connector drm_connector; +uint32_t encoder_id; +struct exynos_drm_display *display; };static int exynos_drm_connector_get_modes (struct drm_connector *connector) {struct exynos_drm_connector *exynos_connector =to_exynos_connector (connector); -struct exynos_drm_manager *manager = exynos_connector->manager; -struct exynos_drm_display_ops *display_ops = manager->display_ops; +struct exynos_drm_display *display = exynos_connector->display;struct edid *edid =NULL ;unsigned int count =0 ;int ret; -if (!display_ops) { -DRM_DEBUG_KMS ("display_ops is null.\n" ); -return 0 ; - } -/* * if get_edid() exists then get_edid() callback of hdmi side * is called to get edid data through i2c interface else
@@ -51,8 +45,8 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)* P.S. in case of lcd panel, count is always 1 if success * because lcd panel has only one mode. */ -if (display_ops->get_edid) { - edid = display_ops->get_edid (manager->ctx, connector); +if (display->ops->get_edid) { + edid = display->ops->get_edid (display->ctx, connector);if (IS_ERR_OR_NULL (edid)) { ret =PTR_ERR (edid); edid =NULL ;
@@ -75,8 +69,8 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)return 0 ; } -if (display_ops->get_panel) - panel = display_ops->get_panel (manager->ctx); +if (display->ops->get_panel) + panel = display->ops->get_panel (display->ctx);else {drm_mode_destroy (connector->dev, mode);return 0 ;
@@ -105,14 +99,13 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector, {struct exynos_drm_connector *exynos_connector =to_exynos_connector (connector); -struct exynos_drm_manager *manager = exynos_connector->manager; -struct exynos_drm_display_ops *display_ops = manager->display_ops; +struct exynos_drm_display *display = exynos_connector->display;int ret =MODE_BAD ;DRM_DEBUG_KMS ("%s\n" , __FILE__); -if (display_ops && display_ops->check_mode) -if (!display_ops->check_mode (manager->ctx, mode)) +if (display->ops->check_mode) +if (!display->ops->check_mode (display->ctx, mode)) ret =MODE_OK ;return ret;
@@ -151,8 +144,7 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector, {struct exynos_drm_connector *exynos_connector =to_exynos_connector (connector); -struct exynos_drm_manager *manager = exynos_connector->manager; -struct exynos_drm_manager_ops *ops = manager->ops; +struct exynos_drm_display *display = exynos_connector->display;unsigned int width, height; width = max_width;
@@ -162,8 +154,8 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector,* if specific driver want to find desired_mode using maxmum * resolution then get max width and height from that driver. */ -if (ops && ops->get_max_resol) - ops->get_max_resol (manager->ctx, &width, &height); +if (display->ops->get_max_resol) + display->ops->get_max_resol (display->ctx, &width, &height);return drm_helper_probe_single_connector_modes (connector, width, height);
@@ -175,13 +167,11 @@ exynos_drm_connector_detect(struct drm_connector *connector, bool force) {struct exynos_drm_connector *exynos_connector =to_exynos_connector (connector); -struct exynos_drm_manager *manager = exynos_connector->manager; -struct exynos_drm_display_ops *display_ops = - manager->display_ops; +struct exynos_drm_display *display = exynos_connector->display;enum drm_connector_status status = connector_status_disconnected; -if (display_ops && display_ops->is_connected) { -if (display_ops->is_connected (manager->ctx)) +if (display->ops->is_connected) { +if (display->ops->is_connected (display->ctx)) status = connector_status_connected;else status = connector_status_disconnected;
@@ -211,7 +201,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, struct drm_encoder *encoder) {struct exynos_drm_connector *exynos_connector; -struct exynos_drm_manager *manager =exynos_drm_get_manager (encoder); +struct exynos_drm_display *display =exynos_drm_get_display (encoder);struct drm_connector *connector;int type;int err;
@@ -222,7 +212,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, connector = &exynos_connector->drm_connector; -switch (manager->display_ops->type) { +switch (display->type) {case EXYNOS_DISPLAY_TYPE_HDMI : type =DRM_MODE_CONNECTOR_HDMIA ; connector->interlace_allowed = true;
@@ -245,7 +235,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, goto err_connector; exynos_connector->encoder_id = encoder->base.id; - exynos_connector->manager = manager; + exynos_connector->display = display; connector->dpms =DRM_MODE_DPMS_OFF ; connector->encoder = encoder;
drivers/gpu/drm/exynos/exynos_drm_core.c +135 -46
251 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_crtc.c +92 -23
225 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_crtc.h +16 -4
@@ -15,9 +15,21 @@#ifndef _EXYNOS_DRM_CRTC_H_#define _EXYNOS_DRM_CRTC_H_ -int exynos_drm_crtc_create (struct drm_device *dev,unsigned int nr); -int exynos_drm_crtc_enable_vblank (struct drm_device *dev,int crtc); -void exynos_drm_crtc_disable_vblank (struct drm_device *dev,int crtc); -void exynos_drm_crtc_finish_pageflip (struct drm_device *dev,int crtc); +struct drm_device ; +struct drm_crtc ; +struct exynos_drm_manager ; +struct exynos_drm_overlay ; + +int exynos_drm_crtc_create (struct exynos_drm_manager *manager); +int exynos_drm_crtc_enable_vblank (struct drm_device *dev,int pipe); +void exynos_drm_crtc_disable_vblank (struct drm_device *dev,int pipe); +void exynos_drm_crtc_finish_pageflip (struct drm_device *dev,int pipe); +void exynos_drm_crtc_complete_scanout (struct drm_framebuffer *fb); + +void exynos_drm_crtc_plane_mode_set (struct drm_crtc *crtc, +struct exynos_drm_overlay *overlay); +void exynos_drm_crtc_plane_commit (struct drm_crtc *crtc,int zpos); +void exynos_drm_crtc_plane_enable (struct drm_crtc *crtc,int zpos); +void exynos_drm_crtc_plane_disable (struct drm_crtc *crtc,int zpos);#endif
drivers/gpu/drm/exynos/exynos_drm_drv.c +17 -12
@@ -72,15 +72,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)exynos_drm_mode_config_init (dev); -/* -* EXYNOS4 is enough to have two CRTCs and each crtc would be used -* without dependency of hardware. -*/ -for (nr =0 ; nr <MAX_CRTC ; nr++) { - ret =exynos_drm_crtc_create (dev, nr); -if (ret) - goto err_release_iommu_mapping; - } + ret =exynos_drm_initialize_managers (dev); +if (ret) + goto err_mode_config_cleanup;for (nr =0 ; nr <MAX_PLANE ; nr++) {struct drm_plane *plane;
@@ -88,12 +82,16 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) plane =exynos_plane_init (dev, possible_crtcs, false);if (!plane) - goto err_release_iommu_mapping; + goto err_manager_cleanup; } + ret =exynos_drm_initialize_displays (dev); +if (ret) + goto err_manager_cleanup; + ret =drm_vblank_init (dev,MAX_CRTC );if (ret) - goto err_release_iommu_mapping; + goto err_display_cleanup;/* * probe sub drivers such as display controller and hdmi driver,
@@ -125,7 +123,12 @@ err_drm_device:exynos_drm_device_unregister (dev); err_vblank:drm_vblank_cleanup (dev); -err_release_iommu_mapping: +err_display_cleanup: +exynos_drm_remove_displays (dev); +err_manager_cleanup: +exynos_drm_remove_managers (dev); +err_mode_config_cleanup: +drm_mode_config_cleanup (dev);drm_release_iommu_mapping (dev); err_crtc:drm_mode_config_cleanup (dev);
@@ -140,6 +143,8 @@ static int exynos_drm_unload(struct drm_device *dev)exynos_drm_device_unregister (dev);drm_vblank_cleanup (dev);drm_kms_helper_poll_fini (dev); +exynos_drm_remove_displays (dev); +exynos_drm_remove_managers (dev);drm_mode_config_cleanup (dev);drm_release_iommu_mapping (dev);
drivers/gpu/drm/exynos/exynos_drm_drv.h +55 -32
158 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_encoder.c +31 -226
349 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_encoder.h +3 -15
@@ -18,20 +18,8 @@ struct exynos_drm_manager;void exynos_drm_encoder_setup (struct drm_device *dev);struct drm_encoder *exynos_drm_encoder_create (struct drm_device *dev, -struct exynos_drm_manager *mgr, -unsigned long possible_crtcs); -struct exynos_drm_manager * -exynos_drm_get_manager (struct drm_encoder *encoder); -void exynos_drm_fn_encoder (struct drm_crtc *crtc,void *data, -void (*fn)(struct drm_encoder *,void *)); -void exynos_drm_enable_vblank (struct drm_encoder *encoder,void *data); -void exynos_drm_disable_vblank (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_crtc_dpms (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_crtc_pipe (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_plane_mode_set (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_plane_commit (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_plane_enable (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_plane_disable (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_complete_scanout (struct drm_framebuffer *fb); +struct exynos_drm_display *mgr, +unsigned long possible_crtcs); +struct exynos_drm_display *exynos_drm_get_display (struct drm_encoder *encoder);#endif
drivers/gpu/drm/exynos/exynos_drm_fb.c +2 -2
@@ -22,7 +22,7 @@#include "exynos_drm_fb.h" #include "exynos_drm_gem.h" #include "exynos_drm_iommu.h" -#include "exynos_drm_encoder.h" +#include "exynos_drm_crtc.h" #define to_exynos_fb (x) container_of(x, struct exynos_drm_fb, fb)
@@ -71,7 +71,7 @@ static void exynos_drm_fb_destroy(struct drm_framebuffer *fb)unsigned int i;/* make sure that overlay data are updated before relesing fb. */ -exynos_drm_encoder_complete_scanout (fb); +exynos_drm_crtc_complete_scanout (fb);drm_framebuffer_cleanup (fb);
drivers/gpu/drm/exynos/exynos_drm_fimd.c +71 -82
285 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +98 -120
323 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_hdmi.h +2 -0
@@ -19,10 +19,12 @@* exynos hdmi common context structure. * * @drm_dev: pointer to drm_device. +* @pipe: pipe for mixer * @ctx: pointer to the context of specific device driver. * this context should be hdmi_context or mixer_context. */ struct exynos_drm_hdmi_context { +int pipe;void *ctx; };
drivers/gpu/drm/exynos/exynos_drm_plane.c +5 -10
@@ -13,7 +13,7 @@#include <drm/exynos_drm.h> #include "exynos_drm_drv.h" -#include "exynos_drm_encoder.h" +#include "exynos_drm_crtc.h" #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" #include "exynos_drm_plane.h"
@@ -139,7 +139,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, overlay->crtc_x, overlay->crtc_y, overlay->crtc_width, overlay->crtc_height); -exynos_drm_fn_encoder (crtc, overlay, exynos_drm_encoder_plane_mode_set); +exynos_drm_crtc_plane_mode_set (crtc, overlay);return 0 ; }
@@ -149,8 +149,7 @@ void exynos_plane_commit(struct drm_plane *plane)struct exynos_plane *exynos_plane =to_exynos_plane (plane);struct exynos_drm_overlay *overlay = &exynos_plane->overlay; -exynos_drm_fn_encoder (plane->crtc, &overlay->zpos, - exynos_drm_encoder_plane_commit); +exynos_drm_crtc_plane_commit (plane->crtc, overlay->zpos); }void exynos_plane_dpms (struct drm_plane *plane,int mode)
@@ -162,17 +161,13 @@ void exynos_plane_dpms(struct drm_plane *plane, int mode)if (exynos_plane->enabled)return ; -exynos_drm_fn_encoder (plane->crtc, &overlay->zpos, - exynos_drm_encoder_plane_enable); - +exynos_drm_crtc_plane_enable (plane->crtc, overlay->zpos); exynos_plane->enabled = true; }else {if (!exynos_plane->enabled)return ; -exynos_drm_fn_encoder (plane->crtc, &overlay->zpos, - exynos_drm_encoder_plane_disable); - +exynos_drm_crtc_plane_disable (plane->crtc, overlay->zpos); exynos_plane->enabled = false; } }
Signature · 1 line
1.8.4
Inki Dae
maintainerRe: [PATCH 12/23] drm/exynos: Split manager/display/subdrv
Quoted 20 lines
static int exynos_drm_create_enc_conn(struct
drm_device*dev,drivers/gpu/drm/exynos/exynos_drm_core.c +8
-4- struct exynos_drm_subdrv *subdrv) + struct exynos_drm_display *display) {struct drm_encoder *encoder;struct drm_connector *connector; +struct exynos_drm_manager *manager;int ret; +unsigned long possible_crtcs =0 ; - subdrv->manager->dev = subdrv->dev; +/* Find possible crtcs for this display */ +list_for_each_entry (manager, &exynos_drm_manager_list, list) +if (manager->type == display->type) + possible_crtcs |=1 << manager->pipe;/* create and initialize a encoder for this sub driver. */ - encoder =exynos_drm_encoder_create (dev, subdrv->manager, - (1 <<MAX_CRTC ) -1 ); + encoder =exynos_drm_encoder_create (dev, display, possible_crtcs);
drivers/gpu/drm/exynos/exynos_drm_core.c static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_core.c +2
-2if (!encoder) {DRM_ERROR ("failed to create encoder\n" );return -EFAULT ; } - subdrv->encoder = encoder; + display->encoder = encoder; -if (subdrv->manager->display_ops->type ==EXYNOS_DISPLAY_TYPE_LCD ) { +if (display->type ==EXYNOS_DISPLAY_TYPE_LCD ) { ret =exynos_drm_attach_lcd_bridge (dev, encoder)
Plz, _do_not_base_ on top of your lvds bridge patch set. As I mentioned before, the tricky codes are not good. For this, let's find a better way after your refactoring patch set are reviewed enough, and if merged.
Quoted 15 lines
if (ret) return 0;drivers/gpu/drm/exynos/exynos_drm_core.c +1
-1@@ -91,7 +98,7 @@ static int exynos_drm_create_enc_conn(struct drm_device *dev, goto err_destroy_encoder; } - subdrv->connector = connector; + display->connector = connector;return 0 ;@@ -100,21 +107,6 @@ err_destroy_encoder:return ret; }
Re: [PATCH 12/23] drm/exynos: Split manager/display/subdrv
Quoted 27 lines · Inki Dae
Quoted 27 lines
static int exynos_drm_create_enc_conn(struct
drm_device*dev,drivers/gpu/drm/exynos/exynos_drm_core.c +9
-5- struct exynos_drm_subdrv *subdrv) + struct exynos_drm_display *display) {struct drm_encoder *encoder;struct drm_connector *connector; +struct exynos_drm_manager *manager;int ret; +unsigned long possible_crtcs =0 ; - subdrv->manager->dev = subdrv->dev; +/* Find possible crtcs for this display */ +list_for_each_entry (manager, &exynos_drm_manager_list, list) +if (manager->type == display->type) + possible_crtcs |=1 << manager->pipe;/* create and initialize a encoder for this sub driver. */ - encoder =exynos_drm_encoder_create (dev, subdrv->manager, - (1 <<MAX_CRTC ) -1 ); + encoder =exynos_drm_encoder_create (dev, display, possible_crtcs);if (!encoder) {DRM_ERROR ("failed to create encoder\n" );return -EFAULT ; } - subdrv->encoder = encoder; + display->encoder = encoder;
Quoted 9 lines
drivers/gpu/drm/exynos/exynos_drm_core.c static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_core.c +1
-1-if (subdrv->manager->display_ops->type ==EXYNOS_DISPLAY_TYPE_LCD ) { +if (display->type ==EXYNOS_DISPLAY_TYPE_LCD ) { ret =exynos_drm_attach_lcd_bridge (dev, encoder)Plz, _do_not_base_ on top of your lvds bridge patch set. As I mentioned before, the tricky codes are not good. For this, let's find a better way after your refactoring patch set are reviewed enough, and if merged.
[+adding back the people you removed from CC]
I'm happy to change how that works, but I've yet to find a better solution. Instead of just dismissing something as "tricky codes", can you suggest a concrete solution that is better than what I've got?
I'm also a bit confused as to why you think it's so tricky, it's a synchronous initialization call to a driver; that's about as simple as it gets.
Sean
Quoted 15 lines
Quoted 15 lines
if (ret) return 0;drivers/gpu/drm/exynos/exynos_drm_core.c +1
-1@@ -91,7 +98,7 @@ static int exynos_drm_create_enc_conn(struct drm_device *dev, goto err_destroy_encoder; } - subdrv->connector = connector; + display->connector = connector;return 0 ;@@ -100,21 +107,6 @@ err_destroy_encoder:return ret; }
Inki Dae
maintainerRE: [PATCH 12/23] drm/exynos: Split manager/display/subdrv
Quoted 12 lines
-----Original Message-----
From: Sean Paul [mailto:[email protected]]
Sent: Saturday, October 12, 2013 11:07 AM
To: Inki Dae
Cc: DRI mailing list; Stéphane Marchesin; Dave Airlie; Tomasz Figa
Subject: Re: [PATCH 12/23] drm/exynos: Split manager/display/subdrvQuoted 2 lines · Inki Dae
Quoted 2 lines
static int exynos_drm_create_enc_conn(struct
drm_device*dev,
- structexynos_drm_subdrv
*subdrv)
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ struct
exynos_drm_display
*display)
Quoted 30 lines
Quoted 13 lines
Quoted 13 lines
{ struct drm_encoder *encoder; struct drm_connector *connector;drivers/gpu/drm/exynos/exynos_drm_core.c +6
-1+struct exynos_drm_manager *manager;int ret; +unsigned long possible_crtcs =0 ; - subdrv->manager->dev = subdrv->dev; +/* Find possible crtcs for this display */ +list_for_each_entry (manager, &exynos_drm_manager_list, list) +if (manager->type == display->type) + possible_crtcs |=1 << manager->pipe;Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_core.c static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
Quoted 4 lines
/* create and initialize a encoder for this sub driver. */drivers/gpu/drm/exynos/exynos_drm_core.c +1
-2- encoder =exynos_drm_encoder_create (dev, subdrv->manager, - (1 <<MAX_CRTC ) -1 ); + encoder = exynos_drm_encoder_create(dev, display,
possible_crtcs);Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_core.c static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
Quoted 8 lines
if (!encoder) { DRM_ERROR("failed to create encoder\n"); return -EFAULT; }drivers/gpu/drm/exynos/exynos_drm_core.c +1
-2- subdrv->encoder = encoder; + display->encoder = encoder; - if (subdrv->manager->display_ops->type ==
EXYNOS_DISPLAY_TYPE_LCD) {Quoted 3 lines
Quoted 2 lines
+ if (
display->type==EXYNOS_DISPLAY_TYPE_LCD) {
ret =exynos_drm_attach_lcd_bridge(dev, encoder)
Quoted 8 lines
Quoted 5 lines
Plz, _do_not_base_ on top of your lvds bridge patch set. As I mentioned before, the tricky codes are not good. For this, let's find a better way after your refactoring patch set are reviewed enough, and if merged.
[+adding back the people you removed from CC]
Hm.. I didn't really remove the people from CC. See the your original email. :)
Quoted 4 lines
I'm happy to change how that works, but I've yet to find a better solution. Instead of just dismissing something as "tricky codes", can you suggest a concrete solution that is better than what I've got?
I think I mentioned already at previous email. First of all, let's have a thorough review to your refactoring patch set, and then let's find a better way.
I believe that we can find a better way with your refactoring patch set: now we can implement encoder and connector directly.
Quoted 1 line
I'm also a bit confused as to why you think it's so tricky, it's a
First, That was your comment, "Right, so this is kind of tricky". And also it seems like tricky codes to me.
Quoted 2 lines
synchronous initialization call to a driver; that's about as simple as it gets.
As you mentioned before, ptn3460 driver is not depended on SoC, and can be used for other SoC. Let you try to think about lcd class and backlight class. I think we need a interfacing layer between common driver and specific something for connecting SoC specific DRM framework.
Quoted 21 lines
Sean
Quoted 3 lines
Review static int exynos_drm_create_enc_conn(struct
Quoted 3 lines
if (ret) return 0;(quoted diff) +0
-0@@ -91,7 +98,7 @@ static int exynos_drm_create_enc_conn(struct
drm_device*dev,Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_core.c +1
-1goto err_destroy_encoder; } - subdrv->connector = connector; + display->connector = connector;return 0 ;@@ -100,21 +107,6 @@ err_destroy_encoder:return ret; }
Re: [PATCH 12/23] drm/exynos: Split manager/display/subdrv
Quoted 63 lines · Inki Dae
Quoted 12 lines
-----Original Message-----
From: Sean Paul [mailto:[email protected]]
Sent: Saturday, October 12, 2013 11:07 AM
To: Inki Dae
Cc: DRI mailing list; Stéphane Marchesin; Dave Airlie; Tomasz Figa
Subject: Re: [PATCH 12/23] drm/exynos: Split manager/display/subdrvQuoted 2 lines · Inki Dae
Quoted 2 lines
static int exynos_drm_create_enc_conn(struct
drm_device*dev,
- structexynos_drm_subdrv*subdrv)
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ struct
exynos_drm_display*display)
Quoted 30 lines
Quoted 13 lines
Quoted 13 lines
{ struct drm_encoder *encoder; struct drm_connector *connector;drivers/gpu/drm/exynos/exynos_drm_core.c +6
-1+struct exynos_drm_manager *manager;int ret; +unsigned long possible_crtcs =0 ; - subdrv->manager->dev = subdrv->dev; +/* Find possible crtcs for this display */ +list_for_each_entry (manager, &exynos_drm_manager_list, list) +if (manager->type == display->type) + possible_crtcs |=1 << manager->pipe;Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_core.c static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
Quoted 4 lines
/* create and initialize a encoder for this sub driver. */drivers/gpu/drm/exynos/exynos_drm_core.c +1
-2- encoder =exynos_drm_encoder_create (dev, subdrv->manager, - (1 <<MAX_CRTC ) -1 ); + encoder = exynos_drm_encoder_create(dev, display,
possible_crtcs);Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_core.c static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
Quoted 8 lines
if (!encoder) { DRM_ERROR("failed to create encoder\n"); return -EFAULT; }drivers/gpu/drm/exynos/exynos_drm_core.c +1
-2- subdrv->encoder = encoder; + display->encoder = encoder; - if (subdrv->manager->display_ops->type ==
EXYNOS_DISPLAY_TYPE_LCD) {Quoted 3 lines
Quoted 2 lines
+ if (
display->type==EXYNOS_DISPLAY_TYPE_LCD) {
ret =exynos_drm_attach_lcd_bridge(dev, encoder)Quoted 8 lines
Quoted 5 lines
Plz, _do_not_base_ on top of your lvds bridge patch set. As I mentioned before, the tricky codes are not good. For this, let's find a better way after your refactoring patch set are reviewed enough, and if merged.
[+adding back the people you removed from CC]
Hm.. I didn't really remove the people from CC. See the your original email. :)
Quoted 4 lines
I'm happy to change how that works, but I've yet to find a better solution. Instead of just dismissing something as "tricky codes", can you suggest a concrete solution that is better than what I've got?
Quoted 7 lines
I think I mentioned already at previous email. First of all, let's have a thorough review to your refactoring patch set, and then let's find a better way.
I believe that we can find a better way with your refactoring patch set: now we can implement encoder and connector directly.
The code will look the exact same, it'll just be in the dp driver instead of drm_core (since drm_core will not create encoders/connectors). Adding the ptn driver in the interim allows me to boot exynos5250-snow with linux-next, so I can test my changes.
Quoted 6 lines
Quoted 2 lines
I'm also a bit confused as to why you think it's so tricky, it's a
First, That was your comment, "Right, so this is kind of tricky". And also it seems like tricky codes to me.
Right, it was a tricky problem (for reasons I've stated multiple times), but the solution is dead easy to understand.
Quoted 8 lines
Quoted 2 lines
synchronous initialization call to a driver; that's about as simple as it gets.
As you mentioned before, ptn3460 driver is not depended on SoC, and can be used for other SoC. Let you try to think about lcd class and backlight class. I think we need a interfacing layer between common driver and specific something for connecting SoC specific DRM framework.
Laurent mentioned that he wanted to come up with a way to model graphics hardware in dt. He could then build a notifier when the various pieces were successfully probed, and drm would only load once all of the pieces were ready.
I think that would be a nice long-term solution, however let's not let the perfect be the enemy of the good. If you can simplify how this works, I'm all for it. However, I don't see any other way at the moment and I don't think it's productive to just wait around for something better to come along.
Sean
Quoted 22 lines
Quoted 21 lines
Sean
Quoted 3 lines
Review static int exynos_drm_create_enc_conn(struct
Quoted 3 lines
if (ret) return 0;(quoted diff) +0
-0@@ -91,7 +98,7 @@ static int exynos_drm_create_enc_conn(struct
drm_device*dev,Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_core.c +1
-1goto err_destroy_encoder; } - subdrv->connector = connector; + display->connector = connector;return 0 ;@@ -100,21 +107,6 @@ err_destroy_encoder:return ret; }
Inki Dae
maintainerRE: [PATCH 12/23] drm/exynos: Split manager/display/subdrv
Quoted 118 lines
-----Original Message-----
From: Sean Paul [mailto:[email protected]]
Sent: Saturday, October 12, 2013 1:20 PM
To: Inki Dae
Cc: DRI mailing list; Stéphane Marchesin; Dave Airlie; Tomasz Figa
Subject: Re: [PATCH 12/23] drm/exynos: Split manager/display/subdrvQuoted 9 lines · Inki Dae
Quoted 9 lines
-----Original Message-----
From: Sean Paul [mailto:[email protected]]
Sent: Saturday, October 12, 2013 11:07 AM
To: Inki Dae
Cc: DRI mailing list; Stéphane Marchesin; Dave Airlie; Tomasz Figa
Subject: Re: [PATCH 12/23] drm/exynos: Split manager/display/subdrvQuoted 39 lines
Quoted 3 lines · Inki Dae
Quoted 2 lines
Quoted 2 lines
static int exynos_drm_create_enc_conn(struct
drm_device*dev,
- structexynos_drm_subdrv*subdrv)
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ struct
exynos_drm_display*display)
Quoted 33 lines
Quoted 13 lines
Quoted 13 lines
{ struct drm_encoder *encoder; struct drm_connector *connector;drivers/gpu/drm/exynos/exynos_drm_core.c +6
-1+struct exynos_drm_manager *manager;int ret; +unsigned long possible_crtcs =0 ; - subdrv->manager->dev = subdrv->dev; +/* Find possible crtcs for this display */ +list_for_each_entry (manager, &exynos_drm_manager_list, list) +if (manager->type == display->type) + possible_crtcs |=1 << manager->pipe;Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_core.c static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
Quoted 4 lines
/* create and initialize a encoder for this sub driver. */drivers/gpu/drm/exynos/exynos_drm_core.c +1
-2- encoder =exynos_drm_encoder_create (dev, subdrv->manager, - (1 <<MAX_CRTC ) -1 ); + encoder = exynos_drm_encoder_create(dev, display,
possible_crtcs);Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_core.c static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
Quoted 8 lines
if (!encoder) { DRM_ERROR("failed to create encoder\n"); return -EFAULT; }drivers/gpu/drm/exynos/exynos_drm_core.c +1
-2- subdrv->encoder = encoder; + display->encoder = encoder; - if (subdrv->manager->display_ops->type ==
EXYNOS_DISPLAY_TYPE_LCD) {Quoted 6 lines
Quoted 2 lines
+ if (
display->type==EXYNOS_DISPLAY_TYPE_LCD) {
ret =exynos_drm_attach_lcd_bridge(dev, encoder)Plz, _do_not_base_ on top of your lvds bridge patch set. As I mentioned before, the tricky codes are not good. For this, let's find a better way after your refactoring patch set are reviewed enough,
and
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
if merged.
[+adding back the people you removed from CC]
Hm.. I didn't really remove the people from CC. See the your original email. :)
Quoted 6 lines
Quoted 4 lines
I'm happy to change how that works, but I've yet to find a better solution. Instead of just dismissing something as "tricky codes", can you suggest a concrete solution that is better than what I've got?
I think I mentioned already at previous email. First of all, let's have
a
Quoted 1 line
thorough review to your refactoring patch set, and then let's find a
better
Quoted 3 lines
way.
I believe that we can find a better way with your refactoring patch set:
now
Quoted 2 lines
we can implement encoder and connector directly.
The code will look the exact same, it'll just be in the dp driver instead of
drm_core(sincedrm_corewill not create encoders/connectors). Adding the ptn driver in the interim allows me to boot exynos5250-snow with linux-next, so I can test my changes.Quoted 4 lines
Quoted 2 lines
I'm also a bit confused as to why you think it's so tricky, it's a
First, That was your comment, "Right, so this is kind of tricky". And
also
Quoted 2 lines
it seems like tricky codes to me.
Right, it was a tricky problem (for reasons I've stated multiple times), but the solution is dead easy to understand.
Quoted 4 lines
Quoted 2 lines
synchronous initialization call to a driver; that's about as simple as it gets.
As you mentioned before, ptn3460 driver is not depended on SoC, and can
be
Quoted 4 lines
used for other SoC. Let you try to think about lcd class and backlight class. I think we need a interfacing layer between common driver and specific something for connecting SoC specific DRM framework.
Laurent mentioned that he wanted to come up with a way to model graphics hardware in dt. He could then build a notifier when the various pieces were successfully probed, and drm would only load once all of the pieces were ready.
Quoted 6 lines
I think that would be a nice long-term solution, however let's not let the perfect be the enemy of the good. If you can simplify how this works, I'm all for it. However, I don't see any other way at the moment and I don't think it's productive to just wait around for something better to come along.
Sean, let's have reviews to your refactoring patch set first. And then I will merge your lvds bridge patch if we cannot find a better way. That would not take much time.
Quoted 25 lines
Sean
Quoted 22 lines
Quoted 21 lines
Sean
Quoted 3 lines
Review static int exynos_drm_create_enc_conn(struct
Quoted 3 lines
if (ret) return 0;(quoted diff) +0
-0@@ -91,7 +98,7 @@ static int exynos_drm_create_enc_conn(struct
drm_device*dev,Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_core.c +1
-1goto err_destroy_encoder; } - subdrv->connector = connector; + display->connector = connector;return 0 ;@@ -100,21 +107,6 @@ err_destroy_encoder:return ret; }
Inki Dae
maintainerRe: [PATCH 12/23] drm/exynos: Split manager/display/subdrv
In reply to Sean PaulQuoted 22 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +2
-4@@ -26,24 +26,23 @@* exynos specific encoder structure. * * @drm_encoder: encoder object. -* @manager: specific encoder has its own manager to control a hardware -* appropriately and we can access a hardware drawing on this manager. +* @display: the display structure that maps to this encoder */ struct exynos_drm_encoder {struct drm_crtc *old_crtc;struct drm_encoder drm_encoder; -struct exynos_drm_manager *manager; +struct exynos_drm_display *display; };static void exynos_drm_encoder_dpms (struct drm_encoder *encoder,int mode) { -struct exynos_drm_manager *manager =exynos_drm_get_manager (encoder);
drivers/gpu/drm/exynos/exynos_drm_encoder.c line 45
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +4
-3-struct exynos_drm_display_ops *display_ops = manager->display_ops; +struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); +struct exynos_drm_display *display = exynos_encoder->display;DRM_DEBUG_KMS ("encoder dpms: %d\n" , mode); -if (display_ops && display_ops->dpms) - display_ops->dpms (manager->ctx, mode); +if (display->ops->dpms) + display->ops->dpms (display->ctx, mode);
It's good to remove apply callback. However, it seems that this patch has a problem that dma channel of fimd isn't enabled after dpms goes from off to on. So can you implement win_enable callback of fimd, and add it to fimd_win_resume function? We should have implemented win_enable callback.
Quoted 1,101 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +25
-219} static bool@@ -52,15 +51,17 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *adjusted_mode) {struct drm_device *dev = encoder->dev; +struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); +struct exynos_drm_display *display = exynos_encoder->display;struct drm_connector *connector; -struct exynos_drm_manager *manager =exynos_drm_get_manager (encoder); -struct exynos_drm_manager_ops *manager_ops = manager->ops;list_for_each_entry (connector, &dev->mode_config.connector_list, head) { -if (connector->encoder == encoder) -if (manager_ops && manager_ops->mode_fixup) - manager_ops->mode_fixup (manager->ctx, connector, - mode, adjusted_mode); +if (connector->encoder != encoder) +continue ; + +if (display->ops->mode_fixup) + display->ops->mode_fixup (display->ctx, connector, mode, + adjusted_mode); }return true;@@ -102,8 +103,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, {struct drm_device *dev = encoder->dev;struct drm_connector *connector; -struct exynos_drm_manager *manager; -struct exynos_drm_manager_ops *manager_ops; +struct exynos_drm_display *display;list_for_each_entry (connector, &dev->mode_config.connector_list, head) {if (connector->encoder == encoder) {@@ -123,11 +123,10 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, encoder->crtc); } - manager =exynos_drm_get_manager (encoder); - manager_ops = manager->ops; + display = exynos_encoder->display; -if (manager_ops && manager_ops->mode_set) - manager_ops->mode_set (manager->ctx, +if (display->ops->mode_set) + display->ops->mode_set (display->ctx, adjusted_mode); exynos_encoder->old_crtc = encoder->crtc;@@ -143,39 +142,15 @@ static void exynos_drm_encoder_prepare(struct drm_encoder *encoder)static void exynos_drm_encoder_commit (struct drm_encoder *encoder) {struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); -struct exynos_drm_manager *manager = exynos_encoder->manager; -struct exynos_drm_manager_ops *manager_ops = manager->ops; - -if (manager_ops && manager_ops->commit) - manager_ops->commit (manager->ctx); -} +struct exynos_drm_display *display = exynos_encoder->display; -void exynos_drm_encoder_complete_scanout (struct drm_framebuffer *fb) -{ -struct exynos_drm_encoder *exynos_encoder; -struct exynos_drm_manager_ops *ops; -struct drm_device *dev = fb->dev; -struct drm_encoder *encoder; +if (display->ops->dpms) + display->ops->dpms (display->ctx,DRM_MODE_DPMS_ON ); -/* -* make sure that overlay data are updated to real hardware -* for all encoders. -*/ -list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) { - exynos_encoder =to_exynos_encoder (encoder); - ops = exynos_encoder->manager->ops; - -/* -* wait for vblank interrupt -* - this makes sure that overlay data are updated to -* real hardware. -*/ -if (ops->wait_for_vblank) - ops->wait_for_vblank (exynos_encoder->manager->dev); - } +if (display->ops->commit) + display->ops->commit (display->ctx); } -static void exynos_drm_encoder_disable (struct drm_encoder *encoder) {struct drm_plane *plane;@@ -201,10 +176,7 @@ static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {static void exynos_drm_encoder_destroy (struct drm_encoder *encoder) { -struct exynos_drm_encoder *exynos_encoder = -to_exynos_encoder (encoder); - - exynos_encoder->manager->pipe =-1 ; +struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder);drm_encoder_cleanup (encoder);kfree (exynos_encoder);@@ -219,13 +191,12 @@ static unsigned int exynos_drm_encoder_clones(struct drm_encoder *encoder)struct drm_encoder *clone;struct drm_device *dev = encoder->dev;struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); -struct exynos_drm_display_ops *display_ops = - exynos_encoder->manager->display_ops; +struct exynos_drm_display *display = exynos_encoder->display;unsigned int clone_mask =0 ;int cnt =0 ;list_for_each_entry (clone, &dev->mode_config.encoder_list, head) { -switch (display_ops->type) { +switch (display->type) {case EXYNOS_DISPLAY_TYPE_LCD :case EXYNOS_DISPLAY_TYPE_HDMI :case EXYNOS_DISPLAY_TYPE_VIDI :@@ -249,24 +220,20 @@ void exynos_drm_encoder_setup(struct drm_device *dev)struct drm_encoder *exynos_drm_encoder_create (struct drm_device *dev, -struct exynos_drm_manager *manager, +struct exynos_drm_display *display,unsigned long possible_crtcs) {struct drm_encoder *encoder;struct exynos_drm_encoder *exynos_encoder; -int ret; -if (!manager || !possible_crtcs) -return NULL ; - -if (!manager->dev) +if (!possible_crtcs)return NULL ; exynos_encoder =kzalloc (sizeof (*exynos_encoder),GFP_KERNEL );if (!exynos_encoder)return NULL ; - exynos_encoder->manager = manager; + exynos_encoder->display = display; encoder = &exynos_encoder->drm_encoder; encoder->possible_crtcs = possible_crtcs;@@ -277,174 +244,12 @@ exynos_drm_encoder_create(struct drm_device *dev,drm_encoder_helper_add (encoder, &exynos_encoder_helper_funcs); -if (manager->ops && manager->ops->initialize) { - ret = manager->ops->initialize (manager->ctx, dev); -if (ret) { -DRM_ERROR ("Manager initialize failed %d\n" , ret); - goto error; - } - } - -if (manager->display_ops && manager->display_ops->initialize) { - ret = manager->display_ops->initialize (manager->ctx, dev); -if (ret) { -DRM_ERROR ("Display initialize failed %d\n" , ret); - goto error; - } - } -DRM_DEBUG_KMS ("encoder has been created\n" );return encoder; - -error: -exynos_drm_encoder_destroy (&exynos_encoder->drm_encoder); -return NULL ; } -struct exynos_drm_manager *exynos_drm_get_manager (struct drm_encoder *encoder) +struct exynos_drm_display *exynos_drm_get_display (struct drm_encoder *encoder) { -return to_exynos_encoder (encoder)->manager; -} - -void exynos_drm_fn_encoder (struct drm_crtc *crtc,void *data, -void (*fn)(struct drm_encoder *,void *)) -{ -struct drm_device *dev = crtc->dev; -struct drm_encoder *encoder; -struct exynos_drm_private *private = dev->dev_private; -struct exynos_drm_manager *manager; - -list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) { -/* -* if crtc is detached from encoder, check pipe, -* otherwise check crtc attached to encoder -*/ -if (!encoder->crtc) { - manager =to_exynos_encoder (encoder)->manager; -if (manager->pipe <0 || - private->crtc[manager->pipe] != crtc) -continue ; - }else { -if (encoder->crtc != crtc) -continue ; - } - -fn (encoder, data); - } -} - -void exynos_drm_enable_vblank (struct drm_encoder *encoder,void *data) -{ -struct exynos_drm_manager *manager = -to_exynos_encoder (encoder)->manager; -struct exynos_drm_manager_ops *manager_ops = manager->ops; -int crtc = *(int *)data; - -if (manager->pipe != crtc) -return ; - -if (manager_ops->enable_vblank) - manager_ops->enable_vblank (manager->ctx); -} - -void exynos_drm_disable_vblank (struct drm_encoder *encoder,void *data) -{ -struct exynos_drm_manager *manager = -to_exynos_encoder (encoder)->manager; -struct exynos_drm_manager_ops *manager_ops = manager->ops; -int crtc = *(int *)data; - -if (manager->pipe != crtc) -return ; - -if (manager_ops->disable_vblank) - manager_ops->disable_vblank (manager->ctx); -} - -void exynos_drm_encoder_crtc_dpms (struct drm_encoder *encoder,void *data) -{ -struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); -struct exynos_drm_manager *manager = exynos_encoder->manager; -struct exynos_drm_manager_ops *manager_ops = manager->ops; -int mode = *(int *)data; - -if (manager_ops && manager_ops->dpms) - manager_ops->dpms (manager->ctx, mode); - -/* -* if this condition is ok then it means that the crtc is already -* detached from encoder and last function for detaching is properly -* done, so clear pipe from manager to prevent repeated call. -*/ -if (mode >DRM_MODE_DPMS_ON ) { -if (!encoder->crtc) - manager->pipe =-1 ; - } -} - -void exynos_drm_encoder_crtc_pipe (struct drm_encoder *encoder,void *data) -{ -struct exynos_drm_manager *manager = -to_exynos_encoder (encoder)->manager; -int pipe = *(int *)data; - -/* -* when crtc is detached from encoder, this pipe is used -* to select manager operation -*/ - manager->pipe = pipe; -} - -void exynos_drm_encoder_plane_mode_set (struct drm_encoder *encoder,void *data) -{ -struct exynos_drm_manager *manager = -to_exynos_encoder (encoder)->manager; -struct exynos_drm_manager_ops *manager_ops = manager->ops; -struct exynos_drm_overlay *overlay = data; - -if (manager_ops && manager_ops->win_mode_set) - manager_ops->win_mode_set (manager->ctx, overlay); -} - -void exynos_drm_encoder_plane_commit (struct drm_encoder *encoder,void *data) -{ -struct exynos_drm_manager *manager = -to_exynos_encoder (encoder)->manager; -struct exynos_drm_manager_ops *manager_ops = manager->ops; -int zpos =DEFAULT_ZPOS ; - -if (data) - zpos = *(int *)data; - -if (manager_ops && manager_ops->win_commit) - manager_ops->win_commit (manager->ctx, zpos); -} - -void exynos_drm_encoder_plane_enable (struct drm_encoder *encoder,void *data) -{ -struct exynos_drm_manager *manager = -to_exynos_encoder (encoder)->manager; -struct exynos_drm_manager_ops *manager_ops = manager->ops; -int zpos =DEFAULT_ZPOS ; - -if (data) - zpos = *(int *)data; - -if (manager_ops && manager_ops->win_enable) - manager_ops->win_enable (manager->ctx, zpos); -} - -void exynos_drm_encoder_plane_disable (struct drm_encoder *encoder,void *data) -{ -struct exynos_drm_manager *manager = -to_exynos_encoder (encoder)->manager; -struct exynos_drm_manager_ops *manager_ops = manager->ops; -int zpos =DEFAULT_ZPOS ; - -if (data) - zpos = *(int *)data; - -if (manager_ops && manager_ops->win_disable) - manager_ops->win_disable (manager->ctx, zpos); +return to_exynos_encoder (encoder)->display; }drivers/gpu/drm/exynos/exynos_drm_encoder.h +3
-15@@ -18,20 +18,8 @@ struct exynos_drm_manager;void exynos_drm_encoder_setup (struct drm_device *dev);struct drm_encoder *exynos_drm_encoder_create (struct drm_device *dev, -struct exynos_drm_manager *mgr, -unsigned long possible_crtcs); -struct exynos_drm_manager * -exynos_drm_get_manager (struct drm_encoder *encoder); -void exynos_drm_fn_encoder (struct drm_crtc *crtc,void *data, -void (*fn)(struct drm_encoder *,void *)); -void exynos_drm_enable_vblank (struct drm_encoder *encoder,void *data); -void exynos_drm_disable_vblank (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_crtc_dpms (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_crtc_pipe (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_plane_mode_set (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_plane_commit (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_plane_enable (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_plane_disable (struct drm_encoder *encoder,void *data); -void exynos_drm_encoder_complete_scanout (struct drm_framebuffer *fb); +struct exynos_drm_display *mgr, +unsigned long possible_crtcs); +struct exynos_drm_display *exynos_drm_get_display (struct drm_encoder *encoder);#endif drivers/gpu/drm/exynos/exynos_drm_fb.c +2
-2@@ -22,7 +22,7 @@#include "exynos_drm_fb.h" #include "exynos_drm_gem.h" #include "exynos_drm_iommu.h" -#include "exynos_drm_encoder.h" +#include "exynos_drm_crtc.h" #define to_exynos_fb (x) container_of(x, struct exynos_drm_fb, fb)@@ -71,7 +71,7 @@ static void exynos_drm_fb_destroy(struct drm_framebuffer *fb)unsigned int i;/* make sure that overlay data are updated before relesing fb. */ -exynos_drm_encoder_complete_scanout (fb); +exynos_drm_crtc_complete_scanout (fb);drm_framebuffer_cleanup (fb);drivers/gpu/drm/exynos/exynos_drm_fimd.c +71
-82@@ -105,7 +105,6 @@ struct fimd_win_data { };struct fimd_context { -struct exynos_drm_subdrv subdrv;struct device *dev;struct drm_device *drm_dev;int irq;@@ -120,6 +119,7 @@ struct fimd_context {u32 vidcon0;u32 vidcon1;bool suspended; +int pipe;struct mutex lock;wait_queue_head_t wait_vsync_queue;atomic_t wait_vsync_event;@@ -169,12 +169,16 @@ static int fimd_check_mode(void *in_ctx, struct drm_display_mode *mode) }static struct exynos_drm_display_ops fimd_display_ops = { - .type =EXYNOS_DISPLAY_TYPE_LCD , .is_connected = fimd_display_is_connected, .get_panel = fimd_get_panel, .check_mode = fimd_check_mode, }; +static struct exynos_drm_display fimd_display = { + .type =EXYNOS_DISPLAY_TYPE_LCD , + .ops = &fimd_display_ops, +}; +static void fimd_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) {struct fimd_context *ctx = in_ctx;@@ -481,15 +485,46 @@ static void fimd_win_disable(void *in_ctx, int zpos) win_data->enabled = false; } -static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) +static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev, +int pipe) {struct fimd_context *ctx = in_ctx; ctx->drm_dev = drm_dev; + ctx->pipe = pipe; + +/* +* enable drm irq mode. +* - with irq_enabled = 1, we can use the vblank feature. +* +* P.S. note that we wouldn't use drm irq handler but +* just specific driver own one instead because +* drm framework supports only one irq handler. +*/ + ctx->drm_dev->irq_enabled =1 ; + +/* +* with vblank_disable_allowed = 1, vblank interrupt will be disabled +* by drm timer once a current process gives up ownership of +* vblank event.(after drm_vblank_put function is called) +*/ + drm_dev->vblank_disable_allowed =1 ; + +/* attach this sub driver to iommu mapping if supported. */ +if (is_drm_iommu_supported (ctx->drm_dev)) +drm_iommu_attach_device (ctx->drm_dev, ctx->dev);return 0 ; } +static void fimd_mgr_remove (void *in_ctx) +{ +struct fimd_context *ctx = in_ctx; + +if (is_drm_iommu_supported (ctx->drm_dev)) +drm_iommu_detach_device (ctx->drm_dev, ctx->dev); +} +static void fimd_dpms (void *in_ctx,int mode) {struct fimd_context *ctx = in_ctx;@@ -523,24 +558,6 @@ static void fimd_dpms(void *in_ctx, int mode)mutex_unlock (&ctx->lock); } -static void fimd_apply (void *in_ctx) -{ -struct fimd_context *ctx = in_ctx; -struct exynos_drm_manager *mgr = ctx->subdrv.manager; -struct exynos_drm_manager_ops *mgr_ops = mgr->ops; -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 && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (ctx, i); - } - -if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (ctx); -} -static void fimd_commit (void *in_ctx) {struct fimd_context *ctx = in_ctx;@@ -597,6 +614,21 @@ static void fimd_commit(void *in_ctx)writel (val, ctx->regs +VIDCON0 ); } +static void fimd_apply (void *in_ctx) +{ +struct fimd_context *ctx = in_ctx; +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 (ctx, i); + } + +fimd_commit (ctx); +} +static int fimd_enable_vblank (void *in_ctx) {struct fimd_context *ctx = in_ctx;@@ -661,6 +693,7 @@ static void fimd_wait_for_vblank(void *in_ctx)static struct exynos_drm_manager_ops fimd_manager_ops = { .initialize = fimd_mgr_initialize, + .remove = fimd_mgr_remove, .dpms = fimd_dpms, .apply = fimd_apply, .commit = fimd_commit,@@ -673,16 +706,13 @@ static struct exynos_drm_manager_ops fimd_manager_ops = { };static struct exynos_drm_manager fimd_manager = { - .pipe =-1 , - .ops = &fimd_manager_ops, - .display_ops = &fimd_display_ops, + .type =EXYNOS_DISPLAY_TYPE_LCD , + .ops = &fimd_manager_ops, };static irqreturn_t fimd_irq_handler (int irq,void *dev_id) {struct fimd_context *ctx = (struct fimd_context *)dev_id; -struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct exynos_drm_manager *manager = subdrv->manager;u32 val; val =readl (ctx->regs +VIDINTCON1 );@@ -692,11 +722,11 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)writel (VIDINTCON1_INT_FRAME , ctx->regs +VIDINTCON1 );/* check the crtc is detached already from encoder */ -if (manager->pipe <0 || !ctx->drm_dev) +if (ctx->pipe <0 || !ctx->drm_dev) goto out; -drm_handle_vblank (ctx->drm_dev, manager->pipe); -exynos_drm_crtc_finish_pageflip (ctx->drm_dev, manager->pipe); +drm_handle_vblank (ctx->drm_dev, ctx->pipe); +exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe);/* set wait vsync event to zero and wake up queue. */ if (atomic_read (&ctx->wait_vsync_event)) {@@ -707,39 +737,6 @@ out:return IRQ_HANDLED ; } -static int fimd_subdrv_probe (struct drm_device *drm_dev,struct device *dev) -{ -/* -* enable drm irq mode. -* - with irq_enabled = 1, we can use the vblank feature. -* -* P.S. note that we wouldn't use drm irq handler but -* just specific driver own one instead because -* drm framework supports only one irq handler. -*/ - drm_dev->irq_enabled =1 ; - -/* -* with vblank_disable_allowed = 1, vblank interrupt will be disabled -* by drm timer once a current process gives up ownership of -* vblank event.(after drm_vblank_put function is called) -*/ - drm_dev->vblank_disable_allowed =1 ; - -/* attach this sub driver to iommu mapping if supported. */ -if (is_drm_iommu_supported (drm_dev)) -drm_iommu_attach_device (drm_dev, dev); - -return 0 ; -} - -static void fimd_subdrv_remove (struct drm_device *drm_dev,struct device *dev) -{ -/* detach this sub driver from iommu mapping if supported. */ -if (is_drm_iommu_supported (drm_dev)) -drm_iommu_detach_device (drm_dev, dev); -} -static int fimd_configure_clocks (struct fimd_context *ctx,struct device *dev) {struct videomode *vm = &ctx->panel.vm;@@ -825,9 +822,8 @@ static int fimd_clock(struct fimd_context *ctx, bool enable)return 0 ; } -static void fimd_window_suspend (struct device *dev) +static void fimd_window_suspend (struct fimd_context *ctx) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data;int i;@@ -839,9 +835,8 @@ static void fimd_window_suspend(struct device *dev)fimd_wait_for_vblank (ctx); } -static void fimd_window_resume (struct device *dev) +static void fimd_window_resume (struct fimd_context *ctx) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data;int i;@@ -854,7 +849,6 @@ static void fimd_window_resume(struct device *dev)static int fimd_activate (struct fimd_context *ctx,bool enable) { -struct device *dev = ctx->subdrv.dev;if (enable) {int ret;@@ -866,11 +860,11 @@ static int fimd_activate(struct fimd_context *ctx, bool enable)/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit (0 , &ctx->irq_flags)) -fimd_enable_vblank (dev); +fimd_enable_vblank (ctx); -fimd_window_resume (dev); +fimd_window_resume (ctx); }else { -fimd_window_suspend (dev); +fimd_window_suspend (ctx);fimd_clock (ctx, false); ctx->suspended = true;@@ -907,7 +901,6 @@ static int fimd_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct fimd_context *ctx; -struct exynos_drm_subdrv *subdrv;struct resource *res;int win;int ret = -EINVAL ;@@ -952,15 +945,6 @@ static int fimd_probe(struct platform_device *pdev)DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); - fimd_manager.ctx = ctx; - - subdrv = &ctx->subdrv; - - subdrv->dev = dev; - subdrv->manager = &fimd_manager; - subdrv->probe = fimd_subdrv_probe; - subdrv->remove = fimd_subdrv_remove; -mutex_init (&ctx->lock);platform_set_drvdata (pdev, ctx);@@ -971,7 +955,11 @@ static int fimd_probe(struct platform_device *pdev)for (win =0 ; win <WINDOWS_NR ; win++)fimd_clear_win (ctx, win); -exynos_drm_subdrv_register (subdrv); + fimd_manager.ctx = ctx; +exynos_drm_manager_register (&fimd_manager); + + fimd_display.ctx = ctx; +exynos_drm_display_register (&fimd_display);return 0 ; }@@ -981,7 +969,8 @@ static int fimd_remove(struct platform_device *pdev)struct device *dev = &pdev->dev;struct fimd_context *ctx =platform_get_drvdata (pdev); -exynos_drm_subdrv_unregister (&ctx->subdrv); +exynos_drm_display_unregister (&fimd_display); +exynos_drm_manager_unregister (&fimd_manager);if (ctx->suspended) goto out;drivers/gpu/drm/exynos/exynos_drm_hdmi.c +98
-120@@ -24,14 +24,11 @@#include "exynos_drm_hdmi.h" #define to_context (dev) platform_get_drvdata(to_platform_device(dev)) -#define to_subdrv (dev) to_context(dev) -#define get_ctx_from_subdrv (subdrv) container_of(subdrv,\ - struct drm_hdmi_context, subdrv);/* platform device pointer for common drm hdmi device. */ static struct platform_device *exynos_drm_hdmi_pdev; -/* Common hdmi subdrv needs to access the hdmi and mixer though context. +/* Common hdmi needs to access the hdmi and mixer though context. * These should be initialied by the repective drivers */ static struct exynos_drm_hdmi_context *hdmi_ctx;static struct exynos_drm_hdmi_context *mixer_ctx;@@ -41,7 +38,6 @@ static struct exynos_hdmi_ops *hdmi_ops;static struct exynos_mixer_ops *mixer_ops;struct drm_hdmi_context { -struct exynos_drm_subdrv subdrv;struct exynos_drm_hdmi_context *hdmi_ctx;struct exynos_drm_hdmi_context *mixer_ctx;@@ -101,6 +97,12 @@ static int drm_hdmi_display_initialize(void *in_ctx, struct drm_device *drm_dev) {struct drm_hdmi_context *ctx = in_ctx; +if (!hdmi_ctx) { +DRM_ERROR ("hdmi context not initialized.\n" ); +return -EINVAL ; + } + ctx->hdmi_ctx = hdmi_ctx; +if (hdmi_ops && hdmi_ops->initialize)return hdmi_ops->initialize (ctx->hdmi_ctx->ctx, drm_dev);@@ -118,6 +120,17 @@ static bool drm_hdmi_is_connected(void *in_ctx)return false; } +static void drm_hdmi_get_max_resol (void *in_ctx,unsigned int *width, +unsigned int *height) +{ +struct drm_hdmi_context *ctx = in_ctx; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +if (hdmi_ops && hdmi_ops->get_max_resol) + hdmi_ops->get_max_resol (ctx->hdmi_ctx->ctx, width, height); +} +static struct edid *drm_hdmi_get_edid (void *in_ctx,struct drm_connector *connector) {@@ -129,6 +142,16 @@ static struct edid *drm_hdmi_get_edid(void *in_ctx,return NULL ; } +static void drm_hdmi_mode_set (void *in_ctx,struct drm_display_mode *mode) +{ +struct drm_hdmi_context *ctx = in_ctx; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +if (hdmi_ops && hdmi_ops->mode_set) + hdmi_ops->mode_set (ctx->hdmi_ctx->ctx, mode); +} +static int drm_hdmi_check_mode (void *in_ctx,struct drm_display_mode *mode) {struct drm_hdmi_context *ctx = in_ctx;@@ -151,52 +174,6 @@ static int drm_hdmi_check_mode(void *in_ctx, struct drm_display_mode *mode)return 0 ; } -static void drm_hdmi_display_dpms (void *in_ctx,int mode) -{ -struct drm_hdmi_context *ctx = in_ctx; - -if (hdmi_ops && hdmi_ops->dpms) - hdmi_ops->dpms (ctx->hdmi_ctx->ctx, mode); -} - -static struct exynos_drm_display_ops drm_hdmi_display_ops = { - .type =EXYNOS_DISPLAY_TYPE_HDMI , - .initialize = drm_hdmi_display_initialize, - .is_connected = drm_hdmi_is_connected, - .get_edid = drm_hdmi_get_edid, - .check_mode = drm_hdmi_check_mode, - .dpms = drm_hdmi_display_dpms, -}; - -static int drm_hdmi_enable_vblank (void *in_ctx) -{ -struct drm_hdmi_context *ctx = in_ctx; -struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct exynos_drm_manager *manager = subdrv->manager; - -if (mixer_ops && mixer_ops->enable_vblank) -return mixer_ops->enable_vblank (ctx->mixer_ctx->ctx, - manager->pipe); - -return 0 ; -} - -static void drm_hdmi_disable_vblank (void *in_ctx) -{ -struct drm_hdmi_context *ctx = in_ctx; - -if (mixer_ops && mixer_ops->disable_vblank) -return mixer_ops->disable_vblank (ctx->mixer_ctx->ctx); -} - -static void drm_hdmi_wait_for_vblank (void *in_ctx) -{ -struct drm_hdmi_context *ctx = in_ctx; - -if (mixer_ops && mixer_ops->wait_for_vblank) - mixer_ops->wait_for_vblank (ctx->mixer_ctx->ctx); -} -static void drm_hdmi_mode_fixup (void *in_ctx,struct drm_connector *connector,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode)@@ -241,21 +218,57 @@ static void drm_hdmi_mode_fixup(void *in_ctx, struct drm_connector *connector, } } -static void drm_hdmi_mode_set (void *in_ctx,void *mode) +static void drm_hdmi_display_dpms (void *in_ctx,int mode) {struct drm_hdmi_context *ctx = in_ctx; -if (hdmi_ops && hdmi_ops->mode_set) - hdmi_ops->mode_set (ctx->hdmi_ctx->ctx, mode); +if (hdmi_ops && hdmi_ops->dpms) + hdmi_ops->dpms (ctx->hdmi_ctx->ctx, mode); } -static void drm_hdmi_get_max_resol (void *in_ctx,unsigned int *width, -unsigned int *height) +static struct exynos_drm_display_ops drm_hdmi_display_ops = { + .initialize = drm_hdmi_display_initialize, + .is_connected = drm_hdmi_is_connected, + .get_max_resol = drm_hdmi_get_max_resol, + .get_edid = drm_hdmi_get_edid, + .mode_fixup = drm_hdmi_mode_fixup, + .mode_set = drm_hdmi_mode_set, + .check_mode = drm_hdmi_check_mode, + .dpms = drm_hdmi_display_dpms, +}; + +static struct exynos_drm_display hdmi_display = { + .type =EXYNOS_DISPLAY_TYPE_HDMI , + .ops = &drm_hdmi_display_ops, +}; + +static int drm_hdmi_enable_vblank (void *in_ctx) {struct drm_hdmi_context *ctx = in_ctx; -if (hdmi_ops && hdmi_ops->get_max_resol) - hdmi_ops->get_max_resol (ctx->hdmi_ctx->ctx, width, height); +if (mixer_ops && mixer_ops->enable_vblank) +return mixer_ops->enable_vblank (ctx->mixer_ctx->ctx, + ctx->mixer_ctx->pipe); + +return 0 ; +} + +static void drm_hdmi_disable_vblank (void *in_ctx) +{ +struct drm_hdmi_context *ctx = in_ctx; + +DRM_DEBUG_KMS ("%s\n" , __FILE__); + +if (mixer_ops && mixer_ops->disable_vblank) +return mixer_ops->disable_vblank (ctx->mixer_ctx->ctx); +} + +static void drm_hdmi_wait_for_vblank (void *in_ctx) +{ +struct drm_hdmi_context *ctx = in_ctx; + +if (mixer_ops && mixer_ops->wait_for_vblank) + mixer_ops->wait_for_vblank (ctx->mixer_ctx->ctx); }static void drm_hdmi_commit (void *in_ctx)@@ -266,11 +279,19 @@ static void drm_hdmi_commit(void *in_ctx) hdmi_ops->commit (ctx->hdmi_ctx->ctx); } -static int drm_hdmi_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) +static int drm_hdmi_mgr_initialize (void *in_ctx,struct drm_device *drm_dev, +int pipe) {struct drm_hdmi_context *ctx = in_ctx;int ret =0 ; +if (!mixer_ctx) { +DRM_ERROR ("mixer context not initialized.\n" ); +return -EFAULT ; + } + ctx->mixer_ctx = mixer_ctx; + ctx->mixer_ctx->pipe = pipe; +if (mixer_ops && mixer_ops->initialize) ret = mixer_ops->initialize (ctx->mixer_ctx->ctx, drm_dev);@@ -280,6 +301,14 @@ static int drm_hdmi_mgr_initialize(void *in_ctx, struct drm_device *drm_dev)return ret; } +static void drm_hdmi_mgr_remove (void *in_ctx) +{ +struct drm_hdmi_context *ctx = in_ctx; + +if (mixer_ops->iommu_on) + mixer_ops->iommu_on (ctx->mixer_ctx->ctx, false); +} +static void drm_hdmi_dpms (void *in_ctx,int mode) {struct drm_hdmi_context *ctx = in_ctx;@@ -350,14 +379,12 @@ static void drm_mixer_win_disable(void *in_ctx, int zpos)static struct exynos_drm_manager_ops drm_hdmi_manager_ops = { .initialize = drm_hdmi_mgr_initialize, + .remove = drm_hdmi_mgr_remove, .dpms = drm_hdmi_dpms, .apply = drm_hdmi_apply, .enable_vblank = drm_hdmi_enable_vblank, .disable_vblank = drm_hdmi_disable_vblank, .wait_for_vblank = drm_hdmi_wait_for_vblank, - .mode_fixup = drm_hdmi_mode_fixup, - .mode_set = drm_hdmi_mode_set, - .get_max_resol = drm_hdmi_get_max_resol, .commit = drm_hdmi_commit, .win_mode_set = drm_mixer_win_mode_set, .win_commit = drm_mixer_win_commit,@@ -365,82 +392,33 @@ static struct exynos_drm_manager_ops drm_hdmi_manager_ops = { };static struct exynos_drm_manager hdmi_manager = { - .pipe =-1 , - .ops = &drm_hdmi_manager_ops, - .display_ops = &drm_hdmi_display_ops, + .type =EXYNOS_DISPLAY_TYPE_HDMI , + .ops = &drm_hdmi_manager_ops, }; -static int hdmi_subdrv_probe (struct drm_device *drm_dev, -struct device *dev) -{ -struct exynos_drm_subdrv *subdrv =to_subdrv (dev); -struct drm_hdmi_context *ctx; - -if (!hdmi_ctx) { -DRM_ERROR ("hdmi context not initialized.\n" ); -return -EFAULT ; - } - -if (!mixer_ctx) { -DRM_ERROR ("mixer context not initialized.\n" ); -return -EFAULT ; - } - - ctx =get_ctx_from_subdrv (subdrv); - -if (!ctx) { -DRM_ERROR ("no drm hdmi context.\n" ); -return -EFAULT ; - } - - ctx->hdmi_ctx = hdmi_ctx; - ctx->mixer_ctx = mixer_ctx; - -return 0 ; -} - -static void hdmi_subdrv_remove (struct drm_device *drm_dev,struct device *dev) -{ -struct drm_hdmi_context *ctx; -struct exynos_drm_subdrv *subdrv =to_subdrv (dev); - - ctx =get_ctx_from_subdrv (subdrv); - -if (mixer_ops->iommu_on) - mixer_ops->iommu_on (ctx->mixer_ctx->ctx, false); -} -static int exynos_drm_hdmi_probe (struct platform_device *pdev) { -struct device *dev = &pdev->dev; -struct exynos_drm_subdrv *subdrv;struct drm_hdmi_context *ctx; - ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL ); + ctx =devm_kzalloc (&pdev->dev,sizeof (*ctx),GFP_KERNEL );if (!ctx)return -ENOMEM ; hdmi_manager.ctx = ctx; +exynos_drm_manager_register (&hdmi_manager); - subdrv = &ctx->subdrv; - - subdrv->dev = dev; - subdrv->manager = &hdmi_manager; - subdrv->probe = hdmi_subdrv_probe; - subdrv->remove = hdmi_subdrv_remove; + hdmi_display.ctx = ctx; +exynos_drm_display_register (&hdmi_display); -platform_set_drvdata (pdev, subdrv); - -exynos_drm_subdrv_register (subdrv); +platform_set_drvdata (pdev, ctx);return 0 ; }static int exynos_drm_hdmi_remove (struct platform_device *pdev) { -struct drm_hdmi_context *ctx =platform_get_drvdata (pdev); - -exynos_drm_subdrv_unregister (&ctx->subdrv); +exynos_drm_display_unregister (&hdmi_display); +exynos_drm_manager_unregister (&hdmi_manager);return 0 ; }drivers/gpu/drm/exynos/exynos_drm_hdmi.h +2
-0@@ -19,10 +19,12 @@* exynos hdmi common context structure. * * @drm_dev: pointer to drm_device. +* @pipe: pipe for mixer * @ctx: pointer to the context of specific device driver. * this context should be hdmi_context or mixer_context. */ struct exynos_drm_hdmi_context { +int pipe;void *ctx; };drivers/gpu/drm/exynos/exynos_drm_plane.c +5
-11@@ -13,7 +13,7 @@#include <drm/exynos_drm.h> #include "exynos_drm_drv.h" -#include "exynos_drm_encoder.h" +#include "exynos_drm_crtc.h" #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" #include "exynos_drm_plane.h" @@ -139,7 +139,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, overlay->crtc_x, overlay->crtc_y, overlay->crtc_width, overlay->crtc_height); -exynos_drm_fn_encoder (crtc, overlay, exynos_drm_encoder_plane_mode_set); +exynos_drm_crtc_plane_mode_set (crtc, overlay);return 0 ; }@@ -149,8 +149,7 @@ void exynos_plane_commit(struct drm_plane *plane)struct exynos_plane *exynos_plane =to_exynos_plane (plane);struct exynos_drm_overlay *overlay = &exynos_plane->overlay; -exynos_drm_fn_encoder (plane->crtc, &overlay->zpos, - exynos_drm_encoder_plane_commit); +exynos_drm_crtc_plane_commit (plane->crtc, overlay->zpos); }void exynos_plane_dpms (struct drm_plane *plane,int mode)@@ -162,17 +161,13 @@ void exynos_plane_dpms(struct drm_plane *plane, int mode)if (exynos_plane->enabled)return ; -exynos_drm_fn_encoder (plane->crtc, &overlay->zpos, - exynos_drm_encoder_plane_enable); - +exynos_drm_crtc_plane_enable (plane->crtc, overlay->zpos); exynos_plane->enabled = true; }else {if (!exynos_plane->enabled)return ; -exynos_drm_fn_encoder (plane->crtc, &overlay->zpos, - exynos_drm_encoder_plane_disable); - +exynos_drm_crtc_plane_disable (plane->crtc, overlay->zpos); exynos_plane->enabled = false; } } --1.8.4
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerRe: [PATCH 12/23] drm/exynos: Split manager/display/subdrv
2013/10/15 Inki Dae <[email protected]>:
Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +4
-5@@ -26,24 +26,23 @@* exynos specific encoder structure. * * @drm_encoder: encoder object. -* @manager: specific encoder has its own manager to control a hardware -* appropriately and we can access a hardware drawing on this manager. +* @display: the display structure that maps to this encoder */ struct exynos_drm_encoder {struct drm_crtc *old_crtc;struct drm_encoder drm_encoder; -struct exynos_drm_manager *manager; +struct exynos_drm_display *display; };static void exynos_drm_encoder_dpms (struct drm_encoder *encoder,int mode) { -struct exynos_drm_manager *manager =exynos_drm_get_manager (encoder); -struct exynos_drm_display_ops *display_ops = manager->display_ops; +struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); +struct exynos_drm_display *display = exynos_encoder->display;DRM_DEBUG_KMS ("encoder dpms: %d\n" , mode);
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c line 45
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +2
-2-if (display_ops && display_ops->dpms) - display_ops->dpms (manager->ctx, mode); +if (display->ops->dpms) + display->ops->dpms (display->ctx, mode);It's good to remove apply callback. However, it seems that this patch has a problem that dma channel of fimd isn't enabled after dpms goes from off to on. So can you implement
win_enablecallback of fimd, and add it tofimd_win_resumefunction? We should have implementedwin_enablecallback.
Plz, ignore the above comments, and see the below comments.
Quoted 115 lines
Quoted 115 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +38
-21@@ -105,7 +105,6 @@ struct fimd_win_data { };struct fimd_context { -struct exynos_drm_subdrv subdrv;struct device *dev;struct drm_device *drm_dev;int irq;@@ -120,6 +119,7 @@ struct fimd_context {u32 vidcon0;u32 vidcon1;bool suspended; +int pipe;struct mutex lock;wait_queue_head_t wait_vsync_queue;atomic_t wait_vsync_event;@@ -169,12 +169,16 @@ static int fimd_check_mode(void *in_ctx, struct drm_display_mode *mode) }static struct exynos_drm_display_ops fimd_display_ops = { - .type =EXYNOS_DISPLAY_TYPE_LCD , .is_connected = fimd_display_is_connected, .get_panel = fimd_get_panel, .check_mode = fimd_check_mode, }; +static struct exynos_drm_display fimd_display = { + .type =EXYNOS_DISPLAY_TYPE_LCD , + .ops = &fimd_display_ops, +}; +static void fimd_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) {struct fimd_context *ctx = in_ctx;@@ -481,15 +485,46 @@ static void fimd_win_disable(void *in_ctx, int zpos) win_data->enabled = false; } -static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) +static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev, +int pipe) {struct fimd_context *ctx = in_ctx; ctx->drm_dev = drm_dev; + ctx->pipe = pipe; + +/* +* enable drm irq mode. +* - with irq_enabled = 1, we can use the vblank feature. +* +* P.S. note that we wouldn't use drm irq handler but +* just specific driver own one instead because +* drm framework supports only one irq handler. +*/ + ctx->drm_dev->irq_enabled =1 ; + +/* +* with vblank_disable_allowed = 1, vblank interrupt will be disabled +* by drm timer once a current process gives up ownership of +* vblank event.(after drm_vblank_put function is called) +*/ + drm_dev->vblank_disable_allowed =1 ; + +/* attach this sub driver to iommu mapping if supported. */ +if (is_drm_iommu_supported (ctx->drm_dev)) +drm_iommu_attach_device (ctx->drm_dev, ctx->dev);return 0 ; } +static void fimd_mgr_remove (void *in_ctx) +{ +struct fimd_context *ctx = in_ctx; + +if (is_drm_iommu_supported (ctx->drm_dev)) +drm_iommu_detach_device (ctx->drm_dev, ctx->dev); +} +static void fimd_dpms (void *in_ctx,int mode) {struct fimd_context *ctx = in_ctx;@@ -523,24 +558,6 @@ static void fimd_dpms(void *in_ctx, int mode)mutex_unlock (&ctx->lock); } -static void fimd_apply (void *in_ctx) -{ -struct fimd_context *ctx = in_ctx; -struct exynos_drm_manager *mgr = ctx->subdrv.manager; -struct exynos_drm_manager_ops *mgr_ops = mgr->ops; -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 && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (ctx, i); - } - -if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (ctx); -} -static void fimd_commit (void *in_ctx) {struct fimd_context *ctx = in_ctx;@@ -597,6 +614,21 @@ static void fimd_commit(void *in_ctx)writel (val, ctx->regs +VIDCON0 ); }
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_commit(void *in_ctx) · line 626
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +10
-0+static void fimd_apply (void *in_ctx) +{ +struct fimd_context *ctx = in_ctx; +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 (ctx, i);
Implement fimd_win_enable function and call it at here,
if (win_data->enabled) {
fimd_win_commit(ctx,i);
fimd_win_enable(ctx, i); <- here
}And, the below codes, for enable overlay dma channel, should be removed from fimd_win_commit function,
/* wincon */
val = readl(ctx->regs + WINCON(win));
val |= WINCONx_ENWIN;
writel(val, ctx->regs + WINCON(win));And, with [PATCH v2] drm/exynos: fimd: clean up pm suspend/resume, it must work well.
Quoted 182 lines
Quoted 182 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +23
-61+ } + +fimd_commit (ctx); +} +static int fimd_enable_vblank (void *in_ctx) {struct fimd_context *ctx = in_ctx;@@ -661,6 +693,7 @@ static void fimd_wait_for_vblank(void *in_ctx)static struct exynos_drm_manager_ops fimd_manager_ops = { .initialize = fimd_mgr_initialize, + .remove = fimd_mgr_remove, .dpms = fimd_dpms, .apply = fimd_apply, .commit = fimd_commit,@@ -673,16 +706,13 @@ static struct exynos_drm_manager_ops fimd_manager_ops = { };static struct exynos_drm_manager fimd_manager = { - .pipe =-1 , - .ops = &fimd_manager_ops, - .display_ops = &fimd_display_ops, + .type =EXYNOS_DISPLAY_TYPE_LCD , + .ops = &fimd_manager_ops, };static irqreturn_t fimd_irq_handler (int irq,void *dev_id) {struct fimd_context *ctx = (struct fimd_context *)dev_id; -struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct exynos_drm_manager *manager = subdrv->manager;u32 val; val =readl (ctx->regs +VIDINTCON1 );@@ -692,11 +722,11 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)writel (VIDINTCON1_INT_FRAME , ctx->regs +VIDINTCON1 );/* check the crtc is detached already from encoder */ -if (manager->pipe <0 || !ctx->drm_dev) +if (ctx->pipe <0 || !ctx->drm_dev) goto out; -drm_handle_vblank (ctx->drm_dev, manager->pipe); -exynos_drm_crtc_finish_pageflip (ctx->drm_dev, manager->pipe); +drm_handle_vblank (ctx->drm_dev, ctx->pipe); +exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe);/* set wait vsync event to zero and wake up queue. */ if (atomic_read (&ctx->wait_vsync_event)) {@@ -707,39 +737,6 @@ out:return IRQ_HANDLED ; } -static int fimd_subdrv_probe (struct drm_device *drm_dev,struct device *dev) -{ -/* -* enable drm irq mode. -* - with irq_enabled = 1, we can use the vblank feature. -* -* P.S. note that we wouldn't use drm irq handler but -* just specific driver own one instead because -* drm framework supports only one irq handler. -*/ - drm_dev->irq_enabled =1 ; - -/* -* with vblank_disable_allowed = 1, vblank interrupt will be disabled -* by drm timer once a current process gives up ownership of -* vblank event.(after drm_vblank_put function is called) -*/ - drm_dev->vblank_disable_allowed =1 ; - -/* attach this sub driver to iommu mapping if supported. */ -if (is_drm_iommu_supported (drm_dev)) -drm_iommu_attach_device (drm_dev, dev); - -return 0 ; -} - -static void fimd_subdrv_remove (struct drm_device *drm_dev,struct device *dev) -{ -/* detach this sub driver from iommu mapping if supported. */ -if (is_drm_iommu_supported (drm_dev)) -drm_iommu_detach_device (drm_dev, dev); -} -static int fimd_configure_clocks (struct fimd_context *ctx,struct device *dev) {struct videomode *vm = &ctx->panel.vm;@@ -825,9 +822,8 @@ static int fimd_clock(struct fimd_context *ctx, bool enable)return 0 ; } -static void fimd_window_suspend (struct device *dev) +static void fimd_window_suspend (struct fimd_context *ctx) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data;int i;@@ -839,9 +835,8 @@ static void fimd_window_suspend(struct device *dev)fimd_wait_for_vblank (ctx); } -static void fimd_window_resume (struct device *dev) +static void fimd_window_resume (struct fimd_context *ctx) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data;int i;@@ -854,7 +849,6 @@ static void fimd_window_resume(struct device *dev)static int fimd_activate (struct fimd_context *ctx,bool enable) { -struct device *dev = ctx->subdrv.dev;if (enable) {int ret;@@ -866,11 +860,11 @@ static int fimd_activate(struct fimd_context *ctx, bool enable)/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit (0 , &ctx->irq_flags)) -fimd_enable_vblank (dev); +fimd_enable_vblank (ctx); -fimd_window_resume (dev); +fimd_window_resume (ctx); }else { -fimd_window_suspend (dev); +fimd_window_suspend (ctx);fimd_clock (ctx, false); ctx->suspended = true;@@ -907,7 +901,6 @@ static int fimd_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct fimd_context *ctx; -struct exynos_drm_subdrv *subdrv;struct resource *res;int win;int ret = -EINVAL ;@@ -952,15 +945,6 @@ static int fimd_probe(struct platform_device *pdev)DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); - fimd_manager.ctx = ctx; - - subdrv = &ctx->subdrv; - - subdrv->dev = dev; - subdrv->manager = &fimd_manager; - subdrv->probe = fimd_subdrv_probe; - subdrv->remove = fimd_subdrv_remove; -mutex_init (&ctx->lock);platform_set_drvdata (pdev, ctx);@@ -971,7 +955,11 @@ static int fimd_probe(struct platform_device *pdev)for (win =0 ; win <WINDOWS_NR ; win++)fimd_clear_win (ctx, win); -exynos_drm_subdrv_register (subdrv); + fimd_manager.ctx = ctx; +exynos_drm_manager_register (&fimd_manager); + + fimd_display.ctx = ctx; +exynos_drm_display_register (&fimd_display);return 0 ; }@@ -981,7 +969,8 @@ static int fimd_remove(struct platform_device *pdev)struct device *dev = &pdev->dev;struct fimd_context *ctx =platform_get_drvdata (pdev); -exynos_drm_subdrv_unregister (&ctx->subdrv); +exynos_drm_display_unregister (&fimd_display); +exynos_drm_manager_unregister (&fimd_manager);if (ctx->suspended) goto out;
Re: [PATCH 12/23] drm/exynos: Split manager/display/subdrv
Quoted 177 lines · Inki Dae
2013/10/15 Inki Dae <[email protected]>:
Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +4
-5@@ -26,24 +26,23 @@* exynos specific encoder structure. * * @drm_encoder: encoder object. -* @manager: specific encoder has its own manager to control a hardware -* appropriately and we can access a hardware drawing on this manager. +* @display: the display structure that maps to this encoder */ struct exynos_drm_encoder {struct drm_crtc *old_crtc;struct drm_encoder drm_encoder; -struct exynos_drm_manager *manager; +struct exynos_drm_display *display; };static void exynos_drm_encoder_dpms (struct drm_encoder *encoder,int mode) { -struct exynos_drm_manager *manager =exynos_drm_get_manager (encoder); -struct exynos_drm_display_ops *display_ops = manager->display_ops; +struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); +struct exynos_drm_display *display = exynos_encoder->display;DRM_DEBUG_KMS ("encoder dpms: %d\n" , mode);Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c line 45
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +2
-2-if (display_ops && display_ops->dpms) - display_ops->dpms (manager->ctx, mode); +if (display->ops->dpms) + display->ops->dpms (display->ctx, mode);It's good to remove apply callback. However, it seems that this patch has a problem that dma channel of fimd isn't enabled after dpms goes from off to on. So can you implement
win_enablecallback of fimd, and add it tofimd_win_resumefunction? We should have implementedwin_enablecallback.Plz, ignore the above comments, and see the below comments.
Quoted 115 lines
Quoted 115 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +38
-21@@ -105,7 +105,6 @@ struct fimd_win_data { };struct fimd_context { -struct exynos_drm_subdrv subdrv;struct device *dev;struct drm_device *drm_dev;int irq;@@ -120,6 +119,7 @@ struct fimd_context {u32 vidcon0;u32 vidcon1;bool suspended; +int pipe;struct mutex lock;wait_queue_head_t wait_vsync_queue;atomic_t wait_vsync_event;@@ -169,12 +169,16 @@ static int fimd_check_mode(void *in_ctx, struct drm_display_mode *mode) }static struct exynos_drm_display_ops fimd_display_ops = { - .type =EXYNOS_DISPLAY_TYPE_LCD , .is_connected = fimd_display_is_connected, .get_panel = fimd_get_panel, .check_mode = fimd_check_mode, }; +static struct exynos_drm_display fimd_display = { + .type =EXYNOS_DISPLAY_TYPE_LCD , + .ops = &fimd_display_ops, +}; +static void fimd_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) {struct fimd_context *ctx = in_ctx;@@ -481,15 +485,46 @@ static void fimd_win_disable(void *in_ctx, int zpos) win_data->enabled = false; } -static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) +static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev, +int pipe) {struct fimd_context *ctx = in_ctx; ctx->drm_dev = drm_dev; + ctx->pipe = pipe; + +/* +* enable drm irq mode. +* - with irq_enabled = 1, we can use the vblank feature. +* +* P.S. note that we wouldn't use drm irq handler but +* just specific driver own one instead because +* drm framework supports only one irq handler. +*/ + ctx->drm_dev->irq_enabled =1 ; + +/* +* with vblank_disable_allowed = 1, vblank interrupt will be disabled +* by drm timer once a current process gives up ownership of +* vblank event.(after drm_vblank_put function is called) +*/ + drm_dev->vblank_disable_allowed =1 ; + +/* attach this sub driver to iommu mapping if supported. */ +if (is_drm_iommu_supported (ctx->drm_dev)) +drm_iommu_attach_device (ctx->drm_dev, ctx->dev);return 0 ; } +static void fimd_mgr_remove (void *in_ctx) +{ +struct fimd_context *ctx = in_ctx; + +if (is_drm_iommu_supported (ctx->drm_dev)) +drm_iommu_detach_device (ctx->drm_dev, ctx->dev); +} +static void fimd_dpms (void *in_ctx,int mode) {struct fimd_context *ctx = in_ctx;@@ -523,24 +558,6 @@ static void fimd_dpms(void *in_ctx, int mode)mutex_unlock (&ctx->lock); } -static void fimd_apply (void *in_ctx) -{ -struct fimd_context *ctx = in_ctx; -struct exynos_drm_manager *mgr = ctx->subdrv.manager; -struct exynos_drm_manager_ops *mgr_ops = mgr->ops; -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 && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (ctx, i); - } - -if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (ctx); -} -static void fimd_commit (void *in_ctx) {struct fimd_context *ctx = in_ctx;@@ -597,6 +614,21 @@ static void fimd_commit(void *in_ctx)writel (val, ctx->regs +VIDCON0 ); }Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_commit(void *in_ctx) · line 626
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +10
-0+static void fimd_apply (void *in_ctx) +{ +struct fimd_context *ctx = in_ctx; +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 (ctx, i);Implement
fimd_win_enablefunction and call it at here,if (win_data->enabled) { fimd_win_commit(ctx,i); fimd_win_enable(ctx, i); <- here }
Quoted 8 lines
And, the below codes, for enable overlay dma channel, should be removed from
fimd_win_commitfunction,/* wincon */ val = readl(ctx->regs + WINCON(win)); val |= WINCONx_ENWIN; writel(val, ctx->regs + WINCON(win));
I'm not sure I follow why you want this done here. It seems unrelated to this patch.
Quoted 3 lines
And, with [PATCH v2] drm/exynos: fimd: clean up pm suspend/resume, it must work well.
I've got a patch to remove all of the suspend/resume/pm_suspend/pm_resume stuff from all of the individual drivers and do everything through dpms. This will eliminate the error modes where the dpms state in the upper layers get out of sync with the actual state of the hardware. It's also more consistent with other drm drivers. I'll post it after this set.
Sean
Quoted 183 lines
Quoted 183 lines
Quoted 183 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +23
-61+ } + +fimd_commit (ctx); +} +static int fimd_enable_vblank (void *in_ctx) {struct fimd_context *ctx = in_ctx;@@ -661,6 +693,7 @@ static void fimd_wait_for_vblank(void *in_ctx)static struct exynos_drm_manager_ops fimd_manager_ops = { .initialize = fimd_mgr_initialize, + .remove = fimd_mgr_remove, .dpms = fimd_dpms, .apply = fimd_apply, .commit = fimd_commit,@@ -673,16 +706,13 @@ static struct exynos_drm_manager_ops fimd_manager_ops = { };static struct exynos_drm_manager fimd_manager = { - .pipe =-1 , - .ops = &fimd_manager_ops, - .display_ops = &fimd_display_ops, + .type =EXYNOS_DISPLAY_TYPE_LCD , + .ops = &fimd_manager_ops, };static irqreturn_t fimd_irq_handler (int irq,void *dev_id) {struct fimd_context *ctx = (struct fimd_context *)dev_id; -struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct exynos_drm_manager *manager = subdrv->manager;u32 val; val =readl (ctx->regs +VIDINTCON1 );@@ -692,11 +722,11 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)writel (VIDINTCON1_INT_FRAME , ctx->regs +VIDINTCON1 );/* check the crtc is detached already from encoder */ -if (manager->pipe <0 || !ctx->drm_dev) +if (ctx->pipe <0 || !ctx->drm_dev) goto out; -drm_handle_vblank (ctx->drm_dev, manager->pipe); -exynos_drm_crtc_finish_pageflip (ctx->drm_dev, manager->pipe); +drm_handle_vblank (ctx->drm_dev, ctx->pipe); +exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe);/* set wait vsync event to zero and wake up queue. */ if (atomic_read (&ctx->wait_vsync_event)) {@@ -707,39 +737,6 @@ out:return IRQ_HANDLED ; } -static int fimd_subdrv_probe (struct drm_device *drm_dev,struct device *dev) -{ -/* -* enable drm irq mode. -* - with irq_enabled = 1, we can use the vblank feature. -* -* P.S. note that we wouldn't use drm irq handler but -* just specific driver own one instead because -* drm framework supports only one irq handler. -*/ - drm_dev->irq_enabled =1 ; - -/* -* with vblank_disable_allowed = 1, vblank interrupt will be disabled -* by drm timer once a current process gives up ownership of -* vblank event.(after drm_vblank_put function is called) -*/ - drm_dev->vblank_disable_allowed =1 ; - -/* attach this sub driver to iommu mapping if supported. */ -if (is_drm_iommu_supported (drm_dev)) -drm_iommu_attach_device (drm_dev, dev); - -return 0 ; -} - -static void fimd_subdrv_remove (struct drm_device *drm_dev,struct device *dev) -{ -/* detach this sub driver from iommu mapping if supported. */ -if (is_drm_iommu_supported (drm_dev)) -drm_iommu_detach_device (drm_dev, dev); -} -static int fimd_configure_clocks (struct fimd_context *ctx,struct device *dev) {struct videomode *vm = &ctx->panel.vm;@@ -825,9 +822,8 @@ static int fimd_clock(struct fimd_context *ctx, bool enable)return 0 ; } -static void fimd_window_suspend (struct device *dev) +static void fimd_window_suspend (struct fimd_context *ctx) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data;int i;@@ -839,9 +835,8 @@ static void fimd_window_suspend(struct device *dev)fimd_wait_for_vblank (ctx); } -static void fimd_window_resume (struct device *dev) +static void fimd_window_resume (struct fimd_context *ctx) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data;int i;@@ -854,7 +849,6 @@ static void fimd_window_resume(struct device *dev)static int fimd_activate (struct fimd_context *ctx,bool enable) { -struct device *dev = ctx->subdrv.dev;if (enable) {int ret;@@ -866,11 +860,11 @@ static int fimd_activate(struct fimd_context *ctx, bool enable)/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit (0 , &ctx->irq_flags)) -fimd_enable_vblank (dev); +fimd_enable_vblank (ctx); -fimd_window_resume (dev); +fimd_window_resume (ctx); }else { -fimd_window_suspend (dev); +fimd_window_suspend (ctx);fimd_clock (ctx, false); ctx->suspended = true;@@ -907,7 +901,6 @@ static int fimd_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct fimd_context *ctx; -struct exynos_drm_subdrv *subdrv;struct resource *res;int win;int ret = -EINVAL ;@@ -952,15 +945,6 @@ static int fimd_probe(struct platform_device *pdev)DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); - fimd_manager.ctx = ctx; - - subdrv = &ctx->subdrv; - - subdrv->dev = dev; - subdrv->manager = &fimd_manager; - subdrv->probe = fimd_subdrv_probe; - subdrv->remove = fimd_subdrv_remove; -mutex_init (&ctx->lock);platform_set_drvdata (pdev, ctx);@@ -971,7 +955,11 @@ static int fimd_probe(struct platform_device *pdev)for (win =0 ; win <WINDOWS_NR ; win++)fimd_clear_win (ctx, win); -exynos_drm_subdrv_register (subdrv); + fimd_manager.ctx = ctx; +exynos_drm_manager_register (&fimd_manager); + + fimd_display.ctx = ctx; +exynos_drm_display_register (&fimd_display);return 0 ; }@@ -981,7 +969,8 @@ static int fimd_remove(struct platform_device *pdev)struct device *dev = &pdev->dev;struct fimd_context *ctx =platform_get_drvdata (pdev); -exynos_drm_subdrv_unregister (&ctx->subdrv); +exynos_drm_display_unregister (&fimd_display); +exynos_drm_manager_unregister (&fimd_manager);if (ctx->suspended) goto out;
Inki Dae
maintainerRe: [PATCH 12/23] drm/exynos: Split manager/display/subdrv
2013/10/16 Sean Paul <[email protected]>:
Quoted 181 lines · Inki Dae
Quoted 180 lines
2013/10/15 Inki Dae <[email protected]>:
Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +4
-5@@ -26,24 +26,23 @@* exynos specific encoder structure. * * @drm_encoder: encoder object. -* @manager: specific encoder has its own manager to control a hardware -* appropriately and we can access a hardware drawing on this manager. +* @display: the display structure that maps to this encoder */ struct exynos_drm_encoder {struct drm_crtc *old_crtc;struct drm_encoder drm_encoder; -struct exynos_drm_manager *manager; +struct exynos_drm_display *display; };static void exynos_drm_encoder_dpms (struct drm_encoder *encoder,int mode) { -struct exynos_drm_manager *manager =exynos_drm_get_manager (encoder); -struct exynos_drm_display_ops *display_ops = manager->display_ops; +struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); +struct exynos_drm_display *display = exynos_encoder->display;DRM_DEBUG_KMS ("encoder dpms: %d\n" , mode);Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c line 45
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_encoder.c +2
-2-if (display_ops && display_ops->dpms) - display_ops->dpms (manager->ctx, mode); +if (display->ops->dpms) + display->ops->dpms (display->ctx, mode);It's good to remove apply callback. However, it seems that this patch has a problem that dma channel of fimd isn't enabled after dpms goes from off to on. So can you implement
win_enablecallback of fimd, and add it tofimd_win_resumefunction? We should have implementedwin_enablecallback.Plz, ignore the above comments, and see the below comments.
Quoted 115 lines
Quoted 115 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +38
-21@@ -105,7 +105,6 @@ struct fimd_win_data { };struct fimd_context { -struct exynos_drm_subdrv subdrv;struct device *dev;struct drm_device *drm_dev;int irq;@@ -120,6 +119,7 @@ struct fimd_context {u32 vidcon0;u32 vidcon1;bool suspended; +int pipe;struct mutex lock;wait_queue_head_t wait_vsync_queue;atomic_t wait_vsync_event;@@ -169,12 +169,16 @@ static int fimd_check_mode(void *in_ctx, struct drm_display_mode *mode) }static struct exynos_drm_display_ops fimd_display_ops = { - .type =EXYNOS_DISPLAY_TYPE_LCD , .is_connected = fimd_display_is_connected, .get_panel = fimd_get_panel, .check_mode = fimd_check_mode, }; +static struct exynos_drm_display fimd_display = { + .type =EXYNOS_DISPLAY_TYPE_LCD , + .ops = &fimd_display_ops, +}; +static void fimd_win_mode_set (void *in_ctx,struct exynos_drm_overlay *overlay) {struct fimd_context *ctx = in_ctx;@@ -481,15 +485,46 @@ static void fimd_win_disable(void *in_ctx, int zpos) win_data->enabled = false; } -static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev) +static int fimd_mgr_initialize (void *in_ctx,struct drm_device *drm_dev, +int pipe) {struct fimd_context *ctx = in_ctx; ctx->drm_dev = drm_dev; + ctx->pipe = pipe; + +/* +* enable drm irq mode. +* - with irq_enabled = 1, we can use the vblank feature. +* +* P.S. note that we wouldn't use drm irq handler but +* just specific driver own one instead because +* drm framework supports only one irq handler. +*/ + ctx->drm_dev->irq_enabled =1 ; + +/* +* with vblank_disable_allowed = 1, vblank interrupt will be disabled +* by drm timer once a current process gives up ownership of +* vblank event.(after drm_vblank_put function is called) +*/ + drm_dev->vblank_disable_allowed =1 ; + +/* attach this sub driver to iommu mapping if supported. */ +if (is_drm_iommu_supported (ctx->drm_dev)) +drm_iommu_attach_device (ctx->drm_dev, ctx->dev);return 0 ; } +static void fimd_mgr_remove (void *in_ctx) +{ +struct fimd_context *ctx = in_ctx; + +if (is_drm_iommu_supported (ctx->drm_dev)) +drm_iommu_detach_device (ctx->drm_dev, ctx->dev); +} +static void fimd_dpms (void *in_ctx,int mode) {struct fimd_context *ctx = in_ctx;@@ -523,24 +558,6 @@ static void fimd_dpms(void *in_ctx, int mode)mutex_unlock (&ctx->lock); } -static void fimd_apply (void *in_ctx) -{ -struct fimd_context *ctx = in_ctx; -struct exynos_drm_manager *mgr = ctx->subdrv.manager; -struct exynos_drm_manager_ops *mgr_ops = mgr->ops; -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 && (mgr_ops && mgr_ops->win_commit)) - mgr_ops->win_commit (ctx, i); - } - -if (mgr_ops && mgr_ops->commit) - mgr_ops->commit (ctx); -} -static void fimd_commit (void *in_ctx) {struct fimd_context *ctx = in_ctx;@@ -597,6 +614,21 @@ static void fimd_commit(void *in_ctx)writel (val, ctx->regs +VIDCON0 ); }Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_commit(void *in_ctx) · line 626
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +10
-0+static void fimd_apply (void *in_ctx) +{ +struct fimd_context *ctx = in_ctx; +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 (ctx, i);Implement
fimd_win_enablefunction and call it at here,if (win_data->enabled) { fimd_win_commit(ctx,i); fimd_win_enable(ctx, i); <- here }And, the below codes, for enable overlay dma channel, should be removed from
fimd_win_commitfunction,
Quoted 9 lines
Quoted 5 lines
/* wincon */ val = readl(ctx->regs + WINCON(win)); val |= WINCONx_ENWIN; writel(val, ctx->regs + WINCON(win));I'm not sure I follow why you want this done here. It seems unrelated to this patch.
Yes, it's unrelated to this patch. I mean additional work.
Quoted 5 lines
Quoted 3 lines
And, with [PATCH v2] drm/exynos: fimd: clean up pm suspend/resume, it must work well.
Quoted 7 lines
I've got a patch to remove all of the suspend/resume/pm_suspend/pm_resume stuff from all of the individual drivers and do everything through dpms. This will eliminate the error modes where the dpms state in the upper layers get out of sync with the actual state of the hardware. It's also more consistent with other drm drivers. I'll post it after this set.
It seems like more clear if we _can_do_ so. However, can the dpms be called when entering sleep? And I think this way - removing all pm related stuff from device drivers - is not reasonable, and we'd need more discussion about that with pm people. So add the related patch set at top of your re-factoring patch set if you want to do so.
Thanks,
Inki Dae
Quoted 189 lines
Sean
Quoted 177 lines
Quoted 177 lines
Quoted 177 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +21
-60+ } + +fimd_commit (ctx); +} +static int fimd_enable_vblank (void *in_ctx) {struct fimd_context *ctx = in_ctx;@@ -661,6 +693,7 @@ static void fimd_wait_for_vblank(void *in_ctx)static struct exynos_drm_manager_ops fimd_manager_ops = { .initialize = fimd_mgr_initialize, + .remove = fimd_mgr_remove, .dpms = fimd_dpms, .apply = fimd_apply, .commit = fimd_commit,@@ -673,16 +706,13 @@ static struct exynos_drm_manager_ops fimd_manager_ops = { };static struct exynos_drm_manager fimd_manager = { - .pipe =-1 , - .ops = &fimd_manager_ops, - .display_ops = &fimd_display_ops, + .type =EXYNOS_DISPLAY_TYPE_LCD , + .ops = &fimd_manager_ops, };static irqreturn_t fimd_irq_handler (int irq,void *dev_id) {struct fimd_context *ctx = (struct fimd_context *)dev_id; -struct exynos_drm_subdrv *subdrv = &ctx->subdrv; -struct exynos_drm_manager *manager = subdrv->manager;u32 val; val =readl (ctx->regs +VIDINTCON1 );@@ -692,11 +722,11 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)writel (VIDINTCON1_INT_FRAME , ctx->regs +VIDINTCON1 );/* check the crtc is detached already from encoder */ -if (manager->pipe <0 || !ctx->drm_dev) +if (ctx->pipe <0 || !ctx->drm_dev) goto out; -drm_handle_vblank (ctx->drm_dev, manager->pipe); -exynos_drm_crtc_finish_pageflip (ctx->drm_dev, manager->pipe); +drm_handle_vblank (ctx->drm_dev, ctx->pipe); +exynos_drm_crtc_finish_pageflip (ctx->drm_dev, ctx->pipe);/* set wait vsync event to zero and wake up queue. */ if (atomic_read (&ctx->wait_vsync_event)) {@@ -707,39 +737,6 @@ out:return IRQ_HANDLED ; } -static int fimd_subdrv_probe (struct drm_device *drm_dev,struct device *dev) -{ -/* -* enable drm irq mode. -* - with irq_enabled = 1, we can use the vblank feature. -* -* P.S. note that we wouldn't use drm irq handler but -* just specific driver own one instead because -* drm framework supports only one irq handler. -*/ - drm_dev->irq_enabled =1 ; - -/* -* with vblank_disable_allowed = 1, vblank interrupt will be disabled -* by drm timer once a current process gives up ownership of -* vblank event.(after drm_vblank_put function is called) -*/ - drm_dev->vblank_disable_allowed =1 ; - -/* attach this sub driver to iommu mapping if supported. */ -if (is_drm_iommu_supported (drm_dev)) -drm_iommu_attach_device (drm_dev, dev); - -return 0 ; -} - -static void fimd_subdrv_remove (struct drm_device *drm_dev,struct device *dev) -{ -/* detach this sub driver from iommu mapping if supported. */ -if (is_drm_iommu_supported (drm_dev)) -drm_iommu_detach_device (drm_dev, dev); -} -static int fimd_configure_clocks (struct fimd_context *ctx,struct device *dev) {struct videomode *vm = &ctx->panel.vm;@@ -825,9 +822,8 @@ static int fimd_clock(struct fimd_context *ctx, bool enable)return 0 ; } -static void fimd_window_suspend (struct device *dev) +static void fimd_window_suspend (struct fimd_context *ctx) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data;int i;@@ -839,9 +835,8 @@ static void fimd_window_suspend(struct device *dev)fimd_wait_for_vblank (ctx); } -static void fimd_window_resume (struct device *dev) +static void fimd_window_resume (struct fimd_context *ctx) { -struct fimd_context *ctx =get_fimd_context (dev);struct fimd_win_data *win_data;int i;@@ -854,7 +849,6 @@ static void fimd_window_resume(struct device *dev)static int fimd_activate (struct fimd_context *ctx,bool enable) { -struct device *dev = ctx->subdrv.dev;if (enable) {int ret;@@ -866,11 +860,11 @@ static int fimd_activate(struct fimd_context *ctx, bool enable)/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit (0 , &ctx->irq_flags)) -fimd_enable_vblank (dev); +fimd_enable_vblank (ctx); -fimd_window_resume (dev); +fimd_window_resume (ctx); }else { -fimd_window_suspend (dev); +fimd_window_suspend (ctx);fimd_clock (ctx, false); ctx->suspended = true;@@ -907,7 +901,6 @@ static int fimd_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct fimd_context *ctx; -struct exynos_drm_subdrv *subdrv;struct resource *res;int win;int ret = -EINVAL ;@@ -952,15 +945,6 @@ static int fimd_probe(struct platform_device *pdev)DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); - fimd_manager.ctx = ctx; - - subdrv = &ctx->subdrv; - - subdrv->dev = dev; - subdrv->manager = &fimd_manager; - subdrv->probe = fimd_subdrv_probe; - subdrv->remove = fimd_subdrv_remove; -mutex_init (&ctx->lock);platform_set_drvdata (pdev, ctx);@@ -971,7 +955,11 @@ static int fimd_probe(struct platform_device *pdev)for (win =0 ; win <WINDOWS_NR ; win++)fimd_clear_win (ctx, win); -exynos_drm_subdrv_register (subdrv); + fimd_manager.ctx = ctx; +exynos_drm_manager_register (&fimd_manager); + + fimd_display.ctx = ctx; +exynos_drm_display_register (&fimd_display);return 0 ; }@@ -981,7 +969,8 @@ static int fimd_remove(struct platform_device *pdev)struct device *dev = &pdev->dev;struct fimd_context *ctx =platform_get_drvdata (pdev);Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_remove(struct platform_device *pdev) · line 976
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-1-exynos_drm_subdrv_unregister (&ctx->subdrv); +exynos_drm_display_unregister (&fimd_display); +exynos_drm_manager_unregister (&fimd_manager);if (ctx->suspended) goto out;_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 13/23 drm/exynos: hdmi: remove the i2c drivers and use devtree
In reply to Sean PaulFrom: Daniel Kurtz <[email protected]>
The i2c client was previously being passed into the hdmi driver via a dedicated i2c driver, and then a global variable. This patch removes all of that and just uses the device tree to get the i2c_client. This patch also properly references the client so we don't lose it before we're done with it.
--- drivers/gpu/drm/exynos/Makefile | 1 - drivers/gpu/drm/exynos/exynos_ddc.c | 63 -------------------------------- drivers/gpu/drm/exynos/exynos_hdmi.c | 57 +++++++++++++---------------- drivers/gpu/drm/exynos/exynos_hdmi.h | 23 ------------ drivers/gpu/drm/exynos/exynos_hdmiphy.c | 65 --------------------------------- 5 files changed, 25 insertions(+), 184 deletions(-) delete mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c
drivers/gpu/drm/exynos/Makefile +0 -1
@@ -12,7 +12,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o \ - exynos_ddc.o exynos_hdmiphy.o \ exynos_drm_hdmi.o exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o
drivers/gpu/drm/exynos/exynos_ddc.c deleted +0 -63
63 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_hdmi.c +25 -32
105 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_hdmi.h deleted +0 -23
@@ -1,23 +0,0 @@ -/* -* -* Copyright (c) 2011 Samsung Electronics Co., Ltd. -* Authors: -* Inki Dae <[email protected]> -* Seung-Woo Kim <[email protected]> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at your -* option) any later version. -*/ - -#ifndef _EXYNOS_HDMI_H_ -#define _EXYNOS_HDMI_H_ - -void hdmi_attach_ddc_client (struct i2c_client *ddc); -void hdmi_attach_hdmiphy_client (struct i2c_client *hdmiphy); - -extern struct i2c_driver hdmiphy_driver; -extern struct i2c_driver ddc_driver; - -#endif
drivers/gpu/drm/exynos/exynos_hdmiphy.c deleted +0 -65
65 lines not on this page · raw message
Signature · 1 line
1.8.4
PATCH 14/23 drm/exynos: Remove exynos_drm_hdmi shim
In reply to Sean PaulThis patch trims exynos_drm_hdmi out of the driver. The reason it existed in the first place was to make up for the mixture of display/overlay/manager ops being spread across hdmi and mixer. With that code now rationalized, mixer and hdmi map directly to exynos_drm_crtc and exynos_drm_encoder, respectively. Since there is a 1:1 mapping, we no longer need this layer.
--- drivers/gpu/drm/exynos/Makefile | 3 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 13 - drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 433 ------------------------------- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 69 ----- drivers/gpu/drm/exynos/exynos_hdmi.c | 102 +++++--- drivers/gpu/drm/exynos/exynos_mixer.c | 144 +++++----- drivers/gpu/drm/exynos/exynos_mixer.h | 20 ++ 7 files changed, 156 insertions(+), 628 deletions(-) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.c delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.h create mode 100644 drivers/gpu/drm/exynos/exynos_mixer.h
drivers/gpu/drm/exynos/Makefile +1 -2
@@ -11,8 +11,7 @@ exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o exynos_drm_connector.o \ exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o -exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o \ - exynos_drm_hdmi.o +exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -13
@@ -329,13 +329,6 @@ static int __init exynos_drm_init(void) ret =platform_driver_register (&mixer_driver);if (ret <0 ) goto out_mixer; - ret =platform_driver_register (&exynos_drm_common_hdmi_driver); -if (ret <0 ) - goto out_common_hdmi; - - ret =exynos_platform_device_hdmi_register (); -if (ret <0 ) - goto out_common_hdmi_dev;#endif #ifdef CONFIG_DRM_EXYNOS_VIDI
@@ -428,10 +421,6 @@ out_vidi:#endif #ifdef CONFIG_DRM_EXYNOS_HDMI -exynos_platform_device_hdmi_unregister (); -out_common_hdmi_dev: -platform_driver_unregister (&exynos_drm_common_hdmi_driver); -out_common_hdmi:platform_driver_unregister (&mixer_driver); out_mixer:platform_driver_unregister (&hdmi_driver);
@@ -473,8 +462,6 @@ static void __exit exynos_drm_exit(void)#endif #ifdef CONFIG_DRM_EXYNOS_HDMI -exynos_platform_device_hdmi_unregister (); -platform_driver_unregister (&exynos_drm_common_hdmi_driver);platform_driver_unregister (&mixer_driver);platform_driver_unregister (&hdmi_driver);#endif
drivers/gpu/drm/exynos/exynos_drm_hdmi.c deleted +0 -433
433 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_hdmi.h deleted +0 -69
69 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_hdmi.c +69 -33
201 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_mixer.c +66 -78
296 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_mixer.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright (C) 2013 Google, Inc. +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _EXYNOS_MIXER_H_ +#define _EXYNOS_MIXER_H_ + +/* This function returns 0 if the given timing is valid for the mixer */ +int mixer_check_mode (struct drm_display_mode *mode); + +#endif
Signature · 1 line
1.8.4
PATCH 15/23 drm/exynos: Use drm_mode_copy to copy modes
In reply to Sean PaulThis patch changes the manual copying of mode to adjusted_mode in mode_fixup to use drm_mode_copy instead of handling things manually.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -9
@@ -843,21 +843,13 @@ static void hdmi_mode_fixup(void *in_ctx, struct drm_connector *connector, mode_ok =hdmi_check_mode (in_ctx, m);if (mode_ok ==0 ) { -struct drm_mode_object base; -struct list_head head; -DRM_INFO ("desired mode doesn't exist so\n" );DRM_INFO ("use the most suitable mode among modes.\n" );DRM_DEBUG_KMS ("Adjusted Mode: [%d]x[%d] [%d]Hz\n" , m->hdisplay, m->vdisplay, m->vrefresh); -/* preserve display mode header while copying. */ - head = adjusted_mode->head; - base = adjusted_mode->base; -memcpy (adjusted_mode, m,sizeof (*m)); - adjusted_mode->head = head; - adjusted_mode->base = base; +drm_mode_copy (adjusted_mode, m);break ; } }
Signature · 1 line
1.8.4
PATCH 16/23 drm/exynos: Disable unused crtc planes from crtc
In reply to Sean PaulThis patch moves the code which disables unused crtc planes from the encoder to the crtc. Since there is a 1:1 encoder/crtc mapping in exynos, the only valid crtc change the pre-existing code could catch is disconnecting an active crtc from the encoder. Thus it is functionally equivalent to just disable all planes attached to a crtc when the crtc is disabled.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 13 +++++- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 65 ++--------------------------- 2 files changed, 15 insertions(+), 63 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +11 -2
@@ -176,10 +176,19 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,static void exynos_drm_crtc_disable (struct drm_crtc *crtc) { -struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct drm_plane *plane; +int ret; -exynos_plane_dpms (exynos_crtc->plane,DRM_MODE_DPMS_OFF );exynos_drm_crtc_dpms (crtc,DRM_MODE_DPMS_OFF ); + +list_for_each_entry (plane, &crtc->dev->mode_config.plane_list, head) { +if (plane->crtc != crtc) +continue ; + + ret = plane->funcs->disable_plane (plane); +if (ret) +DRM_ERROR ("Failed to disable plane %d\n" , ret); + } }static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
drivers/gpu/drm/exynos/exynos_drm_encoder.c +4 -61
82 lines not on this page · raw message
Signature · 1 line
1.8.4
PATCH 17/23 drm/exynos: Add mode_set manager operation
In reply to Sean PaulThis patch adds a mode_set callback to the manager operations which sets the crtc's current mode to the manager driver.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 ++ 2 files changed, 6 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +4 -0
@@ -115,6 +115,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_framebuffer *old_fb) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct exynos_drm_manager *manager = exynos_crtc->manager;struct drm_plane *plane = exynos_crtc->plane;unsigned int crtc_w;unsigned int crtc_h;
@@ -129,6 +130,9 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, crtc_w = crtc->fb->width - x; crtc_h = crtc->fb->height - y; +if (manager->ops->mode_set) + manager->ops->mode_set (manager->ctx, &crtc->mode); + ret =exynos_plane_mode_set (plane, crtc, crtc->fb,0 ,0 , crtc_w, crtc_h, x, y, crtc_w, crtc_h);if (ret)
drivers/gpu/drm/exynos/exynos_drm_drv.h +2 -0
@@ -178,6 +178,7 @@ struct exynos_drm_display {* @remove: cleans up the manager for removal * @dpms: control device power. * @apply: set timing, vblank and overlay data to registers. +* @mode_set: set the given mode to the manager * @commit: set current hw specific display mode to hw. * @enable_vblank: specific driver callback for enabling vblank interrupt. * @disable_vblank: specific driver callback for disabling vblank interrupt.
@@ -193,6 +194,7 @@ struct exynos_drm_manager_ops {void (*remove)(void *ctx);void (*dpms)(void *ctx,int mode);void (*apply)(void *ctx); +void (*mode_set)(void *ctx,const struct drm_display_mode *mode);void (*commit)(void *ctx);int (*enable_vblank)(void *ctx);void (*disable_vblank)(void *ctx);
Signature · 1 line
1.8.4
PATCH 18/23 drm/exynos: Implement mode_fixup manager operation
In reply to Sean PaulThis patch adds a new manager callback for mode_fixup and pipes it through exynos_drm_crtc.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 +++++++- drivers/gpu/drm/exynos/exynos_drm_drv.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +7 -1
@@ -105,7 +105,13 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { -/* drm framework doesn't check NULL */ + struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); +struct exynos_drm_manager *manager = exynos_crtc->manager; + +if (manager->ops->mode_fixup) +return manager->ops->mode_fixup (manager->ctx, mode, + adjusted_mode); +return true; }
drivers/gpu/drm/exynos/exynos_drm_drv.h +3 -0
@@ -178,6 +178,7 @@ struct exynos_drm_display {* @remove: cleans up the manager for removal * @dpms: control device power. * @apply: set timing, vblank and overlay data to registers. +* @mode_fixup: fix mode data before applying it * @mode_set: set the given mode to the manager * @commit: set current hw specific display mode to hw. * @enable_vblank: specific driver callback for enabling vblank interrupt.
@@ -194,6 +195,8 @@ struct exynos_drm_manager_ops {void (*remove)(void *ctx);void (*dpms)(void *ctx,int mode);void (*apply)(void *ctx); +bool (*mode_fixup)(void *ctx,const struct drm_display_mode *mode, +struct drm_display_mode *adjusted_mode);void (*mode_set)(void *ctx,const struct drm_display_mode *mode);void (*commit)(void *ctx);int (*enable_vblank)(void *ctx);
Signature · 1 line
1.8.4
PATCH 19/23 drm/exynos: Use mode_set to configure fimd
In reply to Sean PaulThis patch uses the mode passed into mode_set to configure fimd instead of directly using the panel from context. This will allow us to move the exynos_drm_display implementation from fimd into the DP driver where it belongs.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 157 ++++++++++++++++++------------- 1 file changed, 89 insertions(+), 68 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +89 -68
@@ -104,6 +104,20 @@ struct fimd_win_data {bool resume; }; +struct fimd_mode_data { +unsigned vtotal; +unsigned vdisplay; +unsigned vsync_len; +unsigned vbpd; +unsigned vfpd; +unsigned htotal; +unsigned hdisplay; +unsigned hsync_len; +unsigned hbpd; +unsigned hfpd; +u32 clkdiv; +}; +struct fimd_context {struct device *dev;struct drm_device *drm_dev;
@@ -112,8 +126,8 @@ struct fimd_context {struct clk *bus_clk;struct clk *lcd_clk;void __iomem *regs; +struct fimd_mode_data mode;struct fimd_win_data win_data[WINDOWS_NR ]; -unsigned int clkdiv;unsigned int default_win;unsigned long irq_flags;u32 vidcon0;
@@ -558,11 +572,54 @@ static void fimd_dpms(void *in_ctx, int mode)mutex_unlock (&ctx->lock); } +static u32 fimd_calc_clkdiv (struct fimd_context *ctx, +const struct drm_display_mode *mode) +{ +unsigned long ideal_clk = mode->htotal * mode->vtotal * mode->vrefresh; +u32 clkdiv; + +/* Find the clock divider value that gets us closest to ideal_clk */ + clkdiv =DIV_ROUND_CLOSEST (clk_get_rate (ctx->lcd_clk), ideal_clk); + +return (clkdiv <0x100 ) ? clkdiv :0xff ; +} + +static bool fimd_mode_fixup (void *in_ctx,const struct drm_display_mode *mode, +struct drm_display_mode *adjusted_mode) +{ +if (adjusted_mode->vrefresh ==0 ) + adjusted_mode->vrefresh =FIMD_DEFAULT_FRAMERATE ; + +return true; +} + +static void fimd_mode_set (void *in_ctx,const struct drm_display_mode *in_mode) +{ +struct fimd_context *ctx = in_ctx; +struct fimd_mode_data *mode = &ctx->mode; +int hblank, vblank; + + vblank = in_mode->crtc_vblank_end - in_mode->crtc_vblank_start; + mode->vtotal = in_mode->crtc_vtotal; + mode->vdisplay = in_mode->crtc_vdisplay; + mode->vsync_len = in_mode->crtc_vsync_end - in_mode->crtc_vsync_start; + mode->vbpd = (vblank - mode->vsync_len) /2 ; + mode->vfpd = vblank - mode->vsync_len - mode->vbpd; + + hblank = in_mode->crtc_hblank_end - in_mode->crtc_hblank_start; + mode->htotal = in_mode->crtc_htotal; + mode->hdisplay = in_mode->crtc_hdisplay; + mode->hsync_len = in_mode->crtc_hsync_end - in_mode->crtc_hsync_start; + mode->hbpd = (hblank - mode->hsync_len) /2 ; + mode->hfpd = hblank - mode->hsync_len - mode->hbpd; + + mode->clkdiv =fimd_calc_clkdiv (ctx, in_mode); +} +static void fimd_commit (void *in_ctx) {struct fimd_context *ctx = in_ctx; -struct exynos_drm_panel_info *panel = &ctx->panel; -struct videomode *vm = &panel->vm; +struct fimd_mode_data *mode = &ctx->mode;struct fimd_driver_data *driver_data;u32 val;
@@ -570,26 +627,30 @@ static void fimd_commit(void *in_ctx)if (ctx->suspended)return ; +/* nothing to do if we haven't set the mode yet */ +if (mode->htotal ==0 || mode->vtotal ==0 ) +return ; +/* setup polarity values from machine code. */ writel (ctx->vidcon1, ctx->regs + driver_data->timing_base +VIDCON1 );/* setup vertical timing values. */ - val =VIDTCON0_VBPD (vm->vback_porch -1 ) | -VIDTCON0_VFPD (vm->vfront_porch -1 ) | -VIDTCON0_VSPW (vm->vsync_len -1 ); + val =VIDTCON0_VBPD (mode->vbpd -1 ) | +VIDTCON0_VFPD (mode->vfpd -1 ) | +VIDTCON0_VSPW (mode->vsync_len -1 );writel (val, ctx->regs + driver_data->timing_base +VIDTCON0 );/* setup horizontal timing values. */ - val =VIDTCON1_HBPD (vm->hback_porch -1 ) | -VIDTCON1_HFPD (vm->hfront_porch -1 ) | -VIDTCON1_HSPW (vm->hsync_len -1 ); + val =VIDTCON1_HBPD (mode->hbpd -1 ) | +VIDTCON1_HFPD (mode->hfpd -1 ) | +VIDTCON1_HSPW (mode->hsync_len -1 );writel (val, ctx->regs + driver_data->timing_base +VIDTCON1 );/* setup horizontal and vertical display size. */ - val =VIDTCON2_LINEVAL (vm->vactive -1 ) | -VIDTCON2_HOZVAL (vm->hactive -1 ) | -VIDTCON2_LINEVAL_E (vm->vactive -1 ) | -VIDTCON2_HOZVAL_E (vm->hactive -1 ); + val =VIDTCON2_LINEVAL (mode->vdisplay -1 ) | +VIDTCON2_HOZVAL (mode->hdisplay -1 ) | +VIDTCON2_LINEVAL_E (mode->vdisplay -1 ) | +VIDTCON2_HOZVAL_E (mode->hdisplay -1 );writel (val, ctx->regs + driver_data->timing_base +VIDTCON2 );/* setup clock source, clock divider, enable dma. */
@@ -601,8 +662,8 @@ static void fimd_commit(void *in_ctx) val |=VIDCON0_CLKSEL_LCD ; } -if (ctx->clkdiv >1 ) - val |=VIDCON0_CLKVAL_F (ctx->clkdiv -1 ) |VIDCON0_CLKDIR ; +if (mode->clkdiv >1 ) + val |=VIDCON0_CLKVAL_F (mode->clkdiv -1 ) |VIDCON0_CLKDIR ;else val &= ~VIDCON0_CLKDIR ;/* 1:1 clock */
@@ -696,6 +757,8 @@ static struct exynos_drm_manager_ops fimd_manager_ops = { .remove = fimd_mgr_remove, .dpms = fimd_dpms, .apply = fimd_apply, + .mode_fixup = fimd_mode_fixup, + .mode_set = fimd_mode_set, .commit = fimd_commit, .enable_vblank = fimd_enable_vblank, .disable_vblank = fimd_disable_vblank,
@@ -737,56 +800,6 @@ out:return IRQ_HANDLED ; } -static int fimd_configure_clocks (struct fimd_context *ctx,struct device *dev) -{ -struct videomode *vm = &ctx->panel.vm; -unsigned long clk; - - ctx->bus_clk =devm_clk_get (dev,"fimd" ); -if (IS_ERR (ctx->bus_clk)) { -dev_err (dev,"failed to get bus clock\n" ); -return PTR_ERR (ctx->bus_clk); - } - - ctx->lcd_clk =devm_clk_get (dev,"sclk_fimd" ); -if (IS_ERR (ctx->lcd_clk)) { -dev_err (dev,"failed to get lcd clock\n" ); -return PTR_ERR (ctx->lcd_clk); - } - - clk =clk_get_rate (ctx->lcd_clk); -if (clk ==0 ) { -dev_err (dev,"error getting sclk_fimd clock rate\n" ); -return -EINVAL ; - } - -if (vm->pixelclock ==0 ) { -unsigned long c; - c = vm->hactive + vm->hback_porch + vm->hfront_porch + - vm->hsync_len; - c *= vm->vactive + vm->vback_porch + vm->vfront_porch + - vm->vsync_len; - vm->pixelclock = c *FIMD_DEFAULT_FRAMERATE ; -if (vm->pixelclock ==0 ) { -dev_err (dev,"incorrect display timings\n" ); -return -EINVAL ; - } -dev_warn (dev,"pixel clock recalculated to %luHz (%dHz frame rate)\n" , - vm->pixelclock,FIMD_DEFAULT_FRAMERATE ); - } - ctx->clkdiv =DIV_ROUND_UP (clk, vm->pixelclock); -if (ctx->clkdiv >256 ) { -dev_warn (dev,"calculated pixel clock divider too high (%u), lowered to 256\n" , - ctx->clkdiv); - ctx->clkdiv =256 ; - } - vm->pixelclock = clk / ctx->clkdiv; -DRM_DEBUG_KMS ("pixel clock = %lu, clkdiv = %d\n" , vm->pixelclock, - ctx->clkdiv); - -return 0 ; -} -static void fimd_clear_win (struct fimd_context *ctx,int win) {writel (0 , ctx->regs +WINCON (win));
@@ -916,9 +929,17 @@ static int fimd_probe(struct platform_device *pdev)if (ret)return ret; - ret =fimd_configure_clocks (ctx, dev); -if (ret) -return ret; + ctx->bus_clk =devm_clk_get (dev,"fimd" ); +if (IS_ERR (ctx->bus_clk)) { +dev_err (dev,"failed to get bus clock\n" ); +return PTR_ERR (ctx->bus_clk); + } + + ctx->lcd_clk =devm_clk_get (dev,"sclk_fimd" ); +if (IS_ERR (ctx->lcd_clk)) { +dev_err (dev,"failed to get lcd clock\n" ); +return PTR_ERR (ctx->lcd_clk); + } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
Signature · 1 line
1.8.4
PATCH 20/23 drm/exynos: Remove unused/useless fimd_context members
In reply to Sean PaulThis patch removes a few fimd_context members which are either entirely unused or unneeded.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -12
@@ -121,8 +121,6 @@ struct fimd_mode_data {struct fimd_context {struct device *dev;struct drm_device *drm_dev; -int irq; -struct drm_crtc *crtc;struct clk *bus_clk;struct clk *lcd_clk;void __iomem *regs;
@@ -134,7 +132,6 @@ struct fimd_context {u32 vidcon1;bool suspended;int pipe; -struct mutex lock;wait_queue_head_t wait_vsync_queue;atomic_t wait_vsync_event;
@@ -545,8 +542,6 @@ static void fimd_dpms(void *in_ctx, int mode)DRM_DEBUG_KMS ("%d\n" , mode); -mutex_lock (&ctx->lock); -switch (mode) {case DRM_MODE_DPMS_ON :/*
@@ -568,8 +563,6 @@ static void fimd_dpms(void *in_ctx, int mode)DRM_DEBUG_KMS ("unspecified mode %d\n" , mode);break ; } - -mutex_unlock (&ctx->lock); } static u32 fimd_calc_clkdiv(struct fimd_context *ctx,
@@ -953,9 +946,7 @@ static int fimd_probe(struct platform_device *pdev)return -ENXIO ; } - ctx->irq = res->start; - - ret =devm_request_irq (dev, ctx->irq, fimd_irq_handler, + ret =devm_request_irq (dev, res->start, fimd_irq_handler,0 ,"drm_fimd" , ctx);if (ret) {dev_err (dev,"irq request failed.\n" );
@@ -966,8 +957,6 @@ static int fimd_probe(struct platform_device *pdev)DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); -mutex_init (&ctx->lock); -platform_set_drvdata (pdev, ctx);pm_runtime_enable (dev);
Signature · 1 line
1.8.4
PATCH 21/23 drm/exynos: Move dp driver from video/ to drm/
In reply to Sean PaulThis patch moves the code from video/ to drm/
--- drivers/gpu/drm/exynos/Kconfig | 7 + drivers/gpu/drm/exynos/Makefile | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 1213 ++++++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_dp_core.h | 210 ++++++ drivers/gpu/drm/exynos/exynos_dp_reg.c | 1245 +++++++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_dp_reg.h | 366 +++++++++ drivers/video/exynos/Kconfig | 7 - drivers/video/exynos/Makefile | 1 - drivers/video/exynos/exynos_dp_core.c | 1213 ------------------------------ drivers/video/exynos/exynos_dp_core.h | 210 ------ drivers/video/exynos/exynos_dp_reg.c | 1245 ------------------------------- drivers/video/exynos/exynos_dp_reg.h | 366 --------- 12 files changed, 3042 insertions(+), 3042 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.c create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.h create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.c create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.h delete mode 100644 drivers/video/exynos/exynos_dp_core.c delete mode 100644 drivers/video/exynos/exynos_dp_core.h delete mode 100644 drivers/video/exynos/exynos_dp_reg.c delete mode 100644 drivers/video/exynos/exynos_dp_reg.h
drivers/gpu/drm/exynos/Kconfig +7 -0
@@ -30,6 +30,13 @@ config DRM_EXYNOS_FIMD help Choose this option if you want to use Exynos FIMD for DRM. +config DRM_EXYNOS_DP + bool "EXYNOS DRM DP driver support" + depends on ARCH_EXYNOS + default n + help + This enables support for DP device. + config DRM_EXYNOS_HDMI bool "Exynos DRM HDMI" depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_TV
drivers/gpu/drm/exynos/Makefile +1 -0
@@ -11,6 +11,7 @@ exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o exynos_drm_connector.o \ exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o +exynosdrm-$(CONFIG_DRM_EXYNOS_DP) += exynos_dp_core.o exynos_dp_reg.o exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o
drivers/gpu/drm/exynos/exynos_dp_core.c new file +1213 -0
1,213 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_dp_core.h new file +210 -0
210 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_dp_reg.c new file +1245 -0
1,245 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_dp_reg.h new file +366 -0
312 lines not on this page · raw message
drivers/video/exynos/exynos_dp_core.c deleted +0 -1213
1,213 lines not on this page · raw message
drivers/video/exynos/exynos_dp_core.h deleted +0 -210
210 lines not on this page · raw message
drivers/video/exynos/exynos_dp_reg.c deleted +0 -1245
1,245 lines not on this page · raw message
drivers/video/exynos/exynos_dp_reg.h deleted +0 -366
366 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.4
Part of the diff is not shown here. View the raw message.
PATCH 22/23 drm/exynos: Move display implementation into dp
In reply to Sean PaulThis patch moves the exynos_drm_display implementation from fimd into the dp driver. This will allow for tighter integration of the dp driver into the exynos drm driver.
--- .../devicetree/bindings/video/exynos_dp.txt | 17 +++ .../devicetree/bindings/video/samsung-fimd.txt | 2 + drivers/gpu/drm/exynos/exynos_dp_core.c | 136 +++++++++++++++------ drivers/gpu/drm/exynos/exynos_dp_core.h | 5 + drivers/gpu/drm/exynos/exynos_drm_drv.c | 14 +++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + drivers/gpu/drm/exynos/exynos_drm_fimd.c | 77 +++--------- 7 files changed, 155 insertions(+), 97 deletions(-)
Documentation/devicetree/bindings/video/exynos_dp.txt +17 -0
@@ -45,6 +45,8 @@ Required properties for dp-controller: -samsung,lane-count: number of lanes supported by the panel. LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4 + - display-timings: timings for the connected panel as described by + Documentation/devicetree/bindings/video/display-timing.txt Optional properties for dp-controller: -interlaced:
@@ -83,4 +85,19 @@ Board Specific portion: samsung,color-depth = <1>; samsung,link-rate = <0x0a>; samsung,lane-count = <4>; + + display-timings { + native-mode = <&lcd_timing>; + lcd_timing: 1366x768 { + clock-frequency = <70589280>; + hactive = <1366>; + vactive = <768>; + hfront-porch = <40>; + hback-porch = <40>; + hsync-len = <32>; + vback-porch = <10>; + vfront-porch = <12>; + vsync-len = <6>; + }; + }; };
Documentation/devicetree/bindings/video/samsung-fimd.txt +2 -0
@@ -39,6 +39,8 @@ Required properties: Optional Properties: - samsung,power-domain: a phandle to FIMD power domain node. +- samsung,invert-vden: video enable signal is inverted +- samsung,invert_vclk: video clock signal is inverted Example:
drivers/gpu/drm/exynos/exynos_dp_core.c +102 -34
213 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_dp_core.h +5 -0
@@ -13,6 +13,9 @@#ifndef _EXYNOS_DP_CORE_H#define _EXYNOS_DP_CORE_H +#include <drm/exynos_drm.h> +#include <video/exynos_dp.h> +enum dp_irq_type {DP_IRQ_TYPE_HP_CABLE_IN , DP_IRQ_TYPE_HP_CABLE_OUT,
@@ -42,6 +45,8 @@ struct exynos_dp_device {struct video_info *video_info;struct link_train link_train;struct work_struct hotplug_work; + +struct exynos_drm_panel_info panel; };/* exynos_dp_reg.c */
drivers/gpu/drm/exynos/exynos_drm_drv.c +14 -0
@@ -316,6 +316,12 @@ static int __init exynos_drm_init(void) {int ret; +#ifdef CONFIG_DRM_EXYNOS_DP + ret =platform_driver_register (&dp_driver); +if (ret <0 ) + goto out_dp; +#endif +#ifdef CONFIG_DRM_EXYNOS_FIMD ret =platform_driver_register (&fimd_driver);if (ret <0 )
@@ -431,6 +437,10 @@ out_hdmi:platform_driver_unregister (&fimd_driver); out_fimd:#endif +#ifdef CONFIG_DRM_EXYNOS_DP +platform_driver_unregister (&dp_driver); +out_dp: +#endif return ret; }
@@ -473,6 +483,10 @@ static void __exit exynos_drm_exit(void)#ifdef CONFIG_DRM_EXYNOS_FIMD platform_driver_unregister (&fimd_driver);#endif + +#ifdef CONFIG_DRM_EXYNOS_DP +platform_driver_unregister (&dp_driver); +#endif }module_init (exynos_drm_init);
drivers/gpu/drm/exynos/exynos_drm_drv.h +1 -0
@@ -359,6 +359,7 @@ int exynos_platform_device_ipp_register(void);*/ void exynos_platform_device_ipp_unregister (void ); +extern struct platform_driver dp_driver;extern struct platform_driver fimd_driver;extern struct platform_driver hdmi_driver;extern struct platform_driver mixer_driver;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +14 -63
113 lines not on this page · raw message
Signature · 1 line
1.8.4
PATCH 23/23 ARM: dts: Move display-timings node from fimd to dp
In reply to Sean PaulThis patch moves the display-timings node from fimd to dp to reflect the device tree bindings change.
--- arch/arm/boot/dts/exynos5250-arndale.dts | 7 ++++--- arch/arm/boot/dts/exynos5250-smdk5250.dts | 7 ++++--- arch/arm/boot/dts/exynos5250-snow.dts | 7 ++++--- arch/arm/boot/dts/exynos5420-smdk5420.dts | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-)
arch/arm/boot/dts/exynos5250-arndale.dts +4 -3
@@ -517,10 +517,7 @@ samsung,link-rate = <0x0a>; samsung,lane-count = <4>; status = "okay"; - }; - fimd: fimd@14400000 { - status = "okay"; display-timings { native-mode = <&timing0>; timing0: timing@0 {
@@ -538,6 +535,10 @@ }; }; + fimd: fimd@14400000 { + status = "okay"; + }; + usb_hub_bus { compatible = "simple-bus"; #address-cells = <1>;
arch/arm/boot/dts/exynos5250-smdk5250.dts +4 -3
@@ -261,10 +261,7 @@ pinctrl-names = "default"; pinctrl-0 = <&dp_hpd>; status = "okay"; - }; - fimd@14400000 { - status = "okay"; display-timings { native-mode = <&timing0>; timing0: timing@0 {
@@ -282,6 +279,10 @@ }; }; + fimd@14400000 { + status = "okay"; + }; + fixed-rate-clocks { xxti { compatible = "samsung,clock-xxti";
arch/arm/boot/dts/exynos5250-snow.dts +4 -3
@@ -216,10 +216,7 @@ pinctrl-names = "default"; pinctrl-0 = <&dp_hpd>; status = "okay"; - }; - fimd: fimd@14400000 { - status = "okay"; display-timings { native-mode = <&lcd_timing>; lcd_timing: 1366x768 {
@@ -236,6 +233,10 @@ }; }; + fimd: fimd@14400000 { + status = "okay"; + }; + fixed-rate-clocks { xxti { compatible = "samsung,clock-xxti";
arch/arm/boot/dts/exynos5420-smdk5420.dts +4 -3
@@ -41,10 +41,7 @@ samsung,link-rate = <0x0a>; samsung,lane-count = <4>; status = "okay"; - }; - fimd@14400000 { - status = "okay"; display-timings { native-mode = <&timing0>; timing0: timing@0 {
@@ -61,4 +58,8 @@ }; }; + fimd@14400000 { + status = "okay"; + }; + };
Signature · 1 line
1.8.4
Hi Sean,
Quoted 5 lines · On Thursday 10 of October 2013 20:30:13 Sean Paul wrote:
This patchset refactors parts of the exynos driver to move it closer to a proper drm driver (rather than just implementing a drm layer on top of the hardware drivers). The hope is to get to a point where the dp/hdmi drivers can implement drm_connector/drm_encoder directly, and fimd/mixer can directly implement
drm_crtc.
This looks like a really great series. I did not have time yet to do a thorough review, but at first glance it looks fine. Let me try to take a deeper look into this next week.
Best regards,
Tomasz