public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* adp1653 usage
@ 2011-08-10 11:16 Andy Shevchenko
  2011-08-11  7:19 ` Sakari Ailus
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2011-08-10 11:16 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media

Hello, Sakari.

I would like to understand how to use subdevice (like adp1653) in
current v4l2 framework from user space.

My understanding is following.

Kernel has two drivers (simplified view):
- camera device
- flash device

Kernel initializes a camera driver from a platform specific setup code.
The camera driver loads the subdevice drivers. Later I could access the
subdevice driver parts via IOCTL(s) on /dev/videoX device node.

What I have missed.
- if the subdevice creates device node /dev/v4l-subdevX, how the user
space will know the X is corresponding to let say flash device?
- if there is no v4l-subdevX device node, when and how the kernel runs
->open() and ->close() methods of v4l2_subdev_internal_ops?


-- 
Andy Shevchenko <andriy.shevchenko@intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: adp1653 usage
  2011-08-10 11:16 adp1653 usage Andy Shevchenko
@ 2011-08-11  7:19 ` Sakari Ailus
  2011-08-11 11:33   ` Andy Shevchenko
  2011-08-11 11:35   ` [PATCH] adp1653: set media entity type Andy Shevchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Sakari Ailus @ 2011-08-11  7:19 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-media

On Wed, Aug 10, 2011 at 02:16:00PM +0300, Andy Shevchenko wrote:
> Hello, Sakari.

Hi, Andy!

> I would like to understand how to use subdevice (like adp1653) in
> current v4l2 framework from user space.
> 
> My understanding is following.
> 
> Kernel has two drivers (simplified view):
> - camera device
> - flash device
> 
> Kernel initializes a camera driver from a platform specific setup code.
> The camera driver loads the subdevice drivers. Later I could access the
> subdevice driver parts via IOCTL(s) on /dev/videoX device node.
> 
> What I have missed.
> - if the subdevice creates device node /dev/v4l-subdevX, how the user
> space will know the X is corresponding to let say flash device?

The whole media device's entities (of which the flash in this case is one
of) can be enumerated. The device is called /dev/mediaX.

The Media controller API is defined here:

<URL:http://hverkuil.home.xs4all.nl/spec/media.html#media_common>

> - if there is no v4l-subdevX device node, when and how the kernel runs
> ->open() and ->close() methods of v4l2_subdev_internal_ops?

No-one. This is part of the user space interface.

Isp drivers are also free to use the adp1653 subdev directly, but in
embedded systems where such chips typically are used that seldom makes
sense.

A webcam driver could implement the same interface and provide it through a
video node.

-- 
Sakari Ailus
sakari.ailus@iki.fi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: adp1653 usage
  2011-08-11  7:19 ` Sakari Ailus
@ 2011-08-11 11:33   ` Andy Shevchenko
  2011-08-11 11:35   ` [PATCH] adp1653: set media entity type Andy Shevchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2011-08-11 11:33 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media

On Thu, 2011-08-11 at 10:19 +0300, Sakari Ailus wrote:

> > - if the subdevice creates device node /dev/v4l-subdevX, how the user
> > space will know the X is corresponding to let say flash device?
> 
> The whole media device's entities (of which the flash in this case is one
> of) can be enumerated. The device is called /dev/mediaX.
> 
> The Media controller API is defined here:
> 
> <URL:http://hverkuil.home.xs4all.nl/spec/media.html#media_common>
Thanks for the link and explanations.

I just noticed the adp1653 driver has not defined the type of the media
entity. I have attached a patch just in case.


-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] adp1653: set media entity type
  2011-08-11  7:19 ` Sakari Ailus
  2011-08-11 11:33   ` Andy Shevchenko
@ 2011-08-11 11:35   ` Andy Shevchenko
  2011-08-17 11:35     ` Sakari Ailus
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2011-08-11 11:35 UTC (permalink / raw)
  To: Sakari Ailus, linux-media; +Cc: Andy Shevchenko

The type of a media entity is default for this driver. This patch makes it
explicitly defined as MEDIA_ENT_T_V4L2_SUBDEV_FLASH.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/media/video/adp1653.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/adp1653.c b/drivers/media/video/adp1653.c
index 7f2e710..0fd9579 100644
--- a/drivers/media/video/adp1653.c
+++ b/drivers/media/video/adp1653.c
@@ -438,6 +438,8 @@ static int adp1653_probe(struct i2c_client *client,
 	if (ret < 0)
 		goto free_and_quit;
 
+	flash->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+
 	return 0;
 
 free_and_quit:
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] adp1653: set media entity type
  2011-08-11 11:35   ` [PATCH] adp1653: set media entity type Andy Shevchenko
@ 2011-08-17 11:35     ` Sakari Ailus
  0 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2011-08-17 11:35 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-media

On Thu, Aug 11, 2011 at 02:35:04PM +0300, Andy Shevchenko wrote:
> The type of a media entity is default for this driver. This patch makes it
> explicitly defined as MEDIA_ENT_T_V4L2_SUBDEV_FLASH.

Thanks again for the patch, Andy!

Applied to my tree in linuxtv.org; the branch is called
media-for-3.2-adp1653-1.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/media/video/adp1653.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/video/adp1653.c b/drivers/media/video/adp1653.c
> index 7f2e710..0fd9579 100644
> --- a/drivers/media/video/adp1653.c
> +++ b/drivers/media/video/adp1653.c
> @@ -438,6 +438,8 @@ static int adp1653_probe(struct i2c_client *client,
>  	if (ret < 0)
>  		goto free_and_quit;
>  
> +	flash->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
> +
>  	return 0;
>  
>  free_and_quit:
> -- 
> 1.7.5.4
> 

-- 
Sakari Ailus
sakari.ailus@iki.fi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-17 11:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-10 11:16 adp1653 usage Andy Shevchenko
2011-08-11  7:19 ` Sakari Ailus
2011-08-11 11:33   ` Andy Shevchenko
2011-08-11 11:35   ` [PATCH] adp1653: set media entity type Andy Shevchenko
2011-08-17 11:35     ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox