From patchwork Wed Nov 22 15:21:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 168411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1402237vqb; Wed, 22 Nov 2023 07:24:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IESm3TgQ+KurfdyWhUv41QWUAYmZaACI1TWBWFfxbSnszMDiIPKd2nQAH2LkqP+zWD67NOV X-Received: by 2002:a05:6a20:841e:b0:188:c44:61d with SMTP id c30-20020a056a20841e00b001880c44061dmr2695256pzd.62.1700666660741; Wed, 22 Nov 2023 07:24:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700666660; cv=none; d=google.com; s=arc-20160816; b=Gdw5LUtX+y2WRVloPmPNPGejcaa0vGFJL4OzWVHbnChIgxwPC9MAA8KpadAslfG0ji +SeZo8Zb7xnXhb9E4g056AWnA/KGz6HR9oqYFuF4UKKe3cTF69t6+CYMR0e+pm/f8dcY FQRvNohqy22vdRyS0v/ywcIcTlI9F1xuMykm1G1zQSKroxKhhJI4RMzKBrdiBGyaBKlc rBKpqdGYW77CYCHLESw0yKB78cVkrRhMCHsvNFV5k/uzt0lcZoLpgBoEAo8tr6bQLamw iw99eDKK0tMtDxYNvgtasI8QlT87WFQmH4ew7DvtARyDMir4A4N6HDJXZ2Go4UkLfXrQ vrig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=QW4NvdOgylJZcYNCxWxQXowS0QaJBdvmLl1hbNpEqKA=; fh=7dkMOs5/tPCl/heSmN/G4SnIn36MQ9Q1x2sCPQaV5HQ=; b=rE3qhZzR4Baz6zf9bwwS7NbdiK1gKXKf5INdUwRaC3N4VFEn+EXImen2Rom+pBHii6 DH/kw1llQyFzqfRv+zUWMr6mggthmWhYG7q43sglbLevtwfbUa2G4FbRmGMIOro6U1xV 0p671CMA4TeoV04hjUOdcEEh5vxTDhR1pFeKSC2tQxzuAZWarm4apBP+1Kmw28pBpEx9 4/ASBftvREaxnJyi5In9Bl/iblt2AYke1Uz0bfE19Gz2ywVDXkis56IPOjF5bfZwU33Q sAyaCmxWd8EgdIqWdPlQlrFbZjF/g2Tqtob0U28+jV12FOAaXxElsxnkdZl+LtTGq/9c vHOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=wIgzJjSf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id n12-20020a63e04c000000b005b90b2d9178si12355191pgj.796.2023.11.22.07.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 07:24:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=wIgzJjSf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6C96880564B8; Wed, 22 Nov 2023 07:22:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344236AbjKVPWA (ORCPT + 99 others); Wed, 22 Nov 2023 10:22:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234357AbjKVPV5 (ORCPT ); Wed, 22 Nov 2023 10:21:57 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E5A2109; Wed, 22 Nov 2023 07:21:54 -0800 (PST) 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 9BFE529A; Wed, 22 Nov 2023 16:21:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1700666481; bh=a5vaX6GZvtlfsAJNQBP0qAAJygXfjxV7faNEkvKdK9o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=wIgzJjSfWQ/kP8yC8CEoH2R9L9SOleWmnXyPCuqzZaeqVR6Lgd/2/rcRNG+chaYbi IVIJGZar0WWFOA0Ys5uFHR+YFnZEmlfCAfE+DNSsY8Qqq5vfipWuiLY0Qq4+1jO23O 3/prCLB2LmnzDJwVOVx897QIqgCnzhMtV/Wz0rUQ= From: Tomi Valkeinen Date: Wed, 22 Nov 2023 17:21:34 +0200 Subject: [PATCH v2 1/2] media: imx-mipi-csis: Fix clock handling in remove() MIME-Version: 1.0 Message-Id: <20231122-imx-csis-v2-1-e44b8dc4cb66@ideasonboard.com> References: <20231122-imx-csis-v2-0-e44b8dc4cb66@ideasonboard.com> In-Reply-To: <20231122-imx-csis-v2-0-e44b8dc4cb66@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=1351; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=a5vaX6GZvtlfsAJNQBP0qAAJygXfjxV7faNEkvKdK9o=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlXhyNxfbxyP5pZgrruxd6JZbUxZTPsCrogRzmE YfMDSZT4t2JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZV4cjQAKCRD6PaqMvJYe 9fOTD/0bQ/m+qas+P6A2bvwFTA9FVHi6b1pk2wZNrbMFhwjOFDiTRQSfKsR8sOKfoWBuXR7YQ9p 0DahtKNW5EmY1OBIgnapXcjvWnZ/pFq10bhbWs/ocsggSRacLTCit9yN9y/GevVxFM8pDDEBoca YxpJE3VUBlBY8TbOGksntlttUj93EdwjoDju2+zSFVLxENApox4jDvuotlgHxHI/5HZzJthT/Fk wODTbbq/EMqsD7lJkTDyzvfxzf1zDJ+X1bgMkVQPyq5EsSl2YKv5k+dE/a8Mr9UmFdroNLvWiGB qi8jA8qyDYqsXc10QfJTCwj7s/+NQbgliO0jGkuXgtKK4h4evfaeO8KXREkYzxRwAcbyl5rcnHz n+BvqCDb5AhUbJXqDvNKrthoJD4L9hlJICLRXWlNyeO9XHhxfb/FuchG3M0U2rXQ4F7BxtvhYGP UlsKx7opxlWlEmSROo6Sa3il5PtvWRz0ZgFkF3TiFGiKGdsKMW+5lwITUtu0mRw+fOt9LKSixPI JPIjlkdOo4OJTqmz7GHMHGNjPN+57s8QYWMbANpeQj3rSupQyAhCJyR4Hg3exPAbZ2aZA9AyAlT 5Oo8YUO4GQ3lSvVl7XA9xhHTgSr6DvTGWluI6pNfkbB8uNvA2y01kAyGgCy00cALlCOHZNhUPod nvdkjvcWVSiQx8A== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 07:22:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783278244218039704 X-GMAIL-MSGID: 1783278244218039704 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(). Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7") Reviewed-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- 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);