From 52bf4aa64dd2bbe86c6ebe09f3a62d9d1d76e4ff Mon Sep 17 00:00:00 2001 From: Andrzej Hajda Date: Thu, 27 Oct 2016 10:24:05 +0200 Subject: drm/exynos/hdmi: remove redundant configuration fields The patch removes redundant fields from hdmi_conf_regs. Their values can be calculated from current_mode. This patch is the first step to remove whole hdmi_conf_regs structure. Change-Id: Id40fe15302b2546410f68323e92d136eb93b990a Signed-off-by: Andrzej Hajda Reviewed-by: Joonyoung Shim Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_hdmi.c | 45 ++++++++++++++---------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index f512696d7d4d..dcc0ff573640 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -193,14 +193,9 @@ struct hdmi_v14_conf { struct hdmi_tg_regs tg; }; -struct hdmi_conf_regs { - int pixel_clock; - int cea_video_id; - enum hdmi_picture_aspect aspect_ratio; - union { - struct hdmi_v13_conf v13_conf; - struct hdmi_v14_conf v14_conf; - } conf; +union hdmi_conf_regs { + struct hdmi_v13_conf v13_conf; + struct hdmi_v14_conf v14_conf; }; struct hdmi_context { @@ -224,7 +219,8 @@ struct hdmi_context { /* current hdmiphy conf regs */ struct drm_display_mode current_mode; - struct hdmi_conf_regs mode_conf; + u8 cea_video_id; + union hdmi_conf_regs mode_conf; struct hdmi_resources res; @@ -1141,7 +1137,6 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, u32 hdr_sum; u8 chksum; u32 mod; - u32 vic; u8 ar; mod = hdmi_reg_read(hdata, HDMI_MODE_SEL); @@ -1173,7 +1168,7 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, * Table 9 AVI InfoFrame Data Byte 2 of CEA-861-D Standard */ ar = AVI_ACTIVE_AR_SAME_AS_PIC; - switch (hdata->mode_conf.aspect_ratio) { + switch (hdata->current_mode.picture_aspect_ratio) { case HDMI_PICTURE_ASPECT_4_3: ar |= AVI_PICTURE_AR_4_3; break; @@ -1187,8 +1182,7 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, } hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), ar); - vic = hdata->mode_conf.cea_video_id; - hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(4), vic); + hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(4), hdata->cea_video_id); chksum = hdmi_chksum(hdata, HDMI_AVI_BYTE(1), infoframe->any.length, hdr_sum); @@ -1657,9 +1651,8 @@ static int hdmi_clk_set_parents(struct hdmi_context *hdata, bool to_phy) static void hdmi_v13_mode_apply(struct hdmi_context *hdata) { - const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v13_conf.tg; - const struct hdmi_v13_core_regs *core = - &hdata->mode_conf.conf.v13_conf.core; + const struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg; + const struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core; /* setting core registers */ hdmi_reg_writeb(hdata, HDMI_H_BLANK_0, core->h_blank[0]); @@ -1724,9 +1717,8 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata) static void hdmi_v14_mode_apply(struct hdmi_context *hdata) { - const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v14_conf.tg; - const struct hdmi_v14_core_regs *core = - &hdata->mode_conf.conf.v14_conf.core; + const struct hdmi_tg_regs *tg = &hdata->mode_conf.v14_conf.tg; + const struct hdmi_v14_core_regs *core = &hdata->mode_conf.v14_conf.core; /* setting core registers */ hdmi_reg_writeb(hdata, HDMI_H_BLANK_0, core->h_blank[0]); @@ -1954,7 +1946,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata) u8 mode_set_done = hdata->drv_data->phy_mode_set_done; /* pixel clock */ - i = hdmi_find_phy_conf(hdata, hdata->mode_conf.pixel_clock); + i = hdmi_find_phy_conf(hdata, hdata->current_mode.clock * 1000); if (i < 0) { DRM_ERROR("failed to find hdmiphy conf\n"); return; @@ -2002,8 +1994,8 @@ static void hdmi_set_reg(u8 *reg_pair, int num_bytes, u32 value) static void hdmi_v13_mode_set(struct hdmi_context *hdata, struct drm_display_mode *m) { - struct hdmi_v13_core_regs *core = &hdata->mode_conf.conf.v13_conf.core; - struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v13_conf.tg; + struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core; + struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg; unsigned int val; hdmi_set_reg(core->h_blank, 2, m->htotal - m->hdisplay); @@ -2094,9 +2086,8 @@ static void hdmi_v13_mode_set(struct hdmi_context *hdata, static void hdmi_v14_mode_set(struct hdmi_context *hdata, struct drm_display_mode *m) { - struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v14_conf.tg; - struct hdmi_v14_core_regs *core = - &hdata->mode_conf.conf.v14_conf.core; + struct hdmi_tg_regs *tg = &hdata->mode_conf.v14_conf.tg; + struct hdmi_v14_core_regs *core = &hdata->mode_conf.v14_conf.core; hdmi_set_reg(core->h_blank, 2, m->htotal - m->hdisplay); hdmi_set_reg(core->v_line, 2, m->vtotal); @@ -2297,9 +2288,7 @@ static void hdmi_mode_set(struct exynos_drm_display *display, /* preserve mode information for later use. */ drm_mode_copy(&hdata->current_mode, mode); - hdata->mode_conf.cea_video_id = drm_match_cea_mode(m); - hdata->mode_conf.pixel_clock = m->clock * 1000; - hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio; + hdata->cea_video_id = drm_match_cea_mode(mode); if (hdata->type == HDMI_TYPE13) hdmi_v13_mode_set(hdata, mode); -- cgit v1.2.3