diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/frontends/tda8261.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/media/dvb/frontends/tda8261.c b/drivers/media/dvb/frontends/tda8261.c index 9cbd511d749e..1b9f4dc1b003 100644 --- a/drivers/media/dvb/frontends/tda8261.c +++ b/drivers/media/dvb/frontends/tda8261.c | |||
@@ -130,6 +130,10 @@ static int tda8261_set_state(struct dvb_frontend *fe, | |||
130 | * (to account for half channel spacing on either side) | 130 | * (to account for half channel spacing on either side) |
131 | */ | 131 | */ |
132 | frequency = tstate->frequency; | 132 | frequency = tstate->frequency; |
133 | if ((frequency < 950000) || (frequency > 2150000)) { | ||
134 | printk("%s: Frequency beyond limits, frequency=%d\n", __func__, frequency); | ||
135 | return -EINVAL; | ||
136 | } | ||
133 | N = (frequency + (div_tab[config->step_size] - 1)) / div_tab[config->step_size]; | 137 | N = (frequency + (div_tab[config->step_size] - 1)) / div_tab[config->step_size]; |
134 | printk("%s: Step size=%d, Divider=%d, PG=0x%02x (%d)\n", | 138 | printk("%s: Step size=%d, Divider=%d, PG=0x%02x (%d)\n", |
135 | __func__, config->step_size, div_tab[config->step_size], N, N); | 139 | __func__, config->step_size, div_tab[config->step_size], N, N); |
@@ -137,7 +141,14 @@ static int tda8261_set_state(struct dvb_frontend *fe, | |||
137 | buf[0] = (N >> 8) & 0xff; | 141 | buf[0] = (N >> 8) & 0xff; |
138 | buf[1] = N & 0xff; | 142 | buf[1] = N & 0xff; |
139 | buf[2] = (0x01 << 7) | ((ref_div[config->step_size] & 0x07) << 1); | 143 | buf[2] = (0x01 << 7) | ((ref_div[config->step_size] & 0x07) << 1); |
140 | buf[3] = 0xc0; | 144 | |
145 | if (frequency < 1450000) | ||
146 | buf[3] = 0x00; | ||
147 | if (frequency < 2000000) | ||
148 | buf[3] = 0x40; | ||
149 | if (frequency < 2150000) | ||
150 | buf[3] = 0x80; | ||
151 | |||
141 | /* Set params */ | 152 | /* Set params */ |
142 | if ((err = tda8261_write(state, buf)) < 0) { | 153 | if ((err = tda8261_write(state, buf)) < 0) { |
143 | printk("%s: I/O Error\n", __func__); | 154 | printk("%s: I/O Error\n", __func__); |