Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3694540pxb; Mon, 24 Jan 2022 15:34:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmG9crTy0DxRty7G4Yj+YIl4mQoNmWozzXip4PEPlHK0tuDuDe42Zc2zvooG59St0Z3LBe X-Received: by 2002:a63:a84e:: with SMTP id i14mr13603090pgp.159.1643067279097; Mon, 24 Jan 2022 15:34:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067279; cv=none; d=google.com; s=arc-20160816; b=MKyHeSwmKRQr6HA8fy1STwn1xFW0TQgAmoBzMUIIe0QGUxtYDhLz4YpFE+A556Ykdl w15XBIYhlZkpVlZBL1PqBNetF75mcl/3f08p3Unc8Hez7tfxZ4qZM6K7k3/+KNu5ClHb oHIFFnYchHzTjb35jgpF91LjKX1QHaQ0qwos912b3cUUQ/xdH8ZMZQRv3wSU46KWt+TT h/FR8inEW+jbii6Kw+5SLIc/BPT6iyieeU6NOixZVOtCGIFFILtjtdzf/k8yFiKd8PHr 68KSqIw8aTAkR1SpTKd1EbU9Uld82OSRYRBm069wASGUKLLgs//Uv3lK01wzKGUAk7dB nmJQ== 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=JN/NmM96QEvG2J8BFCCN2Rexgo7zILHkSwJwLhmzalI=; b=m6Uc9lPzOONpRLpKJNBnsBJb3qYWN07jQPsymTW7c86LHNdi8JCOnZBowy8ua5FBlk hXEUYlld2k+sGObCdI/qlRj+JUjamgh0ayUS+fkejW2zTWw9P3JIzBRVEtrSjSyBoAFG Xraub2AW/UJSy5IGleM24rGuahUFX+zpoNEnTEuTbSU5McBqHSq7LsVvGj9j2oFC4UrM /qxuOOnS/7F5KkDzxtEchknt6Ju3FtZlr5muyPKhGXjhqDKpEc8Rwq4mZXBdbTh6FGv7 nxnnSp5TIFx6MWEDPW/DalWFQQ1P6AU+DgQOe5dtp92yQ1P2mefhvTtdk6ivF767Hwit UxEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EuSZKPIK; 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 y16si14513722pfl.75.2022.01.24.15.34.27; Mon, 24 Jan 2022 15:34:39 -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=EuSZKPIK; 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 S1850848AbiAXXbA (ORCPT + 99 others); Mon, 24 Jan 2022 18:31:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835751AbiAXWhZ (ORCPT ); Mon, 24 Jan 2022 17:37:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A85D7C0E9BA9; Mon, 24 Jan 2022 12:59:02 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 47CAA61342; Mon, 24 Jan 2022 20:59:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28421C340E5; Mon, 24 Jan 2022 20:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057941; bh=AwFJn6/pMMxcV4YXEZ5zf98OztZsn5CIgYkwv9snTGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EuSZKPIKHC5pEHdOEMxZhpeKSKzu7q82fEh9QlJo6XI9tWosZiIucrIhwCCTUMg+/ O+Sw3iix5zJELd2lmILtSdGQc/wc8OfnuvKQjrktDophKEbNF+BCmT7HyljHAUJvul bBUkmUJruCffxPzTW9RFoITg20PSvfFBoiYgTaFE= 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.16 0130/1039] media: aspeed: fix mode-detect always time out at 2nd run Date: Mon, 24 Jan 2022 19:31:59 +0100 Message-Id: <20220124184129.533329949@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 cad3f97515aef..136383ad0e97c 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -539,6 +539,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); } @@ -824,10 +828,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