Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2567263lqp; Mon, 25 Mar 2024 02:54:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwwob22D2aMC6XrUwkhTk58gfwgo+NanaGaGCgfIA0GFxQjgX+MaTXTos4NIGraPs0Bjr6a7+vJzBQDHjoyNaMAqCX7X5YlJLtYJxyGQ== X-Google-Smtp-Source: AGHT+IE1E0EC8kbUn15ncjnCWb39zpUzDyveBtK3svejCvWWC86ALCMcQEjZ+bC8XgVjnE3tJNC9 X-Received: by 2002:ae9:e30e:0:b0:78a:29f3:afc7 with SMTP id v14-20020ae9e30e000000b0078a29f3afc7mr6952279qkf.42.1711360451871; Mon, 25 Mar 2024 02:54:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711360451; cv=pass; d=google.com; s=arc-20160816; b=A16jthIstfav/xc3X0p+/wK87LaUilzylCmwzJ5RrQOly1cMDV0FWsNs0uO4V3kfOI WLY8TvsvNlp3RVRU6T/rWZT136djNEkluZf08Mz7tdCI0hiaL4kboRRsrMkYJbV3KWky QClEfzV7lYAdz+pT2JWTaP3VXAe7G1whmUxBfbcKC5Pk86dypFmiwdiqi1nPxJELYk+b 6im8Tq7roULGyIXHAJzhPm5MQ378f6wuTqsHI54HPg+79cmCst/B2CDgK7LHpPcHIcyH 80FWFqZZISOKvDeq3q6ZK2m+XZ5MuUMEer9sHpu5Vd+tHNNg9vsPgvI1DBroxEgUf/A4 J/Ew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VpRnCTFNxH2Kx7emabzBxAAEIIpmbpvMLxywlpFp6j8=; fh=qPC/o307FcKMX9e48ELEOR3WX9/nitAnIX4Zc73R9i4=; b=JpqbmZqMzJvZrrWki9Q36k1rbh4JlR5/dBEvc5InlzBKVIWyr7Z/Annb+Tyn/aDilP Tq0YXEL8I3LofGxLPW4afuzXeoDxsYDq2ufekViCNTSmU49ztWmR+9jne9itCRE1y/Kt z+WpjXlUO09JBOZ+ykEsdosCyX6OUDtXRjQJUZcBlpkn3FfykXCBDtY5hPXvgANw9SA2 ZV7QdmZXw+Evk5b/vJTungzKX9XLgeBJYaZ9JVcNbnEm9x/0ZUYTl1i34G6knm/Ly/94 8CzsgsbeEnFPzGXlQ2dSlYJ3BLBxmHcPQQ5EFSqgDL+HhbsiiMI9tjvF7k3DWhUpr8Ln C+Kg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BW6WYAG1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115959-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h18-20020a37de12000000b00789d592491fsi5086481qkj.265.2024.03.25.02.54.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:54:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115959-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BW6WYAG1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115959-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 698761C310E9 for ; Mon, 25 Mar 2024 09:54:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D5F516F90F; Mon, 25 Mar 2024 03:04:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BW6WYAG1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2EEF14AD32; Sun, 24 Mar 2024 23:16:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322220; cv=none; b=u34LNjKeKIN8aNIKOhcoU5CoDQl8eaIeofsuhF/UtiefIOAHtm0mVd3h7sCXM5MMZo6ehPAKbWld7J58a0CJlGez+sUugvTsklqzX1gTXhhaLl7HcxyudWY3qf9g8Mar23JNZifXz1imKV0zeRPtvAEqur1yrAlx0HkC2qIGYJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322220; c=relaxed/simple; bh=n9RmBDkTknXlF+1oBI7LpD65+Xvb2cgfpRelD4wFYjY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iJLwQU0DPdE+qpqvsfeAIUTKjsLvFYTuUseKBKN3+s0MSHsMrAsp50AwA9nWE7IcXfZjuI8McZLf4Yhykl5XIlrqrp9CBK+KG8SYU9Y1aHTPS/xJ1nYcI3EL+GlRJvP9F8tqJEBCFfO1QOkxlni31TRa6iiioROsWaT3W3hCx3w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BW6WYAG1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96D30C433C7; Sun, 24 Mar 2024 23:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322219; bh=n9RmBDkTknXlF+1oBI7LpD65+Xvb2cgfpRelD4wFYjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BW6WYAG1+WDkpayrnxytR9sRSgabvlFrwJyW6cPjG5SPcwq7lnGCHKbmbjYnQ1l2q f5e7KDliuO/E+rcl6JGYdm57pUvJ5rbIHWhtI4enLifaNgTGZ7od69TNasmAQ5qPaC oiMudjeL0Qel7i2zpE5xGc6FAYZUeinRUsqFKJUH8uiXOVC0hqvJ5lgvnb/t+WamQ5 iYCQUmYTqjUx61i3xysJZC25hatwemj3a+Pbj7qYzvHjF4ZCnwA3JNAuQ0eP4NmpH2 4GAKbYbAmkG+i6IsYCg24mpV86134PUPbV+HyzaJPuimQaEolSdZWi3gqpJfqilhUO dROQ98msNssPw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jernej Skrabec , Hans Verkuil , Sasha Levin Subject: [PATCH 6.1 299/451] media: sun8i-di: Fix power on/off sequences Date: Sun, 24 Mar 2024 19:09:35 -0400 Message-ID: <20240324231207.1351418-300-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Jernej Skrabec [ Upstream commit cff104e33bad38f4b2c8d58816a7accfaa2879f9 ] According to user manual, reset line should be deasserted before clocks are enabled. Also fix power down sequence to be reverse of that. Fixes: a4260ea49547 ("media: sun4i: Add H3 deinterlace driver") Signed-off-by: Jernej Skrabec Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c index 3e58de58cd89d..01b44dd708bd3 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -931,11 +931,18 @@ static int deinterlace_runtime_resume(struct device *device) return ret; } + ret = reset_control_deassert(dev->rstc); + if (ret) { + dev_err(dev->dev, "Failed to apply reset\n"); + + goto err_exclusive_rate; + } + ret = clk_prepare_enable(dev->bus_clk); if (ret) { dev_err(dev->dev, "Failed to enable bus clock\n"); - goto err_exclusive_rate; + goto err_rst; } ret = clk_prepare_enable(dev->mod_clk); @@ -952,23 +959,16 @@ static int deinterlace_runtime_resume(struct device *device) goto err_mod_clk; } - ret = reset_control_deassert(dev->rstc); - if (ret) { - dev_err(dev->dev, "Failed to apply reset\n"); - - goto err_ram_clk; - } - deinterlace_init(dev); return 0; -err_ram_clk: - clk_disable_unprepare(dev->ram_clk); err_mod_clk: clk_disable_unprepare(dev->mod_clk); err_bus_clk: clk_disable_unprepare(dev->bus_clk); +err_rst: + reset_control_assert(dev->rstc); err_exclusive_rate: clk_rate_exclusive_put(dev->mod_clk); @@ -979,11 +979,12 @@ static int deinterlace_runtime_suspend(struct device *device) { struct deinterlace_dev *dev = dev_get_drvdata(device); - reset_control_assert(dev->rstc); - clk_disable_unprepare(dev->ram_clk); clk_disable_unprepare(dev->mod_clk); clk_disable_unprepare(dev->bus_clk); + + reset_control_assert(dev->rstc); + clk_rate_exclusive_put(dev->mod_clk); return 0; -- 2.43.0