Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp25834pxb; Tue, 2 Nov 2021 22:33:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycu5XdZvszwBuGz49Kv4GhSpVXWISQb/+UrekJL1DcuP2p7abMYNgXbhSm0418Bs8rRh0V X-Received: by 2002:a17:907:7f1a:: with SMTP id qf26mr17957608ejc.543.1635917606237; Tue, 02 Nov 2021 22:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635917606; cv=none; d=google.com; s=arc-20160816; b=Zt7b/XkK+E/KFxGV2xTttFVVJH2OCXTWVODeYluRLjg0Iud56UwRLYNHR+OZ+9mFoG 1IrCHtiVSfZd8LDR3oMg3Az9ORcLBORyWdXLjjpb4KqM0EKgAWLLFjySoEBE0ECn9d+J 0yN7X8zplG6x8PQUF9vjrLBRgKutoc3l2NVcBPhWWw1W5AP2+TnZYOofj5Qieuwx9JLU evFe+zZ/3LloM7qajeEVXTXE2YUBFWn55cnyCdZo7mZcnOmHMk6TovyAbu1TxpRi7q3d d8vCs6/5vSw2ApbCd75IESeHqtT2D49pIZI/0SHTdnKpdtCWSgcFXYKYZMZ2mJAL1oS6 XSug== 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:cc:to:from; bh=PRQuosHmyRnQQYuMmQwAdTdlK0VRF0xrt8rqvYAdHP0=; b=vcVGfofnqr8Nko263XnOuyl07MysYntnYo6S8jhPb1RORwq4MCy/YVatAsJeKKDMjB wR7pLoopXY2pfeK85ME58upJTH+LVn3hcNGduB4z1uZmxMnJnDYMFpLDaiU4sC+7hjZk H8DmC4byPLhEV0MnQ6OSYMk0Nrxogz4ggkRnIHXWLT9xsYOIrly8v/6jI2MCivTK3ePE zGyTOdUG3yXX/4kQ6EXsVnDfQyfu5Q2wpu+sCmOOyxGiR8vHlemP1M3ApSo6xdL8kKyg /1WwRZI9pmmnP7GFeiFIDfxKmuY3gUbYlMzeQHRcgNCZknydHFfRZm7UZa7YXADl7oUU GV/Q== 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 dd15si2096173ejc.541.2021.11.02.22.32.48; Tue, 02 Nov 2021 22:33:26 -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 S230046AbhKCFbQ (ORCPT + 99 others); Wed, 3 Nov 2021 01:31:16 -0400 Received: from twspam01.aspeedtech.com ([211.20.114.71]:50968 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbhKCFbP (ORCPT ); Wed, 3 Nov 2021 01:31:15 -0400 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 1A355hk5074274; Wed, 3 Nov 2021 13:05:43 +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, 3 Nov 2021 13:28:34 +0800 From: Jammy Huang To: , , , , , , , , CC: Paul Menzel Subject: [PATCH v3] media: aspeed: fix mode-detect always time out at 2nd run Date: Wed, 3 Nov 2021 13:29:11 +0800 Message-ID: <20211103052911.23646-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 1A355hk5074274 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 time out because VE_SEQ_CTRL_TRIG_MODE_DET is only cleared after 1st mode-detect. To fix the problem, just clear VE_SEQ_CTRL_TRIG_MODE_DET before setting it in aspeed_video_enable_mode_detect(). Signed-off-by: Jammy Huang Acked-by: Paul Menzel Reviewed-by: Joel Stanley --- v3: - add tag v2: - update commit message --- 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 5ffbabf884eb..fea5e4d0927e 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -518,6 +518,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); } @@ -809,10 +813,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