Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2876813rwb; Mon, 15 Aug 2022 13:07:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR65LzRAC4uMD7/YMtJqdSZEG4hnZYOge7AHfhXKSZ5MNIMWxh9sviHkvvPZ0v4hXdgwr86i X-Received: by 2002:a17:907:6818:b0:730:825d:7296 with SMTP id qz24-20020a170907681800b00730825d7296mr11841630ejc.21.1660594057518; Mon, 15 Aug 2022 13:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594057; cv=none; d=google.com; s=arc-20160816; b=OiscgEwRjcJ6uemQZKAvQuciakQtZiXpsTdtqOvS4akasZ31SAj9yxqlxbu9MPfTVl huBuIE34MqIUSgIcOyZgo6wVp/CPNuSna4WuSvNAuLGUZ20coWV+eXBEJbgDFyyp5X2A Pnm0SgmDX1vdsWjXLSEZSdPjWdpb8PlM7EuluBlLc5lT5i2ZPj78LxxkVo+5ThPuleZJ aeScilRzPLd432VRUSbskEmzEgERj585NPT/F0j1fQZPDBXhqTdcUdNn/2fLbXmPZQrP ZpRoEE8X07YEf79qOAlx2MSCfFZyxaCITlO2GqCRY+LM552ARXfoTslv/Ab4rXufSrQU WdDw== 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=8tw6wM9xmJHLjDYkEmivYQXtEt+wi8TJf1P9Xx2lq3w=; b=yszpiKwbsaEQ72XyT2DUlWzm0fTVwuXEs+76qXP+7h5HZzXYdK1bgl/SF8MjBvw2k3 EQy7U4TPCo44GE6yyWH/mBbBMqP5h6qxPmI/EOUU+1cdW1t9d+ayI48pm8BmOnRLmRbN qX17u/bRjhUUbKcx1K10ZLHgSjqGFd2IUkubC3IsUOslVsd/uwHXvp14uUFHRLqn8zyR XYwCAjm/37SqBGDFt1fSZbB36dvqaloab6nPDs4vc2ntAurM5/aQq53KW/8qXsClv/IJ 7gljayaqfvwyQidFVmNIDVQyX0HEWBxBXGnYQ+WdGoUX9k8fpgnByCOFnUINTvYnJtz0 OjBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kc0O2hDR; 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 h4-20020aa7c944000000b0043d64c59b10si7843186edt.94.2022.08.15.13.07.12; Mon, 15 Aug 2022 13:07:37 -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=Kc0O2hDR; 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 S244404AbiHOSxk (ORCPT + 99 others); Mon, 15 Aug 2022 14:53:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244328AbiHOSu6 (ORCPT ); Mon, 15 Aug 2022 14:50:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C398F4504B; Mon, 15 Aug 2022 11:28:59 -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 ams.source.kernel.org (Postfix) with ESMTPS id DDA6EB81081; Mon, 15 Aug 2022 18:28:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E2EEC433D6; Mon, 15 Aug 2022 18:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588136; bh=mZW8ED33u+A2FgscfFPXlX5JDkvNzIjQrACfOxCP7HA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kc0O2hDRPRuVoHJiW+ZWKyQW+GDP7MJMi0wacoo7UALdDtmjt3i0b6rH2w3PGd/Qn nuaGbPHdewF/b/VMHSm0Qt+1+APnSaGlYicp9Lvgy5pfFT4aqYcit9nmsLYGHGdigC 2oWYJM6U8US+lMsgxekVgoTVFCSoYWCuCd8OGX3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 307/779] drm/vc4: hdmi: Reset HDMI MISC_CONTROL register Date: Mon, 15 Aug 2022 19:59:11 +0200 Message-Id: <20220815180350.417995874@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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: Dave Stevenson [ Upstream commit 35dc00c12a72700a9c4592afee7d136ecb280cbd ] The HDMI block can repeat pixels for double clocked modes, and the firmware is now configuring the block to do this as the PV is doing it incorrectly when at 2pixels/clock. If the kernel doesn't reset it then we end up with strange modes. Reset MISC_CONTROL. Fixes: 8323989140f3 ("drm/vc4: hdmi: Support the BCM2711 HDMI controllers") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-22-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++++++ drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 879245808e26..e16fece541da 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -79,6 +79,9 @@ #define VC5_HDMI_VERTB_VSPO_SHIFT 16 #define VC5_HDMI_VERTB_VSPO_MASK VC4_MASK(29, 16) +#define VC5_HDMI_MISC_CONTROL_PIXEL_REP_SHIFT 0 +#define VC5_HDMI_MISC_CONTROL_PIXEL_REP_MASK VC4_MASK(3, 0) + #define VC5_HDMI_SCRAMBLER_CTL_ENABLE BIT(0) #define VC5_HDMI_DEEP_COLOR_CONFIG_1_INIT_PACK_PHASE_SHIFT 8 @@ -849,6 +852,11 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, reg |= gcp_en ? VC5_HDMI_GCP_CONFIG_GCP_ENABLE : 0; HDMI_WRITE(HDMI_GCP_CONFIG, reg); + reg = HDMI_READ(HDMI_MISC_CONTROL); + reg &= ~VC5_HDMI_MISC_CONTROL_PIXEL_REP_MASK; + reg |= VC4_SET_FIELD(0, VC5_HDMI_MISC_CONTROL_PIXEL_REP); + HDMI_WRITE(HDMI_MISC_CONTROL, reg); + HDMI_WRITE(HDMI_CLOCK_STOP, 0); } diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h index 19d2fdc446bc..f126fa425a1d 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h @@ -123,6 +123,7 @@ enum vc4_hdmi_field { HDMI_VERTB0, HDMI_VERTB1, HDMI_VID_CTL, + HDMI_MISC_CONTROL, }; struct vc4_hdmi_register { @@ -233,6 +234,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi0_fields[] = { VC4_HDMI_REG(HDMI_VERTB0, 0x0f0), VC4_HDMI_REG(HDMI_VERTA1, 0x0f4), VC4_HDMI_REG(HDMI_VERTB1, 0x0f8), + VC4_HDMI_REG(HDMI_MISC_CONTROL, 0x100), VC4_HDMI_REG(HDMI_MAI_CHANNEL_MAP, 0x09c), VC4_HDMI_REG(HDMI_MAI_CONFIG, 0x0a0), VC4_HDMI_REG(HDMI_DEEP_COLOR_CONFIG_1, 0x170), @@ -313,6 +315,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi1_fields[] = { VC4_HDMI_REG(HDMI_VERTB0, 0x0f0), VC4_HDMI_REG(HDMI_VERTA1, 0x0f4), VC4_HDMI_REG(HDMI_VERTB1, 0x0f8), + VC4_HDMI_REG(HDMI_MISC_CONTROL, 0x100), VC4_HDMI_REG(HDMI_MAI_CHANNEL_MAP, 0x09c), VC4_HDMI_REG(HDMI_MAI_CONFIG, 0x0a0), VC4_HDMI_REG(HDMI_DEEP_COLOR_CONFIG_1, 0x170), -- 2.35.1