[media] mn88472: add ts mode and ts clock to driver
authorBenjamin Larsson <benjamin@southpole.se>
Sat, 6 Dec 2014 00:25:33 +0000 (21:25 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 8 Apr 2015 09:54:41 +0000 (06:54 -0300)
Signed-off-by: Benjamin Larsson <benjamin@southpole.se>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/dvb-frontends/mn88472.h
drivers/media/usb/dvb-usb-v2/rtl28xxu.c
drivers/staging/media/mn88472/mn88472.c
drivers/staging/media/mn88472/mn88472_priv.h

index e4e0b80d3091f93cd660e1822201817d11b64d77..095294d292f36bf97f5a2709866020e4a85d2621 100644 (file)
 
 #include <linux/dvb/frontend.h>
 
+enum ts_clock {
+       VARIABLE_TS_CLOCK,
+       FIXED_TS_CLOCK,
+};
+
+enum ts_mode {
+       SERIAL_TS_MODE,
+       PARALLEL_TS_MODE,
+};
+
 struct mn88472_config {
        /*
         * Max num of bytes given I2C adapter could write at once.
@@ -39,6 +49,8 @@ struct mn88472_config {
         * Hz
         */
        u32 xtal;
+       int ts_mode;
+       int ts_clock;
 };
 
 #endif
index ea75b3a89a85aba5b4f4abf7a63acb546552c34a..1091ea6704dbdd1c624b0ea80433835ed7e6324c 100644 (file)
@@ -868,6 +868,8 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
                        mn88472_config.i2c_wr_max = 22,
                        strlcpy(info.type, "mn88472", I2C_NAME_SIZE);
                        mn88472_config.xtal = 20500000;
+                       mn88472_config.ts_mode = SERIAL_TS_MODE;
+                       mn88472_config.ts_clock = VARIABLE_TS_CLOCK;
                        info.addr = 0x18;
                        info.platform_data = &mn88472_config;
                        request_module(info.type);
index 44edcf652223de3de0b5394aaab8fb0dde63f454..ed379abcacc0ead469c1ea467b20f9c2eee22c9d 100644 (file)
@@ -178,8 +178,32 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
 
        ret = regmap_write(dev->regmap[0], 0x46, 0x00);
        ret = regmap_write(dev->regmap[0], 0xae, 0x00);
-       ret = regmap_write(dev->regmap[2], 0x08, 0x1d);
-       ret = regmap_write(dev->regmap[0], 0xd9, 0xe3);
+
+       switch (dev->ts_mode) {
+       case SERIAL_TS_MODE:
+               ret = regmap_write(dev->regmap[2], 0x08, 0x1d);
+               break;
+       case PARALLEL_TS_MODE:
+               ret = regmap_write(dev->regmap[2], 0x08, 0x00);
+               break;
+       default:
+               dev_dbg(&client->dev, "ts_mode error: %d\n", dev->ts_mode);
+               ret = -EINVAL;
+               goto err;
+       }
+
+       switch (dev->ts_clock) {
+       case VARIABLE_TS_CLOCK:
+               ret = regmap_write(dev->regmap[0], 0xd9, 0xe3);
+               break;
+       case FIXED_TS_CLOCK:
+               ret = regmap_write(dev->regmap[0], 0xd9, 0xe1);
+               break;
+       default:
+               dev_dbg(&client->dev, "ts_clock error: %d\n", dev->ts_clock);
+               ret = -EINVAL;
+               goto err;
+       }
 
        /* Reset demod */
        ret = regmap_write(dev->regmap[2], 0xf8, 0x9f);
@@ -439,6 +463,8 @@ static int mn88472_probe(struct i2c_client *client,
 
        dev->i2c_wr_max = config->i2c_wr_max;
        dev->xtal = config->xtal;
+       dev->ts_mode = config->ts_mode;
+       dev->ts_clock = config->ts_clock;
        dev->client[0] = client;
        dev->regmap[0] = regmap_init_i2c(dev->client[0], &regmap_config);
        if (IS_ERR(dev->regmap[0])) {
index b12b731e2d4e0f3a2b4d80798ba9f45dbd38193d..9ba8c8b3823e7bac9161fe0fc444aaf0647ea643 100644 (file)
@@ -32,6 +32,8 @@ struct mn88472_dev {
        fe_delivery_system_t delivery_system;
        bool warm; /* FW running */
        u32 xtal;
+       int ts_mode;
+       int ts_clock;
 };
 
 #endif