Skip to content

Commit 4458777

Browse files
b-rad-NDimchehab
authored andcommitted
media: si2168: Add ts bus coontrol, turn off bus on sleep
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 2af0424 commit 4458777

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
@@ -409,6 +409,30 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
409409
return ret;
410410
}
411411

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

543-
/* set ts mode */
544-
memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
545-
cmd.args[4] |= dev->ts_mode;
546-
if (dev->ts_clock_gapped)
547-
cmd.args[4] |= 0x40;
548-
cmd.wlen = 6;
549-
cmd.rlen = 4;
550-
ret = si2168_cmd_execute(client, &cmd);
567+
ret = si2168_ts_bus_ctrl(fe, 1);
551568
if (ret)
552569
goto err;
553570

@@ -584,6 +601,9 @@ static int si2168_sleep(struct dvb_frontend *fe)
584601

585602
dev->active = false;
586603

604+
/* tri-state data bus */
605+
si2168_ts_bus_ctrl(fe, 0);
606+
587607
/* Firmware B 4.0-11 or later loses warm state during sleep */
588608
if (dev->version > ('B' << 24 | 4 << 16 | 0 << 8 | 11 << 0))
589609
dev->warm = false;
@@ -681,6 +701,8 @@ static const struct dvb_frontend_ops si2168_ops = {
681701
.init = si2168_init,
682702
.sleep = si2168_sleep,
683703

704+
.ts_bus_ctrl = si2168_ts_bus_ctrl,
705+
684706
.set_frontend = si2168_set_frontend,
685707

686708
.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)