Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5280088pxb; Wed, 19 Jan 2022 15:09:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJweIeEIJIIYY2zxMpu1OB2cOXDGs0vJlXaLm1JkRiKpyqHWScdNGk73dMyTHVyF0vVhnGZW X-Received: by 2002:a17:90a:bd09:: with SMTP id y9mr7034290pjr.57.1642633768722; Wed, 19 Jan 2022 15:09:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642633768; cv=none; d=google.com; s=arc-20160816; b=iOoXstsexjfL63Nk+7gsP0NPW5Z1ehJV369FdTz0lDDhEXsz76GhRQVdX4zpA6xdsS OgSvR8fraPIU4AZRPp37oeZ9a1uHinBS+qjfcyFsXhmK0tBgccqefP+0RVI8POs9tZYm 7N5DxBewgfm225PstZTn5kklGgR0nK3o8Z1rphZj0Ud6fBKpF9bGkeNeclv4V3TYNhEc UCUOEAvYgQGHCe+UGCnDYO0SphVzTW6QqNfOr3OFaUD+CTz1npUbAXAZb9Dq4SjCPMu0 Nz2CkMcggWnmFf7l8YvfwJCJCnfIfNdmO1Hlu4p9yniomKqbzrf4Qyshe7OhynFRqiJB MwDw== 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=Z/s8Pld54hYx/jr1X2h7B+xuRysnxy1n1NcfkoXCWi8=; b=qi+ezywm1GI2RqPeKX9ekAMwvP0lHvwy5wBwjoZUmEXhYD8TrMk0dptyqM5khX6AJ3 Npp2wvej4CgbKzTvl5ClsrKxf/Szxex+x6T0qdD/NvSYSE3wrtqIJpD6Wa3Z/tEUuw1t v8DJiuCZ9NVt57SAM7SQZYKKnyFCynYJsVubDRe+8K7RXYujf/AATDYpPjFws2RmRyyj A2/9qxCDSh5qriFPRi7Y8FxfgOLVq2Lu7feyFtjHwPgvq9DyBPPes9xi7whpJjnEHJew iVXbQKMG83/CMDmMkqLxY2bkdExbi0vUu6v/AFTTRLpfrZujLqs02I7Npivglm6GmVJh wGqQ== 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 g6si956887plt.615.2022.01.19.15.09.16; Wed, 19 Jan 2022 15:09:28 -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 S1344900AbiARIpT (ORCPT + 99 others); Tue, 18 Jan 2022 03:45:19 -0500 Received: from twspam01.aspeedtech.com ([211.20.114.71]:63939 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344920AbiARIpR (ORCPT ); Tue, 18 Jan 2022 03:45:17 -0500 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 20I8c8Qh013912; Tue, 18 Jan 2022 16:38:09 +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 2/2] video: aspeed: Fix unstable timing detection Date: Tue, 18 Jan 2022 16:44:49 +0800 Message-ID: <20220118084449.5182-3-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 20I8c8Qh013912 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using stable-signal in resolution detection, and try detection again if unstable. VE_MODE_DETECT_EXTSRC_ADC: 1 if video source is from ADC output. VE_MODE_DETECT_H_STABLE: 1 if horizontal signal detection is stable. VE_MODE_DETECT_V_STABLE: 1 if vertical signal detection is stable. Signed-off-by: Jammy Huang --- drivers/media/platform/aspeed-video.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c index 5ba4d70c8dab..585ee2997d44 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -165,9 +165,14 @@ #define VE_MODE_DETECT_STATUS 0x098 #define VE_MODE_DETECT_H_PERIOD GENMASK(11, 0) +#define VE_MODE_DETECT_EXTSRC_ADC BIT(12) +#define VE_MODE_DETECT_H_STABLE BIT(13) +#define VE_MODE_DETECT_V_STABLE BIT(14) #define VE_MODE_DETECT_V_LINES GENMASK(27, 16) #define VE_MODE_DETECT_STATUS_VSYNC BIT(28) #define VE_MODE_DETECT_STATUS_HSYNC BIT(29) +#define VE_MODE_DETECT_VSYNC_RDY BIT(30) +#define VE_MODE_DETECT_HSYNC_RDY BIT(31) #define VE_SYNC_STATUS 0x09c #define VE_SYNC_STATUS_HSYNC GENMASK(11, 0) @@ -971,6 +976,13 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) return; } + mds = aspeed_video_read(video, VE_MODE_DETECT_STATUS); + // try detection again if current signal isn't stable + if (!(mds & VE_MODE_DETECT_H_STABLE) || + !(mds & VE_MODE_DETECT_V_STABLE) || + (mds & VE_MODE_DETECT_EXTSRC_ADC)) + continue; + aspeed_video_check_and_set_polarity(video); aspeed_video_enable_mode_detect(video); -- 2.25.1