public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: davinci-linux-open-source@linux.davincidsp.com
Cc: Manjunath Hadli <manjunath.hadli@ti.com>,
	LMML <linux-media@vger.kernel.org>
Subject: Re: [PATCH v3 10/13] davinci: vpif capture:Add power management support
Date: Mon, 25 Jun 2012 14:57:23 +0200	[thread overview]
Message-ID: <2777370.dWcj1X6j2h@avalon> (raw)
In-Reply-To: <1340622455-10419-11-git-send-email-manjunath.hadli@ti.com>

Hi Manjunath,

Thank you for the patch.

On Monday 25 June 2012 16:37:32 Manjunath Hadli wrote:
> Implement power management operations - suspend and resume as part of
> dev_pm_ops for VPIF capture driver.
> 
> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
> Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
> ---
>  drivers/media/video/davinci/vpif_capture.c |   77 +++++++++++++++++++++----
>  1 files changed, 65 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/media/video/davinci/vpif_capture.c
> b/drivers/media/video/davinci/vpif_capture.c index 097e136..f1ee137 100644
> --- a/drivers/media/video/davinci/vpif_capture.c
> +++ b/drivers/media/video/davinci/vpif_capture.c
> @@ -2300,26 +2300,74 @@ static int vpif_remove(struct platform_device
> *device) return 0;
>  }
> 
> +#ifdef CONFIG_PM
>  /**
>   * vpif_suspend: vpif device suspend
> - *
> - * TODO: Add suspend code here
>   */
> -static int
> -vpif_suspend(struct device *dev)
> +static int vpif_suspend(struct device *dev)
>  {
> -	return -1;
> +
> +	struct common_obj *common;
> +	struct channel_obj *ch;
> +	int i;
> +
> +	for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
> +		/* Get the pointer to the channel object */
> +		ch = vpif_obj.dev[i];
> +		common = &ch->common[VPIF_VIDEO_INDEX];
> +		if (mutex_lock_interruptible(&common->lock))
> +			return -ERESTARTSYS;

As for the display driver, this should probably be replaced by mutex_lock().

> +		if (ch->usrs && common->io_usrs) {
> +			/* Disable channel */
> +			if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
> +				enable_channel0(0);
> +				channel0_intr_enable(0);
> +			}
> +			if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
> +			    common->started == 2) {
> +				enable_channel1(0);
> +				channel1_intr_enable(0);
> +			}
> +		}
> +		mutex_unlock(&common->lock);
> +	}
> +
> +	return 0;
>  }
> 
> -/**
> +/*
>   * vpif_resume: vpif device suspend
> - *
> - * TODO: Add resume code here
>   */
> -static int
> -vpif_resume(struct device *dev)
> +static int vpif_resume(struct device *dev)
>  {
> -	return -1;
> +	struct common_obj *common;
> +	struct channel_obj *ch;
> +	int i;
> +
> +	for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
> +		/* Get the pointer to the channel object */
> +		ch = vpif_obj.dev[i];
> +		common = &ch->common[VPIF_VIDEO_INDEX];
> +		if (mutex_lock_interruptible(&common->lock))
> +			return -ERESTARTSYS;
> +
> +		if (ch->usrs && common->io_usrs) {
> +			/* Disable channel */
> +			if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
> +				enable_channel0(1);
> +				channel0_intr_enable(1);
> +			}
> +			if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
> +			    common->started == 2) {
> +				enable_channel1(1);
> +				channel1_intr_enable(1);
> +			}
> +		}
> +		mutex_unlock(&common->lock);
> +	}
> +
> +	return 0;
>  }
> 
>  static const struct dev_pm_ops vpif_dev_pm_ops = {
> @@ -2327,11 +2375,16 @@ static const struct dev_pm_ops vpif_dev_pm_ops = {
>  	.resume = vpif_resume,
>  };
> 
> +#define vpif_pm_ops (&vpif_dev_pm_ops)
> +#else
> +#define vpif_pm_ops NULL
> +#endif
> +
>  static __refdata struct platform_driver vpif_driver = {
>  	.driver	= {
>  		.name	= "vpif_capture",
>  		.owner	= THIS_MODULE,
> -		.pm = &vpif_dev_pm_ops,
> +		.pm	= vpif_pm_ops,
>  	},
>  	.probe = vpif_probe,
>  	.remove = vpif_remove,
-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2012-06-25 12:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1340622455-10419-1-git-send-email-manjunath.hadli@ti.com>
     [not found] ` <1340622455-10419-9-git-send-email-manjunath.hadli@ti.com>
2012-06-25 12:54   ` [PATCH v3 08/13] davinci: vpif: add support for clipping on output data Laurent Pinchart
2012-06-25 13:08     ` Hans Verkuil
2012-06-25 13:18       ` Laurent Pinchart
2012-06-25 13:23         ` Hans Verkuil
2012-06-28  9:50           ` Hadli, Manjunath
     [not found] ` <1340622455-10419-10-git-send-email-manjunath.hadli@ti.com>
2012-06-25 12:56   ` [PATCH v3 09/13] davinci: vpif display: Add power management support Laurent Pinchart
2012-06-28  9:56     ` Hadli, Manjunath
     [not found] ` <1340622455-10419-11-git-send-email-manjunath.hadli@ti.com>
2012-06-25 12:57   ` Laurent Pinchart [this message]
2012-06-28  9:54     ` [PATCH v3 10/13] davinci: vpif capture:Add " Hadli, Manjunath
     [not found] ` <1340622455-10419-5-git-send-email-manjunath.hadli@ti.com>
2012-06-26 10:36   ` [PATCH v3 04/13] davinci: vpif: fix setting of data width in config_vpif_params() function Sergei Shtylyov
2012-06-28  9:52     ` Hadli, Manjunath

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=2777370.dWcj1X6j2h@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=manjunath.hadli@ti.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox