diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2008-12-01 07:45:27 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:38:24 -0500 |
commit | c2786ad27104c558b92343e8816e18654aae1759 (patch) | |
tree | 45d36ef3dd9f8182477a6386c5063aa3f4177dbb /include/media/soc_camera.h | |
parent | d2e3dce083bc96b3bfb71603eaa1726181f7184b (diff) |
V4L/DVB (9790): 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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/soc_camera.h')
-rw-r--r-- | include/media/soc_camera.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index dddaf45c9583..da57ffdaec4d 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
@@ -41,6 +41,8 @@ struct soc_camera_device { | |||
41 | const struct soc_camera_data_format *current_fmt; | 41 | const struct soc_camera_data_format *current_fmt; |
42 | const struct soc_camera_data_format *formats; | 42 | const struct soc_camera_data_format *formats; |
43 | int num_formats; | 43 | int num_formats; |
44 | struct soc_camera_format_xlate *user_formats; | ||
45 | int num_user_formats; | ||
44 | struct module *owner; | 46 | struct module *owner; |
45 | void *host_priv; /* per-device host private data */ | 47 | void *host_priv; /* per-device host private data */ |
46 | /* soc_camera.c private count. Only accessed with video_lock held */ | 48 | /* soc_camera.c private count. Only accessed with video_lock held */ |
@@ -65,8 +67,10 @@ struct soc_camera_host_ops { | |||
65 | struct module *owner; | 67 | struct module *owner; |
66 | int (*add)(struct soc_camera_device *); | 68 | int (*add)(struct soc_camera_device *); |
67 | void (*remove)(struct soc_camera_device *); | 69 | void (*remove)(struct soc_camera_device *); |
68 | int (*suspend)(struct soc_camera_device *, pm_message_t state); | 70 | int (*suspend)(struct soc_camera_device *, pm_message_t); |
69 | int (*resume)(struct soc_camera_device *); | 71 | int (*resume)(struct soc_camera_device *); |
72 | int (*get_formats)(struct soc_camera_device *, int, | ||
73 | struct soc_camera_format_xlate *); | ||
70 | int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); | 74 | int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); |
71 | int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); | 75 | int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); |
72 | void (*init_videobuf)(struct videobuf_queue *, | 76 | void (*init_videobuf)(struct videobuf_queue *, |
@@ -107,6 +111,8 @@ extern void soc_camera_video_stop(struct soc_camera_device *icd); | |||
107 | 111 | ||
108 | extern const struct soc_camera_data_format *soc_camera_format_by_fourcc( | 112 | extern const struct soc_camera_data_format *soc_camera_format_by_fourcc( |
109 | struct soc_camera_device *icd, unsigned int fourcc); | 113 | struct soc_camera_device *icd, unsigned int fourcc); |
114 | extern const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( | ||
115 | struct soc_camera_device *icd, unsigned int fourcc); | ||
110 | 116 | ||
111 | struct soc_camera_data_format { | 117 | struct soc_camera_data_format { |
112 | const char *name; | 118 | const char *name; |
@@ -115,6 +121,23 @@ struct soc_camera_data_format { | |||
115 | enum v4l2_colorspace colorspace; | 121 | enum v4l2_colorspace colorspace; |
116 | }; | 122 | }; |
117 | 123 | ||
124 | /** | ||
125 | * struct soc_camera_format_xlate - match between host and sensor formats | ||
126 | * @cam_fmt: sensor format provided by the sensor | ||
127 | * @host_fmt: host format after host translation from cam_fmt | ||
128 | * @buswidth: bus width for this format | ||
129 | * | ||
130 | * Host and sensor translation structure. Used in table of host and sensor | ||
131 | * formats matchings in soc_camera_device. A host can override the generic list | ||
132 | * generation by implementing get_formats(), and use it for format checks and | ||
133 | * format setup. | ||
134 | */ | ||
135 | struct soc_camera_format_xlate { | ||
136 | const struct soc_camera_data_format *cam_fmt; | ||
137 | const struct soc_camera_data_format *host_fmt; | ||
138 | unsigned char buswidth; | ||
139 | }; | ||
140 | |||
118 | struct soc_camera_ops { | 141 | struct soc_camera_ops { |
119 | struct module *owner; | 142 | struct module *owner; |
120 | int (*probe)(struct soc_camera_device *); | 143 | int (*probe)(struct soc_camera_device *); |