diff options
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/ir-keymaps.c | 280 | ||||
-rw-r--r-- | drivers/media/common/saa7146_core.c | 2 | ||||
-rw-r--r-- | drivers/media/common/saa7146_fops.c | 2 | ||||
-rw-r--r-- | drivers/media/common/tuners/mt2060.c | 38 | ||||
-rw-r--r-- | drivers/media/common/tuners/mxl5007t.c | 1 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda18271-fe.c | 1 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda827x.c | 12 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda827x.h | 1 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda8290.c | 4 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda8290.h | 1 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda9887.c | 1 | ||||
-rw-r--r-- | drivers/media/common/tuners/tuner-simple.c | 3 | ||||
-rw-r--r-- | drivers/media/common/tuners/tuner-types.c | 22 | ||||
-rw-r--r-- | drivers/media/common/tuners/tuner-xc2028.c | 74 | ||||
-rw-r--r-- | drivers/media/common/tuners/tuner-xc2028.h | 11 | ||||
-rw-r--r-- | drivers/media/common/tuners/xc5000.c | 109 | ||||
-rw-r--r-- | drivers/media/common/tuners/xc5000.h | 8 | ||||
-rw-r--r-- | drivers/media/common/tuners/xc5000_priv.h | 37 |
18 files changed, 478 insertions, 129 deletions
diff --git a/drivers/media/common/ir-keymaps.c b/drivers/media/common/ir-keymaps.c index 8fa91f846d59..4952aeb5dd80 100644 --- a/drivers/media/common/ir-keymaps.c +++ b/drivers/media/common/ir-keymaps.c | |||
@@ -103,6 +103,56 @@ IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE] = { | |||
103 | 103 | ||
104 | EXPORT_SYMBOL_GPL(ir_codes_avermedia_dvbt); | 104 | EXPORT_SYMBOL_GPL(ir_codes_avermedia_dvbt); |
105 | 105 | ||
106 | /* Mauro Carvalho Chehab <mchehab@infradead.org> */ | ||
107 | IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE] = { | ||
108 | [0x00] = KEY_POWER2, | ||
109 | [0x2e] = KEY_DOT, /* '.' */ | ||
110 | [0x01] = KEY_MODE, /* TV/FM */ | ||
111 | |||
112 | [0x05] = KEY_1, | ||
113 | [0x06] = KEY_2, | ||
114 | [0x07] = KEY_3, | ||
115 | [0x09] = KEY_4, | ||
116 | [0x0a] = KEY_5, | ||
117 | [0x0b] = KEY_6, | ||
118 | [0x0d] = KEY_7, | ||
119 | [0x0e] = KEY_8, | ||
120 | [0x0f] = KEY_9, | ||
121 | [0x11] = KEY_0, | ||
122 | |||
123 | [0x13] = KEY_RIGHT, /* -> */ | ||
124 | [0x12] = KEY_LEFT, /* <- */ | ||
125 | |||
126 | [0x17] = KEY_SLEEP, /* Capturar Imagem */ | ||
127 | [0x10] = KEY_SHUFFLE, /* Amostra */ | ||
128 | |||
129 | /* FIXME: The keys bellow aren't ok */ | ||
130 | |||
131 | [0x43] = KEY_CHANNELUP, | ||
132 | [0x42] = KEY_CHANNELDOWN, | ||
133 | [0x1f] = KEY_VOLUMEUP, | ||
134 | [0x1e] = KEY_VOLUMEDOWN, | ||
135 | [0x0c] = KEY_ENTER, | ||
136 | |||
137 | [0x14] = KEY_MUTE, | ||
138 | [0x08] = KEY_AUDIO, | ||
139 | |||
140 | [0x03] = KEY_TEXT, | ||
141 | [0x04] = KEY_EPG, | ||
142 | [0x2b] = KEY_TV2, /* TV2 */ | ||
143 | |||
144 | [0x1d] = KEY_RED, | ||
145 | [0x1c] = KEY_YELLOW, | ||
146 | [0x41] = KEY_GREEN, | ||
147 | [0x40] = KEY_BLUE, | ||
148 | |||
149 | [0x1a] = KEY_PLAYPAUSE, | ||
150 | [0x19] = KEY_RECORD, | ||
151 | [0x18] = KEY_PLAY, | ||
152 | [0x1b] = KEY_STOP, | ||
153 | }; | ||
154 | EXPORT_SYMBOL_GPL(ir_codes_avermedia_m135a); | ||
155 | |||
106 | /* Attila Kondoros <attila.kondoros@chello.hu> */ | 156 | /* Attila Kondoros <attila.kondoros@chello.hu> */ |
107 | IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { | 157 | IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { |
108 | 158 | ||
@@ -467,7 +517,8 @@ EXPORT_SYMBOL_GPL(ir_codes_adstech_dvb_t_pci); | |||
467 | 517 | ||
468 | /* ---------------------------------------------------------------------- */ | 518 | /* ---------------------------------------------------------------------- */ |
469 | 519 | ||
470 | /* MSI TV@nywhere remote */ | 520 | /* MSI TV@nywhere MASTER remote */ |
521 | |||
471 | IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = { | 522 | IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = { |
472 | /* Keys 0 to 9 */ | 523 | /* Keys 0 to 9 */ |
473 | [ 0x00 ] = KEY_0, | 524 | [ 0x00 ] = KEY_0, |
@@ -501,6 +552,95 @@ EXPORT_SYMBOL_GPL(ir_codes_msi_tvanywhere); | |||
501 | 552 | ||
502 | /* ---------------------------------------------------------------------- */ | 553 | /* ---------------------------------------------------------------------- */ |
503 | 554 | ||
555 | /* | ||
556 | Keycodes for remote on the MSI TV@nywhere Plus. The controller IC on the card | ||
557 | is marked "KS003". The controller is I2C at address 0x30, but does not seem | ||
558 | to respond to probes until a read is performed from a valid device. | ||
559 | I don't know why... | ||
560 | |||
561 | Note: This remote may be of similar or identical design to the | ||
562 | Pixelview remote (?). The raw codes and duplicate button codes | ||
563 | appear to be the same. | ||
564 | |||
565 | Henry Wong <henry@stuffedcow.net> | ||
566 | Some changes to formatting and keycodes by Mark Schultz <n9xmj@yahoo.com> | ||
567 | |||
568 | */ | ||
569 | |||
570 | IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE] = { | ||
571 | |||
572 | /* ---- Remote Button Layout ---- | ||
573 | |||
574 | POWER SOURCE SCAN MUTE | ||
575 | TV/FM 1 2 3 | ||
576 | |> 4 5 6 | ||
577 | <| 7 8 9 | ||
578 | ^^UP 0 + RECALL | ||
579 | vvDN RECORD STOP PLAY | ||
580 | |||
581 | MINIMIZE ZOOM | ||
582 | |||
583 | CH+ | ||
584 | VOL- VOL+ | ||
585 | CH- | ||
586 | |||
587 | SNAPSHOT MTS | ||
588 | |||
589 | << FUNC >> RESET | ||
590 | */ | ||
591 | |||
592 | [0x01] = KEY_KP1, /* 1 */ | ||
593 | [0x0b] = KEY_KP2, /* 2 */ | ||
594 | [0x1b] = KEY_KP3, /* 3 */ | ||
595 | [0x05] = KEY_KP4, /* 4 */ | ||
596 | [0x09] = KEY_KP5, /* 5 */ | ||
597 | [0x15] = KEY_KP6, /* 6 */ | ||
598 | [0x06] = KEY_KP7, /* 7 */ | ||
599 | [0x0a] = KEY_KP8, /* 8 */ | ||
600 | [0x12] = KEY_KP9, /* 9 */ | ||
601 | [0x02] = KEY_KP0, /* 0 */ | ||
602 | [0x10] = KEY_KPPLUS, /* + */ | ||
603 | [0x13] = KEY_AGAIN, /* Recall */ | ||
604 | |||
605 | [0x1e] = KEY_POWER, /* Power */ | ||
606 | [0x07] = KEY_TUNER, /* Source */ | ||
607 | [0x1c] = KEY_SEARCH, /* Scan */ | ||
608 | [0x18] = KEY_MUTE, /* Mute */ | ||
609 | |||
610 | [0x03] = KEY_RADIO, /* TV/FM */ | ||
611 | /* The next four keys are duplicates that appear to send the | ||
612 | same IR code as Ch+, Ch-, >>, and << . The raw code assigned | ||
613 | to them is the actual code + 0x20 - they will never be | ||
614 | detected as such unless some way is discovered to distinguish | ||
615 | these buttons from those that have the same code. */ | ||
616 | [0x3f] = KEY_RIGHT, /* |> and Ch+ */ | ||
617 | [0x37] = KEY_LEFT, /* <| and Ch- */ | ||
618 | [0x2c] = KEY_UP, /* ^^Up and >> */ | ||
619 | [0x24] = KEY_DOWN, /* vvDn and << */ | ||
620 | |||
621 | [0x00] = KEY_RECORD, /* Record */ | ||
622 | [0x08] = KEY_STOP, /* Stop */ | ||
623 | [0x11] = KEY_PLAY, /* Play */ | ||
624 | |||
625 | [0x0f] = KEY_CLOSE, /* Minimize */ | ||
626 | [0x19] = KEY_ZOOM, /* Zoom */ | ||
627 | [0x1a] = KEY_SHUFFLE, /* Snapshot */ | ||
628 | [0x0d] = KEY_LANGUAGE, /* MTS */ | ||
629 | |||
630 | [0x14] = KEY_VOLUMEDOWN, /* Vol- */ | ||
631 | [0x16] = KEY_VOLUMEUP, /* Vol+ */ | ||
632 | [0x17] = KEY_CHANNELDOWN, /* Ch- */ | ||
633 | [0x1f] = KEY_CHANNELUP, /* Ch+ */ | ||
634 | |||
635 | [0x04] = KEY_REWIND, /* << */ | ||
636 | [0x0e] = KEY_MENU, /* Function */ | ||
637 | [0x0c] = KEY_FASTFORWARD, /* >> */ | ||
638 | [0x1d] = KEY_RESTART, /* Reset */ | ||
639 | }; | ||
640 | EXPORT_SYMBOL_GPL(ir_codes_msi_tvanywhere_plus); | ||
641 | |||
642 | /* ---------------------------------------------------------------------- */ | ||
643 | |||
504 | /* Cinergy 1400 DVB-T */ | 644 | /* Cinergy 1400 DVB-T */ |
505 | IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE] = { | 645 | IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE] = { |
506 | [ 0x01 ] = KEY_POWER, | 646 | [ 0x01 ] = KEY_POWER, |
@@ -1792,12 +1932,61 @@ IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE] = { | |||
1792 | [ 0x41 ] = KEY_GREEN, /* AP2 */ | 1932 | [ 0x41 ] = KEY_GREEN, /* AP2 */ |
1793 | [ 0x47 ] = KEY_YELLOW, /* AP3 */ | 1933 | [ 0x47 ] = KEY_YELLOW, /* AP3 */ |
1794 | [ 0x57 ] = KEY_BLUE, /* AP4 */ | 1934 | [ 0x57 ] = KEY_BLUE, /* AP4 */ |
1795 | |||
1796 | |||
1797 | }; | 1935 | }; |
1798 | |||
1799 | EXPORT_SYMBOL_GPL(ir_codes_encore_enltv); | 1936 | EXPORT_SYMBOL_GPL(ir_codes_encore_enltv); |
1800 | 1937 | ||
1938 | /* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton | ||
1939 | Mauro Carvalho Chehab <mchehab@infradead.org> */ | ||
1940 | IR_KEYTAB_TYPE ir_codes_encore_enltv2[IR_KEYTAB_SIZE] = { | ||
1941 | [0x4c] = KEY_POWER2, | ||
1942 | [0x4a] = KEY_TUNER, | ||
1943 | [0x40] = KEY_1, | ||
1944 | [0x60] = KEY_2, | ||
1945 | [0x50] = KEY_3, | ||
1946 | [0x70] = KEY_4, | ||
1947 | [0x48] = KEY_5, | ||
1948 | [0x68] = KEY_6, | ||
1949 | [0x58] = KEY_7, | ||
1950 | [0x78] = KEY_8, | ||
1951 | [0x44] = KEY_9, | ||
1952 | [0x54] = KEY_0, | ||
1953 | |||
1954 | [0x64] = KEY_LAST, /* +100 */ | ||
1955 | [0x4e] = KEY_AGAIN, /* Recall */ | ||
1956 | |||
1957 | [0x6c] = KEY_SWITCHVIDEOMODE, /* Video Source */ | ||
1958 | [0x5e] = KEY_MENU, | ||
1959 | [0x56] = KEY_SCREEN, | ||
1960 | [0x7a] = KEY_SETUP, | ||
1961 | |||
1962 | [0x46] = KEY_MUTE, | ||
1963 | [0x5c] = KEY_MODE, /* Stereo */ | ||
1964 | [0x74] = KEY_INFO, | ||
1965 | [0x7c] = KEY_CLEAR, | ||
1966 | |||
1967 | [0x55] = KEY_UP, | ||
1968 | [0x49] = KEY_DOWN, | ||
1969 | [0x7e] = KEY_LEFT, | ||
1970 | [0x59] = KEY_RIGHT, | ||
1971 | [0x6a] = KEY_ENTER, | ||
1972 | |||
1973 | [0x42] = KEY_VOLUMEUP, | ||
1974 | [0x62] = KEY_VOLUMEDOWN, | ||
1975 | [0x52] = KEY_CHANNELUP, | ||
1976 | [0x72] = KEY_CHANNELDOWN, | ||
1977 | |||
1978 | [0x41] = KEY_RECORD, | ||
1979 | [0x51] = KEY_SHUFFLE, /* Snapshot */ | ||
1980 | [0x75] = KEY_TIME, /* Timeshift */ | ||
1981 | [0x71] = KEY_TV2, /* PIP */ | ||
1982 | |||
1983 | [0x45] = KEY_REWIND, | ||
1984 | [0x6f] = KEY_PAUSE, | ||
1985 | [0x7d] = KEY_FORWARD, | ||
1986 | [0x79] = KEY_STOP, | ||
1987 | }; | ||
1988 | EXPORT_SYMBOL_GPL(ir_codes_encore_enltv2); | ||
1989 | |||
1801 | /* for the Technotrend 1500 bundled remotes (grey and black): */ | 1990 | /* for the Technotrend 1500 bundled remotes (grey and black): */ |
1802 | IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE] = { | 1991 | IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE] = { |
1803 | [ 0x01 ] = KEY_POWER, | 1992 | [ 0x01 ] = KEY_POWER, |
@@ -2239,3 +2428,86 @@ IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE] = { | |||
2239 | [0x2a] = KEY_MENU, | 2428 | [0x2a] = KEY_MENU, |
2240 | }; | 2429 | }; |
2241 | EXPORT_SYMBOL_GPL(ir_codes_avermedia_a16d); | 2430 | EXPORT_SYMBOL_GPL(ir_codes_avermedia_a16d); |
2431 | |||
2432 | /* Encore ENLTV-FM v5.3 | ||
2433 | Mauro Carvalho Chehab <mchehab@infradead.org> | ||
2434 | */ | ||
2435 | IR_KEYTAB_TYPE ir_codes_encore_enltv_fm53[IR_KEYTAB_SIZE] = { | ||
2436 | [0x10] = KEY_POWER2, | ||
2437 | [0x06] = KEY_MUTE, | ||
2438 | |||
2439 | [0x09] = KEY_1, | ||
2440 | [0x1d] = KEY_2, | ||
2441 | [0x1f] = KEY_3, | ||
2442 | [0x19] = KEY_4, | ||
2443 | [0x1b] = KEY_5, | ||
2444 | [0x11] = KEY_6, | ||
2445 | [0x17] = KEY_7, | ||
2446 | [0x12] = KEY_8, | ||
2447 | [0x16] = KEY_9, | ||
2448 | [0x48] = KEY_0, | ||
2449 | |||
2450 | [0x04] = KEY_LIST, /* -/-- */ | ||
2451 | [0x40] = KEY_LAST, /* recall */ | ||
2452 | |||
2453 | [0x02] = KEY_MODE, /* TV/AV */ | ||
2454 | [0x05] = KEY_SHUFFLE, /* SNAPSHOT */ | ||
2455 | |||
2456 | [0x4c] = KEY_CHANNELUP, /* UP */ | ||
2457 | [0x00] = KEY_CHANNELDOWN, /* DOWN */ | ||
2458 | [0x0d] = KEY_VOLUMEUP, /* RIGHT */ | ||
2459 | [0x15] = KEY_VOLUMEDOWN, /* LEFT */ | ||
2460 | [0x49] = KEY_ENTER, /* OK */ | ||
2461 | |||
2462 | [0x54] = KEY_RECORD, | ||
2463 | [0x4d] = KEY_PLAY, /* pause */ | ||
2464 | |||
2465 | [0x1e] = KEY_UP, /* video setting */ | ||
2466 | [0x0e] = KEY_RIGHT, /* <- */ | ||
2467 | [0x1a] = KEY_LEFT, /* -> */ | ||
2468 | |||
2469 | [0x0a] = KEY_DOWN, /* video default */ | ||
2470 | [0x0c] = KEY_ZOOM, /* hide pannel */ | ||
2471 | [0x47] = KEY_SLEEP, /* shutdown */ | ||
2472 | }; | ||
2473 | EXPORT_SYMBOL_GPL(ir_codes_encore_enltv_fm53); | ||
2474 | |||
2475 | /* Zogis Real Audio 220 - 32 keys IR */ | ||
2476 | IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE] = { | ||
2477 | [0x1c] = KEY_RADIO, | ||
2478 | [0x12] = KEY_POWER2, | ||
2479 | |||
2480 | [0x01] = KEY_1, | ||
2481 | [0x02] = KEY_2, | ||
2482 | [0x03] = KEY_3, | ||
2483 | [0x04] = KEY_4, | ||
2484 | [0x05] = KEY_5, | ||
2485 | [0x06] = KEY_6, | ||
2486 | [0x07] = KEY_7, | ||
2487 | [0x08] = KEY_8, | ||
2488 | [0x09] = KEY_9, | ||
2489 | [0x00] = KEY_0, | ||
2490 | |||
2491 | [0x0c] = KEY_VOLUMEUP, | ||
2492 | [0x18] = KEY_VOLUMEDOWN, | ||
2493 | [0x0b] = KEY_CHANNELUP, | ||
2494 | [0x15] = KEY_CHANNELDOWN, | ||
2495 | [0x16] = KEY_ENTER, | ||
2496 | |||
2497 | [0x11] = KEY_LIST, /* Source */ | ||
2498 | [0x0d] = KEY_AUDIO, /* stereo */ | ||
2499 | |||
2500 | [0x0f] = KEY_PREVIOUS, /* Prev */ | ||
2501 | [0x1b] = KEY_PAUSE, /* Timeshift */ | ||
2502 | [0x1a] = KEY_NEXT, /* Next */ | ||
2503 | |||
2504 | [0x0e] = KEY_STOP, | ||
2505 | [0x1f] = KEY_PLAY, | ||
2506 | [0x1e] = KEY_PLAYPAUSE, /* Pause */ | ||
2507 | |||
2508 | [0x1d] = KEY_RECORD, | ||
2509 | [0x13] = KEY_MUTE, | ||
2510 | [0x19] = KEY_SHUFFLE, /* Snapshot */ | ||
2511 | |||
2512 | }; | ||
2513 | EXPORT_SYMBOL_GPL(ir_codes_real_audio_220_32_keys); | ||
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index d01965e96927..d599d360da3f 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -234,7 +234,7 @@ void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt) | |||
234 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) | 234 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) |
235 | { | 235 | { |
236 | __le32 *cpu; | 236 | __le32 *cpu; |
237 | dma_addr_t dma_addr; | 237 | dma_addr_t dma_addr = 0; |
238 | 238 | ||
239 | cpu = pci_alloc_consistent(pci, PAGE_SIZE, &dma_addr); | 239 | cpu = pci_alloc_consistent(pci, PAGE_SIZE, &dma_addr); |
240 | if (NULL == cpu) { | 240 | if (NULL == cpu) { |
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index cf6a817d5059..5b34c134aa25 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -533,7 +533,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, | |||
533 | memcpy(vfd, &device_template, sizeof(struct video_device)); | 533 | memcpy(vfd, &device_template, sizeof(struct video_device)); |
534 | strlcpy(vfd->name, name, sizeof(vfd->name)); | 534 | strlcpy(vfd->name, name, sizeof(vfd->name)); |
535 | vfd->release = video_device_release; | 535 | vfd->release = video_device_release; |
536 | vfd->priv = dev; | 536 | video_set_drvdata(vfd, dev); |
537 | 537 | ||
538 | // fixme: -1 should be an insmod parameter *for the extension* (like "video_nr"); | 538 | // fixme: -1 should be an insmod parameter *for the extension* (like "video_nr"); |
539 | if (video_register_device(vfd, type, -1) < 0) { | 539 | if (video_register_device(vfd, type, -1) < 0) { |
diff --git a/drivers/media/common/tuners/mt2060.c b/drivers/media/common/tuners/mt2060.c index 1305b0e63ce5..12206d75dd4e 100644 --- a/drivers/media/common/tuners/mt2060.c +++ b/drivers/media/common/tuners/mt2060.c | |||
@@ -170,6 +170,9 @@ static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame | |||
170 | b[0] = REG_LO1B1; | 170 | b[0] = REG_LO1B1; |
171 | b[1] = 0xFF; | 171 | b[1] = 0xFF; |
172 | 172 | ||
173 | if (fe->ops.i2c_gate_ctrl) | ||
174 | fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */ | ||
175 | |||
173 | mt2060_writeregs(priv,b,2); | 176 | mt2060_writeregs(priv,b,2); |
174 | 177 | ||
175 | freq = params->frequency / 1000; // Hz -> kHz | 178 | freq = params->frequency / 1000; // Hz -> kHz |
@@ -233,6 +236,9 @@ static int mt2060_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame | |||
233 | i++; | 236 | i++; |
234 | } while (i<10); | 237 | } while (i<10); |
235 | 238 | ||
239 | if (fe->ops.i2c_gate_ctrl) | ||
240 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | ||
241 | |||
236 | return ret; | 242 | return ret; |
237 | } | 243 | } |
238 | 244 | ||
@@ -296,13 +302,35 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | |||
296 | static int mt2060_init(struct dvb_frontend *fe) | 302 | static int mt2060_init(struct dvb_frontend *fe) |
297 | { | 303 | { |
298 | struct mt2060_priv *priv = fe->tuner_priv; | 304 | struct mt2060_priv *priv = fe->tuner_priv; |
299 | return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x33); | 305 | int ret; |
306 | |||
307 | if (fe->ops.i2c_gate_ctrl) | ||
308 | fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */ | ||
309 | |||
310 | ret = mt2060_writereg(priv, REG_VGAG, | ||
311 | (priv->cfg->clock_out << 6) | 0x33); | ||
312 | |||
313 | if (fe->ops.i2c_gate_ctrl) | ||
314 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | ||
315 | |||
316 | return ret; | ||
300 | } | 317 | } |
301 | 318 | ||
302 | static int mt2060_sleep(struct dvb_frontend *fe) | 319 | static int mt2060_sleep(struct dvb_frontend *fe) |
303 | { | 320 | { |
304 | struct mt2060_priv *priv = fe->tuner_priv; | 321 | struct mt2060_priv *priv = fe->tuner_priv; |
305 | return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30); | 322 | int ret; |
323 | |||
324 | if (fe->ops.i2c_gate_ctrl) | ||
325 | fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */ | ||
326 | |||
327 | ret = mt2060_writereg(priv, REG_VGAG, | ||
328 | (priv->cfg->clock_out << 6) | 0x30); | ||
329 | |||
330 | if (fe->ops.i2c_gate_ctrl) | ||
331 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | ||
332 | |||
333 | return ret; | ||
306 | } | 334 | } |
307 | 335 | ||
308 | static int mt2060_release(struct dvb_frontend *fe) | 336 | static int mt2060_release(struct dvb_frontend *fe) |
@@ -344,6 +372,9 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter | |||
344 | priv->i2c = i2c; | 372 | priv->i2c = i2c; |
345 | priv->if1_freq = if1; | 373 | priv->if1_freq = if1; |
346 | 374 | ||
375 | if (fe->ops.i2c_gate_ctrl) | ||
376 | fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */ | ||
377 | |||
347 | if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) { | 378 | if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) { |
348 | kfree(priv); | 379 | kfree(priv); |
349 | return NULL; | 380 | return NULL; |
@@ -360,6 +391,9 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter | |||
360 | 391 | ||
361 | mt2060_calibrate(priv); | 392 | mt2060_calibrate(priv); |
362 | 393 | ||
394 | if (fe->ops.i2c_gate_ctrl) | ||
395 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | ||
396 | |||
363 | return fe; | 397 | return fe; |
364 | } | 398 | } |
365 | EXPORT_SYMBOL(mt2060_attach); | 399 | EXPORT_SYMBOL(mt2060_attach); |
diff --git a/drivers/media/common/tuners/mxl5007t.c b/drivers/media/common/tuners/mxl5007t.c index cb25e43502fe..64379f2bf237 100644 --- a/drivers/media/common/tuners/mxl5007t.c +++ b/drivers/media/common/tuners/mxl5007t.c | |||
@@ -979,7 +979,6 @@ struct dvb_frontend *mxl5007t_attach(struct dvb_frontend *fe, | |||
979 | switch (instance) { | 979 | switch (instance) { |
980 | case 0: | 980 | case 0: |
981 | goto fail; | 981 | goto fail; |
982 | break; | ||
983 | case 1: | 982 | case 1: |
984 | /* new tuner instance */ | 983 | /* new tuner instance */ |
985 | state->config = cfg; | 984 | state->config = cfg; |
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 93063c6fbbf6..1b48b5d0bf1e 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -1155,7 +1155,6 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | |||
1155 | switch (instance) { | 1155 | switch (instance) { |
1156 | case 0: | 1156 | case 0: |
1157 | goto fail; | 1157 | goto fail; |
1158 | break; | ||
1159 | case 1: | 1158 | case 1: |
1160 | /* new tuner instance */ | 1159 | /* new tuner instance */ |
1161 | priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; | 1160 | priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; |
diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c index 8555d9cf9051..4a74f65e759a 100644 --- a/drivers/media/common/tuners/tda827x.c +++ b/drivers/media/common/tuners/tda827x.c | |||
@@ -447,17 +447,19 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high, | |||
447 | else | 447 | else |
448 | arg = 0; | 448 | arg = 0; |
449 | } | 449 | } |
450 | if (priv->cfg->tuner_callback) | 450 | if (fe->callback) |
451 | priv->cfg->tuner_callback(priv->i2c_adap->algo_data, | 451 | fe->callback(priv->i2c_adap->algo_data, |
452 | gp_func, arg); | 452 | DVB_FRONTEND_COMPONENT_TUNER, |
453 | gp_func, arg); | ||
453 | buf[1] = high ? 0 : 1; | 454 | buf[1] = high ? 0 : 1; |
454 | if (priv->cfg->config == 2) | 455 | if (priv->cfg->config == 2) |
455 | buf[1] = high ? 1 : 0; | 456 | buf[1] = high ? 1 : 0; |
456 | i2c_transfer(priv->i2c_adap, &msg, 1); | 457 | i2c_transfer(priv->i2c_adap, &msg, 1); |
457 | break; | 458 | break; |
458 | case 3: /* switch with GPIO of saa713x */ | 459 | case 3: /* switch with GPIO of saa713x */ |
459 | if (priv->cfg->tuner_callback) | 460 | if (fe->callback) |
460 | priv->cfg->tuner_callback(priv->i2c_adap->algo_data, 0, high); | 461 | fe->callback(priv->i2c_adap->algo_data, |
462 | DVB_FRONTEND_COMPONENT_TUNER, 0, high); | ||
461 | break; | 463 | break; |
462 | } | 464 | } |
463 | } | 465 | } |
diff --git a/drivers/media/common/tuners/tda827x.h b/drivers/media/common/tuners/tda827x.h index 7850a9a1dc8f..7d72ce0a0c2d 100644 --- a/drivers/media/common/tuners/tda827x.h +++ b/drivers/media/common/tuners/tda827x.h | |||
@@ -36,7 +36,6 @@ struct tda827x_config | |||
36 | /* interface to tda829x driver */ | 36 | /* interface to tda829x driver */ |
37 | unsigned int config; | 37 | unsigned int config; |
38 | int switch_addr; | 38 | int switch_addr; |
39 | int (*tuner_callback) (void *dev, int command, int arg); | ||
40 | 39 | ||
41 | void (*agcf)(struct dvb_frontend *fe); | 40 | void (*agcf)(struct dvb_frontend *fe); |
42 | }; | 41 | }; |
diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c index 91204d3f282d..c112bdd4e0f0 100644 --- a/drivers/media/common/tuners/tda8290.c +++ b/drivers/media/common/tuners/tda8290.c | |||
@@ -672,10 +672,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, | |||
672 | priv->i2c_props.addr = i2c_addr; | 672 | priv->i2c_props.addr = i2c_addr; |
673 | priv->i2c_props.adap = i2c_adap; | 673 | priv->i2c_props.adap = i2c_adap; |
674 | priv->i2c_props.name = "tda829x"; | 674 | priv->i2c_props.name = "tda829x"; |
675 | if (cfg) { | 675 | if (cfg) |
676 | priv->cfg.config = cfg->lna_cfg; | 676 | priv->cfg.config = cfg->lna_cfg; |
677 | priv->cfg.tuner_callback = cfg->tuner_callback; | ||
678 | } | ||
679 | 677 | ||
680 | if (tda8290_probe(&priv->i2c_props) == 0) { | 678 | if (tda8290_probe(&priv->i2c_props) == 0) { |
681 | priv->ver = TDA8290; | 679 | priv->ver = TDA8290; |
diff --git a/drivers/media/common/tuners/tda8290.h b/drivers/media/common/tuners/tda8290.h index aa074f3f0c07..7e288b26fcc3 100644 --- a/drivers/media/common/tuners/tda8290.h +++ b/drivers/media/common/tuners/tda8290.h | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | struct tda829x_config { | 23 | struct tda829x_config { |
24 | unsigned int lna_cfg; | 24 | unsigned int lna_cfg; |
25 | int (*tuner_callback) (void *dev, int command, int arg); | ||
26 | 25 | ||
27 | unsigned int probe_tuner:1; | 26 | unsigned int probe_tuner:1; |
28 | #define TDA829X_PROBE_TUNER 0 | 27 | #define TDA829X_PROBE_TUNER 0 |
diff --git a/drivers/media/common/tuners/tda9887.c b/drivers/media/common/tuners/tda9887.c index 72abf0b73486..ff1788cc5d48 100644 --- a/drivers/media/common/tuners/tda9887.c +++ b/drivers/media/common/tuners/tda9887.c | |||
@@ -686,7 +686,6 @@ struct dvb_frontend *tda9887_attach(struct dvb_frontend *fe, | |||
686 | case 0: | 686 | case 0: |
687 | mutex_unlock(&tda9887_list_mutex); | 687 | mutex_unlock(&tda9887_list_mutex); |
688 | return NULL; | 688 | return NULL; |
689 | break; | ||
690 | case 1: | 689 | case 1: |
691 | fe->analog_demod_priv = priv; | 690 | fe->analog_demod_priv = priv; |
692 | priv->mode = T_STANDBY; | 691 | priv->mode = T_STANDBY; |
diff --git a/drivers/media/common/tuners/tuner-simple.c b/drivers/media/common/tuners/tuner-simple.c index aa773a658a2a..2a1aac1cc755 100644 --- a/drivers/media/common/tuners/tuner-simple.c +++ b/drivers/media/common/tuners/tuner-simple.c | |||
@@ -142,6 +142,7 @@ static inline int tuner_stereo(const int type, const int status) | |||
142 | case TUNER_PHILIPS_FM1236_MK3: | 142 | case TUNER_PHILIPS_FM1236_MK3: |
143 | case TUNER_PHILIPS_FM1256_IH3: | 143 | case TUNER_PHILIPS_FM1256_IH3: |
144 | case TUNER_LG_NTSC_TAPE: | 144 | case TUNER_LG_NTSC_TAPE: |
145 | case TUNER_TCL_MF02GIP_5N: | ||
145 | return ((status & TUNER_SIGNAL) == TUNER_STEREO_MK3); | 146 | return ((status & TUNER_SIGNAL) == TUNER_STEREO_MK3); |
146 | default: | 147 | default: |
147 | return status & TUNER_STEREO; | 148 | return status & TUNER_STEREO; |
@@ -494,6 +495,7 @@ static int simple_radio_bandswitch(struct dvb_frontend *fe, u8 *buffer) | |||
494 | case TUNER_PHILIPS_FMD1216ME_MK3: | 495 | case TUNER_PHILIPS_FMD1216ME_MK3: |
495 | case TUNER_LG_NTSC_TAPE: | 496 | case TUNER_LG_NTSC_TAPE: |
496 | case TUNER_PHILIPS_FM1256_IH3: | 497 | case TUNER_PHILIPS_FM1256_IH3: |
498 | case TUNER_TCL_MF02GIP_5N: | ||
497 | buffer[3] = 0x19; | 499 | buffer[3] = 0x19; |
498 | break; | 500 | break; |
499 | case TUNER_TNF_5335MF: | 501 | case TUNER_TNF_5335MF: |
@@ -1038,7 +1040,6 @@ struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe, | |||
1038 | case 0: | 1040 | case 0: |
1039 | mutex_unlock(&tuner_simple_list_mutex); | 1041 | mutex_unlock(&tuner_simple_list_mutex); |
1040 | return NULL; | 1042 | return NULL; |
1041 | break; | ||
1042 | case 1: | 1043 | case 1: |
1043 | fe->tuner_priv = priv; | 1044 | fe->tuner_priv = priv; |
1044 | 1045 | ||
diff --git a/drivers/media/common/tuners/tuner-types.c b/drivers/media/common/tuners/tuner-types.c index 10dddca8b5d1..04961a1f44be 100644 --- a/drivers/media/common/tuners/tuner-types.c +++ b/drivers/media/common/tuners/tuner-types.c | |||
@@ -1216,6 +1216,23 @@ static struct tuner_params tuner_samsung_tcpg_6121p30a_params[] = { | |||
1216 | }, | 1216 | }, |
1217 | }; | 1217 | }; |
1218 | 1218 | ||
1219 | /* ------------ TUNER_TCL_MF02GIP-5N-E - TCL MF02GIP-5N ------------ */ | ||
1220 | |||
1221 | static struct tuner_range tuner_tcl_mf02gip_5n_ntsc_ranges[] = { | ||
1222 | { 16 * 172.00 /*MHz*/, 0x8e, 0x01, }, | ||
1223 | { 16 * 448.00 /*MHz*/, 0x8e, 0x02, }, | ||
1224 | { 16 * 999.99 , 0x8e, 0x04, }, | ||
1225 | }; | ||
1226 | |||
1227 | static struct tuner_params tuner_tcl_mf02gip_5n_params[] = { | ||
1228 | { | ||
1229 | .type = TUNER_PARAM_TYPE_NTSC, | ||
1230 | .ranges = tuner_tcl_mf02gip_5n_ntsc_ranges, | ||
1231 | .count = ARRAY_SIZE(tuner_tcl_mf02gip_5n_ntsc_ranges), | ||
1232 | .cb_first_if_lower_freq = 1, | ||
1233 | }, | ||
1234 | }; | ||
1235 | |||
1219 | /* --------------------------------------------------------------------- */ | 1236 | /* --------------------------------------------------------------------- */ |
1220 | 1237 | ||
1221 | struct tunertype tuners[] = { | 1238 | struct tunertype tuners[] = { |
@@ -1641,6 +1658,11 @@ struct tunertype tuners[] = { | |||
1641 | .name = "Xceive 5000 tuner", | 1658 | .name = "Xceive 5000 tuner", |
1642 | /* see xc5000.c for details */ | 1659 | /* see xc5000.c for details */ |
1643 | }, | 1660 | }, |
1661 | [TUNER_TCL_MF02GIP_5N] = { /* TCL tuner MF02GIP-5N-E */ | ||
1662 | .name = "TCL tuner MF02GIP-5N-E", | ||
1663 | .params = tuner_tcl_mf02gip_5n_params, | ||
1664 | .count = ARRAY_SIZE(tuner_tcl_mf02gip_5n_params), | ||
1665 | }, | ||
1644 | }; | 1666 | }; |
1645 | EXPORT_SYMBOL(tuners); | 1667 | EXPORT_SYMBOL(tuners); |
1646 | 1668 | ||
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index 4dd1d2421cc5..b65e6803e6c6 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c | |||
@@ -71,9 +71,6 @@ struct firmware_properties { | |||
71 | struct xc2028_data { | 71 | struct xc2028_data { |
72 | struct list_head hybrid_tuner_instance_list; | 72 | struct list_head hybrid_tuner_instance_list; |
73 | struct tuner_i2c_props i2c_props; | 73 | struct tuner_i2c_props i2c_props; |
74 | int (*tuner_callback) (void *dev, | ||
75 | int command, int arg); | ||
76 | void *video_dev; | ||
77 | __u32 frequency; | 74 | __u32 frequency; |
78 | 75 | ||
79 | struct firmware_description *firm; | 76 | struct firmware_description *firm; |
@@ -492,6 +489,23 @@ ret: | |||
492 | return i; | 489 | return i; |
493 | } | 490 | } |
494 | 491 | ||
492 | static inline int do_tuner_callback(struct dvb_frontend *fe, int cmd, int arg) | ||
493 | { | ||
494 | struct xc2028_data *priv = fe->tuner_priv; | ||
495 | |||
496 | /* analog side (tuner-core) uses i2c_adap->algo_data. | ||
497 | * digital side is not guaranteed to have algo_data defined. | ||
498 | * | ||
499 | * digital side will always have fe->dvb defined. | ||
500 | * analog side (tuner-core) doesn't (yet) define fe->dvb. | ||
501 | */ | ||
502 | |||
503 | return (!fe->callback) ? -EINVAL : | ||
504 | fe->callback(((fe->dvb) && (fe->dvb->priv)) ? | ||
505 | fe->dvb->priv : priv->i2c_props.adap->algo_data, | ||
506 | DVB_FRONTEND_COMPONENT_TUNER, cmd, arg); | ||
507 | } | ||
508 | |||
495 | static int load_firmware(struct dvb_frontend *fe, unsigned int type, | 509 | static int load_firmware(struct dvb_frontend *fe, unsigned int type, |
496 | v4l2_std_id *id) | 510 | v4l2_std_id *id) |
497 | { | 511 | { |
@@ -530,8 +544,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, | |||
530 | 544 | ||
531 | if (!size) { | 545 | if (!size) { |
532 | /* Special callback command received */ | 546 | /* Special callback command received */ |
533 | rc = priv->tuner_callback(priv->video_dev, | 547 | rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0); |
534 | XC2028_TUNER_RESET, 0); | ||
535 | if (rc < 0) { | 548 | if (rc < 0) { |
536 | tuner_err("Error at RESET code %d\n", | 549 | tuner_err("Error at RESET code %d\n", |
537 | (*p) & 0x7f); | 550 | (*p) & 0x7f); |
@@ -542,8 +555,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, | |||
542 | if (size >= 0xff00) { | 555 | if (size >= 0xff00) { |
543 | switch (size) { | 556 | switch (size) { |
544 | case 0xff00: | 557 | case 0xff00: |
545 | rc = priv->tuner_callback(priv->video_dev, | 558 | rc = do_tuner_callback(fe, XC2028_RESET_CLK, 0); |
546 | XC2028_RESET_CLK, 0); | ||
547 | if (rc < 0) { | 559 | if (rc < 0) { |
548 | tuner_err("Error at RESET code %d\n", | 560 | tuner_err("Error at RESET code %d\n", |
549 | (*p) & 0x7f); | 561 | (*p) & 0x7f); |
@@ -715,8 +727,7 @@ retry: | |||
715 | memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); | 727 | memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); |
716 | 728 | ||
717 | /* Reset is needed before loading firmware */ | 729 | /* Reset is needed before loading firmware */ |
718 | rc = priv->tuner_callback(priv->video_dev, | 730 | rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0); |
719 | XC2028_TUNER_RESET, 0); | ||
720 | if (rc < 0) | 731 | if (rc < 0) |
721 | goto fail; | 732 | goto fail; |
722 | 733 | ||
@@ -933,7 +944,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, | |||
933 | The reset CLK is needed only with tm6000. | 944 | The reset CLK is needed only with tm6000. |
934 | Driver should work fine even if this fails. | 945 | Driver should work fine even if this fails. |
935 | */ | 946 | */ |
936 | priv->tuner_callback(priv->video_dev, XC2028_RESET_CLK, 1); | 947 | do_tuner_callback(fe, XC2028_RESET_CLK, 1); |
937 | 948 | ||
938 | msleep(10); | 949 | msleep(10); |
939 | 950 | ||
@@ -1002,11 +1013,6 @@ static int xc2028_set_params(struct dvb_frontend *fe, | |||
1002 | 1013 | ||
1003 | tuner_dbg("%s called\n", __func__); | 1014 | tuner_dbg("%s called\n", __func__); |
1004 | 1015 | ||
1005 | if (priv->ctrl.d2633) | ||
1006 | type |= D2633; | ||
1007 | else | ||
1008 | type |= D2620; | ||
1009 | |||
1010 | switch(fe->ops.info.type) { | 1016 | switch(fe->ops.info.type) { |
1011 | case FE_OFDM: | 1017 | case FE_OFDM: |
1012 | bw = p->u.ofdm.bandwidth; | 1018 | bw = p->u.ofdm.bandwidth; |
@@ -1021,10 +1027,8 @@ static int xc2028_set_params(struct dvb_frontend *fe, | |||
1021 | break; | 1027 | break; |
1022 | case FE_ATSC: | 1028 | case FE_ATSC: |
1023 | bw = BANDWIDTH_6_MHZ; | 1029 | bw = BANDWIDTH_6_MHZ; |
1024 | /* The only ATSC firmware (at least on v2.7) is D2633, | 1030 | /* The only ATSC firmware (at least on v2.7) is D2633 */ |
1025 | so overrides ctrl->d2633 */ | 1031 | type |= ATSC | D2633; |
1026 | type |= ATSC| D2633; | ||
1027 | type &= ~D2620; | ||
1028 | break; | 1032 | break; |
1029 | /* DVB-S is not supported */ | 1033 | /* DVB-S is not supported */ |
1030 | default: | 1034 | default: |
@@ -1057,6 +1061,28 @@ static int xc2028_set_params(struct dvb_frontend *fe, | |||
1057 | tuner_err("error: bandwidth not supported.\n"); | 1061 | tuner_err("error: bandwidth not supported.\n"); |
1058 | }; | 1062 | }; |
1059 | 1063 | ||
1064 | /* | ||
1065 | Selects between D2633 or D2620 firmware. | ||
1066 | It doesn't make sense for ATSC, since it should be D2633 on all cases | ||
1067 | */ | ||
1068 | if (fe->ops.info.type != FE_ATSC) { | ||
1069 | switch (priv->ctrl.type) { | ||
1070 | case XC2028_D2633: | ||
1071 | type |= D2633; | ||
1072 | break; | ||
1073 | case XC2028_D2620: | ||
1074 | type |= D2620; | ||
1075 | break; | ||
1076 | case XC2028_AUTO: | ||
1077 | default: | ||
1078 | /* Zarlink seems to need D2633 */ | ||
1079 | if (priv->ctrl.demod == XC3028_FE_ZARLINK456) | ||
1080 | type |= D2633; | ||
1081 | else | ||
1082 | type |= D2620; | ||
1083 | } | ||
1084 | } | ||
1085 | |||
1060 | /* All S-code tables need a 200kHz shift */ | 1086 | /* All S-code tables need a 200kHz shift */ |
1061 | if (priv->ctrl.demod) | 1087 | if (priv->ctrl.demod) |
1062 | demod = priv->ctrl.demod + 200; | 1088 | demod = priv->ctrl.demod + 200; |
@@ -1177,20 +1203,10 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, | |||
1177 | break; | 1203 | break; |
1178 | case 1: | 1204 | case 1: |
1179 | /* new tuner instance */ | 1205 | /* new tuner instance */ |
1180 | priv->tuner_callback = cfg->callback; | ||
1181 | priv->ctrl.max_len = 13; | 1206 | priv->ctrl.max_len = 13; |
1182 | 1207 | ||
1183 | mutex_init(&priv->lock); | 1208 | mutex_init(&priv->lock); |
1184 | 1209 | ||
1185 | /* analog side (tuner-core) uses i2c_adap->algo_data. | ||
1186 | * digital side is not guaranteed to have algo_data defined. | ||
1187 | * | ||
1188 | * digital side will always have fe->dvb defined. | ||
1189 | * analog side (tuner-core) doesn't (yet) define fe->dvb. | ||
1190 | */ | ||
1191 | priv->video_dev = ((fe->dvb) && (fe->dvb->priv)) ? | ||
1192 | fe->dvb->priv : cfg->i2c_adap->algo_data; | ||
1193 | |||
1194 | fe->tuner_priv = priv; | 1210 | fe->tuner_priv = priv; |
1195 | break; | 1211 | break; |
1196 | case 2: | 1212 | case 2: |
diff --git a/drivers/media/common/tuners/tuner-xc2028.h b/drivers/media/common/tuners/tuner-xc2028.h index 216025cf5d4b..19de7928a74e 100644 --- a/drivers/media/common/tuners/tuner-xc2028.h +++ b/drivers/media/common/tuners/tuner-xc2028.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "dvb_frontend.h" | 10 | #include "dvb_frontend.h" |
11 | 11 | ||
12 | #define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw" | 12 | #define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw" |
13 | #define XC3028L_DEFAULT_FIRMWARE "xc3028L-v36.fw" | ||
13 | 14 | ||
14 | /* Dmoduler IF (kHz) */ | 15 | /* Dmoduler IF (kHz) */ |
15 | #define XC3028_FE_DEFAULT 0 /* Don't load SCODE */ | 16 | #define XC3028_FE_DEFAULT 0 /* Don't load SCODE */ |
@@ -23,24 +24,28 @@ | |||
23 | #define XC3028_FE_ZARLINK456 4560 | 24 | #define XC3028_FE_ZARLINK456 4560 |
24 | #define XC3028_FE_CHINA 5200 | 25 | #define XC3028_FE_CHINA 5200 |
25 | 26 | ||
27 | enum firmware_type { | ||
28 | XC2028_AUTO = 0, /* By default, auto-detects */ | ||
29 | XC2028_D2633, | ||
30 | XC2028_D2620, | ||
31 | }; | ||
32 | |||
26 | struct xc2028_ctrl { | 33 | struct xc2028_ctrl { |
27 | char *fname; | 34 | char *fname; |
28 | int max_len; | 35 | int max_len; |
29 | unsigned int scode_table; | 36 | unsigned int scode_table; |
30 | unsigned int mts :1; | 37 | unsigned int mts :1; |
31 | unsigned int d2633 :1; | ||
32 | unsigned int input1:1; | 38 | unsigned int input1:1; |
33 | unsigned int vhfbw7:1; | 39 | unsigned int vhfbw7:1; |
34 | unsigned int uhfbw8:1; | 40 | unsigned int uhfbw8:1; |
35 | unsigned int demod; | 41 | unsigned int demod; |
42 | enum firmware_type type:2; | ||
36 | }; | 43 | }; |
37 | 44 | ||
38 | struct xc2028_config { | 45 | struct xc2028_config { |
39 | struct i2c_adapter *i2c_adap; | 46 | struct i2c_adapter *i2c_adap; |
40 | u8 i2c_addr; | 47 | u8 i2c_addr; |
41 | void *video_dev; | ||
42 | struct xc2028_ctrl *ctrl; | 48 | struct xc2028_ctrl *ctrl; |
43 | int (*callback) (void *dev, int command, int arg); | ||
44 | }; | 49 | }; |
45 | 50 | ||
46 | /* xc2028 commands for callback */ | 51 | /* xc2028 commands for callback */ |
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index dcddfa803a75..f9c2bb917f54 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "dvb_frontend.h" | 30 | #include "dvb_frontend.h" |
31 | 31 | ||
32 | #include "xc5000.h" | 32 | #include "xc5000.h" |
33 | #include "xc5000_priv.h" | 33 | #include "tuner-i2c.h" |
34 | 34 | ||
35 | static int debug; | 35 | static int debug; |
36 | module_param(debug, int, 0644); | 36 | module_param(debug, int, 0644); |
@@ -40,12 +40,26 @@ static int xc5000_load_fw_on_attach; | |||
40 | module_param_named(init_fw, xc5000_load_fw_on_attach, int, 0644); | 40 | module_param_named(init_fw, xc5000_load_fw_on_attach, int, 0644); |
41 | MODULE_PARM_DESC(init_fw, "Load firmware during driver initialization."); | 41 | MODULE_PARM_DESC(init_fw, "Load firmware during driver initialization."); |
42 | 42 | ||
43 | static DEFINE_MUTEX(xc5000_list_mutex); | ||
44 | static LIST_HEAD(hybrid_tuner_instance_list); | ||
45 | |||
43 | #define dprintk(level,fmt, arg...) if (debug >= level) \ | 46 | #define dprintk(level,fmt, arg...) if (debug >= level) \ |
44 | printk(KERN_INFO "%s: " fmt, "xc5000", ## arg) | 47 | printk(KERN_INFO "%s: " fmt, "xc5000", ## arg) |
45 | 48 | ||
46 | #define XC5000_DEFAULT_FIRMWARE "dvb-fe-xc5000-1.1.fw" | 49 | #define XC5000_DEFAULT_FIRMWARE "dvb-fe-xc5000-1.1.fw" |
47 | #define XC5000_DEFAULT_FIRMWARE_SIZE 12332 | 50 | #define XC5000_DEFAULT_FIRMWARE_SIZE 12332 |
48 | 51 | ||
52 | struct xc5000_priv { | ||
53 | struct tuner_i2c_props i2c_props; | ||
54 | struct list_head hybrid_tuner_instance_list; | ||
55 | |||
56 | u32 if_khz; | ||
57 | u32 freq_hz; | ||
58 | u32 bandwidth; | ||
59 | u8 video_standard; | ||
60 | u8 rf_mode; | ||
61 | }; | ||
62 | |||
49 | /* Misc Defines */ | 63 | /* Misc Defines */ |
50 | #define MAX_TV_STANDARD 23 | 64 | #define MAX_TV_STANDARD 23 |
51 | #define XC_MAX_I2C_WRITE_LENGTH 64 | 65 | #define XC_MAX_I2C_WRITE_LENGTH 64 |
@@ -216,9 +230,12 @@ static void xc5000_TunerReset(struct dvb_frontend *fe) | |||
216 | 230 | ||
217 | dprintk(1, "%s()\n", __func__); | 231 | dprintk(1, "%s()\n", __func__); |
218 | 232 | ||
219 | if (priv->cfg->tuner_callback) { | 233 | if (fe->callback) { |
220 | ret = priv->cfg->tuner_callback(priv->devptr, | 234 | ret = fe->callback(((fe->dvb) && (fe->dvb->priv)) ? |
221 | XC5000_TUNER_RESET, 0); | 235 | fe->dvb->priv : |
236 | priv->i2c_props.adap->algo_data, | ||
237 | DVB_FRONTEND_COMPONENT_TUNER, | ||
238 | XC5000_TUNER_RESET, 0); | ||
222 | if (ret) | 239 | if (ret) |
223 | printk(KERN_ERR "xc5000: reset failed\n"); | 240 | printk(KERN_ERR "xc5000: reset failed\n"); |
224 | } else | 241 | } else |
@@ -509,13 +526,13 @@ static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val) | |||
509 | u8 buf[2] = { reg >> 8, reg & 0xff }; | 526 | u8 buf[2] = { reg >> 8, reg & 0xff }; |
510 | u8 bval[2] = { 0, 0 }; | 527 | u8 bval[2] = { 0, 0 }; |
511 | struct i2c_msg msg[2] = { | 528 | struct i2c_msg msg[2] = { |
512 | { .addr = priv->cfg->i2c_address, | 529 | { .addr = priv->i2c_props.addr, |
513 | .flags = 0, .buf = &buf[0], .len = 2 }, | 530 | .flags = 0, .buf = &buf[0], .len = 2 }, |
514 | { .addr = priv->cfg->i2c_address, | 531 | { .addr = priv->i2c_props.addr, |
515 | .flags = I2C_M_RD, .buf = &bval[0], .len = 2 }, | 532 | .flags = I2C_M_RD, .buf = &bval[0], .len = 2 }, |
516 | }; | 533 | }; |
517 | 534 | ||
518 | if (i2c_transfer(priv->i2c, msg, 2) != 2) { | 535 | if (i2c_transfer(priv->i2c_props.adap, msg, 2) != 2) { |
519 | printk(KERN_WARNING "xc5000: I2C read failed\n"); | 536 | printk(KERN_WARNING "xc5000: I2C read failed\n"); |
520 | return -EREMOTEIO; | 537 | return -EREMOTEIO; |
521 | } | 538 | } |
@@ -526,10 +543,10 @@ static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val) | |||
526 | 543 | ||
527 | static int xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len) | 544 | static int xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len) |
528 | { | 545 | { |
529 | struct i2c_msg msg = { .addr = priv->cfg->i2c_address, | 546 | struct i2c_msg msg = { .addr = priv->i2c_props.addr, |
530 | .flags = 0, .buf = buf, .len = len }; | 547 | .flags = 0, .buf = buf, .len = len }; |
531 | 548 | ||
532 | if (i2c_transfer(priv->i2c, &msg, 1) != 1) { | 549 | if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { |
533 | printk(KERN_ERR "xc5000: I2C write failed (len=%i)\n", | 550 | printk(KERN_ERR "xc5000: I2C write failed (len=%i)\n", |
534 | (int)len); | 551 | (int)len); |
535 | return -EREMOTEIO; | 552 | return -EREMOTEIO; |
@@ -539,10 +556,10 @@ static int xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len) | |||
539 | 556 | ||
540 | static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len) | 557 | static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len) |
541 | { | 558 | { |
542 | struct i2c_msg msg = { .addr = priv->cfg->i2c_address, | 559 | struct i2c_msg msg = { .addr = priv->i2c_props.addr, |
543 | .flags = I2C_M_RD, .buf = buf, .len = len }; | 560 | .flags = I2C_M_RD, .buf = buf, .len = len }; |
544 | 561 | ||
545 | if (i2c_transfer(priv->i2c, &msg, 1) != 1) { | 562 | if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { |
546 | printk(KERN_ERR "xc5000 I2C read failed (len=%i)\n",(int)len); | 563 | printk(KERN_ERR "xc5000 I2C read failed (len=%i)\n",(int)len); |
547 | return -EREMOTEIO; | 564 | return -EREMOTEIO; |
548 | } | 565 | } |
@@ -559,7 +576,7 @@ static int xc5000_fwupload(struct dvb_frontend* fe) | |||
559 | printk(KERN_INFO "xc5000: waiting for firmware upload (%s)...\n", | 576 | printk(KERN_INFO "xc5000: waiting for firmware upload (%s)...\n", |
560 | XC5000_DEFAULT_FIRMWARE); | 577 | XC5000_DEFAULT_FIRMWARE); |
561 | 578 | ||
562 | ret = request_firmware(&fw, XC5000_DEFAULT_FIRMWARE, &priv->i2c->dev); | 579 | ret = request_firmware(&fw, XC5000_DEFAULT_FIRMWARE, &priv->i2c_props.adap->dev); |
563 | if (ret) { | 580 | if (ret) { |
564 | printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n"); | 581 | printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n"); |
565 | ret = XC_RESULT_RESET_FAILURE; | 582 | ret = XC_RESULT_RESET_FAILURE; |
@@ -675,10 +692,10 @@ static int xc5000_set_params(struct dvb_frontend *fe, | |||
675 | return -EREMOTEIO; | 692 | return -EREMOTEIO; |
676 | } | 693 | } |
677 | 694 | ||
678 | ret = xc_set_IF_frequency(priv, priv->cfg->if_khz); | 695 | ret = xc_set_IF_frequency(priv, priv->if_khz); |
679 | if (ret != XC_RESULT_SUCCESS) { | 696 | if (ret != XC_RESULT_SUCCESS) { |
680 | printk(KERN_ERR "xc5000: xc_Set_IF_frequency(%d) failed\n", | 697 | printk(KERN_ERR "xc5000: xc_Set_IF_frequency(%d) failed\n", |
681 | priv->cfg->if_khz); | 698 | priv->if_khz); |
682 | return -EIO; | 699 | return -EIO; |
683 | } | 700 | } |
684 | 701 | ||
@@ -897,9 +914,19 @@ static int xc5000_init(struct dvb_frontend *fe) | |||
897 | 914 | ||
898 | static int xc5000_release(struct dvb_frontend *fe) | 915 | static int xc5000_release(struct dvb_frontend *fe) |
899 | { | 916 | { |
917 | struct xc5000_priv *priv = fe->tuner_priv; | ||
918 | |||
900 | dprintk(1, "%s()\n", __func__); | 919 | dprintk(1, "%s()\n", __func__); |
901 | kfree(fe->tuner_priv); | 920 | |
921 | mutex_lock(&xc5000_list_mutex); | ||
922 | |||
923 | if (priv) | ||
924 | hybrid_tuner_release_state(priv); | ||
925 | |||
926 | mutex_unlock(&xc5000_list_mutex); | ||
927 | |||
902 | fe->tuner_priv = NULL; | 928 | fe->tuner_priv = NULL; |
929 | |||
903 | return 0; | 930 | return 0; |
904 | } | 931 | } |
905 | 932 | ||
@@ -924,29 +951,43 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = { | |||
924 | 951 | ||
925 | struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | 952 | struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, |
926 | struct i2c_adapter *i2c, | 953 | struct i2c_adapter *i2c, |
927 | struct xc5000_config *cfg, void *devptr) | 954 | struct xc5000_config *cfg) |
928 | { | 955 | { |
929 | struct xc5000_priv *priv = NULL; | 956 | struct xc5000_priv *priv = NULL; |
957 | int instance; | ||
930 | u16 id = 0; | 958 | u16 id = 0; |
931 | 959 | ||
932 | dprintk(1, "%s()\n", __func__); | 960 | dprintk(1, "%s(%d-%04x)\n", __func__, |
961 | i2c ? i2c_adapter_id(i2c) : -1, | ||
962 | cfg ? cfg->i2c_address : -1); | ||
933 | 963 | ||
934 | priv = kzalloc(sizeof(struct xc5000_priv), GFP_KERNEL); | 964 | mutex_lock(&xc5000_list_mutex); |
935 | if (priv == NULL) | ||
936 | return NULL; | ||
937 | 965 | ||
938 | priv->cfg = cfg; | 966 | instance = hybrid_tuner_request_state(struct xc5000_priv, priv, |
939 | priv->bandwidth = BANDWIDTH_6_MHZ; | 967 | hybrid_tuner_instance_list, |
940 | priv->i2c = i2c; | 968 | i2c, cfg->i2c_address, "xc5000"); |
941 | priv->devptr = devptr; | 969 | switch (instance) { |
970 | case 0: | ||
971 | goto fail; | ||
972 | break; | ||
973 | case 1: | ||
974 | /* new tuner instance */ | ||
975 | priv->bandwidth = BANDWIDTH_6_MHZ; | ||
976 | priv->if_khz = cfg->if_khz; | ||
977 | |||
978 | fe->tuner_priv = priv; | ||
979 | break; | ||
980 | default: | ||
981 | /* existing tuner instance */ | ||
982 | fe->tuner_priv = priv; | ||
983 | break; | ||
984 | } | ||
942 | 985 | ||
943 | /* Check if firmware has been loaded. It is possible that another | 986 | /* Check if firmware has been loaded. It is possible that another |
944 | instance of the driver has loaded the firmware. | 987 | instance of the driver has loaded the firmware. |
945 | */ | 988 | */ |
946 | if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != 0) { | 989 | if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != 0) |
947 | kfree(priv); | 990 | goto fail; |
948 | return NULL; | ||
949 | } | ||
950 | 991 | ||
951 | switch(id) { | 992 | switch(id) { |
952 | case XC_PRODUCT_ID_FW_LOADED: | 993 | case XC_PRODUCT_ID_FW_LOADED: |
@@ -967,19 +1008,23 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | |||
967 | printk(KERN_ERR | 1008 | printk(KERN_ERR |
968 | "xc5000: Device not found at addr 0x%02x (0x%x)\n", | 1009 | "xc5000: Device not found at addr 0x%02x (0x%x)\n", |
969 | cfg->i2c_address, id); | 1010 | cfg->i2c_address, id); |
970 | kfree(priv); | 1011 | goto fail; |
971 | return NULL; | ||
972 | } | 1012 | } |
973 | 1013 | ||
1014 | mutex_unlock(&xc5000_list_mutex); | ||
1015 | |||
974 | memcpy(&fe->ops.tuner_ops, &xc5000_tuner_ops, | 1016 | memcpy(&fe->ops.tuner_ops, &xc5000_tuner_ops, |
975 | sizeof(struct dvb_tuner_ops)); | 1017 | sizeof(struct dvb_tuner_ops)); |
976 | 1018 | ||
977 | fe->tuner_priv = priv; | ||
978 | |||
979 | if (xc5000_load_fw_on_attach) | 1019 | if (xc5000_load_fw_on_attach) |
980 | xc5000_init(fe); | 1020 | xc5000_init(fe); |
981 | 1021 | ||
982 | return fe; | 1022 | return fe; |
1023 | fail: | ||
1024 | mutex_unlock(&xc5000_list_mutex); | ||
1025 | |||
1026 | xc5000_release(fe); | ||
1027 | return NULL; | ||
983 | } | 1028 | } |
984 | EXPORT_SYMBOL(xc5000_attach); | 1029 | EXPORT_SYMBOL(xc5000_attach); |
985 | 1030 | ||
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h index 5389f740945a..cf1a558e0e7f 100644 --- a/drivers/media/common/tuners/xc5000.h +++ b/drivers/media/common/tuners/xc5000.h | |||
@@ -30,8 +30,6 @@ struct i2c_adapter; | |||
30 | struct xc5000_config { | 30 | struct xc5000_config { |
31 | u8 i2c_address; | 31 | u8 i2c_address; |
32 | u32 if_khz; | 32 | u32 if_khz; |
33 | |||
34 | int (*tuner_callback) (void *priv, int command, int arg); | ||
35 | }; | 33 | }; |
36 | 34 | ||
37 | /* xc5000 callback command */ | 35 | /* xc5000 callback command */ |
@@ -49,13 +47,11 @@ struct xc5000_config { | |||
49 | (defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE)) | 47 | (defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE)) |
50 | extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, | 48 | extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, |
51 | struct i2c_adapter *i2c, | 49 | struct i2c_adapter *i2c, |
52 | struct xc5000_config *cfg, | 50 | struct xc5000_config *cfg); |
53 | void *devptr); | ||
54 | #else | 51 | #else |
55 | static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, | 52 | static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, |
56 | struct i2c_adapter *i2c, | 53 | struct i2c_adapter *i2c, |
57 | struct xc5000_config *cfg, | 54 | struct xc5000_config *cfg) |
58 | void *devptr) | ||
59 | { | 55 | { |
60 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 56 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
61 | return NULL; | 57 | return NULL; |
diff --git a/drivers/media/common/tuners/xc5000_priv.h b/drivers/media/common/tuners/xc5000_priv.h deleted file mode 100644 index b2a0074c99c9..000000000000 --- a/drivers/media/common/tuners/xc5000_priv.h +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for Xceive XC5000 "QAM/8VSB single chip tuner" | ||
3 | * | ||
4 | * Copyright (c) 2007 Steven Toth <stoth@linuxtv.org> | ||
5 | * | ||
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 | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #ifndef XC5000_PRIV_H | ||
23 | #define XC5000_PRIV_H | ||
24 | |||
25 | struct xc5000_priv { | ||
26 | struct xc5000_config *cfg; | ||
27 | struct i2c_adapter *i2c; | ||
28 | |||
29 | u32 freq_hz; | ||
30 | u32 bandwidth; | ||
31 | u8 video_standard; | ||
32 | u8 rf_mode; | ||
33 | |||
34 | void *devptr; | ||
35 | }; | ||
36 | |||
37 | #endif | ||