1 From a3eec916cbc17dc1aaa3ddf120836cd5200eb4ef Mon Sep 17 00:00:00 2001
2 From: Mauro Carvalho Chehab <m.chehab@samsung.com>
3 Date: Mon, 21 Jul 2014 14:21:18 -0300
4 Subject: media: xc5000: Fix get_frequency()
6 From: Mauro Carvalho Chehab <m.chehab@samsung.com>
8 commit a3eec916cbc17dc1aaa3ddf120836cd5200eb4ef upstream.
10 The programmed frequency on xc5000 is not the middle
11 frequency, but the initial frequency on the bandwidth range.
12 However, the DVB API works with the middle frequency.
14 Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 drivers/media/tuners/xc5000.c | 22 ++++++++++++----------
19 1 file changed, 12 insertions(+), 10 deletions(-)
21 --- a/drivers/media/tuners/xc5000.c
22 +++ b/drivers/media/tuners/xc5000.c
23 @@ -56,7 +56,7 @@ struct xc5000_priv {
28 + u32 freq_hz, freq_offset;
32 @@ -749,13 +749,13 @@ static int xc5000_set_params(struct dvb_
34 dprintk(1, "%s() VSB modulation\n", __func__);
35 priv->rf_mode = XC_RF_MODE_AIR;
36 - priv->freq_hz = freq - 1750000;
37 + priv->freq_offset = 1750000;
38 priv->video_standard = DTV6;
40 case SYS_DVBC_ANNEX_B:
41 dprintk(1, "%s() QAM modulation\n", __func__);
42 priv->rf_mode = XC_RF_MODE_CABLE;
43 - priv->freq_hz = freq - 1750000;
44 + priv->freq_offset = 1750000;
45 priv->video_standard = DTV6;
48 @@ -770,15 +770,15 @@ static int xc5000_set_params(struct dvb_
51 priv->video_standard = DTV6;
52 - priv->freq_hz = freq - 1750000;
53 + priv->freq_offset = 1750000;
56 priv->video_standard = DTV7;
57 - priv->freq_hz = freq - 2250000;
58 + priv->freq_offset = 2250000;
61 priv->video_standard = DTV8;
62 - priv->freq_hz = freq - 2750000;
63 + priv->freq_offset = 2750000;
66 printk(KERN_ERR "xc5000 bandwidth not set!\n");
67 @@ -792,15 +792,15 @@ static int xc5000_set_params(struct dvb_
68 priv->rf_mode = XC_RF_MODE_CABLE;
70 priv->video_standard = DTV6;
71 - priv->freq_hz = freq - 1750000;
72 + priv->freq_offset = 1750000;
74 } else if (bw <= 7000000) {
75 priv->video_standard = DTV7;
76 - priv->freq_hz = freq - 2250000;
77 + priv->freq_offset = 2250000;
80 priv->video_standard = DTV7_8;
81 - priv->freq_hz = freq - 2750000;
82 + priv->freq_offset = 2750000;
85 dprintk(1, "%s() Bandwidth %dMHz (%d)\n", __func__,
86 @@ -811,6 +811,8 @@ static int xc5000_set_params(struct dvb_
90 + priv->freq_hz = freq - priv->freq_offset;
92 dprintk(1, "%s() frequency=%d (compensated to %d)\n",
93 __func__, freq, priv->freq_hz);
95 @@ -1061,7 +1063,7 @@ static int xc5000_get_frequency(struct d
97 struct xc5000_priv *priv = fe->tuner_priv;
98 dprintk(1, "%s()\n", __func__);
99 - *freq = priv->freq_hz;
100 + *freq = priv->freq_hz + priv->freq_offset;