added support for tbs6916

This commit is contained in:
Davin622
2024-04-26 15:05:38 +08:00
parent eb50749344
commit d8d1ff33c0
8 changed files with 187 additions and 14 deletions

View File

@@ -87,6 +87,7 @@ struct stv_base {
u32 (*set_TSparam)(struct i2c_adapter *i2c,int tuner,int time,bool flag);
//end
int vglna;
bool control_22k; //for 6916
};
struct stv {
@@ -215,9 +216,15 @@ static int stid135_probe(struct stv *state)
err |= fe_stid135_tuner_enable(p_params->handle_demod, AFE_TUNER3);
err |= fe_stid135_tuner_enable(p_params->handle_demod, AFE_TUNER4);
err |= fe_stid135_diseqc_init(state->base->handle,AFE_TUNER1, FE_SAT_DISEQC_2_3_PWM);
err |= fe_stid135_diseqc_init(state->base->handle,AFE_TUNER2, FE_SAT_22KHZ_Continues);
err |= fe_stid135_diseqc_init(state->base->handle,AFE_TUNER3, FE_SAT_DISEQC_2_3_PWM);
err |= fe_stid135_diseqc_init(state->base->handle,AFE_TUNER4, FE_SAT_22KHZ_Continues);
err |= fe_stid135_diseqc_init(state->base->handle,AFE_TUNER3, FE_SAT_DISEQC_2_3_PWM);
if(state->base->control_22k){
err |= fe_stid135_diseqc_init(state->base->handle,AFE_TUNER2, FE_SAT_22KHZ_Continues);
err |= fe_stid135_diseqc_init(state->base->handle,AFE_TUNER4, FE_SAT_22KHZ_Continues);
}
else{
err |= fe_stid135_diseqc_init(state->base->handle,AFE_TUNER2, FE_SAT_DISEQC_2_3_PWM);
err |= fe_stid135_diseqc_init(state->base->handle,AFE_TUNER4, FE_SAT_DISEQC_2_3_PWM);
}
if (state->base->set_voltage) {
state->base->set_voltage(state->base->i2c, SEC_VOLTAGE_13, 0);
state->base->set_voltage(state->base->i2c, SEC_VOLTAGE_13, 1);
@@ -818,7 +825,8 @@ static int stid135_set_tone(struct dvb_frontend *fe, enum fe_sec_tone_mode tone)
return 0;
}
if(state->base->control_22k==false) //for 6916 demod1 ,disable the 22k function.
return 0;
mutex_lock(&state->base->status_lock);
err = fe_stid135_set_22khz_cont(state->base->handle,state->rf_in + 1, tone == SEC_TONE_ON);
mutex_unlock(&state->base->status_lock);
@@ -1086,6 +1094,7 @@ struct dvb_frontend *stid135_attach(struct i2c_adapter *i2c,
base->set_TSsampling = cfg->set_TSsampling;
base->set_TSparam = cfg->set_TSparam;
base->vglna = cfg->vglna; //for stvvglna 6909x v2 6903x v2
base->control_22k = cfg->control_22k;
mutex_init(&base->status_lock);

View File

@@ -46,6 +46,11 @@ struct stid135_cfg {
// for stvlna
int vglna;
//for tbs6916, because there are two stid135 (Demod 0 and Demod 1).
//if two Demod send 22k simultaneity, it will be affect the signal . so disable the Demod1 22k function on mode 0&1
//keep Demod 1 send diseqc function on unicable mode.
bool control_22k;
};
#if IS_REACHABLE(CONFIG_DVB_STID135)

View File

@@ -18,6 +18,85 @@
#include "tbsecp3.h"
struct tbsecp3_board tbsecp3_boards[] = {
[TBSECP3_BOARD_TBS6916] = {
.board_id = TBSECP3_BOARD_TBS6916,
.name = "TurboSight TBS 6916 (Octa DVB-S/S2/S2X)",
.adapters = 16,
.i2c_speed = 39,
.eeprom_i2c = 1,
.eeprom_addr = 0x00,
.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 = 0,
},
{
.ts_in = 2,
.i2c_bus_nr = 0,
},
{
.ts_in = 3,
.i2c_bus_nr = 0,
},
{
.ts_in = 4,
.i2c_bus_nr = 0,
},
{
.ts_in = 5,
.i2c_bus_nr = 0,
},
{
.ts_in = 6,
.i2c_bus_nr = 0,
},
{
.ts_in = 7,
.i2c_bus_nr = 0,
},
{
.ts_in = 8,
.i2c_bus_nr = 1,
.gpio.demod_reset.lvl = TBSECP3_GPIODEF_LOW,
.gpio.demod_reset.nr = TBSECP3_GPIO_PIN(1, 0),
},
{
.ts_in = 9,
.i2c_bus_nr = 1,
},
{
.ts_in = 10,
.i2c_bus_nr = 1,
},
{
.ts_in = 11,
.i2c_bus_nr = 1,
},
{
.ts_in = 12,
.i2c_bus_nr = 1,
},
{
.ts_in = 13,
.i2c_bus_nr = 1,
},
{
.ts_in = 14,
.i2c_bus_nr = 1,
},
{
.ts_in = 15,
.i2c_bus_nr = 1,
}
}
},
[TBSECP3_BOARD_TBS6590SE] = {
.board_id = TBSECP3_BOARD_TBS6590SE,
.name = "TurboSight TBS 6590SE DVB-S/S2/S2X/T/T2/C/C2 + 2xCI ",

View File

@@ -53,15 +53,45 @@ static irqreturn_t tbsecp3_irq_handler(int irq, void *dev_id)
tbs_write(TBSECP3_INT_BASE, TBSECP3_INT_STAT, stat);
if (stat & 0x00000ff0) {
/* dma */
if (stat & 0x000000f0) {
/* dma0~3 */
for (i = 0; i < dev->info->adapters; i++) {
in = dev->adapter[i].cfg->ts_in;
if (stat & TBSECP3_DMA_IF(in))
if (stat & TBSECP3_DMA_IF(in)){
tasklet_schedule(&dev->adapter[i].tasklet);
}
}
}
if (stat & 0x00000f00) {
/* dma 4~7*/
for (i = 4; i < dev->info->adapters; i++) {
in = dev->adapter[i].cfg->ts_in;
if (stat & TBSECP3_DMA_IF(in)){
tasklet_schedule(&dev->adapter[i].tasklet);
}
}
}
if (stat & 0x0000f000) {
/* dma8~11 */
for (i = 8; i < dev->info->adapters; i++) {
in = dev->adapter[i].cfg->ts_in;
if (stat & TBSECP3_DMA_IF1(in)){
tasklet_schedule(&dev->adapter[i].tasklet);
}
}
}
if (stat & 0x000f0000) {
/* dma 12~15*/
for (i = 12; i < dev->info->adapters; i++) {
in = dev->adapter[i].cfg->ts_in;
if (stat & TBSECP3_DMA_IF1(in)){
tasklet_schedule(&dev->adapter[i].tasklet);
}
}
}
if (stat & 0x0000000f) {
/* i2c */
for (i = 0; i < 4; i++) {
@@ -368,6 +398,7 @@ static const struct pci_device_id tbsecp3_id_table[] = {
TBSECP3_ID(TBSECP3_BOARD_TBS6522H,0x6522,0x0004),
TBSECP3_ID(TBSECP3_BOARD_TBS6504H,0x6504,0x0008),
TBSECP3_ID(TBSECP3_BOARD_TBS6590SE,0x6590,0x0002),
TBSECP3_ID(TBSECP3_BOARD_TBS6916,0x6916,0x0001),
{0}
};
MODULE_DEVICE_TABLE(pci, tbsecp3_id_table);

View File

@@ -17,7 +17,7 @@
#include "tbsecp3.h"
static unsigned int dma_pkts[8] = {128, 128, 128, 128, 128, 128, 128, 128};
static unsigned int dma_pkts[16] = {128, 128, 128, 128, 128, 128, 128, 128,128, 128, 128, 128, 128, 128, 128, 128};
module_param_array(dma_pkts, int, NULL, 0444); /* No /sys/module write access */
MODULE_PARM_DESC(dma_pkts, "DMA buffer size in TS packets (16-256), default 128");

View File

@@ -1019,6 +1019,7 @@ static struct stid135_cfg tbs6903x_stid135_cfg = {
.set_TSsampling = NULL,
.set_TSparam = NULL,
.vglna = 0,
.control_22k = true,
};
static struct stid135_cfg tbs6909x_stid135_cfg = {
@@ -1033,6 +1034,7 @@ static struct stid135_cfg tbs6909x_stid135_cfg = {
.set_TSsampling = NULL,
.set_TSparam = NULL,
.vglna = 0,
.control_22k = true,
};
static struct stid135_cfg tbs6903x_V2_stid135_cfg = {
@@ -1047,6 +1049,7 @@ static struct stid135_cfg tbs6903x_V2_stid135_cfg = {
.set_TSsampling = NULL,
.set_TSparam = NULL,
.vglna = 1,
.control_22k = true,
};
static struct stid135_cfg tbs6909x_V2_stid135_cfg = {
@@ -1061,6 +1064,7 @@ static struct stid135_cfg tbs6909x_V2_stid135_cfg = {
.set_TSsampling = NULL,
.set_TSparam = NULL,
.vglna = 2,
.control_22k = true,
};
static struct stid135_cfg tbs6912_stid135_cfg = {
@@ -1075,8 +1079,36 @@ static struct stid135_cfg tbs6912_stid135_cfg = {
.set_TSsampling = Set_TSsampling,
.set_TSparam = Set_TSparam,
.vglna = false,
.control_22k = true,
};
static struct stid135_cfg tbs6916_stid135_cfg[] = {
{
.adr = 0x68,
.clk = 27,
.ts_mode = TS_STFE,
.set_voltage = max_set_voltage,
.write_properties = ecp3_spi_write,
.read_properties = ecp3_spi_read,
.set_TSsampling = NULL,
.set_TSparam = NULL,
.vglna =false,
.control_22k = true,
},
{
.adr = 0x68,
.clk = 27,
.ts_mode = TS_STFE,
.set_voltage = max_set_voltage,
.write_properties = NULL,
.read_properties = NULL,
.set_TSsampling = NULL,
.set_TSparam = NULL,
.vglna =false,
.control_22k = false,
},
};
static struct rda5816_config rda5816_cfg[] = {
{
.i2c_adr = 0x8,
@@ -2460,7 +2492,20 @@ static int tbsecp3_frontend_attach(struct tbsecp3_adapter *adapter)
tbsecp3_ca_init(adapter, adapter->nr);
break;
case TBSECP3_BOARD_TBS6916:
if(adapter->nr<8)
adapter->fe = dvb_attach(stid135_attach, i2c,
&tbs6916_stid135_cfg[0], adapter->nr, adapter->nr/2);
else{
adapter->nr -= 8;
adapter->fe = dvb_attach(stid135_attach, i2c,
&tbs6916_stid135_cfg[1], adapter->nr, adapter->nr/2);
}
if (adapter->fe == NULL)
goto frontend_atach_fail;
case TBSECP3_BOARD_TBS6909X:
if(pci->subsystem_device==0x0010)
adapter->fe = dvb_attach(stid135_attach, i2c,

View File

@@ -34,7 +34,9 @@
#define TBSECP3_CA_BASE(_n) (0x6000 + 0x1000 * _n)
/* DMA */
#define TBSECP3_DMA_BASE(_n) (_n < 4) ? (0x8000 + 0x1000 * _n) : (0x8800 + 0x1000 * (_n - 4))
//#define TBSECP3_DMA_BASE(_n) (_n < 4) ? (0x8000 + 0x1000 * _n) : (0x8800 + 0x1000 * (_n - 4))
#define TBSECP3_DMA_BASE(_n) (_n<8)?((_n < 4) ? (0x8000 + 0x1000 * _n) : (0x8800 + 0x1000 * (_n - 4))): \
((_n < 12) ? (0x8400 + 0x1000 *( _n - 8)) : (0x8C00 + 0x1000 * (_n - 12)))
#define TBSECP3_DMA_STAT 0x0000
#define TBSECP3_DMA_EN 0x0000
#define TBSECP3_DMA_TSIZE 0x0004
@@ -50,7 +52,7 @@
#define TBSECP3_DMA_IE(_n) (0x0018 + 4 * _n)
#define TBSECP3_I2C_IF(_n) (0x0001 << _n)
#define TBSECP3_DMA_IF(_n) (0x0010 << _n)
#define TBSECP3_DMA_IF1(_n) (0x1000<<(_n-8))
//spi flash
#define SPI_CONFIG 0x10
#define SPI_STATUS 0x10

View File

@@ -88,8 +88,10 @@
#define TBSECP3_BOARD_TBS6504H 44
#define TBSECP3_BOARD_TBS6590SE 45
#define TBSECP3_BOARD_TBS6308X 46
#define TBSECP3_BOARD_TBS6916 47
#define TBSECP3_MAX_ADAPTERS (8)
#define TBSECP3_MAX_ADAPTERS (16)
#define TBSECP3_MAX_I2C_BUS (4)
#define TBSECP3_GPIODEF_NONE (0)
@@ -127,7 +129,7 @@ struct tbsecp3_board {
u32 i2c_speed;
u8 eeprom_i2c;
u8 eeprom_addr;
struct tbsecp3_adap_config adap_config[8];
struct tbsecp3_adap_config adap_config[16];
};
struct tbsecp3_i2c {
@@ -206,7 +208,7 @@ struct tbsecp3_dev {
bool msi;
/* dvb adapters */
struct tbsecp3_adapter adapter[TBSECP3_MAX_ADAPTERS];
struct tbsecp3_adapter adapter[16];
/* i2c */
struct tbsecp3_i2c i2c_bus[TBSECP3_MAX_I2C_BUS];