Received: by 10.223.176.5 with SMTP id f5csp1026448wra; Fri, 2 Feb 2018 09:56:35 -0800 (PST) X-Google-Smtp-Source: AH8x227CE0+j637ckrXh3ud0iuIBvlM/pJpZj6NN3BnTZ2A17vIcwrPJeGRAZQFhjqtH8vgMdhO7 X-Received: by 10.99.114.71 with SMTP id c7mr1096284pgn.283.1517594194922; Fri, 02 Feb 2018 09:56:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517594194; cv=none; d=google.com; s=arc-20160816; b=MwEu0umonT6xqB1hTeAZIkgDpjVFxhsREYoZIZymeCS3+OlYKiecfNUwLUCubsbR4x TexaiXWsu+KkybhjyyIEuXp1ofm/tf1TiujhRYcXMKmTFpJ7vNDl5dq4xSt29jMOQ8PY D9hRpGv7NDzCyzGAcaklCZeRjYRnQT2sXFTnUuk2fvC0K7myGqQhy9EKH5B6KKJL34HM qyxQ38XaUhHs8knry9dUNgGX02Vwd6e/2MAx15hpB7oc3hwe5qFjC7cN/133lJZI+mBM ogse4NF8kv0+kY+mGkO77YC6QhlYPbGp1zs/OcAKu1R6hv6kCXP0JvCX043tG8+g0g3z avUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kxOl2WHTaRK7aXIDbtyACZBIqAa2cEkRUT8krjx+hAo=; b=BxIw51aOPsTXOtE0c2HGDF4uit9uDmrIfxuEIgDm+/YpVr3Iu4/rQSnU/vlqCFDH7A 1RZXuraqMH/DHfn9337YvNPZW4LDg4grR7HLV+sswnDUWlHY+4coYXTzdRKztxYVk7Cu Ljf//o9MH23IILFDT2XbO0Vp6co8YRdjHdw08A589gg68OK3zQWtCA6XvuyzY0OzizCO ufWqOiaP6yY9bq/U6mNXtEF9K2FYv+reZkAhsNIkiRHriUxqYrWYOZZ1jy0RfnIYgFyK C7MzxC/hKtI51rtNI9JATAAXwXQoXqw9LhzcgdU8YnzveyGlKqZCbIM5XJYA/LMQQYZd svPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i14si1684805pgp.516.2018.02.02.09.56.19; Fri, 02 Feb 2018 09:56:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753710AbeBBRyF (ORCPT + 99 others); Fri, 2 Feb 2018 12:54:05 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38854 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753227AbeBBRMB (ORCPT ); Fri, 2 Feb 2018 12:12:01 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 38EEFF17; Fri, 2 Feb 2018 17:12:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philipp Zabel , Andrey Gusakov , Andrzej Hajda , Sasha Levin Subject: [PATCH 4.14 109/156] drm/bridge: tc358767: fix timing calculations Date: Fri, 2 Feb 2018 17:58:10 +0100 Message-Id: <20180202140845.114333952@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrey Gusakov [ Upstream commit 66d1c3b94d5d59e4325e61a78d520f92c043d645 ] Fields in HTIM01 and HTIM02 regs should be even. Recomended thresh_dly value is max_tu_symbol. Remove set of VPCTRL0.VSDELAY as it is related to DSI input interface. Currently driver supports only DPI. Acked-by: Philipp Zabel Signed-off-by: Andrey Gusakov Signed-off-by: Andrzej Hajda Link: https://patchwork.freedesktop.org/patch/msgid/1510073785-16108-5-git-send-email-andrey.gusakov@cogentembedded.com Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/bridge/tc358767.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -659,6 +659,14 @@ static int tc_set_video_mode(struct tc_d int lower_margin = mode->vsync_start - mode->vdisplay; int vsync_len = mode->vsync_end - mode->vsync_start; + /* + * Recommended maximum number of symbols transferred in a transfer unit: + * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size, + * (output active video bandwidth in bytes)) + * Must be less than tu_size. + */ + max_tu_symbol = TU_SIZE_RECOMMENDED - 1; + dev_dbg(tc->dev, "set mode %dx%d\n", mode->hdisplay, mode->vdisplay); dev_dbg(tc->dev, "H margin %d,%d sync %d\n", @@ -668,13 +676,18 @@ static int tc_set_video_mode(struct tc_d dev_dbg(tc->dev, "total: %dx%d\n", mode->htotal, mode->vtotal); - /* LCD Ctl Frame Size */ - tc_write(VPCTRL0, (0x40 << 20) /* VSDELAY */ | + /* + * LCD Ctl Frame Size + * datasheet is not clear of vsdelay in case of DPI + * assume we do not need any delay when DPI is a source of + * sync signals + */ + tc_write(VPCTRL0, (0 << 20) /* VSDELAY */ | OPXLFMT_RGB888 | FRMSYNC_DISABLED | MSF_DISABLED); - tc_write(HTIM01, (left_margin << 16) | /* H back porch */ - (hsync_len << 0)); /* Hsync */ - tc_write(HTIM02, (right_margin << 16) | /* H front porch */ - (mode->hdisplay << 0)); /* width */ + tc_write(HTIM01, (ALIGN(left_margin, 2) << 16) | /* H back porch */ + (ALIGN(hsync_len, 2) << 0)); /* Hsync */ + tc_write(HTIM02, (ALIGN(right_margin, 2) << 16) | /* H front porch */ + (ALIGN(mode->hdisplay, 2) << 0)); /* width */ tc_write(VTIM01, (upper_margin << 16) | /* V back porch */ (vsync_len << 0)); /* Vsync */ tc_write(VTIM02, (lower_margin << 16) | /* V front porch */ @@ -693,7 +706,7 @@ static int tc_set_video_mode(struct tc_d /* DP Main Stream Attributes */ vid_sync_dly = hsync_len + left_margin + mode->hdisplay; tc_write(DP0_VIDSYNCDELAY, - (0x003e << 16) | /* thresh_dly */ + (max_tu_symbol << 16) | /* thresh_dly */ (vid_sync_dly << 0)); tc_write(DP0_TOTALVAL, (mode->vtotal << 16) | (mode->htotal)); @@ -709,13 +722,6 @@ static int tc_set_video_mode(struct tc_d tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW | DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888); - /* - * Recommended maximum number of symbols transferred in a transfer unit: - * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size, - * (output active video bandwidth in bytes)) - * Must be less than tu_size. - */ - max_tu_symbol = TU_SIZE_RECOMMENDED - 1; tc_write(DP0_MISC, (max_tu_symbol << 23) | (TU_SIZE_RECOMMENDED << 16) | BPC_8);