summaryrefslogtreecommitdiff
path: root/linux/include
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-12-01 13:45:27 +0100
committerGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-12-01 13:45:27 +0100
commit70459071e4ccc3617dc180337b15366b596f9047 (patch)
treeb921e56e616a09613deba556155bb1d63dc4efea /linux/include
parentdf64fb6c88d2244e8a6374b34ff395e31ec6ef4f (diff)
downloadmediapointer-dvb-s2-70459071e4ccc3617dc180337b15366b596f9047.tar.gz
mediapointer-dvb-s2-70459071e4ccc3617dc180337b15366b596f9047.tar.bz2
soc-camera: pixel format negotiation - core support
Allocate and fill a list of formats, supported by this specific camera-host combination. Use it for format enumeration. Take care to stay backwards-compatible. Camera hosts rely on sensor formats available, as well as host specific translations. We add a structure so that hosts can define a translation table and use it for format check and setup. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> --- drivers/media/video/soc_camera.c | 93 +++++++++++++++++++++++++++++++++----- include/media/soc_camera.h | 25 ++++++++++- 2 files changed, 105 insertions(+), 13 deletions(-)
Diffstat (limited to 'linux/include')
-rw-r--r--linux/include/media/soc_camera.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/linux/include/media/soc_camera.h b/linux/include/media/soc_camera.h
index dddaf45c9..da57ffdae 100644
--- a/linux/include/media/soc_camera.h
+++ b/linux/include/media/soc_camera.h
@@ -41,6 +41,8 @@ struct soc_camera_device {
const struct soc_camera_data_format *current_fmt;
const struct soc_camera_data_format *formats;
int num_formats;
+ struct soc_camera_format_xlate *user_formats;
+ int num_user_formats;
struct module *owner;
void *host_priv; /* per-device host private data */
/* soc_camera.c private count. Only accessed with video_lock held */
@@ -65,8 +67,10 @@ struct soc_camera_host_ops {
struct module *owner;
int (*add)(struct soc_camera_device *);
void (*remove)(struct soc_camera_device *);
- int (*suspend)(struct soc_camera_device *, pm_message_t state);
+ int (*suspend)(struct soc_camera_device *, pm_message_t);
int (*resume)(struct soc_camera_device *);
+ int (*get_formats)(struct soc_camera_device *, int,
+ struct soc_camera_format_xlate *);
int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *);
int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
void (*init_videobuf)(struct videobuf_queue *,
@@ -107,6 +111,8 @@ extern void soc_camera_video_stop(struct soc_camera_device *icd);
extern const struct soc_camera_data_format *soc_camera_format_by_fourcc(
struct soc_camera_device *icd, unsigned int fourcc);
+extern const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc(
+ struct soc_camera_device *icd, unsigned int fourcc);
struct soc_camera_data_format {
const char *name;
@@ -115,6 +121,23 @@ struct soc_camera_data_format {
enum v4l2_colorspace colorspace;
};
+/**
+ * struct soc_camera_format_xlate - match between host and sensor formats
+ * @cam_fmt: sensor format provided by the sensor
+ * @host_fmt: host format after host translation from cam_fmt
+ * @buswidth: bus width for this format
+ *
+ * Host and sensor translation structure. Used in table of host and sensor
+ * formats matchings in soc_camera_device. A host can override the generic list
+ * generation by implementing get_formats(), and use it for format checks and
+ * format setup.
+ */
+struct soc_camera_format_xlate {
+ const struct soc_camera_data_format *cam_fmt;
+ const struct soc_camera_data_format *host_fmt;
+ unsigned char buswidth;
+};
+
struct soc_camera_ops {
struct module *owner;
int (*probe)(struct soc_camera_device *);