Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2580372lqp; Mon, 25 Mar 2024 03:24:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVT3n43I4hld0o34/sHwuJtk7ei+pQNHjMtImDVIpgARlhsrBSLz8vn6ive8E/hxRbtaNEqECYoyo/QlJuGXI3rncCfZAWY+Tza1WmIw== X-Google-Smtp-Source: AGHT+IF6JXJfqWTpL9Vby/hyW2IMa2p8FwtmHtIGhM8x+vEzkeVt7Kh6ON9CdsBCkvrIldzGjCAR X-Received: by 2002:a05:6214:f61:b0:696:8de9:dc1 with SMTP id iy1-20020a0562140f6100b006968de90dc1mr2743690qvb.44.1711362272445; Mon, 25 Mar 2024 03:24:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711362272; cv=pass; d=google.com; s=arc-20160816; b=knSza3RzpHQi+EmDmt1c2Ti/my/ELjIy6oBjqE1IgRFdnjVn0VrnBMV3t+lPH4//zY RI2Cu1EmSak1UUDyPo6UYIYOSQRup5IAM1ewsnZRX6DZ/NoBjOxBMjSNboBC1ywUfYaW BFbNWpx+2eKKZyLNzY4gw0z93OWKhbjMe+LGJCRWMhq8pmbCsRolv6OTsQqtyRHnuGFN 0sc0uU3Em2yhHjBEWfEIhXDQW9VMnjWuDK9+CrITUye41Bxapu/sb1/ihGFM9bTlt7go 5L3gpWk5jxH98eEj2YJjUeHdKvB4bgQowdTM90EebuML+QR3Ok8AjGDSX99owwGllUsU 34Og== 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=aurZHLxi0o/J55NqdeYXS7WiGRVxnzx6KWHhPFwC4VE=; fh=qPC/o307FcKMX9e48ELEOR3WX9/nitAnIX4Zc73R9i4=; b=llbNpdR9MRAE0S4KdZ7iJpxO5yRsb0UUo04T+yzk1Nm06Whr3XQm0mzMmbDVeFUz6t FH6zOabaS6ifsQFMoldxWnPsFJqxAyN9qfCjLd80qpSvW4NjwT9SsLrY025qeiDzmqbr gt9lCCjZg7S6h3SVKHyAq179gvfjKdGtMq7c/Cvq/dxSg7BGpdEqfouKtVjrweheCYvU zawJfc6ONCK4s/GoPMawzIw3R7qjSF/EegET9NY8A4LyFuVT8nkAaxN2jtYLaIrYK45n 1xLmRysxUIGB23ob21jRF4QKYA7lDXlg2CKOSxGNaZsVGQAvJvnn5Xz7ZDgMJSDoa64N vq1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=peVo8nRn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116184-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j11-20020a05620a146b00b00789e8207842si4898021qkl.315.2024.03.25.03.24.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:24:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=peVo8nRn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116184-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 2C09B1C328C8 for ; Mon, 25 Mar 2024 10:24:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CB583B8E48; Mon, 25 Mar 2024 03:33:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="peVo8nRn" 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 A133017C63D; Sun, 24 Mar 2024 23:42:56 +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=1711323776; cv=none; b=SyGsMnuWuO/5QGHYWohc7qEiiTyroCpBRgoM1dGuHk/0F1+kFKKlYrkEUS24vC36AnzdAtbocFBp2CobP6ximew9GJWQNq3v4aAbwEXhRzlO0LOgbi+tbL4KX5TgkuEV//izDjzK+nlSwWqqbnSlK4zeNxBbcnPNv6XzmUyl0aQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323776; c=relaxed/simple; bh=iYn8hq6s2Qn3vdHi8ZTdnpLNgfPLwVGSAJnvl2Q+Sfo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ru89oV7kaobrPrRm/aIUxt7VZq/MZ0VrNv/6NquD44K9pVHNCha0fwAQyrSlIw4vcwzfoZIwr5BO4wQ4bZdDKcohH0iu/Twu34UQREUgpemT6Tp+sNTrUeygDgevn5HVzjIQpTIUsrZ/Iwb3mb+SChScUgkqB73gosNb/gNhr0c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=peVo8nRn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E11DFC433C7; Sun, 24 Mar 2024 23:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323776; bh=iYn8hq6s2Qn3vdHi8ZTdnpLNgfPLwVGSAJnvl2Q+Sfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=peVo8nRnpwTd+ITZG/VehJI1g7VfswwfGgMm8CBCW/O1K8ZR/cF81loY++PmaJJoH gRTBDzL4RyRk8ctWxyL2mPBnMrmqNINAhajFMvaxFwlM8qIBP/Fsh9DLBL+JinoUlM ZMH2g8mlPhpA/mQuIQK/nYcdUlBV48SGtGuylg/GqmhZM0YCn8UmjTEBIY5WDTkpd7 0PxMA4AcFPoLYEhZop9dwLC1sXNuqXG/S1KYuSaMwyhZb0Vd7HxHt4Ch6bDGfUbJOr NKjIIY/fjJO5G7wJiNbUzJjo57b4TLeRTdsVKMvbmkkUOAwWkADN7eSahpAYcAsbcT 3mdk3NtTeV1xQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jernej Skrabec , Hans Verkuil , Sasha Levin Subject: [PATCH 5.10 152/238] media: sun8i-di: Fix power on/off sequences Date: Sun, 24 Mar 2024 19:39:00 -0400 Message-ID: <20240324234027.1354210-153-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 a9d3272940be0..cb6d32c59191f 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -937,11 +937,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); @@ -958,23 +965,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); @@ -985,11 +985,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