* [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines
[not found] <cover.1431046915.git.mchehab@osg.samsung.com>
@ 2015-05-08 1:12 ` Mauro Carvalho Chehab
2015-05-08 11:54 ` Hans Verkuil
2015-05-08 1:12 ` [PATCH 10/18] media controller: use macros to check for V4L2 subdev entities Mauro Carvalho Chehab
1 sibling, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2015-05-08 1:12 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml b/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml
index 5872f8bbf774..5b8147629159 100644
--- a/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml
+++ b/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml
@@ -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>
diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index efde88adf624..7fa0cc0f08f0 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -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));
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 71a1b93b0790..9ef920221b5a 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -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;
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 63596063b213..9f8fc8330b3e 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -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);
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 775c11c6b173..a7aa2aac9c23 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -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)
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 10/18] media controller: use macros to check for V4L2 subdev entities
[not found] <cover.1431046915.git.mchehab@osg.samsung.com>
2015-05-08 1:12 ` [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines Mauro Carvalho Chehab
@ 2015-05-08 1:12 ` Mauro Carvalho Chehab
2015-05-08 12:46 ` Hans Verkuil
1 sibling, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2015-05-08 1:12 UTC (permalink / raw)
To: linux-arm-kernel
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_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.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/platform/exynos4-is/common.c b/drivers/media/platform/exynos4-is/common.c
index 0eb34ecb8ee4..1f1b9a56e24e 100644
--- a/drivers/media/platform/exynos4-is/common.c
+++ b/drivers/media/platform/exynos4-is/common.c
@@ -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);
diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
index cfebf292e15a..545286813414 100644
--- a/drivers/media/platform/exynos4-is/fimc-capture.c
+++ b/drivers/media/platform/exynos4-is/fimc-capture.c
@@ -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))
diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
index 76b6b4d14616..014d0bad657d 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
@@ -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);
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
index ca6261a86a5f..4fb53a28eaaa 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite.c
@@ -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;
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index f315ef946cd4..e2eba223a544 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -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);
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index 18d0a871747f..a194d575573b 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -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;
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index d285af18df7f..8ff034c42d9c 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -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);
diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
index 76e6289a5612..cc11ab37862e 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -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;
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index d91f19a9e1c1..172eaaaf46c8 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -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));
diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index 7fa0cc0f08f0..00a440313cb4 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -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;
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 9f8fc8330b3e..66c6d9fd2033 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -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);
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 06d48d5eb0a0..429bec44d1a3 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -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);
diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index e0ad5e520e2d..a9632facfb66 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -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;
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
index 85c54fedddda..019fcff7217c 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -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));
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines
2015-05-08 1:12 ` [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines Mauro Carvalho Chehab
@ 2015-05-08 11:54 ` Hans Verkuil
2015-05-08 12:32 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 7+ messages in thread
From: Hans Verkuil @ 2015-05-08 11:54 UTC (permalink / raw)
To: linux-arm-kernel
On 05/08/2015 03:12 AM, Mauro Carvalho Chehab wrote:
> 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.
> 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
>
> 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.)
> 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 :-(
> 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.
> 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.
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
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
> diff --git a/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml b/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml
> index 5872f8bbf774..5b8147629159 100644
> --- a/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml
> +++ b/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml
> @@ -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>
> diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
> index efde88adf624..7fa0cc0f08f0 100644
> --- a/drivers/media/platform/xilinx/xilinx-dma.c
> +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> @@ -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));
> diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
> index 71a1b93b0790..9ef920221b5a 100644
> --- a/drivers/media/v4l2-core/v4l2-dev.c
> +++ b/drivers/media/v4l2-core/v4l2-dev.c
> @@ -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;
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index 63596063b213..9f8fc8330b3e 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -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);
>
> diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
> index 775c11c6b173..a7aa2aac9c23 100644
> --- a/include/uapi/linux/media.h
> +++ b/include/uapi/linux/media.h
> @@ -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)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines
2015-05-08 11:54 ` Hans Verkuil
@ 2015-05-08 12:32 ` Mauro Carvalho Chehab
2015-05-08 12:57 ` Hans Verkuil
0 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2015-05-08 12:32 UTC (permalink / raw)
To: linux-arm-kernel
Em Fri, 08 May 2015 13:54:07 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:
> On 05/08/2015 03:12 AM, Mauro Carvalho Chehab wrote:
> > 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 ;)
>
> You should add /dev/swradio? for SDR devices.
I will.
>
> > 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.
> >
> > 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.
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.
> 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.
> > 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.
> 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 :-(
>
> > 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,"
> > 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.
>
> How about MEDIA_ENT_T_DATA_STREAMING? Or perhaps DATA_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?
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 10/18] media controller: use macros to check for V4L2 subdev entities
2015-05-08 1:12 ` [PATCH 10/18] media controller: use macros to check for V4L2 subdev entities Mauro Carvalho Chehab
@ 2015-05-08 12:46 ` Hans Verkuil
2015-05-08 13:20 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 7+ messages in thread
From: Hans Verkuil @ 2015-05-08 12:46 UTC (permalink / raw)
To: linux-arm-kernel
On 05/08/2015 03:12 AM, Mauro Carvalho Chehab wrote:
> 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_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.
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
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
> diff --git a/drivers/media/platform/exynos4-is/common.c b/drivers/media/platform/exynos4-is/common.c
> index 0eb34ecb8ee4..1f1b9a56e24e 100644
> --- a/drivers/media/platform/exynos4-is/common.c
> +++ b/drivers/media/platform/exynos4-is/common.c
> @@ -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);
> diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
> index cfebf292e15a..545286813414 100644
> --- a/drivers/media/platform/exynos4-is/fimc-capture.c
> +++ b/drivers/media/platform/exynos4-is/fimc-capture.c
> @@ -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))
> diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> index 76b6b4d14616..014d0bad657d 100644
> --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> @@ -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);
> diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
> index ca6261a86a5f..4fb53a28eaaa 100644
> --- a/drivers/media/platform/exynos4-is/fimc-lite.c
> +++ b/drivers/media/platform/exynos4-is/fimc-lite.c
> @@ -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;
> diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> index f315ef946cd4..e2eba223a544 100644
> --- a/drivers/media/platform/exynos4-is/media-dev.c
> +++ b/drivers/media/platform/exynos4-is/media-dev.c
> @@ -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);
> diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
> index 18d0a871747f..a194d575573b 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -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;
> diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
> index d285af18df7f..8ff034c42d9c 100644
> --- a/drivers/media/platform/omap3isp/ispvideo.c
> +++ b/drivers/media/platform/omap3isp/ispvideo.c
> @@ -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);
> diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
> index 76e6289a5612..cc11ab37862e 100644
> --- a/drivers/media/platform/s3c-camif/camif-capture.c
> +++ b/drivers/media/platform/s3c-camif/camif-capture.c
> @@ -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;
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
> index d91f19a9e1c1..172eaaaf46c8 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -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));
> diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
> index 7fa0cc0f08f0..00a440313cb4 100644
> --- a/drivers/media/platform/xilinx/xilinx-dma.c
> +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> @@ -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;
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index 9f8fc8330b3e..66c6d9fd2033 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -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);
>
> diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> index 06d48d5eb0a0..429bec44d1a3 100644
> --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> @@ -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);
> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> index e0ad5e520e2d..a9632facfb66 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -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;
> diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
> index 85c54fedddda..019fcff7217c 100644
> --- a/drivers/staging/media/omap4iss/iss_video.c
> +++ b/drivers/staging/media/omap4iss/iss_video.c
> @@ -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));
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines
2015-05-08 12:32 ` Mauro Carvalho Chehab
@ 2015-05-08 12:57 ` Hans Verkuil
0 siblings, 0 replies; 7+ messages in thread
From: Hans Verkuil @ 2015-05-08 12:57 UTC (permalink / raw)
To: linux-arm-kernel
Hi Mauro,
On 05/08/2015 02:32 PM, Mauro Carvalho Chehab wrote:
>>> 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.
Yes, this is quite theoretical at the moment.
>>> 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 :-)
>
>>> 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.
>>
>> How about MEDIA_ENT_T_DATA_STREAMING? Or perhaps DATA_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.
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.
>
> 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?
>
>> 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).
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 10/18] media controller: use macros to check for V4L2 subdev entities
2015-05-08 12:46 ` Hans Verkuil
@ 2015-05-08 13:20 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2015-05-08 13:20 UTC (permalink / raw)
To: linux-arm-kernel
Em Fri, 08 May 2015 14:46:19 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:
> On 05/08/2015 03:12 AM, Mauro Carvalho Chehab wrote:
> > 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_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.
>
> 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.
> 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?
Any better suggestion for its name?
>
> Why have a DTV_DEMOD, DTV_DEMUX, etc. but not a MEDIA_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.
> 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.
>
> 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.
As I said previously, we should either use properties for hardware and entities
for software or the reverse. Not mix both ;)
>
> Regards,
>
> Hans
>
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> >
> > diff --git a/drivers/media/platform/exynos4-is/common.c b/drivers/media/platform/exynos4-is/common.c
> > index 0eb34ecb8ee4..1f1b9a56e24e 100644
> > --- a/drivers/media/platform/exynos4-is/common.c
> > +++ b/drivers/media/platform/exynos4-is/common.c
> > @@ -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);
> > diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
> > index cfebf292e15a..545286813414 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-capture.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-capture.c
> > @@ -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))
> > diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > index 76b6b4d14616..014d0bad657d 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > @@ -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);
> > diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
> > index ca6261a86a5f..4fb53a28eaaa 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-lite.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-lite.c
> > @@ -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;
> > diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> > index f315ef946cd4..e2eba223a544 100644
> > --- a/drivers/media/platform/exynos4-is/media-dev.c
> > +++ b/drivers/media/platform/exynos4-is/media-dev.c
> > @@ -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);
> > diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
> > index 18d0a871747f..a194d575573b 100644
> > --- a/drivers/media/platform/omap3isp/isp.c
> > +++ b/drivers/media/platform/omap3isp/isp.c
> > @@ -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;
> > diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
> > index d285af18df7f..8ff034c42d9c 100644
> > --- a/drivers/media/platform/omap3isp/ispvideo.c
> > +++ b/drivers/media/platform/omap3isp/ispvideo.c
> > @@ -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);
> > diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
> > index 76e6289a5612..cc11ab37862e 100644
> > --- a/drivers/media/platform/s3c-camif/camif-capture.c
> > +++ b/drivers/media/platform/s3c-camif/camif-capture.c
> > @@ -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;
> > diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
> > index d91f19a9e1c1..172eaaaf46c8 100644
> > --- a/drivers/media/platform/vsp1/vsp1_video.c
> > +++ b/drivers/media/platform/vsp1/vsp1_video.c
> > @@ -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));
> > diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
> > index 7fa0cc0f08f0..00a440313cb4 100644
> > --- a/drivers/media/platform/xilinx/xilinx-dma.c
> > +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> > @@ -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;
> > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> > index 9f8fc8330b3e..66c6d9fd2033 100644
> > --- a/drivers/media/v4l2-core/v4l2-subdev.c
> > +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> > @@ -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);
> >
> > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > index 06d48d5eb0a0..429bec44d1a3 100644
> > --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > @@ -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);
> > diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> > index e0ad5e520e2d..a9632facfb66 100644
> > --- a/drivers/staging/media/omap4iss/iss.c
> > +++ b/drivers/staging/media/omap4iss/iss.c
> > @@ -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;
> > diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
> > index 85c54fedddda..019fcff7217c 100644
> > --- a/drivers/staging/media/omap4iss/iss_video.c
> > +++ b/drivers/staging/media/omap4iss/iss_video.c
> > @@ -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));
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-05-08 13:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1431046915.git.mchehab@osg.samsung.com>
2015-05-08 1:12 ` [PATCH 03/18] media controller: use MEDIA_ENT_T_AV_DMA for A/V DMA engines Mauro Carvalho Chehab
2015-05-08 11:54 ` Hans Verkuil
2015-05-08 12:32 ` Mauro Carvalho Chehab
2015-05-08 12:57 ` Hans Verkuil
2015-05-08 1:12 ` [PATCH 10/18] media controller: use macros to check for V4L2 subdev entities Mauro Carvalho Chehab
2015-05-08 12:46 ` Hans Verkuil
2015-05-08 13:20 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).