From 04427ec57480d83f98d8a8a326b831dfa474f297 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Mon, 2 Feb 2015 14:20:28 +0100 Subject: drm/exynos: add support for 'hdmi' clock Mixed need to have hdmi clock enabled to properly perform power on/off sequences, so add handling of this clock directly to the mixer driver. Dependency between hdmi clock and mixer module has been observed on Exynos4 based boards. Suggested-by: Andrzej Hajda Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas Signed-off-by: Marek Szyprowski Signed-off-by: Inki Dae diff --git a/Documentation/devicetree/bindings/video/exynos_mixer.txt b/Documentation/devicetree/bindings/video/exynos_mixer.txt index 08b394b..3e38128 100644 --- a/Documentation/devicetree/bindings/video/exynos_mixer.txt +++ b/Documentation/devicetree/bindings/video/exynos_mixer.txt @@ -15,6 +15,7 @@ Required properties: a) mixer: Gate of Mixer IP bus clock. b) sclk_hdmi: HDMI Special clock, one of the two possible inputs of mixer mux. + c) hdmi: Gate of HDMI IP bus clock, needed together with sclk_hdmi. Example: diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index ed44cd4..1c65a31 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -72,6 +72,7 @@ struct mixer_resources { spinlock_t reg_slock; struct clk *mixer; struct clk *vp; + struct clk *hdmi; struct clk *sclk_mixer; struct clk *sclk_hdmi; struct clk *mout_mixer; @@ -769,6 +770,12 @@ static int mixer_resources_init(struct mixer_context *mixer_ctx) return -ENODEV; } + mixer_res->hdmi = devm_clk_get(dev, "hdmi"); + if (IS_ERR(mixer_res->hdmi)) { + dev_err(dev, "failed to get clock 'hdmi'\n"); + return PTR_ERR(mixer_res->hdmi); + } + mixer_res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi"); if (IS_ERR(mixer_res->sclk_hdmi)) { dev_err(dev, "failed to get clock 'sclk_hdmi'\n"); @@ -1092,6 +1099,7 @@ static void mixer_poweron(struct exynos_drm_crtc *crtc) pm_runtime_get_sync(ctx->dev); clk_prepare_enable(res->mixer); + clk_prepare_enable(res->hdmi); if (ctx->vp_enabled) { clk_prepare_enable(res->vp); if (ctx->has_sclk) @@ -1131,6 +1139,7 @@ static void mixer_poweroff(struct exynos_drm_crtc *crtc) ctx->powered = false; mutex_unlock(&ctx->mixer_mutex); + clk_disable_unprepare(res->hdmi); clk_disable_unprepare(res->mixer); if (ctx->vp_enabled) { clk_disable_unprepare(res->vp); -- cgit v0.10.2 From 8dcc14f82f06fce997e35f4c77ced9d4ed192f31 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Tue, 20 Jan 2015 15:31:14 +0100 Subject: drm/exynos: IOMMU support should not be selectable by user If system provides IOMMU feature, Exynos DRM should use it by default, because the Exynos DRM subdrivers don't work correctly when Exynos IOMMU driver has been enabled and no IOMMU support has been compiled into Exynos DRM driver. Signed-off-by: Marek Szyprowski Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index c072999..7cf0b46 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -12,10 +12,9 @@ config DRM_EXYNOS If M is selected the module will be called exynosdrm. config DRM_EXYNOS_IOMMU - bool "EXYNOS DRM IOMMU Support" + bool depends on DRM_EXYNOS && EXYNOS_IOMMU && ARM_DMA_USE_IOMMU - help - Choose this option if you want to use IOMMU feature for DRM. + default y config DRM_EXYNOS_DMABUF bool "EXYNOS DRM DMABUF" -- cgit v0.10.2 From b74ea6a97e82b8230309a95c1266ce4b97254d54 Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Wed, 4 Feb 2015 14:19:33 +0900 Subject: drm/exynos: remove DRM_EXYNOS_DMABUF config The exynos drm driver has DRIVER_PRIME capability, then it's reasonable to support dmabuf as default. Remove DRM_EXYNOS_DMABUF config, it will prevent that user selects the option unnecessarily. Signed-off-by: Joonyoung Shim Reviewed-by: Gustavo Padovan Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 7cf0b46..627aaa0 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -16,12 +16,6 @@ config DRM_EXYNOS_IOMMU depends on DRM_EXYNOS && EXYNOS_IOMMU && ARM_DMA_USE_IOMMU default y -config DRM_EXYNOS_DMABUF - bool "EXYNOS DRM DMABUF" - depends on DRM_EXYNOS - help - Choose this option if you want to use DMABUF feature for DRM. - config DRM_EXYNOS_FIMD bool "Exynos DRM FIMD" depends on DRM_EXYNOS && !FB_S3C diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index 33ae365..0856891 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile @@ -6,10 +6,9 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \ exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \ exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \ - exynos_drm_plane.o + exynos_drm_plane.o exynos_drm_dmabuf.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_DPI) += exynos_drm_dpi.o exynosdrm-$(CONFIG_DRM_EXYNOS_DSI) += exynos_drm_dsi.o diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h index 49acfaf..886de9f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h @@ -12,14 +12,9 @@ #ifndef _EXYNOS_DRM_DMABUF_H_ #define _EXYNOS_DRM_DMABUF_H_ -#ifdef CONFIG_DRM_EXYNOS_DMABUF struct dma_buf *exynos_dmabuf_prime_export(struct drm_device *drm_dev, struct drm_gem_object *obj, int flags); struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, struct dma_buf *dma_buf); -#else -#define exynos_dmabuf_prime_export NULL -#define exynos_dmabuf_prime_import NULL -#endif #endif -- cgit v0.10.2 From 9865df4d76bc674e7922c8bb279beb8435b8e888 Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Tue, 27 Jan 2015 20:40:45 +0900 Subject: drm/exynos: remove to use unnecessary MODULE_xxx macro The exynos_drm_dmabuf.c file doesn't include any module feature and it isn't built to module. Signed-off-by: Joonyoung Shim Reviewed-by: Gustavo Padovan Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c index 60192ed..3833bf8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c @@ -279,7 +279,3 @@ err_buf_detach: return ERR_PTR(ret); } - -MODULE_AUTHOR("Inki Dae "); -MODULE_DESCRIPTION("Samsung SoC DRM DMABUF Module"); -MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 0f04cf8df0b20a97369cb634663fef0578cbf273 Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Fri, 30 Jan 2015 16:43:01 +0900 Subject: drm/exynos: fix wrong pipe calculation for crtc We get wrong pipe value for crtc since commit 93bca243ec96 ("drm/exynos: remove struct exynos_drm_manager"). We should should increase pipe value before call exynos_drm_crtc_create. Signed-off-by: Joonyoung Shim Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 682806e..39f7fa7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -1065,18 +1065,19 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) struct drm_device *drm_dev = data; int ret; - ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe, - EXYNOS_DISPLAY_TYPE_LCD, - &fimd_crtc_ops, ctx); - if (IS_ERR(ctx->crtc)) - return PTR_ERR(ctx->crtc); - ret = fimd_ctx_initialize(ctx, drm_dev); if (ret) { DRM_ERROR("fimd_ctx_initialize failed.\n"); return ret; } + ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe, + EXYNOS_DISPLAY_TYPE_LCD, + &fimd_crtc_ops, ctx); + if (IS_ERR(ctx->crtc)) { + fimd_ctx_remove(ctx); + return PTR_ERR(ctx->crtc); + } if (ctx->display) exynos_drm_create_enc_conn(drm_dev, ctx->display); diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 9c8300e..fb68d3c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -548,6 +548,8 @@ static int vidi_bind(struct device *dev, struct device *master, void *data) struct drm_device *drm_dev = data; int ret; + vidi_ctx_initialize(ctx, drm_dev); + ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe, EXYNOS_DISPLAY_TYPE_VIDI, &vidi_crtc_ops, ctx); @@ -556,8 +558,6 @@ static int vidi_bind(struct device *dev, struct device *master, void *data) return PTR_ERR(ctx->crtc); } - vidi_ctx_initialize(ctx, drm_dev); - ret = exynos_drm_create_enc_conn(drm_dev, &ctx->display); if (ret) { ctx->crtc->base.funcs->destroy(&ctx->crtc->base); -- cgit v0.10.2 From 92dc7a047b02be447a51baa93deb0c0f694241a5 Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Fri, 30 Jan 2015 16:43:02 +0900 Subject: drm/exynos: use driver internal struct Use driver internal struct as argument instead of struct exynos_drm_crtc except functions of exynos_drm_crtc_ops and instead of struct exynos_drm_display except functions of exynos_drm_display_ops. It can reduce unnecessary variable declaration. Signed-off-by: Joonyoung Shim Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 46f1497..bf17a60 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -1058,10 +1058,8 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp) phy_power_off(dp->phy); } -static void exynos_dp_poweron(struct exynos_drm_display *display) +static void exynos_dp_poweron(struct exynos_dp_device *dp) { - struct exynos_dp_device *dp = display_to_dp(display); - if (dp->dpms_mode == DRM_MODE_DPMS_ON) return; @@ -1076,13 +1074,11 @@ static void exynos_dp_poweron(struct exynos_drm_display *display) exynos_dp_phy_init(dp); exynos_dp_init_dp(dp); enable_irq(dp->irq); - exynos_dp_commit(display); + exynos_dp_commit(&dp->display); } -static void exynos_dp_poweroff(struct exynos_drm_display *display) +static void exynos_dp_poweroff(struct exynos_dp_device *dp) { - struct exynos_dp_device *dp = display_to_dp(display); - if (dp->dpms_mode != DRM_MODE_DPMS_ON) return; @@ -1110,12 +1106,12 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) switch (mode) { case DRM_MODE_DPMS_ON: - exynos_dp_poweron(display); + exynos_dp_poweron(dp); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - exynos_dp_poweroff(display); + exynos_dp_poweroff(dp); break; default: break; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 39f7fa7..925fc69 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -253,9 +253,8 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, writel(val, ctx->regs + SHADOWCON); } -static void fimd_clear_channel(struct exynos_drm_crtc *crtc) +static void fimd_clear_channel(struct fimd_context *ctx) { - struct fimd_context *ctx = crtc->ctx; int win, ch_enabled = 0; DRM_DEBUG_KMS("%s\n", __FILE__); @@ -280,7 +279,7 @@ static void fimd_clear_channel(struct exynos_drm_crtc *crtc) unsigned int state = ctx->suspended; ctx->suspended = 0; - fimd_wait_for_vblank(crtc); + fimd_wait_for_vblank(ctx->crtc); ctx->suspended = state; } } @@ -302,7 +301,7 @@ static int fimd_ctx_initialize(struct fimd_context *ctx, * If any channel is already active, iommu will throw * a PAGE FAULT when enabled. So clear any channel if enabled. */ - fimd_clear_channel(ctx->crtc); + fimd_clear_channel(ctx); ret = drm_iommu_attach_device(ctx->drm_dev, ctx->dev); if (ret) { DRM_ERROR("drm_iommu_attach failed.\n"); @@ -823,9 +822,8 @@ static void fimd_win_disable(struct exynos_drm_crtc *crtc, int zpos) win_data->enabled = false; } -static void fimd_window_suspend(struct exynos_drm_crtc *crtc) +static void fimd_window_suspend(struct fimd_context *ctx) { - struct fimd_context *ctx = crtc->ctx; struct fimd_win_data *win_data; int i; @@ -833,13 +831,12 @@ static void fimd_window_suspend(struct exynos_drm_crtc *crtc) win_data = &ctx->win_data[i]; win_data->resume = win_data->enabled; if (win_data->enabled) - fimd_win_disable(crtc, i); + fimd_win_disable(ctx->crtc, i); } } -static void fimd_window_resume(struct exynos_drm_crtc *crtc) +static void fimd_window_resume(struct fimd_context *ctx) { - struct fimd_context *ctx = crtc->ctx; struct fimd_win_data *win_data; int i; @@ -850,26 +847,24 @@ static void fimd_window_resume(struct exynos_drm_crtc *crtc) } } -static void fimd_apply(struct exynos_drm_crtc *crtc) +static void fimd_apply(struct fimd_context *ctx) { - struct fimd_context *ctx = crtc->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(crtc, i); + fimd_win_commit(ctx->crtc, i); else - fimd_win_disable(crtc, i); + fimd_win_disable(ctx->crtc, i); } - fimd_commit(crtc); + fimd_commit(ctx->crtc); } -static int fimd_poweron(struct exynos_drm_crtc *crtc) +static int fimd_poweron(struct fimd_context *ctx) { - struct fimd_context *ctx = crtc->ctx; int ret; if (!ctx->suspended) @@ -893,16 +888,16 @@ static int fimd_poweron(struct exynos_drm_crtc *crtc) /* if vblank was enabled status, enable it again. */ if (test_and_clear_bit(0, &ctx->irq_flags)) { - ret = fimd_enable_vblank(crtc); + ret = fimd_enable_vblank(ctx->crtc); if (ret) { DRM_ERROR("Failed to re-enable vblank [%d]\n", ret); goto enable_vblank_err; } } - fimd_window_resume(crtc); + fimd_window_resume(ctx); - fimd_apply(crtc); + fimd_apply(ctx); return 0; @@ -915,10 +910,8 @@ bus_clk_err: return ret; } -static int fimd_poweroff(struct exynos_drm_crtc *crtc) +static int fimd_poweroff(struct fimd_context *ctx) { - struct fimd_context *ctx = crtc->ctx; - if (ctx->suspended) return 0; @@ -927,7 +920,7 @@ static int fimd_poweroff(struct exynos_drm_crtc *crtc) * suspend that connector. Otherwise we might try to scan from * a destroyed buffer later. */ - fimd_window_suspend(crtc); + fimd_window_suspend(ctx); clk_disable_unprepare(ctx->lcd_clk); clk_disable_unprepare(ctx->bus_clk); @@ -944,12 +937,12 @@ static void fimd_dpms(struct exynos_drm_crtc *crtc, int mode) switch (mode) { case DRM_MODE_DPMS_ON: - fimd_poweron(crtc); + fimd_poweron(crtc->ctx); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - fimd_poweroff(crtc); + fimd_poweroff(crtc->ctx); break; default: DRM_DEBUG_KMS("unspecified mode %d\n", mode); diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index fb68d3c..b886972 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -97,17 +97,16 @@ static const char fake_edid_info[] = { 0x00, 0x00, 0x00, 0x06 }; -static void vidi_apply(struct exynos_drm_crtc *crtc) +static void vidi_apply(struct vidi_context *ctx) { - struct vidi_context *ctx = crtc->ctx; - struct exynos_drm_crtc_ops *crtc_ops = crtc->ops; + struct exynos_drm_crtc_ops *crtc_ops = ctx->crtc->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 && (crtc_ops && crtc_ops->win_commit)) - crtc_ops->win_commit(crtc, i); + crtc_ops->win_commit(ctx->crtc, i); } } @@ -240,10 +239,8 @@ static void vidi_win_disable(struct exynos_drm_crtc *crtc, int zpos) /* TODO. */ } -static int vidi_power_on(struct exynos_drm_crtc *crtc, bool enable) +static int vidi_power_on(struct vidi_context *ctx, bool enable) { - struct vidi_context *ctx = crtc->ctx; - DRM_DEBUG_KMS("%s\n", __FILE__); if (enable != false && enable != true) @@ -254,9 +251,9 @@ static int vidi_power_on(struct exynos_drm_crtc *crtc, bool enable) /* if vblank was enabled status, enable it again. */ if (test_and_clear_bit(0, &ctx->irq_flags)) - vidi_enable_vblank(crtc); + vidi_enable_vblank(ctx->crtc); - vidi_apply(crtc); + vidi_apply(ctx); } else { ctx->suspended = true; } @@ -274,12 +271,12 @@ static void vidi_dpms(struct exynos_drm_crtc *crtc, int mode) switch (mode) { case DRM_MODE_DPMS_ON: - vidi_power_on(crtc, true); + vidi_power_on(ctx, true); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - vidi_power_on(crtc, false); + vidi_power_on(ctx, false); break; default: DRM_DEBUG_KMS("unspecified mode %d\n", mode); diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 98051e8..229b361 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2032,9 +2032,8 @@ static void hdmi_commit(struct exynos_drm_display *display) hdmi_conf_apply(hdata); } -static void hdmi_poweron(struct exynos_drm_display *display) +static void hdmi_poweron(struct hdmi_context *hdata) { - struct hdmi_context *hdata = display_to_hdmi(display); struct hdmi_resources *res = &hdata->res; mutex_lock(&hdata->hdmi_mutex); @@ -2060,12 +2059,11 @@ static void hdmi_poweron(struct exynos_drm_display *display) clk_prepare_enable(res->sclk_hdmi); hdmiphy_poweron(hdata); - hdmi_commit(display); + hdmi_commit(&hdata->display); } -static void hdmi_poweroff(struct exynos_drm_display *display) +static void hdmi_poweroff(struct hdmi_context *hdata) { - struct hdmi_context *hdata = display_to_hdmi(display); struct hdmi_resources *res = &hdata->res; mutex_lock(&hdata->hdmi_mutex); @@ -2109,7 +2107,7 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode) switch (mode) { case DRM_MODE_DPMS_ON: - hdmi_poweron(display); + hdmi_poweron(hdata); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: @@ -2128,7 +2126,7 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode) if (funcs && funcs->dpms) (*funcs->dpms)(crtc, mode); - hdmi_poweroff(display); + hdmi_poweroff(hdata); break; default: DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 1c65a31..75b47da 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1054,23 +1054,21 @@ static void mixer_wait_for_vblank(struct exynos_drm_crtc *crtc) drm_vblank_put(mixer_ctx->drm_dev, mixer_ctx->pipe); } -static void mixer_window_suspend(struct exynos_drm_crtc *crtc) +static void mixer_window_suspend(struct mixer_context *ctx) { - struct mixer_context *ctx = crtc->ctx; struct hdmi_win_data *win_data; int i; for (i = 0; i < MIXER_WIN_NR; i++) { win_data = &ctx->win_data[i]; win_data->resume = win_data->enabled; - mixer_win_disable(crtc, i); + mixer_win_disable(ctx->crtc, i); } - mixer_wait_for_vblank(crtc); + mixer_wait_for_vblank(ctx->crtc); } -static void mixer_window_resume(struct exynos_drm_crtc *crtc) +static void mixer_window_resume(struct mixer_context *ctx) { - struct mixer_context *ctx = crtc->ctx; struct hdmi_win_data *win_data; int i; @@ -1079,13 +1077,12 @@ static void mixer_window_resume(struct exynos_drm_crtc *crtc) win_data->enabled = win_data->resume; win_data->resume = false; if (win_data->enabled) - mixer_win_commit(crtc, i); + mixer_win_commit(ctx->crtc, i); } } -static void mixer_poweron(struct exynos_drm_crtc *crtc) +static void mixer_poweron(struct mixer_context *ctx) { - struct mixer_context *ctx = crtc->ctx; struct mixer_resources *res = &ctx->mixer_res; mutex_lock(&ctx->mixer_mutex); @@ -1115,12 +1112,11 @@ static void mixer_poweron(struct exynos_drm_crtc *crtc) mixer_reg_write(res, MXR_INT_EN, ctx->int_en); mixer_win_reset(ctx); - mixer_window_resume(crtc); + mixer_window_resume(ctx); } -static void mixer_poweroff(struct exynos_drm_crtc *crtc) +static void mixer_poweroff(struct mixer_context *ctx) { - struct mixer_context *ctx = crtc->ctx; struct mixer_resources *res = &ctx->mixer_res; mutex_lock(&ctx->mixer_mutex); @@ -1131,7 +1127,7 @@ static void mixer_poweroff(struct exynos_drm_crtc *crtc) mutex_unlock(&ctx->mixer_mutex); mixer_stop(ctx); - mixer_window_suspend(crtc); + mixer_window_suspend(ctx); ctx->int_en = mixer_reg_read(res, MXR_INT_EN); @@ -1154,12 +1150,12 @@ static void mixer_dpms(struct exynos_drm_crtc *crtc, int mode) { switch (mode) { case DRM_MODE_DPMS_ON: - mixer_poweron(crtc); + mixer_poweron(crtc->ctx); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - mixer_poweroff(crtc); + mixer_poweroff(crtc->ctx); break; default: DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); -- cgit v0.10.2 From e2dc3f72eea7decdb56368f0de88bba343720828 Mon Sep 17 00:00:00 2001 From: Alban Browaeys Date: Thu, 29 Jan 2015 22:18:40 +0100 Subject: drm/exynos: fix no hdmi output The hdmi outputs black screen only even though under the hood Xorg and framebuffer console are fine : devices found and initialized, but not a pixel out. Commit 93bca243ec96 ("drm/exynos: remove struct exynos_drm_manager") changed the call order of mixer_initialize with regards to exynos_drm_crtc_create. This changes breaks hdmi out on Odroid U2 (linux-next with added Marek Szyprowski v4 hdmi patchset from linux-samsung-soc ML). Restore the previous call ordering get hdmi to ouput proper pixels: ie call mixer_initialize first then exynos_drm_crtc_create. Fixes: 93bca243ec96 ("drm/exynos: remove struct exynos_drm_manager") Signed-off-by: Alban Browaeys Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 75b47da..0aa6cf4 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1254,18 +1254,19 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data) struct drm_device *drm_dev = data; int ret; + ret = mixer_initialize(ctx, drm_dev); + if (ret) + return ret; + ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe, EXYNOS_DISPLAY_TYPE_HDMI, &mixer_crtc_ops, ctx); if (IS_ERR(ctx->crtc)) { + mixer_ctx_remove(ctx); ret = PTR_ERR(ctx->crtc); goto free_ctx; } - ret = mixer_initialize(ctx, drm_dev); - if (ret) - goto free_ctx; - return 0; free_ctx: -- cgit v0.10.2 From 129046c6ecb662e902a241bbbcb1da4206986370 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 30 Jan 2015 17:30:45 +0900 Subject: drm/exynos: hdmi: replace fb size with mode size from win commit For default graphic window, mixer_win_commit() sets display size register as fb size. Calling setplane with smaller fb size than mode size to default window causes distorted display result. So this patch replaces fb size with mode size for display size from the mixer_win_commit(). Signed-off-by: Seung-Woo Kim Acked-by: Joonyoung Shim Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 0aa6cf4..496c861 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -583,8 +583,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win) /* setup display size */ if (ctx->mxr_ver == MXR_VER_128_0_0_184 && win == MIXER_DEFAULT_WIN) { - val = MXR_MXR_RES_HEIGHT(win_data->fb_height); - val |= MXR_MXR_RES_WIDTH(win_data->fb_width); + val = MXR_MXR_RES_HEIGHT(win_data->mode_height); + val |= MXR_MXR_RES_WIDTH(win_data->mode_width); mixer_reg_write(res, MXR_RESOLUTION, val); } -- cgit v0.10.2 From a5d7ac30fa9ffa923e3603309692a36e3b3b3ae1 Mon Sep 17 00:00:00 2001 From: Carlo Caione Date: Wed, 4 Feb 2015 10:23:19 +0100 Subject: drm/exynos: fix DMA_ATTR_NO_KERNEL_MAPPING usage The Exynos DRM driver doesn't follow the correct API when dealing with dma_{alloc, mmap, free}_attrs functions and the DMA_ATTR_NO_KERNEL_MAPPING attribute. When a IOMMU is not available and the DMA_ATTR_NO_KERNEL_MAPPING is used, the driver should use the pointer returned by dma_alloc_attr() as a cookie. The Exynos DRM driver directly uses the non-requested virtual kernel address returned by the DMA mapping subsystem. This just works now because the non-IOMMU codepath doesn't obey DMA_ATTR_NO_KERNEL_MAPPING but we need to fix it before fixing the DMA layer. Signed-off-by: Carlo Caione Acked-by: Marek Szyprowski Acked-by: Joonyoung Shim Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 9c80884..24994ba 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c @@ -63,11 +63,11 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, return -ENOMEM; } - buf->kvaddr = (void __iomem *)dma_alloc_attrs(dev->dev, + buf->cookie = dma_alloc_attrs(dev->dev, buf->size, &buf->dma_addr, GFP_KERNEL, &buf->dma_attrs); - if (!buf->kvaddr) { + if (!buf->cookie) { DRM_ERROR("failed to allocate buffer.\n"); ret = -ENOMEM; goto err_free; @@ -132,7 +132,7 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, buf->sgt = NULL; if (!is_drm_iommu_supported(dev)) { - dma_free_attrs(dev->dev, buf->size, buf->kvaddr, + dma_free_attrs(dev->dev, buf->size, buf->cookie, (dma_addr_t)buf->dma_addr, &buf->dma_attrs); drm_free_large(buf->pages); } else diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index e12ea90..84f8dfe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -79,9 +79,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, struct drm_framebuffer *fb) { struct fb_info *fbi = helper->fbdev; - struct drm_device *dev = helper->dev; struct exynos_drm_gem_buf *buffer; unsigned int size = fb->width * fb->height * (fb->bits_per_pixel >> 3); + unsigned int nr_pages; unsigned long offset; drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth); @@ -94,25 +94,14 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, return -EFAULT; } - /* map pages with kernel virtual space. */ + nr_pages = buffer->size >> PAGE_SHIFT; + + buffer->kvaddr = (void __iomem *) vmap(buffer->pages, + nr_pages, VM_MAP, + pgprot_writecombine(PAGE_KERNEL)); if (!buffer->kvaddr) { - if (is_drm_iommu_supported(dev)) { - unsigned int nr_pages = buffer->size >> PAGE_SHIFT; - - buffer->kvaddr = (void __iomem *) vmap(buffer->pages, - nr_pages, VM_MAP, - pgprot_writecombine(PAGE_KERNEL)); - } else { - phys_addr_t dma_addr = buffer->dma_addr; - if (dma_addr) - buffer->kvaddr = (void __iomem *)phys_to_virt(dma_addr); - else - buffer->kvaddr = (void __iomem *)NULL; - } - if (!buffer->kvaddr) { - DRM_ERROR("failed to map pages to kernel space.\n"); - return -EIO; - } + DRM_ERROR("failed to map pages to kernel space.\n"); + return -EIO; } /* buffer count to framebuffer always is 1 at booting time. */ @@ -313,7 +302,7 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj; struct drm_framebuffer *fb; - if (is_drm_iommu_supported(dev) && exynos_gem_obj->buffer->kvaddr) + if (exynos_gem_obj->buffer->kvaddr) vunmap(exynos_gem_obj->buffer->kvaddr); /* release drm framebuffer and real buffer */ diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index ec58fe9..308173c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h @@ -22,6 +22,7 @@ /* * exynos drm gem buffer structure. * + * @cookie: cookie returned by dma_alloc_attrs * @kvaddr: kernel virtual address to allocated memory region. * *userptr: user space address. * @dma_addr: bus address(accessed by dma) to allocated memory region. @@ -35,6 +36,7 @@ * VM_PFNMAP or not. */ struct exynos_drm_gem_buf { + void *cookie; void __iomem *kvaddr; unsigned long userptr; dma_addr_t dma_addr; -- cgit v0.10.2 From 30b39f0488eb114b3523de7a6579ef8ff2c40a6e Mon Sep 17 00:00:00 2001 From: Gustavo Padovan Date: Thu, 5 Feb 2015 16:11:35 +0900 Subject: drm/exynos: Remove exynos_plane_dpms() call with no effect exynos_plane_dpms(DRM_MODE_DPMS_ON) calls the win_enable()'s callback from the underlying layer. However neither one of these layers implement win_enable() - FIMD, Mixer and VIDI. Thus the call to exynos_plane_dpms() is pointless. Signed-off-by: Gustavo Padovan Acked-by: Daniel Vetter Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index a85c451..fff2e55 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -66,8 +66,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc) if (exynos_crtc->ops->commit) exynos_crtc->ops->commit(exynos_crtc); - - exynos_plane_dpms(crtc->primary, DRM_MODE_DPMS_ON); } static bool -- cgit v0.10.2 From f27829a184ed3bf44b952fa299f399513bdb0a18 Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Thu, 5 Feb 2015 16:11:36 +0900 Subject: drm/exynos: remove mode property of exynos crtc This was added by commit 3b8d1cf818c2 ("drm/exynos: add property for crtc mode"). Currently we can control a plane used for crtc using primary plane by universal plane feature. Stop to use non-standard property to control primary plane. Signed-off-by: Joonyoung Shim Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index fff2e55..48ccab7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -232,70 +232,12 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc) kfree(exynos_crtc); } -static int exynos_drm_crtc_set_property(struct drm_crtc *crtc, - struct drm_property *property, - uint64_t val) -{ - struct drm_device *dev = crtc->dev; - struct exynos_drm_private *dev_priv = dev->dev_private; - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); - - if (property == dev_priv->crtc_mode_property) { - enum exynos_crtc_mode mode = val; - - if (mode == exynos_crtc->mode) - return 0; - - exynos_crtc->mode = mode; - - switch (mode) { - case CRTC_MODE_NORMAL: - exynos_drm_crtc_commit(crtc); - break; - case CRTC_MODE_BLANK: - exynos_plane_dpms(crtc->primary, DRM_MODE_DPMS_OFF); - break; - default: - break; - } - - return 0; - } - - return -EINVAL; -} - static struct drm_crtc_funcs exynos_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .page_flip = exynos_drm_crtc_page_flip, .destroy = exynos_drm_crtc_destroy, - .set_property = exynos_drm_crtc_set_property, -}; - -static const struct drm_prop_enum_list mode_names[] = { - { CRTC_MODE_NORMAL, "normal" }, - { CRTC_MODE_BLANK, "blank" }, }; -static void exynos_drm_crtc_attach_mode_property(struct drm_crtc *crtc) -{ - struct drm_device *dev = crtc->dev; - struct exynos_drm_private *dev_priv = dev->dev_private; - struct drm_property *prop; - - prop = dev_priv->crtc_mode_property; - if (!prop) { - prop = drm_property_create_enum(dev, 0, "mode", mode_names, - ARRAY_SIZE(mode_names)); - if (!prop) - return; - - dev_priv->crtc_mode_property = prop; - } - - drm_object_attach_property(&crtc->base, prop, 0); -} - struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, int pipe, enum exynos_drm_output_type type, @@ -338,8 +280,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs); - exynos_drm_crtc_attach_mode_property(crtc); - return exynos_crtc; err_crtc: diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index d490b49..1aceafc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -197,11 +197,6 @@ struct exynos_drm_crtc_ops { void (*te_handler)(struct exynos_drm_crtc *crtc); }; -enum exynos_crtc_mode { - CRTC_MODE_NORMAL, /* normal mode */ - CRTC_MODE_BLANK, /* The private plane of crtc is blank */ -}; - /* * Exynos specific crtc structure. * @@ -215,7 +210,6 @@ enum exynos_crtc_mode { * we can refer to the crtc to current hardware interrupt occurred through * this pipe value. * @dpms: store the crtc dpms value - * @mode: store the crtc mode value * @ops: pointer to callbacks for exynos drm specific functionality * @ctx: A pointer to the crtc's implementation specific context */ @@ -224,7 +218,6 @@ struct exynos_drm_crtc { enum exynos_drm_output_type type; unsigned int pipe; unsigned int dpms; - enum exynos_crtc_mode mode; wait_queue_head_t pending_flip_queue; atomic_t pending_flip; struct exynos_drm_crtc_ops *ops; @@ -265,7 +258,6 @@ struct exynos_drm_private { */ struct drm_crtc *crtc[MAX_CRTC]; struct drm_property *plane_zpos_property; - struct drm_property *crtc_mode_property; unsigned long da_start; unsigned long da_space_size; -- cgit v0.10.2 From d9ea62566dbda7afb63c790057f3243f51abf771 Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Thu, 5 Feb 2015 16:11:37 +0900 Subject: drm/exynos: remove exynos_plane_dpms The exynos_plane_dpms function handles enabled flag of exynos plane and calls internal hw driver callback function for hw overlay on/off. But it causes state disharmory problem currently and is will be obstacle to apply atomic operation later to keep non-standard per-plane dpms state like enabled flag. Let's remove enabled flag, it just stop to recall internal callback function but hw drivers can handle it properly. And call internal callback function directly then we can remove unnecessary exynos_plane_dpms function Signed-off-by: Joonyoung Shim Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 358cff6..2dfb847 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -145,32 +145,6 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, exynos_crtc->ops->win_mode_set(exynos_crtc, exynos_plane); } -void exynos_plane_dpms(struct drm_plane *plane, int mode) -{ - struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(plane->crtc); - - if (mode == DRM_MODE_DPMS_ON) { - if (exynos_plane->enabled) - return; - - if (exynos_crtc->ops->win_enable) - exynos_crtc->ops->win_enable(exynos_crtc, - exynos_plane->zpos); - - exynos_plane->enabled = true; - } else { - if (!exynos_plane->enabled) - return; - - if (exynos_crtc->ops->win_disable) - exynos_crtc->ops->win_disable(exynos_crtc, - exynos_plane->zpos); - - exynos_plane->enabled = false; - } -} - int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, @@ -199,7 +173,12 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, static int exynos_disable_plane(struct drm_plane *plane) { - exynos_plane_dpms(plane, DRM_MODE_DPMS_OFF); + struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); + struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(plane->crtc); + + if (exynos_crtc->ops->win_disable) + exynos_crtc->ops->win_disable(exynos_crtc, + exynos_plane->zpos); return 0; } diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.h b/drivers/gpu/drm/exynos/exynos_drm_plane.h index 59d4075..9d3c374 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.h +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.h @@ -20,7 +20,6 @@ int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h); -void exynos_plane_dpms(struct drm_plane *plane, int mode); struct drm_plane *exynos_plane_init(struct drm_device *dev, unsigned long possible_crtcs, enum drm_plane_type type); -- cgit v0.10.2 From 936ce5cce66ce6f9b5138a1ac0fbf0c2d459a960 Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Thu, 5 Feb 2015 16:11:38 +0900 Subject: drm/exynos: fix NULL pointer reference There is a case called disable_plane callback function even if plane->crtc is NULL from exynos_drm_encoder_disable and it will cause NULL pointer reference error. Signed-off-by: Joonyoung Shim Signed-off-by: Inki Dae diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 7e282e3..57de0bd 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -102,7 +102,7 @@ static void exynos_drm_encoder_disable(struct drm_encoder *encoder) /* all planes connected to this encoder should be also disabled. */ drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) { - if (plane->crtc == encoder->crtc) + if (plane->crtc && (plane->crtc == encoder->crtc)) plane->funcs->disable_plane(plane); } } -- cgit v0.10.2 From 96976c3d9aff4e1387c30f6356ac01fa6f72ef46 Mon Sep 17 00:00:00 2001 From: Ajay Kumar Date: Thu, 5 Feb 2015 21:24:04 +0530 Subject: drm/exynos: Add DECON driver This patch is based on exynos-drm-next branch of Inki Dae's tree at: git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git DECON(Display and Enhancement Controller) is the new IP in exynos7 SOC for generating video signals using pixel data. DECON driver can be used to drive 2 different interfaces on Exynos7: DECON-INT(video controller) and DECON-EXT(Mixer for HDMI) The existing FIMD driver code was used as a template to create DECON driver. Only DECON-INT is supported as of now, and DECON-EXT support will be added later. The current version of the driver supports video mode displays. Changelog v2: - Change config name, DRM_EXYNOS_DECON to DRM_EXYNOS7_DECON. Signed-off-by: Akshu Agrawal Signed-off-by: Ajay Kumar Signed-off-by: Inki Dae diff --git a/Documentation/devicetree/bindings/video/exynos7-decon.txt b/Documentation/devicetree/bindings/video/exynos7-decon.txt new file mode 100644 index 0000000..f5f9c8d --- /dev/null +++ b/Documentation/devicetree/bindings/video/exynos7-decon.txt @@ -0,0 +1,68 @@ +Device-Tree bindings for Samsung Exynos7 SoC display controller (DECON) + +DECON (Display and Enhancement Controller) is the Display Controller for the +Exynos7 series of SoCs which transfers the image data from a video memory +buffer to an external LCD interface. + +Required properties: +- compatible: value should be "samsung,exynos7-decon"; + +- reg: physical base address and length of the DECON registers set. + +- interrupt-parent: should be the phandle of the decon controller's + parent interrupt controller. + +- interrupts: should contain a list of all DECON IP block interrupts in the + order: FIFO Level, VSYNC, LCD_SYSTEM. The interrupt specifier + format depends on the interrupt controller used. + +- interrupt-names: should contain the interrupt names: "fifo", "vsync", + "lcd_sys", in the same order as they were listed in the interrupts + property. + +- pinctrl-0: pin control group to be used for this controller. + +- pinctrl-names: must contain a "default" entry. + +- clocks: must include clock specifiers corresponding to entries in the + clock-names property. + +- clock-names: list of clock names sorted in the same order as the clocks + property. Must contain "pclk_decon0", "aclk_decon0", + "decon0_eclk", "decon0_vclk". +- i80-if-timings: timing configuration for lcd i80 interface support. + +Optional Properties: +- samsung,power-domain: a phandle to DECON power domain node. +- display-timings: timing settings for DECON, as described in document [1]. + Can be used in case timings cannot be provided otherwise + or to override timings provided by the panel. + +[1]: Documentation/devicetree/bindings/video/display-timing.txt + +Example: + +SoC specific DT entry: + + decon@13930000 { + compatible = "samsung,exynos7-decon"; + interrupt-parent = <&combiner>; + reg = <0x13930000 0x1000>; + interrupt-names = "lcd_sys", "vsync", "fifo"; + interrupts = <0 188 0>, <0 189 0>, <0 190 0>; + clocks = <&clock_disp PCLK_DECON_INT>, + <&clock_disp ACLK_DECON_INT>, + <&clock_disp SCLK_DECON_INT_ECLK>, + <&clock_disp SCLK_DECON_INT_EXTCLKPLL>; + clock-names = "pclk_decon0", "aclk_decon0", "decon0_eclk", + "decon0_vclk"; + status = "disabled"; + }; + +Board specific DT entry: + + decon@13930000 { + pinctrl-0 = <&lcd_clk &pwm1_out>; + pinctrl-names = "default"; + status = "okay"; + }; diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 627aaa0..a5e7461 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -24,9 +24,16 @@ config DRM_EXYNOS_FIMD help Choose this option if you want to use Exynos FIMD for DRM. +config DRM_EXYNOS7_DECON + bool "Exynos DRM DECON" + depends on DRM_EXYNOS + select FB_MODE_HELPERS + help + Choose this option if you want to use Exynos DECON for DRM. + config DRM_EXYNOS_DPI bool "EXYNOS DRM parallel output support" - depends on DRM_EXYNOS_FIMD + depends on (DRM_EXYNOS_FIMD || DRM_EXYNOS7_DECON) select DRM_PANEL default n help @@ -34,7 +41,7 @@ config DRM_EXYNOS_DPI config DRM_EXYNOS_DSI bool "EXYNOS DRM MIPI-DSI driver support" - depends on DRM_EXYNOS_FIMD + depends on (DRM_EXYNOS_FIMD || DRM_EXYNOS7_DECON) select DRM_MIPI_DSI select DRM_PANEL default n @@ -43,7 +50,7 @@ config DRM_EXYNOS_DSI config DRM_EXYNOS_DP bool "EXYNOS DRM DP driver support" - depends on DRM_EXYNOS_FIMD && ARCH_EXYNOS && (DRM_PTN3460=n || DRM_PTN3460=y || DRM_PTN3460=DRM_EXYNOS) + depends on (DRM_EXYNOS_FIMD || DRM_EXYNOS7DECON) && ARCH_EXYNOS && (DRM_PTN3460=n || DRM_PTN3460=y || DRM_PTN3460=DRM_EXYNOS) default DRM_EXYNOS select DRM_PANEL help diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index 0856891..cc90679 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile @@ -10,6 +10,7 @@ exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \ exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o +exynosdrm-$(CONFIG_DRM_EXYNOS7_DECON) += exynos7_drm_decon.o exynosdrm-$(CONFIG_DRM_EXYNOS_DPI) += exynos_drm_dpi.o exynosdrm-$(CONFIG_DRM_EXYNOS_DSI) += exynos_drm_dsi.o exynosdrm-$(CONFIG_DRM_EXYNOS_DP) += exynos_dp_core.o exynos_dp_reg.o diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c new file mode 100644 index 0000000..63f02e2 --- /dev/null +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -0,0 +1,990 @@ +/* drivers/gpu/drm/exynos/exynos7_drm_decon.c + * + * Copyright (C) 2014 Samsung Electronics Co.Ltd + * Authors: + * Akshu Agarwal + * Ajay Kumar + * + * 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. + * + */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include