Skip to contentSkip to conversation

adp1653 usage

PATCH Applied Andy Shevchenko 2 participants 5 messages Aug 10, 2011 – Aug 17, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

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?

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#1 lore raw
Quoted 1 line · Andy Shevchenko

Hello, Sakari.

Hi, Andy!

Quoted 9 lines

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

Quoted 7 lines

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>

Quoted 2 lines

- 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.

Signature · 2 lines
Sakari Ailus
[email protected]
#2 lore raw
Quoted 9 lines · Sakari Ailus
Quoted 2 lines

- 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.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw

PATCH 1/1 adp1653: set media entity type

In reply to Sakari Ailus

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

---
 drivers/media/video/adp1653.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/media/video/adp1653.c +2 -0
index 7f2e710..0fd9579 100644
@@ -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:
Signature · 1 line
1.7.5.4
Applied
#4 lore raw

Re: [PATCH] adp1653: set media entity type

Quoted 2 lines · 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.

Thanks again for the patch, Andy!

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

Quoted 21 lines
---
 drivers/media/video/adp1653.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/media/video/adp1653.c +2 -0
index 7f2e710..0fd9579 100644
@@ -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:
Signature · 1 line
1.7.5.4
Signature · 2 lines
Sakari Ailus
[email protected]