Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3912197pxb; Tue, 2 Nov 2021 00:14:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwI1VbVqooFDyJzeg+N28iDPauhbMnahhUl/zZ0TaSTTOeHTjbCxSIR3bGpFtqd0+ZGWbo/ X-Received: by 2002:a05:6e02:1588:: with SMTP id m8mr23779055ilu.188.1635837275331; Tue, 02 Nov 2021 00:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635837275; cv=none; d=google.com; s=arc-20160816; b=iB//CcmX5wkdZt68045jj5PgiiQlZePeIQ1pADOkcGKIHzSsiPD7ZDnhP5ZGDdBM2r zfv+NlW1fZhZFPQlNgBsADxSeZrcEfsc1hhzLJQZVGNZx3nwEYdCSKtZw47YLazOWVAQ rKBrLB2Q8p2DMMxnWoptcmL0hMocPNVFwOQwSFtoXTbU3V6o2wOa7gkhq3Pw+TrqpNKa CyeVJHhsrybd8CJ3HDsAlet0Qp9Y7q78w3029MZCvVWlf03HY/ObM+KO6DiSe91CJ5NC yP5ZfDXWNsL5271mImOm57hqibXQzQWDlPxKTjFN4fLQBdoc1PSljvWcEPO7WH0dewgJ c0aQ== 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 :message-id:date:subject:to:from; bh=KLY9TMI45C/b3eOEbpwWZQYNKAa2P5sovLJMGw8O9m0=; b=lGTw4Cs1r4/vOMpINgKyoGzrrA2lgrI11gQvTTDRTCQOw5uZ8ijX2ERDsm9NGc9D+9 Kl8K1r+eV52PJs/FErZxIGZpGraSpgJKj4jYRhvhur4dpG7N6S5hg2/ABhBPCuN5qJ6E TEiwdra6XRxWgbfEmvCJVdYbOhVAlvcSGMmo+EEryl47IMXLJDHmRsaKa/YQTi9UpMhZ oCrnKzVPIAQVCPSTZK4Jo0RYUncHepa2EIq61TsOO7ntxJ8dVjUC+VwK7B5Tjwf8aMUI J+TlcxVvX2zq9xAOdoxg+lthEfMbJNsMi7/qZC7ULgmvbzbXYKJhbz1R7umf5LAIAQEx IAdg== 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 p16si30683040iov.103.2021.11.02.00.14.24; Tue, 02 Nov 2021 00:14:35 -0700 (PDT) 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 S231186AbhKBHPy (ORCPT + 99 others); Tue, 2 Nov 2021 03:15:54 -0400 Received: from twspam01.aspeedtech.com ([211.20.114.71]:6866 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbhKBHPr (ORCPT ); Tue, 2 Nov 2021 03:15:47 -0400 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 1A26oHrr050484; Tue, 2 Nov 2021 14:50:17 +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, 2 Nov 2021 15:13:04 +0800 From: Jammy Huang To: , , , , , , , , Subject: [PATCH] media: aspeed: fix mode-detect always timeout at 2nd run Date: Tue, 2 Nov 2021 15:13:37 +0800 Message-ID: <20211102071337.5983-1-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 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 1A26oHrr050484 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org aspeed_video_get_resolution() will try to do res-detect again if the timing got in last try is invalid. But it will always timeout because VE_SEQ_CTRL_TRIG_MODE_DET only cleared after 1st mode-detect. To fix the problem, just clear VE_SEQ_CTRL_TRIG_MODE_DET before set in aspeed_video_enable_mode_detect(). Signed-off-by: Jammy Huang --- drivers/media/platform/aspeed-video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c index cd2b71c81e31..b470f4b68aa0 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -611,6 +611,10 @@ static void aspeed_video_enable_mode_detect(struct aspeed_video *video) aspeed_video_update(video, VE_INTERRUPT_CTRL, 0, VE_INTERRUPT_MODE_DETECT); + /* Disable mode detect in order to re-trigger */ + aspeed_video_update(video, VE_SEQ_CTRL, + VE_SEQ_CTRL_TRIG_MODE_DET, 0); + /* Trigger mode detect */ aspeed_video_update(video, VE_SEQ_CTRL, 0, VE_SEQ_CTRL_TRIG_MODE_DET); } @@ -930,10 +934,6 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) return; } - /* Disable mode detect in order to re-trigger */ - aspeed_video_update(video, VE_SEQ_CTRL, - VE_SEQ_CTRL_TRIG_MODE_DET, 0); - aspeed_video_check_and_set_polarity(video); aspeed_video_enable_mode_detect(video); -- 2.25.1