aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c18
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c4
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c10
-rw-r--r--drivers/media/video/em28xx/em28xx-reg.h1
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c32
5 files changed, 47 insertions, 18 deletions
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 92b2a6db4fdc..3c006103c1eb 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -268,6 +268,12 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
268 268
269 dprintk("opening device and trying to acquire exclusive lock\n"); 269 dprintk("opening device and trying to acquire exclusive lock\n");
270 270
271 if (!dev) {
272 printk(KERN_ERR "BUG: em28xx can't find device struct."
273 " Can't proceed with open\n");
274 return -ENODEV;
275 }
276
271 /* Sets volume, mute, etc */ 277 /* Sets volume, mute, etc */
272 278
273 dev->mute = 0; 279 dev->mute = 0;
@@ -415,6 +421,12 @@ static int em28xx_audio_init(struct em28xx *dev)
415 static int devnr; 421 static int devnr;
416 int ret, err; 422 int ret, err;
417 423
424 if (dev->has_audio_class) {
425 /* This device does not support the extension (in this case
426 the device is expecting the snd-usb-audio module */
427 return 0;
428 }
429
418 printk(KERN_INFO "em28xx-audio.c: probing for em28x1 " 430 printk(KERN_INFO "em28xx-audio.c: probing for em28x1 "
419 "non standard usbaudio\n"); 431 "non standard usbaudio\n");
420 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " 432 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
@@ -458,6 +470,12 @@ static int em28xx_audio_fini(struct em28xx *dev)
458 if (dev == NULL) 470 if (dev == NULL)
459 return 0; 471 return 0;
460 472
473 if (dev->has_audio_class) {
474 /* This device does not support the extension (in this case
475 the device is expecting the snd-usb-audio module */
476 return 0;
477 }
478
461 if (dev->adev) { 479 if (dev->adev) {
462 snd_card_free(dev->adev->sndcard); 480 snd_card_free(dev->adev->sndcard);
463 kfree(dev->adev); 481 kfree(dev->adev);
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 3e4f3c7e92e7..8cbda43727c3 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -157,6 +157,7 @@ struct em28xx_board em28xx_boards[] = {
157 .tda9887_conf = TDA9887_PRESENT, 157 .tda9887_conf = TDA9887_PRESENT,
158 .tuner_type = TUNER_XC2028, 158 .tuner_type = TUNER_XC2028,
159 .mts_firmware = 1, 159 .mts_firmware = 1,
160 .has_dvb = 1,
160 .decoder = EM28XX_TVP5150, 161 .decoder = EM28XX_TVP5150,
161 .input = { { 162 .input = { {
162 .type = EM28XX_VMUX_TELEVISION, 163 .type = EM28XX_VMUX_TELEVISION,
@@ -524,6 +525,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
524 rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID); 525 rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
525 if (rc > 0) { 526 if (rc > 0) {
526 switch (rc) { 527 switch (rc) {
528 case CHIP_ID_EM2860:
529 em28xx_info("chip ID is em2860\n");
530 break;
527 case CHIP_ID_EM2883: 531 case CHIP_ID_EM2883:
528 em28xx_info("chip ID is em2882/em2883\n"); 532 em28xx_info("chip ID is em2882/em2883\n");
529 dev->wait_after_write = 0; 533 dev->wait_after_write = 0;
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index 8cf4983f0039..0b2333ee07f8 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -382,6 +382,11 @@ static int dvb_init(struct em28xx *dev)
382 int result = 0; 382 int result = 0;
383 struct em28xx_dvb *dvb; 383 struct em28xx_dvb *dvb;
384 384
385 if (!dev->has_dvb) {
386 /* This device does not support the extension */
387 return 0;
388 }
389
385 dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL); 390 dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
386 391
387 if (dvb == NULL) { 392 if (dvb == NULL) {
@@ -444,6 +449,11 @@ out_free:
444 449
445static int dvb_fini(struct em28xx *dev) 450static int dvb_fini(struct em28xx *dev)
446{ 451{
452 if (!dev->has_dvb) {
453 /* This device does not support the extension */
454 return 0;
455 }
456
447 if (dev->dvb) { 457 if (dev->dvb) {
448 unregister_dvb(dev->dvb); 458 unregister_dvb(dev->dvb);
449 dev->dvb = NULL; 459 dev->dvb = NULL;
diff --git a/drivers/media/video/em28xx/em28xx-reg.h b/drivers/media/video/em28xx/em28xx-reg.h
index 9058bed07953..fac1ab23f621 100644
--- a/drivers/media/video/em28xx/em28xx-reg.h
+++ b/drivers/media/video/em28xx/em28xx-reg.h
@@ -84,5 +84,6 @@
84 84
85/* FIXME: Need to be populated with the other chip ID's */ 85/* FIXME: Need to be populated with the other chip ID's */
86enum em28xx_chip_id { 86enum em28xx_chip_id {
87 CHIP_ID_EM2860 = 34,
87 CHIP_ID_EM2883 = 36, 88 CHIP_ID_EM2883 = 36,
88}; 89};
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 8996175cc950..285bc62bbe46 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1166,13 +1166,13 @@ static int vidioc_g_register(struct file *file, void *priv,
1166 1166
1167 reg->val = ret; 1167 reg->val = ret;
1168 } else { 1168 } else {
1169 u64 val = 0; 1169 __le64 val = 0;
1170 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, 1170 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS,
1171 reg->reg, (char *)&val, 2); 1171 reg->reg, (char *)&val, 2);
1172 if (ret < 0) 1172 if (ret < 0)
1173 return ret; 1173 return ret;
1174 1174
1175 reg->val = cpu_to_le64((__u64)val); 1175 reg->val = le64_to_cpu(val);
1176 } 1176 }
1177 1177
1178 return 0; 1178 return 0;
@@ -1183,9 +1183,9 @@ static int vidioc_s_register(struct file *file, void *priv,
1183{ 1183{
1184 struct em28xx_fh *fh = priv; 1184 struct em28xx_fh *fh = priv;
1185 struct em28xx *dev = fh->dev; 1185 struct em28xx *dev = fh->dev;
1186 u64 buf; 1186 __le64 buf;
1187 1187
1188 buf = le64_to_cpu((__u64)reg->val); 1188 buf = cpu_to_le64(reg->val);
1189 1189
1190 return em28xx_write_regs(dev, reg->reg, (char *)&buf, 1190 return em28xx_write_regs(dev, reg->reg, (char *)&buf,
1191 em28xx_reg_len(reg->reg)); 1191 em28xx_reg_len(reg->reg));
@@ -1848,32 +1848,28 @@ static DEFINE_MUTEX(em28xx_extension_devlist_lock);
1848 1848
1849int em28xx_register_extension(struct em28xx_ops *ops) 1849int em28xx_register_extension(struct em28xx_ops *ops)
1850{ 1850{
1851 struct em28xx *h, *dev = NULL; 1851 struct em28xx *dev = NULL;
1852
1853 list_for_each_entry(h, &em28xx_devlist, devlist)
1854 dev = h;
1855 1852
1856 mutex_lock(&em28xx_extension_devlist_lock); 1853 mutex_lock(&em28xx_extension_devlist_lock);
1857 list_add_tail(&ops->next, &em28xx_extension_devlist); 1854 list_add_tail(&ops->next, &em28xx_extension_devlist);
1858 if (dev) 1855 list_for_each_entry(dev, &em28xx_devlist, devlist) {
1859 ops->init(dev); 1856 if (dev)
1860 1857 ops->init(dev);
1858 }
1861 printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name); 1859 printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name);
1862 mutex_unlock(&em28xx_extension_devlist_lock); 1860 mutex_unlock(&em28xx_extension_devlist_lock);
1863
1864 return 0; 1861 return 0;
1865} 1862}
1866EXPORT_SYMBOL(em28xx_register_extension); 1863EXPORT_SYMBOL(em28xx_register_extension);
1867 1864
1868void em28xx_unregister_extension(struct em28xx_ops *ops) 1865void em28xx_unregister_extension(struct em28xx_ops *ops)
1869{ 1866{
1870 struct em28xx *h, *dev = NULL; 1867 struct em28xx *dev = NULL;
1871
1872 list_for_each_entry(h, &em28xx_devlist, devlist)
1873 dev = h;
1874 1868
1875 if (dev) 1869 list_for_each_entry(dev, &em28xx_devlist, devlist) {
1876 ops->fini(dev); 1870 if (dev)
1871 ops->fini(dev);
1872 }
1877 1873
1878 mutex_lock(&em28xx_extension_devlist_lock); 1874 mutex_lock(&em28xx_extension_devlist_lock);
1879 printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name); 1875 printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name);