Skip to content

Commit 2f2244c

Browse files
b-rad-NDi6by9
authored andcommitted
media: si2168: Add ts bus coontrol, turn off bus on sleep
commit 4458777 upstream Includes a function to set TS MODE property os si2168. The function either disables the TS output bus, or sets mode to config option. When going to sleep the TS bus is turned off, this makes the driver compatible with multiple frontend usage. Signed-off-by: Brad Love <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent d3016c1 commit 2f2244c

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

drivers/media/dvb-frontends/si2168.c

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,30 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
407407
return ret;
408408
}
409409

410+
static int si2168_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
411+
{
412+
struct i2c_client *client = fe->demodulator_priv;
413+
struct si2168_dev *dev = i2c_get_clientdata(client);
414+
struct si2168_cmd cmd;
415+
int ret = 0;
416+
417+
dev_dbg(&client->dev, "%s acquire: %d\n", __func__, acquire);
418+
419+
/* set TS_MODE property */
420+
memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
421+
if (acquire)
422+
cmd.args[4] |= dev->ts_mode;
423+
else
424+
cmd.args[4] |= SI2168_TS_TRISTATE;
425+
if (dev->ts_clock_gapped)
426+
cmd.args[4] |= 0x40;
427+
cmd.wlen = 6;
428+
cmd.rlen = 4;
429+
ret = si2168_cmd_execute(client, &cmd);
430+
431+
return ret;
432+
}
433+
410434
static int si2168_init(struct dvb_frontend *fe)
411435
{
412436
struct i2c_client *client = fe->demodulator_priv;
@@ -537,14 +561,7 @@ static int si2168_init(struct dvb_frontend *fe)
537561
dev->version >> 24 & 0xff, dev->version >> 16 & 0xff,
538562
dev->version >> 8 & 0xff, dev->version >> 0 & 0xff);
539563

540-
/* set ts mode */
541-
memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
542-
cmd.args[4] |= dev->ts_mode;
543-
if (dev->ts_clock_gapped)
544-
cmd.args[4] |= 0x40;
545-
cmd.wlen = 6;
546-
cmd.rlen = 4;
547-
ret = si2168_cmd_execute(client, &cmd);
564+
ret = si2168_ts_bus_ctrl(fe, 1);
548565
if (ret)
549566
goto err;
550567

@@ -581,6 +598,9 @@ static int si2168_sleep(struct dvb_frontend *fe)
581598

582599
dev->active = false;
583600

601+
/* tri-state data bus */
602+
si2168_ts_bus_ctrl(fe, 0);
603+
584604
/* Firmware B 4.0-11 or later loses warm state during sleep */
585605
if (dev->version > ('B' << 24 | 4 << 16 | 0 << 8 | 11 << 0))
586606
dev->warm = false;
@@ -678,6 +698,8 @@ static const struct dvb_frontend_ops si2168_ops = {
678698
.init = si2168_init,
679699
.sleep = si2168_sleep,
680700

701+
.ts_bus_ctrl = si2168_ts_bus_ctrl,
702+
681703
.set_frontend = si2168_set_frontend,
682704

683705
.read_status = si2168_read_status,

drivers/media/dvb-frontends/si2168.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct si2168_config {
3838
/* TS mode */
3939
#define SI2168_TS_PARALLEL 0x06
4040
#define SI2168_TS_SERIAL 0x03
41+
#define SI2168_TS_TRISTATE 0x00
4142
u8 ts_mode;
4243

4344
/* TS clock inverted */

0 commit comments

Comments
 (0)