aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:50:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:19:17 -0400
commit6a6c8786725c0b3d143674effa8b772f47b1c189 (patch)
tree8bb76c5dcbd579f13e876bd1a0bb56bee4bcebdd /include
parent0166b74374cae3fa8bff0caef726a3d960a9a50a (diff)
V4L/DVB (12534): soc-camera: V4L2 API compliant scaling (S_FMT) and cropping (S_CROP)
The initial soc-camera scaling and cropping implementation turned out to be incompliant with the V4L2 API, e.g., it expected the user to specify cropping in output window pixels, instead of input window pixels. This patch converts the soc-camera core and all drivers to comply with the standard. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/media/soc_camera.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 344d89904774..3185e8daaa0a 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -22,8 +22,8 @@ struct soc_camera_device {
22 struct list_head list; 22 struct list_head list;
23 struct device dev; 23 struct device dev;
24 struct device *pdev; /* Platform device */ 24 struct device *pdev; /* Platform device */
25 struct v4l2_rect rect_current; /* Current window */ 25 s32 user_width;
26 struct v4l2_rect rect_max; /* Maximum window */ 26 s32 user_height;
27 unsigned short width_min; 27 unsigned short width_min;
28 unsigned short height_min; 28 unsigned short height_min;
29 unsigned short y_skip_top; /* Lines to skip at the top */ 29 unsigned short y_skip_top; /* Lines to skip at the top */
@@ -76,6 +76,8 @@ struct soc_camera_host_ops {
76 int (*get_formats)(struct soc_camera_device *, int, 76 int (*get_formats)(struct soc_camera_device *, int,
77 struct soc_camera_format_xlate *); 77 struct soc_camera_format_xlate *);
78 void (*put_formats)(struct soc_camera_device *); 78 void (*put_formats)(struct soc_camera_device *);
79 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *);
80 int (*get_crop)(struct soc_camera_device *, struct v4l2_crop *);
79 int (*set_crop)(struct soc_camera_device *, struct v4l2_crop *); 81 int (*set_crop)(struct soc_camera_device *, struct v4l2_crop *);
80 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); 82 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
81 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 83 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
@@ -277,6 +279,21 @@ static inline unsigned long soc_camera_bus_param_compatible(
277 common_flags; 279 common_flags;
278} 280}
279 281
282static inline void soc_camera_limit_side(unsigned int *start,
283 unsigned int *length, unsigned int start_min,
284 unsigned int length_min, unsigned int length_max)
285{
286 if (*length < length_min)
287 *length = length_min;
288 else if (*length > length_max)
289 *length = length_max;
290
291 if (*start < start_min)
292 *start = start_min;
293 else if (*start > start_min + length_max - *length)
294 *start = start_min + length_max - *length;
295}
296
280extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 297extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
281 unsigned long flags); 298 unsigned long flags);
282 299