Ejemplo n.º 1
0
/**
 * prev_do_preview - Performs the Preview process
 * @device: Structure containing ISP preview wrapper global information
 * @arg: Currently not used
 *
 * Returns 0 if successful, or -EINVAL if the sent parameters are invalid.
 **/
static int prev_do_preview(struct prev_device *device, int *arg)
{
    int bpp, size;
    int ret = 0;
    u32 out_hsize, out_vsize, out_line_offset;

    dev_dbg(prev_dev, "prev_do_preview E\n");

    if (!device) {
        dev_err(prev_dev, "preview: invalid parameters\n");
        return -EINVAL;
    }

    previewer_set_isp_ctrl();

    if (device->params->size_params.pixsize == PREV_INWIDTH_8BIT)
        bpp = 1;
    else
        bpp = 2;

    size = device->params->size_params.hsize *
           device->params->size_params.vsize * bpp;

    isppreview_config_datapath(PRV_RAW_MEM, PREVIEW_MEM);

    isppreview_try_size(device->params->size_params.hsize,
                        device->params->size_params.vsize,
                        &out_hsize,
                        &out_vsize);


    ret = isppreview_config_inlineoffset(device->params->size_params.hsize
                                         * bpp);
    if (ret)
        goto out;

    out_line_offset = (out_hsize * bpp) & PREV_32BYTES_ALIGN_MASK;

    ret = isppreview_config_outlineoffset(out_line_offset);
    if (ret)
        goto out;

    ret = isppreview_config_size(device->params->size_params.hsize,
                                 device->params->size_params.vsize,
                                 out_hsize, out_vsize);

    device->params->drkf_params.addr = device->isp_addr_lsc;

    prev_hw_setup(device->params);

    ret = isppreview_set_inaddr(device->isp_addr_read);
    if (ret)
        goto out;

    ret = isppreview_set_outaddr(device->isp_addr_read);
    if (ret)
        goto out;

    ret = isp_set_callback(CBK_PREV_DONE, preview_isr, (void *)device,
                           (void *)NULL);
    if (ret) {
        dev_err(prev_dev, "ERROR while setting Previewer callback!\n");
        goto out;
    }
    isppreview_enable(1);

    wait_for_completion_interruptible(&device->wfc);

    ret = isp_unset_callback(CBK_PREV_DONE);

    dev_dbg(prev_dev, "prev_do_preview L\n");
out:
    return ret;
}
Ejemplo n.º 2
0
/**
 * prev_do_preview - Performs the Preview process
 * @device: Structure containing ISP preview wrapper global information
 * @arg: Currently not used
 *
 * Returns 0 if successful, or -EINVAL if the sent parameters are invalid.
 **/
static int prev_do_preview(struct prev_device *device, int *arg)
{
	u32 out_hsize, out_vsize, out_line_offset, in_line_offset;
	int ret = 0, bpp;

	dev_dbg(prev_dev, "prev_do_preview E\n");

	if (!device) {
		dev_err(prev_dev, "preview: invalid parameters\n");
		return -EINVAL;
	}

	prev_set_isp_ctrl(device->params->features);

	if (device->params->size_params.pixsize == PREV_INWIDTH_8BIT)
		bpp = 1;
	else
		bpp = 2;

 	out_hsize = device->out_hsize;
	out_vsize = device->out_vsize;

	in_line_offset = device->params->size_params.hsize * bpp;

	ret = isppreview_config_inlineoffset(in_line_offset);
	if (ret)
		goto out;

	dev_dbg(prev_dev, "%s: out_pitch %d, output width %d, out_hsize %d, "
						"out_vsize %d\n", __func__,
		device->params->size_params.out_pitch,
		device->params->size_params.out_pitch / bpp,
		out_hsize, out_vsize);

	out_line_offset = (out_hsize * bpp) & PREV_32BYTES_ALIGN_MASK;

	ret = isppreview_config_outlineoffset(out_line_offset);
	if (ret)
		goto out;

	ret = prev_config_size(device->params->size_params.hsize,
					device->params->size_params.vsize);
	if (ret)
		goto out;

	device->params->drkf_params.addr = device->isp_addr_lsc;

	prev_hw_setup(device->params);

	ret = isppreview_set_inaddr(device->isp_addr_read);
	if (ret)
		goto out;

	ret = isppreview_set_outaddr(device->isp_addr_read);
	if (ret)
		goto out;

	ret = isp_set_callback(CBK_PREV_DONE, prev_isr, (void *) device,
							(void *) NULL);
	if (ret) {
		dev_err(prev_dev, "ERROR while setting Previewer callback!\n");
		goto out;
	}

	isppreview_enable(1);
	wait_for_completion_interruptible(&device->wfc);
	isppreview_enable(0);

	ret = isp_unset_callback(CBK_PREV_DONE);

	prev_unset_isp_ctrl();

	dev_dbg(prev_dev, "prev_do_preview L\n");
out:
	return ret;
}