Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp196473pxh; Wed, 10 Nov 2021 00:03:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1AVbFKhqSvqLLSAXpE4q9upH/7CkLirQ8iPTCiwgluaxdCMZ/2kmXXTth5ew6LD+QdlJ3 X-Received: by 2002:a17:907:6e9e:: with SMTP id sh30mr18407574ejc.156.1636531414462; Wed, 10 Nov 2021 00:03:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636531414; cv=none; d=google.com; s=arc-20160816; b=dmJy3MLyizBQ/A/E1mRThaMUbndJgc3QTImmbBnkyNj2qSVN1QvEpl8yu7luvsfN3G lbeyC0noAxjtbkC+aBcwgAZOb4yeKNoD34+elT1utEhvO0ey2TZgN9UwaaWihPIk7QW8 j+GG0XLI2UvAP8ZkGwN9cVX168r3zkJt1VMh9GnEsOLrXVVHoceFOOdxAg9atM9EdJMs PzGJE/RISIuwtdIq/KcNM41P0wrP5gi/FpivX+8RS4eByWQLvWhyLSL0ogn4KAI3cB7q pxYyR2KVUAqcu7kknWxYhTpw0mc6MSFZwH5e7Cn5eXiZSa5KdIDQzu/pYBPX1Z5EB9Jr p1OQ== 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 :references:in-reply-to:message-id:date:subject:to:from; bh=D5uUVTRNFB9PJaa1jXrwgkXCYdM4kGYPInrp4DIkoQc=; b=QFa/HPbjPlGZM8tRc78P35ucGiQeeYvAd/wBhd5D4eB5c3sjikRTofLixFh9+GLXAf 4Vfi8JnIs9bSs7O9uF2JcYXS56pYClSHXUnNOhdhT8JdtOXsIDo97ZRHNzMGHppckLaP IKKQM07bfyl81OvfBDzdXrbVqBAXUU9FcGciRSnXhMXDzdxvWlGyUJxy6BEu05ghFA0z 4ChmmSt9rPNAu2jc9QUxeRwlFr54ZjPytNMPj4oRCpWQ6TgQ8BalqAmAlKodQCVYmj2Y CXitV0mwhrPdEf3nn2epLCU8SxOVcfXn4JngZpng6Qk9F12jOKiYGCdtrycCYbXgX0Iw tCDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id go31si33655893ejc.244.2021.11.10.00.02.21; Wed, 10 Nov 2021 00:03:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbhKJIDA (ORCPT + 99 others); Wed, 10 Nov 2021 03:03:00 -0500 Received: from twspam01.aspeedtech.com ([211.20.114.71]:35825 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbhKJIC7 (ORCPT ); Wed, 10 Nov 2021 03:02:59 -0500 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 1AA7alox018228; Wed, 10 Nov 2021 15:36:47 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from JammyHuang-PC.aspeed.com (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 10 Nov 2021 16:00:06 +0800 From: Jammy Huang To: , , , , , , , , Subject: [PATCH v2 1/2] media: aspeed: Add macro for the fields of the mode-detect registers Date: Wed, 10 Nov 2021 16:00:11 +0800 Message-ID: <20211110080012.20759-2-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211110080012.20759-1-jammy_huang@aspeedtech.com> References: <20211110080012.20759-1-jammy_huang@aspeedtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 1AA7alox018228 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org VE_MODE_DT_HOR_TOLER: the tolerance in detecting for stable horizontal signal. VE_MODE_DT_VER_TOLER: the tolerance in detecting for stable vertical signal. VE_MODE_DT_HOR_STABLE: the minimum required count in detecting stable HSYNC signal to set mode detection horizontal signal stable. VE_MODE_DT_VER_STABLE: the minimum required count in detecting stable VSYNC signal to set mode detection vertical signal stable. Signed-off-by: Jammy Huang --- drivers/media/platform/aspeed-video.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c index 5da52646b298..996afbb87ee9 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -196,6 +196,12 @@ #define VE_INTERRUPT_VSYNC_DESC BIT(11) #define VE_MODE_DETECT 0x30c +#define VE_MODE_DT_HOR_TOLER GENMASK(31, 28) +#define VE_MODE_DT_VER_TOLER GENMASK(27, 24) +#define VE_MODE_DT_HOR_STABLE GENMASK(23, 20) +#define VE_MODE_DT_VER_STABLE GENMASK(19, 16) +#define VE_MODE_DT_EDG_THROD GENMASK(15, 8) + #define VE_MEM_RESTRICT_START 0x310 #define VE_MEM_RESTRICT_END 0x314 @@ -1199,7 +1205,12 @@ static void aspeed_video_init_regs(struct aspeed_video *video) aspeed_video_write(video, VE_SCALING_FILTER3, 0x00200000); /* Set mode detection defaults */ - aspeed_video_write(video, VE_MODE_DETECT, 0x22666500); + aspeed_video_write(video, VE_MODE_DETECT, + FIELD_PREP(VE_MODE_DT_HOR_TOLER, 2) | + FIELD_PREP(VE_MODE_DT_VER_TOLER, 2) | + FIELD_PREP(VE_MODE_DT_HOR_STABLE, 6) | + FIELD_PREP(VE_MODE_DT_VER_STABLE, 6) | + FIELD_PREP(VE_MODE_DT_EDG_THROD, 0x65)); aspeed_video_write(video, VE_BCD_CTRL, 0); } -- 2.25.1