Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5219643pxb; Wed, 26 Jan 2022 07:18:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwprliYGA/lmjIkJmMOzJl2OT226++RlOE7iAEI55kKlEokYW68RaLJcMHLS3nTtDiY7qo2 X-Received: by 2002:a50:c388:: with SMTP id h8mr24958940edf.218.1643210338760; Wed, 26 Jan 2022 07:18:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643210338; cv=none; d=google.com; s=arc-20160816; b=p5MEBK5fGl5h2B5o9MqUWBFr1EA0ZTIOIlkn1Mvx48pT79Fnn9szBKUzokc0ad+GNF zrYbn/wqDbrYiWciwVQZJMrYEwN3OtRyFjFxBDnHMqXBqhLkiItLJ9UotwLKXN8pjzj+ vOjo9AlaVDlTLSpE06LwnHSZnI3cLBo/tA+7koI4pSTwqRzk//3YIkBcZccPQM/lVkdd d+WGtU7x4KdziiqjlItx/1Vm9dmmVusTIzzwNzsqxNvQrjuN/rRDAXSKwAivAVu4bWjw B3tYz0DFTSd6jJH2wYtH4DNM46MFTvxj25X2zk5ptQ4abQu6LXK983u1r3SXyyJMgv1B ce5w== 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=tybuKvqteTjWOhUBPBWoELUY2iZK9BTGVqozLU19AoY=; b=pqwfaQWuC58emlw6uqfZYLDgOaARhTq6K35dZf48gdsCX+Px6ANZh0EyaZ0rcILeSl HMizDa+qOxVgkdYoM3qD212aZv6HX0msPYrRwIqD5SywkAkt0mTmxxFie+2/FWJ6F2Pu ux9U2DoLg8NXewAMXfboYblXfD7GFn2MiNi7/Ltp27OKn1UeinZYOTasLe2LMcAEdrHq AViOrbYoIQtHEpNm6ravnZE7khM3ZgdFxaT2ykgPh4tthE/kegPMDfiU40efLXeUEpbn RcZtEZqrMAwdYZzTypufs36MMDUF6ny203Z/xd7QIqkRu5UNT/HOBKHJphIXnFkh3TEC pW6w== 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 hr2si6993491ejc.472.2022.01.26.07.18.32; Wed, 26 Jan 2022 07:18:58 -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 S235975AbiAZBs3 (ORCPT + 99 others); Tue, 25 Jan 2022 20:48:29 -0500 Received: from twspam01.aspeedtech.com ([211.20.114.71]:9057 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235972AbiAZBs0 (ORCPT ); Tue, 25 Jan 2022 20:48:26 -0500 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 20Q1eo9C090811; Wed, 26 Jan 2022 09:40:50 +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, 26 Jan 2022 09:48:13 +0800 From: Jammy Huang To: , , , , , , , , Subject: [PATCH v5 1/2] media: aspeed: Add macro for the fields of the mode-detect registers Date: Wed, 26 Jan 2022 09:47:24 +0800 Message-ID: <20220126014725.1511-2-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126014725.1511-1-jammy_huang@aspeedtech.com> References: <20220126014725.1511-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 20Q1eo9C090811 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 51fb18453b81..5d1ec3de50ad 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -178,6 +178,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 @@ -1105,7 +1111,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)); } static void aspeed_video_start(struct aspeed_video *video) -- 2.25.1