mirror of
				https://github.com/DigitalDevices/dddvb.git
				synced 2025-03-01 10:35:23 +00:00 
			
		
		
		
	change physical layer scrambling API to DTV_PLS and support old API
mixed with DTV_STREAM_ID
This commit is contained in:
		@@ -955,7 +955,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c->stream_id = NO_STREAM_ID_FILTER;
 | 
						c->stream_id = NO_STREAM_ID_FILTER;
 | 
				
			||||||
	c->scrambling_code = NO_SCRAMBLING_CODE;
 | 
						c->pls = NO_SCRAMBLING_CODE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (c->delivery_system) {
 | 
						switch (c->delivery_system) {
 | 
				
			||||||
	case SYS_DVBS:
 | 
						case SYS_DVBS:
 | 
				
			||||||
@@ -1032,7 +1032,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
 | 
				
			|||||||
	_DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),
 | 
						_DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),
 | 
				
			||||||
	_DTV_CMD(DTV_LNA, 1, 0),
 | 
						_DTV_CMD(DTV_LNA, 1, 0),
 | 
				
			||||||
	_DTV_CMD(DTV_INPUT, 1, 0),
 | 
						_DTV_CMD(DTV_INPUT, 1, 0),
 | 
				
			||||||
	_DTV_CMD(DTV_SCRAMBLING_CODE, 1, 0),
 | 
						_DTV_CMD(DTV_PLS, 1, 0),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Get */
 | 
						/* Get */
 | 
				
			||||||
	_DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1),
 | 
						_DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1),
 | 
				
			||||||
@@ -1464,8 +1464,8 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
 | 
				
			|||||||
		tvp->u.buffer.len = 4;
 | 
							tvp->u.buffer.len = 4;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case DTV_SCRAMBLING_CODE:
 | 
						case DTV_PLS:
 | 
				
			||||||
		tvp->u.data = c->scrambling_code;
 | 
							tvp->u.data = c->pls;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	/* Fill quality measures */
 | 
						/* Fill quality measures */
 | 
				
			||||||
@@ -1907,8 +1907,8 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
 | 
				
			|||||||
			r = fe->ops.set_input(fe, c->input);
 | 
								r = fe->ops.set_input(fe, c->input);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case DTV_SCRAMBLING_CODE:
 | 
						case DTV_PLS:
 | 
				
			||||||
		c->scrambling_code = tvp->u.data;
 | 
							c->pls = tvp->u.data;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -397,7 +397,7 @@ struct dtv_frontend_properties {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	u32			lna;
 | 
						u32			lna;
 | 
				
			||||||
	s32                     input;
 | 
						s32                     input;
 | 
				
			||||||
	u32			scrambling_code;
 | 
						u32			pls;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/* statistics data */
 | 
						/* statistics data */
 | 
				
			||||||
	struct dtv_fe_stats	strength;
 | 
						struct dtv_fe_stats	strength;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1067,6 +1067,7 @@ static int firmware_download(struct mxl *state, u8 *mbin, u32 mbin_len)
 | 
				
			|||||||
	status = read_register(state, HYDRA_PRCM_ROOT_CLK_REG, ®Data);
 | 
						status = read_register(state, HYDRA_PRCM_ROOT_CLK_REG, ®Data);
 | 
				
			||||||
	if (status)
 | 
						if (status)
 | 
				
			||||||
		return status;
 | 
							return status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	status = do_firmware_download(state, mbin, mbin_len);
 | 
						status = do_firmware_download(state, mbin, mbin_len);
 | 
				
			||||||
	if (status)
 | 
						if (status)
 | 
				
			||||||
		return status;
 | 
							return status;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -865,7 +865,7 @@ static int init_search_param(struct stv *state)
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	write_reg(state, RSTV0910_P2_UPLCCST0 + state->regoff, 0xe0);
 | 
						write_reg(state, RSTV0910_P2_UPLCCST0 + state->regoff, 0xe0);
 | 
				
			||||||
	write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0x00);
 | 
						write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0x00);
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	read_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, &tmp);
 | 
						read_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, &tmp);
 | 
				
			||||||
        tmp &= ~0x01;	// nosync = 0, in case next signal is standard TS
 | 
					        tmp &= ~0x01;	// nosync = 0, in case next signal is standard TS
 | 
				
			||||||
	write_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, tmp);
 | 
						write_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, tmp);
 | 
				
			||||||
@@ -961,7 +961,7 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
 | 
				
			|||||||
	s32 Freq;
 | 
						s32 Freq;
 | 
				
			||||||
	u8  regDMDCFGMD;
 | 
						u8  regDMDCFGMD;
 | 
				
			||||||
	u16 symb;
 | 
						u16 symb;
 | 
				
			||||||
	u32 ScramblingCode;
 | 
						u32 ScramblingCode = 1;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (p->symbol_rate < 100000 || p->symbol_rate > 70000000)
 | 
						if (p->symbol_rate < 100000 || p->symbol_rate > 70000000)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
@@ -975,10 +975,18 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	init_search_param(state);
 | 
						init_search_param(state);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
        if (p->scrambling_code != NO_SCRAMBLING_CODE)
 | 
					        if (p->stream_id != NO_STREAM_ID_FILTER) {
 | 
				
			||||||
		ScramblingCode = p->scrambling_code;
 | 
							/* Backwards compatibility to "crazy" API.
 | 
				
			||||||
	else
 | 
							   PRBS X root cannot be 0, so this should always work.
 | 
				
			||||||
		ScramblingCode = 1;
 | 
							*/
 | 
				
			||||||
 | 
							if (p->stream_id & 0xffffff00) 
 | 
				
			||||||
 | 
								ScramblingCode = p->stream_id >> 8;
 | 
				
			||||||
 | 
							write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff, p->stream_id & 0xff);
 | 
				
			||||||
 | 
							write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0xff);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (p->pls != NO_SCRAMBLING_CODE)
 | 
				
			||||||
 | 
							ScramblingCode = p->pls;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ScramblingCode != state->CurScramblingCode) {
 | 
					        if (ScramblingCode != state->CurScramblingCode) {
 | 
				
			||||||
		write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff,
 | 
							write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff,
 | 
				
			||||||
@@ -990,11 +998,6 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
 | 
				
			|||||||
		state->CurScramblingCode = ScramblingCode;
 | 
							state->CurScramblingCode = ScramblingCode;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (p->stream_id != NO_STREAM_ID_FILTER) {
 | 
					 | 
				
			||||||
		write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff, p->stream_id & 0xff);
 | 
					 | 
				
			||||||
		write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0xff);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (p->symbol_rate <= 1000000) {  /*SR <=1Msps*/
 | 
						if (p->symbol_rate <= 1000000) {  /*SR <=1Msps*/
 | 
				
			||||||
		state->DemodTimeout = 3000;
 | 
							state->DemodTimeout = 3000;
 | 
				
			||||||
		state->FecTimeout = 2000;
 | 
							state->FecTimeout = 2000;
 | 
				
			||||||
@@ -1246,7 +1249,7 @@ static int get_frequency_offset(struct stv *state, s32 *off)
 | 
				
			|||||||
	if (derot & (1<<23))
 | 
						if (derot & (1<<23))
 | 
				
			||||||
		derot |= 0xFF000000;
 | 
							derot |= 0xFF000000;
 | 
				
			||||||
        *off = - (s32) (((s64) derot * (s64) state->base->mclk) >> 24);
 | 
					        *off = - (s32) (((s64) derot * (s64) state->base->mclk) >> 24);
 | 
				
			||||||
	pr_info("foff = %d\n", *off);
 | 
						//pr_info("foff = %d\n", *off);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -379,9 +379,9 @@ struct dvb_frontend_event {
 | 
				
			|||||||
#define DTV_STAT_TOTAL_BLOCK_COUNT	69
 | 
					#define DTV_STAT_TOTAL_BLOCK_COUNT	69
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DTV_INPUT                       70
 | 
					#define DTV_INPUT                       70
 | 
				
			||||||
#define DTV_SCRAMBLING_CODE             71
 | 
					#define DTV_PLS                         71
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DTV_MAX_COMMAND		DTV_SCRAMBLING_CODE
 | 
					#define DTV_MAX_COMMAND		DTV_PLS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef enum fe_pilot {
 | 
					typedef enum fe_pilot {
 | 
				
			||||||
	PILOT_ON,
 | 
						PILOT_ON,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user