All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCH] em28xx: balance subdevice power-off calls
Date: Mon, 09 Sep 2013 19:10:26 +0200	[thread overview]
Message-ID: <522E0102.4060303@googlemail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1309051459261.785@axis700.grange>

Hi Guennadi,

thank you for looking at this. A few thoughts:

Am 05.09.2013 15:11, schrieb Guennadi Liakhovetski:
> The em28xx USB driver powers off its subdevices, by calling their .s_power()
> methods to save power, but actually never powers them on. Apparently this
> works with currently used subdevice drivers, but is wrong and might break
> with some other ones. This patch fixes this issue by adding required
> .s_power() calls to turn subdevices on.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> Please, test - only compile tested due to lack of hardware
>
>  drivers/media/usb/em28xx/em28xx-cards.c |    1 +
>  drivers/media/usb/em28xx/em28xx-video.c |   17 ++++++++++-------
>  2 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
> index dc65742..d2d3b06 100644
> --- a/drivers/media/usb/em28xx/em28xx-cards.c
> +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> @@ -3066,6 +3066,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,
>  	}
>  
>  	/* wake i2c devices */
> +	v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 1);
>  	em28xx_wake_i2c(dev);
I wonder if we should make the (s_power, 1) call part of em28xx_wake_i2c().
This function already does

    v4l2_device_call_all(&dev->v4l2_dev, 0, core,  reset, 0);
    v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing,
            INPUT(dev->ctl_input)->vmux, 0, 0);
    v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0);

>  
>  	/* init video dma queues */
> diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
> index 9d10334..283fa26 100644
> --- a/drivers/media/usb/em28xx/em28xx-video.c
> +++ b/drivers/media/usb/em28xx/em28xx-video.c
> @@ -1589,15 +1589,18 @@ static int em28xx_v4l2_open(struct file *filp)
>  	fh->type = fh_type;
>  	filp->private_data = fh;
>  
> -	if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) {
> -		em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
> -		em28xx_resolution_set(dev);
> +	if (dev->users == 0) {
> +		v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 1);
>  
> -		/* Needed, since GPIO might have disabled power of
> -		   some i2c device
> -		 */
> -		em28xx_wake_i2c(dev);
> +		if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
> +			em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
em28xx_set_mode() calls em28xx_gpio_set(dev,
INPUT(dev->ctl_input)->gpio) and I'm not sure if this could disable
subdevice power again...

> +			em28xx_resolution_set(dev);
>  
> +			/* Needed, since GPIO might have disabled power of
> +			   some i2c device
> +			*/
> +			em28xx_wake_i2c(dev);
Hmm... your patch didn't change this, but:
Why do we call these functions only in case of V4L2_BUF_TYPE_VIDEO_CAPTURE ?
Isn't it needed for VBI capturing, too ?
em28xx_wake_i2c() is probably also needed for radio mode...

Mauro, what do you think ?

Regards,
Frank

> +		}
>  	}
>  
>  	if (vdev->vfl_type == VFL_TYPE_RADIO) {


      reply	other threads:[~2013-09-09 17:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 13:11 [PATCH] em28xx: balance subdevice power-off calls Guennadi Liakhovetski
2013-09-09 17:10 ` Frank Schäfer [this message]

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=522E0102.4060303@googlemail.com \
    --to=fschaefer.oss@googlemail.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=hans.verkuil@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=s.nawrocki@samsung.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 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.