Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5280032pxb; Wed, 19 Jan 2022 15:09:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5/mTsVI7m4U8aEDUahFneU2nnQxPcjRsClV6tUH6qxV3YtlO4V0dIS7Me0ZG4YE7PCei5 X-Received: by 2002:a17:90a:ead6:: with SMTP id ev22mr1715806pjb.10.1642633765952; Wed, 19 Jan 2022 15:09:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642633765; cv=none; d=google.com; s=arc-20160816; b=vOXqzG7ZHqZOrH6uF/5Bz/x9VWUM4bnAmaxuShFNgwzlBsUf1Qrf00QP342itePvNg mcUEY0XMRsTHEulestyQTHQ7uGRV2AnWQ5rFcu9BaBeK4t34SvwQyTi7vGBBDFqUXuA+ /Z7mviez9R6v7H7wCewABMIOk7tRazh56NcH/ZnLjlxcvMcswTjLSeqy1+7R64vpdX5A BfLf+CYEr1cPyDzv5dOEkLEwHlpIKtpHpi3BdO/CJBw5IUMel123X21JjZ07rsSenDR8 nBcI2SBhGDsNBdmW1uevqBOV9h8nBtM31lNxzPNlEJoV9zMHD3K5LVaMPKLOCdjhWirS JJZA== 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=cnUHl6DeSeUz6bIcpCHCtZGvY98Oj1k/rbM25CqiRUk=; b=SEm/9LC0iqPVdTF4iiDioIbBcjLTI+IN2GdlGQ8BomxWsj8Cbaw6XXrh+1H+aYiyIh KvtY2yFMtRhvnMfBId5iIjQsk05leDJ4wxQhRBe4pmRYr1MgLBhjlPWLOfautLoneyog kGagtxxnk+H991Yx2LDLTcnwEDMWyi1tcTGa+1DJmmVg7F9looAYB73rZO2QDatdrxsj yEE7nzRhskmP6GrrWSjPD4aj4gYpJGOKiUZ3AvXMo6kWLUjVXNDbgAnGgM12PK5svD5j IyxsmeRzW4XHdiaJ/RvjWsD9BSl8xK+HmX1a27ZAuQYBQF+YvgdHoB7Y2yj7GDA1uQix ReAA== 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 k189si1361388pgc.440.2022.01.19.15.09.13; Wed, 19 Jan 2022 15:09:25 -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 S1344885AbiARIpR (ORCPT + 99 others); Tue, 18 Jan 2022 03:45:17 -0500 Received: from twspam01.aspeedtech.com ([211.20.114.71]:19726 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235174AbiARIpM (ORCPT ); Tue, 18 Jan 2022 03:45:12 -0500 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 20I8c8xP013911; Tue, 18 Jan 2022 16:38:08 +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; Tue, 18 Jan 2022 16:45:05 +0800 From: Jammy Huang To: , , , , , , , , Subject: [PATCH v3 1/2] media: aspeed: Add macro for the fields of the mode-detect registers Date: Tue, 18 Jan 2022 16:44:48 +0800 Message-ID: <20220118084449.5182-2-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118084449.5182-1-jammy_huang@aspeedtech.com> References: <20220118084449.5182-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 20I8c8xP013911 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 4f5f5dd364ee..5ba4d70c8dab 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -190,6 +190,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 @@ -1238,7 +1244,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