All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo@jmondi.org>
Cc: linux-media@vger.kernel.org, Rui Miguel Silva <rmfrfs@gmail.com>,
	kernel@pengutronix.de, linux-imx@nxp.com,
	Paul Elder <paul.elder@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@iki.fi>
Subject: Re: [PATCH 2/4] media: imx: imx-mipi-csis: Drop unneeded system PM implementation
Date: Fri, 11 Mar 2022 19:07:43 +0200	[thread overview]
Message-ID: <YiuB3xWmZjR6cWsS@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220311165325.dihy6if4vu4tdaty@uno.localdomain>

Hi Jacopo,

On Fri, Mar 11, 2022 at 05:53:25PM +0100, Jacopo Mondi wrote:
> Hi Laurent,
> 
>    the commit title makes me think runtime_pm has been dropped
> 
> I would
> 
> media: imx: imx-mipi-csis: Drop manual PM tracking

I wrote "system PM" specifically to avoid implying runtime PM was
dropped, but it seems it's not enough ? :-) I can change the subject,
but I find "manual PM tracking" not very descriptive of what the patch
does.

> On Fri, Mar 11, 2022 at 03:55:33PM +0200, Laurent Pinchart wrote:
> > There's no need to implement system suspend/resume manually, as video
> > pipelines are supposed to be suspended in a controlled and ordered
> > manner by the data sink driver at system suspend time (and similarly at
> > resume time). Drop the system suspend/resume handlers.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  drivers/media/platform/imx/imx-mipi-csis.c | 48 +++-------------------
> >  1 file changed, 5 insertions(+), 43 deletions(-)
> >
> > diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c
> > index 6e06d19c1334..3bdfe05a6c54 100644
> > --- a/drivers/media/platform/imx/imx-mipi-csis.c
> > +++ b/drivers/media/platform/imx/imx-mipi-csis.c
> > @@ -250,8 +250,6 @@
> >
> >  enum {
> >  	ST_POWERED	= 1,
> > -	ST_STREAMING	= 2,
> > -	ST_SUSPENDED	= 4,
> >  };
> 
> I see csis->state be dropped in the next patches so
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
> 
> >  struct mipi_csis_event {
> > @@ -954,24 +952,17 @@ static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
> >  	mutex_lock(&csis->lock);
> >
> >  	if (enable) {
> > -		if (csis->state & ST_SUSPENDED) {
> > -			ret = -EBUSY;
> > -			goto unlock;
> > -		}
> > -
> >  		mipi_csis_start_stream(csis);
> >  		ret = v4l2_subdev_call(csis->src_sd, video, s_stream, 1);
> >  		if (ret < 0)
> >  			goto unlock;
> >
> >  		mipi_csis_log_counters(csis, true);
> > -
> > -		csis->state |= ST_STREAMING;
> >  	} else {
> >  		v4l2_subdev_call(csis->src_sd, video, s_stream, 0);
> >
> >  		mipi_csis_stop_stream(csis);
> > -		csis->state &= ~ST_STREAMING;
> > +
> >  		if (csis->debug.enable)
> >  			mipi_csis_log_counters(csis, true);
> >  	}
> > @@ -1356,7 +1347,7 @@ static int mipi_csis_async_register(struct mipi_csis_device *csis)
> >   * Suspend/resume
> >   */
> >
> > -static int mipi_csis_pm_suspend(struct device *dev, bool runtime)
> > +static int __maybe_unused mipi_csis_runtime_suspend(struct device *dev)
> >  {
> >  	struct v4l2_subdev *sd = dev_get_drvdata(dev);
> >  	struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
> > @@ -1370,8 +1361,6 @@ static int mipi_csis_pm_suspend(struct device *dev, bool runtime)
> >  			goto unlock;
> >  		mipi_csis_clk_disable(csis);
> >  		csis->state &= ~ST_POWERED;
> > -		if (!runtime)
> > -			csis->state |= ST_SUSPENDED;
> >  	}
> >
> >  unlock:
> > @@ -1380,15 +1369,13 @@ static int mipi_csis_pm_suspend(struct device *dev, bool runtime)
> >  	return ret ? -EAGAIN : 0;
> >  }
> >
> > -static int mipi_csis_pm_resume(struct device *dev, bool runtime)
> > +static int __maybe_unused mipi_csis_runtime_resume(struct device *dev)
> >  {
> >  	struct v4l2_subdev *sd = dev_get_drvdata(dev);
> >  	struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
> >  	int ret = 0;
> >
> >  	mutex_lock(&csis->lock);
> > -	if (!runtime && !(csis->state & ST_SUSPENDED))
> > -		goto unlock;
> >
> >  	if (!(csis->state & ST_POWERED)) {
> >  		ret = mipi_csis_phy_enable(csis);
> > @@ -1398,10 +1385,6 @@ static int mipi_csis_pm_resume(struct device *dev, bool runtime)
> >  		csis->state |= ST_POWERED;
> >  		mipi_csis_clk_enable(csis);
> >  	}
> > -	if (csis->state & ST_STREAMING)
> > -		mipi_csis_start_stream(csis);
> > -
> > -	csis->state &= ~ST_SUSPENDED;
> >
> >  unlock:
> >  	mutex_unlock(&csis->lock);
> > @@ -1409,30 +1392,9 @@ static int mipi_csis_pm_resume(struct device *dev, bool runtime)
> >  	return ret ? -EAGAIN : 0;
> >  }
> >
> > -static int __maybe_unused mipi_csis_suspend(struct device *dev)
> > -{
> > -	return mipi_csis_pm_suspend(dev, false);
> > -}
> > -
> > -static int __maybe_unused mipi_csis_resume(struct device *dev)
> > -{
> > -	return mipi_csis_pm_resume(dev, false);
> > -}
> > -
> > -static int __maybe_unused mipi_csis_runtime_suspend(struct device *dev)
> > -{
> > -	return mipi_csis_pm_suspend(dev, true);
> > -}
> > -
> > -static int __maybe_unused mipi_csis_runtime_resume(struct device *dev)
> > -{
> > -	return mipi_csis_pm_resume(dev, true);
> > -}
> > -
> >  static const struct dev_pm_ops mipi_csis_pm_ops = {
> >  	SET_RUNTIME_PM_OPS(mipi_csis_runtime_suspend, mipi_csis_runtime_resume,
> >  			   NULL)
> > -	SET_SYSTEM_SLEEP_PM_OPS(mipi_csis_suspend, mipi_csis_resume)
> >  };
> >
> >  /* -----------------------------------------------------------------------------
> > @@ -1557,7 +1519,7 @@ static int mipi_csis_probe(struct platform_device *pdev)
> >  	/* Enable runtime PM. */
> >  	pm_runtime_enable(dev);
> >  	if (!pm_runtime_enabled(dev)) {
> > -		ret = mipi_csis_pm_resume(dev, true);
> > +		ret = mipi_csis_runtime_resume(dev);
> >  		if (ret < 0)
> >  			goto unregister_all;
> >  	}
> > @@ -1592,7 +1554,7 @@ static int mipi_csis_remove(struct platform_device *pdev)
> >  	v4l2_async_unregister_subdev(&csis->sd);
> >
> >  	pm_runtime_disable(&pdev->dev);
> > -	mipi_csis_pm_suspend(&pdev->dev, true);
> > +	mipi_csis_runtime_suspend(&pdev->dev);
> >  	mipi_csis_clk_disable(csis);
> >  	media_entity_cleanup(&csis->sd.entity);
> >  	mutex_destroy(&csis->lock);

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-03-11 17:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 13:55 [PATCH 0/4] media: imx: imx-mipi-csis: Simplify PM support Laurent Pinchart
2022-03-11 13:55 ` [PATCH 1/4] media: imx: imx-mipi-csis: Don't use .s_power() Laurent Pinchart
2022-03-11 16:34   ` Jacopo Mondi
2022-03-11 17:05     ` Laurent Pinchart
2022-03-11 13:55 ` [PATCH 2/4] media: imx: imx-mipi-csis: Drop unneeded system PM implementation Laurent Pinchart
2022-03-11 16:53   ` Jacopo Mondi
2022-03-11 17:07     ` Laurent Pinchart [this message]
2022-03-11 17:19       ` Jacopo Mondi
2022-03-11 13:55 ` [PATCH 3/4] media: imx: imx-mipi-csis: Don't stop streaming at runtime suspend time Laurent Pinchart
2022-03-11 16:55   ` Jacopo Mondi
2022-03-11 13:55 ` [PATCH 4/4] media: imx: imx-mipi-csis: Simplify runtime PM implementation Laurent Pinchart
2022-03-11 17:00   ` Jacopo Mondi
2022-03-11 17:09     ` Laurent Pinchart
2022-03-12 15:30       ` Jacopo Mondi
2022-03-12 22:18   ` Sakari Ailus
2022-03-12 22:20     ` Sakari Ailus
2022-03-11 14:00 ` [PATCH 0/4] media: imx: imx-mipi-csis: Simplify PM support Laurent Pinchart
2022-03-12 15:25 ` [PATCH 1/2] media: imx: imx-mipi-csis: Simplify mipi_csis_s_stream() Jacopo Mondi
2022-03-12 20:17   ` Laurent Pinchart
2022-03-12 15:25 ` [PATCH 2/2] media: imx: imx-mipi-csis: Drop powered flag Jacopo Mondi
2022-03-12 18:50   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YiuB3xWmZjR6cWsS@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=jacopo@jmondi.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=rmfrfs@gmail.com \
    --cc=sakari.ailus@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.