aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/xc5000.c
diff options
context:
space:
mode:
authorBeholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>2009-09-24 12:13:28 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:40:13 -0500
commitd7009cdc286d7c9714b357b0e85b3fcbbf9e03a4 (patch)
tree927d71d2d59d8504b6fe4afce4d56a93573cdc67 /drivers/media/common/tuners/xc5000.c
parent798166dbecafa98ec9b28d056774ec2fc80290df (diff)
V4L/DVB (13075): xc5000: add FM radio support
Add FM radio for the xc5000 silicon tuner chip. Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common/tuners/xc5000.c')
-rw-r--r--drivers/media/common/tuners/xc5000.c66
1 files changed, 62 insertions, 4 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index f4ffcdc9b848..fc7cb74256d0 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -739,15 +739,12 @@ static int xc5000_is_firmware_loaded(struct dvb_frontend *fe)
739 return ret; 739 return ret;
740} 740}
741 741
742static int xc5000_set_analog_params(struct dvb_frontend *fe, 742static int xc5000_set_tv_freq(struct dvb_frontend *fe,
743 struct analog_parameters *params) 743 struct analog_parameters *params)
744{ 744{
745 struct xc5000_priv *priv = fe->tuner_priv; 745 struct xc5000_priv *priv = fe->tuner_priv;
746 int ret; 746 int ret;
747 747
748 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS)
749 xc_load_fw_and_init_tuner(fe);
750
751 dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", 748 dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n",
752 __func__, params->frequency); 749 __func__, params->frequency);
753 750
@@ -827,6 +824,67 @@ tune_channel:
827 return 0; 824 return 0;
828} 825}
829 826
827static int xc5000_set_radio_freq(struct dvb_frontend *fe,
828 struct analog_parameters *params)
829{
830 struct xc5000_priv *priv = fe->tuner_priv;
831 int ret = -EINVAL;
832
833 dprintk(1, "%s() frequency=%d (in units of khz)\n",
834 __func__, params->frequency);
835
836 priv->freq_hz = params->frequency * 125 / 2;
837
838 priv->rf_mode = XC_RF_MODE_AIR;
839
840 ret = xc_SetTVStandard(priv,
841 XC5000_Standard[FM_Radio_INPUT1].VideoMode,
842 XC5000_Standard[FM_Radio_INPUT1].AudioMode);
843
844 if (ret != XC_RESULT_SUCCESS) {
845 printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n");
846 return -EREMOTEIO;
847 }
848
849 ret = xc_SetSignalSource(priv, priv->rf_mode);
850 if (ret != XC_RESULT_SUCCESS) {
851 printk(KERN_ERR
852 "xc5000: xc_SetSignalSource(%d) failed\n",
853 priv->rf_mode);
854 return -EREMOTEIO;
855 }
856
857 xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG);
858
859 return 0;
860}
861
862static int xc5000_set_analog_params(struct dvb_frontend *fe,
863 struct analog_parameters *params)
864{
865 struct xc5000_priv *priv = fe->tuner_priv;
866 int ret = -EINVAL;
867
868 if (priv->i2c_props.adap == NULL)
869 return -EINVAL;
870
871 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS)
872 xc_load_fw_and_init_tuner(fe);
873
874 switch (params->mode) {
875 case V4L2_TUNER_RADIO:
876 ret = xc5000_set_radio_freq(fe, params);
877 break;
878 case V4L2_TUNER_ANALOG_TV:
879 case V4L2_TUNER_DIGITAL_TV:
880 ret = xc5000_set_tv_freq(fe, params);
881 break;
882 }
883
884 return ret;
885}
886
887
830static int xc5000_get_frequency(struct dvb_frontend *fe, u32 *freq) 888static int xc5000_get_frequency(struct dvb_frontend *fe, u32 *freq)
831{ 889{
832 struct xc5000_priv *priv = fe->tuner_priv; 890 struct xc5000_priv *priv = fe->tuner_priv;