diff options
author | Dmitri Belimov <d.belimov@gmail.com> | 2011-02-01 03:25:19 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:32:19 -0400 |
commit | 724dcbfa9c24af5afdaa2b7e0449e20066d6555a (patch) | |
tree | d55b32cf6bc15b28381118102c25d5f8fa4ec833 /drivers/media/common | |
parent | d1303567f7738c07c0e5fd22420a9a8e2f55a0c4 (diff) |
[media] xc5000: add set_config and other
Add one more radio input, usefull for tm6010
Add control output amplitude.
Add set_config function for configure tuner when TV card hasn't dvb part.
Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/tuners/xc5000.c | 38 | ||||
-rw-r--r-- | drivers/media/common/tuners/xc5000.h | 1 |
2 files changed, 37 insertions, 2 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index e3218c97d536..1e28f7dcb26b 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c | |||
@@ -65,7 +65,7 @@ struct xc5000_priv { | |||
65 | }; | 65 | }; |
66 | 66 | ||
67 | /* Misc Defines */ | 67 | /* Misc Defines */ |
68 | #define MAX_TV_STANDARD 23 | 68 | #define MAX_TV_STANDARD 24 |
69 | #define XC_MAX_I2C_WRITE_LENGTH 64 | 69 | #define XC_MAX_I2C_WRITE_LENGTH 64 |
70 | 70 | ||
71 | /* Signal Types */ | 71 | /* Signal Types */ |
@@ -92,6 +92,8 @@ struct xc5000_priv { | |||
92 | #define XREG_IF_OUT 0x05 | 92 | #define XREG_IF_OUT 0x05 |
93 | #define XREG_SEEK_MODE 0x07 | 93 | #define XREG_SEEK_MODE 0x07 |
94 | #define XREG_POWER_DOWN 0x0A /* Obsolete */ | 94 | #define XREG_POWER_DOWN 0x0A /* Obsolete */ |
95 | /* Set the output amplitude - SIF for analog, DTVP/DTVN for digital */ | ||
96 | #define XREG_OUTPUT_AMP 0x0B | ||
95 | #define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */ | 97 | #define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */ |
96 | #define XREG_SMOOTHEDCVBS 0x0E | 98 | #define XREG_SMOOTHEDCVBS 0x0E |
97 | #define XREG_XTALFREQ 0x0F | 99 | #define XREG_XTALFREQ 0x0F |
@@ -173,6 +175,7 @@ struct XC_TV_STANDARD { | |||
173 | #define DTV7 20 | 175 | #define DTV7 20 |
174 | #define FM_Radio_INPUT2 21 | 176 | #define FM_Radio_INPUT2 21 |
175 | #define FM_Radio_INPUT1 22 | 177 | #define FM_Radio_INPUT1 22 |
178 | #define FM_Radio_INPUT1_MONO 23 | ||
176 | 179 | ||
177 | static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { | 180 | static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { |
178 | {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020}, | 181 | {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020}, |
@@ -197,7 +200,8 @@ static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { | |||
197 | {"DTV7/8", 0x00C0, 0x801B}, | 200 | {"DTV7/8", 0x00C0, 0x801B}, |
198 | {"DTV7", 0x00C0, 0x8007}, | 201 | {"DTV7", 0x00C0, 0x8007}, |
199 | {"FM Radio-INPUT2", 0x9802, 0x9002}, | 202 | {"FM Radio-INPUT2", 0x9802, 0x9002}, |
200 | {"FM Radio-INPUT1", 0x0208, 0x9002} | 203 | {"FM Radio-INPUT1", 0x0208, 0x9002}, |
204 | {"FM Radio-INPUT1_MONO", 0x0278, 0x9002} | ||
201 | }; | 205 | }; |
202 | 206 | ||
203 | static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe); | 207 | static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe); |
@@ -732,6 +736,8 @@ static int xc5000_set_params(struct dvb_frontend *fe, | |||
732 | return -EIO; | 736 | return -EIO; |
733 | } | 737 | } |
734 | 738 | ||
739 | xc_write_reg(priv, XREG_OUTPUT_AMP, 0x8a); | ||
740 | |||
735 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); | 741 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); |
736 | 742 | ||
737 | if (debug) | 743 | if (debug) |
@@ -836,6 +842,8 @@ tune_channel: | |||
836 | return -EREMOTEIO; | 842 | return -EREMOTEIO; |
837 | } | 843 | } |
838 | 844 | ||
845 | xc_write_reg(priv, XREG_OUTPUT_AMP, 0x09); | ||
846 | |||
839 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); | 847 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); |
840 | 848 | ||
841 | if (debug) | 849 | if (debug) |
@@ -863,6 +871,8 @@ static int xc5000_set_radio_freq(struct dvb_frontend *fe, | |||
863 | radio_input = FM_Radio_INPUT1; | 871 | radio_input = FM_Radio_INPUT1; |
864 | else if (priv->radio_input == XC5000_RADIO_FM2) | 872 | else if (priv->radio_input == XC5000_RADIO_FM2) |
865 | radio_input = FM_Radio_INPUT2; | 873 | radio_input = FM_Radio_INPUT2; |
874 | else if (priv->radio_input == XC5000_RADIO_FM1_MONO) | ||
875 | radio_input = FM_Radio_INPUT1_MONO; | ||
866 | else { | 876 | else { |
867 | dprintk(1, "%s() unknown radio input %d\n", __func__, | 877 | dprintk(1, "%s() unknown radio input %d\n", __func__, |
868 | priv->radio_input); | 878 | priv->radio_input); |
@@ -889,6 +899,12 @@ static int xc5000_set_radio_freq(struct dvb_frontend *fe, | |||
889 | return -EREMOTEIO; | 899 | return -EREMOTEIO; |
890 | } | 900 | } |
891 | 901 | ||
902 | if ((priv->radio_input == XC5000_RADIO_FM1) || | ||
903 | (priv->radio_input == XC5000_RADIO_FM2)) | ||
904 | xc_write_reg(priv, XREG_OUTPUT_AMP, 0x09); | ||
905 | else if (priv->radio_input == XC5000_RADIO_FM1_MONO) | ||
906 | xc_write_reg(priv, XREG_OUTPUT_AMP, 0x06); | ||
907 | |||
892 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); | 908 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); |
893 | 909 | ||
894 | return 0; | 910 | return 0; |
@@ -1039,6 +1055,23 @@ static int xc5000_release(struct dvb_frontend *fe) | |||
1039 | return 0; | 1055 | return 0; |
1040 | } | 1056 | } |
1041 | 1057 | ||
1058 | static int xc5000_set_config(struct dvb_frontend *fe, void *priv_cfg) | ||
1059 | { | ||
1060 | struct xc5000_priv *priv = fe->tuner_priv; | ||
1061 | struct xc5000_config *p = priv_cfg; | ||
1062 | |||
1063 | dprintk(1, "%s()\n", __func__); | ||
1064 | |||
1065 | if (p->if_khz) | ||
1066 | priv->if_khz = p->if_khz; | ||
1067 | |||
1068 | if (p->radio_input) | ||
1069 | priv->radio_input = p->radio_input; | ||
1070 | |||
1071 | return 0; | ||
1072 | } | ||
1073 | |||
1074 | |||
1042 | static const struct dvb_tuner_ops xc5000_tuner_ops = { | 1075 | static const struct dvb_tuner_ops xc5000_tuner_ops = { |
1043 | .info = { | 1076 | .info = { |
1044 | .name = "Xceive XC5000", | 1077 | .name = "Xceive XC5000", |
@@ -1051,6 +1084,7 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = { | |||
1051 | .init = xc5000_init, | 1084 | .init = xc5000_init, |
1052 | .sleep = xc5000_sleep, | 1085 | .sleep = xc5000_sleep, |
1053 | 1086 | ||
1087 | .set_config = xc5000_set_config, | ||
1054 | .set_params = xc5000_set_params, | 1088 | .set_params = xc5000_set_params, |
1055 | .set_analog_params = xc5000_set_analog_params, | 1089 | .set_analog_params = xc5000_set_analog_params, |
1056 | .get_frequency = xc5000_get_frequency, | 1090 | .get_frequency = xc5000_get_frequency, |
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h index 3756e73649be..e2957451b532 100644 --- a/drivers/media/common/tuners/xc5000.h +++ b/drivers/media/common/tuners/xc5000.h | |||
@@ -40,6 +40,7 @@ struct xc5000_config { | |||
40 | #define XC5000_RADIO_NOT_CONFIGURED 0 | 40 | #define XC5000_RADIO_NOT_CONFIGURED 0 |
41 | #define XC5000_RADIO_FM1 1 | 41 | #define XC5000_RADIO_FM1 1 |
42 | #define XC5000_RADIO_FM2 2 | 42 | #define XC5000_RADIO_FM2 2 |
43 | #define XC5000_RADIO_FM1_MONO 3 | ||
43 | 44 | ||
44 | /* For each bridge framework, when it attaches either analog or digital, | 45 | /* For each bridge framework, when it attaches either analog or digital, |
45 | * it has to store a reference back to its _core equivalent structure, | 46 | * it has to store a reference back to its _core equivalent structure, |