Support for Magic-Pro DMB-TH usb stick
PATCH 1/1 Support for Magic-Pro DMB-TH usb stick
Dear all,
Attached is a patch against v4l-dvb repository to add support for Magic-Pro DMB-TH usb stick. DMB-TH is the HDTV broadcast standard used in Hong Kong and China.
Regards,
Timothy Lee
linux/drivers/media/dvb/dvb-usb/cxusb.c +284 -0
@@ -36,6 +36,7 @@#include "tuner-xc2028.h" #include "tuner-simple.h" #include "mxl5005s.h" +#include "lgs8gl5.h" /* debug */ static int dvb_usb_cxusb_debug;
@@ -107,6 +108,24 @@ static void cxusb_nano2_led(struct dvb_ustatic void cxusb_nano2_led (struct dvb_usb_device *d,int onoff) {cxusb_bluebird_gpio_rw (d,0x40 , onoff ?0 :0x40 ); +} + +static int cxusb_d680_dmb_gpio_tuner (struct dvb_usb_device *d, +u8 addr,int onoff) +{ +u8 o[2 ] = {addr, onoff}; +u8 i; +int rc; + + rc =cxusb_ctrl_msg (d,CMD_GPIO_WRITE , o,2 , &i,1 ); + +if (rc <0 )return rc; +if (i ==0x01 )return 0 ; +else + { +deb_info ("gpio_write failed.\n" ); +return -EIO ; + } }/* I2C */
@@ -262,6 +281,19 @@ static int cxusb_nano2_power_ctrl(structreturn rc; } +static int cxusb_d680_dmb_power_ctrl (struct dvb_usb_device *d,int onoff) +{ +int ret; +u8 b; + ret =cxusb_power_ctrl (d, onoff); +if (!onoff)return ret; + +msleep (128 ); +cxusb_ctrl_msg (d,CMD_DIGITAL ,NULL ,0 , &b,1 ); +msleep (100 ); +return ret; +} +static int cxusb_streaming_ctrl (struct dvb_usb_adapter *adap,int onoff) {u8 buf[2 ] = {0x03 ,0x00 };
@@ -283,6 +315,65 @@ static int cxusb_aver_streaming_ctrl(strreturn 0 ; } +static void cxusb_d680_dmb_drain_message (struct dvb_usb_device *d) +{ +int ep = d->props.generic_bulk_ctrl_endpoint; +const int timeout =100 ; +const int junk_len =32 ; +u8 * junk; +int rd_count; + +// Discard remaining data in video pipe + junk =kmalloc (junk_len,GFP_KERNEL ); +if (!junk)return ; +while (1 ) + { +if (usb_bulk_msg (d->udev, +usb_rcvbulkpipe (d->udev, ep), + junk, junk_len, &rd_count, timeout) <0 ) +break ; +if (!rd_count)break ; + } +kfree (junk); +} + +static void cxusb_d680_dmb_drain_video (struct dvb_usb_device *d) +{ +struct usb_data_stream_properties * p = &d->props.adapter[0 ].stream; +const int timeout =100 ; +const int junk_len = p->u.bulk.buffersize; +u8 * junk; +int rd_count; + +// Discard remaining data in video pipe + junk =kmalloc (junk_len,GFP_KERNEL ); +if (!junk)return ; +while (1 ) + { +if (usb_bulk_msg (d->udev, +usb_rcvbulkpipe (d->udev, p->endpoint), + junk, junk_len, &rd_count, timeout) <0 ) +break ; +if (!rd_count)break ; + } +kfree (junk); +} + +static int cxusb_d680_dmb_streaming_ctrl (struct dvb_usb_adapter *adap,int onoff) +{ +if (onoff) { +u8 buf[2 ] = {0x03 ,0x00 }; +cxusb_d680_dmb_drain_video (adap->dev); +return cxusb_ctrl_msg (adap->dev,CMD_STREAMING_ON , + buf,sizeof (buf),NULL ,0 ); + } +else { +int ret =cxusb_ctrl_msg (adap->dev, +CMD_STREAMING_OFF ,NULL ,0 ,NULL ,0 ); +return ret; + } +} +static int cxusb_rc_query (struct dvb_usb_device *d,u32 *event,int *state) {struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
@@ -325,6 +416,32 @@ static int cxusb_bluebird2_rc_query(strufor (i =0 ; i < d->props.rc_key_map_size; i++) {if (keymap[i].custom == ircode[1 ] && keymap[i].data == ircode[2 ]) { + *event = keymap[i].event; + *state =REMOTE_KEY_PRESSED ; + +return 0 ; + } + } + +return 0 ; +} + +static int cxusb_d680_dmb_rc_query (struct dvb_usb_device *d,u32 *event, +int *state) +{ +struct dvb_usb_rc_key *keymap = d->props.rc_key_map; +u8 ircode[2 ]; +int i; + + *event =0 ; + *state =REMOTE_NO_KEY_PRESSED ; + +if (cxusb_ctrl_msg (d,0x10 ,NULL ,0 , ircode,2 ) <0 ) +return 0 ; + +for (i =0 ; i < d->props.rc_key_map_size; i++) { +if (keymap[i].custom == ircode[0 ] && + keymap[i].data == ircode[1 ]) { *event = keymap[i].event; *state =REMOTE_KEY_PRESSED ;
@@ -422,6 +539,44 @@ static struct dvb_usb_rc_key dvico_porta { 0xfc, 0x00, KEY_UNKNOWN }, /* HD */ }; +static struct dvb_usb_rc_key d680_dmb_rc_keys[] = { + {0x00 ,0x38 ,KEY_UNKNOWN },/* TV/AV */ + {0x08 ,0x0c ,KEY_ZOOM }, + {0x08 ,0x00 ,KEY_0 }, + {0x00 ,0x01 ,KEY_1 }, + {0x08 ,0x02 ,KEY_2 }, + {0x00 ,0x03 ,KEY_3 }, + {0x08 ,0x04 ,KEY_4 }, + {0x00 ,0x05 ,KEY_5 }, + {0x08 ,0x06 ,KEY_6 }, + {0x00 ,0x07 ,KEY_7 }, + {0x08 ,0x08 ,KEY_8 }, + {0x00 ,0x09 ,KEY_9 }, + {0x00 ,0x0a ,KEY_MUTE }, + {0x08 ,0x29 ,KEY_BACK }, + {0x00 ,0x12 ,KEY_CHANNELUP }, + {0x08 ,0x13 ,KEY_CHANNELDOWN }, + {0x00 ,0x2b ,KEY_VOLUMEUP }, + {0x08 ,0x2c ,KEY_VOLUMEDOWN }, + {0x00 ,0x20 ,KEY_UP }, + {0x08 ,0x21 ,KEY_DOWN }, + {0x00 ,0x11 ,KEY_LEFT }, + {0x08 ,0x10 ,KEY_RIGHT }, + {0x00 ,0x0d ,KEY_OK }, + {0x08 ,0x1f ,KEY_RECORD }, + {0x00 ,0x17 ,KEY_PLAYPAUSE }, + {0x08 ,0x16 ,KEY_PLAYPAUSE }, + {0x00 ,0x0b ,KEY_STOP }, + {0x08 ,0x27 ,KEY_FASTFORWARD }, + {0x00 ,0x26 ,KEY_REWIND }, + {0x08 ,0x1e ,KEY_UNKNOWN },/* Time Shift */ + {0x00 ,0x0e ,KEY_UNKNOWN },/* Snapshot */ + {0x08 ,0x2d ,KEY_UNKNOWN },/* Mouse Cursor */ + {0x00 ,0x0f ,KEY_UNKNOWN },/* Minimize/Maximize */ + {0x08 ,0x14 ,KEY_UNKNOWN },/* Shuffle */ + {0x00 ,0x25 ,KEY_POWER }, +}; +static int cxusb_dee1601_demod_init (struct dvb_frontend * fe) {static u8 clock_config [] = {CLOCK_CTL ,0x38 ,0x28 };
@@ -527,6 +682,24 @@ static struct mxl5005s_config aver_a868r .AgcMasterByte = 0x00, }; +/* FIXME: needs tweaking */ +static struct mxl5005s_config d680_dmb_tuner = { + .i2c_address =0x63 , + .if_freq =36125000UL , + .xtal_freq =CRYSTAL_FREQ_16000000HZ , + .agc_mode =MXL_SINGLE_AGC , + .tracking_filter =MXL_TF_C , + .rssi_enable =MXL_RSSI_ENABLE , + .cap_select =MXL_CAP_SEL_ENABLE , + .div_out =MXL_DIV_OUT_4 , + .clock_out =MXL_CLOCK_OUT_DISABLE , + .output_load =MXL5005S_IF_OUTPUT_LOAD_200_OHM , + .top =MXL5005S_TOP_25P2 , + .mod_mode =MXL_DIGITAL_MODE , + .if_mode =MXL_ZERO_IF , + .AgcMasterByte =0x00 , +}; +/* Callbacks for DVB USB */ static int cxusb_fmd1216me_tuner_attach (struct dvb_usb_adapter *adap) {
@@ -613,6 +786,14 @@ static int cxusb_mxl5003s_tuner_attach(sdvb_attach (mxl5005s_attach, adap->fe, &adap->dev->i2c_adap, &aver_a868r_tuner);return 0 ; +} + +static int cxusb_d680_dmb_tuner_attach (struct dvb_usb_adapter *adap) +{ +struct dvb_frontend * fe; + fe =dvb_attach (mxl5005s_attach, adap->fe, + &adap->dev->i2c_adap, &d680_dmb_tuner); +return (fe ==NULL ) ? -EIO :0 ; }static int cxusb_cx22702_frontend_attach (struct dvb_usb_adapter *adap)
@@ -751,6 +932,57 @@ static int cxusb_nano2_frontend_attach(sreturn -EIO ; } +static struct lgs8gl5_config lgs8gl5_cfg = { + .demod_address =0x19 , +}; + +static int cxusb_d680_dmb_frontend_attach (struct dvb_usb_adapter *adap) +{ +struct dvb_usb_device * d = adap->dev; +int n; + +/* Select required USB configuration */ +if (usb_set_interface (d->udev,0 ,0 ) <0 ) +err ("set interface failed" ); + +/* Unblock all USB pipes */ +usb_clear_halt (d->udev, +usb_sndbulkpipe (d->udev, d->props.generic_bulk_ctrl_endpoint)); +usb_clear_halt (d->udev, +usb_rcvbulkpipe (d->udev, d->props.generic_bulk_ctrl_endpoint)); +usb_clear_halt (d->udev, +usb_rcvbulkpipe (d->udev, d->props.adapter[0 ].stream.endpoint)); + +/* Drain USB pipes to avoid hang after reboot */ +for (n =0 ; n <5 ; n++) + { +cxusb_d680_dmb_drain_message (d); +cxusb_d680_dmb_drain_video (d); +msleep (200 ); + } + +/* Reset the tuner */ +if (cxusb_d680_dmb_gpio_tuner (d,0x07 ,0 ) <0 ) + { +err ("clear tuner gpio failed" ); +return -EIO ; + } +msleep (100 ); +if (cxusb_d680_dmb_gpio_tuner (d,0x07 ,1 ) <0 ) + { +err ("set tuner gpio failed" ); +return -EIO ; + } +msleep (100 ); + +/* Attach frontend */ +if ((adap->fe =dvb_attach (lgs8gl5_attach, &lgs8gl5_cfg, + &d->i2c_adap)) !=NULL ) +return 0 ; + +return -EIO ; +} +/* * DViCO has shipped two devices with the same USB ID, but only one of them * needs a firmware download. Check the device class details to see if they
@@ -829,6 +1061,7 @@ static struct dvb_usb_device_propertiesstatic struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;static struct dvb_usb_device_properties cxusb_aver_a868r_properties; +static struct dvb_usb_device_properties cxusb_d680_dmb_properties;static int cxusb_probe (struct usb_interface *intf,const struct usb_device_id *id)
@@ -852,6 +1085,8 @@ static int cxusb_probe(struct usb_interf THIS_MODULE, NULL, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, + THIS_MODULE, NULL, adapter_nr) || 0)return 0 ;
@@ -876,6 +1111,7 @@ static struct usb_device_id cxusb_table { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) }, { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) }, { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, + { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) }, {} /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, cxusb_table);
@@ -1321,6 +1557,54 @@ static struct dvb_usb_device_properties } }; +static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { + .caps =DVB_USB_IS_AN_I2C_ADAPTER , + + .usb_ctrl =CYPRESS_FX2 , + + .size_of_priv =sizeof (struct cxusb_state ), + + .num_adapters =1 , + .adapter = { + { + .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl, + .frontend_attach = cxusb_d680_dmb_frontend_attach, + .tuner_attach = cxusb_d680_dmb_tuner_attach, + +/* parameter for the MPEG2-data transfer */ + .stream = { + .type =USB_BULK , + .count =5 , + .endpoint =0x02 , + .u = { + .bulk = { + .buffersize =8192 , + } + } + }, + }, + }, + + .power_ctrl = cxusb_d680_dmb_power_ctrl, + + .i2c_algo = &cxusb_i2c_algo, + + .generic_bulk_ctrl_endpoint =0x01 , + + .rc_interval =100 , + .rc_key_map = d680_dmb_rc_keys, + .rc_key_map_size =ARRAY_SIZE (d680_dmb_rc_keys), + .rc_query = cxusb_d680_dmb_rc_query, + + .num_device_descs =1 , + .devices = { + {"Conexant DMB-TH Stick" , + {NULL }, + { &cxusb_table[17 ],NULL }, + }, + } +}; +static struct usb_driver cxusb_driver = { .name ="dvb_usb_cxusb" , .probe = cxusb_probe,
linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +2 -0
@@ -22,6 +22,7 @@#define USB_VID_AVERMEDIA 0x07ca#define USB_VID_COMPRO 0x185b#define USB_VID_COMPRO_UNK 0x145f +#define USB_VID_CONEXANT 0x0572#define USB_VID_CYPRESS 0x04b4#define USB_VID_DIBCOM 0x10b8#define USB_VID_DPOSH 0x1498
@@ -69,6 +70,7 @@#define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d#define USB_PID_COMPRO_VIDEOMATE_U500 0x1e78#define USB_PID_COMPRO_VIDEOMATE_U500_PC 0x1e80 +#define USB_PID_CONEXANT_D680_DMB 0x86d6#define USB_PID_DIBCOM_HOOK_DEFAULT 0x0064#define USB_PID_DIBCOM_HOOK_DEFAULT_REENUM 0x0065#define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8
linux/drivers/media/dvb/frontends/Kconfig +7 -0
@@ -385,4 +385,11 @@ config DVB_ISL6421 help An SEC control chip. +config DVB_LGS8GL5 + tristate "Silicon Legend LGS-8GL5 demodulator (OFDM)" + depends on DVB_CORE && I2C + default m if DVB_FE_CUSTOMISE + help + A DMB-TH tuner module. Say Y when you want to support this frontend. + endmenu
linux/drivers/media/dvb/frontends/Makefile +1 -0
@@ -48,3 +48,4 @@ obj-$(CONFIG_DVB_AU8522) += au8522.o obj-$(CONFIG_DVB_AU8522) += au8522.o obj-$(CONFIG_DVB_TDA10048) += tda10048.o obj-$(CONFIG_DVB_S5H1411) += s5h1411.o +obj-$(CONFIG_DVB_LGS8GL5) += lgs8gl5.o
linux/drivers/media/dvb/frontends/lgs8gl5.c new file +472 -0
472 lines not on this page · raw message
linux/drivers/media/dvb/frontends/lgs8gl5.h new file +46 -0
46 lines not on this page · raw message
_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
Quoted 8 lines · Timothy Lee
Dear all,
Attached is a patch against v4l-dvb repository to add support for Magic-Pro DMB-TH usb stick. DMB-TH is the HDTV broadcast standard used in Hong Kong and China.
Regards,
Timothy Lee
Timothy,
In order for your patch to be applied to the kernel, a sign-off is required.
Please respond to this email with your sign-off, as described here:
http://linuxtv.org/hg/v4l-dvb/file/tip/README.patches
e) All patches shall have a Developers Certificate of Origin
Also, what software can people use with your device & driver to tune to DMB-TH services?
How do users scan for services?
Regards,
Mike
_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
hermann pitton
Acked-byHi,
Am Freitag, den 08.08.2008, 08:47 -0400 schrieb Michael Krufky:
Quoted 21 lines
Quoted 8 lines · Timothy Lee
Dear all,
Attached is a patch against v4l-dvb repository to add support for Magic-Pro DMB-TH usb stick. DMB-TH is the HDTV broadcast standard used in Hong Kong and China.
Regards,
Timothy LeeTimothy,
In order for your patch to be applied to the kernel, a sign-off is required.
Please respond to this email with your sign-off, as described here:
http://linuxtv.org/hg/v4l-dvb/file/tip/README.patches
e) All patches shall have a Developers Certificate of Origin
Quoted 8 lines
Also, what software can people use with your device & driver to tune to DMB-TH services?
How do users scan for services?
Regards,
Mike
I can't see anything against the rules on it, except the yet missing sign-off.
Cheers,
Hermann
_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
Quoted 16 lines · Michael Krufky
Quoted 7 lines · Timothy Lee
Attached is a patch against v4l-dvb repository to add support for Magic-Pro DMB-TH usb stick. DMB-TH is the HDTV broadcast standard used in Hong Kong and China.
Regards,
Timothy LeeTimothy,
In order for your patch to be applied to the kernel, a sign-off is required.
Please respond to this email with your sign-off, as described here:
Quoted 9 lines
http://linuxtv.org/hg/v4l-dvb/file/tip/README.patches
e) All patches shall have a Developers Certificate of Origin
Also, what software can people use with your device & driver to tune to DMB-TH services?
How do users scan for services?
Dear Michael,
Thanks for your hint on getting the patch accepted. I've now cleaned up the patch to pass checkpatch.pl, and signed it off.
I've also attached a second patch against the dvb-apps repository which adds a DMB-TH scan file for Hong Kong. Since the ProHDTV stick contains a DMB-TH decoder (lgs8gl5) onboard, it outputs MPEG-TS to the PC.
I've been using mplayer to test the driver. But since I'm using dvb-usb's generic video streaming mechanism, I imagine the driver should be compatible with other DVB software.
Regards,
Timothy
linux/drivers/media/dvb/dvb-usb/cxusb.c +286 -0
@@ -36,6 +36,7 @@#include "tuner-xc2028.h" #include "tuner-simple.h" #include "mxl5005s.h" +#include "lgs8gl5.h" /* debug */ static int dvb_usb_cxusb_debug;
@@ -107,6 +108,25 @@ static void cxusb_nano2_led(struct dvb_ustatic void cxusb_nano2_led (struct dvb_usb_device *d,int onoff) {cxusb_bluebird_gpio_rw (d,0x40 , onoff ?0 :0x40 ); +} + +static int cxusb_d680_dmb_gpio_tuner (struct dvb_usb_device *d, +u8 addr,int onoff) +{ +u8 o[2 ] = {addr, onoff}; +u8 i; +int rc; + + rc =cxusb_ctrl_msg (d,CMD_GPIO_WRITE , o,2 , &i,1 ); + +if (rc <0 ) +return rc; +if (i ==0x01 ) +return 0 ; +else { +deb_info ("gpio_write failed.\n" ); +return -EIO ; + } }/* I2C */
@@ -262,6 +282,20 @@ static int cxusb_nano2_power_ctrl(structreturn rc; } +static int cxusb_d680_dmb_power_ctrl (struct dvb_usb_device *d,int onoff) +{ +int ret; +u8 b; + ret =cxusb_power_ctrl (d, onoff); +if (!onoff) +return ret; + +msleep (128 ); +cxusb_ctrl_msg (d,CMD_DIGITAL ,NULL ,0 , &b,1 ); +msleep (100 ); +return ret; +} +static int cxusb_streaming_ctrl (struct dvb_usb_adapter *adap,int onoff) {u8 buf[2 ] = {0x03 ,0x00 };
@@ -283,6 +317,67 @@ static int cxusb_aver_streaming_ctrl(strreturn 0 ; } +static void cxusb_d680_dmb_drain_message (struct dvb_usb_device *d) +{ +int ep = d->props.generic_bulk_ctrl_endpoint; +const int timeout =100 ; +const int junk_len =32 ; +u8 *junk; +int rd_count; + +/* Discard remaining data in video pipe */ + junk =kmalloc (junk_len,GFP_KERNEL ); +if (!junk) +return ; +while (1 ) { +if (usb_bulk_msg (d->udev, +usb_rcvbulkpipe (d->udev, ep), + junk, junk_len, &rd_count, timeout) <0 ) +break ; +if (!rd_count) +break ; + } +kfree (junk); +} + +static void cxusb_d680_dmb_drain_video (struct dvb_usb_device *d) +{ +struct usb_data_stream_properties *p = &d->props.adapter[0 ].stream; +const int timeout =100 ; +const int junk_len = p->u.bulk.buffersize; +u8 *junk; +int rd_count; + +/* Discard remaining data in video pipe */ + junk =kmalloc (junk_len,GFP_KERNEL ); +if (!junk) +return ; +while (1 ) { +if (usb_bulk_msg (d->udev, +usb_rcvbulkpipe (d->udev, p->endpoint), + junk, junk_len, &rd_count, timeout) <0 ) +break ; +if (!rd_count) +break ; + } +kfree (junk); +} + +static int cxusb_d680_dmb_streaming_ctrl ( +struct dvb_usb_adapter *adap,int onoff) +{ +if (onoff) { +u8 buf[2 ] = {0x03 ,0x00 }; +cxusb_d680_dmb_drain_video (adap->dev); +return cxusb_ctrl_msg (adap->dev,CMD_STREAMING_ON , + buf,sizeof (buf),NULL ,0 ); + }else { +int ret =cxusb_ctrl_msg (adap->dev, +CMD_STREAMING_OFF ,NULL ,0 ,NULL ,0 ); +return ret; + } +} +static int cxusb_rc_query (struct dvb_usb_device *d,u32 *event,int *state) {struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
@@ -325,6 +420,32 @@ static int cxusb_bluebird2_rc_query(strufor (i =0 ; i < d->props.rc_key_map_size; i++) {if (keymap[i].custom == ircode[1 ] && keymap[i].data == ircode[2 ]) { + *event = keymap[i].event; + *state =REMOTE_KEY_PRESSED ; + +return 0 ; + } + } + +return 0 ; +} + +static int cxusb_d680_dmb_rc_query (struct dvb_usb_device *d,u32 *event, +int *state) +{ +struct dvb_usb_rc_key *keymap = d->props.rc_key_map; +u8 ircode[2 ]; +int i; + + *event =0 ; + *state =REMOTE_NO_KEY_PRESSED ; + +if (cxusb_ctrl_msg (d,0x10 ,NULL ,0 , ircode,2 ) <0 ) +return 0 ; + +for (i =0 ; i < d->props.rc_key_map_size; i++) { +if (keymap[i].custom == ircode[0 ] && + keymap[i].data == ircode[1 ]) { *event = keymap[i].event; *state =REMOTE_KEY_PRESSED ;
@@ -422,6 +543,44 @@ static struct dvb_usb_rc_key dvico_porta { 0xfc, 0x00, KEY_UNKNOWN }, /* HD */ }; +static struct dvb_usb_rc_key d680_dmb_rc_keys[] = { + {0x00 ,0x38 ,KEY_UNKNOWN },/* TV/AV */ + {0x08 ,0x0c ,KEY_ZOOM }, + {0x08 ,0x00 ,KEY_0 }, + {0x00 ,0x01 ,KEY_1 }, + {0x08 ,0x02 ,KEY_2 }, + {0x00 ,0x03 ,KEY_3 }, + {0x08 ,0x04 ,KEY_4 }, + {0x00 ,0x05 ,KEY_5 }, + {0x08 ,0x06 ,KEY_6 }, + {0x00 ,0x07 ,KEY_7 }, + {0x08 ,0x08 ,KEY_8 }, + {0x00 ,0x09 ,KEY_9 }, + {0x00 ,0x0a ,KEY_MUTE }, + {0x08 ,0x29 ,KEY_BACK }, + {0x00 ,0x12 ,KEY_CHANNELUP }, + {0x08 ,0x13 ,KEY_CHANNELDOWN }, + {0x00 ,0x2b ,KEY_VOLUMEUP }, + {0x08 ,0x2c ,KEY_VOLUMEDOWN }, + {0x00 ,0x20 ,KEY_UP }, + {0x08 ,0x21 ,KEY_DOWN }, + {0x00 ,0x11 ,KEY_LEFT }, + {0x08 ,0x10 ,KEY_RIGHT }, + {0x00 ,0x0d ,KEY_OK }, + {0x08 ,0x1f ,KEY_RECORD }, + {0x00 ,0x17 ,KEY_PLAYPAUSE }, + {0x08 ,0x16 ,KEY_PLAYPAUSE }, + {0x00 ,0x0b ,KEY_STOP }, + {0x08 ,0x27 ,KEY_FASTFORWARD }, + {0x00 ,0x26 ,KEY_REWIND }, + {0x08 ,0x1e ,KEY_UNKNOWN },/* Time Shift */ + {0x00 ,0x0e ,KEY_UNKNOWN },/* Snapshot */ + {0x08 ,0x2d ,KEY_UNKNOWN },/* Mouse Cursor */ + {0x00 ,0x0f ,KEY_UNKNOWN },/* Minimize/Maximize */ + {0x08 ,0x14 ,KEY_UNKNOWN },/* Shuffle */ + {0x00 ,0x25 ,KEY_POWER }, +}; +static int cxusb_dee1601_demod_init (struct dvb_frontend * fe) {static u8 clock_config [] = {CLOCK_CTL ,0x38 ,0x28 };
@@ -527,6 +686,24 @@ static struct mxl5005s_config aver_a868r .AgcMasterByte = 0x00, }; +/* FIXME: needs tweaking */ +static struct mxl5005s_config d680_dmb_tuner = { + .i2c_address =0x63 , + .if_freq =36125000UL , + .xtal_freq =CRYSTAL_FREQ_16000000HZ , + .agc_mode =MXL_SINGLE_AGC , + .tracking_filter =MXL_TF_C , + .rssi_enable =MXL_RSSI_ENABLE , + .cap_select =MXL_CAP_SEL_ENABLE , + .div_out =MXL_DIV_OUT_4 , + .clock_out =MXL_CLOCK_OUT_DISABLE , + .output_load =MXL5005S_IF_OUTPUT_LOAD_200_OHM , + .top =MXL5005S_TOP_25P2 , + .mod_mode =MXL_DIGITAL_MODE , + .if_mode =MXL_ZERO_IF , + .AgcMasterByte =0x00 , +}; +/* Callbacks for DVB USB */ static int cxusb_fmd1216me_tuner_attach (struct dvb_usb_adapter *adap) {
@@ -613,6 +790,14 @@ static int cxusb_mxl5003s_tuner_attach(sdvb_attach (mxl5005s_attach, adap->fe, &adap->dev->i2c_adap, &aver_a868r_tuner);return 0 ; +} + +static int cxusb_d680_dmb_tuner_attach (struct dvb_usb_adapter *adap) +{ +struct dvb_frontend *fe; + fe =dvb_attach (mxl5005s_attach, adap->fe, + &adap->dev->i2c_adap, &d680_dmb_tuner); +return (fe ==NULL ) ? -EIO :0 ; }static int cxusb_cx22702_frontend_attach (struct dvb_usb_adapter *adap)
@@ -751,6 +936,54 @@ static int cxusb_nano2_frontend_attach(sreturn -EIO ; } +static struct lgs8gl5_config lgs8gl5_cfg = { + .demod_address =0x19 , +}; + +static int cxusb_d680_dmb_frontend_attach (struct dvb_usb_adapter *adap) +{ +struct dvb_usb_device *d = adap->dev; +int n; + +/* Select required USB configuration */ +if (usb_set_interface (d->udev,0 ,0 ) <0 ) +err ("set interface failed" ); + +/* Unblock all USB pipes */ +usb_clear_halt (d->udev, +usb_sndbulkpipe (d->udev, d->props.generic_bulk_ctrl_endpoint)); +usb_clear_halt (d->udev, +usb_rcvbulkpipe (d->udev, d->props.generic_bulk_ctrl_endpoint)); +usb_clear_halt (d->udev, +usb_rcvbulkpipe (d->udev, d->props.adapter[0 ].stream.endpoint)); + +/* Drain USB pipes to avoid hang after reboot */ +for (n =0 ; n <5 ; n++) { +cxusb_d680_dmb_drain_message (d); +cxusb_d680_dmb_drain_video (d); +msleep (200 ); + } + +/* Reset the tuner */ +if (cxusb_d680_dmb_gpio_tuner (d,0x07 ,0 ) <0 ) { +err ("clear tuner gpio failed" ); +return -EIO ; + } +msleep (100 ); +if (cxusb_d680_dmb_gpio_tuner (d,0x07 ,1 ) <0 ) { +err ("set tuner gpio failed" ); +return -EIO ; + } +msleep (100 ); + +/* Attach frontend */ + adap->fe =dvb_attach (lgs8gl5_attach, &lgs8gl5_cfg, &d->i2c_adap); +if (adap->fe ==NULL ) +return -EIO ; + +return 0 ; +} +/* * DViCO has shipped two devices with the same USB ID, but only one of them * needs a firmware download. Check the device class details to see if they
@@ -829,6 +1062,7 @@ static struct dvb_usb_device_propertiesstatic struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;static struct dvb_usb_device_properties cxusb_aver_a868r_properties; +static struct dvb_usb_device_properties cxusb_d680_dmb_properties;static int cxusb_probe (struct usb_interface *intf,const struct usb_device_id *id)
@@ -852,6 +1086,8 @@ static int cxusb_probe(struct usb_interf THIS_MODULE, NULL, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, + THIS_MODULE, NULL, adapter_nr) || 0)return 0 ;
@@ -876,6 +1112,7 @@ static struct usb_device_id cxusb_table { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) }, { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) }, { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, + { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) }, {} /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, cxusb_table);
@@ -1321,6 +1558,55 @@ static struct dvb_usb_device_properties } }; +static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { + .caps =DVB_USB_IS_AN_I2C_ADAPTER , + + .usb_ctrl =CYPRESS_FX2 , + + .size_of_priv =sizeof (struct cxusb_state ), + + .num_adapters =1 , + .adapter = { + { + .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl, + .frontend_attach = cxusb_d680_dmb_frontend_attach, + .tuner_attach = cxusb_d680_dmb_tuner_attach, + +/* parameter for the MPEG2-data transfer */ + .stream = { + .type =USB_BULK , + .count =5 , + .endpoint =0x02 , + .u = { + .bulk = { + .buffersize =8192 , + } + } + }, + }, + }, + + .power_ctrl = cxusb_d680_dmb_power_ctrl, + + .i2c_algo = &cxusb_i2c_algo, + + .generic_bulk_ctrl_endpoint =0x01 , + + .rc_interval =100 , + .rc_key_map = d680_dmb_rc_keys, + .rc_key_map_size =ARRAY_SIZE (d680_dmb_rc_keys), + .rc_query = cxusb_d680_dmb_rc_query, + + .num_device_descs =1 , + .devices = { + { +"Conexant DMB-TH Stick" , + {NULL }, + { &cxusb_table[17 ],NULL }, + }, + } +}; +static struct usb_driver cxusb_driver = { .name ="dvb_usb_cxusb" , .probe = cxusb_probe,
linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +2 -0
@@ -22,6 +22,7 @@#define USB_VID_AVERMEDIA 0x07ca#define USB_VID_COMPRO 0x185b#define USB_VID_COMPRO_UNK 0x145f +#define USB_VID_CONEXANT 0x0572#define USB_VID_CYPRESS 0x04b4#define USB_VID_DIBCOM 0x10b8#define USB_VID_DPOSH 0x1498
@@ -69,6 +70,7 @@#define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d#define USB_PID_COMPRO_VIDEOMATE_U500 0x1e78#define USB_PID_COMPRO_VIDEOMATE_U500_PC 0x1e80 +#define USB_PID_CONEXANT_D680_DMB 0x86d6#define USB_PID_DIBCOM_HOOK_DEFAULT 0x0064#define USB_PID_DIBCOM_HOOK_DEFAULT_REENUM 0x0065#define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8
linux/drivers/media/dvb/frontends/Kconfig +7 -0
@@ -385,4 +385,11 @@ config DVB_ISL6421 help An SEC control chip. +config DVB_LGS8GL5 + tristate "Silicon Legend LGS-8GL5 demodulator (OFDM)" + depends on DVB_CORE && I2C + default m if DVB_FE_CUSTOMISE + help + A DMB-TH tuner module. Say Y when you want to support this frontend. + endmenu
linux/drivers/media/dvb/frontends/Makefile +1 -0
@@ -48,3 +48,4 @@ obj-$(CONFIG_DVB_AU8522) += au8522.o obj-$(CONFIG_DVB_AU8522) += au8522.o obj-$(CONFIG_DVB_TDA10048) += tda10048.o obj-$(CONFIG_DVB_S5H1411) += s5h1411.o +obj-$(CONFIG_DVB_LGS8GL5) += lgs8gl5.o
linux/drivers/media/dvb/frontends/lgs8gl5.c new file +480 -0
480 lines not on this page · raw message
linux/drivers/media/dvb/frontends/lgs8gl5.h new file +45 -0
45 lines not on this page · raw message
util/scan/dmb-th/hk-HongKong new file +18 -0
@@ -0,0 +1,18 @@ +# Hong Kong +# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy + +# TVB (band 35) +T 586000000 8MHz AUTO AUTO QAM64 8k 1/32 NONE +# ATV (band 37) +T 602000000 8MHz AUTO AUTO QAM64 8k 1/32 NONE + +# Simulcast (band 22) +T 482000000 8MHz AUTO AUTO QAM64 8k 1/32 NONE +# Simulcast (band 30) +T 546000000 8MHz AUTO AUTO QAM64 8k 1/32 NONE +# Simulcast (band 32) +T 562000000 8MHz AUTO AUTO QAM64 8k 1/32 NONE +# Simulcast (band 40) +T 628000000 8MHz AUTO AUTO QAM64 8k 1/32 NONE +# Simulcast (band 43) +T 650000000 8MHz AUTO AUTO QAM64 8k 1/32 NONE
_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
Quoted 34 lines · Timothy Lee
Quoted 19 lines · Michael Krufky
Quoted 7 lines · Timothy Lee
Attached is a patch against v4l-dvb repository to add support for Magic-Pro DMB-TH usb stick. DMB-TH is the HDTV broadcast standard used in Hong Kong and China.
Regards,
Timothy LeeTimothy,
In order for your patch to be applied to the kernel, a sign-off is required.
Please respond to this email with your sign-off, as described here:
Quoted 8 lines
e) All patches shall have a Developers Certificate of Origin
Also, what software can people use with your device & driver to tune to DMB-TH services?
How do users scan for services?
Dear Michael,
Thanks for your hint on getting the patch accepted. I've now cleaned up the patch to pass checkpatch.pl, and signed it off.
Quoted 8 lines
I've also attached a second patch against the dvb-apps repository which adds a DMB-TH scan file for Hong Kong. Since the ProHDTV stick contains a DMB-TH decoder (lgs8gl5) onboard, it outputs MPEG-TS to the PC.
I've been using mplayer to test the driver. But since I'm using dvb-usb's generic video streaming mechanism, I imagine the driver should be compatible with other DVB software.
Timothy,
I've applied your patch to my cxusb tree, with slight modifications, in order to coincide with another patch to the same code. Please test the tree and confirm proper operation before I request a merge into the master branch.
http://linuxtv.org/hg/~mkrufky/cxusb
I'll push the Hong Kong scan file to dvb-apps after this tree is merged into the master branch.
If you have any additional fixes / changes to make before this is merged into master, please generate them against this cxusb tree.
Regards,
Mike
_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
Quoted 48 lines · Michael Krufky
Quoted 32 lines · Timothy Lee
Quoted 18 lines · Michael Krufky
Quoted 7 lines · Timothy Lee
Attached is a patch against v4l-dvb repository to add support for Magic-Pro DMB-TH usb stick. DMB-TH is the HDTV broadcast standard used in Hong Kong and China.
Regards,
Timothy LeeTimothy,
In order for your patch to be applied to the kernel, a sign-off is required.
Please respond to this email with your sign-off, as described here:
Quoted 8 lines
e) All patches shall have a Developers Certificate of Origin
Also, what software can people use with your device & driver to tune to DMB-TH services?
How do users scan for services?
Dear Michael,
Thanks for your hint on getting the patch accepted. I've now cleaned up the patch to pass checkpatch.pl, and signed it off.
Quoted 8 lines
I've also attached a second patch against the dvb-apps repository which adds a DMB-TH scan file for Hong Kong. Since the ProHDTV stick contains a DMB-TH decoder (lgs8gl5) onboard, it outputs MPEG-TS to the PC.
I've been using mplayer to test the driver. But since I'm using dvb-usb's generic video streaming mechanism, I imagine the driver should be compatible with other DVB software.
Timothy,
I've applied your patch to my cxusb tree, with slight modifications, in order to coincide with another patch to the same code. Please test the tree and confirm proper operation before I request a merge into the master branch.
Quoted 7 lines
http://linuxtv.org/hg/~mkrufky/cxusb
I'll push the Hong Kong scan file to dvb-apps after this tree is merged into the master branch.
If you have any additional fixes / changes to make before this is merged into master, please generate them against this cxusb tree.
I also have a question--
If the device is called, "Magic-Pro DMB-TH usb stick" then I think that we should change its name from "Conexant DMB-TH Stick" to "Magic-Pro DMB-TH usb stick"
Which is the correct name?
-Mike
_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
Quoted 65 lines · Michael Krufky
Quoted 54 lines · Michael Krufky
Quoted 36 lines · Timothy Lee
Quoted 20 lines · Michael Krufky
Quoted 8 lines · Timothy Lee
Attached is a patch against v4l-dvb repository to add support for Magic-Pro DMB-TH usb stick. DMB-TH is the HDTV broadcast standard used in Hong Kong and China.
Regards,
Timothy LeeTimothy,
In order for your patch to be applied to the kernel, a sign-off is required.
Please respond to this email with your sign-off, as described here:
Quoted 9 lines
e) All patches shall have a Developers Certificate of Origin
Also, what software can people use with your device& driver to tune to DMB-TH services?
How do users scan for services?
Dear Michael,
Thanks for your hint on getting the patch accepted. I've now cleaned up the patch to pass checkpatch.pl, and signed it off.
Quoted 9 lines
I've also attached a second patch against the dvb-apps repository which adds a DMB-TH scan file for Hong Kong. Since the ProHDTV stick contains a DMB-TH decoder (lgs8gl5) onboard, it outputs MPEG-TS to the PC.
I've been using mplayer to test the driver. But since I'm using dvb-usb's generic video streaming mechanism, I imagine the driver should be compatible with other DVB software.
Timothy,
I've applied your patch to my cxusb tree, with slight modifications, in order to coincide with another patch to the same code. Please test the tree and confirm proper operation before I request a merge into the master branch.
Quoted 8 lines
http://linuxtv.org/hg/~mkrufky/cxusb
I'll push the Hong Kong scan file to dvb-apps after this tree is merged into the master branch.
If you have any additional fixes / changes to make before this is merged into master, please generate them against this cxusb tree.
Quoted 9 lines
I also have a question--
If the device is called, "Magic-Pro DMB-TH usb stick" then I think that we should change its name from "Conexant DMB-TH Stick" to "Magic-Pro DMB-TH usb stick"
Which is the correct name?
-Mike
"Conexant..." is the name listed in the Windows INF file. The circuit board appears to be a reference design branded by at least two companies (MagicPro and Mygica) in Hong Kong.
Regards,
Timohty
_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
Quoted 54 lines · Michael Krufky
Quoted 36 lines · Timothy Lee
Quoted 20 lines · Michael Krufky
Quoted 8 lines · Timothy Lee
Attached is a patch against v4l-dvb repository to add support for Magic-Pro DMB-TH usb stick. DMB-TH is the HDTV broadcast standard used in Hong Kong and China.
Regards,
Timothy LeeTimothy,
In order for your patch to be applied to the kernel, a sign-off is required.
Please respond to this email with your sign-off, as described here:
Quoted 9 lines
e) All patches shall have a Developers Certificate of Origin
Also, what software can people use with your device& driver to tune to DMB-TH services?
How do users scan for services?
Dear Michael,
Thanks for your hint on getting the patch accepted. I've now cleaned up the patch to pass checkpatch.pl, and signed it off.
Quoted 9 lines
I've also attached a second patch against the dvb-apps repository which adds a DMB-TH scan file for Hong Kong. Since the ProHDTV stick contains a DMB-TH decoder (lgs8gl5) onboard, it outputs MPEG-TS to the PC.
I've been using mplayer to test the driver. But since I'm using dvb-usb's generic video streaming mechanism, I imagine the driver should be compatible with other DVB software.
Timothy,
I've applied your patch to my cxusb tree, with slight modifications, in order to coincide with another patch to the same code. Please test the tree and confirm proper operation before I request a merge into the master branch.
Quoted 8 lines
http://linuxtv.org/hg/~mkrufky/cxusb
I'll push the Hong Kong scan file to dvb-apps after this tree is merged into the master branch.
If you have any additional fixes / changes to make before this is merged into master, please generate them against this cxusb tree.
I've tested your cxusb tree, and the newly added code is working fine. Thanks!
Regards,
Timothy
_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
Hi Mike,
Am Sonntag 10 August 2008 19:58:34 schrieb Michael Krufky:
<snip>
Quoted 11 lines
Timothy,
I've applied your patch to my cxusb tree, with slight modifications, in order to coincide with another patch to the same code. Please test the tree and confirm proper operation before I request a merge into the master branch.
http://linuxtv.org/hg/~mkrufky/cxusb
I'll push the Hong Kong scan file to dvb-apps after this tree is merged into the master branch.
I didn't really follow the discussion (sorry), but I think if the device presents itself as a dvb-t device and is usable as a (pseudo-)dvb-t device (tune / scan / watch), the scan file should be in the dvb-t. And in this case please change "fec_lo" to "NONE" when you're committing.
Quoted 6 lines
If you have any additional fixes / changes to make before this is merged into master, please generate them against this cxusb tree.
Regards,
Mike
Thanks,
Christoph
_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb