aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2005-07-07 20:58:13 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 21:24:00 -0400
commit78c6e73f5a27f01e45e86a4e3d13863c9cce6374 (patch)
treeb9e5cfdffe2ecb7762bf7b8275c267a323b27b49 /drivers/media
parent0589b8e4fd24885a00d8954aef57c3319d161fee (diff)
[PATCH] dvb: usb: digitv-usb fixes
Some more work on the digitv-usb driver: o MT352 initialization and PLL-programming o I2c-transfer fixed. Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Johannes Stezenbach <js@linuxtv.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/digitv.c69
1 files changed, 24 insertions, 45 deletions
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c
index 5acf3fde9522..f272d34f7725 100644
--- a/drivers/media/dvb/dvb-usb/digitv.c
+++ b/drivers/media/dvb/dvb-usb/digitv.c
@@ -1,10 +1,9 @@
1/* DVB USB compliant linux driver for Nebula Electronics uDigiTV DVB-T USB2.0 1/* DVB USB compliant linux driver for Nebula Electronics uDigiTV DVB-T USB2.0
2 * receiver 2 * receiver
3 * 3 *
4 * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) and 4 * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de)
5 * Allan Third (allan.third@cs.man.ac.uk)
6 * 5 *
7 * partly based on the SDK published by Nebula Electronics (TODO do we want this line ?) 6 * partly based on the SDK published by Nebula Electronics
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free 9 * under the terms of the GNU General Public License as published by the Free
@@ -95,41 +94,20 @@ static int digitv_identify_state (struct usb_device *udev, struct
95 94
96static int digitv_mt352_demod_init(struct dvb_frontend *fe) 95static int digitv_mt352_demod_init(struct dvb_frontend *fe)
97{ 96{
98 static u8 mt352_clock_config[] = { 0x89, 0x38, 0x2d }; 97 static u8 reset_buf[] = { 0x89, 0x38, 0x8a, 0x2d, 0x50, 0x80 };
99 static u8 mt352_reset[] = { 0x50, 0x80 }; 98 static u8 init_buf[] = { 0x68, 0xa0, 0x8e, 0x40, 0x53, 0x50,
100 static u8 mt352_mclk_ratio[] = { 0x8b, 0x00 }; 99 0x67, 0x20, 0x7d, 0x01, 0x7c, 0x00, 0x7a, 0x00,
101 100 0x79, 0x20, 0x57, 0x05, 0x56, 0x31, 0x88, 0x0f,
102 static u8 mt352_agc_cfg[] = { 0x68, 0xa0 }; 101 0x75, 0x32 };
103 static u8 mt352_adc_ctl_1_cfg[] = { 0x8E, 0xa0 }; 102 int i;
104 static u8 mt352_acq_ctl[] = { 0x53, 0x50 };
105 static u8 mt352_agc_target[] = { 0x67, 0x20 };
106
107 static u8 mt352_rs_err_per[] = { 0x7c, 0x00, 0x01 };
108 static u8 mt352_snr_select[] = { 0x79, 0x00, 0x20 };
109
110 static u8 mt352_input_freq_1[] = { 0x56, 0x31, 0x05 };
111 103
112 static u8 mt352_scan_ctl[] = { 0x88, 0x0f }; 104 for (i = 0; i < ARRAY_SIZE(reset_buf); i += 2)
113 static u8 mt352_capt_range[] = { 0x75, 0x32 }; 105 mt352_write(fe, &reset_buf[i], 2);
114 106
115 mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config));
116 mt352_write(fe, mt352_reset, sizeof(mt352_reset));
117 msleep(1); 107 msleep(1);
118 mt352_write(fe, mt352_mclk_ratio, sizeof(mt352_mclk_ratio));
119
120 mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg));
121 mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg));
122 mt352_write(fe, mt352_acq_ctl, sizeof(mt352_acq_ctl));
123 mt352_write(fe, mt352_agc_target, sizeof(mt352_agc_target));
124
125
126 mt352_write(fe, mt352_rs_err_per, sizeof(mt352_rs_err_per));
127 mt352_write(fe, mt352_snr_select, sizeof(mt352_snr_select));
128 108
129 mt352_write(fe, mt352_input_freq_1, sizeof(mt352_input_freq_1)); 109 for (i = 0; i < ARRAY_SIZE(init_buf); i += 2)
130 110 mt352_write(fe, &init_buf[i], 2);
131 mt352_write(fe, mt352_scan_ctl, sizeof(mt352_scan_ctl));
132 mt352_write(fe, mt352_capt_range, sizeof(mt352_capt_range));
133 111
134 return 0; 112 return 0;
135} 113}
@@ -137,7 +115,7 @@ static int digitv_mt352_demod_init(struct dvb_frontend *fe)
137static struct mt352_config digitv_mt352_config = { 115static struct mt352_config digitv_mt352_config = {
138 .demod_address = 0x0, /* ignored by the digitv anyway */ 116 .demod_address = 0x0, /* ignored by the digitv anyway */
139 .demod_init = digitv_mt352_demod_init, 117 .demod_init = digitv_mt352_demod_init,
140 .pll_set = NULL, /* TODO */ 118 .pll_set = dvb_usb_pll_set,
141}; 119};
142 120
143static struct nxt6000_config digitv_nxt6000_config = { 121static struct nxt6000_config digitv_nxt6000_config = {
@@ -150,9 +128,9 @@ static struct nxt6000_config digitv_nxt6000_config = {
150 128
151static int digitv_frontend_attach(struct dvb_usb_device *d) 129static int digitv_frontend_attach(struct dvb_usb_device *d)
152{ 130{
153 if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) == NULL) 131 if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL)
154 return 0; 132 return 0;
155 if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) == NULL) { 133 if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) {
156 134
157 warn("nxt6000 support is not done yet, in fact you are one of the first " 135 warn("nxt6000 support is not done yet, in fact you are one of the first "
158 "person who wants to use this device in Linux. Please report to " 136 "person who wants to use this device in Linux. Please report to "
@@ -163,6 +141,13 @@ static int digitv_frontend_attach(struct dvb_usb_device *d)
163 return -EIO; 141 return -EIO;
164} 142}
165 143
144static int digitv_tuner_attach(struct dvb_usb_device *d)
145{
146 d->pll_addr = 0x60;
147 d->pll_desc = &dvb_pll_tded4;
148 return 0;
149}
150
166static struct dvb_usb_rc_key digitv_rc_keys[] = { 151static struct dvb_usb_rc_key digitv_rc_keys[] = {
167 { 0x00, 0x16, KEY_POWER }, /* dummy key */ 152 { 0x00, 0x16, KEY_POWER }, /* dummy key */
168}; 153};
@@ -184,7 +169,6 @@ int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
184 return 0; 169 return 0;
185} 170}
186 171
187
188/* DVB USB Driver stuff */ 172/* DVB USB Driver stuff */
189static struct dvb_usb_properties digitv_properties; 173static struct dvb_usb_properties digitv_properties;
190 174
@@ -208,13 +192,8 @@ static struct dvb_usb_properties digitv_properties = {
208 192
209 .size_of_priv = 0, 193 .size_of_priv = 0,
210 194
211 .streaming_ctrl = NULL,
212 .pid_filter = NULL,
213 .pid_filter_ctrl = NULL,
214 .power_ctrl = NULL,
215 .frontend_attach = digitv_frontend_attach, 195 .frontend_attach = digitv_frontend_attach,
216 .tuner_attach = NULL, // digitv_tuner_attach, 196 .tuner_attach = digitv_tuner_attach,
217 .read_mac_address = NULL,
218 197
219 .rc_interval = 1000, 198 .rc_interval = 1000,
220 .rc_key_map = digitv_rc_keys, 199 .rc_key_map = digitv_rc_keys,
@@ -238,7 +217,7 @@ static struct dvb_usb_properties digitv_properties = {
238 } 217 }
239 }, 218 },
240 219
241 .num_device_descs = 2, 220 .num_device_descs = 1,
242 .devices = { 221 .devices = {
243 { "Nebula Electronics uDigiTV DVB-T USB2.0)", 222 { "Nebula Electronics uDigiTV DVB-T USB2.0)",
244 { &digitv_table[0], NULL }, 223 { &digitv_table[0], NULL },