aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/tda18271-fe.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-15 15:49:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-15 15:49:56 -0500
commit122804ecb59493fbb4d31b3ba9ac59faaf45276f (patch)
treecff4d8a158c412e4a8d3abc8d91bb0eb52b01c9a /drivers/media/common/tuners/tda18271-fe.c
parent16008d641670571ff4cd750b416c7caf2d89f467 (diff)
parent126400033940afb658123517a2e80eb68259fbd7 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (655 commits) [media] revert patch: HDIC HD29L2 DMB-TH USB2.0 reference design driver mb86a20s: Add a few more register settings at the init seq mb86a20s: Group registers into the same line [media] [PATCH] don't reset the delivery system on DTV_CLEAR [media] [BUG] it913x-fe fix typo error making SNR levels unstable [media] cx23885: Query the CX25840 during enum_input for status [media] cx25840: Add support for g_input_status [media] rc-videomate-m1f.c Rename to match remote controler name [media] drivers: media: au0828: Fix dependency for VIDEO_AU0828 [media] convert drivers/media/* to use module_platform_driver() [media] drivers: video: cx231xx: Fix dependency for VIDEO_CX231XX_DVB [media] Exynos4 JPEG codec v4l2 driver [media] doc: v4l: selection: choose pixels as units for selection rectangles [media] v4l: s5p-tv: mixer: fix setup of VP scaling [media] v4l: s5p-tv: mixer: add support for selection API [media] v4l: emulate old crop API using extended crop/compose API [media] doc: v4l: add documentation for selection API [media] doc: v4l: add binary images for selection API [media] v4l: add support for selection api [media] hd29l2: fix review findings ...
Diffstat (limited to 'drivers/media/common/tuners/tda18271-fe.c')
-rw-r--r--drivers/media/common/tuners/tda18271-fe.c83
1 files changed, 41 insertions, 42 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c
index 63cc4004e211..2e67f4459904 100644
--- a/drivers/media/common/tuners/tda18271-fe.c
+++ b/drivers/media/common/tuners/tda18271-fe.c
@@ -928,59 +928,49 @@ fail:
928 928
929/* ------------------------------------------------------------------ */ 929/* ------------------------------------------------------------------ */
930 930
931static int tda18271_set_params(struct dvb_frontend *fe, 931static int tda18271_set_params(struct dvb_frontend *fe)
932 struct dvb_frontend_parameters *params)
933{ 932{
933 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
934 u32 delsys = c->delivery_system;
935 u32 bw = c->bandwidth_hz;
936 u32 freq = c->frequency;
934 struct tda18271_priv *priv = fe->tuner_priv; 937 struct tda18271_priv *priv = fe->tuner_priv;
935 struct tda18271_std_map *std_map = &priv->std; 938 struct tda18271_std_map *std_map = &priv->std;
936 struct tda18271_std_map_item *map; 939 struct tda18271_std_map_item *map;
937 int ret; 940 int ret;
938 u32 bw, freq = params->frequency;
939 941
940 priv->mode = TDA18271_DIGITAL; 942 priv->mode = TDA18271_DIGITAL;
941 943
942 if (fe->ops.info.type == FE_ATSC) { 944 switch (delsys) {
943 switch (params->u.vsb.modulation) { 945 case SYS_ATSC:
944 case VSB_8: 946 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; 947 bw = 6000000;
961 } else if (fe->ops.info.type == FE_OFDM) { 948 break;
962 switch (params->u.ofdm.bandwidth) { 949 case SYS_ISDBT:
963 case BANDWIDTH_6_MHZ: 950 case SYS_DVBT:
964 bw = 6000000; 951 case SYS_DVBT2:
952 if (bw <= 6000000) {
965 map = &std_map->dvbt_6; 953 map = &std_map->dvbt_6;
966 break; 954 } else if (bw <= 7000000) {
967 case BANDWIDTH_7_MHZ:
968 bw = 7000000;
969 map = &std_map->dvbt_7; 955 map = &std_map->dvbt_7;
970 break; 956 } else {
971 case BANDWIDTH_8_MHZ:
972 bw = 8000000;
973 map = &std_map->dvbt_8; 957 map = &std_map->dvbt_8;
974 break;
975 default:
976 tda_warn("bandwidth not set!\n");
977 return -EINVAL;
978 } 958 }
979 } else if (fe->ops.info.type == FE_QAM) { 959 break;
980 /* DVB-C */ 960 case SYS_DVBC_ANNEX_B:
981 map = &std_map->qam_8; 961 bw = 6000000;
982 bw = 8000000; 962 /* falltrough */
983 } else { 963 case SYS_DVBC_ANNEX_A:
964 case SYS_DVBC_ANNEX_C:
965 if (bw <= 6000000) {
966 map = &std_map->qam_6;
967 } else if (bw <= 7000000) {
968 map = &std_map->qam_7;
969 } else {
970 map = &std_map->qam_8;
971 }
972 break;
973 default:
984 tda_warn("modulation type not supported!\n"); 974 tda_warn("modulation type not supported!\n");
985 return -EINVAL; 975 return -EINVAL;
986 } 976 }
@@ -994,9 +984,9 @@ static int tda18271_set_params(struct dvb_frontend *fe,
994 if (tda_fail(ret)) 984 if (tda_fail(ret))
995 goto fail; 985 goto fail;
996 986
987 priv->if_freq = map->if_freq;
997 priv->frequency = freq; 988 priv->frequency = freq;
998 priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? 989 priv->bandwidth = bw;
999 params->u.ofdm.bandwidth : 0;
1000fail: 990fail:
1001 return ret; 991 return ret;
1002} 992}
@@ -1050,6 +1040,7 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe,
1050 if (tda_fail(ret)) 1040 if (tda_fail(ret))
1051 goto fail; 1041 goto fail;
1052 1042
1043 priv->if_freq = map->if_freq;
1053 priv->frequency = freq; 1044 priv->frequency = freq;
1054 priv->bandwidth = 0; 1045 priv->bandwidth = 0;
1055fail: 1046fail:
@@ -1086,6 +1077,13 @@ static int tda18271_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
1086 return 0; 1077 return 0;
1087} 1078}
1088 1079
1080static int tda18271_get_if_frequency(struct dvb_frontend *fe, u32 *frequency)
1081{
1082 struct tda18271_priv *priv = fe->tuner_priv;
1083 *frequency = (u32)priv->if_freq * 1000;
1084 return 0;
1085}
1086
1089/* ------------------------------------------------------------------ */ 1087/* ------------------------------------------------------------------ */
1090 1088
1091#define tda18271_update_std(std_cfg, name) do { \ 1089#define tda18271_update_std(std_cfg, name) do { \
@@ -1245,6 +1243,7 @@ static const struct dvb_tuner_ops tda18271_tuner_ops = {
1245 .set_config = tda18271_set_config, 1243 .set_config = tda18271_set_config,
1246 .get_frequency = tda18271_get_frequency, 1244 .get_frequency = tda18271_get_frequency,
1247 .get_bandwidth = tda18271_get_bandwidth, 1245 .get_bandwidth = tda18271_get_bandwidth,
1246 .get_if_frequency = tda18271_get_if_frequency,
1248}; 1247};
1249 1248
1250struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, 1249struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,