Lines Matching refs:nvdec
30 struct nvdec { struct
43 static inline struct nvdec *to_nvdec(struct tegra_drm_client *client) in to_nvdec() argument
45 return container_of(client, struct nvdec, client); in to_nvdec()
48 static inline void nvdec_writel(struct nvdec *nvdec, u32 value, in nvdec_writel() argument
51 writel(value, nvdec->regs + offset); in nvdec_writel()
54 static int nvdec_boot(struct nvdec *nvdec) in nvdec_boot() argument
57 struct iommu_fwspec *spec = dev_iommu_fwspec_get(nvdec->dev); in nvdec_boot()
62 if (nvdec->config->supports_sid && spec) { in nvdec_boot()
66 nvdec_writel(nvdec, value, VIC_TFBIF_TRANSCFG); in nvdec_boot()
71 nvdec_writel(nvdec, value, VIC_THI_STREAMID0); in nvdec_boot()
72 nvdec_writel(nvdec, value, VIC_THI_STREAMID1); in nvdec_boot()
77 err = falcon_boot(&nvdec->falcon); in nvdec_boot()
81 err = falcon_wait_idle(&nvdec->falcon); in nvdec_boot()
83 dev_err(nvdec->dev, "falcon boot timed out\n"); in nvdec_boot()
95 struct nvdec *nvdec = to_nvdec(drm); in nvdec_init() local
100 dev_err(nvdec->dev, "failed to attach to domain: %d\n", err); in nvdec_init()
104 nvdec->channel = host1x_channel_request(client); in nvdec_init()
105 if (!nvdec->channel) { in nvdec_init()
138 host1x_channel_put(nvdec->channel); in nvdec_init()
150 struct nvdec *nvdec = to_nvdec(drm); in nvdec_exit() local
164 host1x_channel_put(nvdec->channel); in nvdec_exit()
167 nvdec->channel = NULL; in nvdec_exit()
170 dma_unmap_single(nvdec->dev, nvdec->falcon.firmware.phys, in nvdec_exit()
171 nvdec->falcon.firmware.size, DMA_TO_DEVICE); in nvdec_exit()
172 tegra_drm_free(tegra, nvdec->falcon.firmware.size, in nvdec_exit()
173 nvdec->falcon.firmware.virt, in nvdec_exit()
174 nvdec->falcon.firmware.iova); in nvdec_exit()
176 dma_free_coherent(nvdec->dev, nvdec->falcon.firmware.size, in nvdec_exit()
177 nvdec->falcon.firmware.virt, in nvdec_exit()
178 nvdec->falcon.firmware.iova); in nvdec_exit()
189 static int nvdec_load_firmware(struct nvdec *nvdec) in nvdec_load_firmware() argument
191 struct host1x_client *client = &nvdec->client.base; in nvdec_load_firmware()
192 struct tegra_drm *tegra = nvdec->client.drm; in nvdec_load_firmware()
198 if (nvdec->falcon.firmware.virt) in nvdec_load_firmware()
201 err = falcon_read_firmware(&nvdec->falcon, nvdec->config->firmware); in nvdec_load_firmware()
205 size = nvdec->falcon.firmware.size; in nvdec_load_firmware()
208 virt = dma_alloc_coherent(nvdec->dev, size, &iova, GFP_KERNEL); in nvdec_load_firmware()
210 err = dma_mapping_error(nvdec->dev, iova); in nvdec_load_firmware()
217 nvdec->falcon.firmware.virt = virt; in nvdec_load_firmware()
218 nvdec->falcon.firmware.iova = iova; in nvdec_load_firmware()
220 err = falcon_load_firmware(&nvdec->falcon); in nvdec_load_firmware()
232 phys = dma_map_single(nvdec->dev, virt, size, DMA_TO_DEVICE); in nvdec_load_firmware()
234 err = dma_mapping_error(nvdec->dev, phys); in nvdec_load_firmware()
238 nvdec->falcon.firmware.phys = phys; in nvdec_load_firmware()
245 dma_free_coherent(nvdec->dev, size, virt, iova); in nvdec_load_firmware()
255 struct nvdec *nvdec = dev_get_drvdata(dev); in nvdec_runtime_resume() local
258 err = clk_prepare_enable(nvdec->clk); in nvdec_runtime_resume()
264 err = nvdec_load_firmware(nvdec); in nvdec_runtime_resume()
268 err = nvdec_boot(nvdec); in nvdec_runtime_resume()
275 clk_disable_unprepare(nvdec->clk); in nvdec_runtime_resume()
281 struct nvdec *nvdec = dev_get_drvdata(dev); in nvdec_runtime_suspend() local
283 host1x_channel_stop(nvdec->channel); in nvdec_runtime_suspend()
285 clk_disable_unprepare(nvdec->clk); in nvdec_runtime_suspend()
293 struct nvdec *nvdec = to_nvdec(client); in nvdec_open_channel() local
295 context->channel = host1x_channel_get(nvdec->channel); in nvdec_open_channel()
349 struct nvdec *nvdec; in nvdec_probe() local
360 nvdec = devm_kzalloc(dev, sizeof(*nvdec), GFP_KERNEL); in nvdec_probe()
361 if (!nvdec) in nvdec_probe()
364 nvdec->config = of_device_get_match_data(dev); in nvdec_probe()
370 nvdec->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); in nvdec_probe()
371 if (IS_ERR(nvdec->regs)) in nvdec_probe()
372 return PTR_ERR(nvdec->regs); in nvdec_probe()
374 nvdec->clk = devm_clk_get(dev, NULL); in nvdec_probe()
375 if (IS_ERR(nvdec->clk)) { in nvdec_probe()
377 return PTR_ERR(nvdec->clk); in nvdec_probe()
380 err = clk_set_rate(nvdec->clk, ULONG_MAX); in nvdec_probe()
390 nvdec->falcon.dev = dev; in nvdec_probe()
391 nvdec->falcon.regs = nvdec->regs; in nvdec_probe()
393 err = falcon_init(&nvdec->falcon); in nvdec_probe()
397 platform_set_drvdata(pdev, nvdec); in nvdec_probe()
399 INIT_LIST_HEAD(&nvdec->client.base.list); in nvdec_probe()
400 nvdec->client.base.ops = &nvdec_client_ops; in nvdec_probe()
401 nvdec->client.base.dev = dev; in nvdec_probe()
402 nvdec->client.base.class = host_class; in nvdec_probe()
403 nvdec->client.base.syncpts = syncpts; in nvdec_probe()
404 nvdec->client.base.num_syncpts = 1; in nvdec_probe()
405 nvdec->dev = dev; in nvdec_probe()
407 INIT_LIST_HEAD(&nvdec->client.list); in nvdec_probe()
408 nvdec->client.version = nvdec->config->version; in nvdec_probe()
409 nvdec->client.ops = &nvdec_ops; in nvdec_probe()
411 err = host1x_client_register(&nvdec->client.base); in nvdec_probe()
420 falcon_exit(&nvdec->falcon); in nvdec_probe()
427 struct nvdec *nvdec = platform_get_drvdata(pdev); in nvdec_remove() local
430 err = host1x_client_unregister(&nvdec->client.base); in nvdec_remove()
437 falcon_exit(&nvdec->falcon); in nvdec_remove()