Received: by 10.223.176.5 with SMTP id f5csp1050267wra; Fri, 2 Feb 2018 10:17:58 -0800 (PST) X-Google-Smtp-Source: AH8x224AWsET3wwVcS/XzfJyMBZy8kBocfKksEatozhbDqOsp1ALRIMXazQoD1YIuFaU9rb9iaNo X-Received: by 2002:a17:902:904b:: with SMTP id w11-v6mr36078042plz.41.1517595478580; Fri, 02 Feb 2018 10:17:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517595478; cv=none; d=google.com; s=arc-20160816; b=yy/uJCkFStfS0Y6QG5h30dDlr+p79qBbnbP1ZLxFQSEpZZ2ZzH+Lella0FzkPHs93B mmwlgaXxz3Ndei2ZzJ6R6/YJXsuzediof6JBRvEiXAQHU4xXip72j0gGkhUfqYi+Hd8W xZmaa650cdvkvGyNCaYy7ce7nNe04a7VEijrzVtlMKWS1f1tB0Sjeb4K1X49suk5OT5X duFLyeA3ixYc3KDxF09SB6uQoWrpm280jhF4cdpNtTx2djc0H7+1ap7dwK10mbSZ0o/+ cPkCdw/P1gt57zLup5tLpnAWY3RPGPgUqWz3OfMPA/IsyZdN4QsHKfOsti1TzMHgg51Z rgMA== 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=4CYpM7sbEFnkgSC2DtoX6dFzB7SSHlHhaE7kwWtXNFU=; b=Zdc6SoBhd7Bv6t9XjPO51pgP1JMQ+3DYpQZe4Tb4dCMVQaLVg87TyXpMRQCYpD4iOX tez1XkfbVuVDFYB/7oCs14/qDfCrePGPcpIfIvGenePTlt1oFkKyXv5j+6lJ4HhHZ5Eg LgxHMaF/VFuJpBuQ/G/mTEtS/pvgv8Qysi66UL8TuOmLkMaKk4QaJy+aabhF8kQIekJP mEkLK1UYojA1Lu+YLavv8PLka4L8IssNFddkBItLbjwfZfmzrRhHBnsGAMBhNjbpUksf icQaGsIFIQlUG+seGhjD6YPwIi42YNJ8BiEg2zbVZrKy2nK+cGkLGfH6pld+keIwykwv nkTQ== 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 x9si1772823pgq.801.2018.02.02.10.17.43; Fri, 02 Feb 2018 10:17:58 -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 S1754253AbeBBSQt (ORCPT + 99 others); Fri, 2 Feb 2018 13:16:49 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36410 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746AbeBBRFM (ORCPT ); Fri, 2 Feb 2018 12:05:12 -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 77CDFE20; Fri, 2 Feb 2018 17:05:11 +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.9 57/86] drm/bridge: tc358767: fix timing calculations Date: Fri, 2 Feb 2018 17:58:17 +0100 Message-Id: <20180202140827.692232619@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140822.679101338@linuxfoundation.org> References: <20180202140822.679101338@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.9-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);