[media] si2157: support selection of IF interface
authorOlli Salonen <olli.salonen@iki.fi>
Tue, 5 May 2015 16:54:17 +0000 (13:54 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 12 May 2015 16:20:55 +0000 (13:20 -0300)
The chips supported by the si2157 driver have two IF outputs (either
pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
add an option to choose which output shall be used.

As this patch changes the default behaviour, the IF interface is
specified in each driver currently using si2157 driver. This is to
keep bisectability.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/saa7164/saa7164-dvb.c
drivers/media/pci/smipcie/smipcie.c
drivers/media/tuners/si2157.c
drivers/media/tuners/si2157.h
drivers/media/tuners/si2157_priv.h
drivers/media/usb/cx231xx/cx231xx-dvb.c
drivers/media/usb/dvb-usb-v2/af9035.c
drivers/media/usb/dvb-usb-v2/dvbsky.c
drivers/media/usb/dvb-usb/cxusb.c
drivers/media/usb/em28xx/em28xx-dvb.c

index 745caabe33971f1d279c58d220117d41ce5cb99b..37fd013c385bcaa23dc128836edc20598130e1bb 100644 (file)
@@ -1912,6 +1912,7 @@ static int dvb_register(struct cx23885_tsport *port)
                        /* attach tuner */
                        memset(&si2157_config, 0, sizeof(si2157_config));
                        si2157_config.fe = fe0->dvb.frontend;
+                       si2157_config.if_port = 1;
                        memset(&info, 0, sizeof(struct i2c_board_info));
                        strlcpy(info.type, "si2157", I2C_NAME_SIZE);
                        info.addr = 0x60;
@@ -1957,6 +1958,7 @@ static int dvb_register(struct cx23885_tsport *port)
                /* attach tuner */
                memset(&si2157_config, 0, sizeof(si2157_config));
                si2157_config.fe = fe0->dvb.frontend;
+               si2157_config.if_port = 1;
                memset(&info, 0, sizeof(struct i2c_board_info));
                strlcpy(info.type, "si2157", I2C_NAME_SIZE);
                info.addr = 0x60;
@@ -2093,6 +2095,7 @@ static int dvb_register(struct cx23885_tsport *port)
                /* attach tuner */
                memset(&si2157_config, 0, sizeof(si2157_config));
                si2157_config.fe = fe0->dvb.frontend;
+               si2157_config.if_port = 1;
                memset(&info, 0, sizeof(struct i2c_board_info));
                strlcpy(info.type, "si2157", I2C_NAME_SIZE);
                info.addr = 0x60;
@@ -2172,6 +2175,7 @@ static int dvb_register(struct cx23885_tsport *port)
                        /* attach tuner */
                        memset(&si2157_config, 0, sizeof(si2157_config));
                        si2157_config.fe = fe0->dvb.frontend;
+                       si2157_config.if_port = 1;
                        memset(&info, 0, sizeof(struct i2c_board_info));
                        strlcpy(info.type, "si2157", I2C_NAME_SIZE);
                        info.addr = 0x60;
index 99698002a808e74461e4d8ac27194d0e706608ea..e9a783b71b4523282d741b451f517b6b133e23d5 100644 (file)
@@ -111,6 +111,7 @@ static struct lgdt3306a_config hauppauge_hvr2255b_config = {
 
 static struct si2157_config hauppauge_hvr2255_tuner_config = {
        .inversion = 1,
+       .if_port = 1,
 };
 
 static int si2157_attach(struct saa7164_port *port, struct i2c_adapter *adapter,
@@ -665,6 +666,7 @@ int saa7164_dvb_register(struct saa7164_port *port)
 
                        /* attach tuner */
                        memset(&si2157_config, 0, sizeof(si2157_config));
+                       si2157_config.if_port = 1;
                        si2157_config.fe = port->dvb.frontend;
                        memset(&info, 0, sizeof(struct i2c_board_info));
                        strlcpy(info.type, "si2157", I2C_NAME_SIZE);
@@ -710,6 +712,7 @@ int saa7164_dvb_register(struct saa7164_port *port)
                        /* attach tuner */
                        memset(&si2157_config, 0, sizeof(si2157_config));
                        si2157_config.fe = port->dvb.frontend;
+                       si2157_config.if_port = 1;
                        memset(&info, 0, sizeof(struct i2c_board_info));
                        strlcpy(info.type, "si2157", I2C_NAME_SIZE);
                        info.addr = 0xc0 >> 1;
index 411592524c63501f23504ec44e3964c57ff22539..143fd7899ecd3ff07928a23b6f0d1704fd602ece 100644 (file)
@@ -657,6 +657,7 @@ static int smi_dvbsky_sit2_fe_attach(struct smi_port *port)
        /* attach tuner */
        memset(&si2157_config, 0, sizeof(si2157_config));
        si2157_config.fe = port->fe;
+       si2157_config.if_port = 1;
 
        memset(&client_info, 0, sizeof(struct i2c_board_info));
        strlcpy(client_info.type, "si2157", I2C_NAME_SIZE);
index d74ae26621ca531d458649c487fb9b883a73e00a..cdaf68781a2eede24f8b52e498624af7feddef7e 100644 (file)
@@ -298,7 +298,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
        if (dev->chiptype == SI2157_CHIPTYPE_SI2146)
                memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6);
        else
-               memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6);
+               memcpy(cmd.args, "\x14\x00\x02\x07\x00\x00", 6);
+       cmd.args[4] = dev->if_port;
        cmd.wlen = 6;
        cmd.rlen = 4;
        ret = si2157_cmd_execute(client, &cmd);
@@ -378,6 +379,7 @@ static int si2157_probe(struct i2c_client *client,
        i2c_set_clientdata(client, dev);
        dev->fe = cfg->fe;
        dev->inversion = cfg->inversion;
+       dev->if_port = cfg->if_port;
        dev->fw_loaded = false;
        dev->chiptype = (u8)id->driver_data;
        dev->if_frequency = 5000000; /* default value of property 0x0706 */
index a564c4a9fba7e6cf510e97a87f4930836abb34f5..4db97ab744d6b3f8ac7d55e6cbf7bf649a63390e 100644 (file)
@@ -34,6 +34,12 @@ struct si2157_config {
         * Spectral Inversion
         */
        bool inversion;
+
+       /*
+        * Port selection
+        * Select the RF interface to use (pins 9+11 or 12+13)
+        */
+       u8 if_port;
 };
 
 #endif
index cd8fa5b253047081d47b152cac551814e811ff76..71a5f8c389de816d199153baa64a60204cd48a9c 100644 (file)
@@ -28,6 +28,7 @@ struct si2157_dev {
        bool fw_loaded;
        bool inversion;
        u8 chiptype;
+       u8 if_port;
        u32 if_frequency;
 };
 
index 610d5675bde66e5cabd2727f5c31f30a1ef82493..66ee161fc7ba891a14bdace5f79b4a155d993ded 100644 (file)
@@ -797,6 +797,7 @@ static int dvb_init(struct cx231xx *dev)
                /* attach tuner */
                memset(&si2157_config, 0, sizeof(si2157_config));
                si2157_config.fe = dev->dvb->frontend;
+               si2157_config.if_port = 1;
                si2157_config.inversion = true;
                strlcpy(info.type, "si2157", I2C_NAME_SIZE);
                info.addr = 0x60;
@@ -852,6 +853,7 @@ static int dvb_init(struct cx231xx *dev)
                /* attach tuner */
                memset(&si2157_config, 0, sizeof(si2157_config));
                si2157_config.fe = dev->dvb->frontend;
+               si2157_config.if_port = 1;
                si2157_config.inversion = true;
                strlcpy(info.type, "si2157", I2C_NAME_SIZE);
                info.addr = 0x60;
index 80a29f5377ea54bd2be9fbe7be687bb0f9082565..7b7f75d8216ee3d9cff91bc0d0b0e55d1fc0e5f7 100644 (file)
@@ -1569,6 +1569,7 @@ static int it930x_tuner_attach(struct dvb_usb_adapter *adap)
 
        memset(&si2157_config, 0, sizeof(si2157_config));
        si2157_config.fe = adap->fe[0];
+       si2157_config.if_port = 1;
        ret = af9035_add_i2c_dev(d, "si2157", 0x63,
                        &si2157_config, state->i2c_adapter_demod);
 
index 0f73b1d23d56d4f3540549669f8b31abb6ee420a..57c8c2db9f2d7100906d0f04713a1b9235f39614 100644 (file)
@@ -549,6 +549,7 @@ static int dvbsky_t680c_attach(struct dvb_usb_adapter *adap)
        /* attach tuner */
        memset(&si2157_config, 0, sizeof(si2157_config));
        si2157_config.fe = adap->fe[0];
+       si2157_config.if_port = 1;
        memset(&info, 0, sizeof(struct i2c_board_info));
        strlcpy(info.type, "si2157", I2C_NAME_SIZE);
        info.addr = 0x60;
@@ -633,6 +634,7 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
        /* attach tuner */
        memset(&si2157_config, 0, sizeof(si2157_config));
        si2157_config.fe = adap->fe[0];
+       si2157_config.if_port = 1;
        memset(&info, 0, sizeof(struct i2c_board_info));
        strlcpy(info.type, "si2157", I2C_NAME_SIZE);
        info.addr = 0x60;
index ffc3704abdedce344d3cf0ccc9cff8a7df6762df..ab715118172878ff52c8ba3e1002ec2357971a8c 100644 (file)
@@ -1350,6 +1350,7 @@ static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap)
        /* attach tuner */
        memset(&si2157_config, 0, sizeof(si2157_config));
        si2157_config.fe = adap->fe_adap[0].fe;
+       si2157_config.if_port = 1;
        memset(&info, 0, sizeof(struct i2c_board_info));
        strlcpy(info.type, "si2157", I2C_NAME_SIZE);
        info.addr = 0x60;
index a5b22c5a240ced569dd83128b6d237838af0b2ef..5b7c7c888274ef50e7d2996af60b125c8b377626 100644 (file)
@@ -1579,6 +1579,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
                        /* attach tuner */
                        memset(&si2157_config, 0, sizeof(si2157_config));
                        si2157_config.fe = dvb->fe[0];
+                       si2157_config.if_port = 1;
                        memset(&info, 0, sizeof(struct i2c_board_info));
                        strlcpy(info.type, "si2157", I2C_NAME_SIZE);
                        info.addr = 0x60;
@@ -1639,6 +1640,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
                        /* attach tuner */
                        memset(&si2157_config, 0, sizeof(si2157_config));
                        si2157_config.fe = dvb->fe[0];
+                       si2157_config.if_port = 0;
                        memset(&info, 0, sizeof(struct i2c_board_info));
                        strlcpy(info.type, "si2146", I2C_NAME_SIZE);
                        info.addr = 0x60;