Lines Matching full:csi

50 	struct sun4i_csi *csi = container_of(notifier, struct sun4i_csi,  in sun4i_csi_notify_bound()  local
53 csi->src_subdev = subdev; in sun4i_csi_notify_bound()
54 csi->src_pad = media_entity_get_fwnode_pad(&subdev->entity, in sun4i_csi_notify_bound()
57 if (csi->src_pad < 0) { in sun4i_csi_notify_bound()
58 dev_err(csi->dev, "Couldn't find output pad for subdev %s\n", in sun4i_csi_notify_bound()
60 return csi->src_pad; in sun4i_csi_notify_bound()
63 dev_dbg(csi->dev, "Bound %s pad: %d\n", subdev->name, csi->src_pad); in sun4i_csi_notify_bound()
69 struct sun4i_csi *csi = container_of(notifier, struct sun4i_csi, in sun4i_csi_notify_complete() local
71 struct v4l2_subdev *subdev = &csi->subdev; in sun4i_csi_notify_complete()
72 struct video_device *vdev = &csi->vdev; in sun4i_csi_notify_complete()
75 ret = v4l2_device_register_subdev(&csi->v4l, subdev); in sun4i_csi_notify_complete()
79 ret = sun4i_csi_v4l2_register(csi); in sun4i_csi_notify_complete()
83 ret = media_device_register(&csi->mdev); in sun4i_csi_notify_complete()
95 ret = media_create_pad_link(&csi->src_subdev->entity, csi->src_pad, in sun4i_csi_notify_complete()
102 ret = v4l2_device_register_subdev_nodes(&csi->v4l); in sun4i_csi_notify_complete()
109 media_device_unregister(&csi->mdev); in sun4i_csi_notify_complete()
119 static int sun4i_csi_notifier_init(struct sun4i_csi *csi) in sun4i_csi_notifier_init() argument
128 v4l2_async_nf_init(&csi->notifier, &csi->v4l); in sun4i_csi_notifier_init()
130 ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(csi->dev), 0, 0, in sun4i_csi_notifier_init()
139 csi->bus = vep.bus.parallel; in sun4i_csi_notifier_init()
141 asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, ep, in sun4i_csi_notifier_init()
148 csi->notifier.ops = &sun4i_csi_notify_ops; in sun4i_csi_notifier_init()
159 struct sun4i_csi *csi; in sun4i_csi_probe() local
163 csi = devm_kzalloc(&pdev->dev, sizeof(*csi), GFP_KERNEL); in sun4i_csi_probe()
164 if (!csi) in sun4i_csi_probe()
166 platform_set_drvdata(pdev, csi); in sun4i_csi_probe()
167 csi->dev = &pdev->dev; in sun4i_csi_probe()
168 subdev = &csi->subdev; in sun4i_csi_probe()
169 vdev = &csi->vdev; in sun4i_csi_probe()
171 csi->traits = of_device_get_match_data(&pdev->dev); in sun4i_csi_probe()
172 if (!csi->traits) in sun4i_csi_probe()
175 csi->mdev.dev = csi->dev; in sun4i_csi_probe()
176 strscpy(csi->mdev.model, "Allwinner Video Capture Device", in sun4i_csi_probe()
177 sizeof(csi->mdev.model)); in sun4i_csi_probe()
178 csi->mdev.hw_revision = 0; in sun4i_csi_probe()
179 media_device_init(&csi->mdev); in sun4i_csi_probe()
180 csi->v4l.mdev = &csi->mdev; in sun4i_csi_probe()
182 csi->regs = devm_platform_ioremap_resource(pdev, 0); in sun4i_csi_probe()
183 if (IS_ERR(csi->regs)) in sun4i_csi_probe()
184 return PTR_ERR(csi->regs); in sun4i_csi_probe()
190 csi->bus_clk = devm_clk_get(&pdev->dev, "bus"); in sun4i_csi_probe()
191 if (IS_ERR(csi->bus_clk)) { in sun4i_csi_probe()
193 return PTR_ERR(csi->bus_clk); in sun4i_csi_probe()
196 if (csi->traits->has_isp) { in sun4i_csi_probe()
197 csi->isp_clk = devm_clk_get(&pdev->dev, "isp"); in sun4i_csi_probe()
198 if (IS_ERR(csi->isp_clk)) { in sun4i_csi_probe()
200 return PTR_ERR(csi->isp_clk); in sun4i_csi_probe()
204 csi->ram_clk = devm_clk_get(&pdev->dev, "ram"); in sun4i_csi_probe()
205 if (IS_ERR(csi->ram_clk)) { in sun4i_csi_probe()
207 return PTR_ERR(csi->ram_clk); in sun4i_csi_probe()
210 csi->rst = devm_reset_control_get(&pdev->dev, NULL); in sun4i_csi_probe()
211 if (IS_ERR(csi->rst)) { in sun4i_csi_probe()
213 return PTR_ERR(csi->rst); in sun4i_csi_probe()
222 snprintf(subdev->name, sizeof(subdev->name), "sun4i-csi-0"); in sun4i_csi_probe()
223 v4l2_set_subdevdata(subdev, csi); in sun4i_csi_probe()
225 csi->subdev_pads[CSI_SUBDEV_SINK].flags = in sun4i_csi_probe()
227 csi->subdev_pads[CSI_SUBDEV_SOURCE].flags = MEDIA_PAD_FL_SOURCE; in sun4i_csi_probe()
229 csi->subdev_pads); in sun4i_csi_probe()
233 csi->vdev_pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; in sun4i_csi_probe()
235 ret = media_entity_pads_init(&vdev->entity, 1, &csi->vdev_pad); in sun4i_csi_probe()
239 ret = sun4i_csi_dma_register(csi, irq); in sun4i_csi_probe()
243 ret = sun4i_csi_notifier_init(csi); in sun4i_csi_probe()
247 ret = v4l2_async_nf_register(&csi->notifier); in sun4i_csi_probe()
249 dev_err(csi->dev, "Couldn't register our notifier.\n"); in sun4i_csi_probe()
258 media_device_unregister(&csi->mdev); in sun4i_csi_probe()
259 sun4i_csi_dma_unregister(csi); in sun4i_csi_probe()
262 media_device_cleanup(&csi->mdev); in sun4i_csi_probe()
269 struct sun4i_csi *csi = platform_get_drvdata(pdev); in sun4i_csi_remove() local
272 v4l2_async_nf_unregister(&csi->notifier); in sun4i_csi_remove()
273 v4l2_async_nf_cleanup(&csi->notifier); in sun4i_csi_remove()
274 vb2_video_unregister_device(&csi->vdev); in sun4i_csi_remove()
275 media_device_unregister(&csi->mdev); in sun4i_csi_remove()
276 sun4i_csi_dma_unregister(csi); in sun4i_csi_remove()
277 media_device_cleanup(&csi->mdev); in sun4i_csi_remove()
301 struct sun4i_csi *csi = dev_get_drvdata(dev); in sun4i_csi_runtime_resume() local
303 reset_control_deassert(csi->rst); in sun4i_csi_runtime_resume()
304 clk_prepare_enable(csi->bus_clk); in sun4i_csi_runtime_resume()
305 clk_prepare_enable(csi->ram_clk); in sun4i_csi_runtime_resume()
306 clk_set_rate(csi->isp_clk, 80000000); in sun4i_csi_runtime_resume()
307 clk_prepare_enable(csi->isp_clk); in sun4i_csi_runtime_resume()
309 writel(1, csi->regs + CSI_EN_REG); in sun4i_csi_runtime_resume()
316 struct sun4i_csi *csi = dev_get_drvdata(dev); in sun4i_csi_runtime_suspend() local
318 clk_disable_unprepare(csi->isp_clk); in sun4i_csi_runtime_suspend()
319 clk_disable_unprepare(csi->ram_clk); in sun4i_csi_runtime_suspend()
320 clk_disable_unprepare(csi->bus_clk); in sun4i_csi_runtime_suspend()
322 reset_control_assert(csi->rst); in sun4i_csi_runtime_suspend()
337 .name = "sun4i-csi",