Skip to content

Commit

Permalink
[media] si2157: support selection of IF interface
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Antti Palosaari <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
trsqr authored and mchehab committed May 12, 2015
1 parent 7adf99d commit ee3c3e4
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions drivers/media/pci/cx23885/cx23885-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions drivers/media/pci/saa7164/saa7164-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions drivers/media/pci/smipcie/smipcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion drivers/media/tuners/si2157.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down
6 changes: 6 additions & 0 deletions drivers/media/tuners/si2157.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions drivers/media/tuners/si2157_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct si2157_dev {
bool fw_loaded;
bool inversion;
u8 chiptype;
u8 if_port;
u32 if_frequency;
};

Expand Down
2 changes: 2 additions & 0 deletions drivers/media/usb/cx231xx/cx231xx-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions drivers/media/usb/dvb-usb-v2/af9035.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions drivers/media/usb/dvb-usb-v2/dvbsky.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions drivers/media/usb/dvb-usb/cxusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions drivers/media/usb/em28xx/em28xx-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ee3c3e4

Please sign in to comment.