From patchwork Wed Sep 6 10:36:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9940303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7CF5D60224 for ; Wed, 6 Sep 2017 10:37:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8338028B8D for ; Wed, 6 Sep 2017 10:37:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 781AB28B8F; Wed, 6 Sep 2017 10:37:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0918D28B8D for ; Wed, 6 Sep 2017 10:37:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753074AbdIFKhi (ORCPT ); Wed, 6 Sep 2017 06:37:38 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:35944 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753080AbdIFKhd (ORCPT ); Wed, 6 Sep 2017 06:37:33 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170906103731euoutp01e56e1e6c4b4c15882d39dc061fd22f83~hv3Mqs-XA1659916599euoutp01l; Wed, 6 Sep 2017 10:37:31 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170906103731eucas1p10769754e0439a47a6faa535ffbc7a442~hv3L4TK5s0372303723eucas1p1l; Wed, 6 Sep 2017 10:37:31 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id D4.E1.12867.AEFCFA95; Wed, 6 Sep 2017 11:37:30 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170906103730eucas1p2678e273a036b1fb02b5d1d51fa5fc20d~hv3LRYe_e3034930349eucas1p2c; Wed, 6 Sep 2017 10:37:30 +0000 (GMT) X-AuditID: cbfec7f2-f793b6d000003243-a6-59afcfeab369 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C1.A8.18832.AEFCFA95; Wed, 6 Sep 2017 11:37:30 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OVU00L0NTIFI200@eusync1.samsung.com>; Wed, 06 Sep 2017 11:37:30 +0100 (BST) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Tobias Jakobi , Daniel Drake Subject: [PATCH 06/10] drm/exynos/hdmi: remove redundant mode field Date: Wed, 06 Sep 2017 12:36:56 +0200 Message-id: <1504694220-15818-7-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1504694220-15818-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7djP87qvzq+PNDj9X9/i1rpzrBYbZ6xn tXg0/zGzxZWv79ksJt2fwGIx4/w+Jou1R+6yW7St/sDqwOGx6Hu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B4ewgLPEvFlpIDUsAqoS+y7sYAGxeYHCa6atY4HYJidx81wnM4jNKeAicer6J7D5QkA1 Mx8uYpzAyLuAkWEVo0hqaXFuem6xoV5xYm5xaV66XnJ+7iZGYGhtO/Zz8w7GSxuDDzEKcDAq 8fAWPFwXKcSaWFZcmXuIUYKDWUmE9++59ZFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeXv3rI4U EkhPLEnNTk0tSC2CyTJxcEo1MCYHzF3xhe0d38awK3fnntJzmhlg327MWs1z/r/KjSd7zk/I 869oeb1x0o1/Ail9pl/veeikOPKus1oQ5f7NKZr7zBmhnekf/HMEVL80tmx5Lrf5/kUVu69v i5/fTNm71nQuF6P/ysfxiS/ENxdqWObbLtkQdiQ8O1SyzG4q48npIZFV/JEb3iixFGckGmox FxUnAgCFKP7eKQIAAA== X-CMS-MailID: 20170906103730eucas1p2678e273a036b1fb02b5d1d51fa5fc20d X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-CMS-RootMailID: 20170906103730eucas1p2678e273a036b1fb02b5d1d51fa5fc20d X-RootMTR: 20170906103730eucas1p2678e273a036b1fb02b5d1d51fa5fc20d References: <1504694220-15818-1-git-send-email-a.hajda@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Display mode is preserved in CRTC state, there is no need to keep local copy of it. Moreover since HDMI should configure registers according to requested mode, use it instead of adjusted_mode, which should contain mode produced by CRTC - functionally it does not change anything, but subsequent patches will make the difference. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_hdmi.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 214fa5e..7225b65 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -119,7 +119,6 @@ struct hdmi_context { bool powered; bool dvi_mode; struct delayed_work hotplug_work; - struct drm_display_mode current_mode; struct cec_notifier *notifier; const struct hdmi_driver_data *drv_data; @@ -770,6 +769,7 @@ static int hdmi_clk_set_parents(struct hdmi_context *hdata, bool to_phy) static void hdmi_reg_infoframes(struct hdmi_context *hdata) { + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; union hdmi_infoframe frm; u8 buf[25]; int ret; @@ -783,8 +783,7 @@ static void hdmi_reg_infoframes(struct hdmi_context *hdata) return; } - ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi, - &hdata->current_mode, false); + ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi, m, false); if (!ret) ret = hdmi_avi_infoframe_pack(&frm.avi, buf, sizeof(buf)); if (ret > 0) { @@ -794,8 +793,7 @@ static void hdmi_reg_infoframes(struct hdmi_context *hdata) DRM_INFO("%s: invalid AVI infoframe (%d)\n", __func__, ret); } - ret = drm_hdmi_vendor_infoframe_from_display_mode(&frm.vendor.hdmi, - &hdata->current_mode); + ret = drm_hdmi_vendor_infoframe_from_display_mode(&frm.vendor.hdmi, m); if (!ret) ret = hdmi_vendor_infoframe_pack(&frm.vendor.hdmi, buf, sizeof(buf)); @@ -1088,9 +1086,10 @@ static void hdmi_audio_control(struct hdmi_context *hdata, bool onoff) static void hdmi_start(struct hdmi_context *hdata, bool start) { + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; u32 val = start ? HDMI_TG_EN : 0; - if (hdata->current_mode.flags & DRM_MODE_FLAG_INTERLACE) + if (m->flags & DRM_MODE_FLAG_INTERLACE) val |= HDMI_FIELD_EN; hdmi_reg_writemask(hdata, HDMI_CON_0, val, HDMI_EN); @@ -1160,7 +1159,7 @@ static void hdmiphy_wait_for_pll(struct hdmi_context *hdata) static void hdmi_v13_mode_apply(struct hdmi_context *hdata) { - struct drm_display_mode *m = &hdata->current_mode; + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; unsigned int val; hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); @@ -1239,7 +1238,7 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata) static void hdmi_v14_mode_apply(struct hdmi_context *hdata) { - struct drm_display_mode *m = &hdata->current_mode; + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); hdmi_reg_writev(hdata, HDMI_V_LINE_0, 2, m->vtotal); @@ -1372,10 +1371,11 @@ static void hdmiphy_enable_mode_set(struct hdmi_context *hdata, bool enable) static void hdmiphy_conf_apply(struct hdmi_context *hdata) { + struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; int ret; const u8 *phy_conf; - ret = hdmi_find_phy_conf(hdata, hdata->current_mode.clock * 1000); + ret = hdmi_find_phy_conf(hdata, m->clock * 1000); if (ret < 0) { DRM_ERROR("failed to find hdmiphy conf\n"); return; @@ -1407,21 +1407,6 @@ static void hdmi_conf_apply(struct hdmi_context *hdata) hdmi_audio_control(hdata, true); } -static void hdmi_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - struct hdmi_context *hdata = encoder_to_hdmi(encoder); - struct drm_display_mode *m = adjusted_mode; - - DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%s\n", - m->hdisplay, m->vdisplay, - m->vrefresh, (m->flags & DRM_MODE_FLAG_INTERLACE) ? - "INTERLACED" : "PROGRESSIVE"); - - drm_mode_copy(&hdata->current_mode, m); -} - static void hdmi_set_refclk(struct hdmi_context *hdata, bool on) { if (!hdata->sysreg) @@ -1504,7 +1489,6 @@ static void hdmi_disable(struct drm_encoder *encoder) static const struct drm_encoder_helper_funcs exynos_hdmi_encoder_helper_funcs = { .mode_fixup = hdmi_mode_fixup, - .mode_set = hdmi_mode_set, .enable = hdmi_enable, .disable = hdmi_disable, };