Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1624852ybg; Thu, 4 Jun 2020 14:50:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFihJEKP8ufTCf55bmWG4rPu/FFc1zy6oQ2PqtxgXuGLKEoz6FXME3epHCgkyXc7bZr8GG X-Received: by 2002:aa7:c80c:: with SMTP id a12mr6563065edt.140.1591307445753; Thu, 04 Jun 2020 14:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591307445; cv=none; d=google.com; s=arc-20160816; b=VBcohk0CPNqe7cpcdC2bAIEOvCZPlwa5DhjGmpYwNV7iKCNZInwrO+1XmQ0TQB0vhs 0dE14nlYIM4XVZ7+ZwLa5ydfRQhvMtWQcZmyfZIF6cVIP9qCGr6kuP8ttdMpgs0JzJyh EPut2zdQ29Wgh5DQdRYGCHK7AridxVPWFzh/EJWKCIRJyR0aAylKNZJ9tiVD+571IgdT QJyUyBHoBEU9GT06ps0nN8jqpTsdof7XTa1kmd8swI9GtYpRpniPlZXd6VVn5cN1ce5L pq2fcMW7+77wL5LSxVhtdU3jkxMU4/XovhJQpmMlnd/Xn2TfR18+n1faT66y9yCugSC4 4BDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=x/FPwPDEuPaYg7Z1/cR1d4oNeX+tQD4qIJ8f+45BDlM=; b=0vMg/nE5nfMNoxJnc2wJsWXFpQtViLWcAxNP4S2omPHREuBgWVQrr28afEESivY+9P LJDiFvjg3O+Qc94ZnY+mY9oQFCRdxsQwph1mjudl+677xCeefvMKYFlIcy92nudsvtS2 hzvXXfON4VUAhaYxSrqOyeZQXO0fgpI/3zt6m+JnyapC1kSrMixGWTfPAh+0gitw1yqQ qSlV0673U0sd/TYIIiztR8C8aTZfoaWvfAs6K0+9rUaSrhyn70FiBuLLk8H1k1o7p1xd K79dtsi7rQ3180cTaV0acqHeRFwNXXE3BzgAojKIITEo/r9RG8+otUTCpeySTG3TYLl/ fgwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n24si2588474edb.277.2020.06.04.14.50.22; Thu, 04 Jun 2020 14:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729463AbgFDU1Y (ORCPT + 99 others); Thu, 4 Jun 2020 16:27:24 -0400 Received: from v6.sk ([167.172.42.174]:46350 "EHLO v6.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725883AbgFDU1Y (ORCPT ); Thu, 4 Jun 2020 16:27:24 -0400 Received: from localhost (v6.sk [IPv6:::1]) by v6.sk (Postfix) with ESMTP id 0E4BC610D0; Thu, 4 Jun 2020 20:26:52 +0000 (UTC) Date: Thu, 4 Jun 2020 22:26:48 +0200 From: Lubomir Rintel To: Mauro Carvalho Chehab Cc: Jonathan Corbet , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sakari Ailus Subject: Re: [RESEND 2 PATCH] media: marvell-ccic: Add support for runtime PM Message-ID: <20200604202648.GA565781@furthur.local> References: <20200601192124.172650-1-lkundrak@v3.sk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200601192124.172650-1-lkundrak@v3.sk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Cc += Sakari. I'm wondering if you'd mind looking at this mmp ccic patch too. Thank you Lubo On Mon, Jun 01, 2020 at 09:21:24PM +0200, Lubomir Rintel wrote: > On MMP3, the camera block lives on na separate power island. We want to > turn it off if the CCIC is not in use to conserve power. > > Signed-off-by: Lubomir Rintel > --- > drivers/media/platform/marvell-ccic/mcam-core.c | 3 +++ > drivers/media/platform/marvell-ccic/mmp-driver.c | 12 ++++++++---- > 2 files changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c > index 09775b6624c6b..c2cd1d461bd06 100644 > --- a/drivers/media/platform/marvell-ccic/mcam-core.c > +++ b/drivers/media/platform/marvell-ccic/mcam-core.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -901,6 +902,7 @@ static void mcam_clk_enable(struct mcam_camera *mcam) > { > unsigned int i; > > + pm_runtime_get_sync(mcam->dev); > for (i = 0; i < NR_MCAM_CLK; i++) { > if (!IS_ERR(mcam->clk[i])) > clk_prepare_enable(mcam->clk[i]); > @@ -915,6 +917,7 @@ static void mcam_clk_disable(struct mcam_camera *mcam) > if (!IS_ERR(mcam->clk[i])) > clk_disable_unprepare(mcam->clk[i]); > } > + pm_runtime_put(mcam->dev); > } > > /* ---------------------------------------------------------------------- */ > diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c b/drivers/media/platform/marvell-ccic/mmp-driver.c > index 92b92255dac66..eec482d16805b 100644 > --- a/drivers/media/platform/marvell-ccic/mmp-driver.c > +++ b/drivers/media/platform/marvell-ccic/mmp-driver.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > > #include "mcam-core.h" > > @@ -313,10 +314,12 @@ static int mmpcam_probe(struct platform_device *pdev) > cam->irq = res->start; > ret = devm_request_irq(&pdev->dev, cam->irq, mmpcam_irq, IRQF_SHARED, > "mmp-camera", mcam); > - if (ret == 0) { > - mmpcam_add_device(cam); > - return 0; > - } > + if (ret) > + goto out; > + > + mmpcam_add_device(cam); > + pm_runtime_enable(&pdev->dev); > + return 0; > > out: > fwnode_handle_put(mcam->asd.match.fwnode); > @@ -332,6 +335,7 @@ static int mmpcam_remove(struct mmp_camera *cam) > > mmpcam_remove_device(cam); > mccic_shutdown(mcam); > + pm_runtime_force_suspend(mcam->dev); > return 0; > } > > -- > 2.26.2 >