aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2009-09-24 12:27:24 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:40:13 -0500
commit496e9057adf55d0e6c9be3805f0bc61288409317 (patch)
tree2a2b02a502cb31062cc3fa817272a56a299b90f4 /drivers/media
parentd7009cdc286d7c9714b357b0e85b3fcbbf9e03a4 (diff)
V4L/DVB (13076): xc5000: make the definition of the FM input part of the xc5000 config struct
Remove hard-coded definition of the xc5000 FM radio input, making it a parameter passed in when doing the attach call. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/common/tuners/xc5000.c25
-rw-r--r--drivers/media/common/tuners/xc5000.h6
2 files changed, 28 insertions, 3 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index fc7cb74256d0..d33bf831e76c 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -61,6 +61,7 @@ struct xc5000_priv {
61 u32 bandwidth; 61 u32 bandwidth;
62 u8 video_standard; 62 u8 video_standard;
63 u8 rf_mode; 63 u8 rf_mode;
64 u8 radio_input;
64}; 65};
65 66
66/* Misc Defines */ 67/* Misc Defines */
@@ -829,17 +830,32 @@ static int xc5000_set_radio_freq(struct dvb_frontend *fe,
829{ 830{
830 struct xc5000_priv *priv = fe->tuner_priv; 831 struct xc5000_priv *priv = fe->tuner_priv;
831 int ret = -EINVAL; 832 int ret = -EINVAL;
833 u8 radio_input;
832 834
833 dprintk(1, "%s() frequency=%d (in units of khz)\n", 835 dprintk(1, "%s() frequency=%d (in units of khz)\n",
834 __func__, params->frequency); 836 __func__, params->frequency);
835 837
838 if (priv->radio_input == XC5000_RADIO_NOT_CONFIGURED) {
839 dprintk(1, "%s() radio input not configured\n", __func__);
840 return -EINVAL;
841 }
842
843 if (priv->radio_input == XC5000_RADIO_FM1)
844 radio_input = FM_Radio_INPUT1;
845 else if (priv->radio_input == XC5000_RADIO_FM2)
846 radio_input = FM_Radio_INPUT2;
847 else {
848 dprintk(1, "%s() unknown radio input %d\n", __func__,
849 priv->radio_input);
850 return -EINVAL;
851 }
852
836 priv->freq_hz = params->frequency * 125 / 2; 853 priv->freq_hz = params->frequency * 125 / 2;
837 854
838 priv->rf_mode = XC_RF_MODE_AIR; 855 priv->rf_mode = XC_RF_MODE_AIR;
839 856
840 ret = xc_SetTVStandard(priv, 857 ret = xc_SetTVStandard(priv, XC5000_Standard[radio_input].VideoMode,
841 XC5000_Standard[FM_Radio_INPUT1].VideoMode, 858 XC5000_Standard[radio_input].AudioMode);
842 XC5000_Standard[FM_Radio_INPUT1].AudioMode);
843 859
844 if (ret != XC_RESULT_SUCCESS) { 860 if (ret != XC_RESULT_SUCCESS) {
845 printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); 861 printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n");
@@ -1058,6 +1074,9 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
1058 priv->if_khz = cfg->if_khz; 1074 priv->if_khz = cfg->if_khz;
1059 } 1075 }
1060 1076
1077 if (priv->radio_input == 0)
1078 priv->radio_input = cfg->radio_input;
1079
1061 /* Check if firmware has been loaded. It is possible that another 1080 /* Check if firmware has been loaded. It is possible that another
1062 instance of the driver has loaded the firmware. 1081 instance of the driver has loaded the firmware.
1063 */ 1082 */
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h
index f4c146698a00..e6d7236c9ea1 100644
--- a/drivers/media/common/tuners/xc5000.h
+++ b/drivers/media/common/tuners/xc5000.h
@@ -30,11 +30,17 @@ struct i2c_adapter;
30struct xc5000_config { 30struct xc5000_config {
31 u8 i2c_address; 31 u8 i2c_address;
32 u32 if_khz; 32 u32 if_khz;
33 u8 radio_input;
33}; 34};
34 35
35/* xc5000 callback command */ 36/* xc5000 callback command */
36#define XC5000_TUNER_RESET 0 37#define XC5000_TUNER_RESET 0
37 38
39/* Possible Radio inputs */
40#define XC5000_RADIO_NOT_CONFIGURED 0
41#define XC5000_RADIO_FM1 1
42#define XC5000_RADIO_FM2 2
43
38/* For each bridge framework, when it attaches either analog or digital, 44/* For each bridge framework, when it attaches either analog or digital,
39 * it has to store a reference back to its _core equivalent structure, 45 * it has to store a reference back to its _core equivalent structure,
40 * so that it can service the hardware by steering gpio's etc. 46 * so that it can service the hardware by steering gpio's etc.