Exemplo n.º 1
0
static int hist_validate_params(struct ispstat *hist, void *new_conf)
{
    struct omap3isp_hist_config *user_cfg = new_conf;
    int c;
    u32 buf_size;

    if (user_cfg->cfa > OMAP3ISP_HIST_CFA_FOVEONX3)
        return -EINVAL;



    if ((user_cfg->num_regions < OMAP3ISP_HIST_MIN_REGIONS) ||
            (user_cfg->num_regions > OMAP3ISP_HIST_MAX_REGIONS))
        return -EINVAL;


    for (c = 0; c < user_cfg->num_regions; c++) {
        if (user_cfg->region[c].h_start & ~ISPHIST_REG_START_END_MASK)
            return -EINVAL;
        if (user_cfg->region[c].h_end & ~ISPHIST_REG_START_END_MASK)
            return -EINVAL;
        if (user_cfg->region[c].v_start & ~ISPHIST_REG_START_END_MASK)
            return -EINVAL;
        if (user_cfg->region[c].v_end & ~ISPHIST_REG_START_END_MASK)
            return -EINVAL;
        if (user_cfg->region[c].h_start > user_cfg->region[c].h_end)
            return -EINVAL;
        if (user_cfg->region[c].v_start > user_cfg->region[c].v_end)
            return -EINVAL;
    }

    switch (user_cfg->num_regions) {
    case 1:
        if (user_cfg->hist_bins > OMAP3ISP_HIST_BINS_256)
            return -EINVAL;
        break;
    case 2:
        if (user_cfg->hist_bins > OMAP3ISP_HIST_BINS_128)
            return -EINVAL;
        break;
    default:
        if (user_cfg->hist_bins > OMAP3ISP_HIST_BINS_64)
            return -EINVAL;
        break;
    }

    buf_size = hist_get_buf_size(user_cfg);
    if (buf_size > user_cfg->buf_size)

        user_cfg->buf_size = buf_size;
    else if (user_cfg->buf_size > OMAP3ISP_HIST_MAX_BUF_SIZE)
        user_cfg->buf_size = OMAP3ISP_HIST_MAX_BUF_SIZE;

    return 0;
}
Exemplo n.º 2
0
static void hist_set_params(struct ispstat *hist, void *new_conf)
{
    struct omap3isp_hist_config *user_cfg = new_conf;
    struct omap3isp_hist_config *cur_cfg = hist->priv;

    if (!hist->configured || hist_comp_params(hist, user_cfg)) {
        memcpy(cur_cfg, user_cfg, sizeof(*user_cfg));
        if (user_cfg->num_acc_frames == 0)
            user_cfg->num_acc_frames = 1;
        hist->inc_config++;
        hist->update = 1;
        cur_cfg->buf_size = hist_get_buf_size(cur_cfg);

    }
}
Exemplo n.º 3
0
Arquivo: isphist.c Projeto: 7799/linux
/*
 * hist_update_params - Helper function to check and store user given params.
 * @new_conf: Pointer to user configuration structure.
 */
static void hist_set_params(struct ispstat *hist, void *new_conf)
{
	struct omap3isp_hist_config *user_cfg = new_conf;
	struct omap3isp_hist_config *cur_cfg = hist->priv;

	if (!hist->configured || hist_comp_params(hist, user_cfg)) {
		memcpy(cur_cfg, user_cfg, sizeof(*user_cfg));
		if (user_cfg->num_acc_frames == 0)
			user_cfg->num_acc_frames = 1;
		hist->inc_config++;
		hist->update = 1;
		/*
		 * User might be asked for a bigger buffer than necessary for
		 * this configuration. In order to return the right amount of
		 * data during buffer request, let's calculate the size here
		 * instead of stick with user_cfg->buf_size.
		 */
		cur_cfg->buf_size = hist_get_buf_size(cur_cfg);

	}
}