aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2015-07-18 17:54:12 -0400
committerSteven Toth <stoth@kernellabs.com>2015-07-18 17:54:12 -0400
commite271a9ef2c77dde2d4deb11a9cee5eade720b2f9 (patch)
tree38eea4000764b5c178cfdc7e30c499069f2493b3
parent6727d4fce95586e60922bdaf57b8a0eb99482557 (diff)
[media] si2168: Add support for dvb-core TS bus-control.
Allow bridges to tri-state the ts output bus, for cases where the si2168 is sharing a single transport bus. Signed-off-by: Steven Toth <stoth@kernellabs.com>
-rw-r--r--drivers/media/dvb-frontends/si2168.c51
-rw-r--r--drivers/media/dvb-frontends/si2168.h1
2 files changed, 43 insertions, 9 deletions
diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
index 25e238c370e5..79665a3da304 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -190,6 +190,45 @@ err:
return ret;
}
+/* Configure the TS bus for tristate, or users requested configuration */
+static int si2168_set_ts_mode(struct dvb_frontend *fe, int tristate)
+{
+ struct i2c_client *client = fe->demodulator_priv;
+ struct si2168_dev *dev = i2c_get_clientdata(client);
+ struct si2168_cmd cmd;
+ int ret;
+
+ /* set ts mode */
+ memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
+ if (tristate)
+ cmd.args[4] |= SI2168_TS_TRISTATE;
+ else
+ cmd.args[4] |= dev->ts_mode;
+
+ if (dev->ts_clock_gapped)
+ cmd.args[4] |= 0x40;
+ cmd.wlen = 6;
+ cmd.rlen = 4;
+ ret = si2168_cmd_execute(client, &cmd);
+ if (ret)
+ return -EIO;
+
+ return 0;
+}
+
+static int si2168_ts_bus_ctrl(struct dvb_frontend *fe, int enable)
+{
+ if (enable) {
+ /* Enable TS-outputs */
+ si2168_set_ts_mode(fe, 0);
+ } else {
+ /* Tri-state the TS bus */
+ si2168_set_ts_mode(fe, 1);
+ }
+
+ return 0;
+}
+
static int si2168_set_frontend(struct dvb_frontend *fe)
{
struct i2c_client *client = fe->demodulator_priv;
@@ -550,15 +589,8 @@ static int si2168_init(struct dvb_frontend *fe)
dev_info(&client->dev, "firmware version: %c.%c.%d\n",
cmd.args[6], cmd.args[7], cmd.args[8]);
- /* set ts mode */
- memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
- cmd.args[4] |= dev->ts_mode;
- if (dev->ts_clock_gapped)
- cmd.args[4] |= 0x40;
- cmd.wlen = 6;
- cmd.rlen = 4;
- ret = si2168_cmd_execute(client, &cmd);
- if (ret)
+ ret = si2168_set_ts_mode(fe, 0);
+ if (ret < 0)
goto err;
dev->fw_loaded = true;
@@ -686,6 +718,7 @@ static const struct dvb_frontend_ops si2168_ops = {
.set_frontend = si2168_set_frontend,
.read_status = si2168_read_status,
+ .ts_bus_ctrl = si2168_ts_bus_ctrl,
};
static int si2168_probe(struct i2c_client *client,
diff --git a/drivers/media/dvb-frontends/si2168.h b/drivers/media/dvb-frontends/si2168.h
index 3225d0cc93c7..f48f0fb0ad69 100644
--- a/drivers/media/dvb-frontends/si2168.h
+++ b/drivers/media/dvb-frontends/si2168.h
@@ -38,6 +38,7 @@ struct si2168_config {
/* TS mode */
#define SI2168_TS_PARALLEL 0x06
#define SI2168_TS_SERIAL 0x03
+#define SI2168_TS_TRISTATE 0x00
u8 ts_mode;
/* TS clock inverted */

Privacy Policy