aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig10
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile3
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c48
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-common.c9
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-mb.c7
-rw-r--r--drivers/media/dvb/dvb-usb/digitv.c15
-rw-r--r--drivers/media/dvb/dvb-usb/dtt200u-fe.c8
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-dvb.c17
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-i2c.c24
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h4
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h6
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk-fe.c272
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.c256
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.h79
-rw-r--r--drivers/media/dvb/dvb-usb/umt-010.c2
-rw-r--r--drivers/media/dvb/dvb-usb/vp702x-fe.c7
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045-fe.c9
17 files changed, 705 insertions, 71 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index e388fb1567d6..3bc6722a6443 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -88,6 +88,7 @@ config DVB_USB_CXUSB
88 select DVB_CX22702 88 select DVB_CX22702
89 select DVB_LGDT330X 89 select DVB_LGDT330X
90 select DVB_MT352 90 select DVB_MT352
91 select DVB_ZL10353
91 help 92 help
92 Say Y here to support the Conexant USB2.0 hybrid reference design. 93 Say Y here to support the Conexant USB2.0 hybrid reference design.
93 Currently, only DVB and ATSC modes are supported, analog mode 94 Currently, only DVB and ATSC modes are supported, analog mode
@@ -130,6 +131,15 @@ config DVB_USB_VP702X
130 131
131 DVB-S USB2.0 receivers. 132 DVB-S USB2.0 receivers.
132 133
134config DVB_USB_GP8PSK
135 tristate "GENPIX 8PSK->USB module support"
136 depends on DVB_USB
137 help
138 Say Y here to support the
139 GENPIX 8psk module
140
141 DVB-S USB2.0 receivers.
142
133config DVB_USB_NOVA_T_USB2 143config DVB_USB_NOVA_T_USB2
134 tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support" 144 tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support"
135 depends on DVB_USB 145 depends on DVB_USB
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 2dc9aad9681e..9643f56c7fe9 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -7,6 +7,9 @@ obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o
7dvb-usb-vp702x-objs = vp702x.o vp702x-fe.o 7dvb-usb-vp702x-objs = vp702x.o vp702x-fe.o
8obj-$(CONFIG_DVB_USB_VP702X) += dvb-usb-vp702x.o 8obj-$(CONFIG_DVB_USB_VP702X) += dvb-usb-vp702x.o
9 9
10dvb-usb-gp8psk-objs = gp8psk.o gp8psk-fe.o
11obj-$(CONFIG_DVB_USB_GP8PSK) += dvb-usb-gp8psk.o
12
10dvb-usb-dtt200u-objs = dtt200u.o dtt200u-fe.o 13dvb-usb-dtt200u-objs = dtt200u.o dtt200u-fe.o
11obj-$(CONFIG_DVB_USB_DTT200U) += dvb-usb-dtt200u.o 14obj-$(CONFIG_DVB_USB_DTT200U) += dvb-usb-dtt200u.o
12 15
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 1f0d3e995c8d..ae23bdde42a8 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -27,8 +27,10 @@
27 27
28#include "cx22702.h" 28#include "cx22702.h"
29#include "lgdt330x.h" 29#include "lgdt330x.h"
30#include "lg_h06xf.h"
30#include "mt352.h" 31#include "mt352.h"
31#include "mt352_priv.h" 32#include "mt352_priv.h"
33#include "zl10353.h"
32 34
33/* debug */ 35/* debug */
34int dvb_usb_cxusb_debug; 36int dvb_usb_cxusb_debug;
@@ -322,32 +324,37 @@ static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
322 return 0; 324 return 0;
323} 325}
324 326
327static int cxusb_lgh064f_tuner_set_params(struct dvb_frontend *fe,
328 struct dvb_frontend_parameters *fep)
329{
330 struct dvb_usb_device *d = fe->dvb->priv;
331 return lg_h06xf_pll_set(fe, &d->i2c_adap, fep);
332}
333
325static struct cx22702_config cxusb_cx22702_config = { 334static struct cx22702_config cxusb_cx22702_config = {
326 .demod_address = 0x63, 335 .demod_address = 0x63,
327 336
328 .output_mode = CX22702_PARALLEL_OUTPUT, 337 .output_mode = CX22702_PARALLEL_OUTPUT,
329
330 .pll_init = dvb_usb_pll_init_i2c,
331 .pll_set = dvb_usb_pll_set_i2c,
332}; 338};
333 339
334static struct lgdt330x_config cxusb_lgdt3303_config = { 340static struct lgdt330x_config cxusb_lgdt3303_config = {
335 .demod_address = 0x0e, 341 .demod_address = 0x0e,
336 .demod_chip = LGDT3303, 342 .demod_chip = LGDT3303,
337 .pll_set = dvb_usb_pll_set_i2c,
338}; 343};
339 344
340static struct mt352_config cxusb_dee1601_config = { 345static struct mt352_config cxusb_dee1601_config = {
341 .demod_address = 0x0f, 346 .demod_address = 0x0f,
342 .demod_init = cxusb_dee1601_demod_init, 347 .demod_init = cxusb_dee1601_demod_init,
343 .pll_set = dvb_usb_pll_set,
344}; 348};
345 349
346struct mt352_config cxusb_mt352_config = { 350static struct zl10353_config cxusb_zl10353_dee1601_config = {
351 .demod_address = 0x0f,
352};
353
354static struct mt352_config cxusb_mt352_config = {
347 /* used in both lgz201 and th7579 */ 355 /* used in both lgz201 and th7579 */
348 .demod_address = 0x0f, 356 .demod_address = 0x0f,
349 .demod_init = cxusb_mt352_demod_init, 357 .demod_init = cxusb_mt352_demod_init,
350 .pll_set = dvb_usb_pll_set,
351}; 358};
352 359
353/* Callbacks for DVB USB */ 360/* Callbacks for DVB USB */
@@ -357,17 +364,10 @@ static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d)
357 d->pll_addr = 0x61; 364 d->pll_addr = 0x61;
358 memcpy(d->pll_init, bpll, 4); 365 memcpy(d->pll_init, bpll, 4);
359 d->pll_desc = &dvb_pll_fmd1216me; 366 d->pll_desc = &dvb_pll_fmd1216me;
360 return 0;
361}
362 367
363static int cxusb_lgh064f_tuner_attach(struct dvb_usb_device *d) 368 d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c;
364{ 369 d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
365 u8 bpll[4] = { 0x00, 0x00, 0x18, 0x50 }; 370
366 /* bpll[2] : unset bit 3, set bits 4&5
367 bpll[3] : 0x50 - digital, 0x20 - analog */
368 d->pll_addr = 0x61;
369 memcpy(d->pll_init, bpll, 4);
370 d->pll_desc = &dvb_pll_tdvs_tua6034;
371 return 0; 371 return 0;
372} 372}
373 373
@@ -375,6 +375,7 @@ static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d)
375{ 375{
376 d->pll_addr = 0x61; 376 d->pll_addr = 0x61;
377 d->pll_desc = &dvb_pll_thomson_dtt7579; 377 d->pll_desc = &dvb_pll_thomson_dtt7579;
378 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
378 return 0; 379 return 0;
379} 380}
380 381
@@ -382,6 +383,7 @@ static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d)
382{ 383{
383 d->pll_addr = 0x61; 384 d->pll_addr = 0x61;
384 d->pll_desc = &dvb_pll_lg_z201; 385 d->pll_desc = &dvb_pll_lg_z201;
386 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
385 return 0; 387 return 0;
386} 388}
387 389
@@ -389,6 +391,13 @@ static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d)
389{ 391{
390 d->pll_addr = 0x60; 392 d->pll_addr = 0x60;
391 d->pll_desc = &dvb_pll_thomson_dtt7579; 393 d->pll_desc = &dvb_pll_thomson_dtt7579;
394 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
395 return 0;
396}
397
398static int cxusb_lgdt3303_tuner_attach(struct dvb_usb_device *d)
399{
400 d->fe->ops.tuner_ops.set_params = cxusb_lgh064f_tuner_set_params;
392 return 0; 401 return 0;
393} 402}
394 403
@@ -439,7 +448,8 @@ static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d)
439 448
440 cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0); 449 cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0);
441 450
442 if ((d->fe = mt352_attach(&cxusb_dee1601_config, &d->i2c_adap)) != NULL) 451 if (((d->fe = mt352_attach(&cxusb_dee1601_config, &d->i2c_adap)) != NULL) ||
452 ((d->fe = zl10353_attach(&cxusb_zl10353_dee1601_config, &d->i2c_adap)) != NULL))
443 return 0; 453 return 0;
444 454
445 return -EIO; 455 return -EIO;
@@ -555,7 +565,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
555 .streaming_ctrl = cxusb_streaming_ctrl, 565 .streaming_ctrl = cxusb_streaming_ctrl,
556 .power_ctrl = cxusb_bluebird_power_ctrl, 566 .power_ctrl = cxusb_bluebird_power_ctrl,
557 .frontend_attach = cxusb_lgdt3303_frontend_attach, 567 .frontend_attach = cxusb_lgdt3303_frontend_attach,
558 .tuner_attach = cxusb_lgh064f_tuner_attach, 568 .tuner_attach = cxusb_lgdt3303_tuner_attach,
559 569
560 .i2c_algo = &cxusb_i2c_algo, 570 .i2c_algo = &cxusb_i2c_algo,
561 571
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c
index 2d52b76671d3..abd75b4a350d 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-common.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-common.c
@@ -173,11 +173,10 @@ int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d)
173 struct dib3000_config demod_cfg; 173 struct dib3000_config demod_cfg;
174 struct dibusb_state *st = d->priv; 174 struct dibusb_state *st = d->priv;
175 175
176 demod_cfg.pll_set = dvb_usb_pll_set_i2c;
177 demod_cfg.pll_init = dvb_usb_pll_init_i2c;
178
179 for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++) 176 for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++)
180 if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) { 177 if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) {
178 d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c;
179 d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
181 d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; 180 d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl;
182 return 0; 181 return 0;
183 } 182 }
@@ -190,6 +189,10 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d)
190{ 189{
191 d->pll_addr = 0x60; 190 d->pll_addr = 0x60;
192 d->pll_desc = &dvb_pll_env57h1xd5; 191 d->pll_desc = &dvb_pll_env57h1xd5;
192
193 d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c;
194 d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
195
193 return 0; 196 return 0;
194} 197}
195EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); 198EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c
index dd5a13195886..f4c45f386ebc 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-mb.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c
@@ -20,11 +20,12 @@ static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_device *d)
20 struct dibusb_state *st = d->priv; 20 struct dibusb_state *st = d->priv;
21 21
22 demod_cfg.demod_address = 0x8; 22 demod_cfg.demod_address = 0x8;
23 demod_cfg.pll_set = dvb_usb_pll_set_i2c;
24 demod_cfg.pll_init = dvb_usb_pll_init_i2c;
25 23
26 if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) 24 if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) {
25 d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c;
26 d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
27 return -ENODEV; 27 return -ENODEV;
28 }
28 29
29 d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; 30 d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl;
30 31
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c
index 91136c00ce9d..c14d9efb48fd 100644
--- a/drivers/media/dvb/dvb-usb/digitv.c
+++ b/drivers/media/dvb/dvb-usb/digitv.c
@@ -112,27 +112,30 @@ static int digitv_mt352_demod_init(struct dvb_frontend *fe)
112 112
113static struct mt352_config digitv_mt352_config = { 113static struct mt352_config digitv_mt352_config = {
114 .demod_init = digitv_mt352_demod_init, 114 .demod_init = digitv_mt352_demod_init,
115 .pll_set = dvb_usb_pll_set,
116}; 115};
117 116
118static int digitv_nxt6000_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) 117static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
119{ 118{
120 struct dvb_usb_device *d = fe->dvb->priv; 119 struct dvb_usb_device *d = fe->dvb->priv;
121 u8 b[5]; 120 u8 b[5];
122 dvb_usb_pll_set(fe,fep,b); 121 dvb_usb_tuner_calc_regs(fe,fep,b, 5);
123 return digitv_ctrl_msg(d,USB_WRITE_TUNER,0,&b[1],4,NULL,0); 122 return digitv_ctrl_msg(d,USB_WRITE_TUNER,0,&b[1],4,NULL,0);
124} 123}
125 124
126static struct nxt6000_config digitv_nxt6000_config = { 125static struct nxt6000_config digitv_nxt6000_config = {
127 .clock_inversion = 1, 126 .clock_inversion = 1,
128 .pll_set = digitv_nxt6000_pll_set,
129}; 127};
130 128
131static int digitv_frontend_attach(struct dvb_usb_device *d) 129static int digitv_frontend_attach(struct dvb_usb_device *d)
132{ 130{
133 if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL || 131 if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL) {
134 (d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) 132 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
135 return 0; 133 return 0;
134 }
135 if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) {
136 d->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params;
137 return 0;
138 }
136 return -EIO; 139 return -EIO;
137} 140}
138 141
diff --git a/drivers/media/dvb/dvb-usb/dtt200u-fe.c b/drivers/media/dvb/dvb-usb/dtt200u-fe.c
index cd21ddbfd054..17413adec7a1 100644
--- a/drivers/media/dvb/dvb-usb/dtt200u-fe.c
+++ b/drivers/media/dvb/dvb-usb/dtt200u-fe.c
@@ -18,7 +18,6 @@ struct dtt200u_fe_state {
18 18
19 struct dvb_frontend_parameters fep; 19 struct dvb_frontend_parameters fep;
20 struct dvb_frontend frontend; 20 struct dvb_frontend frontend;
21 struct dvb_frontend_ops ops;
22}; 21};
23 22
24static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) 23static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat)
@@ -163,16 +162,13 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d)
163 deb_info("attaching frontend dtt200u\n"); 162 deb_info("attaching frontend dtt200u\n");
164 163
165 state->d = d; 164 state->d = d;
166 memcpy(&state->ops,&dtt200u_fe_ops,sizeof(struct dvb_frontend_ops));
167 165
168 state->frontend.ops = &state->ops; 166 memcpy(&state->frontend.ops,&dtt200u_fe_ops,sizeof(struct dvb_frontend_ops));
169 state->frontend.demodulator_priv = state; 167 state->frontend.demodulator_priv = state;
170 168
171 goto success; 169 return &state->frontend;
172error: 170error:
173 return NULL; 171 return NULL;
174success:
175 return &state->frontend;
176} 172}
177 173
178static struct dvb_frontend_ops dtt200u_fe_ops = { 174static struct dvb_frontend_ops dtt200u_fe_ops = {
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
index 6fa92100248b..ec631708c394 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
@@ -82,7 +82,7 @@ int dvb_usb_dvb_init(struct dvb_usb_device *d)
82 int ret; 82 int ret;
83 83
84 if ((ret = dvb_register_adapter(&d->dvb_adap, d->desc->name, 84 if ((ret = dvb_register_adapter(&d->dvb_adap, d->desc->name,
85 d->owner)) < 0) { 85 d->owner, &d->udev->dev)) < 0) {
86 deb_info("dvb_register_adapter failed: error %d", ret); 86 deb_info("dvb_register_adapter failed: error %d", ret);
87 goto err; 87 goto err;
88 } 88 }
@@ -121,16 +121,15 @@ int dvb_usb_dvb_init(struct dvb_usb_device *d)
121 121
122 dvb_net_init(&d->dvb_adap, &d->dvb_net, &d->demux.dmx); 122 dvb_net_init(&d->dvb_adap, &d->dvb_net, &d->demux.dmx);
123 123
124 goto success; 124 d->state |= DVB_USB_STATE_DVB;
125 return 0;
126
125err_dmx_dev: 127err_dmx_dev:
126 dvb_dmx_release(&d->demux); 128 dvb_dmx_release(&d->demux);
127err_dmx: 129err_dmx:
128 dvb_unregister_adapter(&d->dvb_adap); 130 dvb_unregister_adapter(&d->dvb_adap);
129err: 131err:
130 return ret; 132 return ret;
131success:
132 d->state |= DVB_USB_STATE_DVB;
133 return 0;
134} 133}
135 134
136int dvb_usb_dvb_exit(struct dvb_usb_device *d) 135int dvb_usb_dvb_exit(struct dvb_usb_device *d)
@@ -184,13 +183,13 @@ int dvb_usb_fe_init(struct dvb_usb_device* d)
184 183
185 /* re-assign sleep and wakeup functions */ 184 /* re-assign sleep and wakeup functions */
186 if (d->fe != NULL) { 185 if (d->fe != NULL) {
187 d->fe_init = d->fe->ops->init; d->fe->ops->init = dvb_usb_fe_wakeup; 186 d->fe_init = d->fe->ops.init; d->fe->ops.init = dvb_usb_fe_wakeup;
188 d->fe_sleep = d->fe->ops->sleep; d->fe->ops->sleep = dvb_usb_fe_sleep; 187 d->fe_sleep = d->fe->ops.sleep; d->fe->ops.sleep = dvb_usb_fe_sleep;
189 188
190 if (dvb_register_frontend(&d->dvb_adap, d->fe)) { 189 if (dvb_register_frontend(&d->dvb_adap, d->fe)) {
191 err("Frontend registration failed."); 190 err("Frontend registration failed.");
192 if (d->fe->ops->release) 191 if (d->fe->ops.release)
193 d->fe->ops->release(d->fe); 192 d->fe->ops.release(d->fe);
194 d->fe = NULL; 193 d->fe = NULL;
195 return -ENODEV; 194 return -ENODEV;
196 } 195 }
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
index 9b254532af4d..6b611a725093 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
@@ -46,7 +46,7 @@ int dvb_usb_i2c_exit(struct dvb_usb_device *d)
46 return 0; 46 return 0;
47} 47}
48 48
49int dvb_usb_pll_init_i2c(struct dvb_frontend *fe) 49int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe)
50{ 50{
51 struct dvb_usb_device *d = fe->dvb->priv; 51 struct dvb_usb_device *d = fe->dvb->priv;
52 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = d->pll_init, .len = 4 }; 52 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = d->pll_init, .len = 4 };
@@ -63,6 +63,8 @@ int dvb_usb_pll_init_i2c(struct dvb_frontend *fe)
63 deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1], 63 deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1],
64 d->pll_init[2],d->pll_init[3]); 64 d->pll_init[2],d->pll_init[3]);
65 65
66 if (fe->ops.i2c_gate_ctrl)
67 fe->ops.i2c_gate_ctrl(fe, 1);
66 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { 68 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) {
67 err("tuner i2c write failed for pll_init."); 69 err("tuner i2c write failed for pll_init.");
68 ret = -EREMOTEIO; 70 ret = -EREMOTEIO;
@@ -73,38 +75,42 @@ int dvb_usb_pll_init_i2c(struct dvb_frontend *fe)
73 d->tuner_pass_ctrl(fe,0,d->pll_addr); 75 d->tuner_pass_ctrl(fe,0,d->pll_addr);
74 return ret; 76 return ret;
75} 77}
76EXPORT_SYMBOL(dvb_usb_pll_init_i2c); 78EXPORT_SYMBOL(dvb_usb_tuner_init_i2c);
77 79
78int dvb_usb_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 b[5]) 80int dvb_usb_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 *b, int buf_len)
79{ 81{
80 struct dvb_usb_device *d = fe->dvb->priv; 82 struct dvb_usb_device *d = fe->dvb->priv;
81 83
84 if (buf_len != 5)
85 return -EINVAL;
82 if (d->pll_desc == NULL) 86 if (d->pll_desc == NULL)
83 return 0; 87 return 0;
84 88
85 deb_pll("pll addr: %x, freq: %d %p\n",d->pll_addr,fep->frequency,d->pll_desc); 89 deb_pll("pll addr: %x, freq: %d %p\n",d->pll_addr,fep->frequency,d->pll_desc);
86 90
87 b[0] = d->pll_addr << 1; 91 b[0] = d->pll_addr;
88 dvb_pll_configure(d->pll_desc,&b[1],fep->frequency,fep->u.ofdm.bandwidth); 92 dvb_pll_configure(d->pll_desc,&b[1],fep->frequency,fep->u.ofdm.bandwidth);
89 93
90 deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]); 94 deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]);
91 95
92 return 0; 96 return 5;
93} 97}
94EXPORT_SYMBOL(dvb_usb_pll_set); 98EXPORT_SYMBOL(dvb_usb_tuner_calc_regs);
95 99
96int dvb_usb_pll_set_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) 100int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
97{ 101{
98 struct dvb_usb_device *d = fe->dvb->priv; 102 struct dvb_usb_device *d = fe->dvb->priv;
99 int ret = 0; 103 int ret = 0;
100 u8 b[5]; 104 u8 b[5];
101 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = &b[1], .len = 4 }; 105 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = &b[1], .len = 4 };
102 106
103 dvb_usb_pll_set(fe,fep,b); 107 dvb_usb_tuner_calc_regs(fe,fep,b,5);
104 108
105 if (d->tuner_pass_ctrl) 109 if (d->tuner_pass_ctrl)
106 d->tuner_pass_ctrl(fe,1,d->pll_addr); 110 d->tuner_pass_ctrl(fe,1,d->pll_addr);
107 111
112 if (fe->ops.i2c_gate_ctrl)
113 fe->ops.i2c_gate_ctrl(fe, 1);
108 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { 114 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) {
109 err("tuner i2c write failed for pll_set."); 115 err("tuner i2c write failed for pll_set.");
110 ret = -EREMOTEIO; 116 ret = -EREMOTEIO;
@@ -116,4 +122,4 @@ int dvb_usb_pll_set_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters
116 122
117 return ret; 123 return ret;
118} 124}
119EXPORT_SYMBOL(dvb_usb_pll_set_i2c); 125EXPORT_SYMBOL(dvb_usb_tuner_set_params_i2c);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index cb239049b098..95698918bc11 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -31,6 +31,7 @@
31#define USB_VID_VISIONPLUS 0x13d3 31#define USB_VID_VISIONPLUS 0x13d3
32#define USB_VID_TWINHAN 0x1822 32#define USB_VID_TWINHAN 0x1822
33#define USB_VID_ULTIMA_ELECTRONIC 0x05d8 33#define USB_VID_ULTIMA_ELECTRONIC 0x05d8
34#define USB_VID_GENPIX 0x09c0
34 35
35/* Product IDs */ 36/* Product IDs */
36#define USB_PID_ADSTECH_USB2_COLD 0xa333 37#define USB_PID_ADSTECH_USB2_COLD 0xa333
@@ -104,5 +105,6 @@
104#define USB_PID_KYE_DVB_T_WARM 0x701f 105#define USB_PID_KYE_DVB_T_WARM 0x701f
105#define USB_PID_PCTV_200E 0x020e 106#define USB_PID_PCTV_200E 0x020e
106#define USB_PID_PCTV_400E 0x020f 107#define USB_PID_PCTV_400E 0x020f
107 108#define USB_PID_GENPIX_8PSK_COLD 0x0200
109#define USB_PID_GENPIX_8PSK_WARM 0x0201
108#endif 110#endif
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h
index fead958a57e3..4cf9f89c51bf 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -330,9 +330,9 @@ extern int dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16);
330extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *); 330extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *);
331 331
332/* commonly used pll init and set functions */ 332/* commonly used pll init and set functions */
333extern int dvb_usb_pll_init_i2c(struct dvb_frontend *); 333extern int dvb_usb_tuner_init_i2c(struct dvb_frontend *);
334extern int dvb_usb_pll_set(struct dvb_frontend *, struct dvb_frontend_parameters *, u8[]); 334extern int dvb_usb_tuner_calc_regs(struct dvb_frontend *, struct dvb_frontend_parameters *, u8 *buf, int buf_len);
335extern int dvb_usb_pll_set_i2c(struct dvb_frontend *, struct dvb_frontend_parameters *); 335extern int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *, struct dvb_frontend_parameters *);
336 336
337/* commonly used firmware download types and function */ 337/* commonly used firmware download types and function */
338struct hexline { 338struct hexline {
diff --git a/drivers/media/dvb/dvb-usb/gp8psk-fe.c b/drivers/media/dvb/dvb-usb/gp8psk-fe.c
new file mode 100644
index 000000000000..6ccbdc9cd772
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/gp8psk-fe.c
@@ -0,0 +1,272 @@
1/* DVB USB compliant Linux driver for the
2 * - GENPIX 8pks/qpsk USB2.0 DVB-S module
3 *
4 * Copyright (C) 2006 Alan Nisota (alannisota@gmail.com)
5 *
6 * Thanks to GENPIX for the sample code used to implement this module.
7 *
8 * This module is based off the vp7045 and vp702x modules
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation, version 2.
13 *
14 * see Documentation/dvb/README.dvb-usb for more information
15 */
16#include "gp8psk.h"
17
18struct gp8psk_fe_state {
19 struct dvb_frontend fe;
20
21 struct dvb_usb_device *d;
22
23 u16 snr;
24
25 unsigned long next_snr_check;
26};
27
28static int gp8psk_fe_read_status(struct dvb_frontend* fe, fe_status_t *status)
29{
30 struct gp8psk_fe_state *st = fe->demodulator_priv;
31 u8 lock;
32
33 if (gp8psk_usb_in_op(st->d, GET_SIGNAL_LOCK, 0, 0, &lock,1))
34 return -EINVAL;
35
36 if (lock)
37 *status = FE_HAS_LOCK | FE_HAS_SYNC | FE_HAS_VITERBI | FE_HAS_SIGNAL | FE_HAS_CARRIER;
38 else
39 *status = 0;
40
41 return 0;
42}
43
44/* not supported by this Frontend */
45static int gp8psk_fe_read_ber(struct dvb_frontend* fe, u32 *ber)
46{
47 (void) fe;
48 *ber = 0;
49 return 0;
50}
51
52/* not supported by this Frontend */
53static int gp8psk_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc)
54{
55 (void) fe;
56 *unc = 0;
57 return 0;
58}
59
60static int gp8psk_fe_read_snr(struct dvb_frontend* fe, u16 *snr)
61{
62 struct gp8psk_fe_state *st = fe->demodulator_priv;
63 u8 buf[2];
64
65 if (time_after(jiffies,st->next_snr_check)) {
66 gp8psk_usb_in_op(st->d,GET_SIGNAL_STRENGTH,0,0,buf,2);
67 *snr = (int)(buf[1]) << 8 | buf[0];
68 /* snr is reported in dBu*256 */
69 /* snr / 38.4 ~= 100% strength */
70 /* snr * 17 returns 100% strength as 65535 */
71 if (*snr <= 3855)
72 *snr = (*snr<<4) + *snr; // snr * 17
73 else
74 *snr = 65535;
75 st->next_snr_check = jiffies + (10*HZ)/1000;
76 } else {
77 *snr = st->snr;
78 }
79 return 0;
80}
81
82static int gp8psk_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength)
83{
84 return gp8psk_fe_read_snr(fe, strength);
85}
86
87static int gp8psk_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune)
88{
89 tune->min_delay_ms = 800;
90 return 0;
91}
92
93static int gp8psk_fe_set_frontend(struct dvb_frontend* fe,
94 struct dvb_frontend_parameters *fep)
95{
96 struct gp8psk_fe_state *state = fe->demodulator_priv;
97 u8 cmd[10];
98 u32 freq = fep->frequency * 1000;
99
100 cmd[4] = freq & 0xff;
101 cmd[5] = (freq >> 8) & 0xff;
102 cmd[6] = (freq >> 16) & 0xff;
103 cmd[7] = (freq >> 24) & 0xff;
104
105 switch(fe->ops.info.type) {
106 case FE_QPSK:
107 cmd[0] = fep->u.qpsk.symbol_rate & 0xff;
108 cmd[1] = (fep->u.qpsk.symbol_rate >> 8) & 0xff;
109 cmd[2] = (fep->u.qpsk.symbol_rate >> 16) & 0xff;
110 cmd[3] = (fep->u.qpsk.symbol_rate >> 24) & 0xff;
111 cmd[8] = ADV_MOD_DVB_QPSK;
112 cmd[9] = 0x03; /*ADV_MOD_FEC_XXX*/
113 break;
114 default:
115 // other modes are unsuported right now
116 cmd[0] = 0;
117 cmd[1] = 0;
118 cmd[2] = 0;
119 cmd[3] = 0;
120 cmd[8] = 0;
121 cmd[9] = 0;
122 break;
123 }
124
125 gp8psk_usb_out_op(state->d,TUNE_8PSK,0,0,cmd,10);
126
127 state->next_snr_check = jiffies;
128
129 return 0;
130}
131
132static int gp8psk_fe_get_frontend(struct dvb_frontend* fe,
133 struct dvb_frontend_parameters *fep)
134{
135 return 0;
136}
137
138
139static int gp8psk_fe_send_diseqc_msg (struct dvb_frontend* fe,
140 struct dvb_diseqc_master_cmd *m)
141{
142 struct gp8psk_fe_state *st = fe->demodulator_priv;
143
144 deb_fe("%s\n",__FUNCTION__);
145
146 if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, m->msg[0], 0,
147 m->msg, m->msg_len)) {
148 return -EINVAL;
149 }
150 return 0;
151}
152
153static int gp8psk_fe_send_diseqc_burst (struct dvb_frontend* fe,
154 fe_sec_mini_cmd_t burst)
155{
156 struct gp8psk_fe_state *st = fe->demodulator_priv;
157 u8 cmd;
158
159 deb_fe("%s\n",__FUNCTION__);
160
161 /* These commands are certainly wrong */
162 cmd = (burst == SEC_MINI_A) ? 0x00 : 0x01;
163
164 if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, cmd, 0,
165 &cmd, 0)) {
166 return -EINVAL;
167 }
168 return 0;
169}
170
171static int gp8psk_fe_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
172{
173 struct gp8psk_fe_state* state = fe->demodulator_priv;
174
175 if (gp8psk_usb_out_op(state->d,SET_22KHZ_TONE,
176 (tone == SEC_TONE_ON), 0, NULL, 0)) {
177 return -EINVAL;
178 }
179 return 0;
180}
181
182static int gp8psk_fe_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage)
183{
184 struct gp8psk_fe_state* state = fe->demodulator_priv;
185
186 if (gp8psk_usb_out_op(state->d,SET_LNB_VOLTAGE,
187 voltage == SEC_VOLTAGE_18, 0, NULL, 0)) {
188 return -EINVAL;
189 }
190 return 0;
191}
192
193static int gp8psk_fe_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long sw_cmd)
194{
195 struct gp8psk_fe_state* state = fe->demodulator_priv;
196 u8 cmd = sw_cmd & 0x7f;
197
198 if (gp8psk_usb_out_op(state->d,SET_DN_SWITCH, cmd, 0,
199 NULL, 0)) {
200 return -EINVAL;
201 }
202 if (gp8psk_usb_out_op(state->d,SET_LNB_VOLTAGE, !!(sw_cmd & 0x80),
203 0, NULL, 0)) {
204 return -EINVAL;
205 }
206
207 return 0;
208}
209
210static void gp8psk_fe_release(struct dvb_frontend* fe)
211{
212 struct gp8psk_fe_state *state = fe->demodulator_priv;
213 kfree(state);
214}
215
216static struct dvb_frontend_ops gp8psk_fe_ops;
217
218struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d)
219{
220 struct gp8psk_fe_state *s = kzalloc(sizeof(struct gp8psk_fe_state), GFP_KERNEL);
221 if (s == NULL)
222 goto error;
223
224 s->d = d;
225 memcpy(&s->fe.ops, &gp8psk_fe_ops, sizeof(struct dvb_frontend_ops));
226 s->fe.demodulator_priv = s;
227
228 goto success;
229error:
230 return NULL;
231success:
232 return &s->fe;
233}
234
235
236static struct dvb_frontend_ops gp8psk_fe_ops = {
237 .info = {
238 .name = "Genpix 8psk-USB DVB-S",
239 .type = FE_QPSK,
240 .frequency_min = 950000,
241 .frequency_max = 2150000,
242 .frequency_stepsize = 100,
243 .symbol_rate_min = 1000000,
244 .symbol_rate_max = 45000000,
245 .symbol_rate_tolerance = 500, /* ppm */
246 .caps = FE_CAN_INVERSION_AUTO |
247 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
248 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
249 FE_CAN_QPSK
250 },
251
252 .release = gp8psk_fe_release,
253
254 .init = NULL,
255 .sleep = NULL,
256
257 .set_frontend = gp8psk_fe_set_frontend,
258 .get_frontend = gp8psk_fe_get_frontend,
259 .get_tune_settings = gp8psk_fe_get_tune_settings,
260
261 .read_status = gp8psk_fe_read_status,
262 .read_ber = gp8psk_fe_read_ber,
263 .read_signal_strength = gp8psk_fe_read_signal_strength,
264 .read_snr = gp8psk_fe_read_snr,
265 .read_ucblocks = gp8psk_fe_read_unc_blocks,
266
267 .diseqc_send_master_cmd = gp8psk_fe_send_diseqc_msg,
268 .diseqc_send_burst = gp8psk_fe_send_diseqc_burst,
269 .set_tone = gp8psk_fe_set_tone,
270 .set_voltage = gp8psk_fe_set_voltage,
271 .dishnetwork_send_legacy_command = gp8psk_fe_send_legacy_dish_cmd,
272};
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c
new file mode 100644
index 000000000000..9a98f3fdae31
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/gp8psk.c
@@ -0,0 +1,256 @@
1/* DVB USB compliant Linux driver for the
2 * - GENPIX 8pks/qpsk USB2.0 DVB-S module
3 *
4 * Copyright (C) 2006 Alan Nisota (alannisota@gmail.com)
5 *
6 * Thanks to GENPIX for the sample code used to implement this module.
7 *
8 * This module is based off the vp7045 and vp702x modules
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation, version 2.
13 *
14 * see Documentation/dvb/README.dvb-usb for more information
15 */
16#include "gp8psk.h"
17
18/* debug */
19static char bcm4500_firmware[] = "dvb-usb-gp8psk-02.fw";
20int dvb_usb_gp8psk_debug;
21module_param_named(debug,dvb_usb_gp8psk_debug, int, 0644);
22MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
23
24int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen)
25{
26 int ret = 0,try = 0;
27
28 if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
29 return ret;
30
31 while (ret >= 0 && ret != blen && try < 3) {
32 ret = usb_control_msg(d->udev,
33 usb_rcvctrlpipe(d->udev,0),
34 req,
35 USB_TYPE_VENDOR | USB_DIR_IN,
36 value,index,b,blen,
37 2000);
38 deb_info("reading number %d (ret: %d)\n",try,ret);
39 try++;
40 }
41
42 if (ret < 0 || ret != blen) {
43 warn("usb in operation failed.");
44 ret = -EIO;
45 } else
46 ret = 0;
47
48 deb_xfer("in: req. %x, val: %x, ind: %x, buffer: ",req,value,index);
49 debug_dump(b,blen,deb_xfer);
50
51 mutex_unlock(&d->usb_mutex);
52
53 return ret;
54}
55
56int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
57 u16 index, u8 *b, int blen)
58{
59 int ret;
60
61 deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index);
62 debug_dump(b,blen,deb_xfer);
63
64 if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
65 return ret;
66
67 if (usb_control_msg(d->udev,
68 usb_sndctrlpipe(d->udev,0),
69 req,
70 USB_TYPE_VENDOR | USB_DIR_OUT,
71 value,index,b,blen,
72 2000) != blen) {
73 warn("usb out operation failed.");
74 ret = -EIO;
75 } else
76 ret = 0;
77 mutex_unlock(&d->usb_mutex);
78
79 return ret;
80}
81
82static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d)
83{
84 int ret;
85 const struct firmware *fw = NULL;
86 u8 *ptr, *buf;
87 if ((ret = request_firmware(&fw, bcm4500_firmware,
88 &d->udev->dev)) != 0) {
89 err("did not find the bcm4500 firmware file. (%s) "
90 "Please see linux/Documentation/dvb/ for more details on firmware-problems. (%d)",
91 bcm4500_firmware,ret);
92 return ret;
93 }
94
95 ret = -EINVAL;
96
97 if (gp8psk_usb_out_op(d, LOAD_BCM4500,1,0,NULL, 0))
98 goto out_rel_fw;
99
100 info("downloaidng bcm4500 firmware from file '%s'",bcm4500_firmware);
101
102 ptr = fw->data;
103 buf = kmalloc(512, GFP_KERNEL | GFP_DMA);
104
105 while (ptr[0] != 0xff) {
106 u16 buflen = ptr[0] + 4;
107 if (ptr + buflen >= fw->data + fw->size) {
108 err("failed to load bcm4500 firmware.");
109 goto out_free;
110 }
111 memcpy(buf, ptr, buflen);
112 if (dvb_usb_generic_write(d, buf, buflen)) {
113 err("failed to load bcm4500 firmware.");
114 goto out_free;
115 }
116 ptr += buflen;
117 }
118
119 ret = 0;
120
121out_free:
122 kfree(buf);
123out_rel_fw:
124 release_firmware(fw);
125
126 return ret;
127}
128
129static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff)
130{
131 u8 status, buf;
132 if (onoff) {
133 gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1);
134 if (! (status & 0x01)) /* started */
135 if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1))
136 return -EINVAL;
137
138 if (! (status & 0x02)) /* BCM4500 firmware loaded */
139 if(gp8psk_load_bcm4500fw(d))
140 return EINVAL;
141
142 if (! (status & 0x04)) /* LNB Power */
143 if (gp8psk_usb_in_op(d, START_INTERSIL, 1, 0,
144 &buf, 1))
145 return EINVAL;
146
147 /* Set DVB mode */
148 if(gp8psk_usb_out_op(d, SET_DVB_MODE, 1, 0, NULL, 0))
149 return -EINVAL;
150 gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1);
151 } else {
152 /* Turn off LNB power */
153 if (gp8psk_usb_in_op(d, START_INTERSIL, 0, 0, &buf, 1))
154 return EINVAL;
155 /* Turn off 8psk power */
156 if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1))
157 return -EINVAL;
158
159 }
160 return 0;
161}
162
163
164static int gp8psk_streaming_ctrl(struct dvb_usb_device *d, int onoff)
165{
166 return gp8psk_usb_out_op(d, ARM_TRANSFER, onoff, 0 , NULL, 0);
167}
168
169static int gp8psk_frontend_attach(struct dvb_usb_device *d)
170{
171 d->fe = gp8psk_fe_attach(d);
172
173 return 0;
174}
175
176static struct dvb_usb_properties gp8psk_properties;
177
178static int gp8psk_usb_probe(struct usb_interface *intf,
179 const struct usb_device_id *id)
180{
181 return dvb_usb_device_init(intf,&gp8psk_properties,THIS_MODULE,NULL);
182}
183
184static struct usb_device_id gp8psk_usb_table [] = {
185 { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_COLD) },
186 { USB_DEVICE(USB_VID_GENPIX, USB_PID_GENPIX_8PSK_WARM) },
187 { 0 },
188};
189MODULE_DEVICE_TABLE(usb, gp8psk_usb_table);
190
191static struct dvb_usb_properties gp8psk_properties = {
192 .caps = 0,
193
194 .usb_ctrl = CYPRESS_FX2,
195 .firmware = "dvb-usb-gp8psk-01.fw",
196
197 .streaming_ctrl = gp8psk_streaming_ctrl,
198 .power_ctrl = gp8psk_power_ctrl,
199 .frontend_attach = gp8psk_frontend_attach,
200
201 .generic_bulk_ctrl_endpoint = 0x01,
202 /* parameter for the MPEG2-data transfer */
203 .urb = {
204 .type = DVB_USB_BULK,
205 .count = 7,
206 .endpoint = 0x82,
207 .u = {
208 .bulk = {
209 .buffersize = 8192,
210 }
211 }
212 },
213
214 .num_device_descs = 1,
215 .devices = {
216 { .name = "Genpix 8PSK-USB DVB-S USB2.0 receiver",
217 .cold_ids = { &gp8psk_usb_table[0], NULL },
218 .warm_ids = { &gp8psk_usb_table[1], NULL },
219 },
220 { 0 },
221 }
222};
223
224/* usb specific object needed to register this driver with the usb subsystem */
225static struct usb_driver gp8psk_usb_driver = {
226 .name = "dvb_usb_gp8psk",
227 .probe = gp8psk_usb_probe,
228 .disconnect = dvb_usb_device_exit,
229 .id_table = gp8psk_usb_table,
230};
231
232/* module stuff */
233static int __init gp8psk_usb_module_init(void)
234{
235 int result;
236 if ((result = usb_register(&gp8psk_usb_driver))) {
237 err("usb_register failed. (%d)",result);
238 return result;
239 }
240
241 return 0;
242}
243
244static void __exit gp8psk_usb_module_exit(void)
245{
246 /* deregister this driver from the USB subsystem */
247 usb_deregister(&gp8psk_usb_driver);
248}
249
250module_init(gp8psk_usb_module_init);
251module_exit(gp8psk_usb_module_exit);
252
253MODULE_AUTHOR("Alan Nisota <alannisota@gamil.com>");
254MODULE_DESCRIPTION("Driver for Genpix 8psk-USB DVB-S USB2.0");
255MODULE_VERSION("1.0");
256MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.h b/drivers/media/dvb/dvb-usb/gp8psk.h
new file mode 100644
index 000000000000..3eba7061011c
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/gp8psk.h
@@ -0,0 +1,79 @@
1/* DVB USB compliant Linux driver for the
2 * - GENPIX 8pks/qpsk USB2.0 DVB-S module
3 *
4 * Copyright (C) 2006 Alan Nisota (alannisota@gmail.com)
5 *
6 * Thanks to GENPIX for the sample code used to implement this module.
7 *
8 * This module is based off the vp7045 and vp702x modules
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation, version 2.
13 *
14 * see Documentation/dvb/README.dvb-usb for more information
15 */
16#ifndef _DVB_USB_GP8PSK_H_
17#define _DVB_USB_GP8PSK_H_
18
19#define DVB_USB_LOG_PREFIX "gp8psk"
20#include "dvb-usb.h"
21
22extern int dvb_usb_gp8psk_debug;
23#define deb_info(args...) dprintk(dvb_usb_gp8psk_debug,0x01,args)
24#define deb_xfer(args...) dprintk(dvb_usb_gp8psk_debug,0x02,args)
25#define deb_rc(args...) dprintk(dvb_usb_gp8psk_debug,0x04,args)
26#define deb_fe(args...) dprintk(dvb_usb_gp8psk_debug,0x08,args)
27/* gp8psk commands */
28
29/* Twinhan Vendor requests */
30#define TH_COMMAND_IN 0xC0
31#define TH_COMMAND_OUT 0xC1
32
33/* command bytes */
34#define GET_8PSK_CONFIG 0x80
35#define SET_8PSK_CONFIG 0x81
36#define ARM_TRANSFER 0x85
37#define TUNE_8PSK 0x86
38#define GET_SIGNAL_STRENGTH 0x87
39#define LOAD_BCM4500 0x88
40#define BOOT_8PSK 0x89
41#define START_INTERSIL 0x8A
42#define SET_LNB_VOLTAGE 0x8B
43#define SET_22KHZ_TONE 0x8C
44#define SEND_DISEQC_COMMAND 0x8D
45#define SET_DVB_MODE 0x8E
46#define SET_DN_SWITCH 0x8F
47#define GET_SIGNAL_LOCK 0x90
48
49/* Satellite modulation modes */
50#define ADV_MOD_DVB_QPSK 0 /* DVB-S QPSK */
51#define ADV_MOD_TURBO_QPSK 1 /* Turbo QPSK */
52#define ADV_MOD_TURBO_8PSK 2 /* Turbo 8PSK (also used for Trellis 8PSK) */
53#define ADV_MOD_TURBO_16QAM 3 /* Turbo 16QAM (also used for Trellis 8PSK) */
54
55#define ADV_MOD_DCII_C_QPSK 4 /* Digicipher II Combo */
56#define ADV_MOD_DCII_I_QPSK 5 /* Digicipher II I-stream */
57#define ADV_MOD_DCII_Q_QPSK 6 /* Digicipher II Q-stream */
58#define ADV_MOD_DCII_C_OQPSK 7 /* Digicipher II offset QPSK */
59#define ADV_MOD_DSS_QPSK 8 /* DSS (DIRECTV) QPSK */
60#define ADV_MOD_DVB_BPSK 9 /* DVB-S BPSK */
61
62#define GET_USB_SPEED 0x07
63 #define USB_SPEED_LOW 0
64 #define USB_SPEED_FULL 1
65 #define USB_SPEED_HIGH 2
66
67#define RESET_FX2 0x13
68
69#define FW_VERSION_READ 0x0B
70#define VENDOR_STRING_READ 0x0C
71#define PRODUCT_STRING_READ 0x0D
72#define FW_BCD_VERSION_READ 0x14
73
74extern struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d);
75extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
76extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
77 u16 index, u8 *b, int blen);
78
79#endif
diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c
index 14f1911c79bb..97d74da0dad8 100644
--- a/drivers/media/dvb/dvb-usb/umt-010.c
+++ b/drivers/media/dvb/dvb-usb/umt-010.c
@@ -57,7 +57,6 @@ static int umt_mt352_frontend_attach(struct dvb_usb_device *d)
57 memset(&umt_config,0,sizeof(struct mt352_config)); 57 memset(&umt_config,0,sizeof(struct mt352_config));
58 umt_config.demod_init = umt_mt352_demod_init; 58 umt_config.demod_init = umt_mt352_demod_init;
59 umt_config.demod_address = 0xf; 59 umt_config.demod_address = 0xf;
60 umt_config.pll_set = dvb_usb_pll_set;
61 60
62 d->fe = mt352_attach(&umt_config, &d->i2c_adap); 61 d->fe = mt352_attach(&umt_config, &d->i2c_adap);
63 62
@@ -68,6 +67,7 @@ static int umt_tuner_attach (struct dvb_usb_device *d)
68{ 67{
69 d->pll_addr = 0x61; 68 d->pll_addr = 0x61;
70 d->pll_desc = &dvb_pll_tua6034; 69 d->pll_desc = &dvb_pll_tua6034;
70 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
71 return 0; 71 return 0;
72} 72}
73 73
diff --git a/drivers/media/dvb/dvb-usb/vp702x-fe.c b/drivers/media/dvb/dvb-usb/vp702x-fe.c
index 2a89f8c5da99..d4da494132ec 100644
--- a/drivers/media/dvb/dvb-usb/vp702x-fe.c
+++ b/drivers/media/dvb/dvb-usb/vp702x-fe.c
@@ -287,17 +287,16 @@ struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d)
287 goto error; 287 goto error;
288 288
289 s->d = d; 289 s->d = d;
290 s->fe.ops = &vp702x_fe_ops; 290
291 memcpy(&s->fe.ops,&vp702x_fe_ops,sizeof(struct dvb_frontend_ops));
291 s->fe.demodulator_priv = s; 292 s->fe.demodulator_priv = s;
292 293
293 s->lnb_buf[1] = SET_LNB_POWER; 294 s->lnb_buf[1] = SET_LNB_POWER;
294 s->lnb_buf[3] = 0xff; /* 0=tone burst, 2=data burst, ff=off */ 295 s->lnb_buf[3] = 0xff; /* 0=tone burst, 2=data burst, ff=off */
295 296
296 goto success; 297 return &s->fe;
297error: 298error:
298 return NULL; 299 return NULL;
299success:
300 return &s->fe;
301} 300}
302 301
303 302
diff --git a/drivers/media/dvb/dvb-usb/vp7045-fe.c b/drivers/media/dvb/dvb-usb/vp7045-fe.c
index 9999336aeeb6..8452eef90322 100644
--- a/drivers/media/dvb/dvb-usb/vp7045-fe.c
+++ b/drivers/media/dvb/dvb-usb/vp7045-fe.c
@@ -23,8 +23,6 @@
23 23
24struct vp7045_fe_state { 24struct vp7045_fe_state {
25 struct dvb_frontend fe; 25 struct dvb_frontend fe;
26 struct dvb_frontend_ops ops;
27
28 struct dvb_usb_device *d; 26 struct dvb_usb_device *d;
29}; 27};
30 28
@@ -151,15 +149,12 @@ struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d)
151 goto error; 149 goto error;
152 150
153 s->d = d; 151 s->d = d;
154 memcpy(&s->ops, &vp7045_fe_ops, sizeof(struct dvb_frontend_ops)); 152 memcpy(&s->fe.ops, &vp7045_fe_ops, sizeof(struct dvb_frontend_ops));
155 s->fe.ops = &s->ops;
156 s->fe.demodulator_priv = s; 153 s->fe.demodulator_priv = s;
157 154
158 goto success; 155 return &s->fe;
159error: 156error:
160 return NULL; 157 return NULL;
161success:
162 return &s->fe;
163} 158}
164 159
165 160