From patchwork Tue Jun 11 14:11:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 2704281 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D5F3240079 for ; Tue, 11 Jun 2013 13:49:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750974Ab3FKNts (ORCPT ); Tue, 11 Jun 2013 09:49:48 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:35434 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752657Ab3FKNtG (ORCPT ); Tue, 11 Jun 2013 09:49:06 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MO8006HBEDSGHH0@mailout3.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 11 Jun 2013 22:49:05 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id B5.C5.03969.0DA27B15; Tue, 11 Jun 2013 22:49:04 +0900 (KST) X-AuditID: cbfee68f-b7f436d000000f81-8b-51b72ad0c996 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 96.AD.28381.0DA27B15; Tue, 11 Jun 2013 22:49:04 +0900 (KST) Received: from chromeserver-PowerEdge-T410.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MO80097REB7UU70@mmp2.samsung.com>; Tue, 11 Jun 2013 22:49:04 +0900 (KST) From: Rahul Sharma To: linux-samsung-soc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, dri-devel@lists.freedesktop.org Cc: kgene.kim@samsung.com, sw0312.kim@samsung.com, inki.dae@samsung.com, joshi@samsung.com, r.sh.open@gmail.com, Rahul Sharma Subject: [PATCH 1/9] drm/exynos: use SoC name to identify hdmi version Date: Tue, 11 Jun 2013 19:41:23 +0530 Message-id: <1370959891-8923-2-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1370959891-8923-1-git-send-email-rahul.sharma@samsung.com> References: <1370959891-8923-1-git-send-email-rahul.sharma@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeLIzCtJLcpLzFFi42JZI2JSp3tBa3ugwbWHFhYHZj9ktbjy9T2b xaT7E1gsvu/6wm7Ru+Aqm8WM8/uYLBa+iLeYsugwq8WMyS/ZHDg9ds66y+5xv/s4k8f5GQsZ Pfq2rGL0+LxJLoA1issmJTUnsyy1SN8ugStjb/t8poLZJxkrfjzQaGDsWsvYxcjJISFgItHV cAHKFpO4cG89WxcjF4eQwFJGiVvTQRyIotkbDjFDJKYzStzd2s8I4cxmkrh0ZAcrSBWbgK7E 7IPPwEaJCORKNPxtZwEpYhaYxSjxffYZdpCEsICbxK21O1lAbBYBVYkJb9cwgdi8Au4S/Z1v mCHWKUp0P5sAtppTwEOip+ESWFwIqKbxTzPYZgmBdewSDcv3MEEMEpD4NvkQ0FAOoISsxKYD UHMkJQ6uuMEygVF4ASPDKkbR1ILkguKk9CJjveLE3OLSvHS95PzcTYzA8D/971n/Dsa7B6wP MSYDjZvILCWanA+Mn7ySeENjMyMLUxNTYyNzSzPShJXEedVarAOFBNITS1KzU1MLUovii0pz UosPMTJxcEo1MLb0s68py7u/4rTNvNKFO/dv1P86/coxk3fy/btnrWmMVuRlWdp8RU7E9JpC /uq4zedkW7Zuue//MXXfzSlnmPK8n+rbV0vKrrmg9/rR5IpUYc3N0csPvFsxJd7yT6bUhmVz zHcublcKcJhn3rLkYvOt0/9TDsy4Hsyz30P8gKHH3+0K82Qq5nQqsRRnJBpqMRcVJwIADMP0 q5UCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsVy+t9jQd0LWtsDDRa+0rI4MPshq8WVr+/Z LCbdn8Bi8X3XF3aL3gVX2SxmnN/HZLHwRbzFlEWHWS1mTH7J5sDpsXPWXXaP+93HmTzOz1jI 6NG3ZRWjx+dNcgGsUQ2MNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2 Si4+AbpumTlABykplCXmlAKFAhKLi5X07TBNCA1x07WAaYzQ9Q0JgusxMkADCWsYM/a2z2cq mH2SseLHA40Gxq61jF2MnBwSAiYSszccYoawxSQu3FvP1sXIxSEkMJ1R4u7WfkYIZzaTxKUj O1hBqtgEdCVmH3wG1i0ikCvR8LedBaSIWWAWo8T32WfYQRLCAm4St9buZAGxWQRUJSa8XcME YvMKuEv0d76BWqco0f1sAhuIzSngIdHTcAksLgRU0/inmXECI+8CRoZVjKKpBckFxUnpuYZ6 xYm5xaV56XrJ+bmbGMHR9UxqB+PKBotDjAIcjEo8vAmM2wKFWBPLiitzDzFKcDArifA2ym0P FOJNSaysSi3Kjy8qzUktPsSYDHTVRGYp0eR8YOTnlcQbGpuYmxqbWppYmJhZkiasJM57oNU6 UEggPbEkNTs1tSC1CGYLEwenVAOjrmbRF4blXX/tgj+5urpP4vw5X3nR69TVqx++cy0zCt4d P7WmKlU17MvZRNb3h5Zv17K3Tm9ZwKodsGC1lJ1KQ5L/lhmPZOKmuQvJZPREmzc90jmcvu7J pU/1ZZ1L9nO02bKrxa+tqe/ew77Q99/87dkllz/yf4+Yut8qs3DKuYmVP09dTlFSYinOSDTU Yi4qTgQARrO69PICAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Exynos hdmi IP version is named after hdmi specification version i.e. 1.3 and 1.4. This versioning mechanism is not sufficient to handle the diversity in the hdmi/phy IPs which are present across the exynos SoC family. This patch changes the hdmi version to the name of the SoC in which the IP was introduced for the first time. Same version is applicable to all subsequent SoCs having the same IP version. Exynos4210 has 1.3 HDMI, i2c mapped phy with configuration set. Exynos5250 has 1.4 HDMI, i2c mapped phy with configuration set. Exynos5420 has 1.4 HDMI, Platform Bus mapped phy with configuration set. Based on the HDMI IP version we cannot decide to pick Exynos5250 phy conf and use i2c for data transfer or Exynos5420 phy confs and platform bus calls for communication. Signed-off-by: Rahul Sharma --- drivers/gpu/drm/exynos/exynos_hdmi.c | 249 +++++++++++++++++----------------- drivers/gpu/drm/exynos/regs-hdmi.h | 78 +++++------ 2 files changed, 164 insertions(+), 163 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 75a6bf3..9384ffc 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -73,9 +73,9 @@ enum HDMI_PACKET_TYPE { HDMI_PACKET_TYPE_AUI = HDMI_PACKET_TYPE_INFOFRAME + 4 }; -enum hdmi_type { - HDMI_TYPE13, - HDMI_TYPE14, +enum hdmi_version { + HDMI_VER_EXYNOS4210, + HDMI_VER_EXYNOS4212, }; struct hdmi_resources { @@ -109,7 +109,7 @@ struct hdmi_tg_regs { u8 tg_3d[1]; }; -struct hdmi_v13_core_regs { +struct hdmi_4210_core_regs { u8 h_blank[2]; u8 v_blank[3]; u8 h_v_line[3]; @@ -122,7 +122,7 @@ struct hdmi_v13_core_regs { u8 v_sync_gen3[3]; }; -struct hdmi_v14_core_regs { +struct hdmi_4212_core_regs { u8 h_blank[2]; u8 v2_blank[2]; u8 v1_blank[2]; @@ -161,13 +161,13 @@ struct hdmi_v14_core_regs { u8 vact_space_6[2]; }; -struct hdmi_v13_conf { - struct hdmi_v13_core_regs core; +struct hdmi_4210_conf { + struct hdmi_4210_core_regs core; struct hdmi_tg_regs tg; }; -struct hdmi_v14_conf { - struct hdmi_v14_core_regs core; +struct hdmi_4212_conf { + struct hdmi_4212_core_regs core; struct hdmi_tg_regs tg; }; @@ -175,8 +175,8 @@ struct hdmi_conf_regs { int pixel_clock; int cea_video_id; union { - struct hdmi_v13_conf v13_conf; - struct hdmi_v14_conf v14_conf; + struct hdmi_4210_conf v4210_conf; + struct hdmi_4212_conf v4212_conf; } conf; }; @@ -203,7 +203,7 @@ struct hdmi_context { int hpd_gpio; - enum hdmi_type type; + enum hdmi_version version; }; struct hdmiphy_config { @@ -212,7 +212,7 @@ struct hdmiphy_config { }; /* list of phy config settings */ -static const struct hdmiphy_config hdmiphy_v13_configs[] = { +static const struct hdmiphy_config hdmiphy_4210_configs[] = { { .pixel_clock = 27000000, .conf = { @@ -260,7 +260,7 @@ static const struct hdmiphy_config hdmiphy_v13_configs[] = { }, }; -static const struct hdmiphy_config hdmiphy_v14_configs[] = { +static const struct hdmiphy_config hdmiphy_4212_configs[] = { { .pixel_clock = 25200000, .conf = { @@ -413,7 +413,7 @@ static inline void hdmi_phy_pow_ctrl_reg_writemask(struct hdmi_context *hdata, writel(value, hdata->phy_pow_ctrl_reg); } -static void hdmi_v13_regs_dump(struct hdmi_context *hdata, char *prefix) +static void hdmi_4210_regs_dump(struct hdmi_context *hdata, char *prefix) { #define DUMPREG(reg_id) \ DRM_DEBUG_KMS("%s:" #reg_id " = %08x\n", prefix, \ @@ -422,50 +422,50 @@ static void hdmi_v13_regs_dump(struct hdmi_context *hdata, char *prefix) DUMPREG(HDMI_INTC_FLAG); DUMPREG(HDMI_INTC_CON); DUMPREG(HDMI_HPD_STATUS); - DUMPREG(HDMI_V13_PHY_RSTOUT); - DUMPREG(HDMI_V13_PHY_VPLL); - DUMPREG(HDMI_V13_PHY_CMU); - DUMPREG(HDMI_V13_CORE_RSTOUT); + DUMPREG(HDMI_4210_PHY_RSTOUT); + DUMPREG(HDMI_4210_PHY_VPLL); + DUMPREG(HDMI_4210_PHY_CMU); + DUMPREG(HDMI_4210_CORE_RSTOUT); DRM_DEBUG_KMS("%s: ---- CORE REGISTERS ----\n", prefix); DUMPREG(HDMI_CON_0); DUMPREG(HDMI_CON_1); DUMPREG(HDMI_CON_2); DUMPREG(HDMI_SYS_STATUS); - DUMPREG(HDMI_V13_PHY_STATUS); + DUMPREG(HDMI_4210_PHY_STATUS); DUMPREG(HDMI_STATUS_EN); DUMPREG(HDMI_HPD); DUMPREG(HDMI_MODE_SEL); - DUMPREG(HDMI_V13_HPD_GEN); - DUMPREG(HDMI_V13_DC_CONTROL); - DUMPREG(HDMI_V13_VIDEO_PATTERN_GEN); + DUMPREG(HDMI_4210_HPD_GEN); + DUMPREG(HDMI_4210_DC_CONTROL); + DUMPREG(HDMI_4210_VIDEO_PATTERN_GEN); DRM_DEBUG_KMS("%s: ---- CORE SYNC REGISTERS ----\n", prefix); DUMPREG(HDMI_H_BLANK_0); DUMPREG(HDMI_H_BLANK_1); - DUMPREG(HDMI_V13_V_BLANK_0); - DUMPREG(HDMI_V13_V_BLANK_1); - DUMPREG(HDMI_V13_V_BLANK_2); - DUMPREG(HDMI_V13_H_V_LINE_0); - DUMPREG(HDMI_V13_H_V_LINE_1); - DUMPREG(HDMI_V13_H_V_LINE_2); + DUMPREG(HDMI_4210_V_BLANK_0); + DUMPREG(HDMI_4210_V_BLANK_1); + DUMPREG(HDMI_4210_V_BLANK_2); + DUMPREG(HDMI_4210_H_V_LINE_0); + DUMPREG(HDMI_4210_H_V_LINE_1); + DUMPREG(HDMI_4210_H_V_LINE_2); DUMPREG(HDMI_VSYNC_POL); DUMPREG(HDMI_INT_PRO_MODE); - DUMPREG(HDMI_V13_V_BLANK_F_0); - DUMPREG(HDMI_V13_V_BLANK_F_1); - DUMPREG(HDMI_V13_V_BLANK_F_2); - DUMPREG(HDMI_V13_H_SYNC_GEN_0); - DUMPREG(HDMI_V13_H_SYNC_GEN_1); - DUMPREG(HDMI_V13_H_SYNC_GEN_2); - DUMPREG(HDMI_V13_V_SYNC_GEN_1_0); - DUMPREG(HDMI_V13_V_SYNC_GEN_1_1); - DUMPREG(HDMI_V13_V_SYNC_GEN_1_2); - DUMPREG(HDMI_V13_V_SYNC_GEN_2_0); - DUMPREG(HDMI_V13_V_SYNC_GEN_2_1); - DUMPREG(HDMI_V13_V_SYNC_GEN_2_2); - DUMPREG(HDMI_V13_V_SYNC_GEN_3_0); - DUMPREG(HDMI_V13_V_SYNC_GEN_3_1); - DUMPREG(HDMI_V13_V_SYNC_GEN_3_2); + DUMPREG(HDMI_4210_V_BLANK_F_0); + DUMPREG(HDMI_4210_V_BLANK_F_1); + DUMPREG(HDMI_4210_V_BLANK_F_2); + DUMPREG(HDMI_4210_H_SYNC_GEN_0); + DUMPREG(HDMI_4210_H_SYNC_GEN_1); + DUMPREG(HDMI_4210_H_SYNC_GEN_2); + DUMPREG(HDMI_4210_V_SYNC_GEN_1_0); + DUMPREG(HDMI_4210_V_SYNC_GEN_1_1); + DUMPREG(HDMI_4210_V_SYNC_GEN_1_2); + DUMPREG(HDMI_4210_V_SYNC_GEN_2_0); + DUMPREG(HDMI_4210_V_SYNC_GEN_2_1); + DUMPREG(HDMI_4210_V_SYNC_GEN_2_2); + DUMPREG(HDMI_4210_V_SYNC_GEN_3_0); + DUMPREG(HDMI_4210_V_SYNC_GEN_3_1); + DUMPREG(HDMI_4210_V_SYNC_GEN_3_2); DRM_DEBUG_KMS("%s: ---- TG REGISTERS ----\n", prefix); DUMPREG(HDMI_TG_CMD); @@ -500,7 +500,7 @@ static void hdmi_v13_regs_dump(struct hdmi_context *hdata, char *prefix) #undef DUMPREG } -static void hdmi_v14_regs_dump(struct hdmi_context *hdata, char *prefix) +static void hdmi_4212_regs_dump(struct hdmi_context *hdata, char *prefix) { int i; @@ -669,10 +669,10 @@ static void hdmi_v14_regs_dump(struct hdmi_context *hdata, char *prefix) static void hdmi_regs_dump(struct hdmi_context *hdata, char *prefix) { - if (hdata->type == HDMI_TYPE13) - hdmi_v13_regs_dump(hdata, prefix); + if (hdata->version == HDMI_VER_EXYNOS4210) + hdmi_4210_regs_dump(hdata, prefix); else - hdmi_v14_regs_dump(hdata, prefix); + hdmi_4212_regs_dump(hdata, prefix); } static u8 hdmi_chksum(struct hdmi_context *hdata, @@ -789,12 +789,12 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock) DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); - if (hdata->type == HDMI_TYPE13) { - confs = hdmiphy_v13_configs; - count = ARRAY_SIZE(hdmiphy_v13_configs); - } else if (hdata->type == HDMI_TYPE14) { - confs = hdmiphy_v14_configs; - count = ARRAY_SIZE(hdmiphy_v14_configs); + if (hdata->version == HDMI_VER_EXYNOS4210) { + confs = hdmiphy_4210_configs; + count = ARRAY_SIZE(hdmiphy_4210_configs); + } else if (hdata->version == HDMI_VER_EXYNOS4212) { + confs = hdmiphy_4212_configs; + count = ARRAY_SIZE(hdmiphy_4212_configs); } else return -EINVAL; @@ -882,8 +882,8 @@ static void hdmi_reg_acr(struct hdmi_context *hdata, u8 *acr) hdmi_reg_writeb(hdata, HDMI_ACR_CTS1, acr[2]); hdmi_reg_writeb(hdata, HDMI_ACR_CTS2, acr[1]); - if (hdata->type == HDMI_TYPE13) - hdmi_reg_writeb(hdata, HDMI_V13_ACR_CON, 4); + if (hdata->version == HDMI_VER_EXYNOS4210) + hdmi_reg_writeb(hdata, HDMI_4210_ACR_CON, 4); else hdmi_reg_writeb(hdata, HDMI_ACR_CON, 4); } @@ -986,8 +986,8 @@ static void hdmi_conf_reset(struct hdmi_context *hdata) { u32 reg; - if (hdata->type == HDMI_TYPE13) - reg = HDMI_V13_CORE_RSTOUT; + if (hdata->version == HDMI_VER_EXYNOS4210) + reg = HDMI_4210_CORE_RSTOUT; else reg = HDMI_CORE_RSTOUT; @@ -1020,21 +1020,21 @@ static void hdmi_conf_init(struct hdmi_context *hdata) HDMI_VID_PREAMBLE_DIS | HDMI_GUARD_BAND_DIS); } - if (hdata->type == HDMI_TYPE13) { + if (hdata->version == HDMI_VER_EXYNOS4210) { /* choose bluescreen (fecal) color */ - hdmi_reg_writeb(hdata, HDMI_V13_BLUE_SCREEN_0, 0x12); - hdmi_reg_writeb(hdata, HDMI_V13_BLUE_SCREEN_1, 0x34); - hdmi_reg_writeb(hdata, HDMI_V13_BLUE_SCREEN_2, 0x56); + hdmi_reg_writeb(hdata, HDMI_4210_BLUE_SCREEN_0, 0x12); + hdmi_reg_writeb(hdata, HDMI_4210_BLUE_SCREEN_1, 0x34); + hdmi_reg_writeb(hdata, HDMI_4210_BLUE_SCREEN_2, 0x56); /* enable AVI packet every vsync, fixes purple line problem */ - hdmi_reg_writeb(hdata, HDMI_V13_AVI_CON, 0x02); + hdmi_reg_writeb(hdata, HDMI_4210_AVI_CON, 0x02); /* force RGB, look to CEA-861-D, table 7 for more detail */ - hdmi_reg_writeb(hdata, HDMI_V13_AVI_BYTE(0), 0 << 5); + hdmi_reg_writeb(hdata, HDMI_4210_AVI_BYTE(0), 0 << 5); hdmi_reg_writemask(hdata, HDMI_CON_1, 0x10 << 5, 0x11 << 5); - hdmi_reg_writeb(hdata, HDMI_V13_SPD_CON, 0x02); - hdmi_reg_writeb(hdata, HDMI_V13_AUI_CON, 0x02); - hdmi_reg_writeb(hdata, HDMI_V13_ACR_CON, 0x04); + hdmi_reg_writeb(hdata, HDMI_4210_SPD_CON, 0x02); + hdmi_reg_writeb(hdata, HDMI_4210_AUI_CON, 0x02); + hdmi_reg_writeb(hdata, HDMI_4210_ACR_CON, 0x04); } else { infoframe.type = HDMI_PACKET_TYPE_AVI; infoframe.ver = HDMI_AVI_VERSION; @@ -1051,39 +1051,39 @@ static void hdmi_conf_init(struct hdmi_context *hdata) } } -static void hdmi_v13_mode_apply(struct hdmi_context *hdata) +static void hdmi_4210_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.conf.v4210_conf.tg; + const struct hdmi_4210_core_regs *core = + &hdata->mode_conf.conf.v4210_conf.core; int tries; /* setting core registers */ hdmi_reg_writeb(hdata, HDMI_H_BLANK_0, core->h_blank[0]); hdmi_reg_writeb(hdata, HDMI_H_BLANK_1, core->h_blank[1]); - hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_0, core->v_blank[0]); - hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_1, core->v_blank[1]); - hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_2, core->v_blank[2]); - hdmi_reg_writeb(hdata, HDMI_V13_H_V_LINE_0, core->h_v_line[0]); - hdmi_reg_writeb(hdata, HDMI_V13_H_V_LINE_1, core->h_v_line[1]); - hdmi_reg_writeb(hdata, HDMI_V13_H_V_LINE_2, core->h_v_line[2]); + hdmi_reg_writeb(hdata, HDMI_4210_V_BLANK_0, core->v_blank[0]); + hdmi_reg_writeb(hdata, HDMI_4210_V_BLANK_1, core->v_blank[1]); + hdmi_reg_writeb(hdata, HDMI_4210_V_BLANK_2, core->v_blank[2]); + hdmi_reg_writeb(hdata, HDMI_4210_H_V_LINE_0, core->h_v_line[0]); + hdmi_reg_writeb(hdata, HDMI_4210_H_V_LINE_1, core->h_v_line[1]); + hdmi_reg_writeb(hdata, HDMI_4210_H_V_LINE_2, core->h_v_line[2]); hdmi_reg_writeb(hdata, HDMI_VSYNC_POL, core->vsync_pol[0]); hdmi_reg_writeb(hdata, HDMI_INT_PRO_MODE, core->int_pro_mode[0]); - hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_F_0, core->v_blank_f[0]); - hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_F_1, core->v_blank_f[1]); - hdmi_reg_writeb(hdata, HDMI_V13_V_BLANK_F_2, core->v_blank_f[2]); - hdmi_reg_writeb(hdata, HDMI_V13_H_SYNC_GEN_0, core->h_sync_gen[0]); - hdmi_reg_writeb(hdata, HDMI_V13_H_SYNC_GEN_1, core->h_sync_gen[1]); - hdmi_reg_writeb(hdata, HDMI_V13_H_SYNC_GEN_2, core->h_sync_gen[2]); - hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_1_0, core->v_sync_gen1[0]); - hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_1_1, core->v_sync_gen1[1]); - hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_1_2, core->v_sync_gen1[2]); - hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_2_0, core->v_sync_gen2[0]); - hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_2_1, core->v_sync_gen2[1]); - hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_2_2, core->v_sync_gen2[2]); - hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_3_0, core->v_sync_gen3[0]); - hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_3_1, core->v_sync_gen3[1]); - hdmi_reg_writeb(hdata, HDMI_V13_V_SYNC_GEN_3_2, core->v_sync_gen3[2]); + hdmi_reg_writeb(hdata, HDMI_4210_V_BLANK_F_0, core->v_blank_f[0]); + hdmi_reg_writeb(hdata, HDMI_4210_V_BLANK_F_1, core->v_blank_f[1]); + hdmi_reg_writeb(hdata, HDMI_4210_V_BLANK_F_2, core->v_blank_f[2]); + hdmi_reg_writeb(hdata, HDMI_4210_H_SYNC_GEN_0, core->h_sync_gen[0]); + hdmi_reg_writeb(hdata, HDMI_4210_H_SYNC_GEN_1, core->h_sync_gen[1]); + hdmi_reg_writeb(hdata, HDMI_4210_H_SYNC_GEN_2, core->h_sync_gen[2]); + hdmi_reg_writeb(hdata, HDMI_4210_V_SYNC_GEN_1_0, core->v_sync_gen1[0]); + hdmi_reg_writeb(hdata, HDMI_4210_V_SYNC_GEN_1_1, core->v_sync_gen1[1]); + hdmi_reg_writeb(hdata, HDMI_4210_V_SYNC_GEN_1_2, core->v_sync_gen1[2]); + hdmi_reg_writeb(hdata, HDMI_4210_V_SYNC_GEN_2_0, core->v_sync_gen2[0]); + hdmi_reg_writeb(hdata, HDMI_4210_V_SYNC_GEN_2_1, core->v_sync_gen2[1]); + hdmi_reg_writeb(hdata, HDMI_4210_V_SYNC_GEN_2_2, core->v_sync_gen2[2]); + hdmi_reg_writeb(hdata, HDMI_4210_V_SYNC_GEN_3_0, core->v_sync_gen3[0]); + hdmi_reg_writeb(hdata, HDMI_4210_V_SYNC_GEN_3_1, core->v_sync_gen3[1]); + hdmi_reg_writeb(hdata, HDMI_4210_V_SYNC_GEN_3_2, core->v_sync_gen3[2]); /* Timing generator registers */ hdmi_reg_writeb(hdata, HDMI_TG_H_FSZ_L, tg->h_fsz[0]); hdmi_reg_writeb(hdata, HDMI_TG_H_FSZ_H, tg->h_fsz[1]); @@ -1116,7 +1116,7 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata) /* waiting for HDMIPHY's PLL to get to steady state */ for (tries = 100; tries; --tries) { - u32 val = hdmi_reg_read(hdata, HDMI_V13_PHY_STATUS); + u32 val = hdmi_reg_read(hdata, HDMI_4210_PHY_STATUS); if (val & HDMI_PHY_STATUS_READY) break; usleep_range(1000, 2000); @@ -1140,11 +1140,11 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata) hdmi_reg_writemask(hdata, HDMI_TG_CMD, ~0, HDMI_TG_EN); } -static void hdmi_v14_mode_apply(struct hdmi_context *hdata) +static void hdmi_4212_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.conf.v4212_conf.tg; + const struct hdmi_4212_core_regs *core = + &hdata->mode_conf.conf.v4212_conf.core; int tries; /* setting core registers */ @@ -1309,10 +1309,10 @@ static void hdmi_v14_mode_apply(struct hdmi_context *hdata) static void hdmi_mode_apply(struct hdmi_context *hdata) { - if (hdata->type == HDMI_TYPE13) - hdmi_v13_mode_apply(hdata); + if (hdata->version == HDMI_VER_EXYNOS4210) + hdmi_4210_mode_apply(hdata); else - hdmi_v14_mode_apply(hdata); + hdmi_4212_mode_apply(hdata); } static void hdmiphy_conf_reset(struct hdmi_context *hdata) @@ -1331,8 +1331,8 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata) if (hdata->hdmiphy_port) i2c_master_send(hdata->hdmiphy_port, buffer, 2); - if (hdata->type == HDMI_TYPE13) - reg = HDMI_V13_PHY_RSTOUT; + if (hdata->version == HDMI_VER_EXYNOS4210) + reg = HDMI_4210_PHY_RSTOUT; else reg = HDMI_PHY_RSTOUT; @@ -1347,7 +1347,7 @@ static void hdmiphy_poweron(struct hdmi_context *hdata) { DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); - if (hdata->type == HDMI_TYPE14) + if (hdata->version != HDMI_VER_EXYNOS4210) hdmi_reg_writemask(hdata, HDMI_PHY_CON_0, 0, HDMI_PHY_POWER_OFF_EN); } @@ -1356,7 +1356,7 @@ static void hdmiphy_poweroff(struct hdmi_context *hdata) { DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); - if (hdata->type == HDMI_TYPE14) + if (hdata->version != HDMI_VER_EXYNOS4210) hdmi_reg_writemask(hdata, HDMI_PHY_CON_0, ~0, HDMI_PHY_POWER_OFF_EN); } @@ -1382,10 +1382,10 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata) return; } - if (hdata->type == HDMI_TYPE13) - hdmiphy_data = hdmiphy_v13_configs[i].conf; + if (hdata->version == HDMI_VER_EXYNOS4210) + hdmiphy_data = hdmiphy_4210_configs[i].conf; else - hdmiphy_data = hdmiphy_v14_configs[i].conf; + hdmiphy_data = hdmiphy_4212_configs[i].conf; memcpy(buffer, hdmiphy_data, 32); ret = i2c_master_send(hdata->hdmiphy_port, buffer, 32); @@ -1446,11 +1446,12 @@ static void hdmi_set_reg(u8 *reg_pair, int num_bytes, u32 value) reg_pair[i] = (value >> (8 * i)) & 0xff; } -static void hdmi_v13_mode_set(struct hdmi_context *hdata, +static void hdmi_4210_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_4210_core_regs *core = + &hdata->mode_conf.conf.v4210_conf.core; + struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v4210_conf.tg; unsigned int val; hdata->mode_conf.cea_video_id = @@ -1542,12 +1543,12 @@ static void hdmi_v13_mode_set(struct hdmi_context *hdata, hdmi_set_reg(tg->tg_3d, 1, 0x0); /* Not used */ } -static void hdmi_v14_mode_set(struct hdmi_context *hdata, +static void hdmi_4212_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.conf.v4212_conf.tg; + struct hdmi_4212_core_regs *core = + &hdata->mode_conf.conf.v4212_conf.core; hdata->mode_conf.cea_video_id = drm_match_cea_mode((struct drm_display_mode *)m); @@ -1661,10 +1662,10 @@ static void hdmi_mode_set(void *ctx, struct drm_display_mode *mode) m->vrefresh, (m->flags & DRM_MODE_FLAG_INTERLACE) ? "INTERLACED" : "PROGERESSIVE"); - if (hdata->type == HDMI_TYPE13) - hdmi_v13_mode_set(hdata, mode); + if (hdata->version == HDMI_VER_EXYNOS4210) + hdmi_4210_mode_set(hdata, mode); else - hdmi_v14_mode_set(hdata, mode); + hdmi_4212_mode_set(hdata, mode); } static void hdmi_get_max_resol(void *ctx, unsigned int *width, @@ -1962,16 +1963,16 @@ static int drm_hdmi_dt_parse_phy_pow_control(struct hdmi_context *hdata) static struct platform_device_id hdmi_driver_types[] = { { .name = "s5pv210-hdmi", - .driver_data = HDMI_TYPE13, + .driver_data = HDMI_VER_EXYNOS4210, }, { .name = "exynos4-hdmi", - .driver_data = HDMI_TYPE13, + .driver_data = HDMI_VER_EXYNOS4210, }, { .name = "exynos4-hdmi14", - .driver_data = HDMI_TYPE14, + .driver_data = HDMI_VER_EXYNOS4212, }, { .name = "exynos5-hdmi", - .driver_data = HDMI_TYPE14, + .driver_data = HDMI_VER_EXYNOS4212, }, { /* end node */ } @@ -1981,7 +1982,7 @@ static struct platform_device_id hdmi_driver_types[] = { static struct of_device_id hdmi_match_types[] = { { .compatible = "samsung,exynos5-hdmi", - .data = (void *)HDMI_TYPE14, + .data = (void *)HDMI_VER_EXYNOS4212, }, { /* end node */ } @@ -2041,9 +2042,9 @@ static int hdmi_probe(struct platform_device *pdev) dev->of_node); if (match == NULL) return -ENODEV; - hdata->type = (enum hdmi_type)match->data; + hdata->version = (enum hdmi_version)match->data; } else { - hdata->type = (enum hdmi_type)platform_get_device_id + hdata->version = (enum hdmi_version)platform_get_device_id (pdev)->driver_data; } diff --git a/drivers/gpu/drm/exynos/regs-hdmi.h b/drivers/gpu/drm/exynos/regs-hdmi.h index 8d9ca25..e169847 100644 --- a/drivers/gpu/drm/exynos/regs-hdmi.h +++ b/drivers/gpu/drm/exynos/regs-hdmi.h @@ -19,7 +19,7 @@ * Register part */ -/* HDMI Version 1.3 & Common */ +/* HDMI Registers in Exynos4210 & Common to other soc */ #define HDMI_CTRL_BASE(x) ((x) + 0x00000000) #define HDMI_CORE_BASE(x) ((x) + 0x00010000) #define HDMI_I2S_BASE(x) ((x) + 0x00040000) @@ -29,57 +29,57 @@ #define HDMI_INTC_CON HDMI_CTRL_BASE(0x0000) #define HDMI_INTC_FLAG HDMI_CTRL_BASE(0x0004) #define HDMI_HPD_STATUS HDMI_CTRL_BASE(0x000C) -#define HDMI_V13_PHY_RSTOUT HDMI_CTRL_BASE(0x0014) -#define HDMI_V13_PHY_VPLL HDMI_CTRL_BASE(0x0018) -#define HDMI_V13_PHY_CMU HDMI_CTRL_BASE(0x001C) -#define HDMI_V13_CORE_RSTOUT HDMI_CTRL_BASE(0x0020) +#define HDMI_4210_PHY_RSTOUT HDMI_CTRL_BASE(0x0014) +#define HDMI_4210_PHY_VPLL HDMI_CTRL_BASE(0x0018) +#define HDMI_4210_PHY_CMU HDMI_CTRL_BASE(0x001C) +#define HDMI_4210_CORE_RSTOUT HDMI_CTRL_BASE(0x0020) /* Core registers */ #define HDMI_CON_0 HDMI_CORE_BASE(0x0000) #define HDMI_CON_1 HDMI_CORE_BASE(0x0004) #define HDMI_CON_2 HDMI_CORE_BASE(0x0008) #define HDMI_SYS_STATUS HDMI_CORE_BASE(0x0010) -#define HDMI_V13_PHY_STATUS HDMI_CORE_BASE(0x0014) +#define HDMI_4210_PHY_STATUS HDMI_CORE_BASE(0x0014) #define HDMI_STATUS_EN HDMI_CORE_BASE(0x0020) #define HDMI_HPD HDMI_CORE_BASE(0x0030) #define HDMI_MODE_SEL HDMI_CORE_BASE(0x0040) #define HDMI_ENC_EN HDMI_CORE_BASE(0x0044) -#define HDMI_V13_BLUE_SCREEN_0 HDMI_CORE_BASE(0x0050) -#define HDMI_V13_BLUE_SCREEN_1 HDMI_CORE_BASE(0x0054) -#define HDMI_V13_BLUE_SCREEN_2 HDMI_CORE_BASE(0x0058) +#define HDMI_4210_BLUE_SCREEN_0 HDMI_CORE_BASE(0x0050) +#define HDMI_4210_BLUE_SCREEN_1 HDMI_CORE_BASE(0x0054) +#define HDMI_4210_BLUE_SCREEN_2 HDMI_CORE_BASE(0x0058) #define HDMI_H_BLANK_0 HDMI_CORE_BASE(0x00A0) #define HDMI_H_BLANK_1 HDMI_CORE_BASE(0x00A4) -#define HDMI_V13_V_BLANK_0 HDMI_CORE_BASE(0x00B0) -#define HDMI_V13_V_BLANK_1 HDMI_CORE_BASE(0x00B4) -#define HDMI_V13_V_BLANK_2 HDMI_CORE_BASE(0x00B8) -#define HDMI_V13_H_V_LINE_0 HDMI_CORE_BASE(0x00C0) -#define HDMI_V13_H_V_LINE_1 HDMI_CORE_BASE(0x00C4) -#define HDMI_V13_H_V_LINE_2 HDMI_CORE_BASE(0x00C8) +#define HDMI_4210_V_BLANK_0 HDMI_CORE_BASE(0x00B0) +#define HDMI_4210_V_BLANK_1 HDMI_CORE_BASE(0x00B4) +#define HDMI_4210_V_BLANK_2 HDMI_CORE_BASE(0x00B8) +#define HDMI_4210_H_V_LINE_0 HDMI_CORE_BASE(0x00C0) +#define HDMI_4210_H_V_LINE_1 HDMI_CORE_BASE(0x00C4) +#define HDMI_4210_H_V_LINE_2 HDMI_CORE_BASE(0x00C8) #define HDMI_VSYNC_POL HDMI_CORE_BASE(0x00E4) #define HDMI_INT_PRO_MODE HDMI_CORE_BASE(0x00E8) -#define HDMI_V13_V_BLANK_F_0 HDMI_CORE_BASE(0x0110) -#define HDMI_V13_V_BLANK_F_1 HDMI_CORE_BASE(0x0114) -#define HDMI_V13_V_BLANK_F_2 HDMI_CORE_BASE(0x0118) -#define HDMI_V13_H_SYNC_GEN_0 HDMI_CORE_BASE(0x0120) -#define HDMI_V13_H_SYNC_GEN_1 HDMI_CORE_BASE(0x0124) -#define HDMI_V13_H_SYNC_GEN_2 HDMI_CORE_BASE(0x0128) -#define HDMI_V13_V_SYNC_GEN_1_0 HDMI_CORE_BASE(0x0130) -#define HDMI_V13_V_SYNC_GEN_1_1 HDMI_CORE_BASE(0x0134) -#define HDMI_V13_V_SYNC_GEN_1_2 HDMI_CORE_BASE(0x0138) -#define HDMI_V13_V_SYNC_GEN_2_0 HDMI_CORE_BASE(0x0140) -#define HDMI_V13_V_SYNC_GEN_2_1 HDMI_CORE_BASE(0x0144) -#define HDMI_V13_V_SYNC_GEN_2_2 HDMI_CORE_BASE(0x0148) -#define HDMI_V13_V_SYNC_GEN_3_0 HDMI_CORE_BASE(0x0150) -#define HDMI_V13_V_SYNC_GEN_3_1 HDMI_CORE_BASE(0x0154) -#define HDMI_V13_V_SYNC_GEN_3_2 HDMI_CORE_BASE(0x0158) -#define HDMI_V13_ACR_CON HDMI_CORE_BASE(0x0180) -#define HDMI_V13_AVI_CON HDMI_CORE_BASE(0x0300) -#define HDMI_V13_AVI_BYTE(n) HDMI_CORE_BASE(0x0320 + 4 * (n)) -#define HDMI_V13_DC_CONTROL HDMI_CORE_BASE(0x05C0) -#define HDMI_V13_VIDEO_PATTERN_GEN HDMI_CORE_BASE(0x05C4) -#define HDMI_V13_HPD_GEN HDMI_CORE_BASE(0x05C8) -#define HDMI_V13_AUI_CON HDMI_CORE_BASE(0x0360) -#define HDMI_V13_SPD_CON HDMI_CORE_BASE(0x0400) +#define HDMI_4210_V_BLANK_F_0 HDMI_CORE_BASE(0x0110) +#define HDMI_4210_V_BLANK_F_1 HDMI_CORE_BASE(0x0114) +#define HDMI_4210_V_BLANK_F_2 HDMI_CORE_BASE(0x0118) +#define HDMI_4210_H_SYNC_GEN_0 HDMI_CORE_BASE(0x0120) +#define HDMI_4210_H_SYNC_GEN_1 HDMI_CORE_BASE(0x0124) +#define HDMI_4210_H_SYNC_GEN_2 HDMI_CORE_BASE(0x0128) +#define HDMI_4210_V_SYNC_GEN_1_0 HDMI_CORE_BASE(0x0130) +#define HDMI_4210_V_SYNC_GEN_1_1 HDMI_CORE_BASE(0x0134) +#define HDMI_4210_V_SYNC_GEN_1_2 HDMI_CORE_BASE(0x0138) +#define HDMI_4210_V_SYNC_GEN_2_0 HDMI_CORE_BASE(0x0140) +#define HDMI_4210_V_SYNC_GEN_2_1 HDMI_CORE_BASE(0x0144) +#define HDMI_4210_V_SYNC_GEN_2_2 HDMI_CORE_BASE(0x0148) +#define HDMI_4210_V_SYNC_GEN_3_0 HDMI_CORE_BASE(0x0150) +#define HDMI_4210_V_SYNC_GEN_3_1 HDMI_CORE_BASE(0x0154) +#define HDMI_4210_V_SYNC_GEN_3_2 HDMI_CORE_BASE(0x0158) +#define HDMI_4210_ACR_CON HDMI_CORE_BASE(0x0180) +#define HDMI_4210_AVI_CON HDMI_CORE_BASE(0x0300) +#define HDMI_4210_AVI_BYTE(n) HDMI_CORE_BASE(0x0320 + 4 * (n)) +#define HDMI_4210_DC_CONTROL HDMI_CORE_BASE(0x05C0) +#define HDMI_4210_VIDEO_PATTERN_GEN HDMI_CORE_BASE(0x05C4) +#define HDMI_4210_HPD_GEN HDMI_CORE_BASE(0x05C8) +#define HDMI_4210_AUI_CON HDMI_CORE_BASE(0x0360) +#define HDMI_4210_SPD_CON HDMI_CORE_BASE(0x0400) /* Timing generator registers */ #define HDMI_TG_CMD HDMI_TG_BASE(0x0000) @@ -155,7 +155,7 @@ #define HDMI_FIELD_EN (1 << 1) -/* HDMI Version 1.4 */ +/* HDMI Registers in Exynos4212 */ /* Control registers */ /* #define HDMI_INTC_CON HDMI_CTRL_BASE(0x0000) */ /* #define HDMI_INTC_FLAG HDMI_CTRL_BASE(0x0004) */