int nvhost_msenc_init(struct platform_device *dev) { struct nvhost_device_data *pdata = platform_get_drvdata(dev); int err = 0; struct msenc *m; char *fw_name; nvhost_dbg_fn("in dev:%p", dev); fw_name = msenc_get_fw_name(dev); if (!fw_name) { dev_err(&dev->dev, "couldn't determine firmware name"); return -EINVAL; } m = kzalloc(sizeof(struct msenc), GFP_KERNEL); if (!m) { dev_err(&dev->dev, "couldn't alloc ucode"); kfree(fw_name); return -ENOMEM; } set_msenc(dev, m); nvhost_dbg_fn("primed dev:%p", dev); err = msenc_read_ucode(dev, fw_name); kfree(fw_name); fw_name = 0; if (err || !m->valid) { dev_err(&dev->dev, "ucode not valid"); goto clean_up; } nvhost_module_busy(dev); msenc_boot(dev); nvhost_module_idle(dev); if (pdata->scaling_init) nvhost_scale_hw_init(dev); return 0; clean_up: dev_err(&dev->dev, "failed"); return err; }
void nvhost_msenc_init(struct platform_device *dev) { struct nvhost_device_data *pdata = (struct nvhost_device_data *)dev->dev.platform_data; int err = 0; struct msenc *m; char *fw_name; fw_name = msenc_get_fw_name(dev); if (!fw_name) { dev_err(&dev->dev, "couldn't determine firmware name"); return; } m = kzalloc(sizeof(struct msenc), GFP_KERNEL); if (!m) { dev_err(&dev->dev, "couldn't alloc ucode"); kfree(fw_name); return; } set_msenc(dev, m); err = msenc_read_ucode(dev, fw_name); kfree(fw_name); fw_name = 0; if (err || !m->valid) { dev_err(&dev->dev, "ucode not valid"); goto clean_up; } if (!pdata->can_powergate) { nvhost_module_busy(dev); msenc_boot(dev); nvhost_module_idle(dev); } return; clean_up: dev_err(&dev->dev, "failed"); }
void nvhost_msenc_deinit(struct platform_device *dev) { struct msenc *m = get_msenc(dev); struct nvhost_device_data *pdata = platform_get_drvdata(dev); if (pdata->scaling_init) nvhost_scale_hw_deinit(dev); if (!m) return; /* unpin, free ucode memory */ if (m->mapped) { dma_free_attrs(&dev->dev, m->size, m->mapped, m->phys, &m->attrs); m->mapped = NULL; } m->valid = false; kfree(m); set_msenc(dev, NULL); }