Lines Matching refs:vic
30 struct vic { struct
46 static inline struct vic *to_vic(struct tegra_drm_client *client) in to_vic() argument
48 return container_of(client, struct vic, client); in to_vic()
51 static void vic_writel(struct vic *vic, u32 value, unsigned int offset) in vic_writel() argument
53 writel(value, vic->regs + offset); in vic_writel()
58 struct vic *vic = dev_get_drvdata(dev); in vic_runtime_resume() local
61 err = clk_prepare_enable(vic->clk); in vic_runtime_resume()
67 err = reset_control_deassert(vic->rst); in vic_runtime_resume()
76 clk_disable_unprepare(vic->clk); in vic_runtime_resume()
82 struct vic *vic = dev_get_drvdata(dev); in vic_runtime_suspend() local
85 err = reset_control_assert(vic->rst); in vic_runtime_suspend()
91 clk_disable_unprepare(vic->clk); in vic_runtime_suspend()
93 vic->booted = false; in vic_runtime_suspend()
98 static int vic_boot(struct vic *vic) in vic_boot() argument
104 if (vic->booted) in vic_boot()
108 if (vic->config->supports_sid) { in vic_boot()
109 struct iommu_fwspec *spec = dev_iommu_fwspec_get(vic->dev); in vic_boot()
114 vic_writel(vic, value, VIC_TFBIF_TRANSCFG); in vic_boot()
119 vic_writel(vic, value, VIC_THI_STREAMID0); in vic_boot()
120 vic_writel(vic, value, VIC_THI_STREAMID1); in vic_boot()
126 vic_writel(vic, CG_IDLE_CG_DLY_CNT(4) | in vic_boot()
131 err = falcon_boot(&vic->falcon); in vic_boot()
135 hdr = vic->falcon.firmware.vaddr; in vic_boot()
137 hdr = vic->falcon.firmware.vaddr + in vic_boot()
141 falcon_execute_method(&vic->falcon, VIC_SET_APPLICATION_ID, 1); in vic_boot()
142 falcon_execute_method(&vic->falcon, VIC_SET_FCE_UCODE_SIZE, in vic_boot()
144 falcon_execute_method(&vic->falcon, VIC_SET_FCE_UCODE_OFFSET, in vic_boot()
145 (vic->falcon.firmware.paddr + fce_bin_data_offset) in vic_boot()
148 err = falcon_wait_idle(&vic->falcon); in vic_boot()
150 dev_err(vic->dev, in vic_boot()
155 vic->booted = true; in vic_boot()
187 struct vic *vic = to_vic(drm); in vic_init() local
193 dev_err(vic->dev, "failed to attach to domain: %d\n", in vic_init()
198 vic->domain = tegra->domain; in vic_init()
201 vic->channel = host1x_channel_request(client->dev); in vic_init()
202 if (!vic->channel) { in vic_init()
222 host1x_channel_put(vic->channel); in vic_init()
236 struct vic *vic = to_vic(drm); in vic_exit() local
244 host1x_channel_put(vic->channel); in vic_exit()
246 if (vic->domain) { in vic_exit()
247 iommu_detach_group(vic->domain, group); in vic_exit()
248 vic->domain = NULL; in vic_exit()
259 static int vic_load_firmware(struct vic *vic) in vic_load_firmware() argument
263 if (vic->falcon.data) in vic_load_firmware()
266 vic->falcon.data = vic->client.drm; in vic_load_firmware()
268 err = falcon_read_firmware(&vic->falcon, vic->config->firmware); in vic_load_firmware()
272 err = falcon_load_firmware(&vic->falcon); in vic_load_firmware()
279 vic->falcon.data = NULL; in vic_load_firmware()
286 struct vic *vic = to_vic(client); in vic_open_channel() local
289 err = pm_runtime_get_sync(vic->dev); in vic_open_channel()
293 err = vic_load_firmware(vic); in vic_open_channel()
297 err = vic_boot(vic); in vic_open_channel()
301 context->channel = host1x_channel_get(vic->channel); in vic_open_channel()
310 pm_runtime_put(vic->dev); in vic_open_channel()
316 struct vic *vic = to_vic(context->client); in vic_close_channel() local
320 pm_runtime_put(vic->dev); in vic_close_channel()
374 struct vic *vic; in vic_probe() local
377 vic = devm_kzalloc(dev, sizeof(*vic), GFP_KERNEL); in vic_probe()
378 if (!vic) in vic_probe()
381 vic->config = of_device_get_match_data(dev); in vic_probe()
393 vic->regs = devm_ioremap_resource(dev, regs); in vic_probe()
394 if (IS_ERR(vic->regs)) in vic_probe()
395 return PTR_ERR(vic->regs); in vic_probe()
397 vic->clk = devm_clk_get(dev, NULL); in vic_probe()
398 if (IS_ERR(vic->clk)) { in vic_probe()
400 return PTR_ERR(vic->clk); in vic_probe()
404 vic->rst = devm_reset_control_get(dev, "vic"); in vic_probe()
405 if (IS_ERR(vic->rst)) { in vic_probe()
407 return PTR_ERR(vic->rst); in vic_probe()
411 vic->falcon.dev = dev; in vic_probe()
412 vic->falcon.regs = vic->regs; in vic_probe()
413 vic->falcon.ops = &vic_falcon_ops; in vic_probe()
415 err = falcon_init(&vic->falcon); in vic_probe()
419 platform_set_drvdata(pdev, vic); in vic_probe()
421 INIT_LIST_HEAD(&vic->client.base.list); in vic_probe()
422 vic->client.base.ops = &vic_client_ops; in vic_probe()
423 vic->client.base.dev = dev; in vic_probe()
424 vic->client.base.class = HOST1X_CLASS_VIC; in vic_probe()
425 vic->client.base.syncpts = syncpts; in vic_probe()
426 vic->client.base.num_syncpts = 1; in vic_probe()
427 vic->dev = dev; in vic_probe()
429 INIT_LIST_HEAD(&vic->client.list); in vic_probe()
430 vic->client.version = vic->config->version; in vic_probe()
431 vic->client.ops = &vic_ops; in vic_probe()
433 err = host1x_client_register(&vic->client.base); in vic_probe()
449 host1x_client_unregister(&vic->client.base); in vic_probe()
451 falcon_exit(&vic->falcon); in vic_probe()
458 struct vic *vic = platform_get_drvdata(pdev); in vic_remove() local
461 err = host1x_client_unregister(&vic->client.base); in vic_remove()
473 falcon_exit(&vic->falcon); in vic_remove()