From patchwork Wed Nov 22 15:21:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 168410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1400993vqb; Wed, 22 Nov 2023 07:22:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmuLGYy5/yDZAfxPG/Ltc5CcE95Wd7J5ywZL7m5PaLTgcVJNyX1Hr7wgTrDDyo2ls2sMqv X-Received: by 2002:a17:903:2444:b0:1ce:1892:2fa6 with SMTP id l4-20020a170903244400b001ce18922fa6mr3117885pls.0.1700666549822; Wed, 22 Nov 2023 07:22:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700666549; cv=none; d=google.com; s=arc-20160816; b=XX0u3TD/9DVSz6+8kfGwczuGFl9/VtEepxx0IEwOxuXmrvsg2BNAuaoXVAikORGIuX DsWuQBxRSBwRZ3rqu22l2+LIPq8Ei+Q5clv9sN3yEDF2eVMkzHfcow2jkTfU50tPBXEu 30jVP/vZ7p6lspCmHUiffbCVoIxJw7uOrqEs3bQTzchGLL8SYtp8Egi8Q66qqnosOr18 xgBvqmcbak/QjCdMuc2RMCtSSdlyp2ND9ucoY6FHbX+F/9BsJpmOizbDWMLtxdAADypP bPj60sxmB59+DwsUffYIAX/lvBbRMPzp4SQ3sHrnv9TNuG+u0R1rXzRyssyf3rdaW0pZ Pl5Q== 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=f/ZHStFHxff6hjPyASgMwO6ItJRXGO6OW+OQNErCzTo=; fh=7dkMOs5/tPCl/heSmN/G4SnIn36MQ9Q1x2sCPQaV5HQ=; b=slzfnu/eGyXQuZBWd3ZiaXj74K66WrumNJLsq44EPnMWAnSCu7idjrIIPjnTz8co6X 03+tnPlWWJUhzpAvqu9Av259ek3BSoka+nNqKqHfbzpT+A6u88Tc730Wopjj+r0rlRCK QNeJVRkDV+bc1JSi0sJ3cuQ20peLNjndkgBqbo4+vCcA5c+Se7gVzEVK2bph/X6TQRQ5 Q/F+2cq6kUbHHw4bUfY98tOeDinWsEICEcxH8nrQMjIlRY1g3eIvaYOFca/8/DueDCZc COtD/qKZrxeU6OKGFQWeAbZ52p5vtay/R+Ob2u0PC5HX0dK1ZSSql+22Gr8Vc5kqw4wB KrlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Eov64+qh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b6-20020a170902d30600b001c9ce2b6b9esi12438566plc.262.2023.11.22.07.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 07:22:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Eov64+qh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 2A3E3805D5EA; Wed, 22 Nov 2023 07:22:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344302AbjKVPWC (ORCPT + 99 others); Wed, 22 Nov 2023 10:22:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234695AbjKVPV6 (ORCPT ); Wed, 22 Nov 2023 10:21:58 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33CB4E7; Wed, 22 Nov 2023 07:21:55 -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 932E0641; Wed, 22 Nov 2023 16:21:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1700666482; bh=oLh+PYyvynzrtsVKhC9dRmFuGMQd356Ob1Vi0pnH3uI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Eov64+qh5+l2JI/hZS6I7DOpXiFQdbP67UBBuwXV4ASAwfL5ewOKcA6UTg+pvdV4n 5ydILDHildwhCI5zyY256SizMFqXQYFeUvWFoteoVorJVUBlBlGsAuyX6RTzt/v7mB 20LmrdmF2OGZAYL6afR3XeZOuj3qstq1Dlmw9at4= From: Tomi Valkeinen Date: Wed, 22 Nov 2023 17:21:35 +0200 Subject: [PATCH v2 2/2] media: imx-mipi-csis: Drop extra clock enable at probe() MIME-Version: 1.0 Message-Id: <20231122-imx-csis-v2-2-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=2436; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=oLh+PYyvynzrtsVKhC9dRmFuGMQd356Ob1Vi0pnH3uI=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlXhyO7E0e4Yi0seizlKIhwM6sPd6QWD4XXH963 56XWdMxPb6JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZV4cjgAKCRD6PaqMvJYe 9eavD/wIeF/Msot/w6WJqthTJU/S9QIUb6BUTmAtOot7zFYQdMM3aGinlcQxnQ2LVHnZ092dP1E 15Sg1PVzM90NdXVwZybVnUhEPFfKuAm5nM5fYX7PyFXksAQFvXv8KEItyjWJzMJpTPADUAqVH5p kMpFmDbyq1a4xSVpFXb5zMVdHAKNAHaFOtaI2+Ha/gYvF6EQLhn8Hl7eY8ZI3TQtBE2amTzOxaT 1N121JJMCFk2F9sJBgCUobGenO3eg/oV92rzUOva7LudQNT/H7T78c8p7OU6AIAenW94ZVajQKC OXB4M4B/VP2+ZB1ApBV3CWbD68FQtjsdkDsNsNDH3Q0gnnWHQDd7iumoI+xq3ts34tn6iznTUjT eD0zgyFpekj/jyMpjd9s9jlvY4VuekXUjADWKLNWqx6x1ZZ+5OGAMvcFQrUfS5StgJISb7vfkM1 5Gav39YZjF9U1HXziFt1YPKDRjskx8YUIVf6Yk4ZIu+Jj4Eous6qV1UULjxR2D0VCYr79akfNno PXf2VDmc/+NeSqTn8+ii9yxpq6atzVjBwZagXH+BsOtHk77hyXkMPy1xjb6L6ejrCkF8QKKJcVS Ej10zkGTeGIBa9cAKXFxlxspBgd8n9mOoiANcs/9znxoK8C0VD/c8Ub1VFfWCqUnF3gXk+S+hp0 Y0Ea9XqGjyOYruw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Wed, 22 Nov 2023 07:22:18 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783278128092796033 X-GMAIL-MSGID: 1783278128092796033 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. 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 | 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);