Exemplo n.º 1
0
void isph3a_aewb_try_enable(struct isp_h3a_device *isp_h3a)
{
	unsigned long irqflags;

	spin_lock_irqsave(isp_h3a->lock, irqflags);
	if (!isp_h3a->enabled && isp_h3a->aewb_config_local.aewb_enable) {
		isp_h3a->update = 1;
		isp_h3a->buf_next = ispstat_buf_next(&isp_h3a->stat);
		spin_unlock_irqrestore(isp_h3a->lock, irqflags);
		isph3a_aewb_config_registers(isp_h3a);
		isph3a_aewb_enable(isp_h3a, 1);
	} else
		spin_unlock_irqrestore(isp_h3a->lock, irqflags);
}
Exemplo n.º 2
0
/**
 * isph3a_aewb_configure - Configure AEWB regs, enable/disable H3A engine.
 * @aewbcfg: Pointer to AEWB config structure.
 *
 * Returns 0 if successful, -EINVAL if aewbcfg pointer is NULL, -ENOMEM if
 * was unable to allocate memory for the buffer, of other errors if H3A
 * callback is not set or the parameters for AEWB are invalid.
 **/
int isph3a_aewb_configure(struct isp_h3a_device *isp_h3a,
			  struct isph3a_aewb_config *aewbcfg)
{
	int ret = 0;
	int win_count = 0;
	unsigned int buf_size;
	unsigned long irqflags;
	struct ispstat_buffer *buf;

	if (NULL == aewbcfg) {
		dev_info(isp_h3a->dev, "h3a: Null argument in configuration\n");
		return -EINVAL;
	}

	ret = isph3a_aewb_validate_params(isp_h3a, aewbcfg);
	if (ret)
		return ret;

	/* FIXME: This win_count handling looks really fishy. */
	win_count = aewbcfg->ver_win_count * aewbcfg->hor_win_count;
	win_count += aewbcfg->hor_win_count;
	ret = win_count / 8;
	win_count += win_count % 8 ? 1 : 0;
	win_count += ret;

	buf_size = win_count * AEWB_PACKET_SIZE;

	ret = ispstat_bufs_alloc(&isp_h3a->stat, buf_size);
	if (ret)
		return ret;

	buf = ispstat_buf_next(&isp_h3a->stat);

	spin_lock_irqsave(isp_h3a->lock, irqflags);

	isp_h3a->win_count = win_count;

	isph3a_aewb_set_params(isp_h3a, aewbcfg);
	isp_reg_writel(isp_h3a->dev, buf->iommu_addr,
		       OMAP3_ISP_IOMEM_H3A, ISPH3A_AEWBUFST);
	spin_unlock_irqrestore(isp_h3a->lock, irqflags);
	isph3a_aewb_enable(isp_h3a, aewbcfg->aewb_enable);
	isph3a_print_status(isp_h3a);


	return 0;
}