Skip to content

Commit a1dad50

Browse files
trsqrmchehab
authored andcommitted
[media] si2157: Set delivery system and bandwidth before tuning
Tell used TV standard and bandwidth for tuner firmware. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
1 parent 1b92373 commit a1dad50

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

‎drivers/media/tuners/si2157.c‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ static int si2157_set_params(struct dvb_frontend *fe)
209209
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
210210
int ret;
211211
struct si2157_cmd cmd;
212+
u8 bandwidth, delivery_system;
212213

213214
dev_dbg(&s->client->dev,
214215
"%s: delivery_system=%d frequency=%u bandwidth_hz=%u\n",
@@ -220,6 +221,36 @@ static int si2157_set_params(struct dvb_frontend *fe)
220221
goto err;
221222
}
222223

224+
if (c->bandwidth_hz <= 6000000)
225+
bandwidth = 0x06;
226+
else if (c->bandwidth_hz <= 7000000)
227+
bandwidth = 0x07;
228+
else if (c->bandwidth_hz <= 8000000)
229+
bandwidth = 0x08;
230+
else
231+
bandwidth = 0x0f;
232+
233+
switch (c->delivery_system) {
234+
case SYS_DVBT:
235+
case SYS_DVBT2: /* it seems DVB-T and DVB-T2 both are 0x20 here */
236+
delivery_system = 0x20;
237+
break;
238+
case SYS_DVBC_ANNEX_A:
239+
delivery_system = 0x30;
240+
break;
241+
default:
242+
ret = -EINVAL;
243+
goto err;
244+
}
245+
246+
memcpy(cmd.args, "\x14\x00\x03\x07\x00\x00", 6);
247+
cmd.args[4] = delivery_system | bandwidth;
248+
cmd.wlen = 6;
249+
cmd.rlen = 1;
250+
ret = si2157_cmd_execute(s, &cmd);
251+
if (ret)
252+
goto err;
253+
223254
/* set frequency */
224255
memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8);
225256
cmd.args[4] = (c->frequency >> 0) & 0xff;

0 commit comments

Comments
 (0)