aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-03 20:05:06 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:55:49 -0400
commitfec528b77f9be3e7ebb8d7c25888b0cf9fb8e8d6 (patch)
tree716d78e7b40197841af9a594728036bf27fa85bd /drivers/media
parent39624f7ee8eb90b61d79ab731da264959ac1879a (diff)
[media] Add initial support for Terratec H5
Not working yet. There are some fixes at the DRX-K that are needed for it to work. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/Kconfig2
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c37
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c8
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c110
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c4
-rw-r--r--drivers/media/video/em28xx/em28xx-reg.h1
-rw-r--r--drivers/media/video/em28xx/em28xx.h4
7 files changed, 160 insertions, 6 deletions
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig
index 49878fd0c8f4..281ee427c2ab 100644
--- a/drivers/media/video/em28xx/Kconfig
+++ b/drivers/media/video/em28xx/Kconfig
@@ -39,6 +39,8 @@ config VIDEO_EM28XX_DVB
39 select DVB_S921 if !DVB_FE_CUSTOMISE 39 select DVB_S921 if !DVB_FE_CUSTOMISE
40 select DVB_DRXD if !DVB_FE_CUSTOMISE 40 select DVB_DRXD if !DVB_FE_CUSTOMISE
41 select DVB_CXD2820R if !DVB_FE_CUSTOMISE 41 select DVB_CXD2820R if !DVB_FE_CUSTOMISE
42 select DVB_DRXK if !DVB_FE_CUSTOMISE
43 select DVB_TDA18271C2DD if !DVB_FE_CUSTOMISE
42 select VIDEOBUF_DVB 44 select VIDEOBUF_DVB
43 ---help--- 45 ---help---
44 This adds support for DVB cards based on the 46 This adds support for DVB cards based on the
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index c892a1e4ad85..cc0b9a387917 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -300,6 +300,23 @@ static struct em28xx_reg_seq pctv_290e[] = {
300 {-1, -1, -1, -1}, 300 {-1, -1, -1, -1},
301}; 301};
302 302
303#if 0
304static struct em28xx_reg_seq terratec_h5_gpio[] = {
305 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
306 {EM2874_R80_GPIO, 0xf6, 0xff, 100},
307 {EM2874_R80_GPIO, 0xf2, 0xff, 50},
308 {EM2874_R80_GPIO, 0xf6, 0xff, 50},
309 { -1, -1, -1, -1},
310};
311
312static struct em28xx_reg_seq terratec_h5_digital[] = {
313 {EM2874_R80_GPIO, 0xf6, 0xff, 10},
314 {EM2874_R80_GPIO, 0xe6, 0xff, 100},
315 {EM2874_R80_GPIO, 0xa6, 0xff, 10},
316 { -1, -1, -1, -1},
317};
318#endif
319
303/* 320/*
304 * Board definitions 321 * Board definitions
305 */ 322 */
@@ -843,6 +860,19 @@ struct em28xx_board em28xx_boards[] = {
843 .gpio = terratec_cinergy_USB_XS_FR_analog, 860 .gpio = terratec_cinergy_USB_XS_FR_analog,
844 } }, 861 } },
845 }, 862 },
863 [EM2884_BOARD_TERRATEC_H5] = {
864 .name = "Terratec Cinergy H5",
865 .has_dvb = 1,
866#if 0
867 .tuner_type = TUNER_PHILIPS_TDA8290,
868 .tuner_addr = 0x41,
869 .dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
870 .tuner_gpio = terratec_h5_gpio,
871#endif
872 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
873 EM28XX_I2C_CLK_WAIT_ENABLE |
874 EM28XX_I2C_FREQ_400_KHZ,
875 },
846 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = { 876 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
847 .name = "Hauppauge WinTV HVR 900", 877 .name = "Hauppauge WinTV HVR 900",
848 .tda9887_conf = TDA9887_PRESENT, 878 .tda9887_conf = TDA9887_PRESENT,
@@ -1855,6 +1885,8 @@ struct usb_device_id em28xx_id_table[] = {
1855 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS }, 1885 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1856 { USB_DEVICE(0x0ccd, 0x0043), 1886 { USB_DEVICE(0x0ccd, 0x0043),
1857 .driver_info = EM2870_BOARD_TERRATEC_XS }, 1887 .driver_info = EM2870_BOARD_TERRATEC_XS },
1888 { USB_DEVICE(0x0ccd, 0x10a2),
1889 .driver_info = EM2884_BOARD_TERRATEC_H5 },
1858 { USB_DEVICE(0x0ccd, 0x0047), 1890 { USB_DEVICE(0x0ccd, 0x0047),
1859 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS }, 1891 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1860 { USB_DEVICE(0x0ccd, 0x0084), 1892 { USB_DEVICE(0x0ccd, 0x0084),
@@ -2840,6 +2872,11 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
2840 em28xx_info("chip ID is em2882/em2883\n"); 2872 em28xx_info("chip ID is em2882/em2883\n");
2841 dev->wait_after_write = 0; 2873 dev->wait_after_write = 0;
2842 break; 2874 break;
2875 case CHIP_ID_EM2884:
2876 em28xx_info("chip ID is em2884\n");
2877 dev->reg_gpio_num = EM2874_R80_GPIO;
2878 dev->wait_after_write = 0;
2879 break;
2843 default: 2880 default:
2844 em28xx_info("em28xx chip ID = %d\n", dev->chip_id); 2881 em28xx_info("em28xx chip ID = %d\n", dev->chip_id);
2845 } 2882 }
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index 16c9b73b1c3f..01b89100ebd3 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -211,6 +211,7 @@ int em28xx_write_reg(struct em28xx *dev, u16 reg, u8 val)
211{ 211{
212 return em28xx_write_regs(dev, reg, &val, 1); 212 return em28xx_write_regs(dev, reg, &val, 1);
213} 213}
214EXPORT_SYMBOL_GPL(em28xx_write_reg);
214 215
215/* 216/*
216 * em28xx_write_reg_bits() 217 * em28xx_write_reg_bits()
@@ -618,7 +619,9 @@ int em28xx_capture_start(struct em28xx *dev, int start)
618{ 619{
619 int rc; 620 int rc;
620 621
621 if (dev->chip_id == CHIP_ID_EM2874 || dev->chip_id == CHIP_ID_EM28174) { 622 if (dev->chip_id == CHIP_ID_EM2874 ||
623 dev->chip_id == CHIP_ID_EM2884 ||
624 dev->chip_id == CHIP_ID_EM28174) {
622 /* The Transport Stream Enable Register moved in em2874 */ 625 /* The Transport Stream Enable Register moved in em2874 */
623 if (!start) { 626 if (!start) {
624 rc = em28xx_write_reg_bits(dev, EM2874_R5F_TS_ENABLE, 627 rc = em28xx_write_reg_bits(dev, EM2874_R5F_TS_ENABLE,
@@ -887,6 +890,7 @@ int em28xx_gpio_set(struct em28xx *dev, struct em28xx_reg_seq *gpio)
887 } 890 }
888 return rc; 891 return rc;
889} 892}
893EXPORT_SYMBOL_GPL(em28xx_gpio_set);
890 894
891int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode) 895int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode)
892{ 896{
@@ -1111,7 +1115,7 @@ int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev)
1111 unsigned int chip_cfg2; 1115 unsigned int chip_cfg2;
1112 unsigned int packet_size = 564; 1116 unsigned int packet_size = 564;
1113 1117
1114 if (dev->chip_id == CHIP_ID_EM2874) { 1118 if (dev->chip_id == CHIP_ID_EM2874 || dev->chip_id == CHIP_ID_EM2884) {
1115 /* FIXME - for now assume 564 like it was before, but the 1119 /* FIXME - for now assume 564 like it was before, but the
1116 em2874 code should be added to return the proper value... */ 1120 em2874 code should be added to return the proper value... */
1117 packet_size = 564; 1121 packet_size = 564;
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index 012ab8ec19cf..b8686c1eb3b6 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 DVB device driver for em28xx 2 DVB device driver for em28xx
3 3
4 (c) 2008 Mauro Carvalho Chehab <mchehab@infradead.org> 4 (c) 2008-2011 Mauro Carvalho Chehab <mchehab@infradead.org>
5 5
6 (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com> 6 (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com>
7 - Fixes for the driver to properly work with HVR-950 7 - Fixes for the driver to properly work with HVR-950
@@ -40,6 +40,8 @@
40#include "s921.h" 40#include "s921.h"
41#include "drxd.h" 41#include "drxd.h"
42#include "cxd2820r.h" 42#include "cxd2820r.h"
43#include "tda18271c2dd.h"
44#include "drxk.h"
43 45
44MODULE_DESCRIPTION("driver for em28xx based DVB cards"); 46MODULE_DESCRIPTION("driver for em28xx based DVB cards");
45MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); 47MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>");
@@ -73,6 +75,10 @@ struct em28xx_dvb {
73 struct dmx_frontend fe_hw; 75 struct dmx_frontend fe_hw;
74 struct dmx_frontend fe_mem; 76 struct dmx_frontend fe_mem;
75 struct dvb_net net; 77 struct dvb_net net;
78
79 /* Due to DRX-D - probably need changes */
80 int (*gate_ctrl)(struct dvb_frontend *, int);
81 struct semaphore pll_mutex;
76}; 82};
77 83
78 84
@@ -295,6 +301,78 @@ static struct drxd_config em28xx_drxd = {
295 .disable_i2c_gate_ctrl = 1, 301 .disable_i2c_gate_ctrl = 1,
296}; 302};
297 303
304#define TERRATEC_H5_DRXK_I2C_ADDR 0x29
305
306struct drxk_config terratec_h5_drxk = {
307 .adr = 0x29,
308};
309
310static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
311{
312 struct em28xx_dvb *dvb = fe->sec_priv;
313 int status;
314
315 if (!dvb)
316 return -EINVAL;
317
318 if (enable) {
319 down(&dvb->pll_mutex);
320 status = dvb->gate_ctrl(fe, 1);
321 } else {
322 status = dvb->gate_ctrl(fe, 0);
323 up(&dvb->pll_mutex);
324 }
325 return status;
326}
327
328static void terratec_h5_init(struct em28xx *dev)
329{
330 int i;
331 struct em28xx_reg_seq terratec_h5_init[] = {
332 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
333 {EM2874_R80_GPIO, 0xf6, 0xff, 100},
334 {EM2874_R80_GPIO, 0xf2, 0xff, 50},
335 {EM2874_R80_GPIO, 0xf6, 0xff, 100},
336 { -1, -1, -1, -1},
337 };
338 struct em28xx_reg_seq terratec_h5_end[] = {
339 {EM2874_R80_GPIO, 0xe6, 0xff, 100},
340 {EM2874_R80_GPIO, 0xa6, 0xff, 50},
341 {EM2874_R80_GPIO, 0xe6, 0xff, 100},
342 { -1, -1, -1, -1},
343 };
344 struct {
345 unsigned char r[4];
346 int len;
347 } regs[] = {
348 {{ 0x06, 0x02, 0x00, 0x31 }, 4},
349 {{ 0x01, 0x02 }, 2},
350 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
351 {{ 0x01, 0x00 }, 2},
352 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
353 {{ 0x01, 0x00, 0x03, 0xa0 }, 4},
354 {{ 0x01, 0x00 }, 2},
355 {{ 0x01, 0x00, 0x73, 0xaf }, 4},
356 {{ 0x04, 0x00 }, 2},
357 {{ 0x00, 0x04 }, 2},
358 {{ 0x00, 0x04, 0x00, 0x0a }, 4},
359 {{ 0x04, 0x14 }, 2},
360 {{ 0x04, 0x14, 0x00, 0x00 }, 4},
361 };
362
363 em28xx_gpio_set(dev, terratec_h5_init);
364 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
365 msleep(10);
366 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);
367 msleep(10);
368
369 dev->i2c_client.addr = 0x82 >> 1;
370
371 for (i = 0; i < ARRAY_SIZE(regs); i++)
372 i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
373 em28xx_gpio_set(dev, terratec_h5_end);
374};
375
298static int mt352_terratec_xs_init(struct dvb_frontend *fe) 376static int mt352_terratec_xs_init(struct dvb_frontend *fe)
299{ 377{
300 /* Values extracted from a USB trace of the Terratec Windows driver */ 378 /* Values extracted from a USB trace of the Terratec Windows driver */
@@ -689,6 +767,36 @@ static int dvb_init(struct em28xx *dev)
689 } 767 }
690 } 768 }
691 break; 769 break;
770 case EM2884_BOARD_TERRATEC_H5:
771 terratec_h5_init(dev);
772
773 /* dvb->fe[1] will be DVB-C, and dvb->fe[0] will be DVB-T */
774 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap, &dvb->fe[1]);
775 if (!dvb->fe[0] || !dvb->fe[1]) {
776 result = -EINVAL;
777 goto out_free;
778 }
779 /* FIXME: do we need a pll semaphore? */
780 dvb->fe[0]->sec_priv = dvb;
781 sema_init(&dvb->pll_mutex, 1);
782 dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl;
783 dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl;
784 dvb->fe[1]->ops.i2c_gate_ctrl = drxk_gate_ctrl;
785 dvb->fe[1]->id = 1;
786
787 /* Attach tda18271 */
788 if (dvb->fe[0]->ops.i2c_gate_ctrl)
789 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
790 if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], &dev->i2c_adap, 0x60)) {
791 result = -EINVAL;
792 goto out_free;
793 }
794 if (dvb->fe[0]->ops.i2c_gate_ctrl)
795 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0);
796 if (dvb->fe[1]->ops.i2c_gate_ctrl)
797 dvb->fe[1]->ops.i2c_gate_ctrl(dvb->fe[1], 1);
798
799 break;
692 default: 800 default:
693 em28xx_errdev("/2: The frontend of your DVB/ATSC card" 801 em28xx_errdev("/2: The frontend of your DVB/ATSC card"
694 " isn't supported yet\n"); 802 " isn't supported yet\n");
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 4ece6856fba0..548d2df391ca 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -330,7 +330,9 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
330 struct em28xx_eeprom *em_eeprom = (void *)eedata; 330 struct em28xx_eeprom *em_eeprom = (void *)eedata;
331 int i, err, size = len, block; 331 int i, err, size = len, block;
332 332
333 if (dev->chip_id == CHIP_ID_EM2874 || dev->chip_id == CHIP_ID_EM28174) { 333 if (dev->chip_id == CHIP_ID_EM2874 ||
334 dev->chip_id == CHIP_ID_EM28174 ||
335 dev->chip_id == CHIP_ID_EM2884) {
334 /* Empia switched to a 16-bit addressable eeprom in newer 336 /* Empia switched to a 16-bit addressable eeprom in newer
335 devices. While we could certainly write a routine to read 337 devices. While we could certainly write a routine to read
336 the eeprom, there is nothing of use in there that cannot be 338 the eeprom, there is nothing of use in there that cannot be
diff --git a/drivers/media/video/em28xx/em28xx-reg.h b/drivers/media/video/em28xx/em28xx-reg.h
index e92a28ede434..66f792361b97 100644
--- a/drivers/media/video/em28xx/em28xx-reg.h
+++ b/drivers/media/video/em28xx/em28xx-reg.h
@@ -201,6 +201,7 @@ enum em28xx_chip_id {
201 CHIP_ID_EM2870 = 35, 201 CHIP_ID_EM2870 = 35,
202 CHIP_ID_EM2883 = 36, 202 CHIP_ID_EM2883 = 36,
203 CHIP_ID_EM2874 = 65, 203 CHIP_ID_EM2874 = 65,
204 CHIP_ID_EM2884 = 68,
204 CHIP_ID_EM28174 = 113, 205 CHIP_ID_EM28174 = 113,
205}; 206};
206 207
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index e03849fd3717..d80658bf3da9 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -117,9 +117,9 @@
117#define EM2800_BOARD_VC211A 74 117#define EM2800_BOARD_VC211A 74
118#define EM2882_BOARD_DIKOM_DK300 75 118#define EM2882_BOARD_DIKOM_DK300 75
119#define EM2870_BOARD_KWORLD_A340 76 119#define EM2870_BOARD_KWORLD_A340 76
120#define EM2874_BOARD_LEADERSHIP_ISDBT 77 120#define EM2874_BOARD_LEADERSHIP_ISDBT 77
121#define EM28174_BOARD_PCTV_290E 78 121#define EM28174_BOARD_PCTV_290E 78
122 122#define EM2884_BOARD_TERRATEC_H5 79
123 123
124/* Limits minimum and default number of buffers */ 124/* Limits minimum and default number of buffers */
125#define EM28XX_MIN_BUF 4 125#define EM28XX_MIN_BUF 4