Remove media controller entity subtypes and rename types
Subsystems (16)
cover Remove media controller entity subtypes and rename types
The media controller entity subtype doesn't make much sense, especially since V4L2 subdevices may also have associated devnodes.
So, better to get rid of it while it is not too late.
Also, the entities namespace is a bit messy, putting tuners under V4L2, while this kind of entity could also be used by radio and digital TV.
This patchset addresses the entities namespace and gets rid of entity subtypes.
We need, of course, to keep the old symbols to avoid userspace breakage.
Inside the Kernel, however, the previous subtype defines should not be used.
The first patches in this series are just namespace renames, and were done mostly using scripts. So, they shouln't cause much discussons, except if someone doesn't like the new names I gave :)
Mauro Carvalho Chehab (8):
media controller: add EXPERIMENTAL to Kconfig option for DVB support media controller: deprecate entity subtype
media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines media controller: Rename camera entities
media controller: rename MEDIA_ENT_T_DEVNODE_DVB entities media controller: rename analog TV decoder
media controller: rename the tuner entity
media controller: add comments for the entity types
The next 9 patches, however, remove the entities subtype dependency from the drivers and core. They were highly done using cut and paste. I did several reviews on them, but I won't doubt that some dumb error were introduced. So, please review them carefully.
The last one is just documentation cleanups.
Mauro Carvalho Chehab (10):
media controller: add macros to check if subdev or A/V DMA media controller: use macros to check for V4L2 subdev entities omap3/omap4/davinci: get rid of MEDIA_ENT_T_V4L2_SUBDEV abuse
s5c73m3: fix subdev type
s5k5baf: fix subdev type
davinci_vbpe: stop MEDIA_ENT_T_V4L2_SUBDEV abuse
omap4iss: stop MEDIA_ENT_T_V4L2_SUBDEV abuse
v4l2-subdev: use MEDIA_ENT_T_UNKNOWN for new subdevs media controller: get rid of entity subtype on Kernel
DocBook: update descriptions for the media controller entities
.../DocBook/media/v4l/media-ioc-enum-entities.xml | 57 +++++++---------- drivers/media/Kconfig | 2 +- drivers/media/dvb-core/dvbdev.c | 20 +++--- drivers/media/i2c/adp1653.c | 2 +- drivers/media/i2c/adv7180.c | 2 +- drivers/media/i2c/as3645a.c | 2 +- drivers/media/i2c/cx25840/cx25840-core.c | 2 +- drivers/media/i2c/lm3560.c | 2 +- drivers/media/i2c/lm3646.c | 2 +- drivers/media/i2c/m5mols/m5mols_core.c | 2 +- drivers/media/i2c/noon010pc30.c | 2 +- drivers/media/i2c/ov2659.c | 2 +- drivers/media/i2c/ov9650.c | 2 +- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 4 +- drivers/media/i2c/s5k4ecgx.c | 2 +- drivers/media/i2c/s5k5baf.c | 6 +- drivers/media/i2c/s5k6aa.c | 2 +- drivers/media/i2c/smiapp/smiapp-core.c | 2 +- drivers/media/i2c/tvp514x.c | 2 +- drivers/media/i2c/tvp7002.c | 2 +- drivers/media/platform/exynos4-is/common.c | 3 +- drivers/media/platform/exynos4-is/fimc-capture.c | 5 +- drivers/media/platform/exynos4-is/fimc-isp-video.c | 3 +- drivers/media/platform/exynos4-is/fimc-lite.c | 10 ++- drivers/media/platform/exynos4-is/media-dev.c | 7 +-- drivers/media/platform/omap3isp/isp.c | 14 ++--- drivers/media/platform/omap3isp/ispccdc.c | 15 +++-- drivers/media/platform/omap3isp/ispccp2.c | 13 ++-- drivers/media/platform/omap3isp/ispcsi2.c | 10 ++- drivers/media/platform/omap3isp/isppreview.c | 15 +++-- drivers/media/platform/omap3isp/ispresizer.c | 13 ++-- drivers/media/platform/omap3isp/ispvideo.c | 7 +-- drivers/media/platform/s3c-camif/camif-capture.c | 2 +- drivers/media/platform/vsp1/vsp1_video.c | 9 ++- drivers/media/platform/xilinx/xilinx-dma.c | 8 +-- drivers/media/usb/cx231xx/cx231xx-cards.c | 4 +- drivers/media/usb/cx231xx/cx231xx-video.c | 2 +- drivers/media/v4l2-core/tuner-core.c | 2 +- drivers/media/v4l2-core/v4l2-dev.c | 2 +- drivers/media/v4l2-core/v4l2-subdev.c | 6 +- drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 9 ++- drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 13 ++-- drivers/staging/media/davinci_vpfe/dm365_isif.c | 13 ++-- drivers/staging/media/davinci_vpfe/dm365_resizer.c | 22 ++++--- drivers/staging/media/davinci_vpfe/vpfe_video.c | 11 ++-- drivers/staging/media/omap4iss/iss.c | 14 ++--- drivers/staging/media/omap4iss/iss_csi2.c | 11 +++- drivers/staging/media/omap4iss/iss_ipipe.c | 7 ++- drivers/staging/media/omap4iss/iss_ipipeif.c | 13 ++-- drivers/staging/media/omap4iss/iss_resizer.c | 11 +++- drivers/staging/media/omap4iss/iss_video.c | 5 +- include/media/media-entity.h | 27 ++++++-- include/uapi/linux/media.h | 71 +++++++++++++++++----- 53 files changed, 294 insertions(+), 202 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/18 media controller: add EXPERIMENTAL to Kconfig option for DVB support
The Media Controller DVB support is still an experimental feature, as it is under heavy development. It is already said that it is an experimental feature at the help, but let make it even clearer and louder, as we may need to adjust some bits when we start using it on embedded drivers.
drivers/media/Kconfig +1 -1
@@ -95,7 +95,7 @@ config MEDIA_CONTROLLER This API is mostly used by camera interfaces in embedded platforms. config MEDIA_CONTROLLER_DVB - bool "Enable Media controller for DVB" + bool "Enable Media controller for DVB (EXPERIMENTAL)" depends on MEDIA_CONTROLLER ---help--- Enable the media controller API support for DVB.
Signature · 1 line
2.1.0
Re: [PATCH 01/18] media controller: add EXPERIMENTAL to Kconfig option for DVB support
Quoted 7 lines · Mauro Carvalho Chehab
The Media Controller DVB support is still an experimental feature, as it is under heavy development. It is already said that it is an experimental feature at the help, but let make it even clearer and louder, as we may need to adjust some bits when we start using it on embedded drivers.
Signed-off-by Mauro Carvalho Chehab <[email protected]>
Thanks!
Hans
Quoted 15 lines
drivers/media/Kconfig +1
-1@@ -95,7 +95,7 @@ config MEDIA_CONTROLLER This API is mostly used by camera interfaces in embedded platforms. config MEDIA_CONTROLLER_DVB - bool "Enable Media controller for DVB" + bool "Enable Media controller for DVB (EXPERIMENTAL)" depends on MEDIA_CONTROLLER ---help--- Enable the media controller API support for DVB.
Re: [PATCH 01/18] media controller: add EXPERIMENTAL to Kconfig option for DVB support
Quoted 10 lines · On Friday 08 May 2015 13:33:46 Hans Verkuil wrote:
Quoted 7 lines · Mauro Carvalho Chehab
The Media Controller DVB support is still an experimental feature, as it is under heavy development. It is already said that it is an experimental feature at the help, but let make it even clearer and louder, as we may need to adjust some bits when we start using it on embedded drivers.
Signed-off-by Mauro Carvalho Chehab <[email protected]>Acked-by Hans Verkuil <[email protected]>
And
Quoted 17 lines
Quoted 17 lines
drivers/media/Kconfig +1
-1@@ -95,7 +95,7 @@ config MEDIA_CONTROLLER This API is mostly used by camera interfaces in embedded platforms. config MEDIA_CONTROLLER_DVB - bool "Enable Media controller for DVB" + bool "Enable Media controller for DVB (EXPERIMENTAL)"drivers/media/Kconfig +0
-0depends on MEDIA_CONTROLLER ---help--- Enable the media controller API support for DVB.
Signature · 3 lines
Regards, Laurent Pinchart
A message that is not in the archive (sent off-list or not yet received): cover.1431046915.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org
PATCH 3/18 media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines
At the Video4Linux API, the /dev/video?, /dev/vbi? and /dev/radio? device nodes are used for the chipset that provides the bridge between video/radio streams and the USB, PCI or CPU buses.
Such bridge is also typically used to control the V4L2 device as a hole.
For video streaming devices and SDR radio devices, they're also associated with the DMA engines that transfer the video stream (or SDR stream) to the CPU's memory.
It should be noticed, however, this is not true on non-SDR radio devices, and may also not be true on embedded devices that, due to DRM reasons, don't allow writing unencrypted data on a memory that could be seen by the CPU.
So, we'll eventually need to add another entity for such bridge chipsets that have a video/vbi/radio device node associated, but don't have DMA engines on (some) devnodes.
As, currently, we don't have any such case, let's for now just rename the device nodes that are associated with a DMA engine as MEDIA_ENT_T_AV_DMA.
So,
MEDIA_ENT_T_DEVNODE_V4L -> MEDIA_ENT_T_AV_DMA
PS.: This is not actually true for USB devices, as the DMA engine is an internal component, as it is up to the Kernel to strip the stream payload from the URB packages.
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +1 -1
@@ -183,7 +183,7 @@ <entry>Unknown device node</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_V4L</constant></entry> + <entry><constant>MEDIA_ENT_T_AV_DMA</constant></entry> <entry>V4L video, radio or vbi device node</entry> </row> <row>
drivers/media/platform/xilinx/xilinx-dma.c +1 -1
@@ -193,7 +193,7 @@ static int xvip_pipeline_validate(struct xvip_pipeline *pipe,while ((entity =media_entity_graph_walk_next (&graph))) {struct xvip_dma *dma; -if (entity->type !=MEDIA_ENT_T_DEVNODE_V4L ) +if (entity->type !=MEDIA_ENT_T_AV_DMA )continue ; dma =to_xvip_dma (media_entity_to_video_device (entity));
drivers/media/v4l2-core/v4l2-dev.c +1 -1
@@ -912,7 +912,7 @@ int __video_register_device(struct video_device *vdev, int type, int nr,/* Part 5: Register the entity. */ if (vdev->v4l2_dev->mdev && vdev->vfl_type !=VFL_TYPE_SUBDEV ) { - vdev->entity.type =MEDIA_ENT_T_DEVNODE_V4L ; + vdev->entity.type =MEDIA_ENT_T_AV_DMA ; vdev->entity.name = vdev->name; vdev->entity.info.dev.major =VIDEO_MAJOR ; vdev->entity.info.dev.minor = vdev->minor;
drivers/media/v4l2-core/v4l2-subdev.c +1 -1
@@ -535,7 +535,7 @@ v4l2_subdev_link_validate_get_format(struct media_pad *pad,return v4l2_subdev_call (sd, pad, get_fmt,NULL , fmt); } -WARN (pad->entity->type !=MEDIA_ENT_T_DEVNODE_V4L , +WARN (pad->entity->type !=MEDIA_ENT_T_AV_DMA ,"Driver bug! Wrong media entity type 0x%08x, entity %s\n" , pad->entity->type, pad->entity->name);
include/uapi/linux/media.h +6 -6
@@ -44,12 +44,12 @@ struct media_device_info {/* Used values for media_entity_desc::type */ -#define MEDIA_ENT_T_DEVNODE_V4L (((1 << 16)) + 1) -#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE_V4L + 3) -#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE_V4L + 4) -#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_DEVNODE_V4L + 5) -#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE_V4L + 6) -#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_DEVNODE_V4L + 7) +#define MEDIA_ENT_T_AV_DMA (((1 << 16)) + 1) +#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_AV_DMA + 3) +#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_AV_DMA + 4) +#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_AV_DMA + 5) +#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_AV_DMA + 6) +#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_AV_DMA + 7)#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ((2 << 16) + 1)#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 1)
Signature · 1 line
2.1.0
Re: [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines
Quoted 2 lines · Mauro Carvalho Chehab
At the Video4Linux API, the
/dev/video?,/dev/vbi? and/dev/radio? device nodes are used for the chipset that
You should add /dev/swradio? for SDR devices.
Quoted 5 lines
provides the bridge between video/radio streams and the USB, PCI or CPU buses.
Such bridge is also typically used to control the V4L2 device as a hole.
hole -> whole
Quoted 7 lines
For video streaming devices and SDR radio devices, they're also associated with the DMA engines that transfer the video stream (or SDR stream) to the CPU's memory.
It should be noticed, however, this is not true on non-SDR radio devices,
I think you forgot that SDR devices are not using /dev/radio but /dev/swradio. They have different names. Radio devices never stream (OK, I think there are one or two exceptions, but that's really because nobody bothered to make an alsa driver. Those boards are in practice out of spec.)
Quoted 3 lines
and may also not be true on embedded devices that, due to DRM reasons, don't allow writing unencrypted data on a memory that could be seen by the CPU.
This actually might still work by using opaque DMABUF handles. But that's under discussion right now in the Secure Data Path thread.
Another reason can also be that the SoC vendor re-invented the wheel and made there own DMA streaming solution. You can still make V4L drivers that control the video receivers/transmitters, but for the actual streaming you are forced to use the vendor's crap code (hello TI!).
I've bitter experiences with that :-(
Quoted 5 lines
So, we'll eventually need to add another entity for such bridge chipsets that have a video/vbi/radio device node associated, but don't have DMA engines on (some) devnodes.
As, currently, we don't have any such case,
??? Radio devices are exactly that.
Quoted 10 lines
let's for now
just rename the device nodes that are associated with a DMA engine asMEDIA_ENT_T_AV_DMA.So,
MEDIA_ENT_T_DEVNODE_V4L -> MEDIA_ENT_T_AV_DMAPS.: This is not actually true for USB devices, as the DMA engine is an internal component, as it is up to the Kernel to strip the stream payload from the URB packages.
How about MEDIA_ENT_T_DATA_STREAMING? Or perhaps DATA_IO? Perhaps even just "IO"?
That would cover USB as well, and I dislike the use of "AV", since the data might contain other things besides audio and/or video.
Regards,
Hans
Quoted 79 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +1
-1@@ -183,7 +183,7 @@ <entry>Unknown device node</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_V4L</constant></entry> + <entry><constant>MEDIA_ENT_T_AV_DMA</constant></entry> <entry>V4L video, radio or vbi device node</entry> </row> <row>drivers/media/platform/xilinx/xilinx-dma.c +1
-1@@ -193,7 +193,7 @@ static int xvip_pipeline_validate(struct xvip_pipeline *pipe,while ((entity =media_entity_graph_walk_next (&graph))) {struct xvip_dma *dma; -if (entity->type !=MEDIA_ENT_T_DEVNODE_V4L ) +if (entity->type !=MEDIA_ENT_T_AV_DMA )continue ; dma =to_xvip_dma (media_entity_to_video_device (entity));drivers/media/v4l2-core/v4l2-dev.c +1
-1@@ -912,7 +912,7 @@ int __video_register_device(struct video_device *vdev, int type, int nr,/* Part 5: Register the entity. */ if (vdev->v4l2_dev->mdev && vdev->vfl_type !=VFL_TYPE_SUBDEV ) { - vdev->entity.type =MEDIA_ENT_T_DEVNODE_V4L ; + vdev->entity.type =MEDIA_ENT_T_AV_DMA ; vdev->entity.name = vdev->name; vdev->entity.info.dev.major =VIDEO_MAJOR ; vdev->entity.info.dev.minor = vdev->minor;drivers/media/v4l2-core/v4l2-subdev.c +1
-1@@ -535,7 +535,7 @@ v4l2_subdev_link_validate_get_format(struct media_pad *pad,return v4l2_subdev_call (sd, pad, get_fmt,NULL , fmt); } -WARN (pad->entity->type !=MEDIA_ENT_T_DEVNODE_V4L , +WARN (pad->entity->type !=MEDIA_ENT_T_AV_DMA ,"Driver bug! Wrong media entity type 0x%08x, entity %s\n" , pad->entity->type, pad->entity->name);include/uapi/linux/media.h +6
-6@@ -44,12 +44,12 @@ struct media_device_info {/* Used values for media_entity_desc::type */ -#define MEDIA_ENT_T_DEVNODE_V4L (((1 << 16)) + 1) -#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE_V4L + 3) -#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE_V4L + 4) -#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_DEVNODE_V4L + 5) -#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE_V4L + 6) -#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_DEVNODE_V4L + 7) +#define MEDIA_ENT_T_AV_DMA (((1 << 16)) + 1) +#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_AV_DMA + 3) +#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_AV_DMA + 4) +#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_AV_DMA + 5) +#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_AV_DMA + 6) +#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_AV_DMA + 7)#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ((2 << 16) + 1)#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 1)
Re: [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines
Em Fri, 08 May 2015 13:54:07 +0200
Hans Verkuil <[email protected]> escreveu:
Quoted 3 lines · Mauro Carvalho Chehab
Quoted 2 lines
At the Video4Linux API, the
/dev/video?,/dev/vbi? and/dev/radio? device nodes are used for the chipset that
I knew that this patch would cause some discussions ;)
Quoted 2 lines
You should add
/dev/swradio? for SDR devices.
I will.
Quoted 8 lines
Quoted 6 lines
provides the bridge between video/radio streams and the USB, PCI or CPU buses.
Such bridge is also typically used to control the V4L2 device as a hole.
hole -> whole
Ok.
Quoted 10 lines
Quoted 7 lines
For video streaming devices and SDR radio devices, they're also associated with the DMA engines that transfer the video stream (or SDR stream) to the CPU's memory.
It should be noticed, however, this is not true on non-SDR radio devices,
I think you forgot that SDR devices are not using
/dev/radiobut/dev/swradio.
Yeah, true. I forgot that, in the end of the day, we used a different naming for SDR radio devnodes. I'll fix the comments.
Quoted 4 lines
They have different names. Radio devices never
stream (OK, I think there are one or two exceptions, but that's really because nobody bothered to make an alsa driver. Those boards are in practice out of spec.)
Yes, I know.
Quoted 6 lines
Quoted 3 lines
and may also not be true on embedded devices that, due to DRM reasons, don't allow writing unencrypted data on a memory that could be seen by the CPU.
This actually might still work by using opaque DMABUF handles. But that's under discussion right now in the Secure Data Path thread.
Well, a DMABUF opaque handler like that actually refers to either a buffer that is shared only between 2 devices or to a device-to-device DMA transfer.
Such dataflow is different than the usual meaning of the video devnode, where the devnode is used to do I/O transfers. So, it may actually be mapped as a different type of entity.
We'll need to discuss further when we start mapping this via MC.
Quoted 7 lines
Another reason can also be that the SoC vendor re-invented the wheel and made there own DMA streaming solution. You can still make V4L drivers that control the video receivers/transmitters, but for the actual streaming you are forced to use the vendor's crap code (hello TI!).
I've bitter experiences with that :-(
Quoted 7 lines
Quoted 5 lines
So, we'll eventually need to add another entity for such bridge chipsets that have a video/vbi/radio device node associated, but don't have DMA engines on (some) devnodes.
As, currently, we don't have any such case,
??? Radio devices are exactly that.
I actually meant to say:
"As, currently, no driver uses Media Controller on such cases,"
Quoted 7 lines
Quoted 7 lines
let's for now
just rename the device nodes that are associated with a DMA engine asMEDIA_ENT_T_AV_DMA.So,
MEDIA_ENT_T_DEVNODE_V4L -> MEDIA_ENT_T_AV_DMA
Quoted 6 lines
Quoted 3 lines
PS.: This is not actually true for USB devices, as the DMA engine is an internal component, as it is up to the Kernel to strip the stream payload from the URB packages.
How about
MEDIA_ENT_T_DATA_STREAMING? Or perhapsDATA_IO? Perhaps even just "IO"?
Almost entities do I/O and data streaming (exceptions are flash controller, SEC and similar control subdevices). So, DATA_STREAMING, DATA_IO or IO are a way too generic.
DMA is a little bit more restrictive than we wanted.
Actually, I originally named those as MEDIA_ENT_T_AV_BRIDGE, because the hardware component that implements the device->CPU I/O is typically a bridge. But then I went into the drivers, and I noticed that several devices with just one bridge have several different entities for I/O.
So, I ran this script:
$ git filter-branch -f --msg-filter 'cat && sed s,MEDIA_ENT_T_AV_BRIDGE,MEDIA_ENT_T_AV_DMA,g' origin/patchwork.. $ git filter-branch -f --tree-filter 'for i in $(git grep -l MEDIA_ENT_T_AV_BRIDGE); do sed s,MEDIA_ENT_T_AV_BRIDGE,MEDIA_ENT_T_AV_DMA,g $i >a && mv a $i; done' origin/patchwork..
To replace the name everywere. Provided that we decide a better name, this can be easily fixable by doing the above scripting.
Perhaps MEDIA_ENT_T_DEV_CPU_AV_IO would be a better name?
Quoted 2 lines
That would cover USB as well, and I dislike the use of "AV", since the data might contain other things besides audio and/or video.
True, but how to distinguish such device from an ALSA DEV/CPU IO?
Answering myself, I see one alternative for that... we could use MEDIA_ENT_T_DEV_CPU_IO for all device->CPU I/O devices, and use properties to tell what APIs are valid on such entity. The bad thing is that someone could add multiple "incompatible" APIs at the same device (like ALSA, V4L and DVB - all on the dame sevnode).
I'm running out of ideas here ;)
In the lack of a better name, I would keep MEDIA_ENT_T_AV_DMA, as it is the closest one to what's provided by such entities (or the less wrong one).
Regards,
Mauro
Re: [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines
Hi Mauro,
Quoted 11 lines · Mauro Carvalho Chehab
Quoted 6 lines
Quoted 3 lines
and may also not be true on embedded devices that, due to DRM reasons, don't allow writing unencrypted data on a memory that could be seen by the CPU.
This actually might still work by using opaque DMABUF handles. But that's under discussion right now in the Secure Data Path thread.
Well, a DMABUF opaque handler like that actually refers to either a buffer that is shared only between 2 devices or to a device-to-device DMA transfer.
Quoted 5 lines
Such dataflow is different than the usual meaning of the video devnode, where the devnode is used to do I/O transfers. So, it may actually be mapped as a different type of entity.
We'll need to discuss further when we start mapping this via MC.
Yes, this is quite theoretical at the moment.
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
So, we'll eventually need to add another entity for such bridge chipsets that have a video/vbi/radio device node associated, but don't have DMA engines on (some) devnodes.
As, currently, we don't have any such case,
??? Radio devices are exactly that.
I actually meant to say:
"As, currently, no driver uses Media Controller on such cases,"
Ah, OK. That makes more sense :-)
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
let's for now
just rename the device nodes that are associated with a DMA engine asMEDIA_ENT_T_AV_DMA.So,
MEDIA_ENT_T_DEVNODE_V4L -> MEDIA_ENT_T_AV_DMAPS.: This is not actually true for USB devices, as the DMA engine is an internal component, as it is up to the Kernel to strip the stream payload from the URB packages.
Quoted 6 lines
Quoted 2 lines
How about
MEDIA_ENT_T_DATA_STREAMING? Or perhapsDATA_IO? Perhaps even just "IO"?Almost entities do I/O and data streaming (exceptions are flash controller, SEC and similar control subdevices). So,
DATA_STREAMING,DATA_IOor IO are a way too generic.
For some of our products we have lots of video nodes that just control the receiver or transmitter (and possibly other related blocks), but leave the streaming to vendor code where we are forced to use that. So this can be a lot more common than you might think, although you won't see that appearing in the kernel.
Quoted 28 lines
DMA is a little bit more restrictive than we wanted.
Actually, I originally named those as
MEDIA_ENT_T_AV_BRIDGE, because the hardware component that implements thedevice->CPUI/O is typically a bridge. But then I went into the drivers, and I noticed that several devices with just one bridge have several different entities for I/O.So, I ran this script:
$ git filter-branch -f --msg-filter 'cat && sed s,MEDIA_ENT_T_AV_BRIDGE,MEDIA_ENT_T_AV_DMA,g' origin/patchwork.. $ git filter-branch -f --tree-filter 'for i in $(git grep -l MEDIA_ENT_T_AV_BRIDGE); do sed s,MEDIA_ENT_T_AV_BRIDGE,MEDIA_ENT_T_AV_DMA,g $i >a && mv a $i; done' origin/patchwork..To replace the name everywere. Provided that we decide a better name, this can be easily fixable by doing the above scripting.
Perhaps
MEDIA_ENT_T_DEV_CPU_AV_IOwould be a better name?Quoted 2 lines
That would cover USB as well, and I dislike the use of "AV", since the data might contain other things besides audio and/or video.
True, but how to distinguish such device from an ALSA DEV/CPU IO?
Answering myself, I see one alternative for that... we could use
MEDIA_ENT_T_DEV_CPU_IOfor alldevice->CPUI/O devices, and use properties to tell what APIs are valid on such entity. The bad thing is that someone could add multiple "incompatible" APIs at the same device (like ALSA, V4L and DVB - all on the dame sevnode).
Quoted 5 lines
I'm running out of ideas here ;)
In the lack of a better name, I would keep
MEDIA_ENT_T_AV_DMA, as it is the closest one to what's provided by such entities (or the less wrong one).
See my reply to patch 10/18: I see whether streaming is supported or not as a function (or feature) of the entity, just like a subdev entity can be both a tuner and a video decoder. I.e. these are properties.
I think the naming issue here shows the problem with your approach. Whereas having a 'streaming' property simplifies this IMHO.
Regards,
Hans
PATCH 5/18 media controller: rename MEDIA_ENT_T_DEVNODE_DVB entities
In reply to a message not in the archiveIn order to reflect that the entities are actually the hardware (or firmware, or in-kernel software), and are not associated with the DVB API, let's remove DEVNODE_ from the entity names and use DTV (Digital TV) for the entities.
The frontend is an special case: the frontend devnode actually talks directly with the DTV demodulator. It may or may not also talk with the SEC (Satellite Equipment Control) and with the tuner. For the sake of unifying the nomenclature, let's call it as MEDIA_ENT_T_DTV_DEMOD, because this component is always there.
So:
MEDIA_ENT_T_DEVNODE_DVB_FE -> MEDIA_ENT_T_DTV_DEMOD MEDIA_ENT_T_DEVNODE_DVB_DEMUX -> MEDIA_ENT_T_DTV_DEMUX MEDIA_ENT_T_DEVNODE_DVB_DVR -> MEDIA_ENT_T_DTV_DVR MEDIA_ENT_T_DEVNODE_DVB_CA -> MEDIA_ENT_T_DTV_CA MEDIA_ENT_T_DEVNODE_DVB_NET -> MEDIA_ENT_T_DTV_NET
PS.: we could actually not keep this define:
#define MEDIA_ENT_T_DEVNODE_DVB_FE MEDIA_ENT_T_DTV_DEMOD
As MEDIA_ENT_T_DEVNODE_DVB_FE symbol will not arrive any Kernel version (being present only at the 4.1-rc kernels), but keeping it helps to show that the DVB frontend node is actually associated with the DTV demodulator. So, keeping it for now helps to better document. Also, it avoids to break experimental versions of v4l-utils. So, better to remove this only when we remove the remaining legacy stuff.
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +5 -5
@@ -195,23 +195,23 @@ <entry>ALSA card</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_FE</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_DEMOD</constant></entry> <entry>DVB frontend devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DEMUX</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_DEMUX</constant></entry> <entry>DVB demux devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DVR</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_DVR</constant></entry> <entry>DVB DVR devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_CA</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_CA</constant></entry> <entry>DVB CAM devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_NET</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_NET</constant></entry> <entry>DVB network devnode</entry> </row> <row>
drivers/media/dvb-core/dvbdev.c +9 -9
@@ -221,26 +221,26 @@ static void dvb_register_media_device(struct dvb_device *dvbdev,switch (type) {case DVB_DEVICE_FRONTEND : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_FE ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_DEMOD ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ; dvbdev->pads[1 ].flags =MEDIA_PAD_FL_SOURCE ;break ;case DVB_DEVICE_DEMUX : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_DEMUX ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_DEMUX ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ; dvbdev->pads[1 ].flags =MEDIA_PAD_FL_SOURCE ;break ;case DVB_DEVICE_DVR : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_DVR ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_DVR ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ;break ;case DVB_DEVICE_CA : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_CA ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_CA ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ; dvbdev->pads[1 ].flags =MEDIA_PAD_FL_SOURCE ;break ;case DVB_DEVICE_NET : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_NET ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_NET ;break ;default :kfree (dvbdev->entity);
@@ -396,16 +396,16 @@ void dvb_create_media_graph(struct dvb_adapter *adap)case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : tuner = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_FE : +case MEDIA_ENT_T_DTV_DEMOD : fe = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_DEMUX : +case MEDIA_ENT_T_DTV_DEMUX : demux = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_DVR : +case MEDIA_ENT_T_DTV_DVR : dvr = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_CA : +case MEDIA_ENT_T_DTV_CA : ca = entity;break ; }
include/uapi/linux/media.h +12 -6
@@ -45,11 +45,11 @@ struct media_device_info {/* Used values for media_entity_desc::type */ #define MEDIA_ENT_T_AV_DMA (((1 << 16)) + 1) -#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_AV_DMA + 3) -#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_AV_DMA + 4) -#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_AV_DMA + 5) -#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_AV_DMA + 6) -#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_AV_DMA + 7) +#define MEDIA_ENT_T_DTV_DEMOD (MEDIA_ENT_T_AV_DMA + 3) +#define MEDIA_ENT_T_DTV_DEMUX (MEDIA_ENT_T_AV_DMA + 4) +#define MEDIA_ENT_T_DTV_DVR (MEDIA_ENT_T_AV_DMA + 5) +#define MEDIA_ENT_T_DTV_CA (MEDIA_ENT_T_AV_DMA + 6) +#define MEDIA_ENT_T_DTV_NET (MEDIA_ENT_T_AV_DMA + 7)#define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1)#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1)
@@ -76,7 +76,13 @@ struct media_device_info {#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) -#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE +#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DTV_DEMOD +#define MEDIA_ENT_T_DEVNODE_DVB_FE MEDIA_ENT_T_DTV_DEMOD +#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX MEDIA_ENT_T_DTV_DEMUX +#define MEDIA_ENT_T_DEVNODE_DVB_DVR MEDIA_ENT_T_DTV_DVR +#define MEDIA_ENT_T_DEVNODE_DVB_CA MEDIA_ENT_T_DTV_CA +#define MEDIA_ENT_T_DEVNODE_DVB_NET MEDIA_ENT_T_DTV_NET +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_T_CAM_SENSOR#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_T_CAM_FLASH#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS
Signature · 1 line
2.1.0
Re: [PATCH 05/18] media controller: rename MEDIA_ENT_T_DEVNODE_DVB entities
Quoted 12 lines · Mauro Carvalho Chehab
In order to reflect that the entities are actually the hardware (or firmware, or in-kernel software), and are not associated with the DVB API, let's remove
DEVNODE_from the entity names and use DTV (Digital TV) for the entities.The frontend is an special case: the frontend devnode actually talks directly with the DTV demodulator. It may or may not also talk with the SEC (Satellite Equipment Control) and with the tuner. For the sake of unifying the nomenclature, let's call it as
MEDIA_ENT_T_DTV_DEMOD, because this component is always there.
Quoted 7 lines
So:
MEDIA_ENT_T_DEVNODE_DVB_FE -> MEDIA_ENT_T_DTV_DEMOD MEDIA_ENT_T_DEVNODE_DVB_DEMUX -> MEDIA_ENT_T_DTV_DEMUX MEDIA_ENT_T_DEVNODE_DVB_DVR -> MEDIA_ENT_T_DTV_DVR MEDIA_ENT_T_DEVNODE_DVB_CA -> MEDIA_ENT_T_DTV_CA MEDIA_ENT_T_DEVNODE_DVB_NET -> MEDIA_ENT_T_DTV_NET
I'm happy with the new names.
Quoted 11 lines
PS.: we could actually not keep this define:
#define MEDIA_ENT_T_DEVNODE_DVB_FE MEDIA_ENT_T_DTV_DEMODAs
MEDIA_ENT_T_DEVNODE_DVB_FEsymbol will not arrive any Kernel version (being present only at the 4.1-rc kernels), but keeping it helps to show that the DVB frontend node is actually associated with the DTV demodulator. So, keeping it for now helps to better document. Also, it avoids to break experimental versions of v4l-utils. So, better to remove this only when we remove the remaining legacy stuff.
I disagree with that. Let's not introduce defines that are not going to be used. And v4l-utils is easily fixed.
Instead of keeping an unused define, why not...
Quoted 8 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +0
-0
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml line 199
Quoted 6 lines
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +1
-1@@ -195,23 +195,23 @@ <entry>ALSA card</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_FE</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_DEMOD</constant></entry> <entry>DVB frontend devnode</entry>
... explain what is going on here? I.e. that this frontend always controls a demod and optionally also a tuner and/or SEC.
Regards,
Hans
Quoted 116 lines
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +4
-4</row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DEMUX</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_DEMUX</constant></entry> <entry>DVB demux devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DVR</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_DVR</constant></entry> <entry>DVB DVR devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_CA</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_CA</constant></entry> <entry>DVB CAM devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_NET</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_NET</constant></entry> <entry>DVB network devnode</entry> </row> <row>drivers/media/dvb-core/dvbdev.c +9
-9@@ -221,26 +221,26 @@ static void dvb_register_media_device(struct dvb_device *dvbdev,switch (type) {case DVB_DEVICE_FRONTEND : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_FE ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_DEMOD ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ; dvbdev->pads[1 ].flags =MEDIA_PAD_FL_SOURCE ;break ;case DVB_DEVICE_DEMUX : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_DEMUX ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_DEMUX ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ; dvbdev->pads[1 ].flags =MEDIA_PAD_FL_SOURCE ;break ;case DVB_DEVICE_DVR : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_DVR ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_DVR ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ;break ;case DVB_DEVICE_CA : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_CA ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_CA ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ; dvbdev->pads[1 ].flags =MEDIA_PAD_FL_SOURCE ;break ;case DVB_DEVICE_NET : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_NET ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_NET ;break ;default :kfree (dvbdev->entity);@@ -396,16 +396,16 @@ void dvb_create_media_graph(struct dvb_adapter *adap)case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : tuner = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_FE : +case MEDIA_ENT_T_DTV_DEMOD : fe = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_DEMUX : +case MEDIA_ENT_T_DTV_DEMUX : demux = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_DVR : +case MEDIA_ENT_T_DTV_DVR : dvr = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_CA : +case MEDIA_ENT_T_DTV_CA : ca = entity;break ; }include/uapi/linux/media.h +12
-6@@ -45,11 +45,11 @@ struct media_device_info {/* Used values for media_entity_desc::type */ #define MEDIA_ENT_T_AV_DMA (((1 << 16)) + 1) -#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_AV_DMA + 3) -#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_AV_DMA + 4) -#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_AV_DMA + 5) -#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_AV_DMA + 6) -#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_AV_DMA + 7) +#define MEDIA_ENT_T_DTV_DEMOD (MEDIA_ENT_T_AV_DMA + 3) +#define MEDIA_ENT_T_DTV_DEMUX (MEDIA_ENT_T_AV_DMA + 4) +#define MEDIA_ENT_T_DTV_DVR (MEDIA_ENT_T_AV_DMA + 5) +#define MEDIA_ENT_T_DTV_CA (MEDIA_ENT_T_AV_DMA + 6) +#define MEDIA_ENT_T_DTV_NET (MEDIA_ENT_T_AV_DMA + 7)#define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1)#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1)@@ -76,7 +76,13 @@ struct media_device_info {#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) -#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE +#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DTV_DEMOD +#define MEDIA_ENT_T_DEVNODE_DVB_FE MEDIA_ENT_T_DTV_DEMOD +#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX MEDIA_ENT_T_DTV_DEMUX +#define MEDIA_ENT_T_DEVNODE_DVB_DVR MEDIA_ENT_T_DTV_DVR +#define MEDIA_ENT_T_DEVNODE_DVB_CA MEDIA_ENT_T_DTV_CA +#define MEDIA_ENT_T_DEVNODE_DVB_NET MEDIA_ENT_T_DTV_NET +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_T_CAM_SENSOR#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_T_CAM_FLASH#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS
A message that is not in the archive (sent off-list or not yet received): 554CA7C8.20505-qWit8jRvyhVmR6Xm/[email protected]
Re: [PATCH 05/18] media controller: rename MEDIA_ENT_T_DEVNODE_DVB entities
Em Fri, 08 May 2015 14:10:48 +0200
Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/[email protected]> escreveu:
Quoted 35 lines · Mauro Carvalho Chehab
Quoted 12 lines
In order to reflect that the entities are actually the hardware (or firmware, or in-kernel software), and are not associated with the DVB API, let's remove
DEVNODE_from the entity names and use DTV (Digital TV) for the entities.The frontend is an special case: the frontend devnode actually talks directly with the DTV demodulator. It may or may not also talk with the SEC (Satellite Equipment Control) and with the tuner. For the sake of unifying the nomenclature, let's call it as
MEDIA_ENT_T_DTV_DEMOD, because this component is always there.Quoted 7 lines
So:
MEDIA_ENT_T_DEVNODE_DVB_FE -> MEDIA_ENT_T_DTV_DEMOD MEDIA_ENT_T_DEVNODE_DVB_DEMUX -> MEDIA_ENT_T_DTV_DEMUX MEDIA_ENT_T_DEVNODE_DVB_DVR -> MEDIA_ENT_T_DTV_DVR MEDIA_ENT_T_DEVNODE_DVB_CA -> MEDIA_ENT_T_DTV_CA MEDIA_ENT_T_DEVNODE_DVB_NET -> MEDIA_ENT_T_DTV_NETI'm happy with the new names.
Quoted 11 lines
PS.: we could actually not keep this define:
#define MEDIA_ENT_T_DEVNODE_DVB_FE MEDIA_ENT_T_DTV_DEMODAs
MEDIA_ENT_T_DEVNODE_DVB_FEsymbol will not arrive any Kernel version (being present only at the 4.1-rc kernels), but keeping it helps to show that the DVB frontend node is actually associated with the DTV demodulator. So, keeping it for now helps to better document. Also, it avoids to break experimental versions of v4l-utils. So, better to remove this only when we remove the remaining legacy stuff.
Quoted 4 lines
I disagree with that. Let's not introduce defines that are not going to be used. And v4l-utils is easily fixed.
Instead of keeping an unused define, why not...
We agree to disagree here ;)
Quoted 4 lines
Quoted 4 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>
Quoted 14 lines
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml line 199
Quoted 11 lines
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +1
-1@@ -195,23 +195,23 @@ <entry>ALSA card</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_FE</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_DEMOD</constant></entry> <entry>DVB frontend devnode</entry>... explain what is going on here? I.e. that this frontend always controls a demod and optionally also a tuner and/or SEC.
I'm actually doing just the renames on those initial patches. There are some adjustments to be done at the documentation, not just that.
So, I opted to do such adjustment on the last patch of this series.
Quoted 122 lines
Regards,
Hans
Quoted 116 lines
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +4
-4</row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DEMUX</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_DEMUX</constant></entry> <entry>DVB demux devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DVR</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_DVR</constant></entry> <entry>DVB DVR devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_CA</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_CA</constant></entry> <entry>DVB CAM devnode</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_NET</constant></entry> + <entry><constant>MEDIA_ENT_T_DTV_NET</constant></entry> <entry>DVB network devnode</entry> </row> <row>drivers/media/dvb-core/dvbdev.c +9
-9@@ -221,26 +221,26 @@ static void dvb_register_media_device(struct dvb_device *dvbdev,switch (type) {case DVB_DEVICE_FRONTEND : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_FE ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_DEMOD ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ; dvbdev->pads[1 ].flags =MEDIA_PAD_FL_SOURCE ;break ;case DVB_DEVICE_DEMUX : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_DEMUX ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_DEMUX ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ; dvbdev->pads[1 ].flags =MEDIA_PAD_FL_SOURCE ;break ;case DVB_DEVICE_DVR : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_DVR ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_DVR ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ;break ;case DVB_DEVICE_CA : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_CA ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_CA ; dvbdev->pads[0 ].flags =MEDIA_PAD_FL_SINK ; dvbdev->pads[1 ].flags =MEDIA_PAD_FL_SOURCE ;break ;case DVB_DEVICE_NET : - dvbdev->entity->type =MEDIA_ENT_T_DEVNODE_DVB_NET ; + dvbdev->entity->type =MEDIA_ENT_T_DTV_NET ;break ;default :kfree (dvbdev->entity);@@ -396,16 +396,16 @@ void dvb_create_media_graph(struct dvb_adapter *adap)case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : tuner = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_FE : +case MEDIA_ENT_T_DTV_DEMOD : fe = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_DEMUX : +case MEDIA_ENT_T_DTV_DEMUX : demux = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_DVR : +case MEDIA_ENT_T_DTV_DVR : dvr = entity;break ; -case MEDIA_ENT_T_DEVNODE_DVB_CA : +case MEDIA_ENT_T_DTV_CA : ca = entity;break ; }include/uapi/linux/media.h +12
-6@@ -45,11 +45,11 @@ struct media_device_info {/* Used values for media_entity_desc::type */ #define MEDIA_ENT_T_AV_DMA (((1 << 16)) + 1) -#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_AV_DMA + 3) -#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_AV_DMA + 4) -#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_AV_DMA + 5) -#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_AV_DMA + 6) -#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_AV_DMA + 7) +#define MEDIA_ENT_T_DTV_DEMOD (MEDIA_ENT_T_AV_DMA + 3) +#define MEDIA_ENT_T_DTV_DEMUX (MEDIA_ENT_T_AV_DMA + 4) +#define MEDIA_ENT_T_DTV_DVR (MEDIA_ENT_T_AV_DMA + 5) +#define MEDIA_ENT_T_DTV_CA (MEDIA_ENT_T_AV_DMA + 6) +#define MEDIA_ENT_T_DTV_NET (MEDIA_ENT_T_AV_DMA + 7)#define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1)#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1)@@ -76,7 +76,13 @@ struct media_device_info {#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) -#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE +#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DTV_DEMOD +#define MEDIA_ENT_T_DEVNODE_DVB_FE MEDIA_ENT_T_DTV_DEMOD +#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX MEDIA_ENT_T_DTV_DEMUX +#define MEDIA_ENT_T_DEVNODE_DVB_DVR MEDIA_ENT_T_DTV_DVR +#define MEDIA_ENT_T_DEVNODE_DVB_CA MEDIA_ENT_T_DTV_CA +#define MEDIA_ENT_T_DEVNODE_DVB_NET MEDIA_ENT_T_DTV_NET +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_T_CAM_SENSOR#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_T_CAM_FLASH#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS
PATCH 16/18 v4l2-subdev: use MEDIA_ENT_T_UNKNOWN for new subdevs
In reply to a message not in the archiveInstead of abusing MEDIA_ENT_T_V4L2_SUBDEV, initialize new subdev entities as MEDIA_ENT_T_UNKNOWN.
drivers/media/v4l2-core/v4l2-subdev.c +1 -1
@@ -584,7 +584,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) sd->host_priv =NULL ;#if defined(CONFIG_MEDIA_CONTROLLER ) sd->entity.name = sd->name; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV ; + sd->entity.type =MEDIA_ENT_T_UNKNOWN ;#endif }EXPORT_SYMBOL (v4l2_subdev_init);
include/uapi/linux/media.h +6 -0
@@ -44,6 +44,12 @@ struct media_device_info {/* Used values for media_entity_desc::type */ +/* +* Initial value when an entity is created +* Drivers should change it to something useful +*/ +#define MEDIA_ENT_T_UNKNOWN 0 +/* Audio/video streaming bridges */ #define MEDIA_ENT_T_AV_DMA (((1 << 16)) + 1)
Signature · 1 line
2.1.0
PATCH 2/18 media controller: deprecate entity subtype
In reply to Mauro Carvalho ChehabThe media controller entity subtype doesn't make much sense, especially since V4L2 subdevices may also have associated devnodes.
So, better to get rid of it while it is not too late.
We need, of course, to keep the old symbols to avoid userspace breakage, but we should avoid using them internally at the Kernel.
include/uapi/linux/media.h +29 -15
@@ -42,31 +42,45 @@ struct media_device_info {#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) +/* Used values for media_entity_desc::type */ + +#define MEDIA_ENT_T_DEVNODE_V4L (((1 << 16)) + 1) +#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE_V4L + 3) +#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE_V4L + 4) +#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_DEVNODE_V4L + 5) +#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE_V4L + 6) +#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_DEVNODE_V4L + 7) + +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ((2 << 16) + 1) +#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 1) +#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 2) +/* A converter of analogue video to its digital representation. */ +#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 3) + +#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 4) + +#if 1 +/* +* Legacy symbols. +* Kept just to avoid userspace compilation breakages. +* One day, the symbols bellow will be removed +*/ +#define MEDIA_ENT_TYPE_SHIFT 16#define MEDIA_ENT_TYPE_MASK 0x00ff0000#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT) -#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1) +#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) +#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) -#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE + 4) -#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE + 5) -#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_DEVNODE + 6) -#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE + 7) -#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_DEVNODE + 8) -/* Legacy symbol. Use it to avoid userspace compilation breakages */ +#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE +#endif -#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) -#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) -#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2) -#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3) -/* A converter of analogue video to its digital representation. */ -#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV + 4) - -#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV + 5) +/* Used bitmasks for media_entity_desc::flags */ #define MEDIA_ENT_FL_DEFAULT (1 << 0)
Signature · 1 line
2.1.0
A message that is not in the archive (sent off-list or not yet received): 80e0882a4194460ca232f19ebbc85fa3338eda3f.1431046915.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org
Hans Verkuil
Acked-byRe: [PATCH 02/18] media controller: deprecate entity subtype
Hi Mauro,
Just a typo, after that you can add my:
Thanks,
Hans
Quoted 31 lines · Mauro Carvalho Chehab
The media controller entity subtype doesn't make much sense, especially since V4L2 subdevices may also have associated devnodes.
So, better to get rid of it while it is not too late.
We need, of course, to keep the old symbols to avoid userspace breakage, but we should avoid using them internally at the Kernel.
Signed-off-by Mauro Carvalho Chehab <[email protected]>include/uapi/linux/media.h +12
-0@@ -42,31 +42,45 @@ struct media_device_info {#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) +/* Used values for media_entity_desc::type */ + +#define MEDIA_ENT_T_DEVNODE_V4L (((1 << 16)) + 1) +#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE_V4L + 3) +#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE_V4L + 4) +#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_DEVNODE_V4L + 5) +#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE_V4L + 6) +#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_DEVNODE_V4L + 7) + +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ((2 << 16) + 1) +#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 1) +#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 2)
include/uapi/linux/media.h struct media_device_info { · line 66
Quoted 10 lines
include/uapi/linux/media.h +10
-0+/* A converter of analogue video to its digital representation. */ +#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 3) + +#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 4) + +#if 1 +/* +* Legacy symbols. +* Kept just to avoid userspace compilation breakages. +* One day, the symbols bellow will be removed
bellow -> below
Quoted 36 lines
include/uapi/linux/media.h +7
-15+*/ +#define MEDIA_ENT_TYPE_SHIFT 16#define MEDIA_ENT_TYPE_MASK 0x00ff0000#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT) -#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1) +#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) +#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) -#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE + 4) -#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE + 5) -#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_DEVNODE + 6) -#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE + 7) -#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_DEVNODE + 8) -/* Legacy symbol. Use it to avoid userspace compilation breakages */ +#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE +#endif -#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) -#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) -#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2) -#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3) -/* A converter of analogue video to its digital representation. */ -#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV + 4) - -#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV + 5) +/* Used bitmasks for media_entity_desc::flags */ #define MEDIA_ENT_FL_DEFAULT (1 << 0)
PATCH 4/18 media controller: Rename camera entities
In reply to Mauro Carvalho ChehabAs explained before, the hole idea of subtypes at entities was not nice. All V4L2 subdevs may have a device node associated.
Also, the hole idea is to expose hardware IP blocks, so calling them as V4L2 is a very bad practice, as they were not designed for the V4L2 API. It is just the reverse.
So, instead of using V4L2_SUBDEV, let's call the camera sub- devices with CAM, instead:
MEDIA_ENT_T_V4L2_SUBDEV_SENSOR -> MEDIA_ENT_T_CAM_SENSOR MEDIA_ENT_T_V4L2_SUBDEV_FLASH -> MEDIA_ENT_T_CAM_FLASH MEDIA_ENT_T_V4L2_SUBDEV_LENS -> MEDIA_ENT_T_CAM_LENS
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +3 -3
@@ -219,15 +219,15 @@ <entry>Unknown V4L sub-device</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_SENSOR</constant></entry> + <entry><constant>MEDIA_ENT_T_CAM_SENSOR</constant></entry> <entry>Video sensor</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_FLASH</constant></entry> + <entry><constant>MEDIA_ENT_T_CAM_FLASH</constant></entry> <entry>Flash controller</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_LENS</constant></entry> + <entry><constant>MEDIA_ENT_T_CAM_LENS</constant></entry> <entry>Lens controller</entry> </row> <row>
drivers/media/i2c/adp1653.c +1 -1
@@ -516,7 +516,7 @@ 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 ; + flash->subdev.entity.type =MEDIA_ENT_T_CAM_FLASH ;return 0 ;
drivers/media/i2c/as3645a.c +1 -1
@@ -831,7 +831,7 @@ static int as3645a_probe(struct i2c_client *client,if (ret <0 ) goto done; - flash->subdev.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + flash->subdev.entity.type =MEDIA_ENT_T_CAM_FLASH ;mutex_init (&flash->power_lock);
drivers/media/i2c/lm3560.c +1 -1
@@ -368,7 +368,7 @@ static int lm3560_subdev_init(struct lm3560_flash *flash, rval =media_entity_init (&flash->subdev_led[led_no].entity,0 ,NULL ,0 );if (rval <0 ) goto err_out; - flash->subdev_led[led_no].entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + flash->subdev_led[led_no].entity.type =MEDIA_ENT_T_CAM_FLASH ;return rval;
drivers/media/i2c/lm3646.c +1 -1
@@ -285,7 +285,7 @@ static int lm3646_subdev_init(struct lm3646_flash *flash) rval =media_entity_init (&flash->subdev_led.entity,0 ,NULL ,0 );if (rval <0 ) goto err_out; - flash->subdev_led.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + flash->subdev_led.entity.type =MEDIA_ENT_T_CAM_FLASH ;return rval; err_out:
drivers/media/i2c/m5mols/m5mols_core.c +1 -1
@@ -978,7 +978,7 @@ static int m5mols_probe(struct i2c_client *client, ret =media_entity_init (&sd->entity,1 , &info->pad,0 );if (ret <0 )return ret; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ;init_waitqueue_head (&info->irq_waitq);mutex_init (&info->lock);
drivers/media/i2c/noon010pc30.c +1 -1
@@ -779,7 +779,7 @@ static int noon010_probe(struct i2c_client *client, goto np_err; info->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &info->pad,0 );if (ret <0 ) goto np_err;
drivers/media/i2c/ov2659.c +1 -1
@@ -1425,7 +1425,7 @@ static int ov2659_probe(struct i2c_client *client,#if defined(CONFIG_MEDIA_CONTROLLER ) ov2659->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &ov2659->pad,0 );if (ret <0 ) {v4l2_ctrl_handler_free (&ov2659->ctrls);
drivers/media/i2c/ov9650.c +1 -1
@@ -1500,7 +1500,7 @@ static int ov965x_probe(struct i2c_client *client,return ret; ov965x->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &ov965x->pad,0 );if (ret <0 )return ret;
drivers/media/i2c/s5k4ecgx.c +1 -1
@@ -961,7 +961,7 @@ static int s5k4ecgx_probe(struct i2c_client *client, sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; priv->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &priv->pad,0 );if (ret)return ret;
drivers/media/i2c/s5k5baf.c +2 -2
@@ -408,7 +408,7 @@ static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl)static inline bool s5k5baf_is_cis_subdev (struct v4l2_subdev *sd) { -return sd->entity.type ==MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; +return sd->entity.type ==MEDIA_ENT_T_CAM_SENSOR ; }static inline struct s5k5baf *to_s5k5baf (struct v4l2_subdev *sd)
@@ -1904,7 +1904,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state, sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; state->cis_pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,NUM_CIS_PADS , &state->cis_pad,0 );if (ret <0 ) goto err;
drivers/media/i2c/s5k6aa.c +1 -1
@@ -1577,7 +1577,7 @@ static int s5k6aa_probe(struct i2c_client *client, sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; s5k6aa->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &s5k6aa->pad,0 );if (ret)return ret;
drivers/media/i2c/smiapp/smiapp-core.c +1 -1
@@ -2763,7 +2763,7 @@ static int smiapp_init(struct smiapp_sensor *sensor)dev_dbg (&client->dev,"profile %d\n" , sensor->minfo.smiapp_profile); - sensor->pixel_array->sd.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sensor->pixel_array->sd.entity.type =MEDIA_ENT_T_CAM_SENSOR ;/* final steps */ smiapp_read_frame_fmt (sensor);
include/uapi/linux/media.h +8 -6
@@ -51,13 +51,13 @@ struct media_device_info {#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_AV_DMA + 6)#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_AV_DMA + 7) -#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ((2 << 16) + 1) -#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 1) -#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 2) +#define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1) +#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1) +#define MEDIA_ENT_T_CAM_LENS (MEDIA_ENT_T_CAM_SENSOR + 2)/* A converter of analogue video to its digital representation. */ -#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 3) +#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3) -#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 4) +#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)#if 1 /*
@@ -76,8 +76,10 @@ struct media_device_info {#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) -#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_T_CAM_SENSOR +#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_T_CAM_FLASH +#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS#endif /* Used bitmasks for media_entity_desc::flags */
Signature · 1 line
2.1.0
Re: [PATCH 04/18] media controller: Rename camera entities
Quoted 1 line · Mauro Carvalho Chehab
As explained before, the hole idea of subtypes at entities was
hole -> whole
Quoted 6 lines
not nice. All V4L2 subdevs may have a device node associated.
Also, the hole idea is to expose hardware IP blocks, so calling them as V4L2 is a very bad practice, as they were not designed for the V4L2 API. It is just the reverse.
Quoted 6 lines
So, instead of using
V4L2_SUBDEV, let's call the camera sub- devices with CAM, instead:MEDIA_ENT_T_V4L2_SUBDEV_SENSOR -> MEDIA_ENT_T_CAM_SENSOR MEDIA_ENT_T_V4L2_SUBDEV_FLASH -> MEDIA_ENT_T_CAM_FLASH MEDIA_ENT_T_V4L2_SUBDEV_LENS -> MEDIA_ENT_T_CAM_LENS
I would actually postpone this until Laurent has a properties API ready. These entity types are fatally flawed since an entity can combine functions in one. E.g. an i2c device (generally represented as a single entity) might provide for both sensor and flash. Or combine tuner and video decoder, etc.
Basically an entity like this is a sub-device (as in the literal meaning of being a part of a larger device) that has one or more functions and may have device node(s) associated with it. That is best expressed as properties.
And you really do have to tell userspace that these entities expose a v4l-subdev device node. Renaming them doesn't make that go away.
Regards,
Hans
Quoted 227 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +3
-3@@ -219,15 +219,15 @@ <entry>Unknown V4L sub-device</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_SENSOR</constant></entry> + <entry><constant>MEDIA_ENT_T_CAM_SENSOR</constant></entry> <entry>Video sensor</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_FLASH</constant></entry> + <entry><constant>MEDIA_ENT_T_CAM_FLASH</constant></entry> <entry>Flash controller</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_LENS</constant></entry> + <entry><constant>MEDIA_ENT_T_CAM_LENS</constant></entry> <entry>Lens controller</entry> </row> <row>drivers/media/i2c/adp1653.c +1
-1@@ -516,7 +516,7 @@ 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 ; + flash->subdev.entity.type =MEDIA_ENT_T_CAM_FLASH ;return 0 ;drivers/media/i2c/as3645a.c +1
-1@@ -831,7 +831,7 @@ static int as3645a_probe(struct i2c_client *client,if (ret <0 ) goto done; - flash->subdev.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + flash->subdev.entity.type =MEDIA_ENT_T_CAM_FLASH ;mutex_init (&flash->power_lock);drivers/media/i2c/lm3560.c +1
-1@@ -368,7 +368,7 @@ static int lm3560_subdev_init(struct lm3560_flash *flash, rval =media_entity_init (&flash->subdev_led[led_no].entity,0 ,NULL ,0 );if (rval <0 ) goto err_out; - flash->subdev_led[led_no].entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + flash->subdev_led[led_no].entity.type =MEDIA_ENT_T_CAM_FLASH ;return rval;drivers/media/i2c/lm3646.c +1
-1@@ -285,7 +285,7 @@ static int lm3646_subdev_init(struct lm3646_flash *flash) rval =media_entity_init (&flash->subdev_led.entity,0 ,NULL ,0 );if (rval <0 ) goto err_out; - flash->subdev_led.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + flash->subdev_led.entity.type =MEDIA_ENT_T_CAM_FLASH ;return rval; err_out:drivers/media/i2c/m5mols/m5mols_core.c +1
-1@@ -978,7 +978,7 @@ static int m5mols_probe(struct i2c_client *client, ret =media_entity_init (&sd->entity,1 , &info->pad,0 );if (ret <0 )return ret; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ;init_waitqueue_head (&info->irq_waitq);mutex_init (&info->lock);drivers/media/i2c/noon010pc30.c +1
-1@@ -779,7 +779,7 @@ static int noon010_probe(struct i2c_client *client, goto np_err; info->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &info->pad,0 );if (ret <0 ) goto np_err;drivers/media/i2c/ov2659.c +1
-1@@ -1425,7 +1425,7 @@ static int ov2659_probe(struct i2c_client *client,#if defined(CONFIG_MEDIA_CONTROLLER ) ov2659->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &ov2659->pad,0 );if (ret <0 ) {v4l2_ctrl_handler_free (&ov2659->ctrls);drivers/media/i2c/ov9650.c +1
-1@@ -1500,7 +1500,7 @@ static int ov965x_probe(struct i2c_client *client,return ret; ov965x->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &ov965x->pad,0 );if (ret <0 )return ret;drivers/media/i2c/s5k4ecgx.c +1
-1@@ -961,7 +961,7 @@ static int s5k4ecgx_probe(struct i2c_client *client, sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; priv->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &priv->pad,0 );if (ret)return ret;drivers/media/i2c/s5k5baf.c +2
-2@@ -408,7 +408,7 @@ static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl)static inline bool s5k5baf_is_cis_subdev (struct v4l2_subdev *sd) { -return sd->entity.type ==MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; +return sd->entity.type ==MEDIA_ENT_T_CAM_SENSOR ; }static inline struct s5k5baf *to_s5k5baf (struct v4l2_subdev *sd)@@ -1904,7 +1904,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state, sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; state->cis_pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,NUM_CIS_PADS , &state->cis_pad,0 );if (ret <0 ) goto err;drivers/media/i2c/s5k6aa.c +1
-1@@ -1577,7 +1577,7 @@ static int s5k6aa_probe(struct i2c_client *client, sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; s5k6aa->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &s5k6aa->pad,0 );if (ret)return ret;drivers/media/i2c/smiapp/smiapp-core.c +1
-1@@ -2763,7 +2763,7 @@ static int smiapp_init(struct smiapp_sensor *sensor)dev_dbg (&client->dev,"profile %d\n" , sensor->minfo.smiapp_profile); - sensor->pixel_array->sd.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sensor->pixel_array->sd.entity.type =MEDIA_ENT_T_CAM_SENSOR ;/* final steps */ smiapp_read_frame_fmt (sensor);include/uapi/linux/media.h +8
-6@@ -51,13 +51,13 @@ struct media_device_info {#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_AV_DMA + 6)#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_AV_DMA + 7) -#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ((2 << 16) + 1) -#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 1) -#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 2) +#define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1) +#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1) +#define MEDIA_ENT_T_CAM_LENS (MEDIA_ENT_T_CAM_SENSOR + 2)/* A converter of analogue video to its digital representation. */ -#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 3) +#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3) -#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 4) +#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)#if 1 /* @@ -76,8 +76,10 @@ struct media_device_info {#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) -#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_T_CAM_SENSOR +#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_T_CAM_FLASH +#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS#endif /* Used bitmasks for media_entity_desc::flags */
Re: [PATCH 04/18] media controller: Rename camera entities
Em Fri, 08 May 2015 14:03:01 +0200
Hans Verkuil <[email protected]> escreveu:
Quoted 14 lines · Mauro Carvalho Chehab
Quoted 1 line
As explained before, the hole idea of subtypes at entities was
hole -> whole
Quoted 9 lines
not nice. All V4L2 subdevs may have a device node associated.
Also, the hole idea is to expose hardware IP blocks, so calling them as V4L2 is a very bad practice, as they were not designed for the V4L2 API. It is just the reverse.
So, instead of using
V4L2_SUBDEV, let's call the camera sub- devices with CAM, instead:
Quoted 8 lines
Quoted 3 lines
MEDIA_ENT_T_V4L2_SUBDEV_SENSOR -> MEDIA_ENT_T_CAM_SENSOR MEDIA_ENT_T_V4L2_SUBDEV_FLASH -> MEDIA_ENT_T_CAM_FLASH MEDIA_ENT_T_V4L2_SUBDEV_LENS -> MEDIA_ENT_T_CAM_LENSI would actually postpone this until Laurent has a properties API ready. These entity types are fatally flawed since an entity can combine functions in one. E.g. an i2c device (generally represented as a single entity) might provide for both sensor and flash. Or combine tuner and video decoder, etc.
Mapping one I2C address as one entity is plain wrong.
It doesn't matter if a piece of hardware has just one I2C address or multiple ones. There are tuners that have multiple I2C addresses. This is actually common on some RDS tuners: they have one address for control, and another one to transfer data from the tuned station. Still, it is just one tuner.
There are also cases where there's no I2C address at all, but still there are multiple entities.
Just enumerating a few examples of drivers I touched recently:
- au8522 - the same I2C address controls both V4L2 analod demod
and DVB demod;
- as102 - it is just a single chip, with tuner, demod and bridge on it. no I2C buses internally at all.
- cx231xx - It has one internal I2C bus used to control different functions inside the bridge chipset.
etc.
So, if a single piece of hardware has the functions of two entities (sensor and flash), it should be represented as two separate entities.
The I2C bus would matter if we were mapping the control plane of the entities, adding PADs for the control lines. But last time I checked, Laurent was still strongly opposed to that.
Quoted 6 lines
Basically an entity like this is a sub-device (as in the literal meaning of being a part of a larger device) that has one or more functions and may have device node(s) associated with it. That is best expressed as properties.
And you really do have to tell userspace that these entities expose a v4l-subdev device node. Renaming them doesn't make that go away.
Well, we should decide if we want the namespace and the entities representing the hardware or representing the Linux API. V4L2_SUBDEV has nothing to do with hardware. It is just an abstraction that we've created on one of our subsystems.
Quoted 233 lines
Regards,
Hans
Quoted 227 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +3
-3@@ -219,15 +219,15 @@ <entry>Unknown V4L sub-device</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_SENSOR</constant></entry> + <entry><constant>MEDIA_ENT_T_CAM_SENSOR</constant></entry> <entry>Video sensor</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_FLASH</constant></entry> + <entry><constant>MEDIA_ENT_T_CAM_FLASH</constant></entry> <entry>Flash controller</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_LENS</constant></entry> + <entry><constant>MEDIA_ENT_T_CAM_LENS</constant></entry> <entry>Lens controller</entry> </row> <row>drivers/media/i2c/adp1653.c +1
-1@@ -516,7 +516,7 @@ 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 ; + flash->subdev.entity.type =MEDIA_ENT_T_CAM_FLASH ;return 0 ;drivers/media/i2c/as3645a.c +1
-1@@ -831,7 +831,7 @@ static int as3645a_probe(struct i2c_client *client,if (ret <0 ) goto done; - flash->subdev.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + flash->subdev.entity.type =MEDIA_ENT_T_CAM_FLASH ;mutex_init (&flash->power_lock);drivers/media/i2c/lm3560.c +1
-1@@ -368,7 +368,7 @@ static int lm3560_subdev_init(struct lm3560_flash *flash, rval =media_entity_init (&flash->subdev_led[led_no].entity,0 ,NULL ,0 );if (rval <0 ) goto err_out; - flash->subdev_led[led_no].entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + flash->subdev_led[led_no].entity.type =MEDIA_ENT_T_CAM_FLASH ;return rval;drivers/media/i2c/lm3646.c +1
-1@@ -285,7 +285,7 @@ static int lm3646_subdev_init(struct lm3646_flash *flash) rval =media_entity_init (&flash->subdev_led.entity,0 ,NULL ,0 );if (rval <0 ) goto err_out; - flash->subdev_led.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_FLASH ; + flash->subdev_led.entity.type =MEDIA_ENT_T_CAM_FLASH ;return rval; err_out:drivers/media/i2c/m5mols/m5mols_core.c +1
-1@@ -978,7 +978,7 @@ static int m5mols_probe(struct i2c_client *client, ret =media_entity_init (&sd->entity,1 , &info->pad,0 );if (ret <0 )return ret; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ;init_waitqueue_head (&info->irq_waitq);mutex_init (&info->lock);drivers/media/i2c/noon010pc30.c +1
-1@@ -779,7 +779,7 @@ static int noon010_probe(struct i2c_client *client, goto np_err; info->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &info->pad,0 );if (ret <0 ) goto np_err;drivers/media/i2c/ov2659.c +1
-1@@ -1425,7 +1425,7 @@ static int ov2659_probe(struct i2c_client *client,#if defined(CONFIG_MEDIA_CONTROLLER ) ov2659->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &ov2659->pad,0 );if (ret <0 ) {v4l2_ctrl_handler_free (&ov2659->ctrls);drivers/media/i2c/ov9650.c +1
-1@@ -1500,7 +1500,7 @@ static int ov965x_probe(struct i2c_client *client,return ret; ov965x->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &ov965x->pad,0 );if (ret <0 )return ret;drivers/media/i2c/s5k4ecgx.c +1
-1@@ -961,7 +961,7 @@ static int s5k4ecgx_probe(struct i2c_client *client, sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; priv->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &priv->pad,0 );if (ret)return ret;drivers/media/i2c/s5k5baf.c +2
-2@@ -408,7 +408,7 @@ static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl)static inline bool s5k5baf_is_cis_subdev (struct v4l2_subdev *sd) { -return sd->entity.type ==MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; +return sd->entity.type ==MEDIA_ENT_T_CAM_SENSOR ; }static inline struct s5k5baf *to_s5k5baf (struct v4l2_subdev *sd)@@ -1904,7 +1904,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state, sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; state->cis_pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,NUM_CIS_PADS , &state->cis_pad,0 );if (ret <0 ) goto err;drivers/media/i2c/s5k6aa.c +1
-1@@ -1577,7 +1577,7 @@ static int s5k6aa_probe(struct i2c_client *client, sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; s5k6aa->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,1 , &s5k6aa->pad,0 );if (ret)return ret;drivers/media/i2c/smiapp/smiapp-core.c +1
-1@@ -2763,7 +2763,7 @@ static int smiapp_init(struct smiapp_sensor *sensor)dev_dbg (&client->dev,"profile %d\n" , sensor->minfo.smiapp_profile); - sensor->pixel_array->sd.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ; + sensor->pixel_array->sd.entity.type =MEDIA_ENT_T_CAM_SENSOR ;/* final steps */ smiapp_read_frame_fmt (sensor);include/uapi/linux/media.h +8
-6@@ -51,13 +51,13 @@ struct media_device_info {#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_AV_DMA + 6)#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_AV_DMA + 7) -#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR ((2 << 16) + 1) -#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 1) -#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 2) +#define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1) +#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1) +#define MEDIA_ENT_T_CAM_LENS (MEDIA_ENT_T_CAM_SENSOR + 2)/* A converter of analogue video to its digital representation. */ -#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 3) +#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3) -#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + 4) +#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)#if 1 /* @@ -76,8 +76,10 @@ struct media_device_info {#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) -#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_T_CAM_SENSOR +#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_T_CAM_FLASH +#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS#endif /* Used bitmasks for media_entity_desc::flags */
Re: [PATCH 04/18] media controller: Rename camera entities
Quoted 21 lines · Mauro Carvalho Chehab
Em Fri, 08 May 2015 14:03:01 +0200
Hans Verkuil <[email protected]> escreveu:Quoted 18 lines · Mauro Carvalho Chehab
Quoted 1 line
As explained before, the hole idea of subtypes at entities was
hole -> whole
Quoted 12 lines
not nice. All V4L2 subdevs may have a device node associated.
Also, the hole idea is to expose hardware IP blocks, so calling them as V4L2 is a very bad practice, as they were not designed for the V4L2 API. It is just the reverse.
So, instead of using
V4L2_SUBDEV, let's call the camera sub- devices with CAM, instead:MEDIA_ENT_T_V4L2_SUBDEV_SENSOR -> MEDIA_ENT_T_CAM_SENSOR MEDIA_ENT_T_V4L2_SUBDEV_FLASH -> MEDIA_ENT_T_CAM_FLASH MEDIA_ENT_T_V4L2_SUBDEV_LENS -> MEDIA_ENT_T_CAM_LENS
Quoted 6 lines
Quoted 4 lines
I would actually postpone this until Laurent has a properties API ready. These entity types are fatally flawed since an entity can combine functions in one. E.g. an i2c device (generally represented as a single entity) might provide for both sensor and flash. Or combine tuner and video decoder, etc.
Mapping one I2C address as one entity is plain wrong.
I said 'i2c device', not i2c address. That would definitely be wrong. I'm also not saying that each i2c device (chip) maps always to one entity, although this is generally true. In the end it depends on the driver author to decide how to split up the functionality of the device into entities. There is no hard and fast rule for that.
Quoted 2 lines
So, if a single piece of hardware has the functions of two entities (sensor and flash), it should be represented as two separate entities.
Perhaps, perhaps not. There is in the general case no clear rule at what level you design your entities. In a complex pipeline it would be madness to map every little HW block to an entity since you would get a zillion entities, which is highly impractical. The cx25840 combines multiple functions (tuner, audio/video decoders), and I am not at all sure you would gain anything from splitting that up into smaller entities. In the end, if you would write a block diagram of your board the cx25840 would be a single block. And experience has shown that that is typically the right level for deciding what will be an entity or not.
Also, in such devices the various functions are often intertwined and generally not easy to separate.
Quoted 9 lines
The I2C bus would matter if we were mapping the control plane of the entities, adding PADs for the control lines. But last time I checked, Laurent was still strongly opposed to that.
Quoted 4 lines
Basically an entity like this is a sub-device (as in the literal meaning of being a part of a larger device) that has one or more functions and may have device node(s) associated with it. That is best expressed as properties.
Quoted 7 lines
Quoted 2 lines
And you really do have to tell userspace that these entities expose a v4l-subdev device node. Renaming them doesn't make that go away.
Well, we should decide if we want the namespace and the entities representing the hardware or representing the Linux API.
V4L2_SUBDEVhas nothing to do with hardware. It is just an abstraction that we've created on one of our subsystems.
I agree. MEDIA_ENT_T_V4L2_SUBDEV_SENSOR basically contains two bits of
information: the linux API used to access the entity and the function.
Since you don't combine multiple APIs (e.g. ALSA and V4L2) for a single device node (I would certainly never allow such code in the kernel!) there is only one of those, but one entity can certainly combine multiple functions as I argued for above. Hence, those should be properties.
Anyway, let's wait what Laurent thinks and setup an irc session for this.
Regards,
Hans
PATCH 6/18 media controller: rename analog TV decoder
In reply to Mauro Carvalho ChehabTo keep coherency, let's also remove V4L2_SUBDEV from the analog TV decoder, calling it by its function, and not by the V4L2 API mapping.
So,
MEDIA_ENT_T_V4L2_SUBDEV_DECODER -> MEDIA_ENT_T_ATV_DECODER
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +1 -1
@@ -231,7 +231,7 @@ <entry>Lens controller</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_DECODER</constant></entry> + <entry><constant>MEDIA_ENT_T_ATV_DECODER</constant></entry> <entry>Video decoder, the basic function of the video decoder is to accept analogue video from a wide variety of sources such as broadcast, DVD players, cameras and video cassette recorders, in
drivers/media/i2c/adv7180.c +1 -1
@@ -1212,7 +1212,7 @@ static int adv7180_probe(struct i2c_client *client, goto err_unregister_vpp_client; state->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.flags |=MEDIA_ENT_T_V4L2_SUBDEV_DECODER ; + sd->entity.flags |=MEDIA_ENT_T_ATV_DECODER ; ret =media_entity_init (&sd->entity,1 , &state->pad,0 );if (ret) goto err_free_ctrl;
drivers/media/i2c/cx25840/cx25840-core.c +1 -1
@@ -5208,7 +5208,7 @@ static int cx25840_probe(struct i2c_client *client, state->pads[CX25840_PAD_INPUT ].flags =MEDIA_PAD_FL_SINK ; state->pads[CX25840_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; state->pads[CX25840_PAD_VBI_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_DECODER ; + sd->entity.type =MEDIA_ENT_T_ATV_DECODER ; ret =media_entity_init (&sd->entity,ARRAY_SIZE (state->pads), state->pads,0 );
drivers/media/i2c/tvp514x.c +1 -1
@@ -1106,7 +1106,7 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)#if defined(CONFIG_MEDIA_CONTROLLER ) decoder->pad.flags =MEDIA_PAD_FL_SOURCE ; decoder->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; - decoder->sd.entity.flags |=MEDIA_ENT_T_V4L2_SUBDEV_DECODER ; + decoder->sd.entity.flags |=MEDIA_ENT_T_ATV_DECODER ; ret =media_entity_init (&decoder->sd.entity,1 , &decoder->pad,0 );if (ret <0 ) {
drivers/media/i2c/tvp7002.c +1 -1
@@ -1019,7 +1019,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)#if defined(CONFIG_MEDIA_CONTROLLER ) device->pad.flags =MEDIA_PAD_FL_SOURCE ; device->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; - device->sd.entity.flags |=MEDIA_ENT_T_V4L2_SUBDEV_DECODER ; + device->sd.entity.flags |=MEDIA_ENT_T_ATV_DECODER ; error =media_entity_init (&device->sd.entity,1 , &device->pad,0 );if (error <0 )
drivers/media/usb/cx231xx/cx231xx-cards.c +1 -1
@@ -1216,7 +1216,7 @@ static void cx231xx_create_media_graph(struct cx231xx *dev)case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : tuner = entity;break ; -case MEDIA_ENT_T_V4L2_SUBDEV_DECODER : +case MEDIA_ENT_T_ATV_DECODER : decoder = entity;break ; }
drivers/media/usb/cx231xx/cx231xx-video.c +1 -1
@@ -119,7 +119,7 @@ static int cx231xx_enable_analog_tuner(struct cx231xx *dev)* this should be enough for the actual needs. */ media_device_for_each_entity (entity, mdev) { -if (entity->type ==MEDIA_ENT_T_V4L2_SUBDEV_DECODER ) { +if (entity->type ==MEDIA_ENT_T_ATV_DECODER ) { decoder = entity;break ; }
include/uapi/linux/media.h +4 -2
@@ -54,8 +54,8 @@ struct media_device_info {#define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1)#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1)#define MEDIA_ENT_T_CAM_LENS (MEDIA_ENT_T_CAM_SENSOR + 2) -/* A converter of analogue video to its digital representation. */ -#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3) + +#define MEDIA_ENT_T_ATV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3)#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)
@@ -86,6 +86,8 @@ struct media_device_info {#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_T_CAM_SENSOR#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_T_CAM_FLASH#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS + +#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_T_ATV_DECODER#endif /* Used bitmasks for media_entity_desc::flags */
Signature · 1 line
2.1.0
Re: [PATCH 06/18] media controller: rename analog TV decoder
Quoted 3 lines · Mauro Carvalho Chehab
To keep coherency, let's also remove
V4L2_SUBDEVfrom the analog TV decoder, calling it by its function, and not by the V4L2 API mapping.
Same issue as with patch 04/18.
Hans
Quoted 123 lines
So,
MEDIA_ENT_T_V4L2_SUBDEV_DECODER -> MEDIA_ENT_T_ATV_DECODERSigned-off-by Mauro Carvalho Chehab <[email protected]>Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +1
-1@@ -231,7 +231,7 @@ <entry>Lens controller</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_DECODER</constant></entry> + <entry><constant>MEDIA_ENT_T_ATV_DECODER</constant></entry> <entry>Video decoder, the basic function of the video decoder is to accept analogue video from a wide variety of sources such as broadcast, DVD players, cameras and video cassette recorders, indrivers/media/i2c/adv7180.c +1
-1@@ -1212,7 +1212,7 @@ static int adv7180_probe(struct i2c_client *client, goto err_unregister_vpp_client; state->pad.flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.flags |=MEDIA_ENT_T_V4L2_SUBDEV_DECODER ; + sd->entity.flags |=MEDIA_ENT_T_ATV_DECODER ; ret =media_entity_init (&sd->entity,1 , &state->pad,0 );if (ret) goto err_free_ctrl;drivers/media/i2c/cx25840/cx25840-core.c +1
-1@@ -5208,7 +5208,7 @@ static int cx25840_probe(struct i2c_client *client, state->pads[CX25840_PAD_INPUT ].flags =MEDIA_PAD_FL_SINK ; state->pads[CX25840_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; state->pads[CX25840_PAD_VBI_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV_DECODER ; + sd->entity.type =MEDIA_ENT_T_ATV_DECODER ; ret =media_entity_init (&sd->entity,ARRAY_SIZE (state->pads), state->pads,0 );drivers/media/i2c/tvp514x.c +1
-1@@ -1106,7 +1106,7 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)#if defined(CONFIG_MEDIA_CONTROLLER ) decoder->pad.flags =MEDIA_PAD_FL_SOURCE ; decoder->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; - decoder->sd.entity.flags |=MEDIA_ENT_T_V4L2_SUBDEV_DECODER ; + decoder->sd.entity.flags |=MEDIA_ENT_T_ATV_DECODER ; ret =media_entity_init (&decoder->sd.entity,1 , &decoder->pad,0 );if (ret <0 ) {drivers/media/i2c/tvp7002.c +1
-1@@ -1019,7 +1019,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)#if defined(CONFIG_MEDIA_CONTROLLER ) device->pad.flags =MEDIA_PAD_FL_SOURCE ; device->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; - device->sd.entity.flags |=MEDIA_ENT_T_V4L2_SUBDEV_DECODER ; + device->sd.entity.flags |=MEDIA_ENT_T_ATV_DECODER ; error =media_entity_init (&device->sd.entity,1 , &device->pad,0 );if (error <0 )drivers/media/usb/cx231xx/cx231xx-cards.c +1
-1@@ -1216,7 +1216,7 @@ static void cx231xx_create_media_graph(struct cx231xx *dev)case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : tuner = entity;break ; -case MEDIA_ENT_T_V4L2_SUBDEV_DECODER : +case MEDIA_ENT_T_ATV_DECODER : decoder = entity;break ; }drivers/media/usb/cx231xx/cx231xx-video.c +1
-1@@ -119,7 +119,7 @@ static int cx231xx_enable_analog_tuner(struct cx231xx *dev)* this should be enough for the actual needs. */ media_device_for_each_entity (entity, mdev) { -if (entity->type ==MEDIA_ENT_T_V4L2_SUBDEV_DECODER ) { +if (entity->type ==MEDIA_ENT_T_ATV_DECODER ) { decoder = entity;break ; }include/uapi/linux/media.h +4
-2@@ -54,8 +54,8 @@ struct media_device_info {#define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1)#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1)#define MEDIA_ENT_T_CAM_LENS (MEDIA_ENT_T_CAM_SENSOR + 2) -/* A converter of analogue video to its digital representation. */ -#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3) + +#define MEDIA_ENT_T_ATV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3)#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)@@ -86,6 +86,8 @@ struct media_device_info {#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_T_CAM_SENSOR#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_T_CAM_FLASH#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS + +#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_T_ATV_DECODER#endif /* Used bitmasks for media_entity_desc::flags */
PATCH 7/18 media controller: rename the tuner entity
In reply to Mauro Carvalho ChehabFinally, let's rename the tuner entity. inside the media subsystem, a tuner can be used by AM/FM radio, SDR radio, analog TV and digital TV. It could even be used on other subsystems, like network, for wireless devices.
So, it is not constricted to V4L2 API, or to a subdev.
Let's then rename it as:
MEDIA_ENT_T_V4L2_SUBDEV_TUNER -> MEDIA_ENT_T_TUNER
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +1 -1
@@ -241,7 +241,7 @@ signals.</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_TUNER</constant></entry> + <entry><constant>MEDIA_ENT_T_TUNER</constant></entry> <entry>TV and/or radio tuner</entry> </row> </tbody>
drivers/media/dvb-core/dvbdev.c +1 -1
@@ -393,7 +393,7 @@ void dvb_create_media_graph(struct dvb_adapter *adap)media_device_for_each_entity (entity, mdev) {switch (entity->type) { -case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : +case MEDIA_ENT_T_TUNER : tuner = entity;break ;case MEDIA_ENT_T_DTV_DEMOD :
drivers/media/usb/cx231xx/cx231xx-cards.c +1 -1
@@ -1213,7 +1213,7 @@ static void cx231xx_create_media_graph(struct cx231xx *dev)media_device_for_each_entity (entity, mdev) {switch (entity->type) { -case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : +case MEDIA_ENT_T_TUNER : tuner = entity;break ;case MEDIA_ENT_T_ATV_DECODER :
drivers/media/v4l2-core/tuner-core.c +1 -1
@@ -696,7 +696,7 @@ static int tuner_probe(struct i2c_client *client, register_client:#if defined(CONFIG_MEDIA_CONTROLLER ) t->pad.flags =MEDIA_PAD_FL_SOURCE ; - t->sd.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_TUNER ; + t->sd.entity.type =MEDIA_ENT_T_TUNER ; t->sd.entity.name = t->name; ret =media_entity_init (&t->sd.entity,1 , &t->pad,0 );
include/uapi/linux/media.h +3 -1
@@ -57,7 +57,7 @@ struct media_device_info {#define MEDIA_ENT_T_ATV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3) -#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4) +#define MEDIA_ENT_T_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)#if 1 /*
@@ -88,6 +88,8 @@ struct media_device_info {#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_T_ATV_DECODER + +#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_T_TUNER#endif /* Used bitmasks for media_entity_desc::flags */
Signature · 1 line
2.1.0
Re: [PATCH 07/18] media controller: rename the tuner entity
Quoted 9 lines · Mauro Carvalho Chehab
Finally, let's rename the tuner entity. inside the media subsystem, a tuner can be used by AM/FM radio, SDR radio, analog TV and digital TV. It could even be used on other subsystems, like network, for wireless devices.
So, it is not constricted to V4L2 API, or to a subdev.
Let's then rename it as:
MEDIA_ENT_T_V4L2_SUBDEV_TUNER -> MEDIA_ENT_T_TUNER
See patch 04/18.
Hans
Quoted 78 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +1
-1@@ -241,7 +241,7 @@ signals.</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_TUNER</constant></entry> + <entry><constant>MEDIA_ENT_T_TUNER</constant></entry> <entry>TV and/or radio tuner</entry> </row> </tbody>drivers/media/dvb-core/dvbdev.c +1
-1@@ -393,7 +393,7 @@ void dvb_create_media_graph(struct dvb_adapter *adap)media_device_for_each_entity (entity, mdev) {switch (entity->type) { -case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : +case MEDIA_ENT_T_TUNER : tuner = entity;break ;case MEDIA_ENT_T_DTV_DEMOD :drivers/media/usb/cx231xx/cx231xx-cards.c +1
-1@@ -1213,7 +1213,7 @@ static void cx231xx_create_media_graph(struct cx231xx *dev)media_device_for_each_entity (entity, mdev) {switch (entity->type) { -case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : +case MEDIA_ENT_T_TUNER : tuner = entity;break ;case MEDIA_ENT_T_ATV_DECODER :drivers/media/v4l2-core/tuner-core.c +1
-1@@ -696,7 +696,7 @@ static int tuner_probe(struct i2c_client *client, register_client:#if defined(CONFIG_MEDIA_CONTROLLER ) t->pad.flags =MEDIA_PAD_FL_SOURCE ; - t->sd.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_TUNER ; + t->sd.entity.type =MEDIA_ENT_T_TUNER ; t->sd.entity.name = t->name; ret =media_entity_init (&t->sd.entity,1 , &t->pad,0 );include/uapi/linux/media.h +3
-1@@ -57,7 +57,7 @@ struct media_device_info {#define MEDIA_ENT_T_ATV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3) -#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4) +#define MEDIA_ENT_T_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)#if 1 /* @@ -88,6 +88,8 @@ struct media_device_info {#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_T_ATV_DECODER + +#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_T_TUNER#endif /* Used bitmasks for media_entity_desc::flags */
Re: [PATCH 07/18] media controller: rename the tuner entity
Em Fri, 08 May 2015 14:13:22 +0200
Hans Verkuil <[email protected]> escreveu:
Quoted 6 lines · Mauro Carvalho Chehab
Quoted 5 lines
Finally, let's rename the tuner entity. inside the media subsystem, a tuner can be used by AM/FM radio, SDR radio, analog TV and digital TV. It could even be used on other subsystems, like network, for wireless devices.
Quoted 6 lines
Quoted 4 lines
So, it is not constricted to V4L2 API, or to a subdev.
Let's then rename it as:
MEDIA_ENT_T_V4L2_SUBDEV_TUNER -> MEDIA_ENT_T_TUNERSee patch 04/18.
Mapping the tuner as a V4L2_SUBDEV is plain wrong. We can't assume that a tuner will always be mapped via V4L2 subdev API.
Quoted 82 lines
Hans
Quoted 78 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +1
-1@@ -241,7 +241,7 @@ signals.</entry> </row> <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_TUNER</constant></entry> + <entry><constant>MEDIA_ENT_T_TUNER</constant></entry> <entry>TV and/or radio tuner</entry> </row> </tbody>drivers/media/dvb-core/dvbdev.c +1
-1@@ -393,7 +393,7 @@ void dvb_create_media_graph(struct dvb_adapter *adap)media_device_for_each_entity (entity, mdev) {switch (entity->type) { -case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : +case MEDIA_ENT_T_TUNER : tuner = entity;break ;case MEDIA_ENT_T_DTV_DEMOD :drivers/media/usb/cx231xx/cx231xx-cards.c +1
-1@@ -1213,7 +1213,7 @@ static void cx231xx_create_media_graph(struct cx231xx *dev)media_device_for_each_entity (entity, mdev) {switch (entity->type) { -case MEDIA_ENT_T_V4L2_SUBDEV_TUNER : +case MEDIA_ENT_T_TUNER : tuner = entity;break ;case MEDIA_ENT_T_ATV_DECODER :drivers/media/v4l2-core/tuner-core.c +1
-1@@ -696,7 +696,7 @@ static int tuner_probe(struct i2c_client *client, register_client:#if defined(CONFIG_MEDIA_CONTROLLER ) t->pad.flags =MEDIA_PAD_FL_SOURCE ; - t->sd.entity.type =MEDIA_ENT_T_V4L2_SUBDEV_TUNER ; + t->sd.entity.type =MEDIA_ENT_T_TUNER ; t->sd.entity.name = t->name; ret =media_entity_init (&t->sd.entity,1 , &t->pad,0 );include/uapi/linux/media.h +3
-1@@ -57,7 +57,7 @@ struct media_device_info {#define MEDIA_ENT_T_ATV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3) -#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4) +#define MEDIA_ENT_T_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)#if 1 /* @@ -88,6 +88,8 @@ struct media_device_info {#define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_T_CAM_LENS#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_T_ATV_DECODER + +#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_T_TUNER#endif /* Used bitmasks for media_entity_desc::flags */
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 07/18] media controller: rename the tuner entity
Quoted 11 lines · Mauro Carvalho Chehab
Em Fri, 08 May 2015 14:13:22 +0200
Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/[email protected]> escreveu:Quoted 8 lines · Mauro Carvalho Chehab
Quoted 7 lines
Finally, let's rename the tuner entity. inside the media subsystem, a tuner can be used by AM/FM radio, SDR radio, analog TV and digital TV. It could even be used on other subsystems, like network, for wireless devices.
So, it is not constricted to V4L2 API, or to a subdev.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Let's then rename it as:
MEDIA_ENT_T_V4L2_SUBDEV_TUNER -> MEDIA_ENT_T_TUNERSee patch 04/18.
Mapping the tuner as a
V4L2_SUBDEVis plain wrong. We can't assume that a tuner will always be mapped via V4L2 subdev API.
True. Today we have subdevs that have no device node to control them, so in that case it would just be a SUBDEV entity. There are subdevs that make a v4l-subdev device node, so those can be V4L(2)_SUBDEV entities.
The question is: what are your ideas for e.g. DVB-only tuners? Would they get a DVB-like device node? (so DTV_SUBDEV) Would hybrid tuners have two device nodes? One v4l-subdev, one dvb/dtv-subdev?
Just curious what your thoughts are.
Brainstorming:
It might be better to map each device node to an entity and each hardware component (tuner, DMA engine) to an entity, and avoid this mixing of hw entity vs device node entity.
Hmm, we need a another brainstorm meeting...
Regards,
Hans
A message that is not in the archive (sent off-list or not yet received): 554CB863.1040006-qWit8jRvyhVmR6Xm/[email protected]
Re: [PATCH 07/18] media controller: rename the tuner entity
Em Fri, 08 May 2015 15:21:39 +0200
Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/[email protected]> escreveu:
Quoted 20 lines · Mauro Carvalho Chehab
Quoted 11 lines
Em Fri, 08 May 2015 14:13:22 +0200
Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/[email protected]> escreveu:Quoted 8 lines · Mauro Carvalho Chehab
Quoted 7 lines
Finally, let's rename the tuner entity. inside the media subsystem, a tuner can be used by AM/FM radio, SDR radio, analog TV and digital TV. It could even be used on other subsystems, like network, for wireless devices.
So, it is not constricted to V4L2 API, or to a subdev.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Let's then rename it as:
MEDIA_ENT_T_V4L2_SUBDEV_TUNER -> MEDIA_ENT_T_TUNERSee patch 04/18.
Mapping the tuner as a
V4L2_SUBDEVis plain wrong. We can't assume that a tuner will always be mapped via V4L2 subdev API.
Quoted 6 lines
True. Today we have subdevs that have no device node to control them, so in that case it would just be a SUBDEV entity. There are subdevs that make a v4l-subdev device node, so those can be V4L(2)_SUBDEV entities.
The question is: what are your ideas for e.g. DVB-only tuners? Would they get a DVB-like device node? (so
DTV_SUBDEV)
I guess we may need DVB subdevs in the future. For now, I don't see much usage.
Quoted 2 lines
Would hybrid tuners have two
device nodes? One v4l-subdev, one dvb/dtv-subdev?
No. A tuner is a tuner. The very same device can be used for analog or digital TV. Ok, there are tuners that only work for digital TV (satellite tuners, typically), because satellite requires a different tuning range, and require an extra hardware to power up the satellite antena. So, on most devices, the tuner is integrated with SEC.
In any case, I don't see any reason why artificially one piece of hardware component (tuner) into one subdevice entity per API.
What it might make sense in the future is to have some DVB-specific ioctls for a hybrid tuner, in order to allow adjusting its internal filters to an specific digital TV standard.
Quoted 7 lines
Just curious what your thoughts are.
Brainstorming:
It might be better to map each device node to an entity and each hardware component (tuner, DMA engine) to an entity, and avoid this mixing of hw entity vs device node entity.
Ok, but then we need to properly define the namespaces for HW and for Linux API components.
So, we would have a namespace like:
- ENT_T_DEVNODE_DVB_(FE|CA|NET|DEMUX|DVR) for the DVB API device nodes;
- ENT_T_DEVNODE_V4L for the radio/swradio/video/vbi devnodes, or,
alternatively, use ENT_T_DEVNODE_V4L_(RADIO|SWRADIO|VIDEO|VBI);
- ENT_T_HW_(TUNER|CAM_SENSOR|ATV_DEMOD|DTV_DEMOD|...) for the
hardware components.
In other words, the namespace would actually define two subtypes:
- devnodes;
- hardware components
There's one advantage on this strategy: it is easier to keep backward compatibility, IMHO, as we'll be preserving 1 << 16 for device nodes and 2 << 16 for hardware components.
Yet, we'll need to add an entity for the V4L2 hardware DMA (with makes sense to me), and this might break backward compatibility if not done well.
It should be said that, in such case, hardware components will then mean not only V4L2-specific hardware (V4L2_SUBDEV_foo), but also DVB, ALSA, ... components.
So, we'll still need a way to identify what of those components are V4L2 subdevs, probably using the properties API.
If you all agree with that, I'll respin the patch series to map the entities like that.
Regards,
Mauro
Quoted 6 lines
Hmm, we need a another brainstorm meeting...
Regards,
Hans
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 07/18] media controller: rename the tuner entity
Quoted 68 lines · Mauro Carvalho Chehab
Em Fri, 08 May 2015 15:21:39 +0200
Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/[email protected]> escreveu:Quoted 20 lines · Mauro Carvalho Chehab
Quoted 11 lines
Em Fri, 08 May 2015 14:13:22 +0200
Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/[email protected]> escreveu:Quoted 8 lines · Mauro Carvalho Chehab
Quoted 7 lines
Finally, let's rename the tuner entity. inside the media subsystem, a tuner can be used by AM/FM radio, SDR radio, analog TV and digital TV. It could even be used on other subsystems, like network, for wireless devices.
So, it is not constricted to V4L2 API, or to a subdev.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Let's then rename it as:
MEDIA_ENT_T_V4L2_SUBDEV_TUNER -> MEDIA_ENT_T_TUNERSee patch 04/18.
Mapping the tuner as a
V4L2_SUBDEVis plain wrong. We can't assume that a tuner will always be mapped via V4L2 subdev API.Quoted 6 lines
True. Today we have subdevs that have no device node to control them, so in that case it would just be a SUBDEV entity. There are subdevs that make a v4l-subdev device node, so those can be V4L(2)_SUBDEV entities.
The question is: what are your ideas for e.g. DVB-only tuners? Would they get a DVB-like device node? (so
DTV_SUBDEV)I guess we may need DVB subdevs in the future. For now, I don't see much usage.
Quoted 2 lines
Would hybrid tuners have two
device nodes? One v4l-subdev, one dvb/dtv-subdev?No. A tuner is a tuner. The very same device can be used for analog or digital TV. Ok, there are tuners that only work for digital TV (satellite tuners, typically), because satellite requires a different tuning range, and require an extra hardware to power up the satellite antena. So, on most devices, the tuner is integrated with SEC.
In any case, I don't see any reason why artificially one piece of hardware component (tuner) into one subdevice entity per API.
What it might make sense in the future is to have some DVB-specific ioctls for a hybrid tuner, in order to allow adjusting its internal filters to an specific digital TV standard.
Quoted 7 lines
Just curious what your thoughts are.
Brainstorming:
It might be better to map each device node to an entity and each hardware component (tuner, DMA engine) to an entity, and avoid this mixing of hw entity vs device node entity.
Ok, but then we need to properly define the namespaces for HW and for Linux API components.
So, we would have a namespace like:
-
ENT_T_DEVNODE_DVB_(FE|CA|NET|DEMUX|DVR)for the DVB API device nodes;
-ENT_T_DEVNODE_V4Lfor the radio/swradio/video/vbi devnodes, or,
alternatively, useENT_T_DEVNODE_V4L_(RADIO|SWRADIO|VIDEO|VBI);
-ENT_T_HW_(TUNER|CAM_SENSOR|ATV_DEMOD|DTV_DEMOD|...)for the
hardware components.
Quoted 6 lines
In other words, the namespace would actually define two subtypes:
- devnodes;
- hardware componentsThere's one advantage on this strategy: it is easier to keep backward compatibility, IMHO, as we'll be preserving 1 << 16 for device nodes
Right, that will work.
Quoted 1 line
and 2 << 16 for hardware components.
This remains problematic since I believe this should be done as a list of properties. Instead the entity type would be ENT_T_HW (if it represents actual hardware), ENT_T_SW (if it is a software implementation, for example for the DVB demux if there is no HW demux), and perhaps ENT_T_IP for representing IP blocks (not sure about this one).
And the properties will tell what functions it supports.
The existing 2 << 16 defines would only be used if the property list matches the original meaning of the define to keep it backwards compatible.
Quoted 4 lines
Yet, we'll need to add an entity for the V4L2 hardware DMA (with makes sense to me), and this might break backward compatibility if not done well.
I see this as a property as well, but otherwise I agree with this.
Quoted 7 lines
It should be said that, in such case, hardware components will then mean not only V4L2-specific hardware (
V4L2_SUBDEV_foo), but also DVB, ALSA, ... components.So, we'll still need a way to identify what of those components are V4L2 subdevs, probably using the properties API.
Why? A hardware component that can be controlled via a v4l-subdev node would be linked to an entity for that v4l-subdev node. That's an API entity. The whole 'is this a v4l-subdev' question disappears, since that is now no longer relevant. Instead you will have an ENT_T_DEVNODE_V4L_SUBDEV entity linked to the hw entity.
Even a radio device would fit cleanly into this: the tuner entity simply has a link to a radio device node entity.
Hmm, does this also solve the control vs DMA issue? If a DEVNODE entity is hooked up to an entity with the DMA functionality, then you can stream, otherwise it is just for control.
I'm not sure if this is always true, though. Of course, we can also just add the streaming/dma property to the DEVNODE entity as well.
Quoted 2 lines
If you all agree with that, I'll respin the patch series to map the entities like that.
We can interpret the existing ENT_T_HW_TUNER etc. as shorthand for a property while the property API isn't there yet (we need that anyway for backwards compat).
So we would need to add a ENT_T_HW_DMA as well (to be replaced by a property later).
Basically I see the 1 << 16 range as device node types, the 2 << 16 range as shorthands for what should be properties (this really defined functions and entities can combine multiple functions), and we would need to have a new range (4 << 16) for non-DEVNODE entity types. Although we could keep it in range 1 << 16 as well, but I think it might make sense to keep it separate.
And there you would get ENT_T_HW/SW/IP (not sure about the last one). And perhaps FPGA.
Again, just brainstorming here.
Regards,
Hans
Re: [PATCH 07/18] media controller: rename the tuner entity
Em Fri, 08 May 2015 16:32:03 +0200
Hans Verkuil <[email protected]> escreveu:
Quoted 78 lines · Mauro Carvalho Chehab
Quoted 68 lines
Em Fri, 08 May 2015 15:21:39 +0200
Hans Verkuil <[email protected]> escreveu:Quoted 20 lines · Mauro Carvalho Chehab
Quoted 11 lines
Em Fri, 08 May 2015 14:13:22 +0200
Hans Verkuil <[email protected]> escreveu:Quoted 8 lines · Mauro Carvalho Chehab
Quoted 7 lines
Finally, let's rename the tuner entity. inside the media subsystem, a tuner can be used by AM/FM radio, SDR radio, analog TV and digital TV. It could even be used on other subsystems, like network, for wireless devices.
So, it is not constricted to V4L2 API, or to a subdev.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Let's then rename it as:
MEDIA_ENT_T_V4L2_SUBDEV_TUNER -> MEDIA_ENT_T_TUNERSee patch 04/18.
Mapping the tuner as a
V4L2_SUBDEVis plain wrong. We can't assume that a tuner will always be mapped via V4L2 subdev API.Quoted 6 lines
True. Today we have subdevs that have no device node to control them, so in that case it would just be a SUBDEV entity. There are subdevs that make a v4l-subdev device node, so those can be V4L(2)_SUBDEV entities.
The question is: what are your ideas for e.g. DVB-only tuners? Would they get a DVB-like device node? (so
DTV_SUBDEV)I guess we may need DVB subdevs in the future. For now, I don't see much usage.
Quoted 2 lines
Would hybrid tuners have two
device nodes? One v4l-subdev, one dvb/dtv-subdev?No. A tuner is a tuner. The very same device can be used for analog or digital TV. Ok, there are tuners that only work for digital TV (satellite tuners, typically), because satellite requires a different tuning range, and require an extra hardware to power up the satellite antena. So, on most devices, the tuner is integrated with SEC.
In any case, I don't see any reason why artificially one piece of hardware component (tuner) into one subdevice entity per API.
What it might make sense in the future is to have some DVB-specific ioctls for a hybrid tuner, in order to allow adjusting its internal filters to an specific digital TV standard.
Quoted 7 lines
Just curious what your thoughts are.
Brainstorming:
It might be better to map each device node to an entity and each hardware component (tuner, DMA engine) to an entity, and avoid this mixing of hw entity vs device node entity.
Ok, but then we need to properly define the namespaces for HW and for Linux API components.
So, we would have a namespace like:
-
ENT_T_DEVNODE_DVB_(FE|CA|NET|DEMUX|DVR)for the DVB API device nodes;
-ENT_T_DEVNODE_V4Lfor the radio/swradio/video/vbi devnodes, or,
alternatively, useENT_T_DEVNODE_V4L_(RADIO|SWRADIO|VIDEO|VBI);
-ENT_T_HW_(TUNER|CAM_SENSOR|ATV_DEMOD|DTV_DEMOD|...)for the
hardware components.Quoted 6 lines
In other words, the namespace would actually define two subtypes:
- devnodes;
- hardware componentsThere's one advantage on this strategy: it is easier to keep backward compatibility, IMHO, as we'll be preserving 1 << 16 for device nodes
Right, that will work.
Quoted 7 lines
Quoted 1 line
and 2 << 16 for hardware components.
This remains problematic since I believe this should be done as a list of properties. Instead the entity type would be
ENT_T_HW(if it represents actual hardware),ENT_T_SW(if it is a software implementation, for example for the DVB demux if there is no HW demux), and perhapsENT_T_IPfor representing IP blocks (not sure about this one).
I don't think we should distinguish IP block from HW. I would also use a different namespace for SW implementation like the DVB demux or for API devnodes.
Perhaps:
ENT_T_API - for non-subdev API device nodes; ENT_T_HW - for hardware/firmware/IP blocks; ENT_T_SW - for software emulation blocks like DVB demux
I would not map subdev API as a separate entity, as those should have a 1:1 map to the entity. So, a property (or a flag) should be enough to indicate that either a ENT_T_HW_ or a ENT_T_SW_ is exposed via a subdev.
With regards to the API mapping, I would have a set of properties that would be grouping V4L2, subdev, DVB, ... parts of the API.
So, for example, if the entity that represents a video devnode controls the tuner, the analog demod and the DMA engine, such entity would have 3 properties:
- ENT_PROP_V4L2_TUNER
- ENT_PROP_V4L2_ATV_DEMOD
- ENT_PROP_V4L2_DMA
Quoted 1 line
And the properties will tell what functions it supports.
Yes, but, as the API right now groups the subtypes, it would be better to keep it splitted, not for userspace to use this as subtype. Just as a matter of keeping things well organized.
I mean, if you take a look at the resulting namespace after all those patches I wrote, the end result is:
#define MEDIA_ENT_T_UNKNOWN 0
#define MEDIA_ENT_T_AV_DMA (((1 << 16)) + 1)
#define MEDIA_ENT_T_DTV_DEMOD (MEDIA_ENT_T_AV_DMA + 3)
#define MEDIA_ENT_T_DTV_DEMUX (MEDIA_ENT_T_AV_DMA + 4)
#define MEDIA_ENT_T_DTV_DVR (MEDIA_ENT_T_AV_DMA + 5)
#define MEDIA_ENT_T_DTV_CA (MEDIA_ENT_T_AV_DMA + 6)
#define MEDIA_ENT_T_DTV_NET (MEDIA_ENT_T_AV_DMA + 7)
#define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1)
#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1)
#define MEDIA_ENT_T_CAM_LENS (MEDIA_ENT_T_CAM_SENSOR + 2)
#define MEDIA_ENT_T_ATV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3)
#define MEDIA_ENT_T_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)
We cannot renumber them, or otherwise things will break. So, we'll have to deal with at least 2 number spaces: 1 << 16 and 2 << 16.
If we use the 1<<16 number space for ENT_T_API and the 2<<16 for ENT_T_HW, the above will keep fitting, and it will be easier to maintain, as we'll be grouping by name.
Quoted 9 lines
The existing 2 << 16 defines would only be used if the property list matches the original meaning of the define to keep it backwards compatible.
Quoted 4 lines
Yet, we'll need to add an entity for the V4L2 hardware DMA (with makes sense to me), and this might break backward compatibility if not done well.
I see this as a property as well, but otherwise I agree with this.
Yes, this could be a property.
Quoted 5 lines
Quoted 5 lines
It should be said that, in such case, hardware components will then mean not only V4L2-specific hardware (
V4L2_SUBDEV_foo), but also DVB, ALSA, ... components.
Quoted 8 lines
Quoted 2 lines
So, we'll still need a way to identify what of those components are V4L2 subdevs, probably using the properties API.
Why? A hardware component that can be controlled via a v4l-subdev node would be linked to an entity for that v4l-subdev node. That's an API entity. The whole 'is this a v4l-subdev' question disappears, since that is now no longer relevant. Instead you will have an
ENT_T_DEVNODE_V4L_SUBDEVentity linked to the hw entity.
I see V4L_SUBDEV as a set of properties, specifying exactly what group of subdev ioctls controls an specific hardware entity.
Quoted 2 lines
Even a radio device would fit cleanly into this: the tuner entity simply has a link to a radio device node entity.
Yes.
Quoted 3 lines
Hmm, does this also solve the control vs DMA issue? If a DEVNODE entity is hooked up to an entity with the DMA functionality, then you can stream, otherwise it is just for control.
Probably yes.
Quoted 9 lines
I'm not sure if this is always true, though. Of course, we can also just add the streaming/dma property to the DEVNODE entity as well.
Quoted 2 lines
If you all agree with that, I'll respin the patch series to map the entities like that.
We can interpret the existing
ENT_T_HW_TUNERetc. as shorthand for a property while the property API isn't there yet (we need that anyway for backwards compat).
I do prefer using a switch() like I did on patch 10/18, specifying the entities that belong to subdev. After we add the property API, we can convert is_media_entity_v4l2_subdev and is_media_entity_av_dma (with should likely be renamed to is_media_entity_v4l_dma) to use the properties API.
I don't think we'll need to create a separate number space for the new entities in order to be backward-compatible.
Quoted 3 lines
So we would need to add a
ENT_T_HW_DMAas well (to be replaced by a property later).
Let's add this directly when we add the Property API.
Quoted 6 lines
Basically I see the 1 << 16 range as device node types, the 2 << 16 range as shorthands for what should be properties (this really defined functions and entities can combine multiple functions), and we would need to have a new range (4 << 16) for non-DEVNODE entity types. Although we could keep it in range 1 << 16 as well, but I think it might make sense to keep it separate.
Keeping a backward-compatible separate range would create messy graphs. I don't think we should do it.
Quoted 9 lines
And there you would get ENT_T_HW/SW/IP (not sure about the last one). And perhaps FPGA.
Again, just brainstorming here.
Regards,
Hans
Re: [PATCH 07/18] media controller: rename the tuner entity
In reply to Hans VerkuilQuoted 5 lines
Quoted 5 lines
Quoted 5 lines
Brainstorming:
It might be better to map each device node to an entity and each hardware component (tuner, DMA engine) to an entity, and avoid this mixing of hw entity vs device node entity.
There are two options here:
either make each device node an entity, or expose the device node information as properties of an entity.
The latter would be backwards compatible with what we do today. I'm trying to think of reasons why you would want to make each device node an entity in its own right.
The problem today is that a video_device representing a video/vbi/radio/swradio device node is an entity, but it is really representing the dma engine. Which is weird for radio devices since there is no dma engine there.
Implementing device nodes as entities in their own right does solve this problem, but implementing it as properties would be weird since a radio device node would be a property of a radio tuner entity, which can be a subdevice driver which means that the bridge driver would have to add the radio device property to a subdev driver, which feels really wrong to me.
With this in mind I do think representing device nodes as entities in their own right makes sense. But I would do this also for a v4l-subdev node. It's very inconsistent not to do that.
Regards,
Hans
Re: [PATCH 07/18] media controller: rename the tuner entity
Em Sat, 09 May 2015 11:31:42 +0200
Hans Verkuil <[email protected]> escreveu:
Quoted 19 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Brainstorming:
It might be better to map each device node to an entity and each hardware component (tuner, DMA engine) to an entity, and avoid this mixing of hw entity vs device node entity.
There are two options here:
either make each device node an entity, or expose the device node information as properties of an entity.
The latter would be backwards compatible with what we do today. I'm trying to think of reasons why you would want to make each device node an entity in its own right.
The problem today is that a
video_devicerepresenting a video/vbi/radio/swradio device node is an entity, but it is really representing the dma engine. Which is weird for radio devices since there is no dma engine there.
Quoted 8 lines
Implementing device nodes as entities in their own right does solve this problem, but implementing it as properties would be weird since a radio device node would be a property of a radio tuner entity, which can be a subdevice driver which means that the bridge driver would have to add the radio device property to a subdev driver, which feels really wrong to me.
With this in mind I do think representing device nodes as entities in their own right makes sense.
I agree with that: devnodes should be entities, as they're the points to control the hardware, and need to be known by the Kernel, no matter if they have DMA engines associated with it or not. The better seems to map the DMA engine as a property on those entities.
Quoted 2 lines
But I would do this also for a v4l-subdev node. It's very inconsistent not to do that.
It should be easy to create an entity for each v4l-subdev node. I just don't see much usage on it, and this will almost double the number of entities. Also, in order to keep it backward-compatible, both the subdev devnode and the subdev no-devnode entity should accept the same set of ioctls.
Regards,
Mauro
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 07/18] media controller: rename the tuner entity
Quoted 36 lines · Mauro Carvalho Chehab
Em Sat, 09 May 2015 11:31:42 +0200
Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/[email protected]> escreveu:Quoted 19 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Brainstorming:
It might be better to map each device node to an entity and each hardware component (tuner, DMA engine) to an entity, and avoid this mixing of hw entity vs device node entity.
There are two options here:
either make each device node an entity, or expose the device node information as properties of an entity.
The latter would be backwards compatible with what we do today. I'm trying to think of reasons why you would want to make each device node an entity in its own right.
The problem today is that a
video_devicerepresenting a video/vbi/radio/swradio device node is an entity, but it is really representing the dma engine. Which is weird for radio devices since there is no dma engine there.Quoted 8 lines
Implementing device nodes as entities in their own right does solve this problem, but implementing it as properties would be weird since a radio device node would be a property of a radio tuner entity, which can be a subdevice driver which means that the bridge driver would have to add the radio device property to a subdev driver, which feels really wrong to me.
With this in mind I do think representing device nodes as entities in their own right makes sense.
I agree with that: devnodes should be entities, as they're the points to control the hardware, and need to be known by the Kernel, no matter if they have DMA engines associated with it or not. The better seems to map the DMA engine as a property on those entities.
Quoted 6 lines
Quoted 2 lines
But I would do this also for a v4l-subdev node. It's very inconsistent not to do that.
It should be easy to create an entity for each v4l-subdev node. I just don't see much usage on it, and this will almost double the number of entities.
The memory is already allocated for that since it is part of struct video_device, which v4l-subdev uses. So I don't see this as a problem.
Quoted 3 lines
Also, in order to keep it backward-compatible, both the subdev devnode and the subdev no-devnode entity should accept the same set of ioctls.
The ioctls always go through the video_device, that will not be changed by this.
But I agree that there are other backward-compat issues. Unfortunately I cannot dedicate much time on this at the moment.
Regards,
Hans
PATCH 8/18 media controller: add comments for the entity types
In reply to Mauro Carvalho ChehabBetter document the linux/media.h UAPI header, by adding comments to each entity subtype.
include/uapi/linux/media.h +6 -0
@@ -44,19 +44,25 @@ struct media_device_info {/* Used values for media_entity_desc::type */ +/* Audio/video streaming bridges */ #define MEDIA_ENT_T_AV_DMA (((1 << 16)) + 1) + +/* Digital TV entities */ #define MEDIA_ENT_T_DTV_DEMOD (MEDIA_ENT_T_AV_DMA + 3)#define MEDIA_ENT_T_DTV_DEMUX (MEDIA_ENT_T_AV_DMA + 4)#define MEDIA_ENT_T_DTV_DVR (MEDIA_ENT_T_AV_DMA + 5)#define MEDIA_ENT_T_DTV_CA (MEDIA_ENT_T_AV_DMA + 6)#define MEDIA_ENT_T_DTV_NET (MEDIA_ENT_T_AV_DMA + 7) +/* Camera entities */ #define MEDIA_ENT_T_CAM_SENSOR ((2 << 16) + 1)#define MEDIA_ENT_T_CAM_FLASH (MEDIA_ENT_T_CAM_SENSOR + 1)#define MEDIA_ENT_T_CAM_LENS (MEDIA_ENT_T_CAM_SENSOR + 2) +/* Analog TV entities */ #define MEDIA_ENT_T_ATV_DECODER (MEDIA_ENT_T_CAM_SENSOR + 3) +/* Radio, Analog TV and/or Digital TV tuners */ #define MEDIA_ENT_T_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4)#if 1
Signature · 1 line
2.1.0
PATCH 9/18 media controller: add macros to check if subdev or A/V DMA
In reply to Mauro Carvalho ChehabAs we'll be removing entity subtypes from the Kernel, we need to provide a way for drivers and core to check if a given entity is represented by a V4L2 subdev or if it is an A/V DMA.
include/media/media-entity.h +29 -0
@@ -113,6 +113,35 @@ static inline u32 media_entity_subtype(struct media_entity *entity)return entity->type &MEDIA_ENT_SUBTYPE_MASK ; } +static inline bool is_media_entity_av_dma (struct media_entity *entity) +{ +if (!entity) +return false; + +if (entity->type ==MEDIA_ENT_T_AV_DMA ) +return true; + +return false; +} + +static inline bool is_media_entity_v4l2_subdev (struct media_entity *entity) +{ +if (!entity) +return false; + +switch (entity->type) { +case MEDIA_ENT_T_CAM_SENSOR : +case MEDIA_ENT_T_CAM_FLASH : +case MEDIA_ENT_T_CAM_LENS : +case MEDIA_ENT_T_ATV_DECODER : +case MEDIA_ENT_T_TUNER : +return true; + +default : +return false; + } +} +#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16#define MEDIA_ENTITY_ENUM_MAX_ID 64
Signature · 1 line
2.1.0
PATCH 10/18 media controller: use macros to check for V4L2 subdev entities
In reply to Mauro Carvalho ChehabInstead of relying on media subtype, use the new macros to detect if an entity is a subdev or an A/V DMA entity.
Please note that most drivers assume that there's just AV_DMA or V4L2 subdevs. This is not true anymore, as we've added MC support for DVB, and there are plans to add support for ALSA and FB/DRM too.
Ok, on the current pipelines supported by those drivers, just V4L stuff are there, but, assuming that some day a pipeline that also works with other subsystems will ever added, it is better to add explicit checks for the AV_DMA stuff.
drivers/media/platform/exynos4-is/common.c +1 -2
@@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)while (pad->flags &MEDIA_PAD_FL_SINK ) {/* source pad */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);
drivers/media/platform/exynos4-is/fimc-capture.c +2 -3
@@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc) } } -if (src_pad ==NULL || -media_entity_type (src_pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (src_pad->entity))break ;/* Don't call FIMC subdev operation to avoid nested locking */
@@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity *entity,struct fimc_vid_cap *vc = &fimc->vid_cap;struct v4l2_subdev *sensor; -if (media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return -EINVAL ;if (WARN_ON (fimc ==NULL ))
drivers/media/platform/exynos4-is/fimc-isp-video.c +1 -2
@@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp)/* Retrieve format at the source pad */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);
drivers/media/platform/exynos4-is/fimc-lite.c +4 -6
@@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc) }/* Retrieve format at the source pad */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);
@@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity *entity, {struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct fimc_lite *fimc =v4l2_get_subdevdata (sd); -unsigned int remote_ent_type =media_entity_type (remote->entity);int ret =0 ;if (WARN_ON (fimc ==NULL ))
@@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,switch (local->index) {case FLITE_SD_PAD_SINK : -if (remote_ent_type !=MEDIA_ENT_T_V4L2_SUBDEV ) { +if (!is_media_entity_v4l2_subdev (remote->entity)) { ret = -EINVAL ;break ; }
@@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,case FLITE_SD_PAD_SOURCE_DMA :if (!(flags &MEDIA_LNK_FL_ENABLED ))atomic_set (&fimc->out_path,FIMC_IO_NONE ); -else if (remote_ent_type ==MEDIA_ENT_T_DEVNODE ) +else if (is_media_av_dma (remote->entity))atomic_set (&fimc->out_path,FIMC_IO_DMA );else ret = -EINVAL ;
@@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,case FLITE_SD_PAD_SOURCE_ISP :if (!(flags &MEDIA_LNK_FL_ENABLED ))atomic_set (&fimc->out_path,FIMC_IO_NONE ); -else if (remote_ent_type ==MEDIA_ENT_T_V4L2_SUBDEV ) + else if (is_media_entity_v4l2_subdev(remote->entity)))atomic_set (&fimc->out_path,FIMC_IO_ISP );else ret = -EINVAL ;
drivers/media/platform/exynos4-is/media-dev.c +3 -4
@@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,break ; } -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);
@@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity))continue ; ret =__fimc_md_modify_pipeline (entity, enable);
@@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)media_entity_graph_walk_start (&graph, entity_err);while ((entity_err =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity_err) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity_err))continue ;__fimc_md_modify_pipeline (entity_err, !enable);
drivers/media/platform/omap3isp/isp.c +6 -8
@@ -693,7 +693,7 @@ static int isp_pipeline_pm_use_count(struct media_entity *entity)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_av_dma (entity)) use += entity->use_count; }
@@ -716,7 +716,7 @@ static int isp_pipeline_pm_power_one(struct media_entity *entity, int change)struct v4l2_subdev *subdev;int ret; - subdev =media_entity_type (entity) ==MEDIA_ENT_T_V4L2_SUBDEV + subdev = is_media_entity_v4l2_subdev(entity)) ?media_entity_to_v4l2_subdev (entity) :NULL ;if (entity->use_count ==0 && change >0 && subdev !=NULL ) {
@@ -756,7 +756,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)media_entity_graph_walk_start (&graph, entity);while (!ret && (entity =media_entity_graph_walk_next (&graph))) -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (entity)) ret =isp_pipeline_pm_power_one (entity, change);if (!ret)
@@ -766,7 +766,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)while ((first =media_entity_graph_walk_next (&graph)) && first != entity) -if (media_entity_type (first) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (first))isp_pipeline_pm_power_one (first, -change);return ret;
@@ -899,8 +899,7 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;
@@ -989,8 +988,7 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;
drivers/media/platform/omap3isp/ispvideo.c +3 -4
@@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad) remote =media_entity_remote_pad (&video->pad); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad)
@@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video *video,if (entity == &video->video.entity)continue ; -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity))continue ; __video =to_isp_video (media_entity_to_video_device (entity));
@@ -916,7 +915,7 @@ static int isp_video_check_external_subdevs(struct isp_video *video,return -EINVAL ; } -if (media_entity_type (source) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (source->entity))return 0 ; pipe->external =media_entity_to_v4l2_subdev (source);
drivers/media/platform/s3c-camif/camif-capture.c +1 -1
@@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev *camif)/* Retrieve format at the sensor subdev source pad */ pad =media_entity_remote_pad (&camif->pads[0 ]); -if (!pad ||media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))return -EPIPE ; src_fmt.pad = pad->index;
drivers/media/platform/vsp1/vsp1_video.c +4 -5
@@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad)struct media_pad *remote; remote =media_entity_remote_pad (local); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad)
@@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,return -EPIPE ;/* We've reached a video node, that shouldn't have happened. */ -if (media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))return -EPIPE ; entity =to_vsp1_entity (media_entity_to_v4l2_subdev (pad->entity));
@@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,struct vsp1_rwpf *rwpf;struct vsp1_entity *e; -if (media_entity_type (entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) { +if (is_media_entity_av_dma (entity)) { pipe->num_video++;continue ; }
@@ -680,7 +679,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe, pad =media_entity_remote_pad (&input->pads[RWPF_PAD_SOURCE ]);while (pad) { -if (media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity =to_vsp1_entity (media_entity_to_v4l2_subdev (pad->entity));
drivers/media/platform/xilinx/xilinx-dma.c +2 -4
@@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)struct media_pad *remote; remote =media_entity_remote_pad (local); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad)
@@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline *pipe, bool start)break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;
drivers/media/v4l2-core/v4l2-subdev.c +1 -1
@@ -526,7 +526,7 @@ static int v4l2_subdev_link_validate_get_format(struct media_pad *pad, struct v4l2_subdev_format *fmt) { - if (media_entity_type(pad->entity) == MEDIA_ENT_T_V4L2_SUBDEV) { + if (is_media_entity_v4l2_subdev(pad->entity)) { struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (pad->entity);
drivers/staging/media/davinci_vpfe/vpfe_video.c +3 -3
@@ -151,7 +151,7 @@ static void vpfe_prepare_pipeline(struct vpfe_video_device *video)while ((entity =media_entity_graph_walk_next (&graph))) {if (entity == &video->video_dev.entity)continue ; -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) + if ((!is_media_entity_av_dma(remote->entity))continue ; far_end =to_vpfe_video (media_entity_to_video_device (entity));if (far_end->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT )
@@ -296,7 +296,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) + if !is_media_entity_v4l2_subdev(entity))continue ; subdev =media_entity_to_v4l2_subdev (entity); ret =v4l2_subdev_call (subdev, video, s_stream,1 );
@@ -337,7 +337,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_v4l2_subdev (entity))continue ; subdev =media_entity_to_v4l2_subdev (entity); ret =v4l2_subdev_call (subdev, video, s_stream,0 );
drivers/staging/media/omap4iss/iss.c +6 -8
@@ -396,7 +396,7 @@ static int iss_pipeline_pm_use_count(struct media_entity *entity)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_av_dma (entity)) use += entity->use_count; }
@@ -418,7 +418,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change) {struct v4l2_subdev *subdev; - subdev =media_entity_type (entity) ==MEDIA_ENT_T_V4L2_SUBDEV + subdev = is_media_entity_v4l2_subdev(entity)) ?media_entity_to_v4l2_subdev (entity) :NULL ;if (entity->use_count ==0 && change >0 && subdev !=NULL ) {
@@ -460,7 +460,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)media_entity_graph_walk_start (&graph, entity);while (!ret && (entity =media_entity_graph_walk_next (&graph))) -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (entity)) ret =iss_pipeline_pm_power_one (entity, change);if (!ret)
@@ -470,7 +470,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)while ((first =media_entity_graph_walk_next (&graph)) && first != entity) -if (media_entity_type (first) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (first))iss_pipeline_pm_power_one (first, -change);return ret;
@@ -589,8 +589,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) + if !is_media_entity_v4l2_subdev(pad->entity))break ; entity = pad->entity;
@@ -657,8 +656,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;
drivers/staging/media/omap4iss/iss_video.c +2 -3
@@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32 *pad) remote =media_entity_remote_pad (&video->pad); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) + if ((!is_media_entity_v4l2_subdev(remote->entity))return NULL ;if (pad)
@@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)if (entity == &video->video.entity)continue ; -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity))continue ; far_end =to_iss_video (media_entity_to_video_device (entity));
Signature · 1 line
2.1.0
PATCH 10/18 media controller: use macros to check for V4L2 subdev entities
Quoted 8 lines · Mauro Carvalho Chehab
Instead of relying on media subtype, use the new macros to detect if an entity is a subdev or an A/V DMA entity.
Please note that most drivers assume that there's just
AV_DMAor V4L2 subdevs. This is not true anymore, as we've added MC support for DVB, and there are plans to add support for ALSA and FB/DRM too.
Quoted 4 lines
Ok, on the current pipelines supported by those drivers, just V4L stuff are there, but, assuming that some day a pipeline that also works with other subsystems will ever added, it is better to add explicit checks for the
AV_DMAstuff.
So, a lot of what you try to do really can't be done until we have a properties API. Oddly enough it is not the DVB part that worries me, that makes sense to me. But the V4L2 part has problems.
To summarize my concerns here:
The DVB (or DTV) entity types map cleanly to specific device nodes that applications will use to access the functionality, but AV_DMA is just much too vague. I.e. does it mean this is a V4L2 device? Or an ALSA device? Something else?
Why have a DTV_DEMOD, DTV_DEMUX, etc. but not a MEDIA_ENT_T_V4L2? Such an entity type clearly indicates a V4L2 device node, which is what an application needs to know. Whether this entity has DMA (or streaming) functionality I see as a property of the entity.
I would prefer to see ENT_T_V4L2 and ENT_T_V4L_SUBDEV since this indicates the crucial information of how this entity should be controlled, and use properties to indicate the functions of the entity (and possibly the information required to locate the device nodes, as we discussed in San Jose).
This is consistent with the DTV entities (since each DTV entity has its own device node and API).
Each entity may have lots of functions, depending on the hardware behind it, so properties are ideal for that.
Finally, what to do with e.g. a radio device? Since there is no data flow but it only controls other entities, perhaps we should just list as properties which other entities are controlled it (i.e. the tuner).
I don't think we can make this right without using properties. We could get away with it while it was only V4L2 that used this (although it would have been useful even there), but this is now getting urgent.
Regards,
Hans
Quoted 433 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/platform/exynos4-is/common.c +1
-2@@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)while (pad->flags &MEDIA_PAD_FL_SINK ) {/* source pad */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);drivers/media/platform/exynos4-is/fimc-capture.c +2
-3@@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc) } } -if (src_pad ==NULL || -media_entity_type (src_pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (src_pad->entity))break ;/* Don't call FIMC subdev operation to avoid nested locking */ @@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity *entity,struct fimc_vid_cap *vc = &fimc->vid_cap;struct v4l2_subdev *sensor; -if (media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return -EINVAL ;if (WARN_ON (fimc ==NULL ))drivers/media/platform/exynos4-is/fimc-isp-video.c +1
-2@@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp)/* Retrieve format at the source pad */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);drivers/media/platform/exynos4-is/fimc-lite.c +4
-6@@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc) }/* Retrieve format at the source pad */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);@@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity *entity, {struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct fimc_lite *fimc =v4l2_get_subdevdata (sd); -unsigned int remote_ent_type =media_entity_type (remote->entity);int ret =0 ;if (WARN_ON (fimc ==NULL ))@@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,switch (local->index) {case FLITE_SD_PAD_SINK : -if (remote_ent_type !=MEDIA_ENT_T_V4L2_SUBDEV ) { +if (!is_media_entity_v4l2_subdev (remote->entity)) { ret = -EINVAL ;break ; }@@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,case FLITE_SD_PAD_SOURCE_DMA :if (!(flags &MEDIA_LNK_FL_ENABLED ))atomic_set (&fimc->out_path,FIMC_IO_NONE ); -else if (remote_ent_type ==MEDIA_ENT_T_DEVNODE ) +else if (is_media_av_dma (remote->entity))atomic_set (&fimc->out_path,FIMC_IO_DMA );else ret = -EINVAL ;@@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,case FLITE_SD_PAD_SOURCE_ISP :if (!(flags &MEDIA_LNK_FL_ENABLED ))atomic_set (&fimc->out_path,FIMC_IO_NONE ); -else if (remote_ent_type ==MEDIA_ENT_T_V4L2_SUBDEV ) + else if (is_media_entity_v4l2_subdev(remote->entity)))atomic_set (&fimc->out_path,FIMC_IO_ISP );else ret = -EINVAL ;drivers/media/platform/exynos4-is/media-dev.c +3
-4@@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,break ; } -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);@@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity))continue ; ret =__fimc_md_modify_pipeline (entity, enable);@@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)media_entity_graph_walk_start (&graph, entity_err);while ((entity_err =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity_err) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity_err))continue ;__fimc_md_modify_pipeline (entity_err, !enable);drivers/media/platform/omap3isp/isp.c +6
-8@@ -693,7 +693,7 @@ static int isp_pipeline_pm_use_count(struct media_entity *entity)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_av_dma (entity)) use += entity->use_count; }@@ -716,7 +716,7 @@ static int isp_pipeline_pm_power_one(struct media_entity *entity, int change)struct v4l2_subdev *subdev;int ret; - subdev =media_entity_type (entity) ==MEDIA_ENT_T_V4L2_SUBDEV + subdev = is_media_entity_v4l2_subdev(entity)) ?media_entity_to_v4l2_subdev (entity) :NULL ;if (entity->use_count ==0 && change >0 && subdev !=NULL ) {@@ -756,7 +756,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)media_entity_graph_walk_start (&graph, entity);while (!ret && (entity =media_entity_graph_walk_next (&graph))) -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (entity)) ret =isp_pipeline_pm_power_one (entity, change);if (!ret)@@ -766,7 +766,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)while ((first =media_entity_graph_walk_next (&graph)) && first != entity) -if (media_entity_type (first) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (first))isp_pipeline_pm_power_one (first, -change);return ret;@@ -899,8 +899,7 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;@@ -989,8 +988,7 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;drivers/media/platform/omap3isp/ispvideo.c +3
-4@@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad) remote =media_entity_remote_pad (&video->pad); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad)@@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video *video,if (entity == &video->video.entity)continue ; -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity))continue ; __video =to_isp_video (media_entity_to_video_device (entity));@@ -916,7 +915,7 @@ static int isp_video_check_external_subdevs(struct isp_video *video,return -EINVAL ; } -if (media_entity_type (source) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (source->entity))return 0 ; pipe->external =media_entity_to_v4l2_subdev (source);drivers/media/platform/s3c-camif/camif-capture.c +1
-1@@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev *camif)/* Retrieve format at the sensor subdev source pad */ pad =media_entity_remote_pad (&camif->pads[0 ]); -if (!pad ||media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))return -EPIPE ; src_fmt.pad = pad->index;drivers/media/platform/vsp1/vsp1_video.c +4
-5@@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad)struct media_pad *remote; remote =media_entity_remote_pad (local); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad)@@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,return -EPIPE ;/* We've reached a video node, that shouldn't have happened. */ -if (media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))return -EPIPE ; entity =to_vsp1_entity (media_entity_to_v4l2_subdev (pad->entity));@@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,struct vsp1_rwpf *rwpf;struct vsp1_entity *e; -if (media_entity_type (entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) { +if (is_media_entity_av_dma (entity)) { pipe->num_video++;continue ; }@@ -680,7 +679,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe, pad =media_entity_remote_pad (&input->pads[RWPF_PAD_SOURCE ]);while (pad) { -if (media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity =to_vsp1_entity (media_entity_to_v4l2_subdev (pad->entity));drivers/media/platform/xilinx/xilinx-dma.c +2
-4@@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)struct media_pad *remote; remote =media_entity_remote_pad (local); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad)@@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline *pipe, bool start)break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;drivers/media/v4l2-core/v4l2-subdev.c +1
-1@@ -526,7 +526,7 @@ static int v4l2_subdev_link_validate_get_format(struct media_pad *pad, struct v4l2_subdev_format *fmt) { - if (media_entity_type(pad->entity) == MEDIA_ENT_T_V4L2_SUBDEV) { + if (is_media_entity_v4l2_subdev(pad->entity)) { struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (pad->entity);drivers/staging/media/davinci_vpfe/vpfe_video.c +3
-3@@ -151,7 +151,7 @@ static void vpfe_prepare_pipeline(struct vpfe_video_device *video)while ((entity =media_entity_graph_walk_next (&graph))) {if (entity == &video->video_dev.entity)continue ; -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) + if ((!is_media_entity_av_dma(remote->entity))continue ; far_end =to_vpfe_video (media_entity_to_video_device (entity));if (far_end->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT )@@ -296,7 +296,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) + if !is_media_entity_v4l2_subdev(entity))continue ; subdev =media_entity_to_v4l2_subdev (entity); ret =v4l2_subdev_call (subdev, video, s_stream,1 );@@ -337,7 +337,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_v4l2_subdev (entity))continue ; subdev =media_entity_to_v4l2_subdev (entity); ret =v4l2_subdev_call (subdev, video, s_stream,0 );drivers/staging/media/omap4iss/iss.c +6
-8@@ -396,7 +396,7 @@ static int iss_pipeline_pm_use_count(struct media_entity *entity)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_av_dma (entity)) use += entity->use_count; }@@ -418,7 +418,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change) {struct v4l2_subdev *subdev; - subdev =media_entity_type (entity) ==MEDIA_ENT_T_V4L2_SUBDEV + subdev = is_media_entity_v4l2_subdev(entity)) ?media_entity_to_v4l2_subdev (entity) :NULL ;if (entity->use_count ==0 && change >0 && subdev !=NULL ) {@@ -460,7 +460,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)media_entity_graph_walk_start (&graph, entity);while (!ret && (entity =media_entity_graph_walk_next (&graph))) -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (entity)) ret =iss_pipeline_pm_power_one (entity, change);if (!ret)@@ -470,7 +470,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)while ((first =media_entity_graph_walk_next (&graph)) && first != entity) -if (media_entity_type (first) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (first))iss_pipeline_pm_power_one (first, -change);return ret;@@ -589,8 +589,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) + if !is_media_entity_v4l2_subdev(pad->entity))break ; entity = pad->entity;@@ -657,8 +656,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;drivers/staging/media/omap4iss/iss_video.c +2
-3@@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32 *pad) remote =media_entity_remote_pad (&video->pad); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) + if ((!is_media_entity_v4l2_subdev(remote->entity))return NULL ;if (pad)@@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)if (entity == &video->video.entity)continue ; -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity))continue ; far_end =to_iss_video (media_entity_to_video_device (entity));
PATCH 10/18 media controller: use macros to check for V4L2 subdev entities
Em Fri, 08 May 2015 14:46:19 +0200
Hans Verkuil <[email protected]> escreveu:
Quoted 9 lines · Mauro Carvalho Chehab
Quoted 8 lines
Instead of relying on media subtype, use the new macros to detect if an entity is a subdev or an A/V DMA entity.
Please note that most drivers assume that there's just
AV_DMAor V4L2 subdevs. This is not true anymore, as we've added MC support for DVB, and there are plans to add support for ALSA and FB/DRM too.
Quoted 7 lines
Quoted 4 lines
Ok, on the current pipelines supported by those drivers, just V4L stuff are there, but, assuming that some day a pipeline that also works with other subsystems will ever added, it is better to add explicit checks for the
AV_DMAstuff.So, a lot of what you try to do really can't be done until we have a properties API.
Well, we need to do the changes incrementally. I suspect that the renaming patches is a way easier to discuss/review than a properties API patchset.
So, IMHO, we should focus on fixing the entities namespace first. Once this is done, the internal methods could be changed to take a properties API into account.
So, for example, let's assume that Laurent/Sakari's properties API would have a way to tell if an entity is a v4l2 subdevice.
All such patchset would need to do is to change the implementation of is_media_entity_v4l2_subdev() to take it into account.
In any case, we should not call an entity as V4L2_SUBDEV, as the entity is a piece of the hardware and not a Linux Kernel V4L2 component.
Quoted 8 lines
Oddly enough it is not the DVB part that worries me, that makes sense to me. But the V4L2 part has problems.
To summarize my concerns here:
The DVB (or DTV) entity types map cleanly to specific device nodes that applications will use to access the functionality, but
AV_DMAis just much too vague. I.e. does it mean this is a V4L2 device? Or an ALSA device? Something else?
Any better suggestion for its name?
Quoted 2 lines
Why have a
DTV_DEMOD,DTV_DEMUX, etc. but not aMEDIA_ENT_T_V4L2?
DTV_DEMOD, DTV_DEMUX, etc are hardware components.
What V4L2 exactly means in terms of the hardware? This is currently a big source of mess, as some drivers map this as just the DMA engine, while others map the entire board, as the V4L2 API can control everything at the non-DTV part of the device.
Quoted 4 lines
Such an
entity type clearly indicates a V4L2 device node, which is what an application needs to know. Whether this entity has DMA (or streaming) functionality I see as a property of the entity.
I can actually see two possible conflicting possibilities:
1) map entities as Linux components. Each entity will represent a single devnode. Entities without devnodes won't be represented. The hardware components would be represented as properties.
2) map entities as hardware components (or software implementation of hardware). The Linux API components would be represented as properties.
We should pick one and make the namespace coherent with our choice.
Quoted 12 lines
I would prefer to see
ENT_T_V4L2andENT_T_V4L_SUBDEVsince this indicates the crucial information of how this entity should be controlled, and use properties to indicate the functions of the entity (and possibly the information required to locate the device nodes, as we discussed in San Jose).This is consistent with the DTV entities (since each DTV entity has its own device node and API).
Each entity may have lots of functions, depending on the hardware behind it, so properties are ideal for that.
Quoted 7 lines
Finally, what to do with e.g. a radio device? Since there is no data flow but it only controls other entities, perhaps we should just list as properties which other entities are controlled it (i.e. the tuner).
I don't think we can make this right without using properties. We could get away with it while it was only V4L2 that used this (although it would have been useful even there), but this is now getting urgent.
As I said previously, we should either use properties for hardware and entities for software or the reverse. Not mix both ;)
Quoted 439 lines
Regards,
Hans
Quoted 433 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/platform/exynos4-is/common.c +1
-2@@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)while (pad->flags &MEDIA_PAD_FL_SINK ) {/* source pad */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);drivers/media/platform/exynos4-is/fimc-capture.c +2
-3@@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc) } } -if (src_pad ==NULL || -media_entity_type (src_pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (src_pad->entity))break ;/* Don't call FIMC subdev operation to avoid nested locking */ @@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity *entity,struct fimc_vid_cap *vc = &fimc->vid_cap;struct v4l2_subdev *sensor; -if (media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return -EINVAL ;if (WARN_ON (fimc ==NULL ))drivers/media/platform/exynos4-is/fimc-isp-video.c +1
-2@@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp)/* Retrieve format at the source pad */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);drivers/media/platform/exynos4-is/fimc-lite.c +4
-6@@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc) }/* Retrieve format at the source pad */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);@@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity *entity, {struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct fimc_lite *fimc =v4l2_get_subdevdata (sd); -unsigned int remote_ent_type =media_entity_type (remote->entity);int ret =0 ;if (WARN_ON (fimc ==NULL ))@@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,switch (local->index) {case FLITE_SD_PAD_SINK : -if (remote_ent_type !=MEDIA_ENT_T_V4L2_SUBDEV ) { +if (!is_media_entity_v4l2_subdev (remote->entity)) { ret = -EINVAL ;break ; }@@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,case FLITE_SD_PAD_SOURCE_DMA :if (!(flags &MEDIA_LNK_FL_ENABLED ))atomic_set (&fimc->out_path,FIMC_IO_NONE ); -else if (remote_ent_type ==MEDIA_ENT_T_DEVNODE ) +else if (is_media_av_dma (remote->entity))atomic_set (&fimc->out_path,FIMC_IO_DMA );else ret = -EINVAL ;@@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,case FLITE_SD_PAD_SOURCE_ISP :if (!(flags &MEDIA_LNK_FL_ENABLED ))atomic_set (&fimc->out_path,FIMC_IO_NONE ); -else if (remote_ent_type ==MEDIA_ENT_T_V4L2_SUBDEV ) + else if (is_media_entity_v4l2_subdev(remote->entity)))atomic_set (&fimc->out_path,FIMC_IO_ISP );else ret = -EINVAL ;drivers/media/platform/exynos4-is/media-dev.c +3
-4@@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,break ; } -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; sd =media_entity_to_v4l2_subdev (pad->entity);@@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity))continue ; ret =__fimc_md_modify_pipeline (entity, enable);@@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)media_entity_graph_walk_start (&graph, entity_err);while ((entity_err =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity_err) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity_err))continue ;__fimc_md_modify_pipeline (entity_err, !enable);drivers/media/platform/omap3isp/isp.c +6
-8@@ -693,7 +693,7 @@ static int isp_pipeline_pm_use_count(struct media_entity *entity)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_av_dma (entity)) use += entity->use_count; }@@ -716,7 +716,7 @@ static int isp_pipeline_pm_power_one(struct media_entity *entity, int change)struct v4l2_subdev *subdev;int ret; - subdev =media_entity_type (entity) ==MEDIA_ENT_T_V4L2_SUBDEV + subdev = is_media_entity_v4l2_subdev(entity)) ?media_entity_to_v4l2_subdev (entity) :NULL ;if (entity->use_count ==0 && change >0 && subdev !=NULL ) {@@ -756,7 +756,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)media_entity_graph_walk_start (&graph, entity);while (!ret && (entity =media_entity_graph_walk_next (&graph))) -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (entity)) ret =isp_pipeline_pm_power_one (entity, change);if (!ret)@@ -766,7 +766,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)while ((first =media_entity_graph_walk_next (&graph)) && first != entity) -if (media_entity_type (first) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (first))isp_pipeline_pm_power_one (first, -change);return ret;@@ -899,8 +899,7 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;@@ -989,8 +988,7 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;drivers/media/platform/omap3isp/ispvideo.c +3
-4@@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad) remote =media_entity_remote_pad (&video->pad); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad)@@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video *video,if (entity == &video->video.entity)continue ; -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity))continue ; __video =to_isp_video (media_entity_to_video_device (entity));@@ -916,7 +915,7 @@ static int isp_video_check_external_subdevs(struct isp_video *video,return -EINVAL ; } -if (media_entity_type (source) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (source->entity))return 0 ; pipe->external =media_entity_to_v4l2_subdev (source);drivers/media/platform/s3c-camif/camif-capture.c +1
-1@@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev *camif)/* Retrieve format at the sensor subdev source pad */ pad =media_entity_remote_pad (&camif->pads[0 ]); -if (!pad ||media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))return -EPIPE ; src_fmt.pad = pad->index;drivers/media/platform/vsp1/vsp1_video.c +4
-5@@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad)struct media_pad *remote; remote =media_entity_remote_pad (local); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad)@@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,return -EPIPE ;/* We've reached a video node, that shouldn't have happened. */ -if (media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))return -EPIPE ; entity =to_vsp1_entity (media_entity_to_v4l2_subdev (pad->entity));@@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,struct vsp1_rwpf *rwpf;struct vsp1_entity *e; -if (media_entity_type (entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) { +if (is_media_entity_av_dma (entity)) { pipe->num_video++;continue ; }@@ -680,7 +679,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe, pad =media_entity_remote_pad (&input->pads[RWPF_PAD_SOURCE ]);while (pad) { -if (media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity =to_vsp1_entity (media_entity_to_v4l2_subdev (pad->entity));drivers/media/platform/xilinx/xilinx-dma.c +2
-4@@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)struct media_pad *remote; remote =media_entity_remote_pad (local); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad)@@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline *pipe, bool start)break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;drivers/media/v4l2-core/v4l2-subdev.c +1
-1@@ -526,7 +526,7 @@ static int v4l2_subdev_link_validate_get_format(struct media_pad *pad, struct v4l2_subdev_format *fmt) { - if (media_entity_type(pad->entity) == MEDIA_ENT_T_V4L2_SUBDEV) { + if (is_media_entity_v4l2_subdev(pad->entity)) { struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (pad->entity);drivers/staging/media/davinci_vpfe/vpfe_video.c +3
-3@@ -151,7 +151,7 @@ static void vpfe_prepare_pipeline(struct vpfe_video_device *video)while ((entity =media_entity_graph_walk_next (&graph))) {if (entity == &video->video_dev.entity)continue ; -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) + if ((!is_media_entity_av_dma(remote->entity))continue ; far_end =to_vpfe_video (media_entity_to_video_device (entity));if (far_end->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT )@@ -296,7 +296,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) + if !is_media_entity_v4l2_subdev(entity))continue ; subdev =media_entity_to_v4l2_subdev (entity); ret =v4l2_subdev_call (subdev, video, s_stream,1 );@@ -337,7 +337,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_v4l2_subdev (entity))continue ; subdev =media_entity_to_v4l2_subdev (entity); ret =v4l2_subdev_call (subdev, video, s_stream,0 );drivers/staging/media/omap4iss/iss.c +6
-8@@ -396,7 +396,7 @@ static int iss_pipeline_pm_use_count(struct media_entity *entity)media_entity_graph_walk_start (&graph, entity);while ((entity =media_entity_graph_walk_next (&graph))) { -if (media_entity_type (entity) ==MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_av_dma (entity)) use += entity->use_count; }@@ -418,7 +418,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change) {struct v4l2_subdev *subdev; - subdev =media_entity_type (entity) ==MEDIA_ENT_T_V4L2_SUBDEV + subdev = is_media_entity_v4l2_subdev(entity)) ?media_entity_to_v4l2_subdev (entity) :NULL ;if (entity->use_count ==0 && change >0 && subdev !=NULL ) {@@ -460,7 +460,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)media_entity_graph_walk_start (&graph, entity);while (!ret && (entity =media_entity_graph_walk_next (&graph))) -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (entity)) ret =iss_pipeline_pm_power_one (entity, change);if (!ret)@@ -470,7 +470,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)while ((first =media_entity_graph_walk_next (&graph)) && first != entity) -if (media_entity_type (first) !=MEDIA_ENT_T_DEVNODE ) +if (is_media_entity_v4l2_subdev (first))iss_pipeline_pm_power_one (first, -change);return ret;@@ -589,8 +589,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) + if !is_media_entity_v4l2_subdev(pad->entity))break ; entity = pad->entity;@@ -657,8 +656,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,break ; pad =media_entity_remote_pad (pad); -if (pad ==NULL || -media_entity_type (pad->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; entity = pad->entity;drivers/staging/media/omap4iss/iss_video.c +2
-3@@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32 *pad) remote =media_entity_remote_pad (&video->pad); -if (remote ==NULL || -media_entity_type (remote->entity) !=MEDIA_ENT_T_V4L2_SUBDEV ) + if ((!is_media_entity_v4l2_subdev(remote->entity))return NULL ;if (pad)@@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)if (entity == &video->video.entity)continue ; -if (media_entity_type (entity) !=MEDIA_ENT_T_DEVNODE ) +if (!is_media_entity_av_dma (entity))continue ; far_end =to_iss_video (media_entity_to_video_device (entity));
PATCH 11/18 omap3/omap4/davinci: get rid of MEDIA_ENT_T_V4L2_SUBDEV abuse
In reply to Mauro Carvalho ChehabOn omap3/omap4/davinci drivers, MEDIA_ENT_T_V4L2_SUBDEV macro is abused in order to "simplify" the pad checks.
Basically, it does a logical or of this macro, in order to check for a local index and if the entity is either a subdev or not.
As we'll get rid of MEDIA_ENT_T_V4L2_SUBDEV macro, replace it by 2 << 16 where it occurs, and add a note saying that the code there is actually a hack.
drivers/media/platform/omap3isp/ispccdc.c +10 -5
@@ -2513,9 +2513,14 @@ static int ccdc_link_setup(struct media_entity *entity,struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct isp_ccdc_device *ccdc =v4l2_get_subdevdata (sd);struct isp_device *isp =to_isp_device (ccdc); +int index = local->index; -switch (local->index |media_entity_type (remote->entity)) { -case CCDC_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +switch (index) { +case CCDC_PAD_SINK |2 <<16 :/* Read from the sensor (parallel interface), CCP2, CSI2a or * CSI2c. */
@@ -2543,7 +2548,7 @@ static int ccdc_link_setup(struct media_entity *entity,* Revisit this when it will be implemented, and return -EBUSY for now. */ -case CCDC_PAD_SOURCE_VP |MEDIA_ENT_T_V4L2_SUBDEV : +case CCDC_PAD_SOURCE_VP |2 <<16 :/* Write to preview engine, histogram and H3A. When none of * those links are active, the video port can be disabled. */
@@ -2556,7 +2561,7 @@ static int ccdc_link_setup(struct media_entity *entity, }break ; -case CCDC_PAD_SOURCE_OF |MEDIA_ENT_T_DEVNODE : +case CCDC_PAD_SOURCE_OF :/* Write to memory */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (ccdc->output & ~CCDC_OUTPUT_MEMORY )
@@ -2567,7 +2572,7 @@ static int ccdc_link_setup(struct media_entity *entity, }break ; -case CCDC_PAD_SOURCE_OF |MEDIA_ENT_T_V4L2_SUBDEV : +case CCDC_PAD_SOURCE_OF |2 <<16 :/* Write to resizer */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (ccdc->output & ~CCDC_OUTPUT_RESIZER )
drivers/media/platform/omap3isp/ispccp2.c +9 -4
@@ -956,9 +956,14 @@ static int ccp2_link_setup(struct media_entity *entity, {struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct isp_ccp2_device *ccp2 =v4l2_get_subdevdata (sd); +int index = local_index; -switch (local->index |media_entity_type (remote->entity)) { -case CCP2_PAD_SINK |MEDIA_ENT_T_DEVNODE : +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +switch (index) { +case CCP2_PAD_SINK :/* read from memory */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (ccp2->input ==CCP2_INPUT_SENSOR )
@@ -970,7 +975,7 @@ static int ccp2_link_setup(struct media_entity *entity, }break ; -case CCP2_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +case CCP2_PAD_SINK |2 <<16 :/* read from sensor/phy */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (ccp2->input ==CCP2_INPUT_MEMORY )
@@ -981,7 +986,7 @@ static int ccp2_link_setup(struct media_entity *entity, ccp2->input =CCP2_INPUT_NONE ; }break ; -case CCP2_PAD_SOURCE |MEDIA_ENT_T_V4L2_SUBDEV : +case CCP2_PAD_SOURCE |2 <<16 :/* write to video port/ccdc */ if (flags &MEDIA_LNK_FL_ENABLED ) ccp2->output =CCP2_OUTPUT_CCDC ;
drivers/media/platform/omap3isp/ispcsi2.c +7 -3
@@ -1144,14 +1144,18 @@ static int csi2_link_setup(struct media_entity *entity,struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct isp_csi2_device *csi2 =v4l2_get_subdevdata (sd);struct isp_csi2_ctrl_cfg *ctrl = &csi2->ctrl; +int index = local->index;/* * The ISP core doesn't support pipelines with multiple video outputs. * Revisit this when it will be implemented, and return -EBUSY for now. */ -switch (local->index |media_entity_type (remote->entity)) { -case CSI2_PAD_SOURCE |MEDIA_ENT_T_DEVNODE : +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +case CSI2_PAD_SOURCE :if (flags &MEDIA_LNK_FL_ENABLED ) {if (csi2->output & ~CSI2_OUTPUT_MEMORY )return -EBUSY ;
@@ -1161,7 +1165,7 @@ static int csi2_link_setup(struct media_entity *entity, }break ; -case CSI2_PAD_SOURCE |MEDIA_ENT_T_V4L2_SUBDEV : +case CSI2_PAD_SOURCE |2 <<16 :if (flags &MEDIA_LNK_FL_ENABLED ) {if (csi2->output & ~CSI2_OUTPUT_CCDC )return -EBUSY ;
drivers/media/platform/omap3isp/isppreview.c +10 -5
@@ -2148,9 +2148,14 @@ static int preview_link_setup(struct media_entity *entity, {struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct isp_prev_device *prev =v4l2_get_subdevdata (sd); +int index = local->index; -switch (local->index |media_entity_type (remote->entity)) { -case PREV_PAD_SINK |MEDIA_ENT_T_DEVNODE : +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +switch (index) { +case PREV_PAD_SINK :/* read from memory */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (prev->input ==PREVIEW_INPUT_CCDC )
@@ -2162,7 +2167,7 @@ static int preview_link_setup(struct media_entity *entity, }break ; -case PREV_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +case PREV_PAD_SINK |2 <<16 :/* read from ccdc */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (prev->input ==PREVIEW_INPUT_MEMORY )
@@ -2179,7 +2184,7 @@ static int preview_link_setup(struct media_entity *entity,* Revisit this when it will be implemented, and return -EBUSY for now. */ -case PREV_PAD_SOURCE |MEDIA_ENT_T_DEVNODE : +case PREV_PAD_SOURCE :/* write to memory */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (prev->output & ~PREVIEW_OUTPUT_MEMORY )
@@ -2190,7 +2195,7 @@ static int preview_link_setup(struct media_entity *entity, }break ; -case PREV_PAD_SOURCE |MEDIA_ENT_T_V4L2_SUBDEV : +case PREV_PAD_SOURCE |2 <<16 :/* write to resizer */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (prev->output & ~PREVIEW_OUTPUT_RESIZER )
drivers/media/platform/omap3isp/ispresizer.c +9 -4
@@ -1623,9 +1623,14 @@ static int resizer_link_setup(struct media_entity *entity, {struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct isp_res_device *res =v4l2_get_subdevdata (sd); +int index = local->index; -switch (local->index |media_entity_type (remote->entity)) { -case RESZ_PAD_SINK |MEDIA_ENT_T_DEVNODE : +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +switch (index) { +case RESZ_PAD_SINK :/* read from memory */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (res->input ==RESIZER_INPUT_VP )
@@ -1637,7 +1642,7 @@ static int resizer_link_setup(struct media_entity *entity, }break ; -case RESZ_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +case RESZ_PAD_SINK |2 <<16 :/* read from ccdc or previewer */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (res->input ==RESIZER_INPUT_MEMORY )
@@ -1649,7 +1654,7 @@ static int resizer_link_setup(struct media_entity *entity, }break ; -case RESZ_PAD_SOURCE |MEDIA_ENT_T_DEVNODE : +case RESZ_PAD_SOURCE :/* resizer always write to memory */ break ;
drivers/staging/media/davinci_vpfe/dm365_ipipeif.c +9 -4
@@ -885,9 +885,14 @@ ipipeif_link_setup(struct media_entity *entity, const struct media_pad *local,struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct vpfe_ipipeif_device *ipipeif =v4l2_get_subdevdata (sd);struct vpfe_device *vpfe =to_vpfe_device (ipipeif); +int index = local->index; -switch (local->index |media_entity_type (remote->entity)) { -case IPIPEIF_PAD_SINK |MEDIA_ENT_T_DEVNODE : +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +switch (index) { +case IPIPEIF_PAD_SINK :/* Single shot mode */ if (!(flags &MEDIA_LNK_FL_ENABLED )) { ipipeif->input =IPIPEIF_INPUT_NONE ;
@@ -896,7 +901,7 @@ ipipeif_link_setup(struct media_entity *entity, const struct media_pad *local, ipipeif->input =IPIPEIF_INPUT_MEMORY ;break ; -case IPIPEIF_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +case IPIPEIF_PAD_SINK |2 <<16 :/* read from isif */ if (!(flags &MEDIA_LNK_FL_ENABLED )) { ipipeif->input =IPIPEIF_INPUT_NONE ;
@@ -908,7 +913,7 @@ ipipeif_link_setup(struct media_entity *entity, const struct media_pad *local, ipipeif->input =IPIPEIF_INPUT_ISIF ;break ; -case IPIPEIF_PAD_SOURCE |MEDIA_ENT_T_V4L2_SUBDEV : +case IPIPEIF_PAD_SOURCE |2 <<16 :if (!(flags &MEDIA_LNK_FL_ENABLED )) { ipipeif->output =IPIPEIF_OUTPUT_NONE ;break ;
drivers/staging/media/davinci_vpfe/dm365_isif.c +9 -4
@@ -1707,9 +1707,14 @@ isif_link_setup(struct media_entity *entity, const struct media_pad *local, {struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct vpfe_isif_device *isif =v4l2_get_subdevdata (sd); +int index = local->index; -switch (local->index |media_entity_type (remote->entity)) { -case ISIF_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +switch (index) { +case ISIF_PAD_SINK |2 <<16 :/* read from decoder/sensor */ if (!(flags &MEDIA_LNK_FL_ENABLED )) { isif->input =ISIF_INPUT_NONE ;
@@ -1720,7 +1725,7 @@ isif_link_setup(struct media_entity *entity, const struct media_pad *local, isif->input =ISIF_INPUT_PARALLEL ;break ; -case ISIF_PAD_SOURCE |MEDIA_ENT_T_DEVNODE : +case ISIF_PAD_SOURCE :/* write to memory */ if (flags &MEDIA_LNK_FL_ENABLED ) isif->output =ISIF_OUTPUT_MEMORY ;
@@ -1728,7 +1733,7 @@ isif_link_setup(struct media_entity *entity, const struct media_pad *local, isif->output =ISIF_OUTPUT_NONE ;break ; -case ISIF_PAD_SOURCE |MEDIA_ENT_T_V4L2_SUBDEV : +case ISIF_PAD_SOURCE |2 <<16 :if (flags &MEDIA_LNK_FL_ENABLED ) isif->output =ISIF_OUTPUT_IPIPEIF ;else
drivers/staging/media/davinci_vpfe/dm365_resizer.c +14 -8
@@ -1654,8 +1654,14 @@ static int resizer_link_setup(struct media_entity *entity,u16 ipipe_source = vpfe_dev->vpfe_ipipe.output;if (&resizer->crop_resizer.subdev == sd) { -switch (local->index |media_entity_type (remote->entity)) { -case RESIZER_CROP_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +int index = local->index; + +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +switch (index) { +case RESIZER_CROP_PAD_SINK |2 <<16 :if (!(flags &MEDIA_LNK_FL_ENABLED )) { resizer->crop_resizer.input =RESIZER_CROP_INPUT_NONE ;
@@ -1675,7 +1681,7 @@ static int resizer_link_setup(struct media_entity *entity,return -EINVAL ;break ; -case RESIZER_CROP_PAD_SOURCE |MEDIA_ENT_T_V4L2_SUBDEV : +case RESIZER_CROP_PAD_SOURCE |2 <<16 :if (!(flags &MEDIA_LNK_FL_ENABLED )) { resizer->crop_resizer.output =RESIZER_CROP_OUTPUT_NONE ;
@@ -1687,7 +1693,7 @@ static int resizer_link_setup(struct media_entity *entity, resizer->crop_resizer.output =RESIZER_A ;break ; -case RESIZER_CROP_PAD_SOURCE2 |MEDIA_ENT_T_V4L2_SUBDEV : +case RESIZER_CROP_PAD_SOURCE2 |2 <<16 :if (!(flags &MEDIA_LNK_FL_ENABLED )) { resizer->crop_resizer.output2 =RESIZER_CROP_OUTPUT_NONE ;
@@ -1704,7 +1710,7 @@ static int resizer_link_setup(struct media_entity *entity, } }else if (&resizer->resizer_a.subdev == sd) {switch (local->index |media_entity_type (remote->entity)) { -case RESIZER_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +case RESIZER_PAD_SINK |2 <<16 :if (!(flags &MEDIA_LNK_FL_ENABLED )) { resizer->resizer_a.input =RESIZER_INPUT_NONE ;break ;
@@ -1714,7 +1720,7 @@ static int resizer_link_setup(struct media_entity *entity, resizer->resizer_a.input =RESIZER_INPUT_CROP_RESIZER ;break ; -case RESIZER_PAD_SOURCE |MEDIA_ENT_T_DEVNODE : +case RESIZER_PAD_SOURCE :if (!(flags &MEDIA_LNK_FL_ENABLED )) { resizer->resizer_a.output =RESIZER_OUTPUT_NONE ;break ;
@@ -1729,7 +1735,7 @@ static int resizer_link_setup(struct media_entity *entity, } }else if (&resizer->resizer_b.subdev == sd) {switch (local->index |media_entity_type (remote->entity)) { -case RESIZER_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +case RESIZER_PAD_SINK |2 <<16 :if (!(flags &MEDIA_LNK_FL_ENABLED )) { resizer->resizer_b.input =RESIZER_INPUT_NONE ;break ;
@@ -1739,7 +1745,7 @@ static int resizer_link_setup(struct media_entity *entity, resizer->resizer_b.input =RESIZER_INPUT_CROP_RESIZER ;break ; -case RESIZER_PAD_SOURCE |MEDIA_ENT_T_DEVNODE : +case RESIZER_PAD_SOURCE :if (!(flags &MEDIA_LNK_FL_ENABLED )) { resizer->resizer_b.output =RESIZER_OUTPUT_NONE ;break ;
drivers/staging/media/omap4iss/iss_csi2.c +8 -3
@@ -1164,14 +1164,19 @@ static int csi2_link_setup(struct media_entity *entity,struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct iss_csi2_device *csi2 =v4l2_get_subdevdata (sd);struct iss_csi2_ctrl_cfg *ctrl = &csi2->ctrl; +int index = local->index; + +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ;/* * The ISS core doesn't support pipelines with multiple video outputs. * Revisit this when it will be implemented, and return -EBUSY for now. */ -switch (local->index |media_entity_type (remote->entity)) { -case CSI2_PAD_SOURCE |MEDIA_ENT_T_DEVNODE : +switch (index) { +case CSI2_PAD_SOURCE :if (flags &MEDIA_LNK_FL_ENABLED ) {if (csi2->output & ~CSI2_OUTPUT_MEMORY )return -EBUSY ;
@@ -1181,7 +1186,7 @@ static int csi2_link_setup(struct media_entity *entity, }break ; -case CSI2_PAD_SOURCE |MEDIA_ENT_T_V4L2_SUBDEV : +case CSI2_PAD_SOURCE |2 <<16 :if (flags &MEDIA_LNK_FL_ENABLED ) {if (csi2->output & ~CSI2_OUTPUT_IPIPEIF )return -EBUSY ;
drivers/staging/media/omap4iss/iss_ipipeif.c +9 -4
@@ -660,9 +660,14 @@ static int ipipeif_link_setup(struct media_entity *entity,struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct iss_ipipeif_device *ipipeif =v4l2_get_subdevdata (sd);struct iss_device *iss =to_iss_device (ipipeif); +int index = local->index; -switch (local->index |media_entity_type (remote->entity)) { -case IPIPEIF_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +switch (index) { +case IPIPEIF_PAD_SINK |2 <<16 :/* Read from the sensor CSI2a or CSI2b. */ if (!(flags &MEDIA_LNK_FL_ENABLED )) { ipipeif->input =IPIPEIF_INPUT_NONE ;
@@ -679,7 +684,7 @@ static int ipipeif_link_setup(struct media_entity *entity,break ; -case IPIPEIF_PAD_SOURCE_ISIF_SF |MEDIA_ENT_T_DEVNODE : +case IPIPEIF_PAD_SOURCE_ISIF_SF :/* Write to memory */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (ipipeif->output & ~IPIPEIF_OUTPUT_MEMORY )
@@ -690,7 +695,7 @@ static int ipipeif_link_setup(struct media_entity *entity, }break ; -case IPIPEIF_PAD_SOURCE_VP |MEDIA_ENT_T_V4L2_SUBDEV : +case IPIPEIF_PAD_SOURCE_VP |2 <<16 :/* Send to IPIPE/RESIZER */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (ipipeif->output & ~IPIPEIF_OUTPUT_VP )
drivers/staging/media/omap4iss/iss_resizer.c +8 -3
@@ -715,9 +715,14 @@ static int resizer_link_setup(struct media_entity *entity,struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity);struct iss_resizer_device *resizer =v4l2_get_subdevdata (sd);struct iss_device *iss =to_iss_device (resizer); +int index = local->index; -switch (local->index |media_entity_type (remote->entity)) { -case RESIZER_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +/* FIXME: this is actually a hack! */ +if (is_media_entity_v4l2_subdev (remote->entity)) + index |=2 <<16 ; + +switch (index) { +case RESIZER_PAD_SINK |2 <<16 :/* Read from IPIPE or IPIPEIF. */ if (!(flags &MEDIA_LNK_FL_ENABLED )) { resizer->input =RESIZER_INPUT_NONE ;
@@ -735,7 +740,7 @@ static int resizer_link_setup(struct media_entity *entity,break ; -case RESIZER_PAD_SOURCE_MEM |MEDIA_ENT_T_DEVNODE : +case RESIZER_PAD_SOURCE_MEM :/* Write to memory */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (resizer->output & ~RESIZER_OUTPUT_MEMORY )
Signature · 1 line
2.1.0
PATCH 12/18 s5c73m3: fix subdev type
In reply to Mauro Carvalho ChehabThis sensor driver is abusing MEDIA_ENT_T_V4L2_SUBDEV, creating some subdevs with a non-existing type.
As this is a sensor driver, the proper type is likely MEDIA_ENT_T_CAM_SENSOR.
drivers/media/i2c/s5c73m3/s5c73m3-core.c +2 -2
@@ -1688,7 +1688,7 @@ static int s5c73m3_probe(struct i2c_client *client, state->sensor_pads[S5C73M3_JPEG_PAD ].flags =MEDIA_PAD_FL_SOURCE ; state->sensor_pads[S5C73M3_ISP_PAD ].flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,S5C73M3_NUM_PADS , state->sensor_pads,0 );
@@ -1704,7 +1704,7 @@ static int s5c73m3_probe(struct i2c_client *client, state->oif_pads[OIF_ISP_PAD ].flags =MEDIA_PAD_FL_SINK ; state->oif_pads[OIF_JPEG_PAD ].flags =MEDIA_PAD_FL_SINK ; state->oif_pads[OIF_SOURCE_PAD ].flags =MEDIA_PAD_FL_SOURCE ; - oif_sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV ; + oif_sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&oif_sd->entity,OIF_NUM_PADS , state->oif_pads,0 );
Signature · 1 line
2.1.0
PATCH 13/18 s5k5baf: fix subdev type
In reply to Mauro Carvalho ChehabThis sensor driver is abusing MEDIA_ENT_T_V4L2_SUBDEV, creating some subdevs with a non-existing type.
As this is a sensor driver, the proper type is likely MEDIA_ENT_T_CAM_SENSOR.
drivers/media/i2c/s5k5baf.c +1 -1
@@ -1919,7 +1919,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state, state->pads[PAD_CIS ].flags =MEDIA_PAD_FL_SINK ; state->pads[PAD_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,NUM_ISP_PADS , state->pads,0 );if (!ret)
Signature · 1 line
2.1.0
Re: [PATCH 13/18] s5k5baf: fix subdev type
Hi Mauro,
Quoted 5 lines · Mauro Carvalho Chehab
This sensor driver is abusing
MEDIA_ENT_T_V4L2_SUBDEV, creating some subdevs with a non-existing type.As this is a sensor driver, the proper type is likely
MEDIA_ENT_T_CAM_SENSOR.
This driver exposes two media entities:
- pure camera sensor, it has type MEDIA_ENT_T_V4L2_SUBDEV_SENSOR/MEDIA_ENT_T_CAM_SENSOR,
- image processing entity, I have assigned to it MEDIA_ENT_T_V4L2_SUBDEV type,
as there were no better option.
Maybe it would be better to introduce another define for such entities, for example MEDIA_ENT_T_CAM_ISP?
The same applies to s5c73m3 driver.
Anyway this patch breaks current code as type field is used internally to distinguish both entities in subdev callbacks - s5k5baf_is_cis_subdev function.
Of course the function can be rewritten if necessary.
Regards
Andrzej
Quoted 16 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/i2c/s5k5baf.c +1
-1@@ -1919,7 +1919,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state, state->pads[PAD_CIS ].flags =MEDIA_PAD_FL_SINK ; state->pads[PAD_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,NUM_ISP_PADS , state->pads,0 );if (!ret)
Re: [PATCH 13/18] s5k5baf: fix subdev type
Hi Andrzej,
Em Fri, 08 May 2015 15:51:16 +0200
Andrzej Hajda <[email protected]> escreveu:
Quoted 9 lines
Hi Mauro,
Quoted 5 lines · Mauro Carvalho Chehab
This sensor driver is abusing
MEDIA_ENT_T_V4L2_SUBDEV, creating some subdevs with a non-existing type.As this is a sensor driver, the proper type is likely
MEDIA_ENT_T_CAM_SENSOR.
Quoted 9 lines
This driver exposes two media entities:
- pure camera sensor, it has type MEDIA_ENT_T_V4L2_SUBDEV_SENSOR/MEDIA_ENT_T_CAM_SENSOR,
- image processing entity, I have assigned to itMEDIA_ENT_T_V4L2_SUBDEVtype,
as there were no better option.
Maybe it would be better to introduce another define for such entities, for exampleMEDIA_ENT_T_CAM_ISP?
The same applies to s5c73m3 driver.
Yeah, a new type is needed instead of abusing MEDIA_ENT_T_V4L2_SUBDEV.
Quoted 5 lines
Anyway this patch breaks current code as type field is used internally to distinguish both entities in subdev callbacks -
s5k5baf_is_cis_subdevfunction.
Of course the function can be rewritten if necessary.
Ah, ok.
Yes, the better is to rewrite it to use the new ISP type.
We're still discussing the namespaces, so, for now, please consider those patches as RFC, but this is something that needs to be fixed anyway, by creating an specific type for ISP hardware.
Regards,
Mauro
Quoted 21 lines
Regards
AndrzejQuoted 16 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/i2c/s5k5baf.c +1
-1@@ -1919,7 +1919,7 @@ static int s5k5baf_configure_subdevs(struct s5k5baf *state, state->pads[PAD_CIS ].flags =MEDIA_PAD_FL_SINK ; state->pads[PAD_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - sd->entity.type =MEDIA_ENT_T_V4L2_SUBDEV ; + sd->entity.type =MEDIA_ENT_T_CAM_SENSOR ; ret =media_entity_init (&sd->entity,NUM_ISP_PADS , state->pads,0 );if (!ret)
PATCH 14/18 davinci_vbpe: stop MEDIA_ENT_T_V4L2_SUBDEV abuse
In reply to Mauro Carvalho ChehabThis driver is abusing MEDIA_ENT_T_V4L2_SUBDEV:
- it uses a hack to check if the remote entity is a subdev;
- it still uses the legacy entity subtype check macro, that will be removed soon.
drivers/staging/media/davinci_vpfe/dm365_ipipe.c +6 -3
@@ -1711,8 +1711,11 @@ ipipe_link_setup(struct media_entity *entity, const struct media_pad *local,struct vpfe_device *vpfe_dev =to_vpfe_device (ipipe);u16 ipipeif_sink = vpfe_dev->vpfe_ipipeif.input; -switch (local->index |media_entity_type (remote->entity)) { -case IPIPE_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +if (!is_media_entity_v4l2_subdev (remote->entity)) +return -EINVAL ; + +switch (local->index) { +case IPIPE_PAD_SINK :if (!(flags &MEDIA_LNK_FL_ENABLED )) { ipipe->input =IPIPE_INPUT_NONE ;break ;
@@ -1725,7 +1728,7 @@ ipipe_link_setup(struct media_entity *entity, const struct media_pad *local, ipipe->input =IPIPE_INPUT_CCDC ;break ; -case IPIPE_PAD_SOURCE |MEDIA_ENT_T_V4L2_SUBDEV : +case IPIPE_PAD_SOURCE :/* out to RESIZER */ if (flags &MEDIA_LNK_FL_ENABLED ) ipipe->output =IPIPE_OUTPUT_RESIZER ;
drivers/staging/media/davinci_vpfe/vpfe_video.c +2 -3
@@ -91,7 +91,7 @@ vpfe_video_remote_subdev(struct vpfe_video_device *video, u32 *pad) {struct media_pad *remote =media_entity_remote_pad (&video->pad); -if (remote ==NULL || remote->entity->type !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (remote->entity))return NULL ;if (pad) *pad = remote->index;
@@ -246,8 +246,7 @@ static int vpfe_video_validate_pipeline(struct vpfe_pipeline *pipe)/* Retrieve the source format */ pad =media_entity_remote_pad (pad); -if (pad ==NULL || - pad->entity->type !=MEDIA_ENT_T_V4L2_SUBDEV ) +if (!is_media_entity_v4l2_subdev (pad->entity))break ; subdev =media_entity_to_v4l2_subdev (pad->entity);
Signature · 1 line
2.1.0
PATCH 15/18 omap4iss: stop MEDIA_ENT_T_V4L2_SUBDEV abuse
In reply to Mauro Carvalho ChehabThis driver is abusing MEDIA_ENT_T_V4L2_SUBDEV, as it uses a hack to check if the remote entity is a subdev. Get rid of it.
drivers/staging/media/omap4iss/iss_ipipe.c +5 -2
@@ -439,8 +439,11 @@ static int ipipe_link_setup(struct media_entity *entity,struct iss_ipipe_device *ipipe =v4l2_get_subdevdata (sd);struct iss_device *iss =to_iss_device (ipipe); +if (!is_media_entity_v4l2_subdev (remote->entity)) +return -EINVAL ; +switch (local->index |media_entity_type (remote->entity)) { -case IPIPE_PAD_SINK |MEDIA_ENT_T_V4L2_SUBDEV : +case IPIPE_PAD_SINK :/* Read from IPIPEIF. */ if (!(flags &MEDIA_LNK_FL_ENABLED )) { ipipe->input =IPIPE_INPUT_NONE ;
@@ -455,7 +458,7 @@ static int ipipe_link_setup(struct media_entity *entity,break ; -case IPIPE_PAD_SOURCE_VP |MEDIA_ENT_T_V4L2_SUBDEV : +case IPIPE_PAD_SOURCE_VP :/* Send to RESIZER */ if (flags &MEDIA_LNK_FL_ENABLED ) {if (ipipe->output & ~IPIPE_OUTPUT_VP )
Signature · 1 line
2.1.0
PATCH 17/18 media controller: get rid of entity subtype on Kernel
In reply to Mauro Carvalho ChehabDon't use anymore the type/subtype entity data/macros inside the Kernel.
include/media/media-entity.h +0 -10
@@ -103,16 +103,6 @@ struct media_entity { } info; }; -static inline u32 media_entity_type (struct media_entity *entity) -{ -return entity->type &MEDIA_ENT_TYPE_MASK ; -} - -static inline u32 media_entity_subtype (struct media_entity *entity) -{ -return entity->type &MEDIA_ENT_SUBTYPE_MASK ; -} -static inline bool is_media_entity_av_dma (struct media_entity *entity) {if (!entity)
include/uapi/linux/media.h +3 -2
@@ -71,7 +71,9 @@ struct media_device_info {/* Radio, Analog TV and/or Digital TV tuners */ #define MEDIA_ENT_T_TUNER (MEDIA_ENT_T_CAM_SENSOR + 4) -#if 1 +#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT) + +#ifndef __KERNEL__/* * Legacy symbols. * Kept just to avoid userspace compilation breakages.
@@ -82,7 +84,6 @@ struct media_device_info {#define MEDIA_ENT_TYPE_MASK 0x00ff0000#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff -#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT)#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
Signature · 1 line
2.1.0
PATCH 18/18 DocBook: update descriptions for the media controller entities
In reply to Mauro Carvalho ChehabCleanup the media controller entities description:
- remove MEDIA_ENT_T_DEVNODE and MEDIA_ENT_T_V4L2_SUBDEV;
- improve the description of some entities;
- add MEDIA_ENT_T_UNKNOWN with a proper description.
Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml +12 -23
@@ -179,48 +179,37 @@ <colspec colname="c2"/> <tbody valign="top"> <row> - <entry><constant>MEDIA_ENT_T_DEVNODE</constant></entry> - <entry>Unknown device node</entry> + <entry><constant>MEDIA_ENT_T_UNKNOWN</constant></entry> + <entry>Unknown device node. That generally indicates that + a device driver didn't initialize properly</entry> </row> <row> <entry><constant>MEDIA_ENT_T_AV_DMA</constant></entry> - <entry>V4L video, radio or vbi device node</entry> - </row> - <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_FB</constant></entry> - <entry>Frame buffer device node</entry> - </row> - <row> - <entry><constant>MEDIA_ENT_T_DEVNODE_ALSA</constant></entry> - <entry>ALSA card</entry> + <entry>V4L Audio/Video DMA engine, used for video, vbi or SDR radio data transfer</entry> </row> <row> <entry><constant>MEDIA_ENT_T_DTV_DEMOD</constant></entry> - <entry>DVB frontend devnode</entry> + <entry>DVB demodulator, associated with a frontend device node</entry> </row> <row> <entry><constant>MEDIA_ENT_T_DTV_DEMUX</constant></entry> - <entry>DVB demux devnode</entry> + <entry>DVB demux hardware or Kernel emulation</entry> </row> <row> <entry><constant>MEDIA_ENT_T_DTV_DVR</constant></entry> - <entry>DVB DVR devnode</entry> + <entry>DVB DVR streaming output device node</entry> </row> <row> <entry><constant>MEDIA_ENT_T_DTV_CA</constant></entry> - <entry>DVB CAM devnode</entry> + <entry>DVB Conditional Access Module (CAM)</entry> </row> <row> <entry><constant>MEDIA_ENT_T_DTV_NET</constant></entry> - <entry>DVB network devnode</entry> - </row> - <row> - <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV</constant></entry> - <entry>Unknown V4L sub-device</entry> + <entry>DVB network device node</entry> </row> <row> <entry><constant>MEDIA_ENT_T_CAM_SENSOR</constant></entry> - <entry>Video sensor</entry> + <entry>Camera video sensor</entry> </row> <row> <entry><constant>MEDIA_ENT_T_CAM_FLASH</constant></entry>
@@ -232,7 +221,7 @@ </row> <row> <entry><constant>MEDIA_ENT_T_ATV_DECODER</constant></entry> - <entry>Video decoder, the basic function of the video decoder is to + <entry>Analog TV video decoder, the basic function of the video decoder is to accept analogue video from a wide variety of sources such as broadcast, DVD players, cameras and video cassette recorders, in either NTSC, PAL or HD format and still occasionally SECAM, separate
@@ -242,7 +231,7 @@ </row> <row> <entry><constant>MEDIA_ENT_T_TUNER</constant></entry> - <entry>TV and/or radio tuner</entry> + <entry>Digital TV, analog TV and/or radio tuner</entry> </row> </tbody> </tgroup>
Signature · 1 line
2.1.0