2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* descriptions + helper functions for simple dvb plls.
|
|
|
|
*
|
|
|
|
* (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/dvb/frontend.h>
|
|
|
|
#include <asm/types.h>
|
|
|
|
|
|
|
|
#include "dvb-pll.h"
|
|
|
|
|
2007-09-08 05:19:57 +08:00
|
|
|
struct dvb_pll_priv {
|
|
|
|
/* pll number */
|
|
|
|
int nr;
|
|
|
|
|
|
|
|
/* i2c details */
|
|
|
|
int pll_i2c_address;
|
|
|
|
struct i2c_adapter *i2c;
|
|
|
|
|
|
|
|
/* the PLL descriptor */
|
|
|
|
struct dvb_pll_desc *pll_desc;
|
|
|
|
|
|
|
|
/* cached frequency/bandwidth */
|
|
|
|
u32 frequency;
|
|
|
|
u32 bandwidth;
|
|
|
|
};
|
|
|
|
|
2007-09-10 00:00:45 +08:00
|
|
|
#define DVB_PLL_MAX 64
|
2007-09-08 05:19:57 +08:00
|
|
|
|
|
|
|
static unsigned int dvb_pll_devcount;
|
|
|
|
|
|
|
|
static int debug = 0;
|
|
|
|
module_param(debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "enable verbose debug messages");
|
|
|
|
|
|
|
|
static unsigned int input[DVB_PLL_MAX] = { [ 0 ... (DVB_PLL_MAX-1) ] = 0 };
|
|
|
|
module_param_array(input, int, NULL, 0644);
|
|
|
|
MODULE_PARM_DESC(input,"specify rf input choice, 0 for autoselect (default)");
|
|
|
|
|
2007-09-08 05:27:43 +08:00
|
|
|
static unsigned int id[DVB_PLL_MAX] =
|
|
|
|
{ [ 0 ... (DVB_PLL_MAX-1) ] = DVB_PLL_UNDEFINED };
|
|
|
|
module_param_array(id, int, NULL, 0644);
|
|
|
|
MODULE_PARM_DESC(id, "force pll id to use (DEBUG ONLY)");
|
|
|
|
|
2007-09-08 05:19:57 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
struct dvb_pll_desc {
|
|
|
|
char *name;
|
|
|
|
u32 min;
|
|
|
|
u32 max;
|
|
|
|
u32 iffreq;
|
2007-09-08 05:03:58 +08:00
|
|
|
void (*set)(struct dvb_frontend *fe, u8 *buf,
|
|
|
|
const struct dvb_frontend_parameters *params);
|
2007-06-13 03:10:51 +08:00
|
|
|
u8 *initdata;
|
|
|
|
u8 *sleepdata;
|
|
|
|
int count;
|
|
|
|
struct {
|
|
|
|
u32 limit;
|
|
|
|
u32 stepsize;
|
|
|
|
u8 config;
|
|
|
|
u8 cb;
|
|
|
|
} entries[12];
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* descriptions */
|
|
|
|
|
2007-04-27 23:31:29 +08:00
|
|
|
/* Set AGC TOP value to 103 dBuV:
|
|
|
|
0x80 = Control Byte
|
|
|
|
0x40 = 250 uA charge pump (irrelevant)
|
|
|
|
0x18 = Aux Byte to follow
|
|
|
|
0x06 = 64.5 kHz divider (irrelevant)
|
|
|
|
0x01 = Disable Vt (aka sleep)
|
|
|
|
|
|
|
|
0x00 = AGC Time constant 2s Iagc = 300 nA (vs 0x80 = 9 nA)
|
|
|
|
0x50 = AGC Take over point = 103 dBuV */
|
|
|
|
static u8 tua603x_agc103[] = { 2, 0x80|0x40|0x18|0x06|0x01, 0x00|0x50 };
|
|
|
|
|
V4L/DVB (5636): Integrate all users of the fmd1216 tuner with dvb-pll
Enhance the dvb-pll definition of the fmd1216 tuner by adding an init sequence
and a sleep sequence.
The init sequence sets the AGC control register to 0xa0, selecting the fast
time constant and 112 dBuV take-over point. This the recommended value for
DVB-T operation.
The sleep sequence sets bit P4 (which is believed to turn the analog
demodulator on), turns off the tuning voltage, and sets the AGC control
register to 0x60 (external AGC voltage, the recommended value for analog
operation).
The existing dvb-pll users in the cx88 driver, listed below, will gain these
init and sleep sequences.
CX88_BOARD_HAUPPAUGE_HVR1100 Hauppauge WinTV-HVR1100 DVB-T/Hybrid
CX88_BOARD_HAUPPAUGE_HVR1100LP Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profi
CX88_BOARD_WINFAST_DTV2000H WinFast DTV2000 H
CX88_BOARD_HAUPPAUGE_HVR3000 Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DV
CX88_BOARD_HAUPPAUGE_HVR1300 Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encod
This non-dvb-pll user in the cx88 driver should only gain the sleep sequence,
as it already had an equivalent init sequence. The non-dvb-pll code for this
user is removed.
X88_BOARD_DNTV_LIVE_DVB_T_PRO digitalnow DNTV Live! DVB-T Pro
In these saa7134 driver, these non-dvb-pll users are converted to use dvb-pll:
SAA7134_BOARD_MD7134 Medion 7134
SAA7134_BOARD_ASUS_EUROPA2_HYBRID Asus Europa2 OEM
The saa7134 functions philips_fmd1216_tuner_init(),
philips_fmd1216_tuner_sleep(), and philips_fmd1216_tuner_set_params() are
deleted and the dvb-pll versions are used.
This should result in equivalent sleep, init, and tuning sequences being sent
to the tuner.
For the cxusb driver, only one board is effected:
USB_PID_MEDION_MD95700 Medion MD95700
This board used dvb_usb_tuner_init_i2c() and dvb_usb_tuner_set_params_i2c()
for init and tuning, respectively. These functions are effectively the same
as the dvb-pll versions. They call a tuner pass control function defined at
the dvb-usb level, but this does not matter, as this card does not have a
tuner pass control function (only the dib3000mb does). This board will gain
the sleep sequence, while init and tuning should be unchanged.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-05-09 05:05:16 +08:00
|
|
|
/* 0x04 = 166.67 kHz divider
|
|
|
|
|
|
|
|
0x80 = AGC Time constant 50ms Iagc = 9 uA
|
|
|
|
0x20 = AGC Take over point = 112 dBuV */
|
|
|
|
static u8 tua603x_agc112[] = { 2, 0x80|0x40|0x18|0x04|0x01, 0x80|0x20 };
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.name = "Thomson dtt7579",
|
|
|
|
.min = 177000000,
|
|
|
|
.max = 858000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-03-19 13:24:09 +08:00
|
|
|
.sleepdata = (u8[]){ 2, 0xb4, 0x03 },
|
|
|
|
.count = 4,
|
2005-04-17 06:20:36 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 443250000, 166667, 0xb4, 0x02 },
|
|
|
|
{ 542000000, 166667, 0xb4, 0x08 },
|
|
|
|
{ 771000000, 166667, 0xbc, 0x08 },
|
|
|
|
{ 999999999, 166667, 0xf4, 0x08 },
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_thomson_dtt7610 = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.name = "Thomson dtt7610",
|
|
|
|
.min = 44000000,
|
|
|
|
.max = 958000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 44000000,
|
2005-04-17 06:20:36 +08:00
|
|
|
.count = 3,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 157250000, 62500, 0x8e, 0x39 },
|
|
|
|
{ 454000000, 62500, 0x8e, 0x3a },
|
|
|
|
{ 999999999, 62500, 0x8e, 0x3c },
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-09-08 05:03:58 +08:00
|
|
|
static void thomson_dtt759x_bw(struct dvb_frontend *fe, u8 *buf,
|
2007-05-05 23:05:39 +08:00
|
|
|
const struct dvb_frontend_parameters *params)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-05-05 23:05:39 +08:00
|
|
|
if (BANDWIDTH_7_MHZ == params->u.ofdm.bandwidth)
|
2005-04-17 06:20:36 +08:00
|
|
|
buf[3] |= 0x10;
|
|
|
|
}
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_thomson_dtt759x = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.name = "Thomson dtt759x",
|
|
|
|
.min = 177000000,
|
|
|
|
.max = 896000000,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = thomson_dtt759x_bw,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-03-19 13:24:09 +08:00
|
|
|
.sleepdata = (u8[]){ 2, 0x84, 0x03 },
|
|
|
|
.count = 5,
|
2005-04-17 06:20:36 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 264000000, 166667, 0xb4, 0x02 },
|
|
|
|
{ 470000000, 166667, 0xbc, 0x02 },
|
|
|
|
{ 735000000, 166667, 0xbc, 0x08 },
|
|
|
|
{ 835000000, 166667, 0xf4, 0x08 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x08 },
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_lg_z201 = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.name = "LG z201",
|
|
|
|
.min = 174000000,
|
|
|
|
.max = 862000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-03-19 13:24:09 +08:00
|
|
|
.sleepdata = (u8[]){ 2, 0xbc, 0x03 },
|
|
|
|
.count = 5,
|
2005-04-17 06:20:36 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 157500000, 166667, 0xbc, 0x01 },
|
|
|
|
{ 443250000, 166667, 0xbc, 0x02 },
|
|
|
|
{ 542000000, 166667, 0xbc, 0x04 },
|
|
|
|
{ 830000000, 166667, 0xf4, 0x04 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x04 },
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_microtune_4042 = {
|
2005-07-08 08:58:29 +08:00
|
|
|
.name = "Microtune 4042 FI5",
|
|
|
|
.min = 57000000,
|
|
|
|
.max = 858000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 44000000,
|
2005-07-08 08:58:29 +08:00
|
|
|
.count = 3,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 162000000, 62500, 0x8e, 0xa1 },
|
|
|
|
{ 457000000, 62500, 0x8e, 0x91 },
|
|
|
|
{ 999999999, 62500, 0x8e, 0x31 },
|
2005-07-08 08:58:29 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_thomson_dtt761x = {
|
2006-01-10 01:25:29 +08:00
|
|
|
/* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
|
|
|
|
.name = "Thomson dtt761x",
|
|
|
|
.min = 57000000,
|
|
|
|
.max = 863000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 44000000,
|
2005-07-08 08:58:42 +08:00
|
|
|
.count = 3,
|
2007-04-27 23:31:29 +08:00
|
|
|
.initdata = tua603x_agc103,
|
2005-07-08 08:58:42 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 147000000, 62500, 0x8e, 0x39 },
|
|
|
|
{ 417000000, 62500, 0x8e, 0x3a },
|
|
|
|
{ 999999999, 62500, 0x8e, 0x3c },
|
2005-07-08 08:58:42 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_unknown_1 = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.name = "unknown 1", /* used by dntv live dvb-t */
|
|
|
|
.min = 174000000,
|
|
|
|
.max = 862000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2005-04-17 06:20:36 +08:00
|
|
|
.count = 9,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 150000000, 166667, 0xb4, 0x01 },
|
|
|
|
{ 173000000, 166667, 0xbc, 0x01 },
|
|
|
|
{ 250000000, 166667, 0xb4, 0x02 },
|
|
|
|
{ 400000000, 166667, 0xbc, 0x02 },
|
|
|
|
{ 420000000, 166667, 0xf4, 0x02 },
|
|
|
|
{ 470000000, 166667, 0xfc, 0x02 },
|
|
|
|
{ 600000000, 166667, 0xbc, 0x08 },
|
|
|
|
{ 730000000, 166667, 0xf4, 0x08 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x08 },
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2005-06-24 13:02:35 +08:00
|
|
|
/* Infineon TUA6010XS
|
|
|
|
* used in Thomson Cable Tuner
|
|
|
|
*/
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_tua6010xs = {
|
2005-06-24 13:02:35 +08:00
|
|
|
.name = "Infineon TUA6010XS",
|
|
|
|
.min = 44250000,
|
|
|
|
.max = 858000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36125000,
|
2005-06-24 13:02:35 +08:00
|
|
|
.count = 3,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 115750000, 62500, 0x8e, 0x03 },
|
|
|
|
{ 403250000, 62500, 0x8e, 0x06 },
|
|
|
|
{ 999999999, 62500, 0x8e, 0x85 },
|
2005-06-24 13:02:35 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Panasonic env57h1xd5 (some Philips PLL ?) */
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_env57h1xd5 = {
|
2005-06-24 13:02:35 +08:00
|
|
|
.name = "Panasonic ENV57H1XD5",
|
|
|
|
.min = 44250000,
|
|
|
|
.max = 858000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36125000,
|
2005-06-24 13:02:35 +08:00
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 153000000, 166667, 0xc2, 0x41 },
|
|
|
|
{ 470000000, 166667, 0xc2, 0x42 },
|
|
|
|
{ 526000000, 166667, 0xc2, 0x84 },
|
|
|
|
{ 999999999, 166667, 0xc2, 0xa4 },
|
2005-06-24 13:02:35 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Philips TDA6650/TDA6651
|
|
|
|
* used in Panasonic ENV77H11D5
|
|
|
|
*/
|
2007-09-08 05:03:58 +08:00
|
|
|
static void tda665x_bw(struct dvb_frontend *fe, u8 *buf,
|
|
|
|
const struct dvb_frontend_parameters *params)
|
2005-06-24 13:02:35 +08:00
|
|
|
{
|
2007-05-05 23:05:39 +08:00
|
|
|
if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
|
2005-06-24 13:02:35 +08:00
|
|
|
buf[3] |= 0x08;
|
|
|
|
}
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_tda665x = {
|
2005-06-24 13:02:35 +08:00
|
|
|
.name = "Philips TDA6650/TDA6651",
|
|
|
|
.min = 44250000,
|
|
|
|
.max = 858000000,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = tda665x_bw,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-05-10 02:58:17 +08:00
|
|
|
.initdata = (u8[]){ 4, 0x0b, 0xf5, 0x85, 0xab },
|
2005-06-24 13:02:35 +08:00
|
|
|
.count = 12,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 93834000, 166667, 0xca, 0x61 /* 011 0 0 0 01 */ },
|
|
|
|
{ 123834000, 166667, 0xca, 0xa1 /* 101 0 0 0 01 */ },
|
|
|
|
{ 161000000, 166667, 0xca, 0xa1 /* 101 0 0 0 01 */ },
|
|
|
|
{ 163834000, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ },
|
|
|
|
{ 253834000, 166667, 0xca, 0x62 /* 011 0 0 0 10 */ },
|
|
|
|
{ 383834000, 166667, 0xca, 0xa2 /* 101 0 0 0 10 */ },
|
|
|
|
{ 443834000, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ },
|
|
|
|
{ 444000000, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ },
|
|
|
|
{ 583834000, 166667, 0xca, 0x64 /* 011 0 0 1 00 */ },
|
|
|
|
{ 793834000, 166667, 0xca, 0xa4 /* 101 0 0 1 00 */ },
|
|
|
|
{ 444834000, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ },
|
|
|
|
{ 861000000, 166667, 0xca, 0xe4 /* 111 0 0 1 00 */ },
|
2005-06-24 13:02:35 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Infineon TUA6034
|
|
|
|
* used in LG TDTP E102P
|
|
|
|
*/
|
2007-09-08 05:03:58 +08:00
|
|
|
static void tua6034_bw(struct dvb_frontend *fe, u8 *buf,
|
|
|
|
const struct dvb_frontend_parameters *params)
|
2005-06-24 13:02:35 +08:00
|
|
|
{
|
2007-05-05 23:05:39 +08:00
|
|
|
if (BANDWIDTH_7_MHZ != params->u.ofdm.bandwidth)
|
2005-06-24 13:02:35 +08:00
|
|
|
buf[3] |= 0x08;
|
|
|
|
}
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_tua6034 = {
|
2005-06-24 13:02:35 +08:00
|
|
|
.name = "Infineon TUA6034",
|
|
|
|
.min = 44250000,
|
|
|
|
.max = 858000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2005-06-24 13:02:35 +08:00
|
|
|
.count = 3,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = tua6034_bw,
|
2005-06-24 13:02:35 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 174500000, 62500, 0xce, 0x01 },
|
|
|
|
{ 230000000, 62500, 0xce, 0x02 },
|
|
|
|
{ 999999999, 62500, 0xce, 0x04 },
|
2005-06-24 13:02:35 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2005-08-09 00:22:43 +08:00
|
|
|
/* Infineon TUA6034
|
2006-04-23 03:15:11 +08:00
|
|
|
* used in LG TDVS-H061F, LG TDVS-H062F and LG TDVS-H064F
|
2005-08-09 00:22:43 +08:00
|
|
|
*/
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = {
|
2006-04-23 03:15:11 +08:00
|
|
|
.name = "LG TDVS-H06xF",
|
2005-08-09 00:22:43 +08:00
|
|
|
.min = 54000000,
|
|
|
|
.max = 863000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 44000000,
|
2007-04-27 23:31:30 +08:00
|
|
|
.initdata = tua603x_agc103,
|
2005-08-09 00:22:43 +08:00
|
|
|
.count = 3,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 165000000, 62500, 0xce, 0x01 },
|
|
|
|
{ 450000000, 62500, 0xce, 0x02 },
|
|
|
|
{ 999999999, 62500, 0xce, 0x04 },
|
2005-08-09 00:22:43 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2005-07-08 08:58:09 +08:00
|
|
|
/* Philips FMD1216ME
|
|
|
|
* used in Medion Hybrid PCMCIA card and USB Box
|
|
|
|
*/
|
2007-09-08 05:03:58 +08:00
|
|
|
static void fmd1216me_bw(struct dvb_frontend *fe, u8 *buf,
|
|
|
|
const struct dvb_frontend_parameters *params)
|
2005-07-08 08:58:09 +08:00
|
|
|
{
|
2007-05-05 23:05:39 +08:00
|
|
|
if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ &&
|
|
|
|
params->frequency >= 158870000)
|
2005-07-08 08:58:09 +08:00
|
|
|
buf[3] |= 0x08;
|
|
|
|
}
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_fmd1216me = {
|
2005-07-08 08:58:12 +08:00
|
|
|
.name = "Philips FMD1216ME",
|
2005-07-08 08:58:09 +08:00
|
|
|
.min = 50870000,
|
|
|
|
.max = 858000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36125000,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = fmd1216me_bw,
|
V4L/DVB (5636): Integrate all users of the fmd1216 tuner with dvb-pll
Enhance the dvb-pll definition of the fmd1216 tuner by adding an init sequence
and a sleep sequence.
The init sequence sets the AGC control register to 0xa0, selecting the fast
time constant and 112 dBuV take-over point. This the recommended value for
DVB-T operation.
The sleep sequence sets bit P4 (which is believed to turn the analog
demodulator on), turns off the tuning voltage, and sets the AGC control
register to 0x60 (external AGC voltage, the recommended value for analog
operation).
The existing dvb-pll users in the cx88 driver, listed below, will gain these
init and sleep sequences.
CX88_BOARD_HAUPPAUGE_HVR1100 Hauppauge WinTV-HVR1100 DVB-T/Hybrid
CX88_BOARD_HAUPPAUGE_HVR1100LP Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profi
CX88_BOARD_WINFAST_DTV2000H WinFast DTV2000 H
CX88_BOARD_HAUPPAUGE_HVR3000 Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DV
CX88_BOARD_HAUPPAUGE_HVR1300 Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encod
This non-dvb-pll user in the cx88 driver should only gain the sleep sequence,
as it already had an equivalent init sequence. The non-dvb-pll code for this
user is removed.
X88_BOARD_DNTV_LIVE_DVB_T_PRO digitalnow DNTV Live! DVB-T Pro
In these saa7134 driver, these non-dvb-pll users are converted to use dvb-pll:
SAA7134_BOARD_MD7134 Medion 7134
SAA7134_BOARD_ASUS_EUROPA2_HYBRID Asus Europa2 OEM
The saa7134 functions philips_fmd1216_tuner_init(),
philips_fmd1216_tuner_sleep(), and philips_fmd1216_tuner_set_params() are
deleted and the dvb-pll versions are used.
This should result in equivalent sleep, init, and tuning sequences being sent
to the tuner.
For the cxusb driver, only one board is effected:
USB_PID_MEDION_MD95700 Medion MD95700
This board used dvb_usb_tuner_init_i2c() and dvb_usb_tuner_set_params_i2c()
for init and tuning, respectively. These functions are effectively the same
as the dvb-pll versions. They call a tuner pass control function defined at
the dvb-usb level, but this does not matter, as this card does not have a
tuner pass control function (only the dib3000mb does). This board will gain
the sleep sequence, while init and tuning should be unchanged.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-05-09 05:05:16 +08:00
|
|
|
.initdata = tua603x_agc112,
|
|
|
|
.sleepdata = (u8[]){ 4, 0x9c, 0x60, 0x85, 0x54 },
|
2005-07-08 08:58:09 +08:00
|
|
|
.count = 7,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 143870000, 166667, 0xbc, 0x41 },
|
|
|
|
{ 158870000, 166667, 0xf4, 0x41 },
|
|
|
|
{ 329870000, 166667, 0xbc, 0x42 },
|
|
|
|
{ 441870000, 166667, 0xf4, 0x42 },
|
|
|
|
{ 625870000, 166667, 0xbc, 0x44 },
|
|
|
|
{ 803870000, 166667, 0xf4, 0x44 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x44 },
|
2005-07-08 08:58:09 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2005-07-08 08:58:12 +08:00
|
|
|
/* ALPS TDED4
|
|
|
|
* used in Nebula-Cards and USB boxes
|
|
|
|
*/
|
2007-09-08 05:03:58 +08:00
|
|
|
static void tded4_bw(struct dvb_frontend *fe, u8 *buf,
|
|
|
|
const struct dvb_frontend_parameters *params)
|
2005-07-08 08:58:12 +08:00
|
|
|
{
|
2007-05-05 23:05:39 +08:00
|
|
|
if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
|
2005-07-08 08:58:12 +08:00
|
|
|
buf[3] |= 0x04;
|
|
|
|
}
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_tded4 = {
|
2005-07-08 08:58:12 +08:00
|
|
|
.name = "ALPS TDED4",
|
|
|
|
.min = 47000000,
|
|
|
|
.max = 863000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = tded4_bw,
|
2005-07-08 08:58:12 +08:00
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 153000000, 166667, 0x85, 0x01 },
|
|
|
|
{ 470000000, 166667, 0x85, 0x02 },
|
|
|
|
{ 823000000, 166667, 0x85, 0x08 },
|
|
|
|
{ 999999999, 166667, 0x85, 0x88 },
|
2005-07-08 08:58:12 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2005-11-09 13:35:39 +08:00
|
|
|
/* ALPS TDHU2
|
|
|
|
* used in AverTVHD MCE A180
|
|
|
|
*/
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_tdhu2 = {
|
2005-11-09 13:35:39 +08:00
|
|
|
.name = "ALPS TDHU2",
|
|
|
|
.min = 54000000,
|
|
|
|
.max = 864000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 44000000,
|
2005-11-09 13:35:39 +08:00
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 162000000, 62500, 0x85, 0x01 },
|
|
|
|
{ 426000000, 62500, 0x85, 0x02 },
|
|
|
|
{ 782000000, 62500, 0x85, 0x08 },
|
|
|
|
{ 999999999, 62500, 0x85, 0x88 },
|
2005-11-09 13:35:39 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Philips TUV1236D
|
|
|
|
* used in ATI HDTV Wonder
|
|
|
|
*/
|
2007-09-08 05:03:58 +08:00
|
|
|
static void tuv1236d_rf(struct dvb_frontend *fe, u8 *buf,
|
|
|
|
const struct dvb_frontend_parameters *params)
|
2007-05-05 23:15:57 +08:00
|
|
|
{
|
2007-09-08 05:19:57 +08:00
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
unsigned int new_rf = input[priv->nr];
|
|
|
|
|
|
|
|
if ((new_rf == 0) || (new_rf > 2)) {
|
|
|
|
switch (params->u.vsb.modulation) {
|
|
|
|
case QAM_64:
|
|
|
|
case QAM_256:
|
|
|
|
new_rf = 1;
|
|
|
|
break;
|
|
|
|
case VSB_8:
|
|
|
|
default:
|
|
|
|
new_rf = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (new_rf) {
|
|
|
|
case 1:
|
2007-05-05 23:15:57 +08:00
|
|
|
buf[3] |= 0x08;
|
|
|
|
break;
|
2007-09-08 05:19:57 +08:00
|
|
|
case 2:
|
2007-05-05 23:15:57 +08:00
|
|
|
buf[3] &= ~0x08;
|
2007-09-08 05:19:57 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"%s: unhandled rf input selection: %d",
|
|
|
|
__FUNCTION__, new_rf);
|
2007-05-05 23:15:57 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_tuv1236d = {
|
2005-11-09 13:35:39 +08:00
|
|
|
.name = "Philips TUV1236D",
|
2005-11-09 13:35:46 +08:00
|
|
|
.min = 54000000,
|
2005-11-09 13:35:39 +08:00
|
|
|
.max = 864000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 44000000,
|
2007-05-05 23:15:57 +08:00
|
|
|
.set = tuv1236d_rf,
|
2005-11-09 13:35:39 +08:00
|
|
|
.count = 3,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 157250000, 62500, 0xc6, 0x41 },
|
|
|
|
{ 454000000, 62500, 0xc6, 0x42 },
|
|
|
|
{ 999999999, 62500, 0xc6, 0x44 },
|
2005-11-09 13:35:39 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2006-01-24 03:11:06 +08:00
|
|
|
/* Samsung TBMV30111IN / TBMV30712IN1
|
2005-11-09 13:35:39 +08:00
|
|
|
* used in Air2PC ATSC - 2nd generation (nxt2002)
|
|
|
|
*/
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_samsung_tbmv = {
|
2006-01-24 03:11:07 +08:00
|
|
|
.name = "Samsung TBMV30111IN / TBMV30712IN1",
|
2005-11-09 13:35:39 +08:00
|
|
|
.min = 54000000,
|
|
|
|
.max = 860000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 44000000,
|
2006-01-16 05:04:04 +08:00
|
|
|
.count = 6,
|
2005-11-09 13:35:39 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 172000000, 166667, 0xb4, 0x01 },
|
|
|
|
{ 214000000, 166667, 0xb4, 0x02 },
|
|
|
|
{ 467000000, 166667, 0xbc, 0x02 },
|
|
|
|
{ 721000000, 166667, 0xbc, 0x08 },
|
|
|
|
{ 841000000, 166667, 0xf4, 0x08 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x02 },
|
2005-11-09 13:35:39 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-01-12 09:31:53 +08:00
|
|
|
/*
|
|
|
|
* Philips SD1878 Tuner.
|
|
|
|
*/
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = {
|
2006-01-12 09:31:53 +08:00
|
|
|
.name = "Philips SD1878",
|
|
|
|
.min = 950000,
|
|
|
|
.max = 2150000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 249, /* zero-IF, offset 249 is to round up */
|
2006-01-12 09:31:53 +08:00
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 1250000, 500, 0xc4, 0x00},
|
|
|
|
{ 1550000, 500, 0xc4, 0x40},
|
|
|
|
{ 2050000, 500, 0xc4, 0x80},
|
|
|
|
{ 2150000, 500, 0xc4, 0xc0},
|
2006-01-12 09:31:53 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2006-02-07 16:25:14 +08:00
|
|
|
/*
|
|
|
|
* Philips TD1316 Tuner.
|
|
|
|
*/
|
2007-09-08 05:03:58 +08:00
|
|
|
static void td1316_bw(struct dvb_frontend *fe, u8 *buf,
|
|
|
|
const struct dvb_frontend_parameters *params)
|
2006-02-07 16:25:14 +08:00
|
|
|
{
|
|
|
|
u8 band;
|
|
|
|
|
|
|
|
/* determine band */
|
2007-05-05 23:05:39 +08:00
|
|
|
if (params->frequency < 161000000)
|
2006-02-07 16:25:14 +08:00
|
|
|
band = 1;
|
2007-05-05 23:05:39 +08:00
|
|
|
else if (params->frequency < 444000000)
|
2006-02-07 16:25:14 +08:00
|
|
|
band = 2;
|
|
|
|
else
|
|
|
|
band = 4;
|
|
|
|
|
|
|
|
buf[3] |= band;
|
|
|
|
|
|
|
|
/* setup PLL filter */
|
2007-05-05 23:05:39 +08:00
|
|
|
if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
|
2006-02-07 16:25:14 +08:00
|
|
|
buf[3] |= 1 << 3;
|
|
|
|
}
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_philips_td1316 = {
|
2006-02-07 16:25:14 +08:00
|
|
|
.name = "Philips TD1316",
|
|
|
|
.min = 87000000,
|
|
|
|
.max = 895000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = td1316_bw,
|
2006-02-07 16:25:14 +08:00
|
|
|
.count = 9,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 93834000, 166667, 0xca, 0x60},
|
|
|
|
{ 123834000, 166667, 0xca, 0xa0},
|
|
|
|
{ 163834000, 166667, 0xca, 0xc0},
|
|
|
|
{ 253834000, 166667, 0xca, 0x60},
|
|
|
|
{ 383834000, 166667, 0xca, 0xa0},
|
|
|
|
{ 443834000, 166667, 0xca, 0xc0},
|
|
|
|
{ 583834000, 166667, 0xca, 0x60},
|
|
|
|
{ 793834000, 166667, 0xca, 0xa0},
|
|
|
|
{ 858834000, 166667, 0xca, 0xe0},
|
2006-02-07 16:25:14 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2006-02-28 19:34:59 +08:00
|
|
|
/* FE6600 used on DViCO Hybrid */
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_thomson_fe6600 = {
|
2006-03-01 11:04:42 +08:00
|
|
|
.name = "Thomson FE6600",
|
2006-02-28 19:34:59 +08:00
|
|
|
.min = 44250000,
|
|
|
|
.max = 858000000,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36125000,
|
2006-02-28 19:34:59 +08:00
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 250000000, 166667, 0xb4, 0x12 },
|
|
|
|
{ 455000000, 166667, 0xfe, 0x11 },
|
|
|
|
{ 775500000, 166667, 0xbc, 0x18 },
|
|
|
|
{ 999999999, 166667, 0xf4, 0x18 },
|
2006-02-28 19:34:59 +08:00
|
|
|
}
|
|
|
|
};
|
2007-06-13 03:10:51 +08:00
|
|
|
|
2007-09-08 05:03:58 +08:00
|
|
|
static void opera1_bw(struct dvb_frontend *fe, u8 *buf,
|
|
|
|
const struct dvb_frontend_parameters *params)
|
2007-04-19 22:26:47 +08:00
|
|
|
{
|
2007-05-05 23:05:39 +08:00
|
|
|
if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ)
|
2007-04-19 22:26:47 +08:00
|
|
|
buf[2] |= 0x08;
|
|
|
|
}
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_opera1 = {
|
2007-04-19 22:26:47 +08:00
|
|
|
.name = "Opera Tuner",
|
|
|
|
.min = 900000,
|
|
|
|
.max = 2250000,
|
|
|
|
.iffreq= 0,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = opera1_bw,
|
2007-04-19 22:26:47 +08:00
|
|
|
.count = 8,
|
|
|
|
.entries = {
|
|
|
|
{ 1064000, 500, 0xe5, 0xc6 },
|
|
|
|
{ 1169000, 500, 0xe5, 0xe6 },
|
|
|
|
{ 1299000, 500, 0xe5, 0x24 },
|
|
|
|
{ 1444000, 500, 0xe5, 0x44 },
|
|
|
|
{ 1606000, 500, 0xe5, 0x64 },
|
|
|
|
{ 1777000, 500, 0xe5, 0x84 },
|
|
|
|
{ 1941000, 500, 0xe5, 0xa4 },
|
|
|
|
{ 2250000, 500, 0xe5, 0xc4 },
|
|
|
|
}
|
|
|
|
};
|
2007-06-13 03:10:51 +08:00
|
|
|
|
2006-10-14 09:18:01 +08:00
|
|
|
/* Philips FCV1236D
|
|
|
|
*/
|
2007-07-29 23:40:48 +08:00
|
|
|
static struct dvb_pll_desc dvb_pll_fcv1236d = {
|
2006-10-14 09:18:01 +08:00
|
|
|
/* Bit_0: RF Input select
|
|
|
|
* Bit_1: 0=digital, 1=analog
|
|
|
|
*/
|
|
|
|
.name = "Philips FCV1236D",
|
|
|
|
.min = 53000000,
|
|
|
|
.max = 803000000,
|
|
|
|
.iffreq= 44000000,
|
|
|
|
.count = 3,
|
|
|
|
.entries = {
|
|
|
|
{ 159000000, 62500, 0x8e, 0xa0 },
|
|
|
|
{ 453000000, 62500, 0x8e, 0x90 },
|
|
|
|
{ 999999999, 62500, 0x8e, 0x30 },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
|
|
|
|
static struct dvb_pll_desc *pll_list[] = {
|
|
|
|
[DVB_PLL_UNDEFINED] = NULL,
|
|
|
|
[DVB_PLL_THOMSON_DTT7579] = &dvb_pll_thomson_dtt7579,
|
|
|
|
[DVB_PLL_THOMSON_DTT759X] = &dvb_pll_thomson_dtt759x,
|
|
|
|
[DVB_PLL_THOMSON_DTT7610] = &dvb_pll_thomson_dtt7610,
|
|
|
|
[DVB_PLL_LG_Z201] = &dvb_pll_lg_z201,
|
|
|
|
[DVB_PLL_MICROTUNE_4042] = &dvb_pll_microtune_4042,
|
|
|
|
[DVB_PLL_THOMSON_DTT761X] = &dvb_pll_thomson_dtt761x,
|
|
|
|
[DVB_PLL_UNKNOWN_1] = &dvb_pll_unknown_1,
|
|
|
|
[DVB_PLL_TUA6010XS] = &dvb_pll_tua6010xs,
|
|
|
|
[DVB_PLL_ENV57H1XD5] = &dvb_pll_env57h1xd5,
|
|
|
|
[DVB_PLL_TUA6034] = &dvb_pll_tua6034,
|
|
|
|
[DVB_PLL_LG_TDVS_H06XF] = &dvb_pll_lg_tdvs_h06xf,
|
|
|
|
[DVB_PLL_TDA665X] = &dvb_pll_tda665x,
|
|
|
|
[DVB_PLL_FMD1216ME] = &dvb_pll_fmd1216me,
|
|
|
|
[DVB_PLL_TDED4] = &dvb_pll_tded4,
|
|
|
|
[DVB_PLL_TUV1236D] = &dvb_pll_tuv1236d,
|
|
|
|
[DVB_PLL_TDHU2] = &dvb_pll_tdhu2,
|
|
|
|
[DVB_PLL_SAMSUNG_TBMV] = &dvb_pll_samsung_tbmv,
|
|
|
|
[DVB_PLL_PHILIPS_SD1878_TDA8261] = &dvb_pll_philips_sd1878_tda8261,
|
|
|
|
[DVB_PLL_PHILIPS_TD1316] = &dvb_pll_philips_td1316,
|
|
|
|
[DVB_PLL_THOMSON_FE6600] = &dvb_pll_thomson_fe6600,
|
|
|
|
[DVB_PLL_OPERA1] = &dvb_pll_opera1,
|
2006-10-14 09:18:01 +08:00
|
|
|
[DVB_PLL_FCV1236D] = &dvb_pll_fcv1236d,
|
2007-06-13 03:10:51 +08:00
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* code */
|
|
|
|
|
2007-09-08 05:03:58 +08:00
|
|
|
static int dvb_pll_configure(struct dvb_frontend *fe, u8 *buf,
|
2007-06-03 03:30:46 +08:00
|
|
|
const struct dvb_frontend_parameters *params)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-09-08 05:03:58 +08:00
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
struct dvb_pll_desc *desc = priv->pll_desc;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 div;
|
|
|
|
int i;
|
|
|
|
|
2007-05-05 23:05:39 +08:00
|
|
|
if (params->frequency != 0 && (params->frequency < desc->min ||
|
|
|
|
params->frequency > desc->max))
|
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
for (i = 0; i < desc->count; i++) {
|
2007-05-05 23:05:39 +08:00
|
|
|
if (params->frequency > desc->entries[i].limit)
|
2005-04-17 06:20:36 +08:00
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
}
|
2007-05-05 23:05:39 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (debug)
|
2007-05-05 23:05:39 +08:00
|
|
|
printk("pll: %s: freq=%d | i=%d/%d\n", desc->name,
|
|
|
|
params->frequency, i, desc->count);
|
2006-04-19 04:47:12 +08:00
|
|
|
if (i == desc->count)
|
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-05-05 23:05:39 +08:00
|
|
|
div = (params->frequency + desc->iffreq +
|
|
|
|
desc->entries[i].stepsize/2) / desc->entries[i].stepsize;
|
2005-04-17 06:20:36 +08:00
|
|
|
buf[0] = div >> 8;
|
|
|
|
buf[1] = div & 0xff;
|
2006-01-24 03:11:11 +08:00
|
|
|
buf[2] = desc->entries[i].config;
|
|
|
|
buf[3] = desc->entries[i].cb;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-05-05 23:05:39 +08:00
|
|
|
if (desc->set)
|
2007-09-08 05:03:58 +08:00
|
|
|
desc->set(fe, buf, params);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (debug)
|
|
|
|
printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
|
|
|
|
desc->name, div, buf[0], buf[1], buf[2], buf[3]);
|
|
|
|
|
2006-11-21 03:45:29 +08:00
|
|
|
// calculate the frequency we set it to
|
2007-03-19 13:24:04 +08:00
|
|
|
return (div * desc->entries[i].stepsize) - desc->iffreq;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-04-19 04:47:12 +08:00
|
|
|
static int dvb_pll_release(struct dvb_frontend *fe)
|
|
|
|
{
|
2006-11-20 06:49:11 +08:00
|
|
|
kfree(fe->tuner_priv);
|
2006-04-19 04:47:12 +08:00
|
|
|
fe->tuner_priv = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dvb_pll_sleep(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
|
2006-08-09 02:48:08 +08:00
|
|
|
if (priv->i2c == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2007-03-19 13:24:09 +08:00
|
|
|
if (priv->pll_desc->sleepdata) {
|
|
|
|
struct i2c_msg msg = { .flags = 0,
|
|
|
|
.addr = priv->pll_i2c_address,
|
|
|
|
.buf = priv->pll_desc->sleepdata + 1,
|
|
|
|
.len = priv->pll_desc->sleepdata[0] };
|
2006-04-19 04:47:12 +08:00
|
|
|
|
2007-03-19 13:24:09 +08:00
|
|
|
int result;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
2007-03-19 13:24:09 +08:00
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
|
|
if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
return 0;
|
2006-04-19 04:47:12 +08:00
|
|
|
}
|
2007-03-19 13:24:09 +08:00
|
|
|
/* Shouldn't be called when initdata is NULL, maybe BUG()? */
|
|
|
|
return -EINVAL;
|
2006-04-19 04:47:12 +08:00
|
|
|
}
|
|
|
|
|
2006-11-21 03:38:42 +08:00
|
|
|
static int dvb_pll_set_params(struct dvb_frontend *fe,
|
|
|
|
struct dvb_frontend_parameters *params)
|
2006-04-19 04:47:12 +08:00
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
u8 buf[4];
|
|
|
|
struct i2c_msg msg =
|
2006-11-21 03:38:42 +08:00
|
|
|
{ .addr = priv->pll_i2c_address, .flags = 0,
|
|
|
|
.buf = buf, .len = sizeof(buf) };
|
2006-04-19 04:47:12 +08:00
|
|
|
int result;
|
2007-05-05 23:05:39 +08:00
|
|
|
u32 frequency = 0;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
if (priv->i2c == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2007-09-08 05:03:58 +08:00
|
|
|
if ((result = dvb_pll_configure(fe, buf, params)) < 0)
|
2006-04-19 04:47:12 +08:00
|
|
|
return result;
|
2006-11-21 03:45:29 +08:00
|
|
|
else
|
|
|
|
frequency = result;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
2006-05-14 16:01:31 +08:00
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
2006-04-19 04:47:12 +08:00
|
|
|
if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2006-11-21 03:45:29 +08:00
|
|
|
priv->frequency = frequency;
|
2007-05-05 23:05:39 +08:00
|
|
|
priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-11-21 03:38:42 +08:00
|
|
|
static int dvb_pll_calc_regs(struct dvb_frontend *fe,
|
|
|
|
struct dvb_frontend_parameters *params,
|
|
|
|
u8 *buf, int buf_len)
|
2006-04-19 04:47:12 +08:00
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
int result;
|
2007-05-05 23:05:39 +08:00
|
|
|
u32 frequency = 0;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
if (buf_len < 5)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2007-09-08 05:03:58 +08:00
|
|
|
if ((result = dvb_pll_configure(fe, buf+1, params)) < 0)
|
2006-04-19 04:47:12 +08:00
|
|
|
return result;
|
2006-11-21 03:45:29 +08:00
|
|
|
else
|
|
|
|
frequency = result;
|
|
|
|
|
2006-04-19 04:47:12 +08:00
|
|
|
buf[0] = priv->pll_i2c_address;
|
|
|
|
|
2006-11-21 03:45:29 +08:00
|
|
|
priv->frequency = frequency;
|
2007-05-05 23:05:39 +08:00
|
|
|
priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dvb_pll_get_frequency(struct dvb_frontend *fe, u32 *frequency)
|
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
*frequency = priv->frequency;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dvb_pll_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
|
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
*bandwidth = priv->bandwidth;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-04-27 23:31:29 +08:00
|
|
|
static int dvb_pll_init(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
|
|
|
|
if (priv->i2c == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (priv->pll_desc->initdata) {
|
|
|
|
struct i2c_msg msg = { .flags = 0,
|
|
|
|
.addr = priv->pll_i2c_address,
|
|
|
|
.buf = priv->pll_desc->initdata + 1,
|
|
|
|
.len = priv->pll_desc->initdata[0] };
|
|
|
|
|
|
|
|
int result;
|
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
|
|
if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* Shouldn't be called when initdata is NULL, maybe BUG()? */
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2006-04-19 04:47:12 +08:00
|
|
|
static struct dvb_tuner_ops dvb_pll_tuner_ops = {
|
|
|
|
.release = dvb_pll_release,
|
|
|
|
.sleep = dvb_pll_sleep,
|
2007-03-19 13:24:09 +08:00
|
|
|
.init = dvb_pll_init,
|
2006-04-19 04:47:12 +08:00
|
|
|
.set_params = dvb_pll_set_params,
|
2006-04-19 08:38:49 +08:00
|
|
|
.calc_regs = dvb_pll_calc_regs,
|
2006-04-19 04:47:12 +08:00
|
|
|
.get_frequency = dvb_pll_get_frequency,
|
|
|
|
.get_bandwidth = dvb_pll_get_bandwidth,
|
|
|
|
};
|
|
|
|
|
2006-11-21 03:38:42 +08:00
|
|
|
struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
|
|
|
|
struct i2c_adapter *i2c,
|
2007-06-13 03:10:51 +08:00
|
|
|
unsigned int pll_desc_id)
|
2006-04-19 04:47:12 +08:00
|
|
|
{
|
2006-07-10 14:34:14 +08:00
|
|
|
u8 b1 [] = { 0 };
|
2006-11-21 03:38:42 +08:00
|
|
|
struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD,
|
|
|
|
.buf = b1, .len = 1 };
|
2006-04-19 04:47:12 +08:00
|
|
|
struct dvb_pll_priv *priv = NULL;
|
2006-07-10 14:34:14 +08:00
|
|
|
int ret;
|
2007-06-13 03:10:51 +08:00
|
|
|
struct dvb_pll_desc *desc;
|
|
|
|
|
2007-09-08 05:27:43 +08:00
|
|
|
if ((id[dvb_pll_devcount] > DVB_PLL_UNDEFINED) &&
|
|
|
|
(id[dvb_pll_devcount] < ARRAY_SIZE(pll_list)))
|
|
|
|
pll_desc_id = id[dvb_pll_devcount];
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
BUG_ON(pll_desc_id < 1 || pll_desc_id >= ARRAY_SIZE(pll_list));
|
|
|
|
|
|
|
|
desc = pll_list[pll_desc_id];
|
2006-07-10 14:34:14 +08:00
|
|
|
|
2006-07-17 06:41:41 +08:00
|
|
|
if (i2c != NULL) {
|
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
|
|
|
2006-07-19 03:37:13 +08:00
|
|
|
ret = i2c_transfer (i2c, &msg, 1);
|
|
|
|
if (ret != 1)
|
2006-08-08 20:10:08 +08:00
|
|
|
return NULL;
|
2006-07-17 06:41:41 +08:00
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 0);
|
|
|
|
}
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL);
|
|
|
|
if (priv == NULL)
|
2006-08-08 20:10:08 +08:00
|
|
|
return NULL;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
priv->pll_i2c_address = pll_addr;
|
|
|
|
priv->i2c = i2c;
|
|
|
|
priv->pll_desc = desc;
|
2007-09-08 05:11:15 +08:00
|
|
|
priv->nr = dvb_pll_devcount++;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
2006-11-21 03:38:42 +08:00
|
|
|
memcpy(&fe->ops.tuner_ops, &dvb_pll_tuner_ops,
|
|
|
|
sizeof(struct dvb_tuner_ops));
|
|
|
|
|
2007-04-27 23:31:27 +08:00
|
|
|
strncpy(fe->ops.tuner_ops.info.name, desc->name,
|
|
|
|
sizeof(fe->ops.tuner_ops.info.name));
|
2006-05-14 16:01:31 +08:00
|
|
|
fe->ops.tuner_ops.info.frequency_min = desc->min;
|
2007-08-18 05:36:44 +08:00
|
|
|
fe->ops.tuner_ops.info.frequency_max = desc->max;
|
2007-03-19 13:24:09 +08:00
|
|
|
if (!desc->initdata)
|
|
|
|
fe->ops.tuner_ops.init = NULL;
|
|
|
|
if (!desc->sleepdata)
|
|
|
|
fe->ops.tuner_ops.sleep = NULL;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
fe->tuner_priv = priv;
|
2007-09-08 05:11:15 +08:00
|
|
|
|
2007-09-09 16:08:30 +08:00
|
|
|
if ((debug) || (id[priv->nr] == pll_desc_id)) {
|
2007-09-08 05:11:15 +08:00
|
|
|
printk("dvb-pll[%d]", priv->nr);
|
|
|
|
if (i2c != NULL)
|
|
|
|
printk(" %d-%04x", i2c_adapter_id(i2c), pll_addr);
|
2007-09-08 05:27:43 +08:00
|
|
|
printk(": id# %d (%s) attached, %s\n", pll_desc_id, desc->name,
|
|
|
|
id[priv->nr] == pll_desc_id ?
|
|
|
|
"insmod option" : "autodetected");
|
2007-09-09 16:16:34 +08:00
|
|
|
}
|
|
|
|
if ((debug) || (input[priv->nr] > 0)) {
|
|
|
|
printk("dvb-pll[%d]", priv->nr);
|
|
|
|
if (i2c != NULL)
|
|
|
|
printk(" %d-%04x", i2c_adapter_id(i2c), pll_addr);
|
|
|
|
printk(": tuner rf input will be ");
|
|
|
|
switch (input[priv->nr]) {
|
|
|
|
case 0:
|
|
|
|
printk("autoselected\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printk("set to input %d (insmod option)\n",
|
|
|
|
input[priv->nr]);
|
|
|
|
}
|
2007-09-08 05:11:15 +08:00
|
|
|
}
|
|
|
|
|
2006-08-08 20:10:08 +08:00
|
|
|
return fe;
|
2006-04-19 04:47:12 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(dvb_pll_attach);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
MODULE_DESCRIPTION("dvb pll library");
|
|
|
|
MODULE_AUTHOR("Gerd Knorr");
|
|
|
|
MODULE_LICENSE("GPL");
|