aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@nokia.com>2007-08-30 08:20:38 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:14:39 -0400
commit098c645e39e10dc580763b5ea4bd4fb390013474 (patch)
tree25013ceabf3fef962621300495eb379b70efcd1e
parent588005e1008f2cea61b7a1ae2a86c531e99b8c9c (diff)
V4L/DVB (6216): V4L: Int if: add vidioc_int_g_ifparm, other updates
vidioc_int_g_ifparm can be used to obtain hardware-specific information about the interface used by the slave. Rearrange v4l2-int-device.h as well. Also remove useless & characters. Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/v4l2-int-device.c4
-rw-r--r--include/media/v4l2-int-device.h130
2 files changed, 80 insertions, 54 deletions
diff --git a/drivers/media/video/v4l2-int-device.c b/drivers/media/video/v4l2-int-device.c
index a643730fa3b2..7ad8700ebdea 100644
--- a/drivers/media/video/v4l2-int-device.c
+++ b/drivers/media/video/v4l2-int-device.c
@@ -150,7 +150,7 @@ int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd)
150{ 150{
151 return ((v4l2_int_ioctl_func_0 *) 151 return ((v4l2_int_ioctl_func_0 *)
152 find_ioctl(d->u.slave, cmd, 152 find_ioctl(d->u.slave, cmd,
153 (v4l2_int_ioctl_func *)&no_such_ioctl_0))(d); 153 (v4l2_int_ioctl_func *)no_such_ioctl_0))(d);
154} 154}
155 155
156static int no_such_ioctl_1(struct v4l2_int_device *d, void *arg) 156static int no_such_ioctl_1(struct v4l2_int_device *d, void *arg)
@@ -162,5 +162,5 @@ int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg)
162{ 162{
163 return ((v4l2_int_ioctl_func_1 *) 163 return ((v4l2_int_ioctl_func_1 *)
164 find_ioctl(d->u.slave, cmd, 164 find_ioctl(d->u.slave, cmd,
165 (v4l2_int_ioctl_func *)&no_such_ioctl_1))(d, arg); 165 (v4l2_int_ioctl_func *)no_such_ioctl_1))(d, arg);
166} 166}
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index deb28ce6685d..861978deb3bf 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -30,11 +30,84 @@
30 30
31#define V4L2NAMESIZE 32 31#define V4L2NAMESIZE 32
32 32
33/*
34 *
35 * The internal V4L2 device interface core.
36 *
37 */
38
33enum v4l2_int_type { 39enum v4l2_int_type {
34 v4l2_int_type_master = 1, 40 v4l2_int_type_master = 1,
35 v4l2_int_type_slave 41 v4l2_int_type_slave
36}; 42};
37 43
44struct v4l2_int_device;
45
46struct v4l2_int_master {
47 int (*attach)(struct v4l2_int_device *master,
48 struct v4l2_int_device *slave);
49 void (*detach)(struct v4l2_int_device *master);
50};
51
52typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *);
53typedef int (v4l2_int_ioctl_func_0)(struct v4l2_int_device *);
54typedef int (v4l2_int_ioctl_func_1)(struct v4l2_int_device *, void *);
55
56struct v4l2_int_ioctl_desc {
57 int num;
58 v4l2_int_ioctl_func *func;
59};
60
61struct v4l2_int_slave {
62 /* Don't touch master. */
63 struct v4l2_int_device *master;
64
65 char attach_to[V4L2NAMESIZE];
66
67 int num_ioctls;
68 struct v4l2_int_ioctl_desc *ioctls;
69};
70
71struct v4l2_int_device {
72 /* Don't touch head. */
73 struct list_head head;
74
75 struct module *module;
76
77 char name[V4L2NAMESIZE];
78
79 enum v4l2_int_type type;
80 union {
81 struct v4l2_int_master *master;
82 struct v4l2_int_slave *slave;
83 } u;
84
85 void *priv;
86};
87
88int v4l2_int_device_register(struct v4l2_int_device *d);
89void v4l2_int_device_unregister(struct v4l2_int_device *d);
90
91int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd);
92int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg);
93
94/*
95 *
96 * Types and definitions for IOCTL commands.
97 *
98 */
99
100/* Slave interface type. */
101enum v4l2_if_type {
102};
103
104struct v4l2_ifparm {
105 enum v4l2_if_type if_type;
106 union {
107 } u;
108};
109
110/* IOCTL command numbers. */
38enum v4l2_int_ioctl_num { 111enum v4l2_int_ioctl_num {
39 /* 112 /*
40 * 113 *
@@ -62,10 +135,12 @@ enum v4l2_int_ioctl_num {
62 vidioc_int_dev_exit_num, 135 vidioc_int_dev_exit_num,
63 /* Set device power state: 0 is off, non-zero is on. */ 136 /* Set device power state: 0 is off, non-zero is on. */
64 vidioc_int_s_power_num, 137 vidioc_int_s_power_num,
65 /* Get parallel interface clock speed for current settings. */ 138 /* Get slave interface parameters. */
139 vidioc_int_g_ifparm_num,
140 /* Get external clock speed for current slave settings. */
66 vidioc_int_g_ext_clk_num, 141 vidioc_int_g_ext_clk_num,
67 /* 142 /*
68 * Tell what the parallel interface clock speed actually is. 143 * Tell what the generated interface clock speed actually is.
69 */ 144 */
70 vidioc_int_s_ext_clk_num, 145 vidioc_int_s_ext_clk_num,
71 /* Does the slave need to be reset after VIDIOC_DQBUF? */ 146 /* Does the slave need to be reset after VIDIOC_DQBUF? */
@@ -91,56 +166,6 @@ enum v4l2_int_ioctl_num {
91 vidioc_int_priv_start_num = 2000, 166 vidioc_int_priv_start_num = 2000,
92}; 167};
93 168
94struct v4l2_int_device;
95
96struct v4l2_int_master {
97 int (*attach)(struct v4l2_int_device *master,
98 struct v4l2_int_device *slave);
99 void (*detach)(struct v4l2_int_device *master);
100};
101
102typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *);
103typedef int (v4l2_int_ioctl_func_0)(struct v4l2_int_device *);
104typedef int (v4l2_int_ioctl_func_1)(struct v4l2_int_device *, void *);
105
106struct v4l2_int_ioctl_desc {
107 int num;
108 v4l2_int_ioctl_func *func;
109};
110
111struct v4l2_int_slave {
112 /* Don't touch master. */
113 struct v4l2_int_device *master;
114
115 char attach_to[V4L2NAMESIZE];
116
117 int num_ioctls;
118 struct v4l2_int_ioctl_desc *ioctls;
119};
120
121struct v4l2_int_device {
122 /* Don't touch head. */
123 struct list_head head;
124
125 struct module *module;
126
127 char name[V4L2NAMESIZE];
128
129 enum v4l2_int_type type;
130 union {
131 struct v4l2_int_master *master;
132 struct v4l2_int_slave *slave;
133 } u;
134
135 void *priv;
136};
137
138int v4l2_int_device_register(struct v4l2_int_device *d);
139void v4l2_int_device_unregister(struct v4l2_int_device *d);
140
141int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd);
142int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg);
143
144/* 169/*
145 * 170 *
146 * IOCTL wrapper functions for better type checking. 171 * IOCTL wrapper functions for better type checking.
@@ -199,6 +224,7 @@ V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *);
199V4L2_INT_WRAPPER_0(dev_init); 224V4L2_INT_WRAPPER_0(dev_init);
200V4L2_INT_WRAPPER_0(dev_exit); 225V4L2_INT_WRAPPER_0(dev_exit);
201V4L2_INT_WRAPPER_1(s_power, int, ); 226V4L2_INT_WRAPPER_1(s_power, int, );
227V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *);
202V4L2_INT_WRAPPER_1(s_ext_clk, u32, ); 228V4L2_INT_WRAPPER_1(s_ext_clk, u32, );
203V4L2_INT_WRAPPER_1(g_ext_clk, u32, *); 229V4L2_INT_WRAPPER_1(g_ext_clk, u32, *);
204V4L2_INT_WRAPPER_1(g_needs_reset, void, *); 230V4L2_INT_WRAPPER_1(g_needs_reset, void, *);