Commit 92dc7a04 authored by Joonyoung Shim's avatar Joonyoung Shim Committed by Inki Dae

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: default avatarJoonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 0f04cf8d
...@@ -1058,10 +1058,8 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp) ...@@ -1058,10 +1058,8 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
phy_power_off(dp->phy); 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) if (dp->dpms_mode == DRM_MODE_DPMS_ON)
return; return;
...@@ -1076,13 +1074,11 @@ static void exynos_dp_poweron(struct exynos_drm_display *display) ...@@ -1076,13 +1074,11 @@ static void exynos_dp_poweron(struct exynos_drm_display *display)
exynos_dp_phy_init(dp); exynos_dp_phy_init(dp);
exynos_dp_init_dp(dp); exynos_dp_init_dp(dp);
enable_irq(dp->irq); 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) if (dp->dpms_mode != DRM_MODE_DPMS_ON)
return; return;
...@@ -1110,12 +1106,12 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) ...@@ -1110,12 +1106,12 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
switch (mode) { switch (mode) {
case DRM_MODE_DPMS_ON: case DRM_MODE_DPMS_ON:
exynos_dp_poweron(display); exynos_dp_poweron(dp);
break; break;
case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF: case DRM_MODE_DPMS_OFF:
exynos_dp_poweroff(display); exynos_dp_poweroff(dp);
break; break;
default: default:
break; break;
......
...@@ -253,9 +253,8 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, ...@@ -253,9 +253,8 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win,
writel(val, ctx->regs + SHADOWCON); 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; int win, ch_enabled = 0;
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
...@@ -280,7 +279,7 @@ static void fimd_clear_channel(struct exynos_drm_crtc *crtc) ...@@ -280,7 +279,7 @@ static void fimd_clear_channel(struct exynos_drm_crtc *crtc)
unsigned int state = ctx->suspended; unsigned int state = ctx->suspended;
ctx->suspended = 0; ctx->suspended = 0;
fimd_wait_for_vblank(crtc); fimd_wait_for_vblank(ctx->crtc);
ctx->suspended = state; ctx->suspended = state;
} }
} }
...@@ -302,7 +301,7 @@ static int fimd_ctx_initialize(struct fimd_context *ctx, ...@@ -302,7 +301,7 @@ static int fimd_ctx_initialize(struct fimd_context *ctx,
* If any channel is already active, iommu will throw * If any channel is already active, iommu will throw
* a PAGE FAULT when enabled. So clear any channel if enabled. * 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); ret = drm_iommu_attach_device(ctx->drm_dev, ctx->dev);
if (ret) { if (ret) {
DRM_ERROR("drm_iommu_attach failed.\n"); DRM_ERROR("drm_iommu_attach failed.\n");
...@@ -823,9 +822,8 @@ static void fimd_win_disable(struct exynos_drm_crtc *crtc, int zpos) ...@@ -823,9 +822,8 @@ static void fimd_win_disable(struct exynos_drm_crtc *crtc, int zpos)
win_data->enabled = false; 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; struct fimd_win_data *win_data;
int i; int i;
...@@ -833,13 +831,12 @@ static void fimd_window_suspend(struct exynos_drm_crtc *crtc) ...@@ -833,13 +831,12 @@ static void fimd_window_suspend(struct exynos_drm_crtc *crtc)
win_data = &ctx->win_data[i]; win_data = &ctx->win_data[i];
win_data->resume = win_data->enabled; win_data->resume = win_data->enabled;
if (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; struct fimd_win_data *win_data;
int i; int i;
...@@ -850,26 +847,24 @@ static void fimd_window_resume(struct exynos_drm_crtc *crtc) ...@@ -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; struct fimd_win_data *win_data;
int i; int i;
for (i = 0; i < WINDOWS_NR; i++) { for (i = 0; i < WINDOWS_NR; i++) {
win_data = &ctx->win_data[i]; win_data = &ctx->win_data[i];
if (win_data->enabled) if (win_data->enabled)
fimd_win_commit(crtc, i); fimd_win_commit(ctx->crtc, i);
else 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; int ret;
if (!ctx->suspended) if (!ctx->suspended)
...@@ -893,16 +888,16 @@ static int fimd_poweron(struct exynos_drm_crtc *crtc) ...@@ -893,16 +888,16 @@ static int fimd_poweron(struct exynos_drm_crtc *crtc)
/* if vblank was enabled status, enable it again. */ /* if vblank was enabled status, enable it again. */
if (test_and_clear_bit(0, &ctx->irq_flags)) { if (test_and_clear_bit(0, &ctx->irq_flags)) {
ret = fimd_enable_vblank(crtc); ret = fimd_enable_vblank(ctx->crtc);
if (ret) { if (ret) {
DRM_ERROR("Failed to re-enable vblank [%d]\n", ret); DRM_ERROR("Failed to re-enable vblank [%d]\n", ret);
goto enable_vblank_err; goto enable_vblank_err;
} }
} }
fimd_window_resume(crtc); fimd_window_resume(ctx);
fimd_apply(crtc); fimd_apply(ctx);
return 0; return 0;
...@@ -915,10 +910,8 @@ static int fimd_poweron(struct exynos_drm_crtc *crtc) ...@@ -915,10 +910,8 @@ static int fimd_poweron(struct exynos_drm_crtc *crtc)
return ret; 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) if (ctx->suspended)
return 0; return 0;
...@@ -927,7 +920,7 @@ static int fimd_poweroff(struct exynos_drm_crtc *crtc) ...@@ -927,7 +920,7 @@ static int fimd_poweroff(struct exynos_drm_crtc *crtc)
* suspend that connector. Otherwise we might try to scan from * suspend that connector. Otherwise we might try to scan from
* a destroyed buffer later. * a destroyed buffer later.
*/ */
fimd_window_suspend(crtc); fimd_window_suspend(ctx);
clk_disable_unprepare(ctx->lcd_clk); clk_disable_unprepare(ctx->lcd_clk);
clk_disable_unprepare(ctx->bus_clk); clk_disable_unprepare(ctx->bus_clk);
...@@ -944,12 +937,12 @@ static void fimd_dpms(struct exynos_drm_crtc *crtc, int mode) ...@@ -944,12 +937,12 @@ static void fimd_dpms(struct exynos_drm_crtc *crtc, int mode)
switch (mode) { switch (mode) {
case DRM_MODE_DPMS_ON: case DRM_MODE_DPMS_ON:
fimd_poweron(crtc); fimd_poweron(crtc->ctx);
break; break;
case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF: case DRM_MODE_DPMS_OFF:
fimd_poweroff(crtc); fimd_poweroff(crtc->ctx);
break; break;
default: default:
DRM_DEBUG_KMS("unspecified mode %d\n", mode); DRM_DEBUG_KMS("unspecified mode %d\n", mode);
......
...@@ -97,17 +97,16 @@ static const char fake_edid_info[] = { ...@@ -97,17 +97,16 @@ static const char fake_edid_info[] = {
0x00, 0x00, 0x00, 0x06 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 = ctx->crtc->ops;
struct exynos_drm_crtc_ops *crtc_ops = crtc->ops;
struct vidi_win_data *win_data; struct vidi_win_data *win_data;
int i; int i;
for (i = 0; i < WINDOWS_NR; i++) { for (i = 0; i < WINDOWS_NR; i++) {
win_data = &ctx->win_data[i]; win_data = &ctx->win_data[i];
if (win_data->enabled && (crtc_ops && crtc_ops->win_commit)) 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) ...@@ -240,10 +239,8 @@ static void vidi_win_disable(struct exynos_drm_crtc *crtc, int zpos)
/* TODO. */ /* 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__); DRM_DEBUG_KMS("%s\n", __FILE__);
if (enable != false && enable != true) if (enable != false && enable != true)
...@@ -254,9 +251,9 @@ static int vidi_power_on(struct exynos_drm_crtc *crtc, bool enable) ...@@ -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 vblank was enabled status, enable it again. */
if (test_and_clear_bit(0, &ctx->irq_flags)) 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 { } else {
ctx->suspended = true; ctx->suspended = true;
} }
...@@ -274,12 +271,12 @@ static void vidi_dpms(struct exynos_drm_crtc *crtc, int mode) ...@@ -274,12 +271,12 @@ static void vidi_dpms(struct exynos_drm_crtc *crtc, int mode)
switch (mode) { switch (mode) {
case DRM_MODE_DPMS_ON: case DRM_MODE_DPMS_ON:
vidi_power_on(crtc, true); vidi_power_on(ctx, true);
break; break;
case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF: case DRM_MODE_DPMS_OFF:
vidi_power_on(crtc, false); vidi_power_on(ctx, false);
break; break;
default: default:
DRM_DEBUG_KMS("unspecified mode %d\n", mode); DRM_DEBUG_KMS("unspecified mode %d\n", mode);
......
...@@ -2032,9 +2032,8 @@ static void hdmi_commit(struct exynos_drm_display *display) ...@@ -2032,9 +2032,8 @@ static void hdmi_commit(struct exynos_drm_display *display)
hdmi_conf_apply(hdata); 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; struct hdmi_resources *res = &hdata->res;
mutex_lock(&hdata->hdmi_mutex); mutex_lock(&hdata->hdmi_mutex);
...@@ -2060,12 +2059,11 @@ static void hdmi_poweron(struct exynos_drm_display *display) ...@@ -2060,12 +2059,11 @@ static void hdmi_poweron(struct exynos_drm_display *display)
clk_prepare_enable(res->sclk_hdmi); clk_prepare_enable(res->sclk_hdmi);
hdmiphy_poweron(hdata); 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; struct hdmi_resources *res = &hdata->res;
mutex_lock(&hdata->hdmi_mutex); mutex_lock(&hdata->hdmi_mutex);
...@@ -2109,7 +2107,7 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode) ...@@ -2109,7 +2107,7 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)
switch (mode) { switch (mode) {
case DRM_MODE_DPMS_ON: case DRM_MODE_DPMS_ON:
hdmi_poweron(display); hdmi_poweron(hdata);
break; break;
case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_SUSPEND:
...@@ -2128,7 +2126,7 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode) ...@@ -2128,7 +2126,7 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)
if (funcs && funcs->dpms) if (funcs && funcs->dpms)
(*funcs->dpms)(crtc, mode); (*funcs->dpms)(crtc, mode);
hdmi_poweroff(display); hdmi_poweroff(hdata);
break; break;
default: default:
DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode);
......
...@@ -1054,23 +1054,21 @@ static void mixer_wait_for_vblank(struct exynos_drm_crtc *crtc) ...@@ -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); 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; struct hdmi_win_data *win_data;
int i; int i;
for (i = 0; i < MIXER_WIN_NR; i++) { for (i = 0; i < MIXER_WIN_NR; i++) {
win_data = &ctx->win_data[i]; win_data = &ctx->win_data[i];
win_data->resume = win_data->enabled; 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; struct hdmi_win_data *win_data;
int i; int i;
...@@ -1079,13 +1077,12 @@ static void mixer_window_resume(struct exynos_drm_crtc *crtc) ...@@ -1079,13 +1077,12 @@ static void mixer_window_resume(struct exynos_drm_crtc *crtc)
win_data->enabled = win_data->resume; win_data->enabled = win_data->resume;
win_data->resume = false; win_data->resume = false;
if (win_data->enabled) 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; struct mixer_resources *res = &ctx->mixer_res;
mutex_lock(&ctx->mixer_mutex); mutex_lock(&ctx->mixer_mutex);
...@@ -1115,12 +1112,11 @@ static void mixer_poweron(struct exynos_drm_crtc *crtc) ...@@ -1115,12 +1112,11 @@ static void mixer_poweron(struct exynos_drm_crtc *crtc)
mixer_reg_write(res, MXR_INT_EN, ctx->int_en); mixer_reg_write(res, MXR_INT_EN, ctx->int_en);
mixer_win_reset(ctx); 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; struct mixer_resources *res = &ctx->mixer_res;
mutex_lock(&ctx->mixer_mutex); mutex_lock(&ctx->mixer_mutex);
...@@ -1131,7 +1127,7 @@ static void mixer_poweroff(struct exynos_drm_crtc *crtc) ...@@ -1131,7 +1127,7 @@ static void mixer_poweroff(struct exynos_drm_crtc *crtc)
mutex_unlock(&ctx->mixer_mutex); mutex_unlock(&ctx->mixer_mutex);
mixer_stop(ctx); mixer_stop(ctx);
mixer_window_suspend(crtc); mixer_window_suspend(ctx);
ctx->int_en = mixer_reg_read(res, MXR_INT_EN); 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) ...@@ -1154,12 +1150,12 @@ static void mixer_dpms(struct exynos_drm_crtc *crtc, int mode)
{ {
switch (mode) { switch (mode) {
case DRM_MODE_DPMS_ON: case DRM_MODE_DPMS_ON:
mixer_poweron(crtc); mixer_poweron(crtc->ctx);
break; break;
case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF: case DRM_MODE_DPMS_OFF:
mixer_poweroff(crtc); mixer_poweroff(crtc->ctx);
break; break;
default: default:
DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode); DRM_DEBUG_KMS("unknown dpms mode: %d\n", mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment