/*
 * ispstat_request_statistics - Request statistics.
 * @data: Pointer to return statistics data.
 *
 * Returns 0 if successful.
 */
int ispstat_request_statistics(struct ispstat *stat,
			       struct ispstat_data *data)
{
	struct ispstat_buffer *buf;

	if (stat->state != ISPSTAT_ENABLED) {
		dev_dbg(stat->isp->dev, "%s: engine not enabled.\n",
			stat->subdev.name);
		return -EINVAL;
	}

	buf = ispstat_buf_get(stat, data);
	if (IS_ERR(buf))
		return PTR_ERR(buf);

	data->ts = buf->ts;
	data->config_counter = buf->config_counter;
	data->frame_number = buf->frame_number;
	data->buf_size = buf->buf_size;

	/*
	 * Deprecated. Number of new buffers is always equal to number of
	 * queued events without error flag. By setting it to 0, userspace
	 * won't try to request new buffer without receiving new event.
	 * This field must go away in future.
	 */
	data->new_bufs = 0;

	buf->empty = 1;
	ispstat_buf_release(stat);

	return 0;
}
Exemple #2
0
/*
 * This API allows the user to update White Balance gains, as well as
 * exposure time and analog gain. It is also used to request frame
 * statistics.
 */
int isp_af_request_statistics(struct isp_af_device *isp_af,
			      struct isp_af_data *afdata)
{
	struct device *dev = to_device(isp_af);
	struct ispstat_buffer *buf;

	if (!isp_af->config.af_config) {
		dev_dbg(dev, "af: statistics requested while af engine"
			     " is not configured\n");
		return -EINVAL;
	}

	if (afdata->update & REQUEST_STATISTICS) {
		buf = ispstat_buf_get(&isp_af->stat,
			      (void *)afdata->af_statistics_buf,
			      afdata->frame_number);
		if (IS_ERR(buf))
			return PTR_ERR(buf);

		afdata->xtrastats.ts = buf->ts;
		afdata->config_counter = buf->config_counter;
		afdata->frame_number = buf->frame_number;

		ispstat_buf_release(&isp_af->stat);
	}

	afdata->curr_frame = isp_af->stat.frame_number;

	return 0;
}
Exemple #3
0
/**
 * isph3a_aewb_stats_available - Check for stats available of specified frame.
 * @aewbdata: Pointer to return AE AWB statistics data
 *
 * Returns 0 if successful, or -1 if statistics are unavailable.
 **/
static int isph3a_aewb_get_stats(struct isp_h3a_device *isp_h3a,
				 struct isph3a_aewb_data *aewbdata)
{
	unsigned long irqflags;
	struct ispstat_buffer *buf;

	buf = ispstat_buf_get(&isp_h3a->stat,
			      (void *)aewbdata->h3a_aewb_statistics_buf,
			      aewbdata->frame_number);

	if (IS_ERR(buf))
		return PTR_ERR(buf);

	spin_lock_irqsave(isp_h3a->lock, irqflags);

	aewbdata->ts = buf->ts;
	aewbdata->config_counter = buf->config_counter;
	aewbdata->frame_number = buf->frame_number;

	spin_unlock_irqrestore(isp_h3a->lock, irqflags);

	ispstat_buf_release(&isp_h3a->stat);

	return 0;
}
Exemple #4
0
/**
 * isph3a_aewb_stats_available - Check for stats available of specified frame.
 * @aewbdata: Pointer to return AE AWB statistics data
 *
 * Returns 0 if successful, or -1 if statistics are unavailable.
 **/
static int isph3a_aewb_get_stats(struct isp_h3a_device *isp_h3a,
				 struct isph3a_aewb_data *aewbdata)
{
	struct ispstat_buffer *buf;

	buf = ispstat_buf_get(&isp_h3a->stat,
			      (void *)aewbdata->h3a_aewb_statistics_buf,
			      aewbdata->frame_number);

	if (IS_ERR(buf))
		return PTR_ERR(buf);

	aewbdata->ts = buf->ts;
	aewbdata->config_counter = buf->config_counter;
	aewbdata->frame_number = buf->frame_number;

	ispstat_buf_release(&isp_h3a->stat);

	return 0;
}