summaryrefslogtreecommitdiff
path: root/isp/omap3isp-priv.h
blob: a31f943fa2cb5223d4eeb8f86d13f137fa6b63e1 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
 * OMAP3 ISP library - OMAP3 ISP private header
 *
 * 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_PRIV_H
#define __OMAP3ISP_PRIV_H

#include <linux/omap3isp.h>
#include <linux/v4l2-mediabus.h>

#include "omap3isp.h"
#include "stats-priv.h"
#include "tools.h"

struct omap3_isp_device;

/*
 * struct omap3_isp_pad - OMAP3 entity pad
 * @link: Link connected to the pad
 * @crop: Crop rectangle
 * @format: Format on the pad
 */
struct omap3_isp_pad {
	struct media_entity_link *link;
	struct v4l2_rect crop;
	struct v4l2_mbus_framefmt format;
};

enum omap3_isp_entity_type {
	OMAP3_ISP_ENTITY_ENTITY,
	OMAP3_ISP_ENTITY_POOL,
	OMAP3_ISP_ENTITY_VIDEO,
};

/*
 * struct omap3_isp_entity - OMAP3 entity in a pipeline
 * @list: Entities list
 * @type: Entity type
 * @entity: Media entity information
 * @sink: Sink pad
 * @source: Sink pad
 * @last: Indicates whether this is the last entity in the pipeline
 */
struct omap3_isp_entity {
	struct list_entry list;
	enum omap3_isp_entity_type type;
	struct media_entity *entity;
	struct omap3_isp_pad sink;
	struct omap3_isp_pad source;
	bool last;
};

/*
 * struct omap3_isp_video - OMAP3 video device
 * @entity: OMAP3 entity
 * @isp: OMAP3 ISP device
 * @video: V4L2 capture device
 * @format: Current video format
 * @pool: Buffers pool
 * @queued: Number of buffers queued to the driver
 * @running: Whether video capture is running on the device
 */
struct omap3_isp_video {
	struct omap3_isp_entity entity;
	struct omap3_isp_device *isp;
	struct v4l2_device *video;
	struct v4l2_mbus_framefmt format;
	struct v4l2_buffers_pool *pool;
	unsigned int queued;
	bool running;
};

#define to_omap3_isp_video(e)	container_of(e, struct omap3_isp_video, entity)

/*
 * struct omap3_isp_pool - OMAP3 buffers pool
 * @entity: OMAP3 entity
 * @list: Pools list
 * @isp: OMAP3 ISP device
 * @input: Capture video device
 * @output: Output video device
 * @pool: Buffers pool
 */
struct omap3_isp_pool {
	struct omap3_isp_entity entity;
	struct list_entry list;
	struct omap3_isp_device *isp;
	struct omap3_isp_video *input;
	struct omap3_isp_video *output;
	struct v4l2_buffers_pool *pool;
};

#define to_omap3_isp_pool(e)	container_of(e, struct omap3_isp_pool, entity)

/*
 * struct omap3_isp_resizer - OMAP3 ISP resizer parameters in a pipeline
 * @entity: The resizer entity
 * @zoom_min: Crop rectangle at minimum zoom
 * @zoom_max: Crop rectangle at maximum zoom (up to x4.0)
 * @pan_x: Zoom center along X axis
 * @pan_y: Zoom center along Y axis
 * @zoom: Zoom level (0.0 - 1.0)
 */
struct omap3_isp_resizer {
	struct omap3_isp_entity *entity;
	struct v4l2_rect zoom_min;
	struct v4l2_rect zoom_max;
};

enum omap3_isp_pipeline_state {
	OMAP3_ISP_PIPELINE_STOPPED,
	OMAP3_ISP_PIPELINE_RUNNING,
	OMAP3_ISP_PIPELINE_SUSPENDED,
};

/*
 * struct omap3_isp_pipeline - OMAP3 pipeline
 * @entitites: Entities in the pipeline
 * @scaler: Whether scaling should be performed on the ISP or the sensor
 * @pools: Pools in the pipeline
 * @input: Video device at the input of the pipeline
 * @output: Video device at the output of the pipeline
 * @state: Pipeline state
 */
struct omap3_isp_pipeline {
	struct list_entry entities;
	enum omap3_isp_scaler scaler;
	struct list_entry pools;
	struct omap3_isp_video *input;
	struct omap3_isp_video *output;
	enum omap3_isp_pipeline_state state;
	struct omap3_isp_resizer resizer;
};

enum omap3_isp_state {
	OMAP3_ISP_IDLE,
	OMAP3_ISP_VIEWFINDER,
	OMAP3_ISP_SNAPSHOT,
	OMAP3_ISP_SCALER,
};

struct omap3_isp_device {
	struct media_device *mdev;

	struct {
		struct media_entity *entity;
		struct v4l2_mbus_framefmt format;
		bool has_color_gains;
		bool has_global_gain;
	} sensor;
	struct {
		struct media_entity *entity;
	} ccdc;
	struct {
		struct media_entity *entity;
		struct omap3isp_prev_wbal wbal;
	} preview;
	struct {
		struct media_entity *entity;
	} resizer;
	struct omap3_isp_aewb aewb;

	struct omap3_isp_pipeline viewfinder;
	struct omap3_isp_pipeline snapshot;
	struct omap3_isp_pipeline scaler;

	enum omap3_isp_state state;

	const struct omap3_isp_operations *ops;
};

#endif