diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-04-22 13:45:53 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:50 -0400 |
commit | 6f4a57292f4f0a0fef5e4e39cb394fedcf2acf9f (patch) | |
tree | 7808cee65ac46fed106b3078213ca422cbe2cee7 /drivers/media/video/tuner-simple.c | |
parent | 22ef8fc945b28398d93a5d362e54915b66eba23f (diff) |
V4L/DVB (7351): tuner-simple: add init and sleep methods
taken from dvb-pll
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tuner-simple.c')
-rw-r--r-- | drivers/media/video/tuner-simple.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 3ec76391a60d..3a27d4a8ce38 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -810,6 +810,52 @@ fail: | |||
810 | return ret; | 810 | return ret; |
811 | } | 811 | } |
812 | 812 | ||
813 | static int simple_init(struct dvb_frontend *fe) | ||
814 | { | ||
815 | struct tuner_simple_priv *priv = fe->tuner_priv; | ||
816 | |||
817 | if (priv->i2c_props.adap == NULL) | ||
818 | return -EINVAL; | ||
819 | |||
820 | if (priv->tun->initdata) { | ||
821 | int ret; | ||
822 | |||
823 | if (fe->ops.i2c_gate_ctrl) | ||
824 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
825 | |||
826 | ret = tuner_i2c_xfer_send(&priv->i2c_props, | ||
827 | priv->tun->initdata + 1, | ||
828 | priv->tun->initdata[0]); | ||
829 | if (ret != priv->tun->initdata[0]) | ||
830 | return ret; | ||
831 | } | ||
832 | |||
833 | return 0; | ||
834 | } | ||
835 | |||
836 | static int simple_sleep(struct dvb_frontend *fe) | ||
837 | { | ||
838 | struct tuner_simple_priv *priv = fe->tuner_priv; | ||
839 | |||
840 | if (priv->i2c_props.adap == NULL) | ||
841 | return -EINVAL; | ||
842 | |||
843 | if (priv->tun->sleepdata) { | ||
844 | int ret; | ||
845 | |||
846 | if (fe->ops.i2c_gate_ctrl) | ||
847 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
848 | |||
849 | ret = tuner_i2c_xfer_send(&priv->i2c_props, | ||
850 | priv->tun->sleepdata + 1, | ||
851 | priv->tun->sleepdata[0]); | ||
852 | if (ret != priv->tun->sleepdata[0]) | ||
853 | return ret; | ||
854 | } | ||
855 | |||
856 | return 0; | ||
857 | } | ||
858 | |||
813 | static int simple_release(struct dvb_frontend *fe) | 859 | static int simple_release(struct dvb_frontend *fe) |
814 | { | 860 | { |
815 | struct tuner_simple_priv *priv = fe->tuner_priv; | 861 | struct tuner_simple_priv *priv = fe->tuner_priv; |
@@ -841,6 +887,8 @@ static int simple_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | |||
841 | } | 887 | } |
842 | 888 | ||
843 | static struct dvb_tuner_ops simple_tuner_ops = { | 889 | static struct dvb_tuner_ops simple_tuner_ops = { |
890 | .init = simple_init, | ||
891 | .sleep = simple_sleep, | ||
844 | .set_analog_params = simple_set_params, | 892 | .set_analog_params = simple_set_params, |
845 | .set_params = simple_dvb_set_params, | 893 | .set_params = simple_dvb_set_params, |
846 | .calc_regs = simple_dvb_calc_regs, | 894 | .calc_regs = simple_dvb_calc_regs, |