diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-07-10 17:37:27 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-04-23 09:18:36 -0400 |
commit | d9b45ed3d8b75e8cf38c8cd1563c29217eecba27 (patch) | |
tree | f9e39e90b9c7df408ecf534f8729cc4a6614b61c | |
parent | 6051f5f860671577b0759a0d054781b3e599d1cd (diff) |
[media] v4l: vsp1: Support multi-input entities
Rework the route configuration code to support entities with multiple
sink pads.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_entity.c | 54 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_entity.h | 23 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_hsit.c | 7 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_lif.c | 1 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_lut.c | 1 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_rpf.c | 1 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_sru.c | 1 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_uds.c | 1 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_video.c | 7 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_wpf.c | 1 |
10 files changed, 54 insertions, 43 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c index 3fc9e4266caf..a9022f858aa5 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.c +++ b/drivers/media/platform/vsp1/vsp1_entity.c | |||
@@ -100,8 +100,10 @@ static int vsp1_entity_link_setup(struct media_entity *entity, | |||
100 | if (source->sink) | 100 | if (source->sink) |
101 | return -EBUSY; | 101 | return -EBUSY; |
102 | source->sink = remote->entity; | 102 | source->sink = remote->entity; |
103 | source->sink_pad = remote->index; | ||
103 | } else { | 104 | } else { |
104 | source->sink = NULL; | 105 | source->sink = NULL; |
106 | source->sink_pad = 0; | ||
105 | } | 107 | } |
106 | 108 | ||
107 | return 0; | 109 | return 0; |
@@ -116,42 +118,40 @@ const struct media_entity_operations vsp1_media_ops = { | |||
116 | * Initialization | 118 | * Initialization |
117 | */ | 119 | */ |
118 | 120 | ||
121 | static const struct vsp1_route vsp1_routes[] = { | ||
122 | { VSP1_ENTITY_HSI, 0, VI6_DPR_HSI_ROUTE, { VI6_DPR_NODE_HSI, } }, | ||
123 | { VSP1_ENTITY_HST, 0, VI6_DPR_HST_ROUTE, { VI6_DPR_NODE_HST, } }, | ||
124 | { VSP1_ENTITY_LIF, 0, 0, { VI6_DPR_NODE_LIF, } }, | ||
125 | { VSP1_ENTITY_LUT, 0, VI6_DPR_LUT_ROUTE, { VI6_DPR_NODE_LUT, } }, | ||
126 | { VSP1_ENTITY_RPF, 0, VI6_DPR_RPF_ROUTE(0), { VI6_DPR_NODE_RPF(0), } }, | ||
127 | { VSP1_ENTITY_RPF, 1, VI6_DPR_RPF_ROUTE(1), { VI6_DPR_NODE_RPF(1), } }, | ||
128 | { VSP1_ENTITY_RPF, 2, VI6_DPR_RPF_ROUTE(2), { VI6_DPR_NODE_RPF(2), } }, | ||
129 | { VSP1_ENTITY_RPF, 3, VI6_DPR_RPF_ROUTE(3), { VI6_DPR_NODE_RPF(3), } }, | ||
130 | { VSP1_ENTITY_RPF, 4, VI6_DPR_RPF_ROUTE(4), { VI6_DPR_NODE_RPF(4), } }, | ||
131 | { VSP1_ENTITY_SRU, 0, VI6_DPR_SRU_ROUTE, { VI6_DPR_NODE_SRU, } }, | ||
132 | { VSP1_ENTITY_UDS, 0, VI6_DPR_UDS_ROUTE(0), { VI6_DPR_NODE_UDS(0), } }, | ||
133 | { VSP1_ENTITY_UDS, 1, VI6_DPR_UDS_ROUTE(1), { VI6_DPR_NODE_UDS(1), } }, | ||
134 | { VSP1_ENTITY_UDS, 2, VI6_DPR_UDS_ROUTE(2), { VI6_DPR_NODE_UDS(2), } }, | ||
135 | { VSP1_ENTITY_WPF, 0, 0, { VI6_DPR_NODE_WPF(0), } }, | ||
136 | { VSP1_ENTITY_WPF, 1, 0, { VI6_DPR_NODE_WPF(1), } }, | ||
137 | { VSP1_ENTITY_WPF, 2, 0, { VI6_DPR_NODE_WPF(2), } }, | ||
138 | { VSP1_ENTITY_WPF, 3, 0, { VI6_DPR_NODE_WPF(3), } }, | ||
139 | }; | ||
140 | |||
119 | int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, | 141 | int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, |
120 | unsigned int num_pads) | 142 | unsigned int num_pads) |
121 | { | 143 | { |
122 | static const struct { | ||
123 | unsigned int id; | ||
124 | unsigned int reg; | ||
125 | } routes[] = { | ||
126 | { VI6_DPR_NODE_HSI, VI6_DPR_HSI_ROUTE }, | ||
127 | { VI6_DPR_NODE_HST, VI6_DPR_HST_ROUTE }, | ||
128 | { VI6_DPR_NODE_LIF, 0 }, | ||
129 | { VI6_DPR_NODE_LUT, VI6_DPR_LUT_ROUTE }, | ||
130 | { VI6_DPR_NODE_RPF(0), VI6_DPR_RPF_ROUTE(0) }, | ||
131 | { VI6_DPR_NODE_RPF(1), VI6_DPR_RPF_ROUTE(1) }, | ||
132 | { VI6_DPR_NODE_RPF(2), VI6_DPR_RPF_ROUTE(2) }, | ||
133 | { VI6_DPR_NODE_RPF(3), VI6_DPR_RPF_ROUTE(3) }, | ||
134 | { VI6_DPR_NODE_RPF(4), VI6_DPR_RPF_ROUTE(4) }, | ||
135 | { VI6_DPR_NODE_SRU, VI6_DPR_SRU_ROUTE }, | ||
136 | { VI6_DPR_NODE_UDS(0), VI6_DPR_UDS_ROUTE(0) }, | ||
137 | { VI6_DPR_NODE_UDS(1), VI6_DPR_UDS_ROUTE(1) }, | ||
138 | { VI6_DPR_NODE_UDS(2), VI6_DPR_UDS_ROUTE(2) }, | ||
139 | { VI6_DPR_NODE_WPF(0), 0 }, | ||
140 | { VI6_DPR_NODE_WPF(1), 0 }, | ||
141 | { VI6_DPR_NODE_WPF(2), 0 }, | ||
142 | { VI6_DPR_NODE_WPF(3), 0 }, | ||
143 | }; | ||
144 | |||
145 | unsigned int i; | 144 | unsigned int i; |
146 | 145 | ||
147 | for (i = 0; i < ARRAY_SIZE(routes); ++i) { | 146 | for (i = 0; i < ARRAY_SIZE(vsp1_routes); ++i) { |
148 | if (routes[i].id == entity->id) { | 147 | if (vsp1_routes[i].type == entity->type && |
149 | entity->route = routes[i].reg; | 148 | vsp1_routes[i].index == entity->index) { |
149 | entity->route = &vsp1_routes[i]; | ||
150 | break; | 150 | break; |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | if (i == ARRAY_SIZE(routes)) | 154 | if (i == ARRAY_SIZE(vsp1_routes)) |
155 | return -EINVAL; | 155 | return -EINVAL; |
156 | 156 | ||
157 | entity->vsp1 = vsp1; | 157 | entity->vsp1 = vsp1; |
diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index f6fd6988aeb0..3c6a5c831bcf 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h | |||
@@ -30,13 +30,31 @@ enum vsp1_entity_type { | |||
30 | VSP1_ENTITY_WPF, | 30 | VSP1_ENTITY_WPF, |
31 | }; | 31 | }; |
32 | 32 | ||
33 | /* | ||
34 | * struct vsp1_route - Entity routing configuration | ||
35 | * @type: Entity type this routing entry is associated with | ||
36 | * @index: Entity index this routing entry is associated with | ||
37 | * @reg: Output routing configuration register | ||
38 | * @inputs: Target node value for each input | ||
39 | * | ||
40 | * Each $vsp1_route entry describes routing configuration for the entity | ||
41 | * specified by the entry's @type and @index. @reg indicates the register that | ||
42 | * holds output routing configuration for the entity, and the @inputs array | ||
43 | * store the target node value for each input of the entity. | ||
44 | */ | ||
45 | struct vsp1_route { | ||
46 | enum vsp1_entity_type type; | ||
47 | unsigned int index; | ||
48 | unsigned int reg; | ||
49 | unsigned int inputs[4]; | ||
50 | }; | ||
51 | |||
33 | struct vsp1_entity { | 52 | struct vsp1_entity { |
34 | struct vsp1_device *vsp1; | 53 | struct vsp1_device *vsp1; |
35 | 54 | ||
36 | enum vsp1_entity_type type; | 55 | enum vsp1_entity_type type; |
37 | unsigned int index; | 56 | unsigned int index; |
38 | unsigned int id; | 57 | const struct vsp1_route *route; |
39 | unsigned int route; | ||
40 | 58 | ||
41 | struct list_head list_dev; | 59 | struct list_head list_dev; |
42 | struct list_head list_pipe; | 60 | struct list_head list_pipe; |
@@ -45,6 +63,7 @@ struct vsp1_entity { | |||
45 | unsigned int source_pad; | 63 | unsigned int source_pad; |
46 | 64 | ||
47 | struct media_entity *sink; | 65 | struct media_entity *sink; |
66 | unsigned int sink_pad; | ||
48 | 67 | ||
49 | struct v4l2_subdev subdev; | 68 | struct v4l2_subdev subdev; |
50 | struct v4l2_mbus_framefmt *formats; | 69 | struct v4l2_mbus_framefmt *formats; |
diff --git a/drivers/media/platform/vsp1/vsp1_hsit.c b/drivers/media/platform/vsp1/vsp1_hsit.c index 285485350d82..db2950a73c60 100644 --- a/drivers/media/platform/vsp1/vsp1_hsit.c +++ b/drivers/media/platform/vsp1/vsp1_hsit.c | |||
@@ -193,13 +193,10 @@ struct vsp1_hsit *vsp1_hsit_create(struct vsp1_device *vsp1, bool inverse) | |||
193 | 193 | ||
194 | hsit->inverse = inverse; | 194 | hsit->inverse = inverse; |
195 | 195 | ||
196 | if (inverse) { | 196 | if (inverse) |
197 | hsit->entity.type = VSP1_ENTITY_HSI; | 197 | hsit->entity.type = VSP1_ENTITY_HSI; |
198 | hsit->entity.id = VI6_DPR_NODE_HSI; | 198 | else |
199 | } else { | ||
200 | hsit->entity.type = VSP1_ENTITY_HST; | 199 | hsit->entity.type = VSP1_ENTITY_HST; |
201 | hsit->entity.id = VI6_DPR_NODE_HST; | ||
202 | } | ||
203 | 200 | ||
204 | ret = vsp1_entity_init(vsp1, &hsit->entity, 2); | 201 | ret = vsp1_entity_init(vsp1, &hsit->entity, 2); |
205 | if (ret < 0) | 202 | if (ret < 0) |
diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c index 135a78957014..d4fb23e9c4a8 100644 --- a/drivers/media/platform/vsp1/vsp1_lif.c +++ b/drivers/media/platform/vsp1/vsp1_lif.c | |||
@@ -215,7 +215,6 @@ struct vsp1_lif *vsp1_lif_create(struct vsp1_device *vsp1) | |||
215 | return ERR_PTR(-ENOMEM); | 215 | return ERR_PTR(-ENOMEM); |
216 | 216 | ||
217 | lif->entity.type = VSP1_ENTITY_LIF; | 217 | lif->entity.type = VSP1_ENTITY_LIF; |
218 | lif->entity.id = VI6_DPR_NODE_LIF; | ||
219 | 218 | ||
220 | ret = vsp1_entity_init(vsp1, &lif->entity, 2); | 219 | ret = vsp1_entity_init(vsp1, &lif->entity, 2); |
221 | if (ret < 0) | 220 | if (ret < 0) |
diff --git a/drivers/media/platform/vsp1/vsp1_lut.c b/drivers/media/platform/vsp1/vsp1_lut.c index 4e9dc7c86ef8..fea36ebe2565 100644 --- a/drivers/media/platform/vsp1/vsp1_lut.c +++ b/drivers/media/platform/vsp1/vsp1_lut.c | |||
@@ -229,7 +229,6 @@ struct vsp1_lut *vsp1_lut_create(struct vsp1_device *vsp1) | |||
229 | return ERR_PTR(-ENOMEM); | 229 | return ERR_PTR(-ENOMEM); |
230 | 230 | ||
231 | lut->entity.type = VSP1_ENTITY_LUT; | 231 | lut->entity.type = VSP1_ENTITY_LUT; |
232 | lut->entity.id = VI6_DPR_NODE_LUT; | ||
233 | 232 | ||
234 | ret = vsp1_entity_init(vsp1, &lut->entity, 2); | 233 | ret = vsp1_entity_init(vsp1, &lut->entity, 2); |
235 | if (ret < 0) | 234 | if (ret < 0) |
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index 2b04d0f95c62..42444568b9fd 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c | |||
@@ -176,7 +176,6 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index) | |||
176 | 176 | ||
177 | rpf->entity.type = VSP1_ENTITY_RPF; | 177 | rpf->entity.type = VSP1_ENTITY_RPF; |
178 | rpf->entity.index = index; | 178 | rpf->entity.index = index; |
179 | rpf->entity.id = VI6_DPR_NODE_RPF(index); | ||
180 | 179 | ||
181 | ret = vsp1_entity_init(vsp1, &rpf->entity, 2); | 180 | ret = vsp1_entity_init(vsp1, &rpf->entity, 2); |
182 | if (ret < 0) | 181 | if (ret < 0) |
diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c index 7ab1a0b2d656..aa0e04c56f3f 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.c +++ b/drivers/media/platform/vsp1/vsp1_sru.c | |||
@@ -327,7 +327,6 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1) | |||
327 | return ERR_PTR(-ENOMEM); | 327 | return ERR_PTR(-ENOMEM); |
328 | 328 | ||
329 | sru->entity.type = VSP1_ENTITY_SRU; | 329 | sru->entity.type = VSP1_ENTITY_SRU; |
330 | sru->entity.id = VI6_DPR_NODE_SRU; | ||
331 | 330 | ||
332 | ret = vsp1_entity_init(vsp1, &sru->entity, 2); | 331 | ret = vsp1_entity_init(vsp1, &sru->entity, 2); |
333 | if (ret < 0) | 332 | if (ret < 0) |
diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c index 1b20f28cbc39..0293bdbb4401 100644 --- a/drivers/media/platform/vsp1/vsp1_uds.c +++ b/drivers/media/platform/vsp1/vsp1_uds.c | |||
@@ -322,7 +322,6 @@ struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index) | |||
322 | 322 | ||
323 | uds->entity.type = VSP1_ENTITY_UDS; | 323 | uds->entity.type = VSP1_ENTITY_UDS; |
324 | uds->entity.index = index; | 324 | uds->entity.index = index; |
325 | uds->entity.id = VI6_DPR_NODE_UDS(index); | ||
326 | 325 | ||
327 | ret = vsp1_entity_init(vsp1, &uds->entity, 2); | 326 | ret = vsp1_entity_init(vsp1, &uds->entity, 2); |
328 | if (ret < 0) | 327 | if (ret < 0) |
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index a0595c17700f..1ef875d521da 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c | |||
@@ -461,7 +461,7 @@ static int vsp1_pipeline_stop(struct vsp1_pipeline *pipe) | |||
461 | 461 | ||
462 | list_for_each_entry(entity, &pipe->entities, list_pipe) { | 462 | list_for_each_entry(entity, &pipe->entities, list_pipe) { |
463 | if (entity->route) | 463 | if (entity->route) |
464 | vsp1_write(entity->vsp1, entity->route, | 464 | vsp1_write(entity->vsp1, entity->route->reg, |
465 | VI6_DPR_NODE_UNUSED); | 465 | VI6_DPR_NODE_UNUSED); |
466 | 466 | ||
467 | v4l2_subdev_call(&entity->subdev, video, s_stream, 0); | 467 | v4l2_subdev_call(&entity->subdev, video, s_stream, 0); |
@@ -680,11 +680,12 @@ static void vsp1_entity_route_setup(struct vsp1_entity *source) | |||
680 | { | 680 | { |
681 | struct vsp1_entity *sink; | 681 | struct vsp1_entity *sink; |
682 | 682 | ||
683 | if (source->route == 0) | 683 | if (source->route->reg == 0) |
684 | return; | 684 | return; |
685 | 685 | ||
686 | sink = container_of(source->sink, struct vsp1_entity, subdev.entity); | 686 | sink = container_of(source->sink, struct vsp1_entity, subdev.entity); |
687 | vsp1_write(source->vsp1, source->route, sink->id); | 687 | vsp1_write(source->vsp1, source->route->reg, |
688 | sink->route->inputs[source->sink_pad]); | ||
688 | } | 689 | } |
689 | 690 | ||
690 | static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int count) | 691 | static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int count) |
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 11a61c601da0..ef9f88ead319 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c | |||
@@ -181,7 +181,6 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index) | |||
181 | 181 | ||
182 | wpf->entity.type = VSP1_ENTITY_WPF; | 182 | wpf->entity.type = VSP1_ENTITY_WPF; |
183 | wpf->entity.index = index; | 183 | wpf->entity.index = index; |
184 | wpf->entity.id = VI6_DPR_NODE_WPF(index); | ||
185 | 184 | ||
186 | ret = vsp1_entity_init(vsp1, &wpf->entity, 2); | 185 | ret = vsp1_entity_init(vsp1, &wpf->entity, 2); |
187 | if (ret < 0) | 186 | if (ret < 0) |