43 #define FWFILE "dvb-cx18-mpc718-mt352.fw"
45 #define CX18_REG_DMUX_NUM_PORT_0_CONTROL 0xd5a000
46 #define CX18_CLOCK_ENABLE2 0xc71024
47 #define CX18_DMUX_CLK_MASK 0x0080
55 .i2c_address = 0xC6 >> 1,
69 .AgcMasterByte = 0x00,
73 .demod_address = 0x32 >> 1,
97 .atsc_6 = { .if_freq = 5380, .agc_mode = 3, .std = 3,
98 .if_lvl = 6, .rfagc_top = 0x37 },
99 .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 0,
100 .if_lvl = 6, .rfagc_top = 0x37 },
104 .std_map = &hauppauge_tda18271_std_map,
114 .demod_address = 0x1e >> 1,
118 .disable_i2c_gate_ctrl = 1,
136 static int yuan_mpc718_mt352_reqfw(
struct cx18_stream *stream,
139 struct cx18 *cx = stream->
cx;
145 CX18_ERR(
"Unable to open firmware file %s\n", fn);
147 size_t sz = (*fw)->size;
148 if (sz < 2 || sz > 64 || (sz % 2) != 0) {
149 CX18_ERR(
"Firmware %s has a bad size: %lu bytes\n",
150 fn, (
unsigned long) sz);
158 CX18_ERR(
"The MPC718 board variant with the MT352 DVB-T"
159 "demodualtor will not work without it\n");
160 CX18_ERR(
"Run 'linux/Documentation/dvb/get_dvb_firmware "
161 "mpc718' if you need the firmware\n");
166 static int yuan_mpc718_mt352_init(
struct dvb_frontend *fe)
176 ret = yuan_mpc718_mt352_reqfw(stream, &fw);
181 for (i = 0; i < fw->
size; i += 2) {
182 buf[0] = fw->
data[
i];
194 mt352_write(fe, buf, 3);
203 mt352_write(fe, buf, 3);
207 buf[1] = fw->
data[i+1];
208 mt352_write(fe, buf, 2);
215 mt352_write(fe, buf, 2);
221 .demod_address = 0x1e >> 1,
225 .demod_init = yuan_mpc718_mt352_init,
229 .demod_address = 0x1e >> 1,
233 .disable_i2c_gate_ctrl = 1,
237 .demod_address = 0x1e >> 1,
241 .disable_i2c_gate_ctrl = 1,
244 static int dvb_register(
struct cx18_stream *stream);
269 CX18_ERR(
"Failed to initialize firmware starting DVB feed\n");
274 switch (cx->
card->type) {
297 if (!demux->
dmx.frontend)
301 if (stream->
dvb->feeding++ == 0) {
308 stream->
dvb->feeding--;
309 if (stream->
dvb->feeding == 0)
334 if (--stream->
dvb->feeding == 0) {
349 struct cx18 *cx = stream->
cx;
370 dvbdemux = &dvb->
demux;
372 dvbdemux->
priv = (
void *)stream;
377 dvbdemux->
stop_feed = cx18_dvb_stop_feed;
382 goto err_dvb_unregister_adapter;
384 dmx = &dvbdemux->
dmx;
388 dvb->
dmxdev.filternum = 256;
393 goto err_dvb_dmx_release;
397 goto err_dvb_dmxdev_release;
401 goto err_remove_hw_frontend;
405 goto err_remove_mem_frontend;
407 ret = dvb_register(stream);
409 goto err_disconnect_frontend;
414 CX18_INFO(
"Registered DVB adapter%d for %s (%d x %d.%02d kB)\n",
415 stream->
dvb->dvb_adapter.num, stream->
name,
417 (stream->
buf_size * 100 / 1024) % 100);
423 err_disconnect_frontend:
425 err_remove_mem_frontend:
427 err_remove_hw_frontend:
429 err_dvb_dmxdev_release:
433 err_dvb_unregister_adapter:
441 struct cx18 *cx = stream->
cx;
453 dvbdemux = &dvb->
demux;
454 dmx = &dvbdemux->
dmx;
470 static int dvb_register(
struct cx18_stream *stream)
473 struct cx18 *cx = stream->
cx;
476 switch (cx->
card->type) {
480 &hauppauge_hvr1600_config,
485 &hauppauge_hvr1600_tuner);
496 &hauppauge_tda18271_config);
500 &leadtek_dvr3100h_demod,
506 .i2c_addr = 0xc2 >> 1,
517 if (fe !=
NULL && fe->
ops.tuner_ops.set_config !=
NULL)
518 fe->
ops.tuner_ops.set_config(fe, &ctrl);
528 &yuan_mpc718_mt352_demod,
532 &yuan_mpc718_zl10353_demod,
538 .i2c_addr = 0xc2 >> 1,
549 if (fe !=
NULL && fe->
ops.tuner_ops.set_config !=
NULL)
550 fe->
ops.tuner_ops.set_config(fe, &ctrl);
555 &gotview_dvd3_zl10353_demod,
561 .i2c_addr = 0xc2 >> 1,
572 if (fe !=
NULL && fe->
ops.tuner_ops.set_config !=
NULL)
573 fe->
ops.tuner_ops.set_config(fe, &ctrl);
582 CX18_ERR(
"frontend initialization failed\n");
590 if (dvb->
fe->ops.release)
591 dvb->
fe->ops.release(dvb->
fe);
600 cx18_write_reg_expect(cx,