• Home
  • Raw
  • Download

Lines Matching refs:vsp1

39 	struct vsp1_device *vsp1 = data;  in vsp1_irq_handler()  local
43 for (i = 0; i < vsp1->pdata.wpf_count; ++i) { in vsp1_irq_handler()
44 struct vsp1_rwpf *wpf = vsp1->wpf[i]; in vsp1_irq_handler()
52 status = vsp1_read(vsp1, VI6_WPF_IRQ_STA(i)); in vsp1_irq_handler()
53 vsp1_write(vsp1, VI6_WPF_IRQ_STA(i), ~status & mask); in vsp1_irq_handler()
78 static int vsp1_create_links(struct vsp1_device *vsp1, struct vsp1_entity *sink) in vsp1_create_links() argument
85 list_for_each_entry(source, &vsp1->entities, list_dev) { in vsp1_create_links()
118 static void vsp1_destroy_entities(struct vsp1_device *vsp1) in vsp1_destroy_entities() argument
123 list_for_each_entry_safe(entity, next, &vsp1->entities, list_dev) { in vsp1_destroy_entities()
128 v4l2_device_unregister(&vsp1->v4l2_dev); in vsp1_destroy_entities()
129 media_device_unregister(&vsp1->media_dev); in vsp1_destroy_entities()
132 static int vsp1_create_entities(struct vsp1_device *vsp1) in vsp1_create_entities() argument
134 struct media_device *mdev = &vsp1->media_dev; in vsp1_create_entities()
135 struct v4l2_device *vdev = &vsp1->v4l2_dev; in vsp1_create_entities()
140 mdev->dev = vsp1->dev; in vsp1_create_entities()
146 dev_err(vsp1->dev, "media device registration failed (%d)\n", in vsp1_create_entities()
152 ret = v4l2_device_register(vsp1->dev, vdev); in vsp1_create_entities()
154 dev_err(vsp1->dev, "V4L2 device registration failed (%d)\n", in vsp1_create_entities()
160 vsp1->bru = vsp1_bru_create(vsp1); in vsp1_create_entities()
161 if (IS_ERR(vsp1->bru)) { in vsp1_create_entities()
162 ret = PTR_ERR(vsp1->bru); in vsp1_create_entities()
166 list_add_tail(&vsp1->bru->entity.list_dev, &vsp1->entities); in vsp1_create_entities()
168 vsp1->hsi = vsp1_hsit_create(vsp1, true); in vsp1_create_entities()
169 if (IS_ERR(vsp1->hsi)) { in vsp1_create_entities()
170 ret = PTR_ERR(vsp1->hsi); in vsp1_create_entities()
174 list_add_tail(&vsp1->hsi->entity.list_dev, &vsp1->entities); in vsp1_create_entities()
176 vsp1->hst = vsp1_hsit_create(vsp1, false); in vsp1_create_entities()
177 if (IS_ERR(vsp1->hst)) { in vsp1_create_entities()
178 ret = PTR_ERR(vsp1->hst); in vsp1_create_entities()
182 list_add_tail(&vsp1->hst->entity.list_dev, &vsp1->entities); in vsp1_create_entities()
184 if (vsp1->pdata.features & VSP1_HAS_LIF) { in vsp1_create_entities()
185 vsp1->lif = vsp1_lif_create(vsp1); in vsp1_create_entities()
186 if (IS_ERR(vsp1->lif)) { in vsp1_create_entities()
187 ret = PTR_ERR(vsp1->lif); in vsp1_create_entities()
191 list_add_tail(&vsp1->lif->entity.list_dev, &vsp1->entities); in vsp1_create_entities()
194 if (vsp1->pdata.features & VSP1_HAS_LUT) { in vsp1_create_entities()
195 vsp1->lut = vsp1_lut_create(vsp1); in vsp1_create_entities()
196 if (IS_ERR(vsp1->lut)) { in vsp1_create_entities()
197 ret = PTR_ERR(vsp1->lut); in vsp1_create_entities()
201 list_add_tail(&vsp1->lut->entity.list_dev, &vsp1->entities); in vsp1_create_entities()
204 for (i = 0; i < vsp1->pdata.rpf_count; ++i) { in vsp1_create_entities()
207 rpf = vsp1_rpf_create(vsp1, i); in vsp1_create_entities()
213 vsp1->rpf[i] = rpf; in vsp1_create_entities()
214 list_add_tail(&rpf->entity.list_dev, &vsp1->entities); in vsp1_create_entities()
217 if (vsp1->pdata.features & VSP1_HAS_SRU) { in vsp1_create_entities()
218 vsp1->sru = vsp1_sru_create(vsp1); in vsp1_create_entities()
219 if (IS_ERR(vsp1->sru)) { in vsp1_create_entities()
220 ret = PTR_ERR(vsp1->sru); in vsp1_create_entities()
224 list_add_tail(&vsp1->sru->entity.list_dev, &vsp1->entities); in vsp1_create_entities()
227 for (i = 0; i < vsp1->pdata.uds_count; ++i) { in vsp1_create_entities()
230 uds = vsp1_uds_create(vsp1, i); in vsp1_create_entities()
236 vsp1->uds[i] = uds; in vsp1_create_entities()
237 list_add_tail(&uds->entity.list_dev, &vsp1->entities); in vsp1_create_entities()
240 for (i = 0; i < vsp1->pdata.wpf_count; ++i) { in vsp1_create_entities()
243 wpf = vsp1_wpf_create(vsp1, i); in vsp1_create_entities()
249 vsp1->wpf[i] = wpf; in vsp1_create_entities()
250 list_add_tail(&wpf->entity.list_dev, &vsp1->entities); in vsp1_create_entities()
254 list_for_each_entry(entity, &vsp1->entities, list_dev) { in vsp1_create_entities()
259 ret = vsp1_create_links(vsp1, entity); in vsp1_create_entities()
264 if (vsp1->pdata.features & VSP1_HAS_LIF) { in vsp1_create_entities()
266 &vsp1->wpf[0]->entity.subdev.entity, RWPF_PAD_SOURCE, in vsp1_create_entities()
267 &vsp1->lif->entity.subdev.entity, LIF_PAD_SINK, 0); in vsp1_create_entities()
273 list_for_each_entry(entity, &vsp1->entities, list_dev) { in vsp1_create_entities()
274 ret = v4l2_device_register_subdev(&vsp1->v4l2_dev, in vsp1_create_entities()
280 ret = v4l2_device_register_subdev_nodes(&vsp1->v4l2_dev); in vsp1_create_entities()
284 vsp1_destroy_entities(vsp1); in vsp1_create_entities()
289 static int vsp1_device_init(struct vsp1_device *vsp1) in vsp1_device_init() argument
295 status = vsp1_read(vsp1, VI6_STATUS); in vsp1_device_init()
297 for (i = 0; i < vsp1->pdata.wpf_count; ++i) { in vsp1_device_init()
303 vsp1_write(vsp1, VI6_SRESET, VI6_SRESET_SRTS(i)); in vsp1_device_init()
305 status = vsp1_read(vsp1, VI6_STATUS); in vsp1_device_init()
313 dev_err(vsp1->dev, "failed to reset wpf.%u\n", i); in vsp1_device_init()
318 vsp1_write(vsp1, VI6_CLK_DCSWT, (8 << VI6_CLK_DCSWT_CSTPW_SHIFT) | in vsp1_device_init()
321 for (i = 0; i < vsp1->pdata.rpf_count; ++i) in vsp1_device_init()
322 vsp1_write(vsp1, VI6_DPR_RPF_ROUTE(i), VI6_DPR_NODE_UNUSED); in vsp1_device_init()
324 for (i = 0; i < vsp1->pdata.uds_count; ++i) in vsp1_device_init()
325 vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED); in vsp1_device_init()
327 vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED); in vsp1_device_init()
328 vsp1_write(vsp1, VI6_DPR_LUT_ROUTE, VI6_DPR_NODE_UNUSED); in vsp1_device_init()
329 vsp1_write(vsp1, VI6_DPR_CLU_ROUTE, VI6_DPR_NODE_UNUSED); in vsp1_device_init()
330 vsp1_write(vsp1, VI6_DPR_HST_ROUTE, VI6_DPR_NODE_UNUSED); in vsp1_device_init()
331 vsp1_write(vsp1, VI6_DPR_HSI_ROUTE, VI6_DPR_NODE_UNUSED); in vsp1_device_init()
332 vsp1_write(vsp1, VI6_DPR_BRU_ROUTE, VI6_DPR_NODE_UNUSED); in vsp1_device_init()
334 vsp1_write(vsp1, VI6_DPR_HGO_SMPPT, (7 << VI6_DPR_SMPPT_TGW_SHIFT) | in vsp1_device_init()
336 vsp1_write(vsp1, VI6_DPR_HGT_SMPPT, (7 << VI6_DPR_SMPPT_TGW_SHIFT) | in vsp1_device_init()
350 int vsp1_device_get(struct vsp1_device *vsp1) in vsp1_device_get() argument
354 mutex_lock(&vsp1->lock); in vsp1_device_get()
355 if (vsp1->ref_count > 0) in vsp1_device_get()
358 ret = clk_prepare_enable(vsp1->clock); in vsp1_device_get()
362 ret = vsp1_device_init(vsp1); in vsp1_device_get()
364 clk_disable_unprepare(vsp1->clock); in vsp1_device_get()
370 vsp1->ref_count++; in vsp1_device_get()
372 mutex_unlock(&vsp1->lock); in vsp1_device_get()
382 void vsp1_device_put(struct vsp1_device *vsp1) in vsp1_device_put() argument
384 mutex_lock(&vsp1->lock); in vsp1_device_put()
386 if (--vsp1->ref_count == 0) in vsp1_device_put()
387 clk_disable_unprepare(vsp1->clock); in vsp1_device_put()
389 mutex_unlock(&vsp1->lock); in vsp1_device_put()
399 struct vsp1_device *vsp1 = dev_get_drvdata(dev); in vsp1_pm_suspend() local
401 WARN_ON(mutex_is_locked(&vsp1->lock)); in vsp1_pm_suspend()
403 if (vsp1->ref_count == 0) in vsp1_pm_suspend()
406 vsp1_pipelines_suspend(vsp1); in vsp1_pm_suspend()
408 clk_disable_unprepare(vsp1->clock); in vsp1_pm_suspend()
415 struct vsp1_device *vsp1 = dev_get_drvdata(dev); in vsp1_pm_resume() local
417 WARN_ON(mutex_is_locked(&vsp1->lock)); in vsp1_pm_resume()
419 if (vsp1->ref_count == 0) in vsp1_pm_resume()
422 clk_prepare_enable(vsp1->clock); in vsp1_pm_resume()
424 vsp1_pipelines_resume(vsp1); in vsp1_pm_resume()
438 static int vsp1_parse_dt(struct vsp1_device *vsp1) in vsp1_parse_dt() argument
440 struct device_node *np = vsp1->dev->of_node; in vsp1_parse_dt()
441 struct vsp1_platform_data *pdata = &vsp1->pdata; in vsp1_parse_dt()
455 dev_err(vsp1->dev, "invalid number of RPF (%u)\n", in vsp1_parse_dt()
461 dev_err(vsp1->dev, "invalid number of UDS (%u)\n", in vsp1_parse_dt()
467 dev_err(vsp1->dev, "invalid number of WPF (%u)\n", in vsp1_parse_dt()
477 struct vsp1_device *vsp1; in vsp1_probe() local
482 vsp1 = devm_kzalloc(&pdev->dev, sizeof(*vsp1), GFP_KERNEL); in vsp1_probe()
483 if (vsp1 == NULL) in vsp1_probe()
486 vsp1->dev = &pdev->dev; in vsp1_probe()
487 mutex_init(&vsp1->lock); in vsp1_probe()
488 INIT_LIST_HEAD(&vsp1->entities); in vsp1_probe()
490 ret = vsp1_parse_dt(vsp1); in vsp1_probe()
496 vsp1->mmio = devm_ioremap_resource(&pdev->dev, io); in vsp1_probe()
497 if (IS_ERR(vsp1->mmio)) in vsp1_probe()
498 return PTR_ERR(vsp1->mmio); in vsp1_probe()
500 vsp1->clock = devm_clk_get(&pdev->dev, NULL); in vsp1_probe()
501 if (IS_ERR(vsp1->clock)) { in vsp1_probe()
503 return PTR_ERR(vsp1->clock); in vsp1_probe()
513 IRQF_SHARED, dev_name(&pdev->dev), vsp1); in vsp1_probe()
520 ret = vsp1_create_entities(vsp1); in vsp1_probe()
526 platform_set_drvdata(pdev, vsp1); in vsp1_probe()
533 struct vsp1_device *vsp1 = platform_get_drvdata(pdev); in vsp1_remove() local
535 vsp1_destroy_entities(vsp1); in vsp1_remove()