Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3579347pxb; Mon, 24 Jan 2022 12:41:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfxArTgTfubqSl4+zF4fblm/wfAEI4/dwgQquSkphFByt0HLVe9R1ri2AXMoWUbE9GXVhh X-Received: by 2002:a17:90a:eac5:: with SMTP id ev5mr9427pjb.147.1643056913257; Mon, 24 Jan 2022 12:41:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056913; cv=none; d=google.com; s=arc-20160816; b=kb7l65bfPdJ7X1JqV1zH2UqA7WRVuscEjWfrjP4CVIpsxspWz4zIPndsITj3Nxfde6 WIiihOONA98E5VIXrCMRudNiOf9cHxmqPDkGOISy22pJsDxqyEli1SRK9xHaFBs2JJXk xkmiwFaLC3CnVh7o5loE/yRwwJ8sy9oaaJdwgX1oFbsiR8hyIjHxt2WfD0LlZzZH7lLn myJELr+qv4AkHntvSeghp7daswNKdNMP13eOsZPOQ4XiCTRyLBSq+D+1C/MuYu6ISrZf Ep6JtQ2WzeHZFVWazLAdKeDvtxQ5hCopYvFbolrYmnZungOhTA+lJsdQSj8U948amq21 MBHg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1GFGMITN98OMgA+x0rGmIOJ3rU02FT88ofMqhef6V+M=; b=ch1pjihbJKzFeuUPWdVS6K85+xEt+8JNizWp3K4nV/tfVelA9bhhHtf9hLLZZx+We5 JMSmGQNoBGO2sne31pZEAj73GnpvD1Fo/jfq3S7bkQL5tB+bTDU02l/8xsNl/LgUHIS3 x0UobQEdr5KApJhvAATlHwzzBJhh1cD4tXAy7GaPHYS8g2UIoACEREQBboO64cY9mo8J HIXfmx34J5Gyxk+nLEvgjbdcZaugVjBUE1XBH0PE+xDjIgvxp6B1VLn+3/Dma7zLcU72 EDQQduhG+A32AF5vg1NS0ShKX6zhkHD5FKAxViDaEPviMSLYYWHEH4SKn73pFxK/HFm0 iHXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IynKtxFX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j20si7667964plc.105.2022.01.24.12.41.37; Mon, 24 Jan 2022 12:41:53 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IynKtxFX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245662AbiAXT6L (ORCPT + 99 others); Mon, 24 Jan 2022 14:58:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49672 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347799AbiAXT0d (ORCPT ); Mon, 24 Jan 2022 14:26:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 810CFB81239; Mon, 24 Jan 2022 19:26:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B626C340E8; Mon, 24 Jan 2022 19:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052389; bh=hoWclYbzWFU22+lq/kIaZSoukxFXpex2giDGDMdzYwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IynKtxFX0cESh/HNR2gLKBMfqYkKt5SZCzdOv9wGnv3W0Yd616Ig6ZXp8S5os134U cLS5wpmT5vD29aUFOvPYKwuz//3YdCD2sgcB+tmThEi3CgOXMX/AHI0q+PrhUkcpnN o8Rflucs8azjcAKgzpWYFmxCX+bSdAjBh85LEQvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jammy Huang , Paul Menzel , Joel Stanley , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 043/320] media: aspeed: fix mode-detect always time out at 2nd run Date: Mon, 24 Jan 2022 19:40:27 +0100 Message-Id: <20220124183955.216607446@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jammy Huang [ Upstream commit 62cea52ad4bead0ae4be2cfe1142eb0aae0e9fbd ] 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(). Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") Signed-off-by: Jammy Huang Acked-by: Paul Menzel Reviewed-by: Joel Stanley Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- 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 6dde49d9aa4c2..be1238f22b8ae 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -477,6 +477,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); } @@ -764,10 +768,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.34.1