From patchwork Wed Nov 22 13:13:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13464865 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 CB9AAC61D97 for ; Wed, 22 Nov 2023 13:14:51 +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=9fI/RGX2BClSgURK7bjRVadV7HaeMoHBAnVal2jgqc4=; b=QKVb2+QVCUnd2B hx+bV4Q1bfV6Zobu8iymUEBp32J1neqiDd9ZwmqPvAeLRFco7k0MJGCsqCO7xdIuCgj3VPqyaxefp TU8BTTm2FnvlwZ8O++DH/6rvyg7oPnOH7Bt8Hi5tTWFBHUhtLKEQef5q6qspyEI8raiMazQeKxpBb Qkaj6s5j47Drpb0QuvmD9J7OJ696x49PX4l9i6GzKQ8ybjHLlq9X3RsFBdjAz1HEdCfO5we3u5wuH e1iur/MnaOgmy3FEfOoNW6fc/UyetVY37WnNpgnOp7rNaecNdcabkEMPmhaMEJsAc1+Frj7msyWLi D7Z2f9vUPdQ92XXQGYJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5n3d-001utE-1D; Wed, 22 Nov 2023 13:14:21 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5n3a-001ur9-0I for linux-arm-kernel@lists.infradead.org; Wed, 22 Nov 2023 13:14:19 +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 1D1EC6EF; Wed, 22 Nov 2023 14:13:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1700658822; bh=grxjc5oPfkc4yi8C+sR2kDM81apJg3ELEbrGiy+KFM0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jjQAnthgxn697I6YpYq0XmJj7SdfyCi69X8jm9bc82FxI506m7dUHWO5mM5RPCwwY 9zEZaqo0gmCbZ+gn7OtwptjWQqpFPMRDTuhYr8O85fkAXcaJWV2sirPpVyx8PYfVzf 3C1ydHpkVGZCW3Msl5TJjeuZvu3+wVziP62Eu2kc= From: Tomi Valkeinen Date: Wed, 22 Nov 2023 15:13:49 +0200 Subject: [PATCH 2/2] media: imx-mipi-csis: Drop extra clock enable at probe() MIME-Version: 1.0 Message-Id: <20231122-imx-csis-v1-2-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=2282; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=grxjc5oPfkc4yi8C+sR2kDM81apJg3ELEbrGiy+KFM0=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlXf6ixWjeF0HRbIjAcZmWDEdLJA0x39UzpL+dN knosF/zzH2JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZV3+ogAKCRD6PaqMvJYe 9em+D/91Yj9X6HpvONi/OwvSPfSqgLbmZ4TlEQXnG25MJEds11sjNcKvQQS/TnppGbgnE295I0p dMJDjjrn9uqMxEQzJBme0qn3+13vBh7bxpEqr9i7Psr0Zb80KO48Vk051lWSarMw851beZT5y0Z tf1ItS/9MNxVg3CdXsIvy1wW9XMWCoZHIZIA8kD7xBA4JvJYoR1Odbq/80QZz0KcB09cE6nsT6f yMQ8PZgm8IB4/pYrN5EceOqFpbvyDScIEv8aCVL23dd/Oh2Lb7LHvXiBMf0ASgXydoErHoEYjm1 WB9HntxOiYpMa2yfu+lsdFT4gTtM3dQhJ4oSSmdOknlDsgOg+e+5gkw8OLLzoMUv4M1RwNZLOtk KzbQQm2o2mlPkXHxa5Sw3WmTTw/uSH2WE5rBYuW5OuY/1qmD/QvPOy5tKtVzlOkEJtVVB4jpQnM T/Kr6WqOXAR2A/3sTOvGD7CBY0nszOvkC0DTXLzZHbXa1912R78h/06yDliBj5i6FwzEqE0sCgy ChhVFPi/rIQtkO8y/vz/cO429l1zzprFjDKwYYOcf94Cw3b2MkImKX5UIhOiElz5sKhjgGqiTcI N1SFkJbF5JxP/tmtP7WnqoiKJ/nvmZlRpQigzoPNpiI69PNqLND2L7jtyY5353T9DpkjFUlpHji kyIaf9QL0Ft2trQ== 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_051418_284952_9FAF9AF9 X-CRM114-Status: GOOD ( 15.04 ) 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 enables the clocks at probe() and disables them only at remove(). It is not clear why the driver does this, as it supports runtime PM, and enables and disables the clocks in the runtime resume and suspend callbacks. Also, in the case runtime PM is not available, the driver calls the resume and suspend callbacks manually from probe() and remove(). Drop the unnecessary clock enable, thus enabling the clocks only when actually needed. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/media/platform/nxp/imx-mipi-csis.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c index b39d7aeba750..b08f6d2e7516 100644 --- a/drivers/media/platform/nxp/imx-mipi-csis.c +++ b/drivers/media/platform/nxp/imx-mipi-csis.c @@ -1435,24 +1435,18 @@ static int mipi_csis_probe(struct platform_device *pdev) /* Reset PHY and enable the clocks. */ mipi_csis_phy_reset(csis); - ret = mipi_csis_clk_enable(csis); - if (ret < 0) { - dev_err(csis->dev, "failed to enable clocks: %d\n", ret); - return ret; - } - /* Now that the hardware is initialized, request the interrupt. */ ret = devm_request_irq(dev, irq, mipi_csis_irq_handler, 0, dev_name(dev), csis); if (ret) { dev_err(dev, "Interrupt request failed\n"); - goto err_disable_clock; + return ret; } /* Initialize and register the subdev. */ ret = mipi_csis_subdev_init(csis); if (ret < 0) - goto err_disable_clock; + return ret; platform_set_drvdata(pdev, &csis->sd); @@ -1486,8 +1480,6 @@ static int mipi_csis_probe(struct platform_device *pdev) v4l2_async_nf_unregister(&csis->notifier); v4l2_async_nf_cleanup(&csis->notifier); v4l2_async_unregister_subdev(&csis->sd); -err_disable_clock: - mipi_csis_clk_disable(csis); return ret; } @@ -1506,7 +1498,6 @@ static void mipi_csis_remove(struct platform_device *pdev) mipi_csis_runtime_suspend(&pdev->dev); pm_runtime_disable(&pdev->dev); - mipi_csis_clk_disable(csis); v4l2_subdev_cleanup(&csis->sd); media_entity_cleanup(&csis->sd.entity); pm_runtime_set_suspended(&pdev->dev);