History

[media] v4l: vsp1: Configure device based on IP version

The IP version number carries enough information to identify the exact device instance features. Drop the related DT properties and use the IP version instead.

Laurent Pinchart committed 10 years ago

Commit 5aa2eb31 parent 1517b0311 files · +116 −117Browse files

Unified · Split

11 files
  1. Documentation/devicetree/bindings/media/renesas,vsp1.txt +0 −21
  2. drivers/media/platform/vsp1/vsp1.h +3 −2
  3. drivers/media/platform/vsp1/vsp1_bru.c +1 −1
  4. drivers/media/platform/vsp1/vsp1_drm.c +3 −3
  5. drivers/media/platform/vsp1/vsp1_drv.c +96 −77
  6. drivers/media/platform/vsp1/vsp1_entity.c +1 −1
  7. drivers/media/platform/vsp1/vsp1_pipe.c +3 −3
  8. drivers/media/platform/vsp1/vsp1_rpf.c +2 −2
  9. drivers/media/platform/vsp1/vsp1_sru.c +2 −2
  10. drivers/media/platform/vsp1/vsp1_video.c +2 −2
  11. drivers/media/platform/vsp1/vsp1_wpf.c +3 −3
Documentation/devicetree/bindings/media/renesas,vsp1.txt+0−21
@@ -14,21 +14,6 @@ Required properties: · 13 unmodified lines
14 - interrupts: VSP interrupt specifier.14 - interrupts: VSP interrupt specifier.
15 - clocks: A phandle + clock-specifier pair for the VSP functional clock.15 - clocks: A phandle + clock-specifier pair for the VSP functional clock.
16 16
17 - renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP.
18 - renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the VSP.
19
20
21Optional properties:
22
23 - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP. Defaults
24 to 0 if not present.
25 - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
26 available.
27 - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
28 available.
29 - renesas,has-sru: Boolean, indicates that the Super Resolution Unit (SRU)
30 module is available.
31
32 17
33Example: R8A7790 (R-Car H2) VSP1-S node18Example: R8A7790 (R-Car H2) VSP1-S node
34 19
@@ -37,10 +22,4 @@ Example: R8A7790 (R-Car H2) VSP1-S node · 2 unmodified lines
37 reg = <0 0xfe928000 0 0x8000>;22 reg = <0 0xfe928000 0 0x8000>;
38 interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;23 interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
39 clocks = <&mstp1_clks R8A7790_CLK_VSP1_S>;24 clocks = <&mstp1_clks R8A7790_CLK_VSP1_S>;
40
41 renesas,has-lut;
42 renesas,has-sru;
43 renesas,#rpf = <5>;
44 renesas,#uds = <3>;
45 renesas,#wpf = <4>;
46 };25 };
drivers/media/platform/vsp1/vsp1.h+3−2
@@ -47,7 +47,8 @@ struct vsp1_uds; · 46 unmodified lines
47#define VSP1_HAS_SRU (1 << 2)47#define VSP1_HAS_SRU (1 << 2)
48#define VSP1_HAS_BRU (1 << 3)48#define VSP1_HAS_BRU (1 << 3)
49 49
50struct vsp1_platform_data {50struct vsp1_device_info {
51 u32 version;
51 unsigned int features;52 unsigned int features;
52 unsigned int rpf_count;53 unsigned int rpf_count;
53 unsigned int uds_count;54 unsigned int uds_count;
@@ -58,7 +59,7 @@ struct vsp1_platform_data { · 4 unmodified lines
58 59
59struct vsp1_device {60struct vsp1_device {
60 struct device *dev;61 struct device *dev;
61 struct vsp1_platform_data pdata;62 const struct vsp1_device_info *info;
62 63
63 void __iomem *mmio;64 void __iomem *mmio;
64 struct clk *clock;65 struct clk *clock;
drivers/media/platform/vsp1/vsp1_bru.c+1−1
@@ -416,7 +416,7 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1) · 415 unmodified lines
416 bru->entity.type = VSP1_ENTITY_BRU;416 bru->entity.type = VSP1_ENTITY_BRU;
417 417
418 ret = vsp1_entity_init(vsp1, &bru->entity,418 ret = vsp1_entity_init(vsp1, &bru->entity,
419 vsp1->pdata.num_bru_inputs + 1);419 vsp1->info->num_bru_inputs + 1);
420 if (ret < 0)420 if (ret < 0)
421 return ERR_PTR(ret);421 return ERR_PTR(ret);
422 422
drivers/media/platform/vsp1/vsp1_drm.c+3−3
@@ -285,7 +285,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, · 284 unmodified lines
285 unsigned long flags;285 unsigned long flags;
286 int ret;286 int ret;
287 287
288 if (rpf_index >= vsp1->pdata.rpf_count)288 if (rpf_index >= vsp1->info->rpf_count)
289 return -EINVAL;289 return -EINVAL;
290 290
291 rpf = vsp1->rpf[rpf_index];291 rpf = vsp1->rpf[rpf_index];
@@ -519,7 +519,7 @@ int vsp1_drm_create_links(struct vsp1_device *vsp1) · 227 unmodified lines
519 if (!vsp1->bru || !vsp1->lif)519 if (!vsp1->bru || !vsp1->lif)
520 return -ENXIO;520 return -ENXIO;
521 521
522 for (i = 0; i < vsp1->pdata.rpf_count; ++i) {522 for (i = 0; i < vsp1->info->rpf_count; ++i) {
523 struct vsp1_rwpf *rpf = vsp1->rpf[i];523 struct vsp1_rwpf *rpf = vsp1->rpf[i];
524 524
525 ret = media_create_pad_link(&rpf->entity.subdev.entity,525 ret = media_create_pad_link(&rpf->entity.subdev.entity,
@@ -572,7 +572,7 @@ int vsp1_drm_init(struct vsp1_device *vsp1) · 46 unmodified lines
572 pipe->frame_end = vsp1_drm_pipeline_frame_end;572 pipe->frame_end = vsp1_drm_pipeline_frame_end;
573 573
574 /* The DRM pipeline is static, add entities manually. */574 /* The DRM pipeline is static, add entities manually. */
575 for (i = 0; i < vsp1->pdata.rpf_count; ++i) {575 for (i = 0; i < vsp1->info->rpf_count; ++i) {
576 struct vsp1_rwpf *input = vsp1->rpf[i];576 struct vsp1_rwpf *input = vsp1->rpf[i];
577 577
578 list_add_tail(&input->entity.list_pipe, &pipe->entities);578 list_add_tail(&input->entity.list_pipe, &pipe->entities);
drivers/media/platform/vsp1/vsp1_drv.c+96−77
@@ -47,7 +47,7 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data) · 46 unmodified lines
47 unsigned int i;47 unsigned int i;
48 u32 status;48 u32 status;
49 49
50 for (i = 0; i < vsp1->pdata.wpf_count; ++i) {50 for (i = 0; i < vsp1->info->wpf_count; ++i) {
51 struct vsp1_rwpf *wpf = vsp1->wpf[i];51 struct vsp1_rwpf *wpf = vsp1->wpf[i];
52 struct vsp1_pipeline *pipe;52 struct vsp1_pipeline *pipe;
53 53
@@ -153,7 +153,7 @@ static int vsp1_uapi_create_links(struct vsp1_device *vsp1) · 99 unmodified lines
153 return ret;153 return ret;
154 }154 }
155 155
156 if (vsp1->pdata.features & VSP1_HAS_LIF) {156 if (vsp1->info->features & VSP1_HAS_LIF) {
157 ret = media_create_pad_link(&vsp1->wpf[0]->entity.subdev.entity,157 ret = media_create_pad_link(&vsp1->wpf[0]->entity.subdev.entity,
158 RWPF_PAD_SOURCE,158 RWPF_PAD_SOURCE,
159 &vsp1->lif->entity.subdev.entity,159 &vsp1->lif->entity.subdev.entity,
@@ -162,7 +162,7 @@ static int vsp1_uapi_create_links(struct vsp1_device *vsp1) · 2 unmodified lines
162 return ret;162 return ret;
163 }163 }
164 164
165 for (i = 0; i < vsp1->pdata.rpf_count; ++i) {165 for (i = 0; i < vsp1->info->rpf_count; ++i) {
166 struct vsp1_rwpf *rpf = vsp1->rpf[i];166 struct vsp1_rwpf *rpf = vsp1->rpf[i];
167 167
168 ret = media_create_pad_link(&rpf->video->video.entity, 0,168 ret = media_create_pad_link(&rpf->video->video.entity, 0,
@@ -174,7 +174,7 @@ static int vsp1_uapi_create_links(struct vsp1_device *vsp1) · 5 unmodified lines
174 return ret;174 return ret;
175 }175 }
176 176
177 for (i = 0; i < vsp1->pdata.wpf_count; ++i) {177 for (i = 0; i < vsp1->info->wpf_count; ++i) {
178 /* Connect the video device to the WPF. All connections are178 /* Connect the video device to the WPF. All connections are
179 * immutable except for the WPF0 source link if a LIF is179 * immutable except for the WPF0 source link if a LIF is
180 * present.180 * present.
@@ -182,7 +182,7 @@ static int vsp1_uapi_create_links(struct vsp1_device *vsp1) · 1 unmodified line
182 struct vsp1_rwpf *wpf = vsp1->wpf[i];182 struct vsp1_rwpf *wpf = vsp1->wpf[i];
183 unsigned int flags = MEDIA_LNK_FL_ENABLED;183 unsigned int flags = MEDIA_LNK_FL_ENABLED;
184 184
185 if (!(vsp1->pdata.features & VSP1_HAS_LIF) || i != 0)185 if (!(vsp1->info->features & VSP1_HAS_LIF) || i != 0)
186 flags |= MEDIA_LNK_FL_IMMUTABLE;186 flags |= MEDIA_LNK_FL_IMMUTABLE;
187 187
188 ret = media_create_pad_link(&wpf->entity.subdev.entity,188 ret = media_create_pad_link(&wpf->entity.subdev.entity,
@@ -215,7 +215,7 @@ static void vsp1_destroy_entities(struct vsp1_device *vsp1) · 26 unmodified lines
215 media_device_unregister(&vsp1->media_dev);215 media_device_unregister(&vsp1->media_dev);
216 media_device_cleanup(&vsp1->media_dev);216 media_device_cleanup(&vsp1->media_dev);
217 217
218 if (!vsp1->pdata.uapi)218 if (!vsp1->info->uapi)
219 vsp1_drm_cleanup(vsp1);219 vsp1_drm_cleanup(vsp1);
220}220}
221 221
@@ -238,7 +238,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 16 unmodified lines
238 * the pipeline is configured internally by the driver in that case, and238 * the pipeline is configured internally by the driver in that case, and
239 * its configuration can thus be trusted.239 * its configuration can thus be trusted.
240 */240 */
241 if (vsp1->pdata.uapi)241 if (vsp1->info->uapi)
242 vsp1->media_ops.link_validate = v4l2_subdev_link_validate;242 vsp1->media_ops.link_validate = v4l2_subdev_link_validate;
243 243
244 vdev->mdev = mdev;244 vdev->mdev = mdev;
@@ -250,7 +250,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 5 unmodified lines
250 }250 }
251 251
252 /* Instantiate all the entities. */252 /* Instantiate all the entities. */
253 if (vsp1->pdata.features & VSP1_HAS_BRU) {253 if (vsp1->info->features & VSP1_HAS_BRU) {
254 vsp1->bru = vsp1_bru_create(vsp1);254 vsp1->bru = vsp1_bru_create(vsp1);
255 if (IS_ERR(vsp1->bru)) {255 if (IS_ERR(vsp1->bru)) {
256 ret = PTR_ERR(vsp1->bru);256 ret = PTR_ERR(vsp1->bru);
@@ -276,7 +276,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 19 unmodified lines
276 276
277 list_add_tail(&vsp1->hst->entity.list_dev, &vsp1->entities);277 list_add_tail(&vsp1->hst->entity.list_dev, &vsp1->entities);
278 278
279 if (vsp1->pdata.features & VSP1_HAS_LIF) {279 if (vsp1->info->features & VSP1_HAS_LIF) {
280 vsp1->lif = vsp1_lif_create(vsp1);280 vsp1->lif = vsp1_lif_create(vsp1);
281 if (IS_ERR(vsp1->lif)) {281 if (IS_ERR(vsp1->lif)) {
282 ret = PTR_ERR(vsp1->lif);282 ret = PTR_ERR(vsp1->lif);
@@ -286,7 +286,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 3 unmodified lines
286 list_add_tail(&vsp1->lif->entity.list_dev, &vsp1->entities);286 list_add_tail(&vsp1->lif->entity.list_dev, &vsp1->entities);
287 }287 }
288 288
289 if (vsp1->pdata.features & VSP1_HAS_LUT) {289 if (vsp1->info->features & VSP1_HAS_LUT) {
290 vsp1->lut = vsp1_lut_create(vsp1);290 vsp1->lut = vsp1_lut_create(vsp1);
291 if (IS_ERR(vsp1->lut)) {291 if (IS_ERR(vsp1->lut)) {
292 ret = PTR_ERR(vsp1->lut);292 ret = PTR_ERR(vsp1->lut);
@@ -296,7 +296,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 3 unmodified lines
296 list_add_tail(&vsp1->lut->entity.list_dev, &vsp1->entities);296 list_add_tail(&vsp1->lut->entity.list_dev, &vsp1->entities);
297 }297 }
298 298
299 for (i = 0; i < vsp1->pdata.rpf_count; ++i) {299 for (i = 0; i < vsp1->info->rpf_count; ++i) {
300 struct vsp1_rwpf *rpf;300 struct vsp1_rwpf *rpf;
301 301
302 rpf = vsp1_rpf_create(vsp1, i);302 rpf = vsp1_rpf_create(vsp1, i);
@@ -308,7 +308,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 5 unmodified lines
308 vsp1->rpf[i] = rpf;308 vsp1->rpf[i] = rpf;
309 list_add_tail(&rpf->entity.list_dev, &vsp1->entities);309 list_add_tail(&rpf->entity.list_dev, &vsp1->entities);
310 310
311 if (vsp1->pdata.uapi) {311 if (vsp1->info->uapi) {
312 struct vsp1_video *video = vsp1_video_create(vsp1, rpf);312 struct vsp1_video *video = vsp1_video_create(vsp1, rpf);
313 313
314 if (IS_ERR(video)) {314 if (IS_ERR(video)) {
@@ -320,7 +320,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 5 unmodified lines
320 }320 }
321 }321 }
322 322
323 if (vsp1->pdata.features & VSP1_HAS_SRU) {323 if (vsp1->info->features & VSP1_HAS_SRU) {
324 vsp1->sru = vsp1_sru_create(vsp1);324 vsp1->sru = vsp1_sru_create(vsp1);
325 if (IS_ERR(vsp1->sru)) {325 if (IS_ERR(vsp1->sru)) {
326 ret = PTR_ERR(vsp1->sru);326 ret = PTR_ERR(vsp1->sru);
@@ -330,7 +330,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 3 unmodified lines
330 list_add_tail(&vsp1->sru->entity.list_dev, &vsp1->entities);330 list_add_tail(&vsp1->sru->entity.list_dev, &vsp1->entities);
331 }331 }
332 332
333 for (i = 0; i < vsp1->pdata.uds_count; ++i) {333 for (i = 0; i < vsp1->info->uds_count; ++i) {
334 struct vsp1_uds *uds;334 struct vsp1_uds *uds;
335 335
336 uds = vsp1_uds_create(vsp1, i);336 uds = vsp1_uds_create(vsp1, i);
@@ -343,7 +343,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 6 unmodified lines
343 list_add_tail(&uds->entity.list_dev, &vsp1->entities);343 list_add_tail(&uds->entity.list_dev, &vsp1->entities);
344 }344 }
345 345
346 for (i = 0; i < vsp1->pdata.wpf_count; ++i) {346 for (i = 0; i < vsp1->info->wpf_count; ++i) {
347 struct vsp1_rwpf *wpf;347 struct vsp1_rwpf *wpf;
348 348
349 wpf = vsp1_wpf_create(vsp1, i);349 wpf = vsp1_wpf_create(vsp1, i);
@@ -355,7 +355,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 5 unmodified lines
355 vsp1->wpf[i] = wpf;355 vsp1->wpf[i] = wpf;
356 list_add_tail(&wpf->entity.list_dev, &vsp1->entities);356 list_add_tail(&wpf->entity.list_dev, &vsp1->entities);
357 357
358 if (vsp1->pdata.uapi) {358 if (vsp1->info->uapi) {
359 struct vsp1_video *video = vsp1_video_create(vsp1, wpf);359 struct vsp1_video *video = vsp1_video_create(vsp1, wpf);
360 360
361 if (IS_ERR(video)) {361 if (IS_ERR(video)) {
@@ -377,7 +377,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 15 unmodified lines
377 }377 }
378 378
379 /* Create links. */379 /* Create links. */
380 if (vsp1->pdata.uapi)380 if (vsp1->info->uapi)
381 ret = vsp1_uapi_create_links(vsp1);381 ret = vsp1_uapi_create_links(vsp1);
382 else382 else
383 ret = vsp1_drm_create_links(vsp1);383 ret = vsp1_drm_create_links(vsp1);
@@ -387,7 +387,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) · 3 unmodified lines
387 /* Register subdev nodes if the userspace API is enabled or initialize387 /* Register subdev nodes if the userspace API is enabled or initialize
388 * the DRM pipeline otherwise.388 * the DRM pipeline otherwise.
389 */389 */
390 if (vsp1->pdata.uapi) {390 if (vsp1->info->uapi) {
391 vsp1->use_dl = false;391 vsp1->use_dl = false;
392 ret = v4l2_device_register_subdev_nodes(&vsp1->v4l2_dev);392 ret = v4l2_device_register_subdev_nodes(&vsp1->v4l2_dev);
393 } else {393 } else {
@@ -438,7 +438,7 @@ static int vsp1_device_init(struct vsp1_device *vsp1) · 44 unmodified lines
438 int ret;438 int ret;
439 439
440 /* Reset any channel that might be running. */440 /* Reset any channel that might be running. */
441 for (i = 0; i < vsp1->pdata.wpf_count; ++i) {441 for (i = 0; i < vsp1->info->wpf_count; ++i) {
442 ret = vsp1_reset_wpf(vsp1, i);442 ret = vsp1_reset_wpf(vsp1, i);
443 if (ret < 0)443 if (ret < 0)
444 return ret;444 return ret;
@@ -447,10 +447,10 @@ static int vsp1_device_init(struct vsp1_device *vsp1) · 2 unmodified lines
447 vsp1_write(vsp1, VI6_CLK_DCSWT, (8 << VI6_CLK_DCSWT_CSTPW_SHIFT) |447 vsp1_write(vsp1, VI6_CLK_DCSWT, (8 << VI6_CLK_DCSWT_CSTPW_SHIFT) |
448 (8 << VI6_CLK_DCSWT_CSTRW_SHIFT));448 (8 << VI6_CLK_DCSWT_CSTRW_SHIFT));
449 449
450 for (i = 0; i < vsp1->pdata.rpf_count; ++i)450 for (i = 0; i < vsp1->info->rpf_count; ++i)
451 vsp1_write(vsp1, VI6_DPR_RPF_ROUTE(i), VI6_DPR_NODE_UNUSED);451 vsp1_write(vsp1, VI6_DPR_RPF_ROUTE(i), VI6_DPR_NODE_UNUSED);
452 452
453 for (i = 0; i < vsp1->pdata.uds_count; ++i)453 for (i = 0; i < vsp1->info->uds_count; ++i)
454 vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED);454 vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED);
455 455
456 vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED);456 vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED);
@@ -567,52 +567,75 @@ static const struct dev_pm_ops vsp1_pm_ops = { · 110 unmodified lines
567 * Platform Driver567 * Platform Driver
568 */568 */
569 569
570static int vsp1_parse_dt(struct vsp1_device *vsp1)570static const struct vsp1_device_info vsp1_device_infos[] = {
571{571 {
572 struct device_node *np = vsp1->dev->of_node;572 .version = VI6_IP_VERSION_MODEL_VSPS_H2,
573 struct vsp1_platform_data *pdata = &vsp1->pdata;573 .features = VSP1_HAS_BRU | VSP1_HAS_LUT | VSP1_HAS_SRU,
574 574 .rpf_count = 5,
575 if (of_property_read_bool(np, "renesas,has-lif"))575 .uds_count = 3,
576 pdata->features |= VSP1_HAS_LIF;576 .wpf_count = 4,
577 if (of_property_read_bool(np, "renesas,has-lut"))577 .num_bru_inputs = 4,
578 pdata->features |= VSP1_HAS_LUT;578 .uapi = true,
579 if (of_property_read_bool(np, "renesas,has-sru"))579 }, {
580 pdata->features |= VSP1_HAS_SRU;580 .version = VI6_IP_VERSION_MODEL_VSPR_H2,
581 581 .features = VSP1_HAS_BRU | VSP1_HAS_SRU,
582 of_property_read_u32(np, "renesas,#rpf", &pdata->rpf_count);582 .rpf_count = 5,
583 of_property_read_u32(np, "renesas,#uds", &pdata->uds_count);583 .uds_count = 1,
584 of_property_read_u32(np, "renesas,#wpf", &pdata->wpf_count);584 .wpf_count = 4,
585 585 .num_bru_inputs = 4,
586 if (pdata->rpf_count <= 0 || pdata->rpf_count > VSP1_MAX_RPF) {586 .uapi = true,
587 dev_err(vsp1->dev, "invalid number of RPF (%u)\n",587 }, {
588 pdata->rpf_count);588 .version = VI6_IP_VERSION_MODEL_VSPD_GEN2,
589 return -EINVAL;589 .features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_LUT,
590 }590 .rpf_count = 4,
591 591 .uds_count = 1,
592 if (pdata->uds_count > VSP1_MAX_UDS) {592 .wpf_count = 4,
593 dev_err(vsp1->dev, "invalid number of UDS (%u)\n",593 .num_bru_inputs = 4,
594 pdata->uds_count);594 .uapi = true,
595 return -EINVAL;595 }, {
596 }596 .version = VI6_IP_VERSION_MODEL_VSPS_M2,
597 597 .features = VSP1_HAS_BRU | VSP1_HAS_LUT | VSP1_HAS_SRU,
598 if (pdata->wpf_count <= 0 || pdata->wpf_count > VSP1_MAX_WPF) {598 .rpf_count = 5,
599 dev_err(vsp1->dev, "invalid number of WPF (%u)\n",599 .uds_count = 3,
600 pdata->wpf_count);600 .wpf_count = 4,
601 return -EINVAL;601 .num_bru_inputs = 4,
602 }602 .uapi = true,
603 603 }, {
604 pdata->features |= VSP1_HAS_BRU;604 .version = VI6_IP_VERSION_MODEL_VSPI_GEN3,
605 pdata->num_bru_inputs = 4;605 .features = VSP1_HAS_LUT | VSP1_HAS_SRU,
606 pdata->uapi = true;606 .rpf_count = 1,
607 607 .uds_count = 1,
608 return 0;608 .wpf_count = 1,
609}609 .uapi = true,
610 }, {
611 .version = VI6_IP_VERSION_MODEL_VSPBD_GEN3,
612 .features = VSP1_HAS_BRU,
613 .rpf_count = 5,
614 .wpf_count = 1,
615 .num_bru_inputs = 5,
616 .uapi = true,
617 }, {
618 .version = VI6_IP_VERSION_MODEL_VSPBC_GEN3,
619 .features = VSP1_HAS_BRU | VSP1_HAS_LUT,
620 .rpf_count = 5,
621 .wpf_count = 1,
622 .num_bru_inputs = 5,
623 .uapi = true,
624 }, {
625 .version = VI6_IP_VERSION_MODEL_VSPD_GEN3,
626 .features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_LUT,
627 .rpf_count = 5,
628 .wpf_count = 2,
629 .num_bru_inputs = 5,
630 },
631};
610 632
611static int vsp1_probe(struct platform_device *pdev)633static int vsp1_probe(struct platform_device *pdev)
612{634{
613 struct vsp1_device *vsp1;635 struct vsp1_device *vsp1;
614 struct resource *irq;636 struct resource *irq;
615 struct resource *io;637 struct resource *io;
638 unsigned int i;
616 u32 version;639 u32 version;
617 int ret;640 int ret;
618 641
@@ -625,10 +648,6 @@ static int vsp1_probe(struct platform_device *pdev) · 6 unmodified lines
625 INIT_LIST_HEAD(&vsp1->entities);648 INIT_LIST_HEAD(&vsp1->entities);
626 INIT_LIST_HEAD(&vsp1->videos);649 INIT_LIST_HEAD(&vsp1->videos);
627 650
628 ret = vsp1_parse_dt(vsp1);
629 if (ret < 0)
630 return ret;
631
632 /* I/O, IRQ and clock resources */651 /* I/O, IRQ and clock resources */
633 io = platform_get_resource(pdev, IORESOURCE_MEM, 0);652 io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
634 vsp1->mmio = devm_ioremap_resource(&pdev->dev, io);653 vsp1->mmio = devm_ioremap_resource(&pdev->dev, io);
@@ -662,21 +681,21 @@ static int vsp1_probe(struct platform_device *pdev) · 27 unmodified lines
662 version = vsp1_read(vsp1, VI6_IP_VERSION);681 version = vsp1_read(vsp1, VI6_IP_VERSION);
663 clk_disable_unprepare(vsp1->clock);682 clk_disable_unprepare(vsp1->clock);
664 683
665 dev_dbg(&pdev->dev, "IP version 0x%08x\n", version);684 for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) {
685 if ((version & VI6_IP_VERSION_MODEL_MASK) ==
686 vsp1_device_infos[i].version) {
687 vsp1->info = &vsp1_device_infos[i];
688 break;
689 }
690 }
666 691
667 switch (version & VI6_IP_VERSION_MODEL_MASK) {692 if (!vsp1->info) {
668 case VI6_IP_VERSION_MODEL_VSPD_GEN3:693 dev_err(&pdev->dev, "unsupported IP version 0x%08x\n", version);
669 vsp1->pdata.num_bru_inputs = 5;694 return -ENXIO;
670 vsp1->pdata.uapi = false;
671 break;
672
673 case VI6_IP_VERSION_MODEL_VSPI_GEN3:
674 case VI6_IP_VERSION_MODEL_VSPBD_GEN3:
675 case VI6_IP_VERSION_MODEL_VSPBC_GEN3:
676 vsp1->pdata.features &= ~VSP1_HAS_BRU;
677 break;
678 }695 }
679 696
697 dev_dbg(&pdev->dev, "IP version 0x%08x\n", version);
698
680 /* Instanciate entities */699 /* Instanciate entities */
681 ret = vsp1_create_entities(vsp1);700 ret = vsp1_create_entities(vsp1);
682 if (ret < 0) {701 if (ret < 0) {
drivers/media/platform/vsp1/vsp1_entity.c+1−1
@@ -45,7 +45,7 @@ int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming) · 44 unmodified lines
45 if (!streaming)45 if (!streaming)
46 return 0;46 return 0;
47 47
48 if (!entity->vsp1->pdata.uapi || !entity->subdev.ctrl_handler)48 if (!entity->vsp1->info->uapi || !entity->subdev.ctrl_handler)
49 return 0;49 return 0;
50 50
51 ret = v4l2_ctrl_handler_setup(entity->subdev.ctrl_handler);51 ret = v4l2_ctrl_handler_setup(entity->subdev.ctrl_handler);
drivers/media/platform/vsp1/vsp1_pipe.c+3−3
@@ -368,7 +368,7 @@ void vsp1_pipelines_suspend(struct vsp1_device *vsp1) · 367 unmodified lines
368 * pipelines twice, first to set them all to the stopping state, and368 * pipelines twice, first to set them all to the stopping state, and
369 * then to wait for the stop to complete.369 * then to wait for the stop to complete.
370 */370 */
371 for (i = 0; i < vsp1->pdata.wpf_count; ++i) {371 for (i = 0; i < vsp1->info->wpf_count; ++i) {
372 struct vsp1_rwpf *wpf = vsp1->wpf[i];372 struct vsp1_rwpf *wpf = vsp1->wpf[i];
373 struct vsp1_pipeline *pipe;373 struct vsp1_pipeline *pipe;
374 374
@@ -385,7 +385,7 @@ void vsp1_pipelines_suspend(struct vsp1_device *vsp1) · 10 unmodified lines
385 spin_unlock_irqrestore(&pipe->irqlock, flags);385 spin_unlock_irqrestore(&pipe->irqlock, flags);
386 }386 }
387 387
388 for (i = 0; i < vsp1->pdata.wpf_count; ++i) {388 for (i = 0; i < vsp1->info->wpf_count; ++i) {
389 struct vsp1_rwpf *wpf = vsp1->wpf[i];389 struct vsp1_rwpf *wpf = vsp1->wpf[i];
390 struct vsp1_pipeline *pipe;390 struct vsp1_pipeline *pipe;
391 391
@@ -409,7 +409,7 @@ void vsp1_pipelines_resume(struct vsp1_device *vsp1) · 17 unmodified lines
409 unsigned int i;409 unsigned int i;
410 410
411 /* Resume pipeline all running pipelines. */411 /* Resume pipeline all running pipelines. */
412 for (i = 0; i < vsp1->pdata.wpf_count; ++i) {412 for (i = 0; i < vsp1->info->wpf_count; ++i) {
413 struct vsp1_rwpf *wpf = vsp1->wpf[i];413 struct vsp1_rwpf *wpf = vsp1->wpf[i];
414 struct vsp1_pipeline *pipe;414 struct vsp1_pipeline *pipe;
415 415
drivers/media/platform/vsp1/vsp1_rpf.c+2−2
@@ -151,12 +151,12 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) · 150 unmodified lines
151 (fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED151 (fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED
152 : VI6_RPF_ALPH_SEL_ASEL_FIXED));152 : VI6_RPF_ALPH_SEL_ASEL_FIXED));
153 153
154 if (vsp1->pdata.uapi)154 if (vsp1->info->uapi)
155 mutex_lock(rpf->ctrls.lock);155 mutex_lock(rpf->ctrls.lock);
156 vsp1_rpf_write(rpf, VI6_RPF_VRTCOL_SET,156 vsp1_rpf_write(rpf, VI6_RPF_VRTCOL_SET,
157 rpf->alpha->cur.val << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);157 rpf->alpha->cur.val << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);
158 vsp1_pipeline_propagate_alpha(pipe, &rpf->entity, rpf->alpha->cur.val);158 vsp1_pipeline_propagate_alpha(pipe, &rpf->entity, rpf->alpha->cur.val);
159 if (vsp1->pdata.uapi)159 if (vsp1->info->uapi)
160 mutex_unlock(rpf->ctrls.lock);160 mutex_unlock(rpf->ctrls.lock);
161 161
162 vsp1_rpf_write(rpf, VI6_RPF_MSK_CTRL, 0);162 vsp1_rpf_write(rpf, VI6_RPF_MSK_CTRL, 0);
drivers/media/platform/vsp1/vsp1_sru.c+2−2
@@ -151,12 +151,12 @@ static int sru_s_stream(struct v4l2_subdev *subdev, int enable) · 150 unmodified lines
151 /* Take the control handler lock to ensure that the CTRL0 value won't be151 /* Take the control handler lock to ensure that the CTRL0 value won't be
152 * changed behind our back by a set control operation.152 * changed behind our back by a set control operation.
153 */153 */
154 if (sru->entity.vsp1->pdata.uapi)154 if (sru->entity.vsp1->info->uapi)
155 mutex_lock(sru->ctrls.lock);155 mutex_lock(sru->ctrls.lock);
156 ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0)156 ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0)
157 & (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK);157 & (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK);
158 vsp1_sru_write(sru, VI6_SRU_CTRL0, ctrl0);158 vsp1_sru_write(sru, VI6_SRU_CTRL0, ctrl0);
159 if (sru->entity.vsp1->pdata.uapi)159 if (sru->entity.vsp1->info->uapi)
160 mutex_unlock(sru->ctrls.lock);160 mutex_unlock(sru->ctrls.lock);
161 161
162 vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5);162 vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5);
drivers/media/platform/vsp1/vsp1_video.c+2−2
@@ -324,7 +324,7 @@ static int vsp1_video_pipeline_validate(struct vsp1_pipeline *pipe, · 323 unmodified lines
324 /* Follow links downstream for each input and make sure the graph324 /* Follow links downstream for each input and make sure the graph
325 * contains no loop and that all branches end at the output WPF.325 * contains no loop and that all branches end at the output WPF.
326 */326 */
327 for (i = 0; i < video->vsp1->pdata.rpf_count; ++i) {327 for (i = 0; i < video->vsp1->info->rpf_count; ++i) {
328 if (!pipe->inputs[i])328 if (!pipe->inputs[i])
329 continue;329 continue;
330 330
@@ -456,7 +456,7 @@ static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe) · 125 unmodified lines
456 unsigned int i;456 unsigned int i;
457 457
458 /* Complete buffers on all video nodes. */458 /* Complete buffers on all video nodes. */
459 for (i = 0; i < vsp1->pdata.rpf_count; ++i) {459 for (i = 0; i < vsp1->info->rpf_count; ++i) {
460 if (!pipe->inputs[i])460 if (!pipe->inputs[i])
461 continue;461 continue;
462 462
drivers/media/platform/vsp1/vsp1_wpf.c+3−3
@@ -98,7 +98,7 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) · 97 unmodified lines
98 * inputs as sub-layers and select the virtual RPF as the master98 * inputs as sub-layers and select the virtual RPF as the master
99 * layer.99 * layer.
100 */100 */
101 for (i = 0; i < vsp1->pdata.rpf_count; ++i) {101 for (i = 0; i < vsp1->info->rpf_count; ++i) {
102 struct vsp1_rwpf *input = pipe->inputs[i];102 struct vsp1_rwpf *input = pipe->inputs[i];
103 103
104 if (!input)104 if (!input)
@@ -155,11 +155,11 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) · 50 unmodified lines
155 /* Take the control handler lock to ensure that the PDV value won't be155 /* Take the control handler lock to ensure that the PDV value won't be
156 * changed behind our back by a set control operation.156 * changed behind our back by a set control operation.
157 */157 */
158 if (vsp1->pdata.uapi)158 if (vsp1->info->uapi)
159 mutex_lock(wpf->ctrls.lock);159 mutex_lock(wpf->ctrls.lock);
160 outfmt |= wpf->alpha->cur.val << VI6_WPF_OUTFMT_PDV_SHIFT;160 outfmt |= wpf->alpha->cur.val << VI6_WPF_OUTFMT_PDV_SHIFT;
161 vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, outfmt);161 vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, outfmt);
162 if (vsp1->pdata.uapi)162 if (vsp1->info->uapi)
163 mutex_unlock(wpf->ctrls.lock);163 mutex_unlock(wpf->ctrls.lock);
164 164
165 vsp1_mod_write(&wpf->entity, VI6_DPR_WPF_FPORCH(wpf->entity.index),165 vsp1_mod_write(&wpf->entity, VI6_DPR_WPF_FPORCH(wpf->entity.index),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t