aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c42
-rw-r--r--drivers/media/dvb/frontends/tda18271-tables.c2
-rw-r--r--drivers/media/dvb/frontends/tda18271.h1
3 files changed, 32 insertions, 13 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c
index aa93e1550627..7d218819b285 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -49,7 +49,8 @@ static int tda18271_ir_cal_init(struct dvb_frontend *fe)
49/* ------------------------------------------------------------------ */ 49/* ------------------------------------------------------------------ */
50 50
51static int tda18271_channel_configuration(struct dvb_frontend *fe, 51static int tda18271_channel_configuration(struct dvb_frontend *fe,
52 u32 ifc, u32 freq, u32 bw, u8 std) 52 u32 ifc, u32 freq, u32 bw, u8 std,
53 int radio)
53{ 54{
54 struct tda18271_priv *priv = fe->tuner_priv; 55 struct tda18271_priv *priv = fe->tuner_priv;
55 unsigned char *regs = priv->tda18271_regs; 56 unsigned char *regs = priv->tda18271_regs;
@@ -76,7 +77,11 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
76 regs[R_MPD] |= 0x80; /* IF notch = 1 */ 77 regs[R_MPD] |= 0x80; /* IF notch = 1 */
77 break; 78 break;
78 } 79 }
79 regs[R_EP4] &= ~0x80; /* FM_RFn: turn this bit on only for fm radio */ 80
81 if (radio)
82 regs[R_EP4] |= 0x80;
83 else
84 regs[R_EP4] &= ~0x80;
80 85
81 /* update RF_TOP / IF_TOP */ 86 /* update RF_TOP / IF_TOP */
82 switch (priv->mode) { 87 switch (priv->mode) {
@@ -615,7 +620,7 @@ static int tda18271_init(struct dvb_frontend *fe)
615} 620}
616 621
617static int tda18271c2_tune(struct dvb_frontend *fe, 622static int tda18271c2_tune(struct dvb_frontend *fe,
618 u32 ifc, u32 freq, u32 bw, u8 std) 623 u32 ifc, u32 freq, u32 bw, u8 std, int radio)
619{ 624{
620 struct tda18271_priv *priv = fe->tuner_priv; 625 struct tda18271_priv *priv = fe->tuner_priv;
621 626
@@ -627,7 +632,7 @@ static int tda18271c2_tune(struct dvb_frontend *fe,
627 632
628 tda18271_rf_tracking_filters_correction(fe, freq); 633 tda18271_rf_tracking_filters_correction(fe, freq);
629 634
630 tda18271_channel_configuration(fe, ifc, freq, bw, std); 635 tda18271_channel_configuration(fe, ifc, freq, bw, std, radio);
631 636
632 mutex_unlock(&priv->lock); 637 mutex_unlock(&priv->lock);
633 638
@@ -637,7 +642,7 @@ static int tda18271c2_tune(struct dvb_frontend *fe,
637/* ------------------------------------------------------------------ */ 642/* ------------------------------------------------------------------ */
638 643
639static int tda18271c1_tune(struct dvb_frontend *fe, 644static int tda18271c1_tune(struct dvb_frontend *fe,
640 u32 ifc, u32 freq, u32 bw, u8 std) 645 u32 ifc, u32 freq, u32 bw, u8 std, int radio)
641{ 646{
642 struct tda18271_priv *priv = fe->tuner_priv; 647 struct tda18271_priv *priv = fe->tuner_priv;
643 unsigned char *regs = priv->tda18271_regs; 648 unsigned char *regs = priv->tda18271_regs;
@@ -769,7 +774,10 @@ static int tda18271c1_tune(struct dvb_frontend *fe,
769 break; 774 break;
770 } 775 }
771 776
772 regs[R_EP4] &= ~0x80; /* turn this bit on only for fm */ 777 if (radio)
778 regs[R_EP4] |= 0x80;
779 else
780 regs[R_EP4] &= ~0x80;
773 781
774 /* image rejection validity */ 782 /* image rejection validity */
775 tda18271_calc_ir_measure(fe, &freq); 783 tda18271_calc_ir_measure(fe, &freq);
@@ -787,17 +795,17 @@ static int tda18271c1_tune(struct dvb_frontend *fe,
787} 795}
788 796
789static inline int tda18271_tune(struct dvb_frontend *fe, 797static inline int tda18271_tune(struct dvb_frontend *fe,
790 u32 ifc, u32 freq, u32 bw, u8 std) 798 u32 ifc, u32 freq, u32 bw, u8 std, int radio)
791{ 799{
792 struct tda18271_priv *priv = fe->tuner_priv; 800 struct tda18271_priv *priv = fe->tuner_priv;
793 int ret = -EINVAL; 801 int ret = -EINVAL;
794 802
795 switch (priv->id) { 803 switch (priv->id) {
796 case TDA18271HDC1: 804 case TDA18271HDC1:
797 ret = tda18271c1_tune(fe, ifc, freq, bw, std); 805 ret = tda18271c1_tune(fe, ifc, freq, bw, std, radio);
798 break; 806 break;
799 case TDA18271HDC2: 807 case TDA18271HDC2:
800 ret = tda18271c2_tune(fe, ifc, freq, bw, std); 808 ret = tda18271c2_tune(fe, ifc, freq, bw, std, radio);
801 break; 809 break;
802 } 810 }
803 return ret; 811 return ret;
@@ -865,7 +873,7 @@ static int tda18271_set_params(struct dvb_frontend *fe,
865 return -EINVAL; 873 return -EINVAL;
866 } 874 }
867 875
868 ret = tda18271_tune(fe, sgIF * 1000, freq, bw, std); 876 ret = tda18271_tune(fe, sgIF * 1000, freq, bw, std, 0);
869 877
870 if (ret < 0) 878 if (ret < 0)
871 goto fail; 879 goto fail;
@@ -883,14 +891,20 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe,
883 struct tda18271_priv *priv = fe->tuner_priv; 891 struct tda18271_priv *priv = fe->tuner_priv;
884 struct tda18271_std_map *std_map = &priv->std; 892 struct tda18271_std_map *std_map = &priv->std;
885 char *mode; 893 char *mode;
886 int ret; 894 int ret, radio = 0;
887 u8 std; 895 u8 std;
888 u16 sgIF; 896 u16 sgIF;
889 u32 freq = params->frequency * 62500; 897 u32 freq = params->frequency * 62500;
890 898
891 priv->mode = TDA18271_ANALOG; 899 priv->mode = TDA18271_ANALOG;
892 900
893 if (params->std & V4L2_STD_MN) { 901 if (params->mode == V4L2_TUNER_RADIO) {
902 radio = 1;
903 freq = freq / 1000;
904 std = std_map->fm_radio.std_bits;
905 sgIF = std_map->fm_radio.if_freq;
906 mode = "fm";
907 } else if (params->std & V4L2_STD_MN) {
894 std = std_map->atv_mn.std_bits; 908 std = std_map->atv_mn.std_bits;
895 sgIF = std_map->atv_mn.if_freq; 909 sgIF = std_map->atv_mn.if_freq;
896 mode = "MN"; 910 mode = "MN";
@@ -926,7 +940,7 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe,
926 940
927 tda_dbg("setting tda18271 to system %s\n", mode); 941 tda_dbg("setting tda18271 to system %s\n", mode);
928 942
929 ret = tda18271_tune(fe, sgIF * 1000, freq, 0, std); 943 ret = tda18271_tune(fe, sgIF * 1000, freq, 0, std, radio);
930 944
931 if (ret < 0) 945 if (ret < 0)
932 goto fail; 946 goto fail;
@@ -994,6 +1008,7 @@ static int tda18271_dump_std_map(struct dvb_frontend *fe)
994 struct tda18271_std_map *std = &priv->std; 1008 struct tda18271_std_map *std = &priv->std;
995 1009
996 tda_dbg("========== STANDARD MAP SETTINGS ==========\n"); 1010 tda_dbg("========== STANDARD MAP SETTINGS ==========\n");
1011 tda18271_dump_std_item(fm_radio, "fm");
997 tda18271_dump_std_item(atv_b, "pal b"); 1012 tda18271_dump_std_item(atv_b, "pal b");
998 tda18271_dump_std_item(atv_dk, "pal dk"); 1013 tda18271_dump_std_item(atv_dk, "pal dk");
999 tda18271_dump_std_item(atv_gh, "pal gh"); 1014 tda18271_dump_std_item(atv_gh, "pal gh");
@@ -1020,6 +1035,7 @@ static int tda18271_update_std_map(struct dvb_frontend *fe,
1020 if (!map) 1035 if (!map)
1021 return -EINVAL; 1036 return -EINVAL;
1022 1037
1038 tda18271_update_std(fm_radio, "fm");
1023 tda18271_update_std(atv_b, "atv b"); 1039 tda18271_update_std(atv_b, "atv b");
1024 tda18271_update_std(atv_dk, "atv dk"); 1040 tda18271_update_std(atv_dk, "atv dk");
1025 tda18271_update_std(atv_gh, "atv gh"); 1041 tda18271_update_std(atv_gh, "atv gh");
diff --git a/drivers/media/dvb/frontends/tda18271-tables.c b/drivers/media/dvb/frontends/tda18271-tables.c
index 0402c7dab19d..e94afcfdc5bc 100644
--- a/drivers/media/dvb/frontends/tda18271-tables.c
+++ b/drivers/media/dvb/frontends/tda18271-tables.c
@@ -1187,6 +1187,7 @@ fail:
1187/*---------------------------------------------------------------------*/ 1187/*---------------------------------------------------------------------*/
1188 1188
1189static struct tda18271_std_map tda18271c1_std_map = { 1189static struct tda18271_std_map tda18271c1_std_map = {
1190 .fm_radio = { .if_freq = 1250, .std_bits = 0x18 },
1190 .atv_b = { .if_freq = 6750, .std_bits = 0x0e }, 1191 .atv_b = { .if_freq = 6750, .std_bits = 0x0e },
1191 .atv_dk = { .if_freq = 7750, .std_bits = 0x0f }, 1192 .atv_dk = { .if_freq = 7750, .std_bits = 0x0f },
1192 .atv_gh = { .if_freq = 7750, .std_bits = 0x0f }, 1193 .atv_gh = { .if_freq = 7750, .std_bits = 0x0f },
@@ -1203,6 +1204,7 @@ static struct tda18271_std_map tda18271c1_std_map = {
1203}; 1204};
1204 1205
1205static struct tda18271_std_map tda18271c2_std_map = { 1206static struct tda18271_std_map tda18271c2_std_map = {
1207 .fm_radio = { .if_freq = 1250, .std_bits = 0x18 },
1206 .atv_b = { .if_freq = 6000, .std_bits = 0x0d }, 1208 .atv_b = { .if_freq = 6000, .std_bits = 0x0d },
1207 .atv_dk = { .if_freq = 6900, .std_bits = 0x0e }, 1209 .atv_dk = { .if_freq = 6900, .std_bits = 0x0e },
1208 .atv_gh = { .if_freq = 7100, .std_bits = 0x0e }, 1210 .atv_gh = { .if_freq = 7100, .std_bits = 0x0e },
diff --git a/drivers/media/dvb/frontends/tda18271.h b/drivers/media/dvb/frontends/tda18271.h
index 9ccfa6e8b5a9..24b0e35a2ab3 100644
--- a/drivers/media/dvb/frontends/tda18271.h
+++ b/drivers/media/dvb/frontends/tda18271.h
@@ -30,6 +30,7 @@ struct tda18271_std_map_item {
30}; 30};
31 31
32struct tda18271_std_map { 32struct tda18271_std_map {
33 struct tda18271_std_map_item fm_radio;
33 struct tda18271_std_map_item atv_b; 34 struct tda18271_std_map_item atv_b;
34 struct tda18271_std_map_item atv_dk; 35 struct tda18271_std_map_item atv_dk;
35 struct tda18271_std_map_item atv_gh; 36 struct tda18271_std_map_item atv_gh;