Lines Matching full:csi

47 	struct sun4i_csi *csi = container_of(notifier, struct sun4i_csi,  in sun4i_csi_notify_bound()  local
50 csi->src_subdev = subdev; in sun4i_csi_notify_bound()
51 csi->src_pad = media_entity_get_fwnode_pad(&subdev->entity, in sun4i_csi_notify_bound()
54 if (csi->src_pad < 0) { in sun4i_csi_notify_bound()
55 dev_err(csi->dev, "Couldn't find output pad for subdev %s\n", in sun4i_csi_notify_bound()
57 return csi->src_pad; in sun4i_csi_notify_bound()
60 dev_dbg(csi->dev, "Bound %s pad: %d\n", subdev->name, csi->src_pad); in sun4i_csi_notify_bound()
66 struct sun4i_csi *csi = container_of(notifier, struct sun4i_csi, in sun4i_csi_notify_complete() local
68 struct v4l2_subdev *subdev = &csi->subdev; in sun4i_csi_notify_complete()
69 struct video_device *vdev = &csi->vdev; in sun4i_csi_notify_complete()
72 ret = v4l2_device_register_subdev(&csi->v4l, subdev); in sun4i_csi_notify_complete()
76 ret = sun4i_csi_v4l2_register(csi); in sun4i_csi_notify_complete()
80 ret = media_device_register(&csi->mdev); in sun4i_csi_notify_complete()
92 ret = media_create_pad_link(&csi->src_subdev->entity, csi->src_pad, in sun4i_csi_notify_complete()
99 ret = v4l2_device_register_subdev_nodes(&csi->v4l); in sun4i_csi_notify_complete()
106 media_device_unregister(&csi->mdev); in sun4i_csi_notify_complete()
116 static int sun4i_csi_notifier_init(struct sun4i_csi *csi) in sun4i_csi_notifier_init() argument
125 v4l2_async_nf_init(&csi->notifier); in sun4i_csi_notifier_init()
127 ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(csi->dev), 0, 0, in sun4i_csi_notifier_init()
136 csi->bus = vep.bus.parallel; in sun4i_csi_notifier_init()
138 asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, ep, in sun4i_csi_notifier_init()
145 csi->notifier.ops = &sun4i_csi_notify_ops; in sun4i_csi_notifier_init()
156 struct sun4i_csi *csi; in sun4i_csi_probe() local
160 csi = devm_kzalloc(&pdev->dev, sizeof(*csi), GFP_KERNEL); in sun4i_csi_probe()
161 if (!csi) in sun4i_csi_probe()
163 platform_set_drvdata(pdev, csi); in sun4i_csi_probe()
164 csi->dev = &pdev->dev; in sun4i_csi_probe()
165 subdev = &csi->subdev; in sun4i_csi_probe()
166 vdev = &csi->vdev; in sun4i_csi_probe()
168 csi->traits = of_device_get_match_data(&pdev->dev); in sun4i_csi_probe()
169 if (!csi->traits) in sun4i_csi_probe()
172 csi->mdev.dev = csi->dev; in sun4i_csi_probe()
173 strscpy(csi->mdev.model, "Allwinner Video Capture Device", in sun4i_csi_probe()
174 sizeof(csi->mdev.model)); in sun4i_csi_probe()
175 csi->mdev.hw_revision = 0; in sun4i_csi_probe()
176 media_device_init(&csi->mdev); in sun4i_csi_probe()
177 csi->v4l.mdev = &csi->mdev; in sun4i_csi_probe()
179 csi->regs = devm_platform_ioremap_resource(pdev, 0); in sun4i_csi_probe()
180 if (IS_ERR(csi->regs)) in sun4i_csi_probe()
181 return PTR_ERR(csi->regs); in sun4i_csi_probe()
187 csi->bus_clk = devm_clk_get(&pdev->dev, "bus"); in sun4i_csi_probe()
188 if (IS_ERR(csi->bus_clk)) { in sun4i_csi_probe()
190 return PTR_ERR(csi->bus_clk); in sun4i_csi_probe()
193 if (csi->traits->has_isp) { in sun4i_csi_probe()
194 csi->isp_clk = devm_clk_get(&pdev->dev, "isp"); in sun4i_csi_probe()
195 if (IS_ERR(csi->isp_clk)) { in sun4i_csi_probe()
197 return PTR_ERR(csi->isp_clk); in sun4i_csi_probe()
201 csi->ram_clk = devm_clk_get(&pdev->dev, "ram"); in sun4i_csi_probe()
202 if (IS_ERR(csi->ram_clk)) { in sun4i_csi_probe()
204 return PTR_ERR(csi->ram_clk); in sun4i_csi_probe()
207 csi->rst = devm_reset_control_get(&pdev->dev, NULL); in sun4i_csi_probe()
208 if (IS_ERR(csi->rst)) { in sun4i_csi_probe()
210 return PTR_ERR(csi->rst); in sun4i_csi_probe()
218 snprintf(subdev->name, sizeof(subdev->name), "sun4i-csi-0"); in sun4i_csi_probe()
219 v4l2_set_subdevdata(subdev, csi); in sun4i_csi_probe()
221 csi->subdev_pads[CSI_SUBDEV_SINK].flags = in sun4i_csi_probe()
223 csi->subdev_pads[CSI_SUBDEV_SOURCE].flags = MEDIA_PAD_FL_SOURCE; in sun4i_csi_probe()
225 csi->subdev_pads); in sun4i_csi_probe()
229 csi->vdev_pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; in sun4i_csi_probe()
231 ret = media_entity_pads_init(&vdev->entity, 1, &csi->vdev_pad); in sun4i_csi_probe()
235 ret = sun4i_csi_dma_register(csi, irq); in sun4i_csi_probe()
239 ret = sun4i_csi_notifier_init(csi); in sun4i_csi_probe()
243 ret = v4l2_async_nf_register(&csi->v4l, &csi->notifier); in sun4i_csi_probe()
245 dev_err(csi->dev, "Couldn't register our notifier.\n"); in sun4i_csi_probe()
254 media_device_unregister(&csi->mdev); in sun4i_csi_probe()
255 sun4i_csi_dma_unregister(csi); in sun4i_csi_probe()
258 media_device_cleanup(&csi->mdev); in sun4i_csi_probe()
265 struct sun4i_csi *csi = platform_get_drvdata(pdev); in sun4i_csi_remove() local
267 v4l2_async_nf_unregister(&csi->notifier); in sun4i_csi_remove()
268 v4l2_async_nf_cleanup(&csi->notifier); in sun4i_csi_remove()
269 vb2_video_unregister_device(&csi->vdev); in sun4i_csi_remove()
270 media_device_unregister(&csi->mdev); in sun4i_csi_remove()
271 sun4i_csi_dma_unregister(csi); in sun4i_csi_remove()
272 media_device_cleanup(&csi->mdev); in sun4i_csi_remove()
298 struct sun4i_csi *csi = dev_get_drvdata(dev); in sun4i_csi_runtime_resume() local
300 reset_control_deassert(csi->rst); in sun4i_csi_runtime_resume()
301 clk_prepare_enable(csi->bus_clk); in sun4i_csi_runtime_resume()
302 clk_prepare_enable(csi->ram_clk); in sun4i_csi_runtime_resume()
303 clk_set_rate(csi->isp_clk, 80000000); in sun4i_csi_runtime_resume()
304 clk_prepare_enable(csi->isp_clk); in sun4i_csi_runtime_resume()
306 writel(1, csi->regs + CSI_EN_REG); in sun4i_csi_runtime_resume()
313 struct sun4i_csi *csi = dev_get_drvdata(dev); in sun4i_csi_runtime_suspend() local
315 clk_disable_unprepare(csi->isp_clk); in sun4i_csi_runtime_suspend()
316 clk_disable_unprepare(csi->ram_clk); in sun4i_csi_runtime_suspend()
317 clk_disable_unprepare(csi->bus_clk); in sun4i_csi_runtime_suspend()
319 reset_control_assert(csi->rst); in sun4i_csi_runtime_suspend()
334 .name = "sun4i-csi",