Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2390174lqp; Sun, 24 Mar 2024 17:19:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHeCcIysce4Vc93mYnoE503bbvtaxOBckcC0J4+69WdfMD6BBPkO55zJhlWmqHFk1JIg8/qaTyjcWeMUmOYtrI6xRkmzW9cs8TEZJp/A== X-Google-Smtp-Source: AGHT+IGlyZt11UPO9LcOTsFmPVNsU66ALW4dezdo8hVz/Xhi2VscuAmkDsrz2tfFSbeAysysEELv X-Received: by 2002:a05:6830:6e9a:b0:6e6:d908:6d17 with SMTP id ed26-20020a0568306e9a00b006e6d9086d17mr1525357otb.21.1711325941498; Sun, 24 Mar 2024 17:19:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711325941; cv=pass; d=google.com; s=arc-20160816; b=OJQ59Xsj3tBucUr/tW/YkDY1kg24uoAH0HErj8LXNIMkW2m2rkQfFmW5cHcSi9C8xB j4fGg6eNZpNON7HD8z+6Z9GT5bH06c0vFldFCjeX/ZXPQhyhvfPHR60KtJYZQ/xh1X2n CkxhkKL5QYZmp8bkxDT8/+wmYQKkxoVNGAN5oxaMwD+nH48JGB47ApD+w8JtyWBnx1Vc xrFinQ1Unja4WNa0IgHl0VUmYmfHOZpfG3ANtYnm1DkvbqI0A+wAJxtf4HDIVhpu45y2 vCYWJAyOY4BoJfQDhaOWTooNVkcrrua1vrXWZh8AJMkPC063DcFZAMOi3it0dnD4EMH/ 01rA== 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=8h2mM44Kh5paH8/uYWrEGX2UcpddsEDbHQnvRELmrXI=; fh=qPC/o307FcKMX9e48ELEOR3WX9/nitAnIX4Zc73R9i4=; b=FEj5NHFs4XkH2RKI2jcDaTjkRpN9jHOpRYxlX+sQT9lVBXi+kioEiI92kSM2kDdpUL FrQqAcJYRMEj7lCuQ7p0+HV5YSlxPsZqJd8AeThSQ+vS5pr282RT7cwWqFe/RTQImeY7 3chCUs6cgmEvV2t9AcRqQWrIa0asFhSltVphCviRqdrzpwo1XOUQoR3jwvh2g5gFAxRl o7fjqxA0c1Ao0CRJV1tfi7hkamqShHd2F4F8PsBWHbljAdLkq/x7+1kmgBnDmhJKpMgg AlyHstERKlsvg2y8C6fadg4D4D99BOHab75vhCuyIhnLDRhu0rHf8/0xYdzZddK7JCsd EmAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ScBMFXWs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u34-20020a634562000000b005cdacf9065fsi6340661pgk.720.2024.03.24.17.19.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:19:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ScBMFXWs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113326-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 205B7B22841 for ; Mon, 25 Mar 2024 00:10:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB84919598D; Sun, 24 Mar 2024 22:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ScBMFXWs" 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 E767313CEF4; Sun, 24 Mar 2024 22:42:07 +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=1711320128; cv=none; b=WvgS2SQHDJPMChHrpOQYYv7ZZx60v7Yb+e9hgsc2wLnoFs9/6lDiYBQwtCZ5JrgwB2aQ/9BfwOM7EKYBm0HmGdr9JvHdSwfkYpqNF9Lw0Ptxx1EbY85kBUNbEOfHu6htTFfvlNBIEjHpe4pSGrFRo56/hosV81U6z9Ky6KdK7Wo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320128; c=relaxed/simple; bh=ak/b9uoeh3ms/KH68WZNnqgKysDllLzWDpMRf02gXZ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=utG0cBJGR1MVo5mvhLTTMgpHjbpqEKfiGl/H7sr7AJMlWUf18gchmZ2dmdNYyvb5ULmYjsi9IFFuuS5zWxwquY8Gwh0Ju5zmm9mPE0riibOabH2nAKQcE1X3wnEXAD1dZBIFZhvfPDGnBmUCTwqjFbOFScR2ZBSA5WbKUqYTUMo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ScBMFXWs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30AFCC433F1; Sun, 24 Mar 2024 22:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320127; bh=ak/b9uoeh3ms/KH68WZNnqgKysDllLzWDpMRf02gXZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ScBMFXWs/iHS37IB27h7UkXZbwOjB78WAB8svmU7IAWqfF34FtCAVu0xEL96rnc11 RJYPj5wSPAJAfE5HXE+QY0Whd90bECz6+vvJx2SFX2AyKlOmxLONzKKYTxTaJTN8gv wfL1TzEDluaJrtKS1r7l3OnKPkYcZBLSCrKVj74TH8yvER9WZmU5rGt5+VYQdLlk1V YkLqI9njUTPiX/J8B/2z5wj3wCEmqxHKvQzre6SBeR/WGBoePN8xMukR5uDbVnHyQ/ HVRLypnBVO5oKXXdYBzLK3FYivkMRHyRWKMXENVYPXH9weEG4W3TN9ATiMbUPH+K7N jmyLxrKXerZ1A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jernej Skrabec , Hans Verkuil , Sasha Levin Subject: [PATCH 6.8 435/715] media: sun8i-di: Fix power on/off sequences Date: Sun, 24 Mar 2024 18:30:14 -0400 Message-ID: <20240324223455.1342824-436-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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 26f6964996f2c..5d58a5e781371 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -929,11 +929,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); @@ -950,23 +957,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); @@ -977,11 +977,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