Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3091555rwb; Mon, 15 Aug 2022 17:55:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR4SX94CkWUkyiR9Fa7ZPlaStfivKgF7GRN6NUO2QcqMzuTIPfLHFUzzAtMfDfpqOLX7oj+s X-Received: by 2002:a17:907:1688:b0:730:b3ae:347 with SMTP id hc8-20020a170907168800b00730b3ae0347mr11984827ejc.756.1660611196695; Mon, 15 Aug 2022 17:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611196; cv=none; d=google.com; s=arc-20160816; b=UyWQGEyxWqHIUjwRoluJe212xBhIu+343hdXEh0kOCbCQCxP/8YcRoAsGEvdVjrxtE ym8rGs8JAClWkKWN6RbDt5+3wHBXfspmoT1wmaKwzt0sbIWDcIpGgzFHNlvpiT4GesBS ctL5771DqrJT6VOO+I2vnTI6x4pfb3T9rR4kkOUH/yCXNAZ2avgjigtDFNlUrdt7Ncjp g7ufPRkIiMtDbf+Gxu9FluBUmiAMvY+4/vqZR1sIRqEYCCD4/f/BkCU7LibFHG/DVYtq 0ThDhyzXcZfqd1WUYPvlXblHDzgEXNm4X6wPc/xCxPwz3mXZnklYWGZriPBcbHOFRlBI PAng== 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=2ohYxPzUICcUAnXoUDxKyA3ZwUwWHV8GqjDuu/HjvfQ=; b=02ZgZY72kFVDcaX9GvbId0JHM1MbZ5TLo0vx4GOyH1N8Pqc7fZQipNzqeJo2kZnXDY jGN0pg5nTH6fmxIMeqM02V0LPvvWxNjMK2Y7lhJ7YncUJqlzIXf4rnkdAzmH62KhsSkB jDDYYTbotYZdNY25A6bIe4fYFcAIs14dke1RyaLILAdsTkrifp67s9fRBHUyuoE78TJ0 FhEkw/U7v02G6NbVmJkdB1CVs/F0GfmGhUKFMj+Ut0YRGbxmVYl5RFMTZIYShpebbZlY bfJ1klx/bFca/CLeXr25McgNvBHAicMQoIhQEFW3at1pSuGjvBmXC+4Fnj8hsfo/afDu n0Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="A/U5D6ih"; 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 hb40-20020a170907162800b0072ab62adfe9si11214302ejc.237.2022.08.15.17.52.51; Mon, 15 Aug 2022 17:53:16 -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="A/U5D6ih"; 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 S1355085AbiHOXrD (ORCPT + 99 others); Mon, 15 Aug 2022 19:47:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354325AbiHOXlx (ORCPT ); Mon, 15 Aug 2022 19:41:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 048B32C66C; Mon, 15 Aug 2022 13:12:41 -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 95E4A60B9B; Mon, 15 Aug 2022 20:12:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8002EC433D6; Mon, 15 Aug 2022 20:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594360; bh=wGmzxuR/0P2E5LaW6gBwW3BBKMxMqFowNKE4fr6qJi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A/U5D6ihR8X8GMc3cP/tiDUxvyZq7vh582+kcuxOOQkJswbKzFFNUEnn483mnntLW Ac7fG64volYeU+fAtjzHNNTEHkMQjOkZ00y3IgjLJ80WvF5Fi8jzMRJR4Su0eIj6CJ wvyGRBGgGJu4GD90W43Pp+FPaiGqUuTs5vnlqaXg= 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.19 0421/1157] drm/vc4: hdmi: Fix timings for interlaced modes Date: Mon, 15 Aug 2022 19:56:17 +0200 Message-Id: <20220815180456.509015789@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 12a5944ee980..b2628afcb327 100644 --- 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 drm_crtc *crtc, struct drm_encoder *encode 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 drm_crtc *crtc, struct drm_encoder *encode 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 drm_crtc *crtc, struct drm_encoder *encode 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 { diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index f3e0de6515e0..674bd29a7cf2 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -988,12 +988,12 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, 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)); unsigned long flags; @@ -1041,12 +1041,12 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, 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)); unsigned long flags; unsigned char gcp; -- 2.35.1