From patchwork Wed Nov 22 13:13:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13464866 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D843C61D97 for ; Wed, 22 Nov 2023 13:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sia4XEZeefMCU+rbGIKdStf+Io6NgSj96+np8wqm6r0=; b=mfxoc6ym5omy3H Gz/yYkxRNHRLDuw8pVZpncjzw9B96rMczRJPLd1wD0GzXu2iJb2/ZpFAB+HEa0AH3Ij6r73B5fk2o jJ2zG5y6c5ZuSZbktq1JHi+EShO7IhmeePP9N9x/EPHtuo0BnzPLEVKrjuFKb7Txes7p7rhKtX4iF 2cZ53hi28RejWxkTeAKj1veuYPq8KhYIGme37BodSehN6bo6pYXgBgmwr3d4iRc7nSWH7ZvW2vvCr AhWTBCHhhHFHiyDhVC7xbfre5gXuOYt57vL3ygJVvkPau6z46VX3OtDxId/sYuEfcd5QjOeS7XTjD cKcxeBgKoEckbqTh9B/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5n3m-001uw3-0Y; Wed, 22 Nov 2023 13:14:30 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5n3b-001ur6-0I for linux-arm-kernel@lists.infradead.org; Wed, 22 Nov 2023 13:14:20 +0000 Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 18BDF29A; Wed, 22 Nov 2023 14:13:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1700658821; bh=T8/2/eVWOaSK74Zk/huyWx16HxOvhau72w6ke9khnUk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=q9SkXhu4AQI4R7ZMreUYZcuHkeiW7TLR2XuUdvegGAgerF8PVMtLjXJtq6eval9aC JD/KOU8ZnYDr04uxr0kIZo4+gO4qlE0UDhqAq6vkzN+76f/0KXjXQuSwhmfp1EKhzu ZsQSiRHaj7FGYrtYcfhg9jFcCKD5aKciIKJdsLLY= From: Tomi Valkeinen Date: Wed, 22 Nov 2023 15:13:48 +0200 Subject: [PATCH 1/2] media: imx-mipi-csis: Fix clock handling in remove() MIME-Version: 1.0 Message-Id: <20231122-imx-csis-v1-1-0617368eb996@ideasonboard.com> References: <20231122-imx-csis-v1-0-0617368eb996@ideasonboard.com> In-Reply-To: <20231122-imx-csis-v1-0-0617368eb996@ideasonboard.com> To: Kieran Bingham , Rui Miguel Silva , Laurent Pinchart , Martin Kepplinger , Purism Kernel Team , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1197; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=T8/2/eVWOaSK74Zk/huyWx16HxOvhau72w6ke9khnUk=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlXf6hZE9bpUJV4Xp6/7RrJtsJvOTki0kH73Zcr 0+T/K2GQRyJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZV3+oQAKCRD6PaqMvJYe 9YCED/oCFm3ABpBs9PrRCrZNYgdhLzwVyaBddL4bnnEd2fj7Vebw/mDfOLyots2G/qgh3WUNpMO JZhPrZ+Xi4aoVX7kC1i0TM5nZu9POri2ZeExU4FvkSmumv5W9bX7PRAduTVaVEBlYP7Lo+9RGqq vuOXFereBiNFf6eORCGVVkqOl0QH8jp//mpAToioKRNnPKR2XoJ+/uFY3FJxdhGnGPv//bwiSK/ eAzx29cSVH5F8wzNwZyTsfpMawgXe34+olYfRGKDgimDqhxrTUgzL/+iKEy3++jH+LxRnYUBAtR EpYBh2ZHXAxLj0HKY/qHKf+hP2WLQgd/ixo56OZOhE7J12lJI9lZdGZQ/wECil0sHzywmXE2TVN ylQZoqv7AnaA5+v9YzuTFyG/UKGibHafEtR6+gmYgG6y3yWdslKRuMtPo9nSsUgOLIQX1qUPhVh 2pKA4F7IhpgxruyQxR7nCSBl3M1nLHgYpZKL7DRzSP4dHZk1szlGszk8e+k0EN/Ob7vINkiw28E ayWAgQ15wKhtqA/xgzSy6nWF6/grR/Xft73DHDxnxS6ikIeptO0Z+nz0L/iQob6BqsxGe+TEfZ8 8jI9JDALlV+H5lt87UkVKvemv2BaNhptriVCQpNs+BPuRpxrRO9ej6ab58qBqC8cmpNqQoOdH8W WyCa57C2XU1DUKA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231122_051419_288984_87249C3D X-CRM114-Status: GOOD ( 11.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver always calls mipi_csis_runtime_suspend() and mipi_csis_clk_disable() in remove(). This causes multiple WARNs from the kernel, as the clocks get disabled too many times. Fix the remove() to call mipi_csis_runtime_suspend() and mipi_csis_clk_disable() in a way that reverses what is done in probe(). Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/media/platform/nxp/imx-mipi-csis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c index 6cb20b45e0a1..b39d7aeba750 100644 --- a/drivers/media/platform/nxp/imx-mipi-csis.c +++ b/drivers/media/platform/nxp/imx-mipi-csis.c @@ -1502,8 +1502,10 @@ static void mipi_csis_remove(struct platform_device *pdev) v4l2_async_nf_cleanup(&csis->notifier); v4l2_async_unregister_subdev(&csis->sd); + if (!pm_runtime_enabled(&pdev->dev)) + mipi_csis_runtime_suspend(&pdev->dev); + pm_runtime_disable(&pdev->dev); - mipi_csis_runtime_suspend(&pdev->dev); mipi_csis_clk_disable(csis); v4l2_subdev_cleanup(&csis->sd); media_entity_cleanup(&csis->sd.entity);