2 #include <linux/kernel.h>
4 #include <linux/dvb/dmx.h>
9 #include <linux/sched.h>
14 static int dvb_bandwidth[][2] = {
19 static int dvb_bandwidth_length =
ARRAY_SIZE(dvb_bandwidth);
22 static int poseidon_check_mode_dvbt(
struct poseidon *pd)
49 static int poseidon_ts_bus_ctrl(
struct dvb_frontend *fe,
int acquire)
73 ret = poseidon_check_mode_dvbt(pd);
105 pd->pm_suspend =
NULL;
106 pd->pm_resume =
NULL;
109 #define poseidon_fe_release NULL
132 return msec > 15000 ?
true :
false;
146 return msec > 800 ?
true :
false;
153 s32 i, bandwidth = -1;
161 for (i = 0; i < dvb_bandwidth_length; i++)
163 bandwidth = dvb_bandwidth[
i][0];
165 if (check_scan_ok(fep->
frequency, bandwidth, pd_dvb)) {
198 static int pm_dvb_suspend(
struct poseidon *pd)
202 dvb_urb_cleanup(pd_dvb);
207 static int pm_dvb_resume(
struct poseidon *pd)
211 poseidon_check_mode_dvbt(pd);
213 poseidon_set_fe(&pd_dvb->
dvb_fe);
215 dvb_start_streaming(pd_dvb);
226 pd->pm_suspend = pm_dvb_suspend;
227 pd->pm_resume = pm_dvb_resume;
244 static int poseidon_fe_get_tune_settings(
struct dvb_frontend *fe,
264 log(
"get tuner status error");
278 if (fw_delay_overflow(&pd->
dvb_data))
337 .name =
"Poseidon DVB-T",
338 .frequency_min = 174000000,
339 .frequency_max = 862000000,
340 .frequency_stepsize = 62500,
353 .init = poseidon_fe_init,
354 .sleep = poseidon_fe_sleep,
356 .set_frontend = poseidon_set_fe,
357 .get_frontend = poseidon_get_fe,
358 .get_tune_settings = poseidon_fe_get_tune_settings,
360 .read_status = poseidon_read_status,
361 .read_ber = poseidon_read_ber,
362 .read_signal_strength = poseidon_read_signal_strength,
363 .read_snr = poseidon_read_snr,
364 .read_ucblocks = poseidon_read_unc_blocks,
366 .ts_bus_ctrl = poseidon_ts_bus_ctrl,
369 static void dvb_urb_irq(
struct urb *
urb)
372 int len = urb->transfer_buffer_length;
377 if (urb->status == -
EPROTO)
382 if (urb->actual_length == len)
384 else if (urb->actual_length == len - 4) {
386 u8 *
buf = urb->transfer_buffer;
392 for (offset = 456; offset < len; offset += 512) {
393 if (!
strncmp(buf + offset,
"DVHS", 4)) {
395 if (len > offset + 52 + 4) {
398 len -= offset + 52 + 4;
409 log(
" usb_submit_urb failed: error %d", ret);
420 dvb_urb_irq, pd_dvb);
446 if (ret | cmd_status)
449 ret = dvb_urb_init(pd_dvb);
458 log(
" submit urb error %d", ret);
484 if (ret | cmd_status)
498 ret = dvb_start_streaming(pd_dvb);
526 "Poseidon dvbt adapter",
534 pd_dvb->
dvb_fe.demodulator_priv = pd;
542 dvbdemux = &pd_dvb->
demux;
544 dvbdemux->
priv = pd_dvb;
554 pd_dvb->
dmxdev.filternum = pd_dvb->
demux.filternum;
556 pd_dvb->
dmxdev.capabilities = 0;
590 dvb_urb_cleanup(pd_dvb);