summaryrefslogtreecommitdiff
path: root/isp/omap3isp.h
blob: 1e9489ffda983107fde3735e0c4484f82fe78da0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * OMAP3 ISP library - OMAP3 ISP
 *
 * Copyright (C) 2010-2011 Ideas on board SPRL
 *
 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at
 * your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef __OMAP3ISP_H
#define __OMAP3ISP_H

#include <linux/v4l2-mediabus.h>
#include <sys/select.h>
#include <stdbool.h>

#include "media.h"
#include "stats.h"
#include "v4l2.h"

struct omap3_isp_device;

enum omap3_isp_scaler {
	OMAP3_ISP_SCALER_ISP = 0,
	OMAP3_ISP_SCALER_SENSOR = 1,
};

enum omap3_isp_event_type {
	OMAP3_ISP_EVENT_READ = 1,
	OMAP3_ISP_EVENT_WRITE = 2,
	OMAP3_ISP_EVENT_EXCEPTION = 4,
};

struct omap3_isp_operations {
	void (*prepare_streamon)(struct omap3_isp_device *isp);
	void (*viewfinder_ready)(struct omap3_isp_device *isp,
				 struct v4l2_video_buffer *buffer);
	bool (*snapshot_ready)(struct omap3_isp_device *isp,
			       struct v4l2_video_buffer *buffer);
	void (*aewb_ready)(struct omap3_isp_device *isp,
			   const struct omap3_isp_aewb_stats *stats);
	void (*watch_fd)(int fd, enum omap3_isp_event_type type,
			 void(*callback)(void *priv), void *priv);
	void (*unwatch_fd)(int fd);
};

struct omap3_isp_device *omap3_isp_open(const char *devname,
					const struct omap3_isp_operations *ops);
void omap3_isp_close(struct omap3_isp_device *isp);

int omap3_isp_viewfinder_setup(struct omap3_isp_device *isp,
			       struct v4l2_mbus_framefmt *ofmt);
int omap3_isp_viewfinder_set_pool(struct omap3_isp_device *isp,
				  struct v4l2_buffers_pool *pool);
int omap3_isp_viewfinder_set_scaler(struct omap3_isp_device *isp,
				    enum omap3_isp_scaler scaler);
int omap3_isp_viewfinder_start(struct omap3_isp_device *isp);
int omap3_isp_viewfinder_stop(struct omap3_isp_device *isp);
int omap3_isp_viewfinder_put_buffer(struct omap3_isp_device *isp,
				    struct v4l2_video_buffer *buffer);

int omap3_isp_snapshot_setup(struct omap3_isp_device *isp,
			     struct v4l2_rect *crop,
			     struct v4l2_mbus_framefmt *ofmt);
int omap3_isp_snapshot_capture(struct omap3_isp_device *isp);
int omap3_isp_snapshot_put_buffer(struct omap3_isp_device *isp,
				  struct v4l2_video_buffer *buffer);

int omap3_isp_ccdc_set_black_level(struct omap3_isp_device *isp, unsigned int value);

int omap3_isp_preview_set_contrast(struct omap3_isp_device *isp, unsigned int value);
int omap3_isp_preview_set_saturation(struct omap3_isp_device *isp, float value);
int omap3_isp_preview_set_gain(struct omap3_isp_device *isp, float gain);
int omap3_isp_preview_set_white_balance(struct omap3_isp_device *isp, float gains[4]);

int omap3_isp_sensor_get_exposure(struct omap3_isp_device *isp,
				  unsigned int *exposure);
int omap3_isp_sensor_set_exposure(struct omap3_isp_device *isp,
				  unsigned int exposure);
int omap3_isp_sensor_set_gain(struct omap3_isp_device *isp, unsigned int gain);
int omap3_isp_sensor_set_gains(struct omap3_isp_device *isp, unsigned int red,
			       unsigned int green, unsigned int blue);

#endif