diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2012-09-21 20:01:45 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2012-09-21 20:01:45 (GMT) |
commit | c0dd634c8b5b2eb7c566ad5a8d8e0a75ac4058c3 (patch) | |
tree | 98d25bda9e81f24889dd31827d0252ab088b85bb /src | |
parent | fc6c0fc3df42cfad3fe07aa20d06085d4026f0c0 (diff) | |
download | AF903x_SRC-master.zip AF903x_SRC-master.tar.gz AF903x_SRC-master.tar.bz2 |
Only the asus stick should work with this on 3.2 kernel. Other
tuners/demodulators etc are disabled. Untested.
Diffstat (limited to 'src')
-rw-r--r-- | src/af903x-core.c | 22 | ||||
-rw-r--r-- | src/af903x-devices.c | 141 | ||||
-rw-r--r-- | src/af903x-drv.c | 16 | ||||
-rw-r--r-- | src/af903x-fe.c | 40 | ||||
-rw-r--r-- | src/af903x-tuner.c | 5 | ||||
-rw-r--r-- | src/af903x.h | 12 |
6 files changed, 137 insertions, 99 deletions
diff --git a/src/af903x-core.c b/src/af903x-core.c index 5d49694..0829a8e 100644 --- a/src/af903x-core.c +++ b/src/af903x-core.c @@ -31,14 +31,11 @@ static int af903x_probe(struct usb_interface *intf, return -ENOMEM; } -/*static int af903x_suspend(struct usb_interface *intf, u32 state) +static int af903x_suspend(struct usb_interface *intf, u32 state) { int error; deb_data("Enter %s Function\n",__FUNCTION__); -#ifdef EEEPC - error = DL_Reboot(); -#else if (DevicePower) { error = DL_CheckTunerInited(0, (Bool *) &TunerInited0); @@ -50,18 +47,15 @@ static int af903x_probe(struct usb_interface *intf, DeviceReboot = true; } -#endif return 0; -}*/ +} -/*static int af903x_resume(struct usb_interface *intf) +static int af903x_resume(struct usb_interface *intf) { int retval = -ENOMEM; int error; deb_data("Enter %s Function\n",__FUNCTION__); -#ifdef EEEPC -#else if(DeviceReboot == true) { retval = Device_init(interface_to_usbdev(intf),&DC, false); @@ -73,21 +67,17 @@ static int af903x_probe(struct usb_interface *intf, if (TunerInited1) error = DL_ApCtrl(1, 1); } -#endif return 0; -}*/ +} static struct usb_driver af903x_driver = { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) - .owner = THIS_MODULE, -#endif .name = "dvb_usb_af903x", .probe = af903x_probe, .disconnect = dvb_usb_device_exit, .id_table = af903x_usb_id_table, -// .suspend = af903x_suspend, -// .resume = af903x_resume, + .suspend = af903x_suspend, + .resume = af903x_resume, }; static int __init af903x_module_init(void) diff --git a/src/af903x-devices.c b/src/af903x-devices.c index e7ecfd4..3df9fde 100644 --- a/src/af903x-devices.c +++ b/src/af903x-devices.c @@ -1,5 +1,9 @@ #include "af903x.h" +static int dvb_usb_af903x_disable_rc = 1; +module_param_named(disable_rc, dvb_usb_af903x_disable_rc, int, 0644); +MODULE_PARM_DESC(disable_rc, "disable rc"); + bool DevicePower; static int af903x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) { @@ -75,7 +79,7 @@ static int af903x_identify_state(struct usb_device *udev, struct dvb_usb_device_ static int af903x_frontend_attach(struct dvb_usb_adapter *adap) { deb_data("- Enter %s Function - chip=%d\n", __FUNCTION__, adap->id); - adap->fe_adap[0].fe = af903x_attach(1); + adap->fe_adap[0].fe = af903x_attach(1); return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; } @@ -98,35 +102,40 @@ static int af903x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) struct usb_device_id af903x_usb_id_table[] = { - { USB_DEVICE(0x15A4,0x1000) }, - { USB_DEVICE(0x15A4,0x1001) }, - { USB_DEVICE(0x15A4,0x1002) }, - { USB_DEVICE(0x15A4,0x1003) }, - { USB_DEVICE(0x15A4,0x9035) }, - { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI_PLUS) }, - { 0}, /* Terminating entry */ + { USB_DEVICE(0x15A4,0x1000) }, + { USB_DEVICE(0x15A4,0x1001) }, + { USB_DEVICE(0x15A4,0x1002) }, + { USB_DEVICE(0x15A4,0x1003) }, + { USB_DEVICE(0x15A4,0x9035) }, + { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI) }, + { 0}, /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, af903x_usb_id_table); -struct dvb_usb_device_properties af903x_properties[] = { - { - .usb_ctrl = DEVICE_SPECIFIC, - .download_firmware = af903x_download_firmware, - .no_reconnect = 1, - .power_ctrl = af903x_powerctrl, - .identify_state = af903x_identify_state, - .num_adapters = 1, +struct dvb_usb_device_properties af903x_properties[] = {{ + .usb_ctrl = DEVICE_SPECIFIC, + .download_firmware = af903x_download_firmware, + .no_reconnect = 1, + .power_ctrl = af903x_powerctrl, + .identify_state = af903x_identify_state, + .num_adapters = 2, .adapter = { { - .fe[0].caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, - .fe[0].pid_filter_count = 32, - .fe[0].pid_filter = af903x_pid_filter, - .fe[0].pid_filter_ctrl = af903x_pid_filter_ctrl, - .fe[0].frontend_attach = af903x_frontend_attach, - .fe[0].tuner_attach = af903x_tuner_attach, - .fe[0].streaming_ctrl = af903x_streaming_ctrl, - .fe[0].stream = { + + .num_frontends = 1, + .fe = {{ + + .caps = DVB_USB_ADAP_HAS_PID_FILTER | + DVB_USB_ADAP_NEED_PID_FILTERING | + DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, + .pid_filter_count = 32, + .pid_filter = af903x_pid_filter, + .pid_filter_ctrl = af903x_pid_filter_ctrl, + .frontend_attach = af903x_frontend_attach, + .tuner_attach = af903x_tuner_attach, + .streaming_ctrl = af903x_streaming_ctrl, + .stream = { .type = USB_BULK, .count = 4, .endpoint = 0x84, @@ -136,33 +145,65 @@ struct dvb_usb_device_properties af903x_properties[] = { } } } - } - }, - .num_device_descs = 2, - .devices = { + + }}, + + }, { - "ITEtech USB2.0 DVB-T Receiver", { - &af903x_usb_id_table[0], - &af903x_usb_id_table[1], - &af903x_usb_id_table[2], - &af903x_usb_id_table[3], - &af903x_usb_id_table[4], - NULL - }, { - NULL - } - }, { - "Asus U3100MINI_PLUS/T/RC Receiver", { - &af903x_usb_id_table[5], - NULL - }, { - NULL + + .num_frontends = 1, + .fe = {{ + + .caps = DVB_USB_ADAP_HAS_PID_FILTER | + DVB_USB_ADAP_NEED_PID_FILTERING | + DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, + .pid_filter_count = 32, + .pid_filter = af903x_pid_filter, + .pid_filter_ctrl = af903x_pid_filter_ctrl, + .frontend_attach = af903x_frontend_attach, + .tuner_attach = af903x_tuner_attach, + .streaming_ctrl = af903x_streaming_ctrl, + .stream = { + .type = USB_BULK, + .count = 4, + .endpoint = 0x85, + .u = { + .bulk = { + .buffersize = 65424, + } + } } - }, { - NULL - } - } - } -}; + + }}, + + }, + }, +// .rc.core = { +// .protocol = RC_TYPE_NEC, +// .module_name = "af903x", +// .rc_query = af903x_rc_query, +// .rc_interval = AF903X_POLL, +// .allowed_protos = RC_TYPE_NEC, +// .rc_codes = NULL, /* will be set in +// af903x_identify_state */ +// }, + .num_device_descs = 2, + .devices = { + {"ITEtech USB2.0 DVB-T Receiver", + {&af903x_usb_id_table[0], + &af903x_usb_id_table[1], + &af903x_usb_id_table[2], + &af903x_usb_id_table[3], + &af903x_usb_id_table[4], + NULL}, + {NULL}, + }, {"Asus U3100MINI_PLUS/T/RC Receiver", + {&af903x_usb_id_table[5], + NULL}, + {NULL}, + }, {NULL}, + } + +}}; int af903x_device_count = ARRAY_SIZE(af903x_properties); diff --git a/src/af903x-drv.c b/src/af903x-drv.c index 86a7802..bd9084d 100644 --- a/src/af903x-drv.c +++ b/src/af903x-drv.c @@ -6,6 +6,7 @@ int dvb_usb_af903x_debug; module_param_named(debug,dvb_usb_af903x_debug, int, 0644); MODULE_PARM_DESC(debug, "set debugging level.(info=1,deb_fw=2,deb_fwdata=4,deb_data=8)" DVB_USB_DEBUG_STATUS); + struct usb_device *udevs; PDEVICE_CONTEXT PDC; @@ -37,6 +38,14 @@ static DWORD DRV_IrTblDownload(IN void * handle) filp->f_pos=0x00; fileSize = filp->f_op->read(filp,b_buf,sizeof(b_buf),&filp->f_pos); + //for(i=0; i<fileSize; i++) + //{ + // deb_data("\n Data %d",i); // + // deb_data("0x%x",b_buf[i]);// + // dwError = Af901xWriteReg(ucDemod2WireAddr, 0, MERC_IR_TABLE_BASE_ADDR + i, b_buf[i]); + // if (dwError) goto exit; + //} + dwError = Demodulator_loadIrTable((Demodulator*) &pdc->Demodulator, (Word)fileSize, b_buf); if (dwError) {printk("Demodulator_loadIrTable fail"); goto exit;} @@ -81,9 +90,10 @@ static DWORD DRV_SetFreqBw( ) { DWORD dwError = Error_NO_ERROR; + PDEVICE_CONTEXT pdc = (PDEVICE_CONTEXT)handle; - Bool bLock = true; + Bool bLock = true; deb_data("- Enter %s Function -\n ",__FUNCTION__); deb_data(" ucSlaveDemod = %d, Freq= %d, BW=%d\n", (int) ucSlaveDemod, (int) dwFreq, (int) ucBw); @@ -549,7 +559,7 @@ static DWORD DRV_GetEEPROMConfig( cnt = 1; } - for(; ucSlaveDemod < cnt; ucSlaveDemod++) + for(ucSlaveDemod; ucSlaveDemod < cnt; ucSlaveDemod++) { deb_data("ucSlaveDemod: %d \n",cnt); dwError = DRV_GetEEPROMConfig2(pdc, ucSlaveDemod); @@ -1404,7 +1414,7 @@ DWORD Device_init(struct usb_device *udev,PDEVICE_CONTEXT PDCs, Bool bBoot) PDC->Demodulator.userData = (Handle)PDC; PDC->Demodulator.chipNumber = 1; PDC->architecture=Architecture_DCA; - PDC->Demodulator.frequency[0] = 546000; + PDC->Demodulator.frequency[0] = 834000; PDC->Demodulator.bandwidth[0] = 8000; PDC->bIrTblDownload = false; PDC->fc[0].tunerinfo.TunerId = 0; diff --git a/src/af903x-fe.c b/src/af903x-fe.c index aee8948..d8876ab 100644 --- a/src/af903x-fe.c +++ b/src/af903x-fe.c @@ -3,7 +3,7 @@ struct af903xm_state { struct dvb_frontend demod; - fe_bandwidth_t current_bandwidth; + u32 current_bandwidth; }; static int af903x_init(struct dvb_frontend *demod) @@ -16,7 +16,7 @@ static int af903x_init(struct dvb_frontend *demod) deb_data("af903x_init return error\n"); return error; } - + return 0; } @@ -42,32 +42,32 @@ static int af903x_identify(struct af903xm_state *state) return 0; } -static int af903x_get_frontend(struct dvb_frontend* fe, - struct dvb_frontend_parameters *fep) +static int af903x_get_frontend(struct dvb_frontend* fe) { + struct dtv_frontend_properties *fep = &fe->dtv_property_cache; struct af903xm_state *state = fe->demodulator_priv; deb_data("- Enter %s Function - chip=%d\n",__FUNCTION__, fe->dvb->num); fep->inversion = INVERSION_AUTO; - fep->u.ofdm.bandwidth = state->current_bandwidth; + fep->bandwidth_hz = state->current_bandwidth; return 0; } -static int af903x_set_frontend(struct dvb_frontend* fe, - struct dvb_frontend_parameters *fep) +static int af903x_set_frontend(struct dvb_frontend* fe) { + struct dtv_frontend_properties *fep = &fe->dtv_property_cache; struct af903xm_state *state = fe->demodulator_priv; struct af903x_ofdm_channel ch; DWORD error = Error_NO_ERROR; - - deb_data("- Enter %s Function - chip=%d\n",__FUNCTION__, fe->dvb->num); - if (fep->u.ofdm.bandwidth == 0) fep->u.ofdm.bandwidth=8; - if (fep->u.ofdm.bandwidth == 1) fep->u.ofdm.bandwidth=7; - if (fep->u.ofdm.bandwidth == 2) fep->u.ofdm.bandwidth=6; + deb_data("- Enter %s Function - chip=%d delsys=%d BW=%d\n",__FUNCTION__, fe->dvb->num, fe->dtv_property_cache.delivery_system,fep->bandwidth_hz); + //fep->bandwidth_hz=8; + if (fep->bandwidth_hz == 0) fep->bandwidth_hz=8; + if (fep->bandwidth_hz == 1) fep->bandwidth_hz=7; + if (fep->bandwidth_hz == 2) fep->bandwidth_hz=6; ch.RF_kHz = fep->frequency / 1000; - ch.Bw = fep->u.ofdm.bandwidth; + ch.Bw = fep->bandwidth_hz; - state->current_bandwidth = fep->u.ofdm.bandwidth; + state->current_bandwidth = fep->bandwidth_hz; deb_data("- Enter %s Function - chip=%d RF=%d, BW=%d\n",__FUNCTION__, fe->dvb->num,ch.RF_kHz,ch.Bw); @@ -130,12 +130,14 @@ static int af903x_read_ber(struct dvb_frontend *fe, u32 *ber) static int af903x_read_snr(struct dvb_frontend* fe, u16 *snr) { +// (void) fe; +// *snr = 0x0000; + //struct af903xm_state *state = fe->demodulator_priv; + DWORD error = Error_NO_ERROR; Constellation constellation; BYTE SignalSnr = 0; - *snr = 0; - error = DL_getSNR(fe->dvb->num, &constellation, &SignalSnr); if(error) return error; @@ -165,6 +167,8 @@ static int af903x_read_unc_blocks(struct dvb_frontend *fe, u32 *unc) } static int af903x_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { +// struct af903xm_state *state = fe->demodulator_priv; + DWORD error = Error_NO_ERROR; BYTE SignalStrength = 0; @@ -200,7 +204,7 @@ struct dvb_frontend * af903x_attach(u8 tmp) struct dvb_frontend *demod; struct af903xm_state *st; - deb_data("- Enter %s Function -\n",__FUNCTION__); + deb_data("- Enter %s Function -\n",__FUNCTION__); st = kzalloc(sizeof(struct af903xm_state), GFP_KERNEL); if (st == NULL) return NULL; @@ -208,7 +212,6 @@ struct dvb_frontend * af903x_attach(u8 tmp) demod = &st->demod; demod->demodulator_priv = st; memcpy(&st->demod.ops, &af903x_ops, sizeof(struct dvb_frontend_ops)); - af903x_identify(st); return demod; @@ -216,6 +219,7 @@ struct dvb_frontend * af903x_attach(u8 tmp) EXPORT_SYMBOL(af903x_attach); static struct dvb_frontend_ops af903x_ops = { + .delsys = { SYS_DVBT }, .info = { .name = "AF903X USB DVB-T", .type = FE_OFDM, diff --git a/src/af903x-tuner.c b/src/af903x-tuner.c index c45f1ae..1e9c562 100644 --- a/src/af903x-tuner.c +++ b/src/af903x-tuner.c @@ -11,13 +11,14 @@ -static int tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +static int tuner_set_params(struct dvb_frontend *fe) { + struct dtv_frontend_properties *params = &fe->dtv_property_cache; struct tuner_priv *priv=NULL; DWORD dwError = Error_NO_ERROR; DWORD freq = params->frequency ;// 1000; // Hz -> kHz - priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; + priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->bandwidth_hz : 0; deb_data("%s - freq : %d , bandwidth : %dn",__FUNCTION__, (int) freq,priv->bandwidth); diff --git a/src/af903x.h b/src/af903x.h index 5c3b9ad..0d676ab 100644 --- a/src/af903x.h +++ b/src/af903x.h @@ -15,25 +15,17 @@ #include "af903x-ioctl.h" #include "demodulator.h" #include "userdef.h" +//#include "firmware.h" #include "type.h" #include "Common.h" #include <linux/version.h> #include <linux/mutex.h> -#define DRIVER_RELEASE_VERSION "v9.08.14.1" +#define DRIVER_RELEASE_VERSION "v9.08.14.3" //***************** customization ***************** //#define QuantaMID 1 //#define EEEPC 1 -//***************** from compat.h ***************** -#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18) -typedef int bool; -#define true 1 -#define false 0 -//***************** from dvb-usb.h ***************** -#define dvb_usb_device_properties dvb_usb_properties -#define dvb_usb_adapter dvb_usb_device -#endif //***************** from device.h *****************// #define AFA_USB_DEVICE |