summaryrefslogtreecommitdiff
path: root/linux/include/media/soc_camera.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/include/media/soc_camera.h')
-rw-r--r--linux/include/media/soc_camera.h72
1 files changed, 51 insertions, 21 deletions
diff --git a/linux/include/media/soc_camera.h b/linux/include/media/soc_camera.h
index c886b1e64..6a8c8be7a 100644
--- a/linux/include/media/soc_camera.h
+++ b/linux/include/media/soc_camera.h
@@ -34,12 +34,12 @@ struct soc_camera_device {
unsigned short exposure;
unsigned char iface; /* Host number */
unsigned char devnum; /* Device number per host */
- unsigned char cached_datawidth; /* See comment in .c */
+ unsigned char buswidth; /* See comment in .c */
struct soc_camera_ops *ops;
struct video_device *vdev;
const struct soc_camera_data_format *current_fmt;
- int (*probe)(struct soc_camera_device *icd);
- void (*remove)(struct soc_camera_device *icd);
+ const struct soc_camera_data_format *formats;
+ int num_formats;
struct module *owner;
/* soc_camera.c private count. Only accessed with video_lock held */
int use_count;
@@ -48,6 +48,7 @@ struct soc_camera_device {
struct soc_camera_file {
struct soc_camera_device *icd;
struct videobuf_queue vb_vidq;
+ spinlock_t *lock;
};
struct soc_camera_host {
@@ -56,17 +57,25 @@ struct soc_camera_host {
unsigned char nr; /* Host number */
size_t msize;
struct videobuf_queue_ops *vbq_ops;
- struct module *owner;
void *priv;
char *drv_name;
+ struct soc_camera_host_ops *ops;
+};
+
+struct soc_camera_host_ops {
+ struct module *owner;
int (*add)(struct soc_camera_device *);
void (*remove)(struct soc_camera_device *);
- int (*set_capture_format)(struct soc_camera_device *, __u32,
- struct v4l2_rect *);
- int (*try_fmt_cap)(struct soc_camera_host *, struct v4l2_format *);
+ int (*set_fmt_cap)(struct soc_camera_device *, __u32,
+ struct v4l2_rect *);
+ int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *);
int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
+ int (*try_bus_param)(struct soc_camera_device *, __u32);
+ int (*set_bus_param)(struct soc_camera_device *, __u32);
unsigned int (*poll)(struct file *, poll_table *);
+ spinlock_t* (*spinlock_alloc)(struct soc_camera_file *);
+ void (*spinlock_free)(spinlock_t *);
};
struct soc_camera_link {
@@ -86,8 +95,7 @@ static inline struct soc_camera_host *to_soc_camera_host(struct device *dev)
return container_of(dev, struct soc_camera_host, dev);
}
-extern int soc_camera_host_register(struct soc_camera_host *ici,
- struct module *owner);
+extern int soc_camera_host_register(struct soc_camera_host *ici);
extern void soc_camera_host_unregister(struct soc_camera_host *ici);
extern int soc_camera_device_register(struct soc_camera_device *icd);
extern void soc_camera_device_unregister(struct soc_camera_device *icd);
@@ -104,26 +112,27 @@ struct soc_camera_data_format {
struct soc_camera_ops {
struct module *owner;
+ int (*probe)(struct soc_camera_device *);
+ void (*remove)(struct soc_camera_device *);
int (*init)(struct soc_camera_device *);
int (*release)(struct soc_camera_device *);
int (*start_capture)(struct soc_camera_device *);
int (*stop_capture)(struct soc_camera_device *);
- int (*set_capture_format)(struct soc_camera_device *, __u32,
- struct v4l2_rect *, unsigned int);
+ int (*set_fmt_cap)(struct soc_camera_device *, __u32,
+ struct v4l2_rect *);
int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
+ unsigned long (*query_bus_param)(struct soc_camera_device *);
+ int (*set_bus_param)(struct soc_camera_device *, unsigned long);
int (*get_chip_id)(struct soc_camera_device *,
struct v4l2_chip_ident *);
#ifdef CONFIG_VIDEO_ADV_DEBUG
int (*get_register)(struct soc_camera_device *, struct v4l2_register *);
int (*set_register)(struct soc_camera_device *, struct v4l2_register *);
#endif
- const struct soc_camera_data_format *formats;
- int num_formats;
int (*get_control)(struct soc_camera_device *, struct v4l2_control *);
int (*set_control)(struct soc_camera_device *, struct v4l2_control *);
const struct v4l2_queryctrl *controls;
int num_controls;
- unsigned int(*get_datawidth)(struct soc_camera_device *icd);
};
static inline struct v4l2_queryctrl const *soc_camera_find_qctrl(
@@ -138,12 +147,33 @@ static inline struct v4l2_queryctrl const *soc_camera_find_qctrl(
return NULL;
}
-#define IS_MASTER (1<<0)
-#define IS_HSYNC_ACTIVE_HIGH (1<<1)
-#define IS_VSYNC_ACTIVE_HIGH (1<<2)
-#define IS_DATAWIDTH_8 (1<<3)
-#define IS_DATAWIDTH_9 (1<<4)
-#define IS_DATAWIDTH_10 (1<<5)
-#define IS_PCLK_SAMPLE_RISING (1<<6)
+#define SOCAM_MASTER (1 << 0)
+#define SOCAM_SLAVE (1 << 1)
+#define SOCAM_HSYNC_ACTIVE_HIGH (1 << 2)
+#define SOCAM_HSYNC_ACTIVE_LOW (1 << 3)
+#define SOCAM_VSYNC_ACTIVE_HIGH (1 << 4)
+#define SOCAM_VSYNC_ACTIVE_LOW (1 << 5)
+#define SOCAM_DATAWIDTH_8 (1 << 6)
+#define SOCAM_DATAWIDTH_9 (1 << 7)
+#define SOCAM_DATAWIDTH_10 (1 << 8)
+#define SOCAM_PCLK_SAMPLE_RISING (1 << 9)
+#define SOCAM_PCLK_SAMPLE_FALLING (1 << 10)
+
+#define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_8 | SOCAM_DATAWIDTH_9 | \
+ SOCAM_DATAWIDTH_10)
+
+static inline unsigned long soc_camera_bus_param_compatible(
+ unsigned long camera_flags, unsigned long bus_flags)
+{
+ unsigned long common_flags, hsync, vsync, pclk;
+
+ common_flags = camera_flags & bus_flags;
+
+ hsync = common_flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW);
+ vsync = common_flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW);
+ pclk = common_flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING);
+
+ return (!hsync || !vsync || !pclk) ? 0 : common_flags;
+}
#endif