Lines Matching +full:video +full:- +full:firmware

1 // SPDX-License-Identifier: GPL-2.0-only
7 #include <linux/firmware.h>
16 #include <linux/firmware/qcom/qcom_scm.h>
21 #include "firmware.h"
30 u32 fw_size = core->fw.mapped_mem_size; in venus_reset_cpu()
34 wrapper_base = core->wrapper_tz_base; in venus_reset_cpu()
36 wrapper_base = core->wrapper_base; in venus_reset_cpu()
61 if (core->use_tz) { in venus_set_hw_state()
63 if (resume && ret == -EINVAL) in venus_set_hw_state()
73 core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET); in venus_set_hw_state()
76 core->wrapper_base + WRAPPER_A9SS_SW_RESET); in venus_set_hw_state()
85 const struct firmware *mdt; in venus_load_fw()
96 dev = core->dev; in venus_load_fw()
97 node = of_parse_phandle(dev->of_node, "memory-region", 0); in venus_load_fw()
99 dev_err(dev, "no memory-region specified\n"); in venus_load_fw()
100 return -EINVAL; in venus_load_fw()
106 dev_err(dev, "failed to lookup reserved memory-region\n"); in venus_load_fw()
107 return -EINVAL; in venus_load_fw()
120 *mem_phys = rmem->base; in venus_load_fw()
121 *mem_size = rmem->size; in venus_load_fw()
124 ret = -EINVAL; in venus_load_fw()
131 ret = -ENOMEM; in venus_load_fw()
135 if (core->use_tz) in venus_load_fw()
155 dev = core->fw.dev; in venus_boot_no_tz()
157 return -EPROBE_DEFER; in venus_boot_no_tz()
159 iommu = core->fw.iommu_domain; in venus_boot_no_tz()
160 core->fw.mapped_mem_size = mem_size; in venus_boot_no_tz()
165 dev_err(dev, "could not map video firmware region\n"); in venus_boot_no_tz()
176 const size_t mapped = core->fw.mapped_mem_size; in venus_shutdown_no_tz()
180 struct device *dev = core->fw.dev; in venus_shutdown_no_tz()
181 void __iomem *wrapper_base = core->wrapper_base; in venus_shutdown_no_tz()
182 void __iomem *wrapper_tz_base = core->wrapper_tz_base; in venus_shutdown_no_tz()
196 iommu = core->fw.iommu_domain; in venus_shutdown_no_tz()
198 if (core->fw.mapped_mem_size && iommu) { in venus_shutdown_no_tz()
202 dev_err(dev, "failed to unmap firmware\n"); in venus_shutdown_no_tz()
204 core->fw.mapped_mem_size = 0; in venus_shutdown_no_tz()
212 struct device *dev = core->dev; in venus_boot()
213 const struct venus_resources *res = core->res; in venus_boot()
220 (core->use_tz && !qcom_scm_is_available())) in venus_boot()
221 return -EPROBE_DEFER; in venus_boot()
223 ret = of_property_read_string_index(dev->of_node, "firmware-name", 0, in venus_boot()
226 fwpath = core->res->fwname; in venus_boot()
230 dev_err(dev, "fail to load video firmware\n"); in venus_boot()
231 return -EINVAL; in venus_boot()
234 core->fw.mem_size = mem_size; in venus_boot()
235 core->fw.mem_phys = mem_phys; in venus_boot()
237 if (core->use_tz) in venus_boot()
245 if (core->use_tz && res->cp_size) { in venus_boot()
249 * cp_size = venus_ns/virtual-addr-pool[0] - yes, address and not size! in venus_boot()
250 * This works, as the non-secure context bank is placed in venus_boot()
253 * cp_nonpixel_start = venus_sec_non_pixel/virtual-addr-pool[0] in venus_boot()
254 * cp_nonpixel_size = venus_sec_non_pixel/virtual-addr-pool[1] in venus_boot()
256 ret = qcom_scm_mem_protect_video_var(res->cp_start, in venus_boot()
257 res->cp_size, in venus_boot()
258 res->cp_nonpixel_start, in venus_boot()
259 res->cp_nonpixel_size); in venus_boot()
275 if (core->use_tz) in venus_shutdown()
291 np = of_get_child_by_name(core->dev->of_node, "video-firmware"); in venus_firmware_init()
293 core->use_tz = true; in venus_firmware_init()
298 info.fwnode = &np->fwnode; in venus_firmware_init()
299 info.parent = core->dev; in venus_firmware_init()
300 info.name = np->name; in venus_firmware_init()
309 pdev->dev.of_node = np; in venus_firmware_init()
311 ret = of_dma_configure(&pdev->dev, np, true); in venus_firmware_init()
313 dev_err(core->dev, "dma configure fail\n"); in venus_firmware_init()
317 core->fw.dev = &pdev->dev; in venus_firmware_init()
319 iommu_dom = iommu_paging_domain_alloc(core->fw.dev); in venus_firmware_init()
321 dev_err(core->fw.dev, "Failed to allocate iommu domain\n"); in venus_firmware_init()
326 ret = iommu_attach_device(iommu_dom, core->fw.dev); in venus_firmware_init()
328 dev_err(core->fw.dev, "could not attach device\n"); in venus_firmware_init()
332 core->fw.iommu_domain = iommu_dom; in venus_firmware_init()
350 if (!core->fw.dev) in venus_firmware_deinit()
353 iommu = core->fw.iommu_domain; in venus_firmware_deinit()
355 iommu_detach_device(iommu, core->fw.dev); in venus_firmware_deinit()
357 if (core->fw.iommu_domain) { in venus_firmware_deinit()
359 core->fw.iommu_domain = NULL; in venus_firmware_deinit()
362 platform_device_unregister(to_platform_device(core->fw.dev)); in venus_firmware_deinit()