diff options
Diffstat (limited to 'drivers/usb/media/sn9c102.h')
-rw-r--r-- | drivers/usb/media/sn9c102.h | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/usb/media/sn9c102.h b/drivers/usb/media/sn9c102.h index e5cea0e2eb57..17d60c1eea7e 100644 --- a/drivers/usb/media/sn9c102.h +++ b/drivers/usb/media/sn9c102.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * V4L2 driver for SN9C10x PC Camera Controllers * | 2 | * V4L2 driver for SN9C10x PC Camera Controllers * |
3 | * * | 3 | * * |
4 | * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 4 | * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * | 7 | * it under the terms of the GNU General Public License as published by * |
@@ -23,7 +23,8 @@ | |||
23 | 23 | ||
24 | #include <linux/version.h> | 24 | #include <linux/version.h> |
25 | #include <linux/usb.h> | 25 | #include <linux/usb.h> |
26 | #include <linux/videodev.h> | 26 | #include <linux/videodev2.h> |
27 | #include <media/v4l2-common.h> | ||
27 | #include <linux/device.h> | 28 | #include <linux/device.h> |
28 | #include <linux/list.h> | 29 | #include <linux/list.h> |
29 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
@@ -52,13 +53,6 @@ | |||
52 | 53 | ||
53 | /*****************************************************************************/ | 54 | /*****************************************************************************/ |
54 | 55 | ||
55 | #define SN9C102_MODULE_NAME "V4L2 driver for SN9C10x PC Camera Controllers" | ||
56 | #define SN9C102_MODULE_AUTHOR "(C) 2004-2005 Luca Risolia" | ||
57 | #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | ||
58 | #define SN9C102_MODULE_LICENSE "GPL" | ||
59 | #define SN9C102_MODULE_VERSION "1:1.24a" | ||
60 | #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 24) | ||
61 | |||
62 | enum sn9c102_bridge { | 56 | enum sn9c102_bridge { |
63 | BRIDGE_SN9C101 = 0x01, | 57 | BRIDGE_SN9C101 = 0x01, |
64 | BRIDGE_SN9C102 = 0x02, | 58 | BRIDGE_SN9C102 = 0x02, |
@@ -102,12 +96,13 @@ enum sn9c102_stream_state { | |||
102 | STREAM_ON, | 96 | STREAM_ON, |
103 | }; | 97 | }; |
104 | 98 | ||
99 | typedef char sn9c103_sof_header_t[18]; | ||
105 | typedef char sn9c102_sof_header_t[12]; | 100 | typedef char sn9c102_sof_header_t[12]; |
106 | typedef char sn9c102_eof_header_t[4]; | 101 | typedef char sn9c102_eof_header_t[4]; |
107 | 102 | ||
108 | struct sn9c102_sysfs_attr { | 103 | struct sn9c102_sysfs_attr { |
109 | u8 reg, i2c_reg; | 104 | u8 reg, i2c_reg; |
110 | sn9c102_sof_header_t frame_header; | 105 | sn9c103_sof_header_t frame_header; |
111 | }; | 106 | }; |
112 | 107 | ||
113 | struct sn9c102_module_param { | 108 | struct sn9c102_module_param { |
@@ -118,8 +113,6 @@ static DECLARE_MUTEX(sn9c102_sysfs_lock); | |||
118 | static DECLARE_RWSEM(sn9c102_disconnect); | 113 | static DECLARE_RWSEM(sn9c102_disconnect); |
119 | 114 | ||
120 | struct sn9c102_device { | 115 | struct sn9c102_device { |
121 | struct device dev; | ||
122 | |||
123 | struct video_device* v4ldev; | 116 | struct video_device* v4ldev; |
124 | 117 | ||
125 | enum sn9c102_bridge bridge; | 118 | enum sn9c102_bridge bridge; |
@@ -140,8 +133,8 @@ struct sn9c102_device { | |||
140 | struct v4l2_jpegcompression compression; | 133 | struct v4l2_jpegcompression compression; |
141 | 134 | ||
142 | struct sn9c102_sysfs_attr sysfs; | 135 | struct sn9c102_sysfs_attr sysfs; |
143 | sn9c102_sof_header_t sof_header; | 136 | sn9c103_sof_header_t sof_header; |
144 | u16 reg[32]; | 137 | u16 reg[63]; |
145 | 138 | ||
146 | struct sn9c102_module_param module_param; | 139 | struct sn9c102_module_param module_param; |
147 | 140 | ||
@@ -160,7 +153,6 @@ sn9c102_attach_sensor(struct sn9c102_device* cam, | |||
160 | struct sn9c102_sensor* sensor) | 153 | struct sn9c102_sensor* sensor) |
161 | { | 154 | { |
162 | cam->sensor = sensor; | 155 | cam->sensor = sensor; |
163 | cam->sensor->dev = &cam->dev; | ||
164 | cam->sensor->usbdev = cam->usbdev; | 156 | cam->sensor->usbdev = cam->usbdev; |
165 | } | 157 | } |
166 | 158 | ||
@@ -170,19 +162,24 @@ sn9c102_attach_sensor(struct sn9c102_device* cam, | |||
170 | #undef KDBG | 162 | #undef KDBG |
171 | #ifdef SN9C102_DEBUG | 163 | #ifdef SN9C102_DEBUG |
172 | # define DBG(level, fmt, args...) \ | 164 | # define DBG(level, fmt, args...) \ |
173 | { \ | 165 | do { \ |
174 | if (debug >= (level)) { \ | 166 | if (debug >= (level)) { \ |
175 | if ((level) == 1) \ | 167 | if ((level) == 1) \ |
176 | dev_err(&cam->dev, fmt "\n", ## args); \ | 168 | dev_err(&cam->usbdev->dev, fmt "\n", ## args); \ |
177 | else if ((level) == 2) \ | 169 | else if ((level) == 2) \ |
178 | dev_info(&cam->dev, fmt "\n", ## args); \ | 170 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
179 | else if ((level) >= 3) \ | 171 | else if ((level) >= 3) \ |
180 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", \ | 172 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
181 | __FUNCTION__, __LINE__ , ## args); \ | 173 | __FUNCTION__, __LINE__ , ## args); \ |
182 | } \ | 174 | } \ |
183 | } | 175 | } while (0) |
176 | # define V4LDBG(level, name, cmd) \ | ||
177 | do { \ | ||
178 | if (debug >= (level)) \ | ||
179 | v4l_print_ioctl(name, cmd); \ | ||
180 | } while (0) | ||
184 | # define KDBG(level, fmt, args...) \ | 181 | # define KDBG(level, fmt, args...) \ |
185 | { \ | 182 | do { \ |
186 | if (debug >= (level)) { \ | 183 | if (debug >= (level)) { \ |
187 | if ((level) == 1 || (level) == 2) \ | 184 | if ((level) == 1 || (level) == 2) \ |
188 | pr_info("sn9c102: " fmt "\n", ## args); \ | 185 | pr_info("sn9c102: " fmt "\n", ## args); \ |
@@ -190,17 +187,18 @@ sn9c102_attach_sensor(struct sn9c102_device* cam, | |||
190 | pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ | 187 | pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ |
191 | __LINE__ , ## args); \ | 188 | __LINE__ , ## args); \ |
192 | } \ | 189 | } \ |
193 | } | 190 | } while (0) |
194 | #else | 191 | #else |
195 | # define KDBG(level, fmt, args...) do {;} while(0); | 192 | # define DBG(level, fmt, args...) do {;} while(0) |
196 | # define DBG(level, fmt, args...) do {;} while(0); | 193 | # define V4LDBG(level, name, cmd) do {;} while(0) |
194 | # define KDBG(level, fmt, args...) do {;} while(0) | ||
197 | #endif | 195 | #endif |
198 | 196 | ||
199 | #undef PDBG | 197 | #undef PDBG |
200 | #define PDBG(fmt, args...) \ | 198 | #define PDBG(fmt, args...) \ |
201 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args); | 199 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args) |
202 | 200 | ||
203 | #undef PDBGG | 201 | #undef PDBGG |
204 | #define PDBGG(fmt, args...) do {;} while(0); /* placeholder */ | 202 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
205 | 203 | ||
206 | #endif /* _SN9C102_H_ */ | 204 | #endif /* _SN9C102_H_ */ |