From: "nibble.max" <nibble.max@gmail.com>
To: "Mauro Carvalho Chehab" <mchehab@redhat.com>
Cc: linux-media <linux-media@vger.kernel.org>
Subject: [PATCH 2/6] m88ds3103, dvbsky dvb-s2 usb box.
Date: Sun, 15 Apr 2012 23:53:26 +0800 [thread overview]
Message-ID: <201204152353240317150@gmail.com> (raw)
In-Reply-To: 4F2185A1.2000402@redhat.com
dvbsky dvb-s2 usb box based on montage m88ds3103 demodulator.
Signed-off-by: Max nibble <nibble.max@gmail.com>
---
drivers/media/dvb/dvb-usb/Kconfig | 1 +
drivers/media/dvb/dvb-usb/dw2102.c | 236 +++++++++++++++++++++++++++++++++++-
2 files changed, 236 insertions(+), 1 deletion(-)
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index be1db75..bf63f29 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -279,6 +279,7 @@ config DVB_USB_DW2102
select DVB_STV0288 if !DVB_FE_CUSTOMISE
select DVB_STB6000 if !DVB_FE_CUSTOMISE
select DVB_CX24116 if !DVB_FE_CUSTOMISE
+ select DVB_M88DS3103 if !DVB_FE_CUSTOMISE
select DVB_SI21XX if !DVB_FE_CUSTOMISE
select DVB_TDA10023 if !DVB_FE_CUSTOMISE
select DVB_MT312 if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c
index 451c5a7..0b1bbd2 100644
--- a/drivers/media/dvb/dvb-usb/dw2102.c
+++ b/drivers/media/dvb/dvb-usb/dw2102.c
@@ -19,6 +19,7 @@
#include "stb6000.h"
#include "eds1547.h"
#include "cx24116.h"
+#include "m88ds3103.h"
#include "tda1002x.h"
#include "mt312.h"
#include "zl10039.h"
@@ -882,6 +883,44 @@ static int s660_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
return 0;
}
+static int bstusb_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
+{
+
+ struct dvb_usb_adapter *udev_adap =
+ (struct dvb_usb_adapter *)(fe->dvb->priv);
+
+ u8 obuf[3] = { 0xe, 0x80, 0 };
+ u8 ibuf[] = { 0 };
+
+ info("US6830: %s!\n", __func__);
+
+ if (voltage == SEC_VOLTAGE_OFF)
+ obuf[2] = 0;
+ else
+ obuf[2] = 1;
+
+ if (dvb_usb_generic_rw(udev_adap->dev, obuf, 3, ibuf, 1, 0) < 0)
+ err("command 0x0e transfer failed.");
+
+ return 0;
+}
+
+static int bstusb_restart(struct dvb_frontend *fe)
+{
+
+ struct dvb_usb_adapter *udev_adap =
+ (struct dvb_usb_adapter *)(fe->dvb->priv);
+
+ u8 obuf[3] = { 0x36, 3, 0 };
+ u8 ibuf[] = { 0 };
+
+
+ if (dvb_usb_generic_rw(udev_adap->dev, obuf, 3, ibuf, 1, 0) < 0)
+ err("command 0x36 transfer failed.");
+
+ return 0;
+}
+
static void dw210x_led_ctrl(struct dvb_frontend *fe, int offon)
{
static u8 led_off[] = { 0 };
@@ -987,6 +1026,24 @@ static struct ds3000_config su3000_ds3000_config = {
.ci_mode = 1,
};
+static struct m88ds3103_config US6830_ds3103_config = {
+ .demod_address = 0x68,
+ .ci_mode = 1,
+ .pin_ctrl = 0x83,
+ .ts_mode = 0,
+ .start_ctrl = bstusb_restart,
+ .set_voltage = bstusb_set_voltage,
+};
+
+static struct m88ds3103_config US6832_ds3103_config = {
+ .demod_address = 0x68,
+ .ci_mode = 1,
+ .pin_ctrl = 0x80,
+ .ts_mode = 0,
+ .start_ctrl = bstusb_restart,
+ .set_voltage = bstusb_set_voltage,
+};
+
static int dw2104_frontend_attach(struct dvb_usb_adapter *d)
{
struct dvb_tuner_ops *tuner_ops = NULL;
@@ -1214,6 +1271,72 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d)
return 0;
}
+static int US6830_frontend_attach(struct dvb_usb_adapter *d)
+{
+ u8 obuf[3] = { 0xe, 0x83, 0 };
+ u8 ibuf[] = { 0 };
+
+
+ info("US6830: %s!\n", __func__);
+
+ if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
+ err("command 0x0e transfer failed.");
+
+ obuf[0] = 0xe;
+ obuf[1] = 0x83;
+ obuf[2] = 1;
+
+ if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
+ err("command 0x0e transfer failed.");
+
+ obuf[0] = 0x51;
+
+ if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
+ err("command 0x51 transfer failed.");
+
+ d->fe_adap[0].fe = dvb_attach(m88ds3103_attach, &US6830_ds3103_config,
+ &d->dev->i2c_adap);
+ if (d->fe_adap[0].fe == NULL)
+ return -EIO;
+
+ info("Attached M88DS3103!\n");
+
+ return 0;
+}
+
+static int US6832_frontend_attach(struct dvb_usb_adapter *d)
+{
+ u8 obuf[3] = { 0xe, 0x83, 0 };
+ u8 ibuf[] = { 0 };
+
+
+ info("US6832: %s!\n", __func__);
+
+ if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
+ err("command 0x0e transfer failed.");
+
+ obuf[0] = 0xe;
+ obuf[1] = 0x83;
+ obuf[2] = 1;
+
+ if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
+ err("command 0x0e transfer failed.");
+
+ obuf[0] = 0x51;
+
+ if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
+ err("command 0x51 transfer failed.");
+
+ d->fe_adap[0].fe = dvb_attach(m88ds3103_attach, &US6832_ds3103_config,
+ &d->dev->i2c_adap);
+ if (d->fe_adap[0].fe == NULL)
+ return -EIO;
+
+ info("Attached M88DS3103!\n");
+
+ return 0;
+}
+
static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
{
dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
@@ -1451,6 +1574,9 @@ enum dw2102_table_entry {
TEVII_S480_1,
TEVII_S480_2,
X3M_SPC1400HD,
+ BST_US6830HD,
+ BST_US6831HD,
+ BST_US6832HD,
};
static struct usb_device_id dw2102_table[] = {
@@ -1469,6 +1595,9 @@ static struct usb_device_id dw2102_table[] = {
[TEVII_S480_1] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
[TEVII_S480_2] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
[X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
+ [BST_US6830HD] = {USB_DEVICE(0x0572, 0x6830)},
+ [BST_US6831HD] = {USB_DEVICE(0x0572, 0x6831)},
+ [BST_US6832HD] = {USB_DEVICE(0x0572, 0x6832)},
{ }
};
@@ -1874,6 +2003,107 @@ static struct dvb_usb_device_properties su3000_properties = {
}
};
+static struct dvb_usb_device_properties US6830_properties = {
+ .caps = DVB_USB_IS_AN_I2C_ADAPTER,
+ .usb_ctrl = DEVICE_SPECIFIC,
+ .size_of_priv = sizeof(struct su3000_state),
+ .power_ctrl = su3000_power_ctrl,
+ .num_adapters = 1,
+ .identify_state = su3000_identify_state,
+ .i2c_algo = &su3000_i2c_algo,
+
+ .rc.legacy = {
+ .rc_map_table = rc_map_su3000_table,
+ .rc_map_size = ARRAY_SIZE(rc_map_su3000_table),
+ .rc_interval = 150,
+ .rc_query = dw2102_rc_query,
+ },
+
+ .read_mac_address = su3000_read_mac_address,
+
+ .generic_bulk_ctrl_endpoint = 0x01,
+
+ .adapter = {
+ {
+ .num_frontends = 1,
+ .fe = {{
+ .streaming_ctrl = su3000_streaming_ctrl,
+ .frontend_attach = US6830_frontend_attach,
+ .stream = {
+ .type = USB_BULK,
+ .count = 8,
+ .endpoint = 0x82,
+ .u = {
+ .bulk = {
+ .buffersize = 4096,
+ }
+ }
+ }
+ }},
+ }
+ },
+ .num_device_descs = 2,
+ .devices = {
+ { "Bestunar US6830 HD",
+ { &dw2102_table[BST_US6830HD], NULL },
+ { NULL },
+ },
+ { "Bestunar US6831 HD",
+ { &dw2102_table[BST_US6831HD], NULL },
+ { NULL },
+ },
+ }
+};
+
+static struct dvb_usb_device_properties US6832_properties = {
+ .caps = DVB_USB_IS_AN_I2C_ADAPTER,
+ .usb_ctrl = DEVICE_SPECIFIC,
+ .size_of_priv = sizeof(struct su3000_state),
+ .power_ctrl = su3000_power_ctrl,
+ .num_adapters = 1,
+ .identify_state = su3000_identify_state,
+ .i2c_algo = &su3000_i2c_algo,
+
+ .rc.legacy = {
+ .rc_map_table = rc_map_su3000_table,
+ .rc_map_size = ARRAY_SIZE(rc_map_su3000_table),
+ .rc_interval = 150,
+ .rc_query = dw2102_rc_query,
+ },
+
+ .read_mac_address = su3000_read_mac_address,
+
+ .generic_bulk_ctrl_endpoint = 0x01,
+
+ .adapter = {
+ {
+ .num_frontends = 1,
+ .fe = {{
+ .streaming_ctrl = su3000_streaming_ctrl,
+ .frontend_attach = US6832_frontend_attach,
+ .stream = {
+ .type = USB_BULK,
+ .count = 8,
+ .endpoint = 0x82,
+ .u = {
+ .bulk = {
+ .buffersize = 4096,
+ }
+ }
+ }
+ }},
+ }
+ },
+ .num_device_descs = 1,
+ .devices = {
+ { "Bestunar US6832 HD",
+ { &dw2102_table[BST_US6832HD], NULL },
+ { NULL },
+ },
+
+ }
+};
+
static int dw2102_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
@@ -1930,7 +2160,11 @@ static int dw2102_probe(struct usb_interface *intf,
0 == dvb_usb_device_init(intf, p7500,
THIS_MODULE, NULL, adapter_nr) ||
0 == dvb_usb_device_init(intf, &su3000_properties,
- THIS_MODULE, NULL, adapter_nr))
+ THIS_MODULE, NULL, adapter_nr) ||
+ 0 == dvb_usb_device_init(intf, &US6830_properties,
+ THIS_MODULE, NULL, adapter_nr) ||
+ 0 == dvb_usb_device_init(intf, &US6832_properties,
+ THIS_MODULE, NULL, adapter_nr))
return 0;
return -ENODEV;
--
1.7.9.5
next prev parent reply other threads:[~2012-04-15 15:53 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-22 10:38 [PATCH 1/3] m88brs2000 DVB-S frontend and tuner module Malcolm Priestley
2012-01-26 16:56 ` Mauro Carvalho Chehab
2012-01-27 22:26 ` Malcolm Priestley
2012-04-15 15:53 ` [PATCH 1/6] m88ds3103, montage dvb-s/s2 demodulator driver nibble.max
2012-04-19 18:06 ` Mauro Carvalho Chehab
2012-04-20 8:01 ` nibble.max
2012-04-19 20:08 ` Mauro Carvalho Chehab
2012-04-20 8:01 ` nibble.max
2012-04-20 9:47 ` Antti Palosaari
2012-04-20 17:24 ` Mauro Carvalho Chehab
2012-04-21 2:45 ` nibble.max
2012-04-23 16:41 ` Antti Palosaari
2012-04-23 19:51 ` Konstantin Dimitrov
2012-04-23 21:04 ` Antti Palosaari
2012-04-27 18:44 ` Konstantin Dimitrov
2012-04-23 21:49 ` Mauro Carvalho Chehab
2012-04-27 19:01 ` Konstantin Dimitrov
2012-04-27 19:36 ` Mauro Carvalho Chehab
2012-04-27 20:37 ` Konstantin Dimitrov
2012-04-27 20:40 ` Konstantin Dimitrov
2012-04-27 20:54 ` Antti Palosaari
2012-04-27 21:01 ` Konstantin Dimitrov
2012-04-27 19:55 ` Antti Palosaari
2012-04-27 20:21 ` Konstantin Dimitrov
2012-04-27 20:42 ` Antti Palosaari
2012-04-27 21:13 ` Konstantin Dimitrov
2012-04-28 3:54 ` nibble.max
2012-04-28 9:17 ` Demod hardware pid filter implement nibble.max
2012-04-28 10:15 ` Antti Palosaari
2012-04-24 2:45 ` Re: [PATCH 1/6] m88ds3103, montage dvb-s/s2 demodulator driver nibble.max
2012-04-26 13:03 ` nibble.max
2012-04-26 13:24 ` Mauro Carvalho Chehab
2012-04-27 7:06 ` [PATCH 1/6 v2] dvbsky, montage dvb-s/s2 TS202x tuner and M88DS3103 " nibble.max
2012-04-27 11:06 ` Mauro Carvalho Chehab
2012-04-27 14:17 ` Re: [PATCH 1/6 v2] dvbsky, montage dvb-s/s2 TS202x tuner and M88DS3103demodulator driver nibble.max
2012-04-27 14:35 ` Mauro Carvalho Chehab
2012-04-27 18:03 ` Konstantin Dimitrov
2012-04-27 7:06 ` [PATCH 2/6 v2] dvbsky, dvb-s/s2 usb box nibble.max
2013-06-30 3:07 ` Fwd: " P. van Gaans
2014-01-15 19:30 ` Mauro Carvalho Chehab
2012-04-27 7:06 ` [PATCH 3/6 v2] dvbsky, dvb-s/s2 PCIe card nibble.max
2012-04-27 7:07 ` [PATCH 4/6 v2] dvbsky, dvb-s/s2 PCI card nibble.max
2012-04-27 7:07 ` [PATCH 5/6 v2] dvbsky, remote control key map nibble.max
2012-04-27 7:07 ` [PATCH 6/6 v2] dvbsky, remote control include header file nibble.max
2012-04-20 17:10 ` [PATCH 1/6] m88ds3103, montage dvb-s/s2 demodulator driver Mauro Carvalho Chehab
2012-04-15 15:53 ` nibble.max [this message]
2012-04-19 18:09 ` [PATCH 2/6] m88ds3103, dvbsky dvb-s2 usb box Mauro Carvalho Chehab
2012-04-20 8:08 ` nibble.max
2012-04-20 17:08 ` Mauro Carvalho Chehab
2012-04-15 15:53 ` [PATCH 3/6] m88ds3103, dvbsky dvb-s2 cx23883 pci card nibble.max
2012-04-15 15:53 ` [PATCH 4/6] m88ds3103, dvbsky dvb-s2 cx23885 pcie card nibble.max
2012-04-19 18:11 ` Mauro Carvalho Chehab
2012-04-15 15:53 ` [PATCH 5/6] m88ds3103, dvbsky remote control key map nibble.max
2012-04-19 18:16 ` Mauro Carvalho Chehab
2012-04-20 8:01 ` nibble.max
2012-04-15 15:53 ` [PATCH 6/6] m88ds3103, dvbsky remote control include header file nibble.max
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201204152353240317150@gmail.com \
--to=nibble.max@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).