Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1155177rdf; Wed, 22 Nov 2023 07:04:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPPEtlwEGtmAk8o8Ge7lN2koCnWbnd5uy5+P3mxJ8BFPkFenX8LadQB1pPIlIhFLnqdxKx X-Received: by 2002:a05:6870:2e0f:b0:1f9:697a:69e1 with SMTP id oi15-20020a0568702e0f00b001f9697a69e1mr3325533oab.16.1700665475006; Wed, 22 Nov 2023 07:04:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700665474; cv=none; d=google.com; s=arc-20160816; b=CNk6hMhdPWljsF+6g84LcfWlPD8fPBLuM+OGUyQg24knJipjStkOcBFUQ+NsyO+xMv bxWmr5t7vRWop9/CMSjnzBDqL9Lz+rF798+jKgWdi8JBGTx9U7FZh7q2pTswD752yXjI I6VwYwK04Yx+hUijkCdgohvZcMnBYDyUeC9gmr8Xz9nlbXiht8IX/ZyLALia+eZkYQ8G EbJY0g5aMZCYGTPptDnBqvJYUcfJWHmghXoInuQKP3BB1Pvu3IlBSObCSphMVsw4yAUN 4lOqPVox8XFnruuCXrY8EdL5nn5kstQ8cJSch5PlPugKw++vorm3I4pnLvNziCe5fQpT 4f5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+aTx+7hrUL0dKyKGl6a+HfYB498t2qDEn5hHdjijPcw=; fh=e4OHv6Xov0Q4gEe0JuRq0fA/xym953GfWftHd/HqGes=; b=Ew6llydnBFUhImSA8DHesC+Ado3mkYjpqmqR8G8PbnREl3bfWvAyIUmELU8bu7o9Pw tNFFedUWOmWwgeFY27OOOi3snFV1QoQTR1xqOSAXiXv4mxOGZ1sXhHrlUcv25FmARMPH XOo7KSfexuxOEYh+P4s0Hl5NC7QO+BFP/ZcP1Hg9FeU0+6tIHX6DopVxVyc4VEs6F5l+ Dgj6Bp8OW54midVSJdNaTgrTGgNx9kqDVjKQmLbgsF5HX1viK4wYfkgS+caYWfk0OlVG 4W8av83dXBqO9fPQmeMyTc1l23Za9qEmnFGxEXJHCHn1WJNXgfgP4M4u8uYPIrVhIW8V ahGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=AswJOSfm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l41-20020a0568302b2900b006d2d96f9fffsi4930232otv.144.2023.11.22.07.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 07:04:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=AswJOSfm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 40CD98263EAD; Wed, 22 Nov 2023 07:04:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344307AbjKVPEK (ORCPT + 99 others); Wed, 22 Nov 2023 10:04:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344284AbjKVPEJ (ORCPT ); Wed, 22 Nov 2023 10:04:09 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEDB092; Wed, 22 Nov 2023 07:04:05 -0800 (PST) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A829C276; Wed, 22 Nov 2023 16:03:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1700665412; bh=Khzc5e3MF7Rql+822BCxtzuamdUU+FbcCsol+NM5omk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AswJOSfmq6jWjqkIxgblejlN62dmvtlzl37M8vuQGgBZBmIsx26UtuYGztLY0u0n6 uVBswsKVdRwNhFnxuCRFlLaXRb4HBY4E2DFHPsRdG0fYwEADJUFgoKkrWG+nPp7aVD IfrZ5CQIb56bscsj4eIMFYAo3EkrsgwH3CLFa4wA= Date: Wed, 22 Nov 2023 17:04:10 +0200 From: Laurent Pinchart To: Tomi Valkeinen Cc: Kieran Bingham , Rui Miguel Silva , Martin Kepplinger , Purism Kernel Team , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] media: imx-mipi-csis: Drop extra clock enable at probe() Message-ID: <20231122150410.GF8627@pendragon.ideasonboard.com> References: <20231122-imx-csis-v1-0-0617368eb996@ideasonboard.com> <20231122-imx-csis-v1-2-0617368eb996@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231122-imx-csis-v1-2-0617368eb996@ideasonboard.com> 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 fry.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 (fry.vger.email [0.0.0.0]); Wed, 22 Nov 2023 07:04:19 -0800 (PST) Hi Tomi, Thank you for the patch. On Wed, Nov 22, 2023 at 03:13:49PM +0200, Tomi Valkeinen wrote: > 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(). Probably a historical mistake. It predates my involvement with the driver :-) > 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); > -- Regards, Laurent Pinchart