Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5506350pxb; Wed, 19 Jan 2022 21:23:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZYfTlhnSDTVDNVqngLw0zHUbYH/xJPOTP29wGyHR1MNlYXcYMDYq7H+9KpxHR2BYVjbyM X-Received: by 2002:a17:902:760c:b0:149:ee23:8905 with SMTP id k12-20020a170902760c00b00149ee238905mr37082340pll.61.1642656205845; Wed, 19 Jan 2022 21:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642656205; cv=none; d=google.com; s=arc-20160816; b=PRgPgMh7S9ga3x63HYfT4NtNK+Job5PAAbguX6uf9my1ttCFCV3zy4/fFi7EvzIfWq Uo0Q/P1YCZ1rA/bZOTjyBKUAv2/+ndU3FrF1gWrs4aXewdpg4PU5kI9t1FlLqMcjFvYi ymbthOMOlaC+xFIQesYop2m8p2cOKY41J4JNPIuvHF3BwVD9BGmCD8ejC41Ofj+A7kuJ Y1OoSO8iq16KK5rv1G+UdpSuA6D8UqZ07RaMuEm5M+l6SYMu8kfL3oYKJYySgxFVneWt qw2r+klXlbrl46cd+MqqCO3bOQZMTQG079ZHgAICiEJMO7s0GDThqAJxr/qjHotZ8NOm mDzA== 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=v/tbfKJMrhPYKpNFN9tyQT1YeNJDQoLqa4gmE+hRSSNKb6zIA15uyGtcQvRKj+qZpk cHOe262AZbah8y2fCuGp4ks3xHXFEwWKs1mJmd9lyLn2l6M22agWTSQqPTE8tzonx0b5 Pu46GDNroVB5PzY0ApgvSWNZcz2TB2G9LlCi8AEcV+qwD6p0Th7GHQJhwDEkED5EVvUa g3ajkeVquel5fDL3BlmIULB+HR6w4IpTiJ4TJ3QF2CJYZkn8EvR6O3KZTiC58gWBH8B+ 5GIY8LPWw61L+LjNujAqd8SG10J50fPZ4AIWupBBHPCvE01Fsr32rQJPwcdcPx/pwDZ9 0YOA== 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 i11si2340279pgt.192.2022.01.19.21.23.08; Wed, 19 Jan 2022 21:23: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 S236799AbiARKHl (ORCPT + 99 others); Tue, 18 Jan 2022 05:07:41 -0500 Received: from twspam01.aspeedtech.com ([211.20.114.71]:29598 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236434AbiARKHk (ORCPT ); Tue, 18 Jan 2022 05:07:40 -0500 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 20IA0Rfm021057; Tue, 18 Jan 2022 18:00:27 +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 18:07:24 +0800 From: Jammy Huang To: , , , , , , , , Subject: [PATCH v4 1/2] media: aspeed: Add macro for the fields of the mode-detect registers Date: Tue, 18 Jan 2022 18:07:28 +0800 Message-ID: <20220118100729.7651-2-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118100729.7651-1-jammy_huang@aspeedtech.com> References: <20220118100729.7651-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 20IA0Rfm021057 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