diff options
author | Sakari Ailus <sakari.ailus@nokia.com> | 2007-08-30 08:20:38 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:14:39 -0400 |
commit | 098c645e39e10dc580763b5ea4bd4fb390013474 (patch) | |
tree | 25013ceabf3fef962621300495eb379b70efcd1e | |
parent | 588005e1008f2cea61b7a1ae2a86c531e99b8c9c (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.c | 4 | ||||
-rw-r--r-- | include/media/v4l2-int-device.h | 130 |
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 | ||
156 | static int no_such_ioctl_1(struct v4l2_int_device *d, void *arg) | 156 | static 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 | |||
33 | enum v4l2_int_type { | 39 | enum 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 | ||
44 | struct v4l2_int_device; | ||
45 | |||
46 | struct 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 | |||
52 | typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *); | ||
53 | typedef int (v4l2_int_ioctl_func_0)(struct v4l2_int_device *); | ||
54 | typedef int (v4l2_int_ioctl_func_1)(struct v4l2_int_device *, void *); | ||
55 | |||
56 | struct v4l2_int_ioctl_desc { | ||
57 | int num; | ||
58 | v4l2_int_ioctl_func *func; | ||
59 | }; | ||
60 | |||
61 | struct 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 | |||
71 | struct 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 | |||
88 | int v4l2_int_device_register(struct v4l2_int_device *d); | ||
89 | void v4l2_int_device_unregister(struct v4l2_int_device *d); | ||
90 | |||
91 | int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd); | ||
92 | int 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. */ | ||
101 | enum v4l2_if_type { | ||
102 | }; | ||
103 | |||
104 | struct v4l2_ifparm { | ||
105 | enum v4l2_if_type if_type; | ||
106 | union { | ||
107 | } u; | ||
108 | }; | ||
109 | |||
110 | /* IOCTL command numbers. */ | ||
38 | enum v4l2_int_ioctl_num { | 111 | enum 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 | ||
94 | struct v4l2_int_device; | ||
95 | |||
96 | struct 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 | |||
102 | typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *); | ||
103 | typedef int (v4l2_int_ioctl_func_0)(struct v4l2_int_device *); | ||
104 | typedef int (v4l2_int_ioctl_func_1)(struct v4l2_int_device *, void *); | ||
105 | |||
106 | struct v4l2_int_ioctl_desc { | ||
107 | int num; | ||
108 | v4l2_int_ioctl_func *func; | ||
109 | }; | ||
110 | |||
111 | struct 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 | |||
121 | struct 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 | |||
138 | int v4l2_int_device_register(struct v4l2_int_device *d); | ||
139 | void v4l2_int_device_unregister(struct v4l2_int_device *d); | ||
140 | |||
141 | int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd); | ||
142 | int 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, *); | |||
199 | V4L2_INT_WRAPPER_0(dev_init); | 224 | V4L2_INT_WRAPPER_0(dev_init); |
200 | V4L2_INT_WRAPPER_0(dev_exit); | 225 | V4L2_INT_WRAPPER_0(dev_exit); |
201 | V4L2_INT_WRAPPER_1(s_power, int, ); | 226 | V4L2_INT_WRAPPER_1(s_power, int, ); |
227 | V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *); | ||
202 | V4L2_INT_WRAPPER_1(s_ext_clk, u32, ); | 228 | V4L2_INT_WRAPPER_1(s_ext_clk, u32, ); |
203 | V4L2_INT_WRAPPER_1(g_ext_clk, u32, *); | 229 | V4L2_INT_WRAPPER_1(g_ext_clk, u32, *); |
204 | V4L2_INT_WRAPPER_1(g_needs_reset, void, *); | 230 | V4L2_INT_WRAPPER_1(g_needs_reset, void, *); |