aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/lgdt3305.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/lgdt3305.c')
-rw-r--r--drivers/media/dvb/frontends/lgdt3305.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/drivers/media/dvb/frontends/lgdt3305.c b/drivers/media/dvb/frontends/lgdt3305.c
index 3272881cb112..1d2c47378cf8 100644
--- a/drivers/media/dvb/frontends/lgdt3305.c
+++ b/drivers/media/dvb/frontends/lgdt3305.c
@@ -266,7 +266,7 @@ fail:
266} 266}
267 267
268static int lgdt3305_set_modulation(struct lgdt3305_state *state, 268static int lgdt3305_set_modulation(struct lgdt3305_state *state,
269 struct dvb_frontend_parameters *param) 269 struct dtv_frontend_properties *p)
270{ 270{
271 u8 opermode; 271 u8 opermode;
272 int ret; 272 int ret;
@@ -279,7 +279,7 @@ static int lgdt3305_set_modulation(struct lgdt3305_state *state,
279 279
280 opermode &= ~0x03; 280 opermode &= ~0x03;
281 281
282 switch (param->u.vsb.modulation) { 282 switch (p->modulation) {
283 case VSB_8: 283 case VSB_8:
284 opermode |= 0x03; 284 opermode |= 0x03;
285 break; 285 break;
@@ -298,11 +298,11 @@ fail:
298} 298}
299 299
300static int lgdt3305_set_filter_extension(struct lgdt3305_state *state, 300static int lgdt3305_set_filter_extension(struct lgdt3305_state *state,
301 struct dvb_frontend_parameters *param) 301 struct dtv_frontend_properties *p)
302{ 302{
303 int val; 303 int val;
304 304
305 switch (param->u.vsb.modulation) { 305 switch (p->modulation) {
306 case VSB_8: 306 case VSB_8:
307 val = 0; 307 val = 0;
308 break; 308 break;
@@ -321,11 +321,11 @@ static int lgdt3305_set_filter_extension(struct lgdt3305_state *state,
321/* ------------------------------------------------------------------------ */ 321/* ------------------------------------------------------------------------ */
322 322
323static int lgdt3305_passband_digital_agc(struct lgdt3305_state *state, 323static int lgdt3305_passband_digital_agc(struct lgdt3305_state *state,
324 struct dvb_frontend_parameters *param) 324 struct dtv_frontend_properties *p)
325{ 325{
326 u16 agc_ref; 326 u16 agc_ref;
327 327
328 switch (param->u.vsb.modulation) { 328 switch (p->modulation) {
329 case VSB_8: 329 case VSB_8:
330 agc_ref = 0x32c4; 330 agc_ref = 0x32c4;
331 break; 331 break;
@@ -348,11 +348,11 @@ static int lgdt3305_passband_digital_agc(struct lgdt3305_state *state,
348} 348}
349 349
350static int lgdt3305_rfagc_loop(struct lgdt3305_state *state, 350static int lgdt3305_rfagc_loop(struct lgdt3305_state *state,
351 struct dvb_frontend_parameters *param) 351 struct dtv_frontend_properties *p)
352{ 352{
353 u16 ifbw, rfbw, agcdelay; 353 u16 ifbw, rfbw, agcdelay;
354 354
355 switch (param->u.vsb.modulation) { 355 switch (p->modulation) {
356 case VSB_8: 356 case VSB_8:
357 agcdelay = 0x04c0; 357 agcdelay = 0x04c0;
358 rfbw = 0x8000; 358 rfbw = 0x8000;
@@ -398,11 +398,11 @@ static int lgdt3305_rfagc_loop(struct lgdt3305_state *state,
398} 398}
399 399
400static int lgdt3305_agc_setup(struct lgdt3305_state *state, 400static int lgdt3305_agc_setup(struct lgdt3305_state *state,
401 struct dvb_frontend_parameters *param) 401 struct dtv_frontend_properties *p)
402{ 402{
403 int lockdten, acqen; 403 int lockdten, acqen;
404 404
405 switch (param->u.vsb.modulation) { 405 switch (p->modulation) {
406 case VSB_8: 406 case VSB_8:
407 lockdten = 0; 407 lockdten = 0;
408 acqen = 0; 408 acqen = 0;
@@ -432,15 +432,15 @@ static int lgdt3305_agc_setup(struct lgdt3305_state *state,
432 return -EINVAL; 432 return -EINVAL;
433 } 433 }
434 434
435 return lgdt3305_rfagc_loop(state, param); 435 return lgdt3305_rfagc_loop(state, p);
436} 436}
437 437
438static int lgdt3305_set_agc_power_ref(struct lgdt3305_state *state, 438static int lgdt3305_set_agc_power_ref(struct lgdt3305_state *state,
439 struct dvb_frontend_parameters *param) 439 struct dtv_frontend_properties *p)
440{ 440{
441 u16 usref = 0; 441 u16 usref = 0;
442 442
443 switch (param->u.vsb.modulation) { 443 switch (p->modulation) {
444 case VSB_8: 444 case VSB_8:
445 if (state->cfg->usref_8vsb) 445 if (state->cfg->usref_8vsb)
446 usref = state->cfg->usref_8vsb; 446 usref = state->cfg->usref_8vsb;
@@ -473,14 +473,14 @@ static int lgdt3305_set_agc_power_ref(struct lgdt3305_state *state,
473/* ------------------------------------------------------------------------ */ 473/* ------------------------------------------------------------------------ */
474 474
475static int lgdt3305_spectral_inversion(struct lgdt3305_state *state, 475static int lgdt3305_spectral_inversion(struct lgdt3305_state *state,
476 struct dvb_frontend_parameters *param, 476 struct dtv_frontend_properties *p,
477 int inversion) 477 int inversion)
478{ 478{
479 int ret; 479 int ret;
480 480
481 lg_dbg("(%d)\n", inversion); 481 lg_dbg("(%d)\n", inversion);
482 482
483 switch (param->u.vsb.modulation) { 483 switch (p->modulation) {
484 case VSB_8: 484 case VSB_8:
485 ret = lgdt3305_write_reg(state, LGDT3305_CR_CTRL_7, 485 ret = lgdt3305_write_reg(state, LGDT3305_CR_CTRL_7,
486 inversion ? 0xf9 : 0x79); 486 inversion ? 0xf9 : 0x79);
@@ -497,13 +497,13 @@ static int lgdt3305_spectral_inversion(struct lgdt3305_state *state,
497} 497}
498 498
499static int lgdt3305_set_if(struct lgdt3305_state *state, 499static int lgdt3305_set_if(struct lgdt3305_state *state,
500 struct dvb_frontend_parameters *param) 500 struct dtv_frontend_properties *p)
501{ 501{
502 u16 if_freq_khz; 502 u16 if_freq_khz;
503 u8 nco1, nco2, nco3, nco4; 503 u8 nco1, nco2, nco3, nco4;
504 u64 nco; 504 u64 nco;
505 505
506 switch (param->u.vsb.modulation) { 506 switch (p->modulation) {
507 case VSB_8: 507 case VSB_8:
508 if_freq_khz = state->cfg->vsb_if_khz; 508 if_freq_khz = state->cfg->vsb_if_khz;
509 break; 509 break;
@@ -517,7 +517,7 @@ static int lgdt3305_set_if(struct lgdt3305_state *state,
517 517
518 nco = if_freq_khz / 10; 518 nco = if_freq_khz / 10;
519 519
520 switch (param->u.vsb.modulation) { 520 switch (p->modulation) {
521 case VSB_8: 521 case VSB_8:
522 nco <<= 24; 522 nco <<= 24;
523 do_div(nco, 625); 523 do_div(nco, 625);
@@ -677,37 +677,37 @@ fail:
677 return ret; 677 return ret;
678} 678}
679 679
680static int lgdt3304_set_parameters(struct dvb_frontend *fe, 680static int lgdt3304_set_parameters(struct dvb_frontend *fe)
681 struct dvb_frontend_parameters *param)
682{ 681{
682 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
683 struct lgdt3305_state *state = fe->demodulator_priv; 683 struct lgdt3305_state *state = fe->demodulator_priv;
684 int ret; 684 int ret;
685 685
686 lg_dbg("(%d, %d)\n", param->frequency, param->u.vsb.modulation); 686 lg_dbg("(%d, %d)\n", p->frequency, p->modulation);
687 687
688 if (fe->ops.tuner_ops.set_params) { 688 if (fe->ops.tuner_ops.set_params) {
689 ret = fe->ops.tuner_ops.set_params(fe, param); 689 ret = fe->ops.tuner_ops.set_params(fe);
690 if (fe->ops.i2c_gate_ctrl) 690 if (fe->ops.i2c_gate_ctrl)
691 fe->ops.i2c_gate_ctrl(fe, 0); 691 fe->ops.i2c_gate_ctrl(fe, 0);
692 if (lg_fail(ret)) 692 if (lg_fail(ret))
693 goto fail; 693 goto fail;
694 state->current_frequency = param->frequency; 694 state->current_frequency = p->frequency;
695 } 695 }
696 696
697 ret = lgdt3305_set_modulation(state, param); 697 ret = lgdt3305_set_modulation(state, p);
698 if (lg_fail(ret)) 698 if (lg_fail(ret))
699 goto fail; 699 goto fail;
700 700
701 ret = lgdt3305_passband_digital_agc(state, param); 701 ret = lgdt3305_passband_digital_agc(state, p);
702 if (lg_fail(ret)) 702 if (lg_fail(ret))
703 goto fail; 703 goto fail;
704 704
705 ret = lgdt3305_agc_setup(state, param); 705 ret = lgdt3305_agc_setup(state, p);
706 if (lg_fail(ret)) 706 if (lg_fail(ret))
707 goto fail; 707 goto fail;
708 708
709 /* reg 0x030d is 3304-only... seen in vsb and qam usbsnoops... */ 709 /* reg 0x030d is 3304-only... seen in vsb and qam usbsnoops... */
710 switch (param->u.vsb.modulation) { 710 switch (p->modulation) {
711 case VSB_8: 711 case VSB_8:
712 lgdt3305_write_reg(state, 0x030d, 0x00); 712 lgdt3305_write_reg(state, 0x030d, 0x00);
713 lgdt3305_write_reg(state, LGDT3305_CR_CTR_FREQ_1, 0x4f); 713 lgdt3305_write_reg(state, LGDT3305_CR_CTR_FREQ_1, 0x4f);
@@ -718,7 +718,7 @@ static int lgdt3304_set_parameters(struct dvb_frontend *fe,
718 case QAM_64: 718 case QAM_64:
719 case QAM_256: 719 case QAM_256:
720 lgdt3305_write_reg(state, 0x030d, 0x14); 720 lgdt3305_write_reg(state, 0x030d, 0x14);
721 ret = lgdt3305_set_if(state, param); 721 ret = lgdt3305_set_if(state, p);
722 if (lg_fail(ret)) 722 if (lg_fail(ret))
723 goto fail; 723 goto fail;
724 break; 724 break;
@@ -727,13 +727,13 @@ static int lgdt3304_set_parameters(struct dvb_frontend *fe,
727 } 727 }
728 728
729 729
730 ret = lgdt3305_spectral_inversion(state, param, 730 ret = lgdt3305_spectral_inversion(state, p,
731 state->cfg->spectral_inversion 731 state->cfg->spectral_inversion
732 ? 1 : 0); 732 ? 1 : 0);
733 if (lg_fail(ret)) 733 if (lg_fail(ret))
734 goto fail; 734 goto fail;
735 735
736 state->current_modulation = param->u.vsb.modulation; 736 state->current_modulation = p->modulation;
737 737
738 ret = lgdt3305_mpeg_mode(state, state->cfg->mpeg_mode); 738 ret = lgdt3305_mpeg_mode(state, state->cfg->mpeg_mode);
739 if (lg_fail(ret)) 739 if (lg_fail(ret))
@@ -747,34 +747,34 @@ fail:
747 return ret; 747 return ret;
748} 748}
749 749
750static int lgdt3305_set_parameters(struct dvb_frontend *fe, 750static int lgdt3305_set_parameters(struct dvb_frontend *fe)
751 struct dvb_frontend_parameters *param)
752{ 751{
752 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
753 struct lgdt3305_state *state = fe->demodulator_priv; 753 struct lgdt3305_state *state = fe->demodulator_priv;
754 int ret; 754 int ret;
755 755
756 lg_dbg("(%d, %d)\n", param->frequency, param->u.vsb.modulation); 756 lg_dbg("(%d, %d)\n", p->frequency, p->modulation);
757 757
758 if (fe->ops.tuner_ops.set_params) { 758 if (fe->ops.tuner_ops.set_params) {
759 ret = fe->ops.tuner_ops.set_params(fe, param); 759 ret = fe->ops.tuner_ops.set_params(fe);
760 if (fe->ops.i2c_gate_ctrl) 760 if (fe->ops.i2c_gate_ctrl)
761 fe->ops.i2c_gate_ctrl(fe, 0); 761 fe->ops.i2c_gate_ctrl(fe, 0);
762 if (lg_fail(ret)) 762 if (lg_fail(ret))
763 goto fail; 763 goto fail;
764 state->current_frequency = param->frequency; 764 state->current_frequency = p->frequency;
765 } 765 }
766 766
767 ret = lgdt3305_set_modulation(state, param); 767 ret = lgdt3305_set_modulation(state, p);
768 if (lg_fail(ret)) 768 if (lg_fail(ret))
769 goto fail; 769 goto fail;
770 770
771 ret = lgdt3305_passband_digital_agc(state, param); 771 ret = lgdt3305_passband_digital_agc(state, p);
772 if (lg_fail(ret)) 772 if (lg_fail(ret))
773 goto fail; 773 goto fail;
774 ret = lgdt3305_set_agc_power_ref(state, param); 774 ret = lgdt3305_set_agc_power_ref(state, p);
775 if (lg_fail(ret)) 775 if (lg_fail(ret))
776 goto fail; 776 goto fail;
777 ret = lgdt3305_agc_setup(state, param); 777 ret = lgdt3305_agc_setup(state, p);
778 if (lg_fail(ret)) 778 if (lg_fail(ret))
779 goto fail; 779 goto fail;
780 780
@@ -786,20 +786,20 @@ static int lgdt3305_set_parameters(struct dvb_frontend *fe,
786 if (lg_fail(ret)) 786 if (lg_fail(ret))
787 goto fail; 787 goto fail;
788 788
789 ret = lgdt3305_set_if(state, param); 789 ret = lgdt3305_set_if(state, p);
790 if (lg_fail(ret)) 790 if (lg_fail(ret))
791 goto fail; 791 goto fail;
792 ret = lgdt3305_spectral_inversion(state, param, 792 ret = lgdt3305_spectral_inversion(state, p,
793 state->cfg->spectral_inversion 793 state->cfg->spectral_inversion
794 ? 1 : 0); 794 ? 1 : 0);
795 if (lg_fail(ret)) 795 if (lg_fail(ret))
796 goto fail; 796 goto fail;
797 797
798 ret = lgdt3305_set_filter_extension(state, param); 798 ret = lgdt3305_set_filter_extension(state, p);
799 if (lg_fail(ret)) 799 if (lg_fail(ret))
800 goto fail; 800 goto fail;
801 801
802 state->current_modulation = param->u.vsb.modulation; 802 state->current_modulation = p->modulation;
803 803
804 ret = lgdt3305_mpeg_mode(state, state->cfg->mpeg_mode); 804 ret = lgdt3305_mpeg_mode(state, state->cfg->mpeg_mode);
805 if (lg_fail(ret)) 805 if (lg_fail(ret))
@@ -813,15 +813,15 @@ fail:
813 return ret; 813 return ret;
814} 814}
815 815
816static int lgdt3305_get_frontend(struct dvb_frontend *fe, 816static int lgdt3305_get_frontend(struct dvb_frontend *fe)
817 struct dvb_frontend_parameters *param)
818{ 817{
818 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
819 struct lgdt3305_state *state = fe->demodulator_priv; 819 struct lgdt3305_state *state = fe->demodulator_priv;
820 820
821 lg_dbg("\n"); 821 lg_dbg("\n");
822 822
823 param->u.vsb.modulation = state->current_modulation; 823 p->modulation = state->current_modulation;
824 param->frequency = state->current_frequency; 824 p->frequency = state->current_frequency;
825 return 0; 825 return 0;
826} 826}
827 827
@@ -1166,9 +1166,9 @@ fail:
1166EXPORT_SYMBOL(lgdt3305_attach); 1166EXPORT_SYMBOL(lgdt3305_attach);
1167 1167
1168static struct dvb_frontend_ops lgdt3304_ops = { 1168static struct dvb_frontend_ops lgdt3304_ops = {
1169 .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
1169 .info = { 1170 .info = {
1170 .name = "LG Electronics LGDT3304 VSB/QAM Frontend", 1171 .name = "LG Electronics LGDT3304 VSB/QAM Frontend",
1171 .type = FE_ATSC,
1172 .frequency_min = 54000000, 1172 .frequency_min = 54000000,
1173 .frequency_max = 858000000, 1173 .frequency_max = 858000000,
1174 .frequency_stepsize = 62500, 1174 .frequency_stepsize = 62500,
@@ -1188,9 +1188,9 @@ static struct dvb_frontend_ops lgdt3304_ops = {
1188}; 1188};
1189 1189
1190static struct dvb_frontend_ops lgdt3305_ops = { 1190static struct dvb_frontend_ops lgdt3305_ops = {
1191 .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
1191 .info = { 1192 .info = {
1192 .name = "LG Electronics LGDT3305 VSB/QAM Frontend", 1193 .name = "LG Electronics LGDT3305 VSB/QAM Frontend",
1193 .type = FE_ATSC,
1194 .frequency_min = 54000000, 1194 .frequency_min = 54000000,
1195 .frequency_max = 858000000, 1195 .frequency_max = 858000000,
1196 .frequency_stepsize = 62500, 1196 .frequency_stepsize = 62500,