aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/s2255drv.c
diff options
context:
space:
mode:
authorDean Anderson <dean@sensoray.com>2009-04-23 15:04:41 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:42 -0400
commitabce21f40f1c7a52c9a126c6c00db1bd76e96b1d (patch)
treed0ad37addc6e5da64d739e27e2e79d710b75dd64 /drivers/media/video/s2255drv.c
parent7fc08bbb9965206c57270a911d0e9430aaf347f7 (diff)
V4L/DVB (11605): patch: s2255drv: code cleanup
This patch does: - remove unused structure items. - define Response values; - change Driver revision printk. Signed-off-by: Dean Anderson <dean@sensoray.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s2255drv.c')
-rw-r--r--drivers/media/video/s2255drv.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 30f4698be90a..90e1dbc1aa89 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -77,6 +77,8 @@
77#define MAX_CHANNELS 4 77#define MAX_CHANNELS 4
78#define S2255_MARKER_FRAME 0x2255DA4AL 78#define S2255_MARKER_FRAME 0x2255DA4AL
79#define S2255_MARKER_RESPONSE 0x2255ACACL 79#define S2255_MARKER_RESPONSE 0x2255ACACL
80#define S2255_RESPONSE_SETMODE 0x01
81#define S2255_RESPONSE_FW 0x10
80#define S2255_USB_XFER_SIZE (16 * 1024) 82#define S2255_USB_XFER_SIZE (16 * 1024)
81#define MAX_CHANNELS 4 83#define MAX_CHANNELS 4
82#define MAX_PIPE_BUFFERS 1 84#define MAX_PIPE_BUFFERS 1
@@ -178,9 +180,6 @@ struct s2255_bufferi {
178 180
179struct s2255_dmaqueue { 181struct s2255_dmaqueue {
180 struct list_head active; 182 struct list_head active;
181 /* thread for acquisition */
182 struct task_struct *kthread;
183 int frame;
184 struct s2255_dev *dev; 183 struct s2255_dev *dev;
185 int channel; 184 int channel;
186}; 185};
@@ -210,16 +209,11 @@ struct s2255_pipeinfo {
210 u32 max_transfer_size; 209 u32 max_transfer_size;
211 u32 cur_transfer_size; 210 u32 cur_transfer_size;
212 u8 *transfer_buffer; 211 u8 *transfer_buffer;
213 u32 transfer_flags;;
214 u32 state; 212 u32 state;
215 u32 prev_state;
216 u32 urb_size;
217 void *stream_urb; 213 void *stream_urb;
218 void *dev; /* back pointer to s2255_dev struct*/ 214 void *dev; /* back pointer to s2255_dev struct*/
219 u32 err_count; 215 u32 err_count;
220 u32 buf_index;
221 u32 idx; 216 u32 idx;
222 u32 priority_set;
223}; 217};
224 218
225struct s2255_fmt; /*forward declaration */ 219struct s2255_fmt; /*forward declaration */
@@ -239,8 +233,6 @@ struct s2255_dev {
239 struct list_head s2255_devlist; 233 struct list_head s2255_devlist;
240 struct timer_list timer; 234 struct timer_list timer;
241 struct s2255_fw *fw_data; 235 struct s2255_fw *fw_data;
242 int board_num;
243 int is_open;
244 struct s2255_pipeinfo pipes[MAX_PIPE_BUFFERS]; 236 struct s2255_pipeinfo pipes[MAX_PIPE_BUFFERS];
245 struct s2255_bufferi buffer[MAX_CHANNELS]; 237 struct s2255_bufferi buffer[MAX_CHANNELS];
246 struct s2255_mode mode[MAX_CHANNELS]; 238 struct s2255_mode mode[MAX_CHANNELS];
@@ -297,9 +289,10 @@ struct s2255_fh {
297 int resources[MAX_CHANNELS]; 289 int resources[MAX_CHANNELS];
298}; 290};
299 291
300#define CUR_USB_FWVER 774 /* current cypress EEPROM firmware version */ 292/* current cypress EEPROM firmware version */
293#define S2255_CUR_USB_FWVER ((3 << 8) | 6)
301#define S2255_MAJOR_VERSION 1 294#define S2255_MAJOR_VERSION 1
302#define S2255_MINOR_VERSION 13 295#define S2255_MINOR_VERSION 14
303#define S2255_RELEASE 0 296#define S2255_RELEASE 0
304#define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ 297#define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \
305 S2255_MINOR_VERSION, \ 298 S2255_MINOR_VERSION, \
@@ -1818,7 +1811,6 @@ static int s2255_probe_v4l(struct s2255_dev *dev)
1818 INIT_LIST_HEAD(&dev->vidq[i].active); 1811 INIT_LIST_HEAD(&dev->vidq[i].active);
1819 dev->vidq[i].dev = dev; 1812 dev->vidq[i].dev = dev;
1820 dev->vidq[i].channel = i; 1813 dev->vidq[i].channel = i;
1821 dev->vidq[i].kthread = NULL;
1822 /* register 4 video devices */ 1814 /* register 4 video devices */
1823 dev->vdev[i] = video_device_alloc(); 1815 dev->vdev[i] = video_device_alloc();
1824 memcpy(dev->vdev[i], &template, sizeof(struct video_device)); 1816 memcpy(dev->vdev[i], &template, sizeof(struct video_device));
@@ -1839,7 +1831,9 @@ static int s2255_probe_v4l(struct s2255_dev *dev)
1839 return ret; 1831 return ret;
1840 } 1832 }
1841 } 1833 }
1842 printk(KERN_INFO "Sensoray 2255 V4L driver\n"); 1834 printk(KERN_INFO "Sensoray 2255 V4L driver Revision: %d.%d\n",
1835 S2255_MAJOR_VERSION,
1836 S2255_MINOR_VERSION);
1843 return ret; 1837 return ret;
1844} 1838}
1845 1839
@@ -1929,14 +1923,14 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info)
1929 if (!(cc >= 0 && cc < MAX_CHANNELS)) 1923 if (!(cc >= 0 && cc < MAX_CHANNELS))
1930 break; 1924 break;
1931 switch (pdword[2]) { 1925 switch (pdword[2]) {
1932 case 0x01: 1926 case S2255_RESPONSE_SETMODE:
1933 /* check if channel valid */ 1927 /* check if channel valid */
1934 /* set mode ready */ 1928 /* set mode ready */
1935 dev->setmode_ready[cc] = 1; 1929 dev->setmode_ready[cc] = 1;
1936 wake_up(&dev->wait_setmode[cc]); 1930 wake_up(&dev->wait_setmode[cc]);
1937 dprintk(5, "setmode ready %d\n", cc); 1931 dprintk(5, "setmode ready %d\n", cc);
1938 break; 1932 break;
1939 case 0x10: 1933 case S2255_RESPONSE_FW:
1940 1934
1941 dev->chn_ready |= (1 << cc); 1935 dev->chn_ready |= (1 << cc);
1942 if ((dev->chn_ready & 0x0f) != 0x0f) 1936 if ((dev->chn_ready & 0x0f) != 0x0f)
@@ -2172,10 +2166,15 @@ static int s2255_board_init(struct s2255_dev *dev)
2172 /* query the firmware */ 2166 /* query the firmware */
2173 fw_ver = s2255_get_fx2fw(dev); 2167 fw_ver = s2255_get_fx2fw(dev);
2174 2168
2175 printk(KERN_INFO "2255 usb firmware version %d \n", fw_ver); 2169 printk(KERN_INFO "2255 usb firmware version %d.%d\n",
2176 if (fw_ver < CUR_USB_FWVER) 2170 (fw_ver >> 8) & 0xff,
2171 fw_ver & 0xff);
2172
2173 if (fw_ver < S2255_CUR_USB_FWVER)
2177 dev_err(&dev->udev->dev, 2174 dev_err(&dev->udev->dev,
2178 "usb firmware not up to date %d\n", fw_ver); 2175 "usb firmware not up to date %d.%d\n",
2176 (fw_ver >> 8) & 0xff,
2177 fw_ver & 0xff);
2179 2178
2180 for (j = 0; j < MAX_CHANNELS; j++) { 2179 for (j = 0; j < MAX_CHANNELS; j++) {
2181 dev->b_acquire[j] = 0; 2180 dev->b_acquire[j] = 0;
@@ -2283,8 +2282,7 @@ static int s2255_start_readpipe(struct s2255_dev *dev)
2283 2282
2284 for (i = 0; i < MAX_PIPE_BUFFERS; i++) { 2283 for (i = 0; i < MAX_PIPE_BUFFERS; i++) {
2285 pipe_info->state = 1; 2284 pipe_info->state = 1;
2286 pipe_info->buf_index = (u32) i; 2285 pipe_info->err_count = 0;
2287 pipe_info->priority_set = 0;
2288 pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL); 2286 pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL);
2289 if (!pipe_info->stream_urb) { 2287 if (!pipe_info->stream_urb) {
2290 dev_err(&dev->udev->dev, 2288 dev_err(&dev->udev->dev,
@@ -2298,7 +2296,6 @@ static int s2255_start_readpipe(struct s2255_dev *dev)
2298 pipe_info->cur_transfer_size, 2296 pipe_info->cur_transfer_size,
2299 read_pipe_completion, pipe_info); 2297 read_pipe_completion, pipe_info);
2300 2298
2301 pipe_info->urb_size = sizeof(pipe_info->stream_urb);
2302 dprintk(4, "submitting URB %p\n", pipe_info->stream_urb); 2299 dprintk(4, "submitting URB %p\n", pipe_info->stream_urb);
2303 retval = usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL); 2300 retval = usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL);
2304 if (retval) { 2301 if (retval) {
@@ -2403,8 +2400,6 @@ static void s2255_stop_readpipe(struct s2255_dev *dev)
2403 if (pipe_info->state == 0) 2400 if (pipe_info->state == 0)
2404 continue; 2401 continue;
2405 pipe_info->state = 0; 2402 pipe_info->state = 0;
2406 pipe_info->prev_state = 1;
2407
2408 } 2403 }
2409 } 2404 }
2410 2405
@@ -2542,7 +2537,9 @@ static int s2255_probe(struct usb_interface *interface,
2542 s2255_probe_v4l(dev); 2537 s2255_probe_v4l(dev);
2543 usb_reset_device(dev->udev); 2538 usb_reset_device(dev->udev);
2544 /* load 2255 board specific */ 2539 /* load 2255 board specific */
2545 s2255_board_init(dev); 2540 retval = s2255_board_init(dev);
2541 if (retval)
2542 goto error;
2546 2543
2547 dprintk(4, "before probe done %p\n", dev); 2544 dprintk(4, "before probe done %p\n", dev);
2548 spin_lock_init(&dev->slock); 2545 spin_lock_init(&dev->slock);