diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-21 06:15:29 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-31 05:27:34 -0500 |
commit | 5ca1c94deafa6bdd68a9a7e65e4b3fbb39cfcfa5 (patch) | |
tree | d852cea5555f76e5e1846ef90471ddb1aa4ff0f0 | |
parent | ce0e93a52a01d0074b2bd12c056cbbf7a8a300c4 (diff) |
[media] tda18271-fe: use DVBv5 parameters on set_params()
Instead of using DVBv3 parameters, rely on DVBv5 parameters to
set the tuner.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/common/tuners/tda18271-fe.c | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 3347c5b488dd..6348bb302139 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -931,56 +931,51 @@ fail: | |||
931 | static int tda18271_set_params(struct dvb_frontend *fe, | 931 | static int tda18271_set_params(struct dvb_frontend *fe, |
932 | struct dvb_frontend_parameters *params) | 932 | struct dvb_frontend_parameters *params) |
933 | { | 933 | { |
934 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
935 | u32 delsys = c->delivery_system; | ||
936 | u32 bw = c->bandwidth_hz; | ||
937 | u32 freq = c->frequency; | ||
938 | u32 band = BANDWIDTH_6_MHZ; | ||
934 | struct tda18271_priv *priv = fe->tuner_priv; | 939 | struct tda18271_priv *priv = fe->tuner_priv; |
935 | struct tda18271_std_map *std_map = &priv->std; | 940 | struct tda18271_std_map *std_map = &priv->std; |
936 | struct tda18271_std_map_item *map; | 941 | struct tda18271_std_map_item *map; |
937 | int ret; | 942 | int ret; |
938 | u32 bw, freq = params->frequency; | ||
939 | 943 | ||
940 | priv->mode = TDA18271_DIGITAL; | 944 | priv->mode = TDA18271_DIGITAL; |
941 | 945 | ||
942 | if (fe->ops.info.type == FE_ATSC) { | 946 | switch (delsys) { |
943 | switch (params->u.vsb.modulation) { | 947 | case SYS_ATSC: |
944 | case VSB_8: | 948 | map = &std_map->atsc_6; |
945 | case VSB_16: | ||
946 | map = &std_map->atsc_6; | ||
947 | break; | ||
948 | case QAM_64: | ||
949 | case QAM_256: | ||
950 | map = &std_map->qam_6; | ||
951 | break; | ||
952 | default: | ||
953 | tda_warn("modulation not set!\n"); | ||
954 | return -EINVAL; | ||
955 | } | ||
956 | #if 0 | ||
957 | /* userspace request is already center adjusted */ | ||
958 | freq += 1750000; /* Adjust to center (+1.75MHZ) */ | ||
959 | #endif | ||
960 | bw = 6000000; | 949 | bw = 6000000; |
961 | } else if (fe->ops.info.type == FE_OFDM) { | 950 | break; |
962 | switch (params->u.ofdm.bandwidth) { | 951 | case SYS_DVBT: |
963 | case BANDWIDTH_6_MHZ: | 952 | case SYS_DVBT2: |
964 | bw = 6000000; | 953 | if (bw <= 6000000) { |
965 | map = &std_map->dvbt_6; | 954 | map = &std_map->dvbt_6; |
966 | break; | 955 | } else if (bw <= 7000000) { |
967 | case BANDWIDTH_7_MHZ: | ||
968 | bw = 7000000; | ||
969 | map = &std_map->dvbt_7; | 956 | map = &std_map->dvbt_7; |
970 | break; | 957 | band = BANDWIDTH_7_MHZ; |
971 | case BANDWIDTH_8_MHZ: | 958 | } else { |
972 | bw = 8000000; | ||
973 | map = &std_map->dvbt_8; | 959 | map = &std_map->dvbt_8; |
974 | break; | 960 | band = BANDWIDTH_8_MHZ; |
975 | default: | ||
976 | tda_warn("bandwidth not set!\n"); | ||
977 | return -EINVAL; | ||
978 | } | 961 | } |
979 | } else if (fe->ops.info.type == FE_QAM) { | 962 | break; |
980 | /* DVB-C */ | 963 | case SYS_DVBC_ANNEX_B: |
981 | map = &std_map->qam_8; | 964 | bw = 6000000; |
982 | bw = 8000000; | 965 | /* falltrough */ |
983 | } else { | 966 | case SYS_DVBC_ANNEX_A: |
967 | case SYS_DVBC_ANNEX_C: | ||
968 | if (bw <= 6000000) { | ||
969 | map = &std_map->qam_6; | ||
970 | } else if (bw <= 7000000) { | ||
971 | map = &std_map->qam_7; | ||
972 | band = BANDWIDTH_7_MHZ; | ||
973 | } else { | ||
974 | map = &std_map->qam_8; | ||
975 | band = BANDWIDTH_8_MHZ; | ||
976 | } | ||
977 | break; | ||
978 | default: | ||
984 | tda_warn("modulation type not supported!\n"); | 979 | tda_warn("modulation type not supported!\n"); |
985 | return -EINVAL; | 980 | return -EINVAL; |
986 | } | 981 | } |
@@ -996,8 +991,7 @@ static int tda18271_set_params(struct dvb_frontend *fe, | |||
996 | 991 | ||
997 | priv->if_freq = map->if_freq; | 992 | priv->if_freq = map->if_freq; |
998 | priv->frequency = freq; | 993 | priv->frequency = freq; |
999 | priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? | 994 | priv->bandwidth = band; |
1000 | params->u.ofdm.bandwidth : 0; | ||
1001 | fail: | 995 | fail: |
1002 | return ret; | 996 | return ret; |
1003 | } | 997 | } |