diff options
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-audio.c | 91 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 3 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-reg.h | 2 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 44 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 4 |
5 files changed, 66 insertions, 78 deletions
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 15c03f0e69ad..94378ccb7505 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c | |||
@@ -62,9 +62,9 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev) | |||
62 | 62 | ||
63 | dprintk("Stopping isoc\n"); | 63 | dprintk("Stopping isoc\n"); |
64 | for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { | 64 | for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { |
65 | usb_unlink_urb(dev->adev->urb[i]); | 65 | usb_unlink_urb(dev->adev.urb[i]); |
66 | usb_free_urb(dev->adev->urb[i]); | 66 | usb_free_urb(dev->adev.urb[i]); |
67 | dev->adev->urb[i] = NULL; | 67 | dev->adev.urb[i] = NULL; |
68 | } | 68 | } |
69 | 69 | ||
70 | return 0; | 70 | return 0; |
@@ -81,8 +81,8 @@ static void em28xx_audio_isocirq(struct urb *urb) | |||
81 | unsigned int stride; | 81 | unsigned int stride; |
82 | struct snd_pcm_substream *substream; | 82 | struct snd_pcm_substream *substream; |
83 | struct snd_pcm_runtime *runtime; | 83 | struct snd_pcm_runtime *runtime; |
84 | if (dev->adev->capture_pcm_substream) { | 84 | if (dev->adev.capture_pcm_substream) { |
85 | substream = dev->adev->capture_pcm_substream; | 85 | substream = dev->adev.capture_pcm_substream; |
86 | runtime = substream->runtime; | 86 | runtime = substream->runtime; |
87 | stride = runtime->frame_bits >> 3; | 87 | stride = runtime->frame_bits >> 3; |
88 | 88 | ||
@@ -95,7 +95,7 @@ static void em28xx_audio_isocirq(struct urb *urb) | |||
95 | if (!length) | 95 | if (!length) |
96 | continue; | 96 | continue; |
97 | 97 | ||
98 | oldptr = dev->adev->hwptr_done_capture; | 98 | oldptr = dev->adev.hwptr_done_capture; |
99 | if (oldptr + length >= runtime->buffer_size) { | 99 | if (oldptr + length >= runtime->buffer_size) { |
100 | unsigned int cnt = | 100 | unsigned int cnt = |
101 | runtime->buffer_size - oldptr; | 101 | runtime->buffer_size - oldptr; |
@@ -110,16 +110,16 @@ static void em28xx_audio_isocirq(struct urb *urb) | |||
110 | 110 | ||
111 | snd_pcm_stream_lock(substream); | 111 | snd_pcm_stream_lock(substream); |
112 | 112 | ||
113 | dev->adev->hwptr_done_capture += length; | 113 | dev->adev.hwptr_done_capture += length; |
114 | if (dev->adev->hwptr_done_capture >= | 114 | if (dev->adev.hwptr_done_capture >= |
115 | runtime->buffer_size) | 115 | runtime->buffer_size) |
116 | dev->adev->hwptr_done_capture -= | 116 | dev->adev.hwptr_done_capture -= |
117 | runtime->buffer_size; | 117 | runtime->buffer_size; |
118 | 118 | ||
119 | dev->adev->capture_transfer_done += length; | 119 | dev->adev.capture_transfer_done += length; |
120 | if (dev->adev->capture_transfer_done >= | 120 | if (dev->adev.capture_transfer_done >= |
121 | runtime->period_size) { | 121 | runtime->period_size) { |
122 | dev->adev->capture_transfer_done -= | 122 | dev->adev.capture_transfer_done -= |
123 | runtime->period_size; | 123 | runtime->period_size; |
124 | period_elapsed = 1; | 124 | period_elapsed = 1; |
125 | } | 125 | } |
@@ -131,7 +131,7 @@ static void em28xx_audio_isocirq(struct urb *urb) | |||
131 | } | 131 | } |
132 | urb->status = 0; | 132 | urb->status = 0; |
133 | 133 | ||
134 | if (dev->adev->shutdown) | 134 | if (dev->adev.shutdown) |
135 | return; | 135 | return; |
136 | 136 | ||
137 | status = usb_submit_urb(urb, GFP_ATOMIC); | 137 | status = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -154,17 +154,17 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) | |||
154 | struct urb *urb; | 154 | struct urb *urb; |
155 | int j, k; | 155 | int j, k; |
156 | 156 | ||
157 | dev->adev->transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC); | 157 | dev->adev.transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC); |
158 | if (!dev->adev->transfer_buffer[i]) | 158 | if (!dev->adev.transfer_buffer[i]) |
159 | return -ENOMEM; | 159 | return -ENOMEM; |
160 | 160 | ||
161 | memset(dev->adev->transfer_buffer[i], 0x80, sb_size); | 161 | memset(dev->adev.transfer_buffer[i], 0x80, sb_size); |
162 | urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC); | 162 | urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC); |
163 | if (!urb) { | 163 | if (!urb) { |
164 | em28xx_errdev("usb_alloc_urb failed!\n"); | 164 | em28xx_errdev("usb_alloc_urb failed!\n"); |
165 | for (j = 0; j < i; j++) { | 165 | for (j = 0; j < i; j++) { |
166 | usb_free_urb(dev->adev->urb[j]); | 166 | usb_free_urb(dev->adev.urb[j]); |
167 | kfree(dev->adev->transfer_buffer[j]); | 167 | kfree(dev->adev.transfer_buffer[j]); |
168 | } | 168 | } |
169 | return -ENOMEM; | 169 | return -ENOMEM; |
170 | } | 170 | } |
@@ -173,7 +173,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) | |||
173 | urb->context = dev; | 173 | urb->context = dev; |
174 | urb->pipe = usb_rcvisocpipe(dev->udev, 0x83); | 174 | urb->pipe = usb_rcvisocpipe(dev->udev, 0x83); |
175 | urb->transfer_flags = URB_ISO_ASAP; | 175 | urb->transfer_flags = URB_ISO_ASAP; |
176 | urb->transfer_buffer = dev->adev->transfer_buffer[i]; | 176 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
177 | urb->interval = 1; | 177 | urb->interval = 1; |
178 | urb->complete = em28xx_audio_isocirq; | 178 | urb->complete = em28xx_audio_isocirq; |
179 | urb->number_of_packets = EM28XX_NUM_AUDIO_PACKETS; | 179 | urb->number_of_packets = EM28XX_NUM_AUDIO_PACKETS; |
@@ -185,11 +185,11 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) | |||
185 | urb->iso_frame_desc[j].length = | 185 | urb->iso_frame_desc[j].length = |
186 | EM28XX_AUDIO_MAX_PACKET_SIZE; | 186 | EM28XX_AUDIO_MAX_PACKET_SIZE; |
187 | } | 187 | } |
188 | dev->adev->urb[i] = urb; | 188 | dev->adev.urb[i] = urb; |
189 | } | 189 | } |
190 | 190 | ||
191 | for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { | 191 | for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { |
192 | errCode = usb_submit_urb(dev->adev->urb[i], GFP_ATOMIC); | 192 | errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); |
193 | if (errCode) { | 193 | if (errCode) { |
194 | em28xx_isoc_audio_deinit(dev); | 194 | em28xx_isoc_audio_deinit(dev); |
195 | 195 | ||
@@ -202,16 +202,16 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) | |||
202 | 202 | ||
203 | static int em28xx_cmd(struct em28xx *dev, int cmd, int arg) | 203 | static int em28xx_cmd(struct em28xx *dev, int cmd, int arg) |
204 | { | 204 | { |
205 | dprintk("%s transfer\n", (dev->adev->capture_stream == STREAM_ON)? | 205 | dprintk("%s transfer\n", (dev->adev.capture_stream == STREAM_ON) ? |
206 | "stop" : "start"); | 206 | "stop" : "start"); |
207 | 207 | ||
208 | switch (cmd) { | 208 | switch (cmd) { |
209 | case EM28XX_CAPTURE_STREAM_EN: | 209 | case EM28XX_CAPTURE_STREAM_EN: |
210 | if (dev->adev->capture_stream == STREAM_OFF && arg == 1) { | 210 | if (dev->adev.capture_stream == STREAM_OFF && arg == 1) { |
211 | dev->adev->capture_stream = STREAM_ON; | 211 | dev->adev.capture_stream = STREAM_ON; |
212 | em28xx_init_audio_isoc(dev); | 212 | em28xx_init_audio_isoc(dev); |
213 | } else if (dev->adev->capture_stream == STREAM_ON && arg == 0) { | 213 | } else if (dev->adev.capture_stream == STREAM_ON && arg == 0) { |
214 | dev->adev->capture_stream = STREAM_OFF; | 214 | dev->adev.capture_stream = STREAM_OFF; |
215 | em28xx_isoc_audio_deinit(dev); | 215 | em28xx_isoc_audio_deinit(dev); |
216 | } else { | 216 | } else { |
217 | printk(KERN_ERR "An underrun very likely occurred. " | 217 | printk(KERN_ERR "An underrun very likely occurred. " |
@@ -289,17 +289,17 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream) | |||
289 | goto err; | 289 | goto err; |
290 | 290 | ||
291 | runtime->hw = snd_em28xx_hw_capture; | 291 | runtime->hw = snd_em28xx_hw_capture; |
292 | if (dev->alt == 0 && dev->adev->users == 0) { | 292 | if (dev->alt == 0 && dev->adev.users == 0) { |
293 | int errCode; | 293 | int errCode; |
294 | dev->alt = 7; | 294 | dev->alt = 7; |
295 | errCode = usb_set_interface(dev->udev, 0, 7); | 295 | errCode = usb_set_interface(dev->udev, 0, 7); |
296 | dprintk("changing alternate number to 7\n"); | 296 | dprintk("changing alternate number to 7\n"); |
297 | } | 297 | } |
298 | 298 | ||
299 | dev->adev->users++; | 299 | dev->adev.users++; |
300 | 300 | ||
301 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); | 301 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
302 | dev->adev->capture_pcm_substream = substream; | 302 | dev->adev.capture_pcm_substream = substream; |
303 | runtime->private_data = dev; | 303 | runtime->private_data = dev; |
304 | 304 | ||
305 | return 0; | 305 | return 0; |
@@ -311,7 +311,7 @@ err: | |||
311 | static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) | 311 | static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) |
312 | { | 312 | { |
313 | struct em28xx *dev = snd_pcm_substream_chip(substream); | 313 | struct em28xx *dev = snd_pcm_substream_chip(substream); |
314 | dev->adev->users--; | 314 | dev->adev.users--; |
315 | 315 | ||
316 | dprintk("closing device\n"); | 316 | dprintk("closing device\n"); |
317 | 317 | ||
@@ -320,10 +320,10 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) | |||
320 | em28xx_audio_analog_set(dev); | 320 | em28xx_audio_analog_set(dev); |
321 | mutex_unlock(&dev->lock); | 321 | mutex_unlock(&dev->lock); |
322 | 322 | ||
323 | if (dev->adev->users == 0 && dev->adev->shutdown == 1) { | 323 | if (dev->adev.users == 0 && dev->adev.shutdown == 1) { |
324 | dprintk("audio users: %d\n", dev->adev->users); | 324 | dprintk("audio users: %d\n", dev->adev.users); |
325 | dprintk("disabling audio stream!\n"); | 325 | dprintk("disabling audio stream!\n"); |
326 | dev->adev->shutdown = 0; | 326 | dev->adev.shutdown = 0; |
327 | dprintk("released lock\n"); | 327 | dprintk("released lock\n"); |
328 | em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); | 328 | em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); |
329 | } | 329 | } |
@@ -356,7 +356,7 @@ static int snd_em28xx_hw_capture_free(struct snd_pcm_substream *substream) | |||
356 | 356 | ||
357 | dprintk("Stop capture, if needed\n"); | 357 | dprintk("Stop capture, if needed\n"); |
358 | 358 | ||
359 | if (dev->adev->capture_stream == STREAM_ON) | 359 | if (dev->adev.capture_stream == STREAM_ON) |
360 | em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); | 360 | em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); |
361 | 361 | ||
362 | return 0; | 362 | return 0; |
@@ -379,7 +379,7 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream, | |||
379 | em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 1); | 379 | em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 1); |
380 | return 0; | 380 | return 0; |
381 | case SNDRV_PCM_TRIGGER_STOP: | 381 | case SNDRV_PCM_TRIGGER_STOP: |
382 | dev->adev->shutdown = 1; | 382 | dev->adev.shutdown = 1; |
383 | return 0; | 383 | return 0; |
384 | default: | 384 | default: |
385 | return -EINVAL; | 385 | return -EINVAL; |
@@ -393,7 +393,7 @@ static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream | |||
393 | 393 | ||
394 | snd_pcm_uframes_t hwptr_done; | 394 | snd_pcm_uframes_t hwptr_done; |
395 | dev = snd_pcm_substream_chip(substream); | 395 | dev = snd_pcm_substream_chip(substream); |
396 | hwptr_done = dev->adev->hwptr_done_capture; | 396 | hwptr_done = dev->adev.hwptr_done_capture; |
397 | 397 | ||
398 | return hwptr_done; | 398 | return hwptr_done; |
399 | } | 399 | } |
@@ -420,7 +420,7 @@ static struct snd_pcm_ops snd_em28xx_pcm_capture = { | |||
420 | 420 | ||
421 | static int em28xx_audio_init(struct em28xx *dev) | 421 | static int em28xx_audio_init(struct em28xx *dev) |
422 | { | 422 | { |
423 | struct em28xx_audio *adev; | 423 | struct em28xx_audio *adev = &dev->adev; |
424 | struct snd_pcm *pcm; | 424 | struct snd_pcm *pcm; |
425 | struct snd_card *card; | 425 | struct snd_card *card; |
426 | static int devnr; | 426 | static int devnr; |
@@ -438,16 +438,9 @@ static int em28xx_audio_init(struct em28xx *dev) | |||
438 | printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " | 438 | printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " |
439 | "Rechberger\n"); | 439 | "Rechberger\n"); |
440 | 440 | ||
441 | adev = kzalloc(sizeof(*adev), GFP_KERNEL); | ||
442 | if (!adev) { | ||
443 | printk(KERN_ERR "em28xx-audio.c: out of memory\n"); | ||
444 | return -1; | ||
445 | } | ||
446 | card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); | 441 | card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); |
447 | if (card == NULL) { | 442 | if (card == NULL) |
448 | kfree(adev); | ||
449 | return -ENOMEM; | 443 | return -ENOMEM; |
450 | } | ||
451 | 444 | ||
452 | spin_lock_init(&adev->slock); | 445 | spin_lock_init(&adev->slock); |
453 | err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); | 446 | err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); |
@@ -471,7 +464,6 @@ static int em28xx_audio_init(struct em28xx *dev) | |||
471 | } | 464 | } |
472 | adev->sndcard = card; | 465 | adev->sndcard = card; |
473 | adev->udev = dev->udev; | 466 | adev->udev = dev->udev; |
474 | dev->adev = adev; | ||
475 | 467 | ||
476 | return 0; | 468 | return 0; |
477 | } | 469 | } |
@@ -488,10 +480,9 @@ static int em28xx_audio_fini(struct em28xx *dev) | |||
488 | return 0; | 480 | return 0; |
489 | } | 481 | } |
490 | 482 | ||
491 | if (dev->adev) { | 483 | if (dev->adev.sndcard) { |
492 | snd_card_free(dev->adev->sndcard); | 484 | snd_card_free(dev->adev.sndcard); |
493 | kfree(dev->adev); | 485 | dev->adev.sndcard = NULL; |
494 | dev->adev = NULL; | ||
495 | } | 486 | } |
496 | 487 | ||
497 | return 0; | 488 | return 0; |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index f8504518586a..819cceaa6ef4 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -1000,12 +1000,11 @@ void em28xx_wake_i2c(struct em28xx *dev) | |||
1000 | static LIST_HEAD(em28xx_devlist); | 1000 | static LIST_HEAD(em28xx_devlist); |
1001 | static DEFINE_MUTEX(em28xx_devlist_mutex); | 1001 | static DEFINE_MUTEX(em28xx_devlist_mutex); |
1002 | 1002 | ||
1003 | struct em28xx *em28xx_get_device(struct inode *inode, | 1003 | struct em28xx *em28xx_get_device(int minor, |
1004 | enum v4l2_buf_type *fh_type, | 1004 | enum v4l2_buf_type *fh_type, |
1005 | int *has_radio) | 1005 | int *has_radio) |
1006 | { | 1006 | { |
1007 | struct em28xx *h, *dev = NULL; | 1007 | struct em28xx *h, *dev = NULL; |
1008 | int minor = iminor(inode); | ||
1009 | 1008 | ||
1010 | *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1009 | *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1011 | *has_radio = 0; | 1010 | *has_radio = 0; |
diff --git a/drivers/media/video/em28xx/em28xx-reg.h b/drivers/media/video/em28xx/em28xx-reg.h index 65dcb91bdcc2..24e39c56811e 100644 --- a/drivers/media/video/em28xx/em28xx-reg.h +++ b/drivers/media/video/em28xx/em28xx-reg.h | |||
@@ -160,7 +160,7 @@ | |||
160 | 160 | ||
161 | /* FIXME: Need to be populated with the other chip ID's */ | 161 | /* FIXME: Need to be populated with the other chip ID's */ |
162 | enum em28xx_chip_id { | 162 | enum em28xx_chip_id { |
163 | CHIP_ID_EM2820 = 18, | 163 | CHIP_ID_EM2820 = 18, /* Also used by em2710 */ |
164 | CHIP_ID_EM2840 = 20, | 164 | CHIP_ID_EM2840 = 20, |
165 | CHIP_ID_EM2750 = 33, | 165 | CHIP_ID_EM2750 = 33, |
166 | CHIP_ID_EM2860 = 34, | 166 | CHIP_ID_EM2860 = 34, |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 53527536481e..416b691c33c1 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -1154,7 +1154,7 @@ static int em28xx_reg_len(int reg) | |||
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | static int vidioc_g_chip_ident(struct file *file, void *priv, | 1156 | static int vidioc_g_chip_ident(struct file *file, void *priv, |
1157 | struct v4l2_chip_ident *chip) | 1157 | struct v4l2_dbg_chip_ident *chip) |
1158 | { | 1158 | { |
1159 | struct em28xx_fh *fh = priv; | 1159 | struct em28xx_fh *fh = priv; |
1160 | struct em28xx *dev = fh->dev; | 1160 | struct em28xx *dev = fh->dev; |
@@ -1162,20 +1162,20 @@ static int vidioc_g_chip_ident(struct file *file, void *priv, | |||
1162 | chip->ident = V4L2_IDENT_NONE; | 1162 | chip->ident = V4L2_IDENT_NONE; |
1163 | chip->revision = 0; | 1163 | chip->revision = 0; |
1164 | 1164 | ||
1165 | em28xx_i2c_call_clients(dev, VIDIOC_G_CHIP_IDENT, chip); | 1165 | em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_CHIP_IDENT, chip); |
1166 | 1166 | ||
1167 | return 0; | 1167 | return 0; |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | 1170 | ||
1171 | static int vidioc_g_register(struct file *file, void *priv, | 1171 | static int vidioc_g_register(struct file *file, void *priv, |
1172 | struct v4l2_register *reg) | 1172 | struct v4l2_dbg_register *reg) |
1173 | { | 1173 | { |
1174 | struct em28xx_fh *fh = priv; | 1174 | struct em28xx_fh *fh = priv; |
1175 | struct em28xx *dev = fh->dev; | 1175 | struct em28xx *dev = fh->dev; |
1176 | int ret; | 1176 | int ret; |
1177 | 1177 | ||
1178 | switch (reg->match_type) { | 1178 | switch (reg->match.type) { |
1179 | case V4L2_CHIP_MATCH_AC97: | 1179 | case V4L2_CHIP_MATCH_AC97: |
1180 | mutex_lock(&dev->lock); | 1180 | mutex_lock(&dev->lock); |
1181 | ret = em28xx_read_ac97(dev, reg->reg); | 1181 | ret = em28xx_read_ac97(dev, reg->reg); |
@@ -1184,6 +1184,7 @@ static int vidioc_g_register(struct file *file, void *priv, | |||
1184 | return ret; | 1184 | return ret; |
1185 | 1185 | ||
1186 | reg->val = ret; | 1186 | reg->val = ret; |
1187 | reg->size = 1; | ||
1187 | return 0; | 1188 | return 0; |
1188 | case V4L2_CHIP_MATCH_I2C_DRIVER: | 1189 | case V4L2_CHIP_MATCH_I2C_DRIVER: |
1189 | em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg); | 1190 | em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg); |
@@ -1192,12 +1193,13 @@ static int vidioc_g_register(struct file *file, void *priv, | |||
1192 | /* Not supported yet */ | 1193 | /* Not supported yet */ |
1193 | return -EINVAL; | 1194 | return -EINVAL; |
1194 | default: | 1195 | default: |
1195 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) | 1196 | if (!v4l2_chip_match_host(®->match)) |
1196 | return -EINVAL; | 1197 | return -EINVAL; |
1197 | } | 1198 | } |
1198 | 1199 | ||
1199 | /* Match host */ | 1200 | /* Match host */ |
1200 | if (em28xx_reg_len(reg->reg) == 1) { | 1201 | reg->size = em28xx_reg_len(reg->reg); |
1202 | if (reg->size == 1) { | ||
1201 | mutex_lock(&dev->lock); | 1203 | mutex_lock(&dev->lock); |
1202 | ret = em28xx_read_reg(dev, reg->reg); | 1204 | ret = em28xx_read_reg(dev, reg->reg); |
1203 | mutex_unlock(&dev->lock); | 1205 | mutex_unlock(&dev->lock); |
@@ -1207,7 +1209,7 @@ static int vidioc_g_register(struct file *file, void *priv, | |||
1207 | 1209 | ||
1208 | reg->val = ret; | 1210 | reg->val = ret; |
1209 | } else { | 1211 | } else { |
1210 | __le64 val = 0; | 1212 | __le16 val = 0; |
1211 | mutex_lock(&dev->lock); | 1213 | mutex_lock(&dev->lock); |
1212 | ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, | 1214 | ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, |
1213 | reg->reg, (char *)&val, 2); | 1215 | reg->reg, (char *)&val, 2); |
@@ -1215,21 +1217,21 @@ static int vidioc_g_register(struct file *file, void *priv, | |||
1215 | if (ret < 0) | 1217 | if (ret < 0) |
1216 | return ret; | 1218 | return ret; |
1217 | 1219 | ||
1218 | reg->val = le64_to_cpu(val); | 1220 | reg->val = le16_to_cpu(val); |
1219 | } | 1221 | } |
1220 | 1222 | ||
1221 | return 0; | 1223 | return 0; |
1222 | } | 1224 | } |
1223 | 1225 | ||
1224 | static int vidioc_s_register(struct file *file, void *priv, | 1226 | static int vidioc_s_register(struct file *file, void *priv, |
1225 | struct v4l2_register *reg) | 1227 | struct v4l2_dbg_register *reg) |
1226 | { | 1228 | { |
1227 | struct em28xx_fh *fh = priv; | 1229 | struct em28xx_fh *fh = priv; |
1228 | struct em28xx *dev = fh->dev; | 1230 | struct em28xx *dev = fh->dev; |
1229 | __le64 buf; | 1231 | __le16 buf; |
1230 | int rc; | 1232 | int rc; |
1231 | 1233 | ||
1232 | switch (reg->match_type) { | 1234 | switch (reg->match.type) { |
1233 | case V4L2_CHIP_MATCH_AC97: | 1235 | case V4L2_CHIP_MATCH_AC97: |
1234 | mutex_lock(&dev->lock); | 1236 | mutex_lock(&dev->lock); |
1235 | rc = em28xx_write_ac97(dev, reg->reg, reg->val); | 1237 | rc = em28xx_write_ac97(dev, reg->reg, reg->val); |
@@ -1243,12 +1245,12 @@ static int vidioc_s_register(struct file *file, void *priv, | |||
1243 | /* Not supported yet */ | 1245 | /* Not supported yet */ |
1244 | return -EINVAL; | 1246 | return -EINVAL; |
1245 | default: | 1247 | default: |
1246 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) | 1248 | if (!v4l2_chip_match_host(®->match)) |
1247 | return -EINVAL; | 1249 | return -EINVAL; |
1248 | } | 1250 | } |
1249 | 1251 | ||
1250 | /* Match host */ | 1252 | /* Match host */ |
1251 | buf = cpu_to_le64(reg->val); | 1253 | buf = cpu_to_le16(reg->val); |
1252 | 1254 | ||
1253 | mutex_lock(&dev->lock); | 1255 | mutex_lock(&dev->lock); |
1254 | rc = em28xx_write_regs(dev, reg->reg, (char *)&buf, | 1256 | rc = em28xx_write_regs(dev, reg->reg, (char *)&buf, |
@@ -1582,15 +1584,15 @@ static int radio_queryctrl(struct file *file, void *priv, | |||
1582 | * em28xx_v4l2_open() | 1584 | * em28xx_v4l2_open() |
1583 | * inits the device and starts isoc transfer | 1585 | * inits the device and starts isoc transfer |
1584 | */ | 1586 | */ |
1585 | static int em28xx_v4l2_open(struct inode *inode, struct file *filp) | 1587 | static int em28xx_v4l2_open(struct file *filp) |
1586 | { | 1588 | { |
1587 | int minor = iminor(inode); | 1589 | int minor = video_devdata(filp)->minor; |
1588 | int errCode = 0, radio; | 1590 | int errCode = 0, radio; |
1589 | struct em28xx *dev; | 1591 | struct em28xx *dev; |
1590 | enum v4l2_buf_type fh_type; | 1592 | enum v4l2_buf_type fh_type; |
1591 | struct em28xx_fh *fh; | 1593 | struct em28xx_fh *fh; |
1592 | 1594 | ||
1593 | dev = em28xx_get_device(inode, &fh_type, &radio); | 1595 | dev = em28xx_get_device(minor, &fh_type, &radio); |
1594 | 1596 | ||
1595 | if (NULL == dev) | 1597 | if (NULL == dev) |
1596 | return -ENODEV; | 1598 | return -ENODEV; |
@@ -1686,7 +1688,7 @@ void em28xx_release_analog_resources(struct em28xx *dev) | |||
1686 | * stops streaming and deallocates all resources allocated by the v4l2 | 1688 | * stops streaming and deallocates all resources allocated by the v4l2 |
1687 | * calls and ioctls | 1689 | * calls and ioctls |
1688 | */ | 1690 | */ |
1689 | static int em28xx_v4l2_close(struct inode *inode, struct file *filp) | 1691 | static int em28xx_v4l2_close(struct file *filp) |
1690 | { | 1692 | { |
1691 | struct em28xx_fh *fh = filp->private_data; | 1693 | struct em28xx_fh *fh = filp->private_data; |
1692 | struct em28xx *dev = fh->dev; | 1694 | struct em28xx *dev = fh->dev; |
@@ -1826,7 +1828,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | |||
1826 | return rc; | 1828 | return rc; |
1827 | } | 1829 | } |
1828 | 1830 | ||
1829 | static const struct file_operations em28xx_v4l_fops = { | 1831 | static const struct v4l2_file_operations em28xx_v4l_fops = { |
1830 | .owner = THIS_MODULE, | 1832 | .owner = THIS_MODULE, |
1831 | .open = em28xx_v4l2_open, | 1833 | .open = em28xx_v4l2_open, |
1832 | .release = em28xx_v4l2_close, | 1834 | .release = em28xx_v4l2_close, |
@@ -1834,8 +1836,6 @@ static const struct file_operations em28xx_v4l_fops = { | |||
1834 | .poll = em28xx_v4l2_poll, | 1836 | .poll = em28xx_v4l2_poll, |
1835 | .mmap = em28xx_v4l2_mmap, | 1837 | .mmap = em28xx_v4l2_mmap, |
1836 | .ioctl = video_ioctl2, | 1838 | .ioctl = video_ioctl2, |
1837 | .llseek = no_llseek, | ||
1838 | .compat_ioctl = v4l_compat_ioctl32, | ||
1839 | }; | 1839 | }; |
1840 | 1840 | ||
1841 | static const struct v4l2_ioctl_ops video_ioctl_ops = { | 1841 | static const struct v4l2_ioctl_ops video_ioctl_ops = { |
@@ -1890,13 +1890,11 @@ static const struct video_device em28xx_video_template = { | |||
1890 | .current_norm = V4L2_STD_PAL, | 1890 | .current_norm = V4L2_STD_PAL, |
1891 | }; | 1891 | }; |
1892 | 1892 | ||
1893 | static const struct file_operations radio_fops = { | 1893 | static const struct v4l2_file_operations radio_fops = { |
1894 | .owner = THIS_MODULE, | 1894 | .owner = THIS_MODULE, |
1895 | .open = em28xx_v4l2_open, | 1895 | .open = em28xx_v4l2_open, |
1896 | .release = em28xx_v4l2_close, | 1896 | .release = em28xx_v4l2_close, |
1897 | .ioctl = video_ioctl2, | 1897 | .ioctl = video_ioctl2, |
1898 | .compat_ioctl = v4l_compat_ioctl32, | ||
1899 | .llseek = no_llseek, | ||
1900 | }; | 1898 | }; |
1901 | 1899 | ||
1902 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { | 1900 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index b5eddc26388e..6c6b94aa05b2 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -473,7 +473,7 @@ struct em28xx { | |||
473 | unsigned long i2c_hash; /* i2c devicelist hash - | 473 | unsigned long i2c_hash; /* i2c devicelist hash - |
474 | for boards with generic ID */ | 474 | for boards with generic ID */ |
475 | 475 | ||
476 | struct em28xx_audio *adev; | 476 | struct em28xx_audio adev; |
477 | 477 | ||
478 | /* states */ | 478 | /* states */ |
479 | enum em28xx_dev_state state; | 479 | enum em28xx_dev_state state; |
@@ -583,7 +583,7 @@ int em28xx_gpio_set(struct em28xx *dev, struct em28xx_reg_seq *gpio); | |||
583 | void em28xx_wake_i2c(struct em28xx *dev); | 583 | void em28xx_wake_i2c(struct em28xx *dev); |
584 | void em28xx_remove_from_devlist(struct em28xx *dev); | 584 | void em28xx_remove_from_devlist(struct em28xx *dev); |
585 | void em28xx_add_into_devlist(struct em28xx *dev); | 585 | void em28xx_add_into_devlist(struct em28xx *dev); |
586 | struct em28xx *em28xx_get_device(struct inode *inode, | 586 | struct em28xx *em28xx_get_device(int minor, |
587 | enum v4l2_buf_type *fh_type, | 587 | enum v4l2_buf_type *fh_type, |
588 | int *has_radio); | 588 | int *has_radio); |
589 | int em28xx_register_extension(struct em28xx_ops *dev); | 589 | int em28xx_register_extension(struct em28xx_ops *dev); |