Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1862039rwb; Fri, 19 Aug 2022 10:36:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR4gnFE/OEfQPCw7qL4rhcLghOGcQj6ROHekDnReK+xQs6yNfVt871z7J1JkWRXWorLj5Vjh X-Received: by 2002:a05:6a00:986:b0:536:4469:12eb with SMTP id u6-20020a056a00098600b00536446912ebmr225005pfg.12.1660930612558; Fri, 19 Aug 2022 10:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930612; cv=none; d=google.com; s=arc-20160816; b=Ovmg16zmgog1uTiKluR8EFzQzirwmiVbdn/uJUWkrEQSi2LZWeRv+1FS644ktnuTdJ gBkvWvo4/nJYDZo1HoxNJBQnD/jYrKLuGXsama5YtfeZRVk36DXqd54rpnVqKp0FUeNB ulTlKvK4cRY2e8XuSLHcquvhY7fil/K8K5tMrU/2r/a/MAL/Dk9G8ZEUxvOygwTxfC2W 8WTTAPdvLJL9416WN99bFe9DhCGIT8tgo/zyqFukHrTxpmgTnPyx4fVW1xNnot+ToBrU Cwbcr4PTit0g5RjAN5mU0MI0rhrRzczocjC/LdQ2hXJju1S5wK9TyRJs6L/FiHF7UsdO Wcqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+7d2S+NboVbPoKgeJ+/iwlwfFAB/JVSPGmUstb56F0c=; b=IyLSx+rG1eJbmnxn90BXjH4r9QmXnRQZpDO9NupV59zv812smNIQvz7MLCbCL3u5tt 90CSo5OH+NgD+Li/K1pNrIFInuNGCMijlUqPG5iTcCDE+lcb/Sd6KQcN1xbiL3RY7nPb GLrjT02N6cAY8CWmnnTlWswtt+Rs20T9ZiYQpPLndqygZ/hkP828VtUjyL1asTbpmuVH gePgzmKYqqy7TNhVXx8BYMcp3wYblORq5HoFeqZH31ACm+j8mNlFx3tO8EBoqGdv5YQn x5nFKKr//pH3ksR4/rFLdMAqdqlBFRS6L/4zdNjCbYKOUNSLR3+WOTMro/I5QpVI5Din SIBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FY22a+9E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jm12-20020a17090304cc00b00158643c240asi4264802plb.87.2022.08.19.10.36.41; Fri, 19 Aug 2022 10:36:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FY22a+9E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351722AbiHSQKH (ORCPT + 99 others); Fri, 19 Aug 2022 12:10:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351844AbiHSQGl (ORCPT ); Fri, 19 Aug 2022 12:06:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85CDD104758; Fri, 19 Aug 2022 08:55:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 74107614FE; Fri, 19 Aug 2022 15:55:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E99C433B5; Fri, 19 Aug 2022 15:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924538; bh=Uou/vE3UmCNcEvFQuUMTDOkCNj2QMbdtUT/5O2mbpZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FY22a+9EwtfY5iT0PEMb7XiYuM9nUMcTNjsqFtp2av7HiVNA1iQe5Bs1U5DIdN0lV YoA/X+VaXqOj+meApDkDxjGQe/RxW/IfamOCOMUglzBDK0zoz9Cf5jXs4cE5E/u8IO xv4cZ4T+j+JtkPo8eV97SITLdqATjUGqB5lsWvP0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mateusz Kwiatkowski , Maxime Ripard , Sasha Levin Subject: [PATCH 5.10 203/545] drm/vc4: hdmi: Fix timings for interlaced modes Date: Fri, 19 Aug 2022 17:39:33 +0200 Message-Id: <20220819153838.464782682@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mateusz Kwiatkowski [ Upstream commit 0ee5a40152b15f200ed3a0d51e8aa782ea979c6a ] Increase the number of post-sync blanking lines on odd fields instead of decreasing it on even fields. This makes the total number of lines properly match the modelines. Additionally fix the value of PV_VCONTROL_ODD_DELAY, which did not take pixels_per_clock into account, causing some displays to invert the fields when driven by bcm2711. Fixes: 682e62c45406 ("drm/vc4: Fix support for interlaced modes on HDMI.") Signed-off-by: Mateusz Kwiatkowski Link: https://lore.kernel.org/r/20220613144800.326124-31-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_crtc.c | 7 ++++--- drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -346,7 +346,8 @@ static void vc4_crtc_config_pv(struct dr PV_HORZB_HACTIVE)); CRTC_WRITE(PV_VERTA, - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlace, PV_VERTA_VBP) | VC4_SET_FIELD(mode->crtc_vsync_end - mode->crtc_vsync_start, PV_VERTA_VSYNC)); @@ -358,7 +359,7 @@ static void vc4_crtc_config_pv(struct dr if (interlace) { CRTC_WRITE(PV_VERTA_EVEN, VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end - 1, + mode->crtc_vsync_end, PV_VERTA_VBP) | VC4_SET_FIELD(mode->crtc_vsync_end - mode->crtc_vsync_start, @@ -378,7 +379,7 @@ static void vc4_crtc_config_pv(struct dr PV_VCONTROL_CONTINUOUS | (is_dsi ? PV_VCONTROL_DSI : 0) | PV_VCONTROL_INTERLACE | - VC4_SET_FIELD(mode->htotal * pixel_rep / 2, + VC4_SET_FIELD(mode->htotal * pixel_rep / (2 * ppc), PV_VCONTROL_ODD_DELAY)); CRTC_WRITE(PV_VSYNCD_EVEN, 0); } else { --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -522,12 +522,12 @@ static void vc4_hdmi_set_timings(struct VC4_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC4_HDMI_VERTA_VAL)); u32 vertb = (VC4_SET_FIELD(0, VC4_HDMI_VERTB_VSPO) | - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlaced, VC4_HDMI_VERTB_VBP)); u32 vertb_even = (VC4_SET_FIELD(0, VC4_HDMI_VERTB_VSPO) | VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end - - interlaced, + mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); HDMI_WRITE(HDMI_HORZA, @@ -566,12 +566,12 @@ static void vc5_hdmi_set_timings(struct VC5_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC5_HDMI_VERTA_VAL)); u32 vertb = (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlaced, VC4_HDMI_VERTB_VBP)); u32 vertb_even = (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end - - interlaced, + mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); HDMI_WRITE(HDMI_VEC_INTERFACE_XBAR, 0x354021);