Lines Matching refs:vic

30 struct vic {  struct
44 static inline struct vic *to_vic(struct tegra_drm_client *client) in to_vic() argument
46 return container_of(client, struct vic, client); in to_vic()
49 static void vic_writel(struct vic *vic, u32 value, unsigned int offset) in vic_writel() argument
51 writel(value, vic->regs + offset); in vic_writel()
54 static int vic_boot(struct vic *vic) in vic_boot() argument
57 struct iommu_fwspec *spec = dev_iommu_fwspec_get(vic->dev); in vic_boot()
64 if (vic->config->supports_sid && spec) { in vic_boot()
69 vic_writel(vic, value, VIC_TFBIF_TRANSCFG); in vic_boot()
84 vic_writel(vic, value, VIC_THI_STREAMID0); in vic_boot()
87 vic_writel(vic, value, VIC_THI_STREAMID1); in vic_boot()
93 vic_writel(vic, CG_IDLE_CG_DLY_CNT(4) | in vic_boot()
98 err = falcon_boot(&vic->falcon); in vic_boot()
102 hdr = vic->falcon.firmware.virt; in vic_boot()
107 hdr = vic->falcon.firmware.virt + in vic_boot()
111 falcon_execute_method(&vic->falcon, VIC_SET_FCE_UCODE_SIZE, in vic_boot()
114 &vic->falcon, VIC_SET_FCE_UCODE_OFFSET, in vic_boot()
115 (vic->falcon.firmware.iova + fce_bin_data_offset) >> 8); in vic_boot()
118 err = falcon_wait_idle(&vic->falcon); in vic_boot()
120 dev_err(vic->dev, in vic_boot()
133 struct vic *vic = to_vic(drm); in vic_init() local
138 dev_err(vic->dev, "failed to attach to domain: %d\n", err); in vic_init()
142 vic->channel = host1x_channel_request(client); in vic_init()
143 if (!vic->channel) { in vic_init()
169 host1x_channel_put(vic->channel); in vic_init()
181 struct vic *vic = to_vic(drm); in vic_exit() local
192 host1x_channel_put(vic->channel); in vic_exit()
196 dma_unmap_single(vic->dev, vic->falcon.firmware.phys, in vic_exit()
197 vic->falcon.firmware.size, DMA_TO_DEVICE); in vic_exit()
198 tegra_drm_free(tegra, vic->falcon.firmware.size, in vic_exit()
199 vic->falcon.firmware.virt, in vic_exit()
200 vic->falcon.firmware.iova); in vic_exit()
202 dma_free_coherent(vic->dev, vic->falcon.firmware.size, in vic_exit()
203 vic->falcon.firmware.virt, in vic_exit()
204 vic->falcon.firmware.iova); in vic_exit()
215 static int vic_load_firmware(struct vic *vic) in vic_load_firmware() argument
217 struct host1x_client *client = &vic->client.base; in vic_load_firmware()
218 struct tegra_drm *tegra = vic->client.drm; in vic_load_firmware()
224 if (vic->falcon.firmware.virt) in vic_load_firmware()
227 err = falcon_read_firmware(&vic->falcon, vic->config->firmware); in vic_load_firmware()
231 size = vic->falcon.firmware.size; in vic_load_firmware()
234 virt = dma_alloc_coherent(vic->dev, size, &iova, GFP_KERNEL); in vic_load_firmware()
236 err = dma_mapping_error(vic->dev, iova); in vic_load_firmware()
243 vic->falcon.firmware.virt = virt; in vic_load_firmware()
244 vic->falcon.firmware.iova = iova; in vic_load_firmware()
246 err = falcon_load_firmware(&vic->falcon); in vic_load_firmware()
258 phys = dma_map_single(vic->dev, virt, size, DMA_TO_DEVICE); in vic_load_firmware()
260 err = dma_mapping_error(vic->dev, phys); in vic_load_firmware()
264 vic->falcon.firmware.phys = phys; in vic_load_firmware()
271 dma_free_coherent(vic->dev, size, virt, iova); in vic_load_firmware()
281 struct vic *vic = dev_get_drvdata(dev); in vic_runtime_resume() local
284 err = clk_prepare_enable(vic->clk); in vic_runtime_resume()
290 err = reset_control_deassert(vic->rst); in vic_runtime_resume()
296 err = vic_load_firmware(vic); in vic_runtime_resume()
300 err = vic_boot(vic); in vic_runtime_resume()
307 reset_control_assert(vic->rst); in vic_runtime_resume()
309 clk_disable_unprepare(vic->clk); in vic_runtime_resume()
315 struct vic *vic = dev_get_drvdata(dev); in vic_runtime_suspend() local
318 err = reset_control_assert(vic->rst); in vic_runtime_suspend()
324 clk_disable_unprepare(vic->clk); in vic_runtime_suspend()
332 struct vic *vic = to_vic(client); in vic_open_channel() local
335 err = pm_runtime_resume_and_get(vic->dev); in vic_open_channel()
339 context->channel = host1x_channel_get(vic->channel); in vic_open_channel()
341 pm_runtime_put(vic->dev); in vic_open_channel()
350 struct vic *vic = to_vic(context->client); in vic_close_channel() local
353 pm_runtime_put(vic->dev); in vic_close_channel()
408 struct vic *vic; in vic_probe() local
418 vic = devm_kzalloc(dev, sizeof(*vic), GFP_KERNEL); in vic_probe()
419 if (!vic) in vic_probe()
422 vic->config = of_device_get_match_data(dev); in vic_probe()
434 vic->regs = devm_ioremap_resource(dev, regs); in vic_probe()
435 if (IS_ERR(vic->regs)) in vic_probe()
436 return PTR_ERR(vic->regs); in vic_probe()
438 vic->clk = devm_clk_get(dev, NULL); in vic_probe()
439 if (IS_ERR(vic->clk)) { in vic_probe()
441 return PTR_ERR(vic->clk); in vic_probe()
445 vic->rst = devm_reset_control_get(dev, "vic"); in vic_probe()
446 if (IS_ERR(vic->rst)) { in vic_probe()
448 return PTR_ERR(vic->rst); in vic_probe()
452 vic->falcon.dev = dev; in vic_probe()
453 vic->falcon.regs = vic->regs; in vic_probe()
455 err = falcon_init(&vic->falcon); in vic_probe()
459 platform_set_drvdata(pdev, vic); in vic_probe()
461 INIT_LIST_HEAD(&vic->client.base.list); in vic_probe()
462 vic->client.base.ops = &vic_client_ops; in vic_probe()
463 vic->client.base.dev = dev; in vic_probe()
464 vic->client.base.class = HOST1X_CLASS_VIC; in vic_probe()
465 vic->client.base.syncpts = syncpts; in vic_probe()
466 vic->client.base.num_syncpts = 1; in vic_probe()
467 vic->dev = dev; in vic_probe()
469 INIT_LIST_HEAD(&vic->client.list); in vic_probe()
470 vic->client.version = vic->config->version; in vic_probe()
471 vic->client.ops = &vic_ops; in vic_probe()
473 err = host1x_client_register(&vic->client.base); in vic_probe()
489 host1x_client_unregister(&vic->client.base); in vic_probe()
491 falcon_exit(&vic->falcon); in vic_probe()
498 struct vic *vic = platform_get_drvdata(pdev); in vic_remove() local
501 err = host1x_client_unregister(&vic->client.base); in vic_remove()
513 falcon_exit(&vic->falcon); in vic_remove()