Skip to content

Commit

Permalink
add support for TBS6590se
Browse files Browse the repository at this point in the history
  • Loading branch information
Davin622 committed Apr 12, 2023
1 parent f609989 commit dc7691b
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 28 deletions.
32 changes: 28 additions & 4 deletions drivers/media/dvb-frontends/cxd2878.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct cxd2878_dev{
u32 atscNoSignalThresh;
u32 atscSignalThresh;
u32 tune_time;

};
/* For CXD2856 or newer generation ICs */
static struct sony_ascot3_adjust_param_t g_param_table_ascot3i[SONY_ASCOT3_TV_SYSTEM_NUM] = {
Expand Down Expand Up @@ -2901,9 +2902,12 @@ static int cxd2878_set_frontend(struct dvb_frontend *fe)

mutex_lock(&dev->base->i2c_lock);

if(!dev->warm)
cxd2878_init(fe);

if(!dev->warm)
cxd2878_init(fe);

if(dev->base->config->RF_switch)
dev->base->config->RF_switch(dev->base->i2c,dev->base->config->rf_port,0);

switch(c->delivery_system){
case SYS_DVBT:
ret = cxd2878_set_dvbt(fe);
Expand Down Expand Up @@ -2959,6 +2963,7 @@ static int cxd2878_tune(struct dvb_frontend*fe,bool re_tune,
{
struct cxd2878_dev *dev = fe->demodulator_priv;
int ret = 0;

if(re_tune){
ret = cxd2878_set_frontend(fe);
if(ret)
Expand Down Expand Up @@ -3087,7 +3092,24 @@ static void cxd2878_spi_write(struct dvb_frontend *fe,struct ecp3_info *ecp3inf)
dev->base->config->write_properties(dev->base->i2c,ecp3inf->reg, ecp3inf->data);
return ;
}
static void cxd2878_eeprom_read(struct dvb_frontend *fe, struct eeprom_info *eepinf)
{
struct cxd2878_dev *dev = fe->demodulator_priv;

if (dev->base->config->read_eeprom)
dev->base->config->read_eeprom(dev->base->i2c,eepinf->reg, &(eepinf->data));
return ;
}

static void cxd2878_eeprom_write(struct dvb_frontend *fe,struct eeprom_info *eepinf)
{
struct cxd2878_dev *dev = fe->demodulator_priv;

if (dev->base->config->write_eeprom)
dev->base->config->write_eeprom(dev->base->i2c,eepinf->reg, eepinf->data);

return ;
}
static void cxd2878_release (struct dvb_frontend*fe)
{
struct cxd2878_dev *dev = fe->demodulator_priv;
Expand Down Expand Up @@ -3145,6 +3167,8 @@ static const struct dvb_frontend_ops cxd2878_ops = {

.spi_read = cxd2878_spi_read,
.spi_write = cxd2878_spi_write,
.eeprom_read = cxd2878_eeprom_read,
.eeprom_write = cxd2878_eeprom_write,
};

static struct cxd_base *match_base(struct i2c_adapter *i2c,u8 adr)
Expand All @@ -3157,7 +3181,7 @@ static struct cxd_base *match_base(struct i2c_adapter *i2c,u8 adr)
return NULL;
}
struct dvb_frontend*cxd2878_attach(const struct cxd2878_config*config,
struct i2c_adapter*i2c)
struct i2c_adapter*i2c)
{
struct cxd2878_dev *dev;
struct cxd_base *base;
Expand Down
6 changes: 6 additions & 0 deletions drivers/media/dvb-frontends/cxd2878.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ struct cxd2878_config{
//for ecp3 update
void (*write_properties) (struct i2c_adapter *i2c,u8 reg, u32 buf);
void (*read_properties) (struct i2c_adapter *i2c,u8 reg, u32 *buf);
// EEPROM access
void (*write_eeprom) (struct i2c_adapter *i2c,u8 reg, u8 buf);
void (*read_eeprom) (struct i2c_adapter *i2c,u8 reg, u8 *buf);

//for 6590SE mode change(T or s);
void (*RF_switch)(struct i2c_adapter * i2c,u8 rf_in,u8 flag);
u8 rf_port; //for change command
};

#if IS_REACHABLE(CONFIG_DVB_CXD2878)
Expand Down
30 changes: 13 additions & 17 deletions drivers/media/dvb-frontends/m88rs6060.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ struct m88rs6060_dev {
u64 post_bit_count;
struct m88rs6060_base *base;
struct si5351_priv *priv;
void (*write_properties)(struct i2c_adapter * i2c, u8 reg, u32 buf);
void (*read_properties)(struct i2c_adapter * i2c, u8 reg, u32 * buf);

void (*write_eeprom) (struct i2c_adapter *i2c,u8 reg, u8 buf);
void (*read_eeprom) (struct i2c_adapter *i2c,u8 reg, u8 *buf);

bool newTP;

Expand Down Expand Up @@ -1961,6 +1956,9 @@ static int m88rs6060_set_frontend(struct dvb_frontend *fe)
goto err;
}

if(dev->config.RF_switch)
dev->config.RF_switch(i2c,dev->config.num,1); //

mutex_lock(&dev->base->i2c_mutex);

symbol_rate_KSs = c->symbol_rate / 1000;
Expand Down Expand Up @@ -3270,8 +3268,8 @@ static void m88rs6060_spi_read(struct dvb_frontend *fe,
struct m88rs6060_dev *dev = i2c_get_clientdata(client);
struct i2c_adapter *i2c = dev->base->i2c;

if (dev->read_properties)
dev->read_properties(i2c, ecp3inf->reg,
if (dev->config.read_properties)
dev->config.read_properties(i2c, ecp3inf->reg,
&(ecp3inf->data));

return;
Expand All @@ -3284,8 +3282,8 @@ static void m88rs6060_spi_write(struct dvb_frontend *fe,
struct m88rs6060_dev *dev = i2c_get_clientdata(client);
struct i2c_adapter *i2c = dev->base->i2c;

if (dev->write_properties)
dev->write_properties(i2c, ecp3inf->reg,
if (dev->config.write_properties)
dev->config.write_properties(i2c, ecp3inf->reg,
ecp3inf->data);
return;
}
Expand All @@ -3296,8 +3294,8 @@ static void m88rs6060_eeprom_read(struct dvb_frontend *fe, struct eeprom_info *e
struct m88rs6060_dev *dev = i2c_get_clientdata(client);
struct i2c_adapter *i2c = dev->base->i2c;

if (dev->read_eeprom)
dev->read_eeprom(i2c, eepinf->reg,
if (dev->config.read_eeprom)
dev->config.read_eeprom(i2c, eepinf->reg,
&(eepinf->data));
return ;
}
Expand All @@ -3308,8 +3306,8 @@ static void m88rs6060_eeprom_write(struct dvb_frontend *fe,struct eeprom_info *e
struct m88rs6060_dev *dev = i2c_get_clientdata(client);
struct i2c_adapter *i2c = dev->base->i2c;

if (dev->write_eeprom)
dev->write_eeprom(i2c, eepinf->reg,
if (dev->config.write_eeprom)
dev->config.write_eeprom(i2c, eepinf->reg,
eepinf->data);
return ;
}
Expand Down Expand Up @@ -3492,6 +3490,7 @@ static int m88rs6060_probe(struct i2c_client *client,
dev->config.write_properties = cfg->write_properties;
dev->config.read_eeprom = cfg->read_eeprom;
dev->config.write_eeprom = cfg->write_eeprom;
dev->config.RF_switch = cfg->RF_switch;
dev->config.envelope_mode = cfg->envelope_mode;
dev->config.disable_22k = cfg->disable_22k;
dev->TsClockChecked = false;
Expand Down Expand Up @@ -3538,10 +3537,7 @@ static int m88rs6060_probe(struct i2c_client *client,
memcpy(&dev->fe.ops, &m88rs6060_ops, sizeof(struct dvb_frontend_ops));
*cfg->fe = &dev->fe;
dev->fe_status = 0;
dev->write_properties = cfg->write_properties;
dev->read_properties = cfg->read_properties;
dev->write_eeprom = cfg->write_eeprom;
dev->read_eeprom = cfg->read_eeprom;


if(dev->config.HAS_CI){ //for 6910SECI
//for ci clk si5351
Expand Down
2 changes: 2 additions & 0 deletions drivers/media/dvb-frontends/m88rs6060.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ struct m88rs6060_cfg {
void (*read_properties)(struct i2c_adapter * i2c, u8 reg, u32 * buf);
void (*write_eeprom) (struct i2c_adapter *i2c,u8 reg, u8 buf);
void (*read_eeprom) (struct i2c_adapter *i2c,u8 reg, u8 *buf);
/*rf switch for 6590se*/
void (*RF_switch)(struct i2c_adapter * i2c,u8 rf_in,u8 flag);
};

#endif
24 changes: 24 additions & 0 deletions drivers/media/pci/tbsecp3/tbsecp3-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@
#include "tbsecp3.h"

struct tbsecp3_board tbsecp3_boards[] = {
[TBSECP3_BOARD_TBS6590SE] = {
.board_id = TBSECP3_BOARD_TBS6590SE,
.name = "TurboSight TBS 6590SE DVB-S/S2/S2X/T/T2/C/C2 + 2xCI ",
.adapters = 2,
.i2c_speed = 39,
.eeprom_i2c = 0,
.eeprom_addr = 0x10,
.adap_config = {
{
.ts_in = 0,
.i2c_bus_nr = 0,
.gpio.demod_reset.lvl = TBSECP3_GPIODEF_LOW,
.gpio.demod_reset.nr = TBSECP3_GPIO_PIN(0, 0),

},
{
.ts_in = 1,
.i2c_bus_nr = 1,
.gpio.demod_reset.lvl = TBSECP3_GPIODEF_LOW,
.gpio.demod_reset.nr = TBSECP3_GPIO_PIN(1, 0),

},
}
},
[TBSECP3_BOARD_TBS6504H] = {
.board_id = TBSECP3_BOARD_TBS6504H,
.name = "TurboSight TBS 6504H Quad DVBS/S2x + Quad DVB-T/T2/C ISDB-T/C ATSC1.0",
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/pci/tbsecp3/tbsecp3-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ static const struct pci_device_id tbsecp3_id_table[] = {
TBSECP3_ID(TBSECP3_BOARD_TBS6909SE,0x6909,0x0066),
TBSECP3_ID(TBSECP3_BOARD_TBS6304T,0x6304,0x0009),
TBSECP3_ID(TBSECP3_BOARD_TBS6522H,0x6522,0x0004),
TBSECP3_ID(TBSECP3_BOARD_TBS6504H,0x6504,0x0008),
TBSECP3_ID(TBSECP3_BOARD_TBS6504H,0x6504,0x0008),
TBSECP3_ID(TBSECP3_BOARD_TBS6590SE,0x6590,0x0002),
{0}
};
MODULE_DEVICE_TABLE(pci, tbsecp3_id_table);
Expand Down
Loading

0 comments on commit dc7691b

Please sign in to comment.