void nvhost_scale_emc_init(struct platform_device *pdev) { struct nvhost_device_data *pdata = platform_get_drvdata(pdev); struct nvhost_device_profile *profile; struct nvhost_gr3d_params *gr3d_params; nvhost_scale_init(pdev); profile = pdata->power_profile; if (!profile) return; gr3d_params = kzalloc(sizeof(*gr3d_params), GFP_KERNEL); if (!gr3d_params) goto err_allocate_gr3d_params; gr3d_params->clk_3d = 0; gr3d_params->clk_3d_emc = 1; profile->private_data = gr3d_params; nvhost_scale_emc_calibrate_emc(&gr3d_params->emc_params, clk(profile, gr3d_params->clk_3d), clk(profile, gr3d_params->clk_3d_emc), pdata->linear_emc); if (nvhost_module_add_client(pdev, gr3d_params)) nvhost_err(&pdev->dev, "failed to register as a acm client"); return; err_allocate_gr3d_params: nvhost_scale_deinit(pdev); }
static int nvhost_channelopen(struct inode *inode, struct file *filp) { struct nvhost_channel_userctx *priv; struct nvhost_channel *ch; ch = container_of(inode->i_cdev, struct nvhost_channel, cdev); ch = nvhost_getchannel(ch); if (!ch) return -ENOMEM; trace_nvhost_channel_open(ch->dev->name); priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) { nvhost_putchannel(ch, NULL); return -ENOMEM; } filp->private_data = priv; mutex_init(&priv->mutex); mutex_lock(&priv->mutex); priv->ch = ch; if(nvhost_module_add_client(ch->dev, priv)) goto fail; if (ch->ctxhandler && ch->ctxhandler->alloc) { priv->hwctx = ch->ctxhandler->alloc(ch->ctxhandler, ch); if (!priv->hwctx) goto fail; } priv->priority = NVHOST_PRIORITY_MEDIUM; priv->clientid = atomic_add_return(1, &nvhost_get_host(ch->dev)->clientid); priv->timeout = CONFIG_TEGRA_GRHOST_DEFAULT_TIMEOUT; mutex_unlock(&priv->mutex); return 0; fail: nvhost_channelrelease(inode, filp); mutex_unlock(&priv->mutex); return -ENOMEM; }
static int nvhost_channelopen(struct inode *inode, struct file *filp) { struct nvhost_channel_userctx *priv; struct nvhost_channel *ch; ch = container_of(inode->i_cdev, struct nvhost_channel, cdev); ch = nvhost_getchannel(ch); if (!ch) return -ENOMEM; trace_nvhost_channel_open(ch->desc->name); priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) { nvhost_putchannel(ch, NULL); return -ENOMEM; } filp->private_data = priv; priv->ch = ch; nvhost_module_add_client(ch->dev, &ch->mod, priv); priv->gather_mem = nvmap_alloc(ch->dev->nvmap, sizeof(u32) * 2 * NVHOST_MAX_GATHERS, 32, NVMAP_HANDLE_CACHEABLE); if (IS_ERR(priv->gather_mem)) goto fail; if (ch->ctxhandler.alloc) { priv->hwctx = ch->ctxhandler.alloc(ch); if (!priv->hwctx) goto fail; priv->hwctx->timeout = &priv->timeout; } priv->gathers = nvmap_mmap(priv->gather_mem); return 0; fail: nvhost_channelrelease(inode, filp); return -ENOMEM; }
static int nvhost_channelopen(struct inode *inode, struct file *filp) { struct nvhost_channel_userctx *priv; struct nvhost_channel *ch; ch = container_of(inode->i_cdev, struct nvhost_channel, cdev); ch = nvhost_getchannel(ch); if (!ch) return -ENOMEM; trace_nvhost_channel_open(ch->dev->name); priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) { nvhost_putchannel(ch, NULL); return -ENOMEM; } filp->private_data = priv; priv->ch = ch; nvhost_module_add_client(ch->dev, priv); if (ch->ctxhandler && ch->ctxhandler->alloc) { priv->hwctx = ch->ctxhandler->alloc(ch->ctxhandler, ch); if (!priv->hwctx) goto fail; } priv->priority = NVHOST_PRIORITY_MEDIUM; priv->clientid = atomic_add_return(1, &nvhost_get_host(ch->dev)->clientid); priv->job = nvhost_job_alloc(ch, priv->hwctx, &priv->hdr, NULL, priv->priority, priv->clientid); if (!priv->job) goto fail; return 0; fail: nvhost_channelrelease(inode, filp); return -ENOMEM; }