Example #1
0
static ssize_t rproc_state_write(struct file *filp, const char __user *userbuf,
				 size_t count, loff_t *ppos)
{
	struct rproc *rproc = filp->private_data;
	char buf[10];
	int ret;

	if (count > sizeof(buf) || count <= 0)
		return -EINVAL;

	ret = copy_from_user(buf, userbuf, count);
	if (ret)
		return -EFAULT;

	if (buf[count - 1] == '\n')
		buf[count - 1] = '\0';

	if (!strncmp(buf, "start", count)) {
		ret = rproc_boot(rproc);
		if (ret) {
			dev_err(&rproc->dev, "Boot failed: %d\n", ret);
			return ret;
		}
	} else if (!strncmp(buf, "stop", count)) {
		rproc_shutdown(rproc);
	} else {
		dev_err(&rproc->dev, "Unrecognised option: %s\n", buf);
		return -EINVAL;
	}

	return count;
}
Example #2
0
static struct dma_chan *st_fdma_of_xlate(struct of_phandle_args *dma_spec,
        struct of_dma *ofdma)
{
    struct st_fdma_dev *fdev = ofdma->of_dma_data;
    struct dma_chan *chan;
    struct st_fdma_chan *fchan;
    int ret;

    if (dma_spec->args_count < 1)
        return ERR_PTR(-EINVAL);

    if (fdev->dma_device.dev->of_node != dma_spec->np)
        return ERR_PTR(-EINVAL);

    ret = rproc_boot(fdev->slim_rproc->rproc);
    if (ret == -ENOENT)
        return ERR_PTR(-EPROBE_DEFER);
    else if (ret)
        return ERR_PTR(ret);

    chan = dma_get_any_slave_channel(&fdev->dma_device);
    if (!chan)
        goto err_chan;

    fchan = to_st_fdma_chan(chan);

    fchan->cfg.of_node = dma_spec->np;
    fchan->cfg.req_line = dma_spec->args[0];
    fchan->cfg.req_ctrl = 0;
    fchan->cfg.type = ST_FDMA_TYPE_FREE_RUN;

    if (dma_spec->args_count > 1)
        fchan->cfg.req_ctrl = dma_spec->args[1]
                              & FDMA_REQ_CTRL_CFG_MASK;

    if (dma_spec->args_count > 2)
        fchan->cfg.type = dma_spec->args[2];

    if (fchan->cfg.type == ST_FDMA_TYPE_FREE_RUN) {
        fchan->dreq_line = 0;
    } else {
        fchan->dreq_line = st_fdma_dreq_get(fchan);
        if (IS_ERR_VALUE(fchan->dreq_line)) {
            chan = ERR_PTR(fchan->dreq_line);
            goto err_chan;
        }
    }

    dev_dbg(fdev->dev, "xlate req_line:%d type:%d req_ctrl:%#lx\n",
            fchan->cfg.req_line, fchan->cfg.type, fchan->cfg.req_ctrl);

    return chan;

err_chan:
    rproc_shutdown(fdev->slim_rproc->rproc);
    return chan;

}
Example #3
0
static ssize_t qproc_shutdown_store(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t size)
{
	struct qproc *qproc = dev_get_drvdata(dev);

	rproc_shutdown(qproc->rproc);
	return size;
}
static int wkm3_resume(struct device *dev)
{
	if (m3_rproc_static->is_rtc_only) {
		rproc_shutdown(m3_rproc_static->rproc);
		rproc_boot(m3_rproc_static->rproc);
	}

	m3_rproc_static->is_rtc_only = false;

	return 0;
}
Example #5
0
static void st_fdma_free_chan_res(struct dma_chan *chan)
{
    struct st_fdma_chan *fchan = to_st_fdma_chan(chan);
    struct rproc *rproc = fchan->fdev->slim_rproc->rproc;
    unsigned long flags;

    LIST_HEAD(head);

    dev_dbg(fchan->fdev->dev, "%s: freeing chan:%d\n",
            __func__, fchan->vchan.chan.chan_id);

    if (fchan->cfg.type != ST_FDMA_TYPE_FREE_RUN)
        st_fdma_dreq_put(fchan);

    spin_lock_irqsave(&fchan->vchan.lock, flags);
    fchan->fdesc = NULL;
    spin_unlock_irqrestore(&fchan->vchan.lock, flags);

    dma_pool_destroy(fchan->node_pool);
    fchan->node_pool = NULL;
    memset(&fchan->cfg, 0, sizeof(struct st_fdma_cfg));

    rproc_shutdown(rproc);
}