Lines Matching refs:nvdec

33 struct nvdec {  struct
46 static inline struct nvdec *to_nvdec(struct tegra_drm_client *client) in to_nvdec() argument
48 return container_of(client, struct nvdec, client); in to_nvdec()
51 static inline void nvdec_writel(struct nvdec *nvdec, u32 value, in nvdec_writel() argument
54 writel(value, nvdec->regs + offset); in nvdec_writel()
57 static int nvdec_boot(struct nvdec *nvdec) in nvdec_boot() argument
60 struct iommu_fwspec *spec = dev_iommu_fwspec_get(nvdec->dev); in nvdec_boot()
65 if (nvdec->config->supports_sid && spec) { in nvdec_boot()
69 nvdec_writel(nvdec, value, NVDEC_TFBIF_TRANSCFG); in nvdec_boot()
74 nvdec_writel(nvdec, value, VIC_THI_STREAMID0); in nvdec_boot()
75 nvdec_writel(nvdec, value, VIC_THI_STREAMID1); in nvdec_boot()
80 err = falcon_boot(&nvdec->falcon); in nvdec_boot()
84 err = falcon_wait_idle(&nvdec->falcon); in nvdec_boot()
86 dev_err(nvdec->dev, "falcon boot timed out\n"); in nvdec_boot()
98 struct nvdec *nvdec = to_nvdec(drm); in nvdec_init() local
103 dev_err(nvdec->dev, "failed to attach to domain: %d\n", err); in nvdec_init()
107 nvdec->channel = host1x_channel_request(client); in nvdec_init()
108 if (!nvdec->channel) { in nvdec_init()
141 host1x_channel_put(nvdec->channel); in nvdec_init()
153 struct nvdec *nvdec = to_nvdec(drm); in nvdec_exit() local
167 host1x_channel_put(nvdec->channel); in nvdec_exit()
170 nvdec->channel = NULL; in nvdec_exit()
173 dma_unmap_single(nvdec->dev, nvdec->falcon.firmware.phys, in nvdec_exit()
174 nvdec->falcon.firmware.size, DMA_TO_DEVICE); in nvdec_exit()
175 tegra_drm_free(tegra, nvdec->falcon.firmware.size, in nvdec_exit()
176 nvdec->falcon.firmware.virt, in nvdec_exit()
177 nvdec->falcon.firmware.iova); in nvdec_exit()
179 dma_free_coherent(nvdec->dev, nvdec->falcon.firmware.size, in nvdec_exit()
180 nvdec->falcon.firmware.virt, in nvdec_exit()
181 nvdec->falcon.firmware.iova); in nvdec_exit()
192 static int nvdec_load_firmware(struct nvdec *nvdec) in nvdec_load_firmware() argument
194 struct host1x_client *client = &nvdec->client.base; in nvdec_load_firmware()
195 struct tegra_drm *tegra = nvdec->client.drm; in nvdec_load_firmware()
201 if (nvdec->falcon.firmware.virt) in nvdec_load_firmware()
204 err = falcon_read_firmware(&nvdec->falcon, nvdec->config->firmware); in nvdec_load_firmware()
208 size = nvdec->falcon.firmware.size; in nvdec_load_firmware()
211 virt = dma_alloc_coherent(nvdec->dev, size, &iova, GFP_KERNEL); in nvdec_load_firmware()
213 err = dma_mapping_error(nvdec->dev, iova); in nvdec_load_firmware()
220 nvdec->falcon.firmware.virt = virt; in nvdec_load_firmware()
221 nvdec->falcon.firmware.iova = iova; in nvdec_load_firmware()
223 err = falcon_load_firmware(&nvdec->falcon); in nvdec_load_firmware()
235 phys = dma_map_single(nvdec->dev, virt, size, DMA_TO_DEVICE); in nvdec_load_firmware()
237 err = dma_mapping_error(nvdec->dev, phys); in nvdec_load_firmware()
241 nvdec->falcon.firmware.phys = phys; in nvdec_load_firmware()
248 dma_free_coherent(nvdec->dev, size, virt, iova); in nvdec_load_firmware()
258 struct nvdec *nvdec = dev_get_drvdata(dev); in nvdec_runtime_resume() local
261 err = clk_prepare_enable(nvdec->clk); in nvdec_runtime_resume()
267 err = nvdec_load_firmware(nvdec); in nvdec_runtime_resume()
271 err = nvdec_boot(nvdec); in nvdec_runtime_resume()
278 clk_disable_unprepare(nvdec->clk); in nvdec_runtime_resume()
284 struct nvdec *nvdec = dev_get_drvdata(dev); in nvdec_runtime_suspend() local
286 host1x_channel_stop(nvdec->channel); in nvdec_runtime_suspend()
288 clk_disable_unprepare(nvdec->clk); in nvdec_runtime_suspend()
296 struct nvdec *nvdec = to_nvdec(client); in nvdec_open_channel() local
298 context->channel = host1x_channel_get(nvdec->channel); in nvdec_open_channel()
361 struct nvdec *nvdec; in nvdec_probe() local
372 nvdec = devm_kzalloc(dev, sizeof(*nvdec), GFP_KERNEL); in nvdec_probe()
373 if (!nvdec) in nvdec_probe()
376 nvdec->config = of_device_get_match_data(dev); in nvdec_probe()
382 nvdec->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); in nvdec_probe()
383 if (IS_ERR(nvdec->regs)) in nvdec_probe()
384 return PTR_ERR(nvdec->regs); in nvdec_probe()
386 nvdec->clk = devm_clk_get(dev, NULL); in nvdec_probe()
387 if (IS_ERR(nvdec->clk)) { in nvdec_probe()
389 return PTR_ERR(nvdec->clk); in nvdec_probe()
392 err = clk_set_rate(nvdec->clk, ULONG_MAX); in nvdec_probe()
402 nvdec->falcon.dev = dev; in nvdec_probe()
403 nvdec->falcon.regs = nvdec->regs; in nvdec_probe()
405 err = falcon_init(&nvdec->falcon); in nvdec_probe()
409 platform_set_drvdata(pdev, nvdec); in nvdec_probe()
411 INIT_LIST_HEAD(&nvdec->client.base.list); in nvdec_probe()
412 nvdec->client.base.ops = &nvdec_client_ops; in nvdec_probe()
413 nvdec->client.base.dev = dev; in nvdec_probe()
414 nvdec->client.base.class = host_class; in nvdec_probe()
415 nvdec->client.base.syncpts = syncpts; in nvdec_probe()
416 nvdec->client.base.num_syncpts = 1; in nvdec_probe()
417 nvdec->dev = dev; in nvdec_probe()
419 INIT_LIST_HEAD(&nvdec->client.list); in nvdec_probe()
420 nvdec->client.version = nvdec->config->version; in nvdec_probe()
421 nvdec->client.ops = &nvdec_ops; in nvdec_probe()
423 err = host1x_client_register(&nvdec->client.base); in nvdec_probe()
432 falcon_exit(&nvdec->falcon); in nvdec_probe()
439 struct nvdec *nvdec = platform_get_drvdata(pdev); in nvdec_remove() local
442 err = host1x_client_unregister(&nvdec->client.base); in nvdec_remove()
449 falcon_exit(&nvdec->falcon); in nvdec_remove()