Commit 0fe44629 authored by Oliver Endriss's avatar Oliver Endriss Committed by Mauro Carvalho Chehab

[media] tda18271c2dd: Lots of coding-style fixes

Signed-off-by: default avatarOliver Endriss <o.endriss@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e8783950
...@@ -64,8 +64,7 @@ struct SRFBandMap { ...@@ -64,8 +64,7 @@ struct SRFBandMap {
u32 m_RF3_Default; u32 m_RF3_Default;
}; };
enum ERegister enum ERegister {
{
ID = 0, ID = 0,
TM, TM,
PL, PL,
...@@ -115,13 +114,13 @@ struct tda_state { ...@@ -115,13 +114,13 @@ struct tda_state {
}; };
static int PowerScan(struct tda_state *state, static int PowerScan(struct tda_state *state,
u8 RFBand,u32 RF_in, u8 RFBand, u32 RF_in,
u32 * pRF_Out, bool *pbcal); u32 *pRF_Out, bool *pbcal);
static int i2c_readn(struct i2c_adapter *adapter, u8 adr, u8 *data, int len) static int i2c_readn(struct i2c_adapter *adapter, u8 adr, u8 *data, int len)
{ {
struct i2c_msg msgs[1] = {{.addr = adr, .flags = I2C_M_RD, struct i2c_msg msgs[1] = {{.addr = adr, .flags = I2C_M_RD,
.buf = data, .len = len}}; .buf = data, .len = len} };
return (i2c_transfer(adapter, msgs, 1) == 1) ? 0 : -1; return (i2c_transfer(adapter, msgs, 1) == 1) ? 0 : -1;
} }
...@@ -131,7 +130,7 @@ static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len) ...@@ -131,7 +130,7 @@ static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len)
.buf = data, .len = len}; .buf = data, .len = len};
if (i2c_transfer(adap, &msg, 1) != 1) { if (i2c_transfer(adap, &msg, 1) != 1) {
printk("i2c_write error\n"); printk(KERN_ERR "i2c_write error\n");
return -1; return -1;
} }
return 0; return 0;
...@@ -147,7 +146,7 @@ static int WriteRegs(struct tda_state *state, ...@@ -147,7 +146,7 @@ static int WriteRegs(struct tda_state *state,
return i2c_write(state->i2c, state->adr, data, nRegs+1); return i2c_write(state->i2c, state->adr, data, nRegs+1);
} }
static int WriteReg(struct tda_state *state, u8 SubAddr,u8 Reg) static int WriteReg(struct tda_state *state, u8 SubAddr, u8 Reg)
{ {
u8 msg[2] = {SubAddr, Reg}; u8 msg[2] = {SubAddr, Reg};
...@@ -164,14 +163,14 @@ static int ReadExtented(struct tda_state *state, u8 * Regs) ...@@ -164,14 +163,14 @@ static int ReadExtented(struct tda_state *state, u8 * Regs)
return i2c_readn(state->i2c, state->adr, Regs, NUM_REGS); return i2c_readn(state->i2c, state->adr, Regs, NUM_REGS);
} }
static int UpdateRegs(struct tda_state *state, u8 RegFrom,u8 RegTo) static int UpdateRegs(struct tda_state *state, u8 RegFrom, u8 RegTo)
{ {
return WriteRegs(state, RegFrom, return WriteRegs(state, RegFrom,
&state->m_Regs[RegFrom], RegTo-RegFrom+1); &state->m_Regs[RegFrom], RegTo-RegFrom+1);
} }
static int UpdateReg(struct tda_state *state, u8 Reg) static int UpdateReg(struct tda_state *state, u8 Reg)
{ {
return WriteReg(state, Reg,state->m_Regs[Reg]); return WriteReg(state, Reg, state->m_Regs[Reg]);
} }
#include "tda18271c2dd_maps.h" #include "tda18271c2dd_maps.h"
...@@ -186,7 +185,7 @@ static void reset(struct tda_state *state) ...@@ -186,7 +185,7 @@ static void reset(struct tda_state *state)
u32 ulIFLevelDVBC = 7; u32 ulIFLevelDVBC = 7;
u32 ulIFLevelDVBT = 6; u32 ulIFLevelDVBT = 6;
u32 ulXTOut = 0; u32 ulXTOut = 0;
u32 ulStandbyMode = 0x06; // Send in stdb, but leave osc on u32 ulStandbyMode = 0x06; /* Send in stdb, but leave osc on */
u32 ulSlave = 0; u32 ulSlave = 0;
u32 ulFMInput = 0; u32 ulFMInput = 0;
u32 ulSettlingTime = 100; u32 ulSettlingTime = 100;
...@@ -199,7 +198,8 @@ static void reset(struct tda_state *state) ...@@ -199,7 +198,8 @@ static void reset(struct tda_state *state)
state->m_IFLevelDVBT = (ulIFLevelDVBT & 0x07) << 2; state->m_IFLevelDVBT = (ulIFLevelDVBT & 0x07) << 2;
state->m_EP4 = 0x20; state->m_EP4 = 0x20;
if( ulXTOut != 0 ) state->m_EP4 |= 0x40; if (ulXTOut != 0)
state->m_EP4 |= 0x40;
state->m_EP3_Standby = ((ulStandbyMode & 0x07) << 5) | 0x0F; state->m_EP3_Standby = ((ulStandbyMode & 0x07) << 5) | 0x0F;
state->m_bMaster = (ulSlave == 0); state->m_bMaster = (ulSlave == 0);
...@@ -214,7 +214,7 @@ static bool SearchMap1(struct SMap Map[], ...@@ -214,7 +214,7 @@ static bool SearchMap1(struct SMap Map[],
{ {
int i = 0; int i = 0;
while ((Map[i].m_Frequency != 0) && (Frequency > Map[i].m_Frequency) ) while ((Map[i].m_Frequency != 0) && (Frequency > Map[i].m_Frequency))
i += 1; i += 1;
if (Map[i].m_Frequency == 0) if (Map[i].m_Frequency == 0)
return false; return false;
...@@ -228,7 +228,7 @@ static bool SearchMap2(struct SMapI Map[], ...@@ -228,7 +228,7 @@ static bool SearchMap2(struct SMapI Map[],
int i = 0; int i = 0;
while ((Map[i].m_Frequency != 0) && while ((Map[i].m_Frequency != 0) &&
(Frequency > Map[i].m_Frequency) ) (Frequency > Map[i].m_Frequency))
i += 1; i += 1;
if (Map[i].m_Frequency == 0) if (Map[i].m_Frequency == 0)
return false; return false;
...@@ -236,13 +236,13 @@ static bool SearchMap2(struct SMapI Map[], ...@@ -236,13 +236,13 @@ static bool SearchMap2(struct SMapI Map[],
return true; return true;
} }
static bool SearchMap3(struct SMap2 Map[],u32 Frequency, static bool SearchMap3(struct SMap2 Map[], u32 Frequency,
u8 *pParam1, u8 *pParam2) u8 *pParam1, u8 *pParam2)
{ {
int i = 0; int i = 0;
while ((Map[i].m_Frequency != 0) && while ((Map[i].m_Frequency != 0) &&
(Frequency > Map[i].m_Frequency) ) (Frequency > Map[i].m_Frequency))
i += 1; i += 1;
if (Map[i].m_Frequency == 0) if (Map[i].m_Frequency == 0)
return false; return false;
...@@ -271,22 +271,23 @@ static int ThermometerRead(struct tda_state *state, u8 *pTM_Value) ...@@ -271,22 +271,23 @@ static int ThermometerRead(struct tda_state *state, u8 *pTM_Value)
do { do {
u8 Regs[16]; u8 Regs[16];
state->m_Regs[TM] |= 0x10; state->m_Regs[TM] |= 0x10;
CHK_ERROR(UpdateReg(state,TM)); CHK_ERROR(UpdateReg(state, TM));
CHK_ERROR(Read(state,Regs)); CHK_ERROR(Read(state, Regs));
if( ( (Regs[TM] & 0x0F) == 0 && (Regs[TM] & 0x20) == 0x20 ) || if (((Regs[TM] & 0x0F) == 0 && (Regs[TM] & 0x20) == 0x20) ||
( (Regs[TM] & 0x0F) == 8 && (Regs[TM] & 0x20) == 0x00 ) ) { ((Regs[TM] & 0x0F) == 8 && (Regs[TM] & 0x20) == 0x00)) {
state->m_Regs[TM] ^= 0x20; state->m_Regs[TM] ^= 0x20;
CHK_ERROR(UpdateReg(state,TM)); CHK_ERROR(UpdateReg(state, TM));
msleep(10); msleep(10);
CHK_ERROR(Read(state,Regs)); CHK_ERROR(Read(state, Regs));
} }
*pTM_Value = (Regs[TM] & 0x20 ) ? m_Thermometer_Map_2[Regs[TM] & 0x0F] : *pTM_Value = (Regs[TM] & 0x20)
m_Thermometer_Map_1[Regs[TM] & 0x0F] ; ? m_Thermometer_Map_2[Regs[TM] & 0x0F]
state->m_Regs[TM] &= ~0x10; // Thermometer off : m_Thermometer_Map_1[Regs[TM] & 0x0F] ;
CHK_ERROR(UpdateReg(state,TM)); state->m_Regs[TM] &= ~0x10; /* Thermometer off */
state->m_Regs[EP4] &= ~0x03; // CAL_mode = 0 ????????? CHK_ERROR(UpdateReg(state, TM));
CHK_ERROR(UpdateReg(state,EP4)); state->m_Regs[EP4] &= ~0x03; /* CAL_mode = 0 ????????? */
} while(0); CHK_ERROR(UpdateReg(state, EP4));
} while (0);
return status; return status;
} }
...@@ -295,16 +296,16 @@ static int StandBy(struct tda_state *state) ...@@ -295,16 +296,16 @@ static int StandBy(struct tda_state *state)
{ {
int status = 0; int status = 0;
do { do {
state->m_Regs[EB12] &= ~0x20; // PD_AGC1_Det = 0 state->m_Regs[EB12] &= ~0x20; /* PD_AGC1_Det = 0 */
CHK_ERROR(UpdateReg(state,EB12)); CHK_ERROR(UpdateReg(state, EB12));
state->m_Regs[EB18] &= ~0x83; // AGC1_loop_off = 0, AGC1_Gain = 6 dB state->m_Regs[EB18] &= ~0x83; /* AGC1_loop_off = 0, AGC1_Gain = 6 dB */
CHK_ERROR(UpdateReg(state,EB18)); CHK_ERROR(UpdateReg(state, EB18));
state->m_Regs[EB21] |= 0x03; // AGC2_Gain = -6 dB state->m_Regs[EB21] |= 0x03; /* AGC2_Gain = -6 dB */
state->m_Regs[EP3] = state->m_EP3_Standby; state->m_Regs[EP3] = state->m_EP3_Standby;
CHK_ERROR(UpdateReg(state,EP3)); CHK_ERROR(UpdateReg(state, EP3));
state->m_Regs[EB23] &= ~0x06; // ForceLP_Fc2_En = 0, LP_Fc[2] = 0 state->m_Regs[EB23] &= ~0x06; /* ForceLP_Fc2_En = 0, LP_Fc[2] = 0 */
CHK_ERROR(UpdateRegs(state,EB21,EB23)); CHK_ERROR(UpdateRegs(state, EB21, EB23));
} while(0); } while (0);
return status; return status;
} }
...@@ -316,9 +317,8 @@ static int CalcMainPLL(struct tda_state *state, u32 freq) ...@@ -316,9 +317,8 @@ static int CalcMainPLL(struct tda_state *state, u32 freq)
u64 OscFreq; u64 OscFreq;
u32 MainDiv; u32 MainDiv;
if (!SearchMap3(m_Main_PLL_Map, freq, &PostDiv, &Div)) { if (!SearchMap3(m_Main_PLL_Map, freq, &PostDiv, &Div))
return -EINVAL; return -EINVAL;
}
OscFreq = (u64) freq * (u64) Div; OscFreq = (u64) freq * (u64) Div;
OscFreq *= (u64) 16384; OscFreq *= (u64) 16384;
...@@ -328,133 +328,122 @@ static int CalcMainPLL(struct tda_state *state, u32 freq) ...@@ -328,133 +328,122 @@ static int CalcMainPLL(struct tda_state *state, u32 freq)
state->m_Regs[MPD] = PostDiv & 0x77; state->m_Regs[MPD] = PostDiv & 0x77;
state->m_Regs[MD1] = ((MainDiv >> 16) & 0x7F); state->m_Regs[MD1] = ((MainDiv >> 16) & 0x7F);
state->m_Regs[MD2] = ((MainDiv >> 8) & 0xFF); state->m_Regs[MD2] = ((MainDiv >> 8) & 0xFF);
state->m_Regs[MD3] = ((MainDiv ) & 0xFF); state->m_Regs[MD3] = (MainDiv & 0xFF);
return UpdateRegs(state, MPD, MD3); return UpdateRegs(state, MPD, MD3);
} }
static int CalcCalPLL(struct tda_state *state, u32 freq) static int CalcCalPLL(struct tda_state *state, u32 freq)
{ {
//KdPrintEx((MSG_TRACE " - " __FUNCTION__ "(%d)\n",freq));
u8 PostDiv; u8 PostDiv;
u8 Div; u8 Div;
u64 OscFreq; u64 OscFreq;
u32 CalDiv; u32 CalDiv;
if( !SearchMap3(m_Cal_PLL_Map,freq,&PostDiv,&Div) ) if (!SearchMap3(m_Cal_PLL_Map, freq, &PostDiv, &Div))
{
return -EINVAL; return -EINVAL;
}
OscFreq = (u64)freq * (u64)Div; OscFreq = (u64)freq * (u64)Div;
//CalDiv = u32( OscFreq * 16384 / 16000000 ); /* CalDiv = u32( OscFreq * 16384 / 16000000 ); */
OscFreq*=(u64)16384; OscFreq *= (u64)16384;
do_div(OscFreq, (u64)16000000); do_div(OscFreq, (u64)16000000);
CalDiv=OscFreq; CalDiv = OscFreq;
state->m_Regs[CPD] = PostDiv; state->m_Regs[CPD] = PostDiv;
state->m_Regs[CD1] = ((CalDiv >> 16) & 0xFF); state->m_Regs[CD1] = ((CalDiv >> 16) & 0xFF);
state->m_Regs[CD2] = ((CalDiv >> 8) & 0xFF); state->m_Regs[CD2] = ((CalDiv >> 8) & 0xFF);
state->m_Regs[CD3] = ((CalDiv ) & 0xFF); state->m_Regs[CD3] = (CalDiv & 0xFF);
return UpdateRegs(state,CPD,CD3); return UpdateRegs(state, CPD, CD3);
} }
static int CalibrateRF(struct tda_state *state, static int CalibrateRF(struct tda_state *state,
u8 RFBand,u32 freq, s32 * pCprog) u8 RFBand, u32 freq, s32 *pCprog)
{ {
//KdPrintEx((MSG_TRACE " - " __FUNCTION__ " ID = %02x\n",state->m_Regs[ID]));
int status = 0; int status = 0;
u8 Regs[NUM_REGS]; u8 Regs[NUM_REGS];
do { do {
u8 BP_Filter=0; u8 BP_Filter = 0;
u8 GainTaper=0; u8 GainTaper = 0;
u8 RFC_K=0; u8 RFC_K = 0;
u8 RFC_M=0; u8 RFC_M = 0;
state->m_Regs[EP4] &= ~0x03; // CAL_mode = 0 state->m_Regs[EP4] &= ~0x03; /* CAL_mode = 0 */
CHK_ERROR(UpdateReg(state,EP4)); CHK_ERROR(UpdateReg(state, EP4));
state->m_Regs[EB18] |= 0x03; // AGC1_Gain = 3 state->m_Regs[EB18] |= 0x03; /* AGC1_Gain = 3 */
CHK_ERROR(UpdateReg(state,EB18)); CHK_ERROR(UpdateReg(state, EB18));
// Switching off LT (as datasheet says) causes calibration on C1 to fail /* Switching off LT (as datasheet says) causes calibration on C1 to fail */
// (Readout of Cprog is allways 255) /* (Readout of Cprog is allways 255) */
if( state->m_Regs[ID] != 0x83 ) // C1: ID == 83, C2: ID == 84 if (state->m_Regs[ID] != 0x83) /* C1: ID == 83, C2: ID == 84 */
{ state->m_Regs[EP3] |= 0x40; /* SM_LT = 1 */
state->m_Regs[EP3] |= 0x40; // SM_LT = 1
} if (!(SearchMap1(m_BP_Filter_Map, freq, &BP_Filter) &&
SearchMap1(m_GainTaper_Map, freq, &GainTaper) &&
if( ! ( SearchMap1(m_BP_Filter_Map,freq,&BP_Filter) && SearchMap3(m_KM_Map, freq, &RFC_K, &RFC_M)))
SearchMap1(m_GainTaper_Map,freq,&GainTaper) &&
SearchMap3(m_KM_Map,freq,&RFC_K,&RFC_M)) )
{
return -EINVAL; return -EINVAL;
}
state->m_Regs[EP1] = (state->m_Regs[EP1] & ~0x07) | BP_Filter; state->m_Regs[EP1] = (state->m_Regs[EP1] & ~0x07) | BP_Filter;
state->m_Regs[EP2] = (RFBand << 5) | GainTaper; state->m_Regs[EP2] = (RFBand << 5) | GainTaper;
state->m_Regs[EB13] = (state->m_Regs[EB13] & ~0x7C) | (RFC_K << 4) | (RFC_M << 2); state->m_Regs[EB13] = (state->m_Regs[EB13] & ~0x7C) | (RFC_K << 4) | (RFC_M << 2);
CHK_ERROR(UpdateRegs(state,EP1,EP3)); CHK_ERROR(UpdateRegs(state, EP1, EP3));
CHK_ERROR(UpdateReg(state,EB13)); CHK_ERROR(UpdateReg(state, EB13));
state->m_Regs[EB4] |= 0x20; // LO_ForceSrce = 1 state->m_Regs[EB4] |= 0x20; /* LO_ForceSrce = 1 */
CHK_ERROR(UpdateReg(state,EB4)); CHK_ERROR(UpdateReg(state, EB4));
state->m_Regs[EB7] |= 0x20; // CAL_ForceSrce = 1 state->m_Regs[EB7] |= 0x20; /* CAL_ForceSrce = 1 */
CHK_ERROR(UpdateReg(state,EB7)); CHK_ERROR(UpdateReg(state, EB7));
state->m_Regs[EB14] = 0; // RFC_Cprog = 0 state->m_Regs[EB14] = 0; /* RFC_Cprog = 0 */
CHK_ERROR(UpdateReg(state,EB14)); CHK_ERROR(UpdateReg(state, EB14));
state->m_Regs[EB20] &= ~0x20; // ForceLock = 0; state->m_Regs[EB20] &= ~0x20; /* ForceLock = 0; */
CHK_ERROR(UpdateReg(state,EB20)); CHK_ERROR(UpdateReg(state, EB20));
state->m_Regs[EP4] |= 0x03; // CAL_Mode = 3 state->m_Regs[EP4] |= 0x03; /* CAL_Mode = 3 */
CHK_ERROR(UpdateRegs(state,EP4,EP5)); CHK_ERROR(UpdateRegs(state, EP4, EP5));
CHK_ERROR(CalcCalPLL(state,freq)); CHK_ERROR(CalcCalPLL(state, freq));
CHK_ERROR(CalcMainPLL(state,freq + 1000000)); CHK_ERROR(CalcMainPLL(state, freq + 1000000));
msleep(5); msleep(5);
CHK_ERROR(UpdateReg(state,EP2)); CHK_ERROR(UpdateReg(state, EP2));
CHK_ERROR(UpdateReg(state,EP1)); CHK_ERROR(UpdateReg(state, EP1));
CHK_ERROR(UpdateReg(state,EP2)); CHK_ERROR(UpdateReg(state, EP2));
CHK_ERROR(UpdateReg(state,EP1)); CHK_ERROR(UpdateReg(state, EP1));
state->m_Regs[EB4] &= ~0x20; // LO_ForceSrce = 0 state->m_Regs[EB4] &= ~0x20; /* LO_ForceSrce = 0 */
CHK_ERROR(UpdateReg(state,EB4)); CHK_ERROR(UpdateReg(state, EB4));
state->m_Regs[EB7] &= ~0x20; // CAL_ForceSrce = 0 state->m_Regs[EB7] &= ~0x20; /* CAL_ForceSrce = 0 */
CHK_ERROR(UpdateReg(state,EB7)); CHK_ERROR(UpdateReg(state, EB7));
msleep(10); msleep(10);
state->m_Regs[EB20] |= 0x20; // ForceLock = 1; state->m_Regs[EB20] |= 0x20; /* ForceLock = 1; */
CHK_ERROR(UpdateReg(state,EB20)); CHK_ERROR(UpdateReg(state, EB20));
msleep(60); msleep(60);
state->m_Regs[EP4] &= ~0x03; // CAL_Mode = 0 state->m_Regs[EP4] &= ~0x03; /* CAL_Mode = 0 */
state->m_Regs[EP3] &= ~0x40; // SM_LT = 0 state->m_Regs[EP3] &= ~0x40; /* SM_LT = 0 */
state->m_Regs[EB18] &= ~0x03; // AGC1_Gain = 0 state->m_Regs[EB18] &= ~0x03; /* AGC1_Gain = 0 */
CHK_ERROR(UpdateReg(state,EB18)); CHK_ERROR(UpdateReg(state, EB18));
CHK_ERROR(UpdateRegs(state,EP3,EP4)); CHK_ERROR(UpdateRegs(state, EP3, EP4));
CHK_ERROR(UpdateReg(state,EP1)); CHK_ERROR(UpdateReg(state, EP1));
CHK_ERROR(ReadExtented(state,Regs)); CHK_ERROR(ReadExtented(state, Regs));
*pCprog = Regs[EB14]; *pCprog = Regs[EB14];
//KdPrintEx((MSG_TRACE " - " __FUNCTION__ " Cprog = %d\n",Regs[EB14]));
} while(0); } while (0);
return status; return status;
} }
static int RFTrackingFiltersInit(struct tda_state *state, static int RFTrackingFiltersInit(struct tda_state *state,
u8 RFBand) u8 RFBand)
{ {
//KdPrintEx((MSG_TRACE " - " __FUNCTION__ "\n"));
int status = 0; int status = 0;
u32 RF1 = m_RF_Band_Map[RFBand].m_RF1_Default; u32 RF1 = m_RF_Band_Map[RFBand].m_RF1_Default;
...@@ -475,171 +464,161 @@ static int RFTrackingFiltersInit(struct tda_state *state, ...@@ -475,171 +464,161 @@ static int RFTrackingFiltersInit(struct tda_state *state,
state->m_RF_B2[RFBand] = 0; state->m_RF_B2[RFBand] = 0;
do { do {
CHK_ERROR(PowerScan(state,RFBand,RF1,&RF1,&bcal)); CHK_ERROR(PowerScan(state, RFBand, RF1, &RF1, &bcal));
if( bcal ) { if (bcal) {
CHK_ERROR(CalibrateRF(state,RFBand,RF1,&Cprog_cal1)); CHK_ERROR(CalibrateRF(state, RFBand, RF1, &Cprog_cal1));
} }
SearchMap2(m_RF_Cal_Map,RF1,&Cprog_table1); SearchMap2(m_RF_Cal_Map, RF1, &Cprog_table1);
if( !bcal ) { if (!bcal)
Cprog_cal1 = Cprog_table1; Cprog_cal1 = Cprog_table1;
}
state->m_RF_B1[RFBand] = Cprog_cal1 - Cprog_table1; state->m_RF_B1[RFBand] = Cprog_cal1 - Cprog_table1;
//state->m_RF_A1[RF_Band] = ???? /* state->m_RF_A1[RF_Band] = ???? */
if( RF2 == 0 ) break; if (RF2 == 0)
break;
CHK_ERROR(PowerScan(state,RFBand,RF2,&RF2,&bcal)); CHK_ERROR(PowerScan(state, RFBand, RF2, &RF2, &bcal));
if( bcal ) { if (bcal) {
CHK_ERROR(CalibrateRF(state,RFBand,RF2,&Cprog_cal2)); CHK_ERROR(CalibrateRF(state, RFBand, RF2, &Cprog_cal2));
} }
SearchMap2(m_RF_Cal_Map,RF2,&Cprog_table2); SearchMap2(m_RF_Cal_Map, RF2, &Cprog_table2);
if( !bcal ) if (!bcal)
{
Cprog_cal2 = Cprog_table2; Cprog_cal2 = Cprog_table2;
}
state->m_RF_A1[RFBand] = state->m_RF_A1[RFBand] =
(Cprog_cal2 - Cprog_table2 - Cprog_cal1 + Cprog_table1) / (Cprog_cal2 - Cprog_table2 - Cprog_cal1 + Cprog_table1) /
((s32)(RF2)-(s32)(RF1)); ((s32)(RF2) - (s32)(RF1));
if( RF3 == 0 ) break; if (RF3 == 0)
break;
CHK_ERROR(PowerScan(state,RFBand,RF3,&RF3,&bcal)); CHK_ERROR(PowerScan(state, RFBand, RF3, &RF3, &bcal));
if( bcal ) if (bcal) {
{ CHK_ERROR(CalibrateRF(state, RFBand, RF3, &Cprog_cal3));
CHK_ERROR(CalibrateRF(state,RFBand,RF3,&Cprog_cal3));
} }
SearchMap2(m_RF_Cal_Map,RF3,&Cprog_table3); SearchMap2(m_RF_Cal_Map, RF3, &Cprog_table3);
if( !bcal ) if (!bcal)
{
Cprog_cal3 = Cprog_table3; Cprog_cal3 = Cprog_table3;
} state->m_RF_A2[RFBand] = (Cprog_cal3 - Cprog_table3 - Cprog_cal2 + Cprog_table2) / ((s32)(RF3) - (s32)(RF2));
state->m_RF_A2[RFBand] = (Cprog_cal3 - Cprog_table3 - Cprog_cal2 + Cprog_table2) / ((s32)(RF3)-(s32)(RF2));
state->m_RF_B2[RFBand] = Cprog_cal2 - Cprog_table2; state->m_RF_B2[RFBand] = Cprog_cal2 - Cprog_table2;
} while(0); } while (0);
state->m_RF1[RFBand] = RF1; state->m_RF1[RFBand] = RF1;
state->m_RF2[RFBand] = RF2; state->m_RF2[RFBand] = RF2;
state->m_RF3[RFBand] = RF3; state->m_RF3[RFBand] = RF3;
#if 0 #if 0
printk("%s %d RF1 = %d A1 = %d B1 = %d RF2 = %d A2 = %d B2 = %d RF3 = %d\n", __FUNCTION__, printk(KERN_ERR "%s %d RF1 = %d A1 = %d B1 = %d RF2 = %d A2 = %d B2 = %d RF3 = %d\n", __func__,
RFBand,RF1,state->m_RF_A1[RFBand],state->m_RF_B1[RFBand],RF2, RFBand, RF1, state->m_RF_A1[RFBand], state->m_RF_B1[RFBand], RF2,
state->m_RF_A2[RFBand],state->m_RF_B2[RFBand],RF3); state->m_RF_A2[RFBand], state->m_RF_B2[RFBand], RF3);
#endif #endif
return status; return status;
} }
static int PowerScan(struct tda_state *state, static int PowerScan(struct tda_state *state,
u8 RFBand,u32 RF_in, u32 * pRF_Out, bool *pbcal) u8 RFBand, u32 RF_in, u32 *pRF_Out, bool *pbcal)
{ {
//KdPrintEx((MSG_TRACE " - " __FUNCTION__ "(%d,%d)\n",RFBand,RF_in)); int status = 0;
int status = 0; do {
do { u8 Gain_Taper = 0;
u8 Gain_Taper=0; s32 RFC_Cprog = 0;
s32 RFC_Cprog=0; u8 CID_Target = 0;
u8 CID_Target=0; u8 CountLimit = 0;
u8 CountLimit=0; u32 freq_MainPLL;
u32 freq_MainPLL; u8 Regs[NUM_REGS];
u8 Regs[NUM_REGS]; u8 CID_Gain;
u8 CID_Gain; s32 Count = 0;
s32 Count = 0; int sign = 1;
int sign = 1; bool wait = false;
bool wait = false;
if (!(SearchMap2(m_RF_Cal_Map, RF_in, &RFC_Cprog) &&
if( ! (SearchMap2(m_RF_Cal_Map,RF_in,&RFC_Cprog) && SearchMap1(m_GainTaper_Map, RF_in, &Gain_Taper) &&
SearchMap1(m_GainTaper_Map,RF_in,&Gain_Taper) && SearchMap3(m_CID_Target_Map, RF_in, &CID_Target, &CountLimit))) {
SearchMap3(m_CID_Target_Map,RF_in,&CID_Target,&CountLimit) )) {
printk("%s Search map failed\n", __FUNCTION__); printk(KERN_ERR "%s Search map failed\n", __func__);
return -EINVAL; return -EINVAL;
} }
state->m_Regs[EP2] = (RFBand << 5) | Gain_Taper; state->m_Regs[EP2] = (RFBand << 5) | Gain_Taper;
state->m_Regs[EB14] = (RFC_Cprog); state->m_Regs[EB14] = (RFC_Cprog);
CHK_ERROR(UpdateReg(state,EP2)); CHK_ERROR(UpdateReg(state, EP2));
CHK_ERROR(UpdateReg(state,EB14)); CHK_ERROR(UpdateReg(state, EB14));
freq_MainPLL = RF_in + 1000000; freq_MainPLL = RF_in + 1000000;
CHK_ERROR(CalcMainPLL(state,freq_MainPLL)); CHK_ERROR(CalcMainPLL(state, freq_MainPLL));
msleep(5); msleep(5);
state->m_Regs[EP4] = (state->m_Regs[EP4] & ~0x03) | 1; // CAL_mode = 1 state->m_Regs[EP4] = (state->m_Regs[EP4] & ~0x03) | 1; /* CAL_mode = 1 */
CHK_ERROR(UpdateReg(state,EP4)); CHK_ERROR(UpdateReg(state, EP4));
CHK_ERROR(UpdateReg(state,EP2)); // Launch power measurement CHK_ERROR(UpdateReg(state, EP2)); /* Launch power measurement */
CHK_ERROR(ReadExtented(state,Regs)); CHK_ERROR(ReadExtented(state, Regs));
CID_Gain = Regs[EB10] & 0x3F; CID_Gain = Regs[EB10] & 0x3F;
state->m_Regs[ID] = Regs[ID]; // Chip version, (needed for C1 workarround in CalibrateRF ) state->m_Regs[ID] = Regs[ID]; /* Chip version, (needed for C1 workarround in CalibrateRF) */
*pRF_Out = RF_in; *pRF_Out = RF_in;
while( CID_Gain < CID_Target ) { while (CID_Gain < CID_Target) {
freq_MainPLL = RF_in + sign * Count + 1000000; freq_MainPLL = RF_in + sign * Count + 1000000;
CHK_ERROR(CalcMainPLL(state,freq_MainPLL)); CHK_ERROR(CalcMainPLL(state, freq_MainPLL));
msleep( wait ? 5 : 1 ); msleep(wait ? 5 : 1);
wait = false; wait = false;
CHK_ERROR(UpdateReg(state,EP2)); // Launch power measurement CHK_ERROR(UpdateReg(state, EP2)); /* Launch power measurement */
CHK_ERROR(ReadExtented(state,Regs)); CHK_ERROR(ReadExtented(state, Regs));
CID_Gain = Regs[EB10] & 0x3F; CID_Gain = Regs[EB10] & 0x3F;
Count += 200000; Count += 200000;
if( Count < CountLimit * 100000 ) continue; if (Count < CountLimit * 100000)
if( sign < 0 ) break; continue;
if (sign < 0)
sign = -sign; break;
Count = 200000;
wait = true; sign = -sign;
} Count = 200000;
CHK_ERROR(status); wait = true;
if( CID_Gain >= CID_Target ) }
{ CHK_ERROR(status);
*pbcal = true; if (CID_Gain >= CID_Target) {
*pRF_Out = freq_MainPLL - 1000000; *pbcal = true;
} *pRF_Out = freq_MainPLL - 1000000;
else } else
{ *pbcal = false;
*pbcal = false; } while (0);
}
} while(0); return status;
//KdPrintEx((MSG_TRACE " - " __FUNCTION__ " Found = %d RF = %d\n",*pbcal,*pRF_Out));
return status;
} }
static int PowerScanInit(struct tda_state *state) static int PowerScanInit(struct tda_state *state)
{ {
//KdPrintEx((MSG_TRACE " - " __FUNCTION__ "\n"));
int status = 0; int status = 0;
do do {
{
state->m_Regs[EP3] = (state->m_Regs[EP3] & ~0x1F) | 0x12; state->m_Regs[EP3] = (state->m_Regs[EP3] & ~0x1F) | 0x12;
state->m_Regs[EP4] = (state->m_Regs[EP4] & ~0x1F); // If level = 0, Cal mode = 0 state->m_Regs[EP4] = (state->m_Regs[EP4] & ~0x1F); /* If level = 0, Cal mode = 0 */
CHK_ERROR(UpdateRegs(state,EP3,EP4)); CHK_ERROR(UpdateRegs(state, EP3, EP4));
state->m_Regs[EB18] = (state->m_Regs[EB18] & ~0x03 ); // AGC 1 Gain = 0 state->m_Regs[EB18] = (state->m_Regs[EB18] & ~0x03); /* AGC 1 Gain = 0 */
CHK_ERROR(UpdateReg(state,EB18)); CHK_ERROR(UpdateReg(state, EB18));
state->m_Regs[EB21] = (state->m_Regs[EB21] & ~0x03 ); // AGC 2 Gain = 0 (Datasheet = 3) state->m_Regs[EB21] = (state->m_Regs[EB21] & ~0x03); /* AGC 2 Gain = 0 (Datasheet = 3) */
state->m_Regs[EB23] = (state->m_Regs[EB23] | 0x06 ); // ForceLP_Fc2_En = 1, LPFc[2] = 1 state->m_Regs[EB23] = (state->m_Regs[EB23] | 0x06); /* ForceLP_Fc2_En = 1, LPFc[2] = 1 */
CHK_ERROR(UpdateRegs(state,EB21,EB23)); CHK_ERROR(UpdateRegs(state, EB21, EB23));
} while(0); } while (0);
return status; return status;
} }
static int CalcRFFilterCurve(struct tda_state *state) static int CalcRFFilterCurve(struct tda_state *state)
{ {
//KdPrintEx((MSG_TRACE " - " __FUNCTION__ "\n"));
int status = 0; int status = 0;
do do {
{ msleep(200); /* Temperature stabilisation */
msleep(200); // Temperature stabilisation
CHK_ERROR(PowerScanInit(state)); CHK_ERROR(PowerScanInit(state));
CHK_ERROR(RFTrackingFiltersInit(state,0)); CHK_ERROR(RFTrackingFiltersInit(state, 0));
CHK_ERROR(RFTrackingFiltersInit(state,1)); CHK_ERROR(RFTrackingFiltersInit(state, 1));
CHK_ERROR(RFTrackingFiltersInit(state,2)); CHK_ERROR(RFTrackingFiltersInit(state, 2));
CHK_ERROR(RFTrackingFiltersInit(state,3)); CHK_ERROR(RFTrackingFiltersInit(state, 3));
CHK_ERROR(RFTrackingFiltersInit(state,4)); CHK_ERROR(RFTrackingFiltersInit(state, 4));
CHK_ERROR(RFTrackingFiltersInit(state,5)); CHK_ERROR(RFTrackingFiltersInit(state, 5));
CHK_ERROR(RFTrackingFiltersInit(state,6)); CHK_ERROR(RFTrackingFiltersInit(state, 6));
CHK_ERROR(ThermometerRead(state,&state->m_TMValue_RFCal)); // also switches off Cal mode !!! CHK_ERROR(ThermometerRead(state, &state->m_TMValue_RFCal)); /* also switches off Cal mode !!! */
} while(0); } while (0);
return status; return status;
} }
...@@ -647,33 +626,33 @@ static int CalcRFFilterCurve(struct tda_state *state) ...@@ -647,33 +626,33 @@ static int CalcRFFilterCurve(struct tda_state *state)
static int FixedContentsI2CUpdate(struct tda_state *state) static int FixedContentsI2CUpdate(struct tda_state *state)
{ {
static u8 InitRegs[] = { static u8 InitRegs[] = {
0x08,0x80,0xC6, 0x08, 0x80, 0xC6,
0xDF,0x16,0x60,0x80, 0xDF, 0x16, 0x60, 0x80,
0x80,0x00,0x00,0x00, 0x80, 0x00, 0x00, 0x00,
0x00,0x00,0x00,0x00, 0x00, 0x00, 0x00, 0x00,
0xFC,0x01,0x84,0x41, 0xFC, 0x01, 0x84, 0x41,
0x01,0x84,0x40,0x07, 0x01, 0x84, 0x40, 0x07,
0x00,0x00,0x96,0x3F, 0x00, 0x00, 0x96, 0x3F,
0xC1,0x00,0x8F,0x00, 0xC1, 0x00, 0x8F, 0x00,
0x00,0x8C,0x00,0x20, 0x00, 0x8C, 0x00, 0x20,
0xB3,0x48,0xB0, 0xB3, 0x48, 0xB0,
}; };
int status = 0; int status = 0;
memcpy(&state->m_Regs[TM],InitRegs,EB23-TM+1); memcpy(&state->m_Regs[TM], InitRegs, EB23 - TM + 1);
do { do {
CHK_ERROR(UpdateRegs(state,TM,EB23)); CHK_ERROR(UpdateRegs(state, TM, EB23));
// AGC1 gain setup /* AGC1 gain setup */
state->m_Regs[EB17] = 0x00; state->m_Regs[EB17] = 0x00;
CHK_ERROR(UpdateReg(state,EB17)); CHK_ERROR(UpdateReg(state, EB17));
state->m_Regs[EB17] = 0x03; state->m_Regs[EB17] = 0x03;
CHK_ERROR(UpdateReg(state,EB17)); CHK_ERROR(UpdateReg(state, EB17));
state->m_Regs[EB17] = 0x43; state->m_Regs[EB17] = 0x43;
CHK_ERROR(UpdateReg(state,EB17)); CHK_ERROR(UpdateReg(state, EB17));
state->m_Regs[EB17] = 0x4C; state->m_Regs[EB17] = 0x4C;
CHK_ERROR(UpdateReg(state,EB17)); CHK_ERROR(UpdateReg(state, EB17));
// IRC Cal Low band /* IRC Cal Low band */
state->m_Regs[EP3] = 0x1F; state->m_Regs[EP3] = 0x1F;
state->m_Regs[EP4] = 0x66; state->m_Regs[EP4] = 0x66;
state->m_Regs[EP5] = 0x81; state->m_Regs[EP5] = 0x81;
...@@ -685,75 +664,77 @@ static int FixedContentsI2CUpdate(struct tda_state *state) ...@@ -685,75 +664,77 @@ static int FixedContentsI2CUpdate(struct tda_state *state)
state->m_Regs[MD1] = 0x77; state->m_Regs[MD1] = 0x77;
state->m_Regs[MD2] = 0x08; state->m_Regs[MD2] = 0x08;
state->m_Regs[MD3] = 0x00; state->m_Regs[MD3] = 0x00;
CHK_ERROR(UpdateRegs(state,EP2,MD3)); // diff between sw and datasheet (ep3-md3) CHK_ERROR(UpdateRegs(state, EP2, MD3)); /* diff between sw and datasheet (ep3-md3) */
//state->m_Regs[EB4] = 0x61; // missing in sw #if 0
//CHK_ERROR(UpdateReg(state,EB4)); state->m_Regs[EB4] = 0x61; /* missing in sw */
//msleep(1); CHK_ERROR(UpdateReg(state, EB4));
//state->m_Regs[EB4] = 0x41; msleep(1);
//CHK_ERROR(UpdateReg(state,EB4)); state->m_Regs[EB4] = 0x41;
CHK_ERROR(UpdateReg(state, EB4));
#endif
msleep(5); msleep(5);
CHK_ERROR(UpdateReg(state,EP1)); CHK_ERROR(UpdateReg(state, EP1));
msleep(5); msleep(5);
state->m_Regs[EP5] = 0x85; state->m_Regs[EP5] = 0x85;
state->m_Regs[CPD] = 0xCB; state->m_Regs[CPD] = 0xCB;
state->m_Regs[CD1] = 0x66; state->m_Regs[CD1] = 0x66;
state->m_Regs[CD2] = 0x70; state->m_Regs[CD2] = 0x70;
CHK_ERROR(UpdateRegs(state,EP3,CD3)); CHK_ERROR(UpdateRegs(state, EP3, CD3));
msleep(5); msleep(5);
CHK_ERROR(UpdateReg(state,EP2)); CHK_ERROR(UpdateReg(state, EP2));
msleep(30); msleep(30);
// IRC Cal mid band /* IRC Cal mid band */
state->m_Regs[EP5] = 0x82; state->m_Regs[EP5] = 0x82;
state->m_Regs[CPD] = 0xA8; state->m_Regs[CPD] = 0xA8;
state->m_Regs[CD2] = 0x00; state->m_Regs[CD2] = 0x00;
state->m_Regs[MPD] = 0xA1; // Datasheet = 0xA9 state->m_Regs[MPD] = 0xA1; /* Datasheet = 0xA9 */
state->m_Regs[MD1] = 0x73; state->m_Regs[MD1] = 0x73;
state->m_Regs[MD2] = 0x1A; state->m_Regs[MD2] = 0x1A;
CHK_ERROR(UpdateRegs(state,EP3,MD3)); CHK_ERROR(UpdateRegs(state, EP3, MD3));
msleep(5); msleep(5);
CHK_ERROR(UpdateReg(state,EP1)); CHK_ERROR(UpdateReg(state, EP1));
msleep(5); msleep(5);
state->m_Regs[EP5] = 0x86; state->m_Regs[EP5] = 0x86;
state->m_Regs[CPD] = 0xA8; state->m_Regs[CPD] = 0xA8;
state->m_Regs[CD1] = 0x66; state->m_Regs[CD1] = 0x66;
state->m_Regs[CD2] = 0xA0; state->m_Regs[CD2] = 0xA0;
CHK_ERROR(UpdateRegs(state,EP3,CD3)); CHK_ERROR(UpdateRegs(state, EP3, CD3));
msleep(5); msleep(5);
CHK_ERROR(UpdateReg(state,EP2)); CHK_ERROR(UpdateReg(state, EP2));
msleep(30); msleep(30);
// IRC Cal high band /* IRC Cal high band */
state->m_Regs[EP5] = 0x83; state->m_Regs[EP5] = 0x83;
state->m_Regs[CPD] = 0x98; state->m_Regs[CPD] = 0x98;
state->m_Regs[CD1] = 0x65; state->m_Regs[CD1] = 0x65;
state->m_Regs[CD2] = 0x00; state->m_Regs[CD2] = 0x00;
state->m_Regs[MPD] = 0x91; // Datasheet = 0x91 state->m_Regs[MPD] = 0x91; /* Datasheet = 0x91 */
state->m_Regs[MD1] = 0x71; state->m_Regs[MD1] = 0x71;
state->m_Regs[MD2] = 0xCD; state->m_Regs[MD2] = 0xCD;
CHK_ERROR(UpdateRegs(state,EP3,MD3)); CHK_ERROR(UpdateRegs(state, EP3, MD3));
msleep(5); msleep(5);
CHK_ERROR(UpdateReg(state,EP1)); CHK_ERROR(UpdateReg(state, EP1));
msleep(5); msleep(5);
state->m_Regs[EP5] = 0x87; state->m_Regs[EP5] = 0x87;
state->m_Regs[CD1] = 0x65; state->m_Regs[CD1] = 0x65;
state->m_Regs[CD2] = 0x50; state->m_Regs[CD2] = 0x50;
CHK_ERROR(UpdateRegs(state,EP3,CD3)); CHK_ERROR(UpdateRegs(state, EP3, CD3));
msleep(5); msleep(5);
CHK_ERROR(UpdateReg(state,EP2)); CHK_ERROR(UpdateReg(state, EP2));
msleep(30); msleep(30);
// Back to normal /* Back to normal */
state->m_Regs[EP4] = 0x64; state->m_Regs[EP4] = 0x64;
CHK_ERROR(UpdateReg(state,EP4)); CHK_ERROR(UpdateReg(state, EP4));
CHK_ERROR(UpdateReg(state,EP1)); CHK_ERROR(UpdateReg(state, EP1));
} while(0); } while (0);
return status; return status;
} }
...@@ -761,13 +742,12 @@ static int InitCal(struct tda_state *state) ...@@ -761,13 +742,12 @@ static int InitCal(struct tda_state *state)
{ {
int status = 0; int status = 0;
do do {
{
CHK_ERROR(FixedContentsI2CUpdate(state)); CHK_ERROR(FixedContentsI2CUpdate(state));
CHK_ERROR(CalcRFFilterCurve(state)); CHK_ERROR(CalcRFFilterCurve(state));
CHK_ERROR(StandBy(state)); CHK_ERROR(StandBy(state));
//m_bInitDone = true; /* m_bInitDone = true; */
} while(0); } while (0);
return status; return status;
}; };
...@@ -779,15 +759,13 @@ static int RFTrackingFiltersCorrection(struct tda_state *state, ...@@ -779,15 +759,13 @@ static int RFTrackingFiltersCorrection(struct tda_state *state,
u8 RFBand; u8 RFBand;
u8 dCoverdT; u8 dCoverdT;
if( !SearchMap2(m_RF_Cal_Map,Frequency,&Cprog_table) || if (!SearchMap2(m_RF_Cal_Map, Frequency, &Cprog_table) ||
!SearchMap4(m_RF_Band_Map,Frequency,&RFBand) || !SearchMap4(m_RF_Band_Map, Frequency, &RFBand) ||
!SearchMap1(m_RF_Cal_DC_Over_DT_Map,Frequency,&dCoverdT) ) !SearchMap1(m_RF_Cal_DC_Over_DT_Map, Frequency, &dCoverdT))
{
return -EINVAL; return -EINVAL;
}
do do {
{
u8 TMValue_Current; u8 TMValue_Current;
u32 RF1 = state->m_RF1[RFBand]; u32 RF1 = state->m_RF1[RFBand];
u32 RF2 = state->m_RF1[RFBand]; u32 RF2 = state->m_RF1[RFBand];
...@@ -799,35 +777,33 @@ static int RFTrackingFiltersCorrection(struct tda_state *state, ...@@ -799,35 +777,33 @@ static int RFTrackingFiltersCorrection(struct tda_state *state,
s32 Capprox = 0; s32 Capprox = 0;
int TComp; int TComp;
state->m_Regs[EP3] &= ~0xE0; // Power up state->m_Regs[EP3] &= ~0xE0; /* Power up */
CHK_ERROR(UpdateReg(state,EP3)); CHK_ERROR(UpdateReg(state, EP3));
CHK_ERROR(ThermometerRead(state,&TMValue_Current)); CHK_ERROR(ThermometerRead(state, &TMValue_Current));
if( RF3 == 0 || Frequency < RF2 ) if (RF3 == 0 || Frequency < RF2)
{
Capprox = RF_A1 * ((s32)(Frequency) - (s32)(RF1)) + RF_B1 + Cprog_table; Capprox = RF_A1 * ((s32)(Frequency) - (s32)(RF1)) + RF_B1 + Cprog_table;
}
else else
{
Capprox = RF_A2 * ((s32)(Frequency) - (s32)(RF2)) + RF_B2 + Cprog_table; Capprox = RF_A2 * ((s32)(Frequency) - (s32)(RF2)) + RF_B2 + Cprog_table;
}
TComp = (int)(dCoverdT) * ((int)(TMValue_Current) - (int)(state->m_TMValue_RFCal))/1000; TComp = (int)(dCoverdT) * ((int)(TMValue_Current) - (int)(state->m_TMValue_RFCal))/1000;
Capprox += TComp; Capprox += TComp;
if( Capprox < 0 ) Capprox = 0; if (Capprox < 0)
else if( Capprox > 255 ) Capprox = 255; Capprox = 0;
else if (Capprox > 255)
Capprox = 255;
// TODO Temperature compensation. There is defenitely a scale factor /* TODO Temperature compensation. There is defenitely a scale factor */
// missing in the datasheet, so leave it out for now. /* missing in the datasheet, so leave it out for now. */
state->m_Regs[EB14] = (Capprox ); state->m_Regs[EB14] = Capprox;
CHK_ERROR(UpdateReg(state,EB14)); CHK_ERROR(UpdateReg(state, EB14));
} while(0); } while (0);
return status; return status;
} }
...@@ -843,94 +819,96 @@ static int ChannelConfiguration(struct tda_state *state, ...@@ -843,94 +819,96 @@ static int ChannelConfiguration(struct tda_state *state,
u8 GainTaper = 0; u8 GainTaper = 0;
u8 IR_Meas; u8 IR_Meas;
state->IF=IntermediateFrequency; state->IF = IntermediateFrequency;
//printk("%s Freq = %d Standard = %d IF = %d\n",__FUNCTION__,Frequency,Standard,IntermediateFrequency); /* printk("%s Freq = %d Standard = %d IF = %d\n", __func__, Frequency, Standard, IntermediateFrequency); */
// get values from tables /* get values from tables */
if(! ( SearchMap1(m_BP_Filter_Map,Frequency,&BP_Filter) && if (!(SearchMap1(m_BP_Filter_Map, Frequency, &BP_Filter) &&
SearchMap1(m_GainTaper_Map,Frequency,&GainTaper) && SearchMap1(m_GainTaper_Map, Frequency, &GainTaper) &&
SearchMap1(m_IR_Meas_Map,Frequency,&IR_Meas) && SearchMap1(m_IR_Meas_Map, Frequency, &IR_Meas) &&
SearchMap4(m_RF_Band_Map,Frequency,&RF_Band) ) ) SearchMap4(m_RF_Band_Map, Frequency, &RF_Band))) {
{
printk("%s SearchMap failed\n", __FUNCTION__); printk(KERN_ERR "%s SearchMap failed\n", __func__);
return -EINVAL; return -EINVAL;
} }
do do {
{
state->m_Regs[EP3] = (state->m_Regs[EP3] & ~0x1F) | m_StandardTable[Standard].m_EP3_4_0; state->m_Regs[EP3] = (state->m_Regs[EP3] & ~0x1F) | m_StandardTable[Standard].m_EP3_4_0;
state->m_Regs[EP3] &= ~0x04; // switch RFAGC to high speed mode state->m_Regs[EP3] &= ~0x04; /* switch RFAGC to high speed mode */
// m_EP4 default for XToutOn, CAL_Mode (0) /* m_EP4 default for XToutOn, CAL_Mode (0) */
state->m_Regs[EP4] = state->m_EP4 | ((Standard > HF_AnalogMax )? state->m_IFLevelDigital : state->m_IFLevelAnalog ); state->m_Regs[EP4] = state->m_EP4 | ((Standard > HF_AnalogMax) ? state->m_IFLevelDigital : state->m_IFLevelAnalog);
//state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDigital; /* state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDigital; */
if( Standard <= HF_AnalogMax ) state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelAnalog; if (Standard <= HF_AnalogMax)
else if( Standard <= HF_ATSC ) state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDVBT; state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelAnalog;
else if( Standard <= HF_DVBC ) state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDVBC; else if (Standard <= HF_ATSC)
else state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDigital; state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDVBT;
else if (Standard <= HF_DVBC)
state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDVBC;
else
state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDigital;
if( (Standard == HF_FM_Radio) && state->m_bFMInput ) state->m_Regs[EP4] |= 80; if ((Standard == HF_FM_Radio) && state->m_bFMInput)
state->m_Regs[EP4] |= 80;
state->m_Regs[MPD] &= ~0x80; state->m_Regs[MPD] &= ~0x80;
if( Standard > HF_AnalogMax ) state->m_Regs[MPD] |= 0x80; // Add IF_notch for digital if (Standard > HF_AnalogMax)
state->m_Regs[MPD] |= 0x80; /* Add IF_notch for digital */
state->m_Regs[EB22] = m_StandardTable[Standard].m_EB22; state->m_Regs[EB22] = m_StandardTable[Standard].m_EB22;
// Note: This is missing from flowchart in TDA18271 specification ( 1.5 MHz cutoff for FM ) /* Note: This is missing from flowchart in TDA18271 specification ( 1.5 MHz cutoff for FM ) */
if( Standard == HF_FM_Radio ) state->m_Regs[EB23] |= 0x06; // ForceLP_Fc2_En = 1, LPFc[2] = 1 if (Standard == HF_FM_Radio)
else state->m_Regs[EB23] &= ~0x06; // ForceLP_Fc2_En = 0, LPFc[2] = 0 state->m_Regs[EB23] |= 0x06; /* ForceLP_Fc2_En = 1, LPFc[2] = 1 */
else
state->m_Regs[EB23] &= ~0x06; /* ForceLP_Fc2_En = 0, LPFc[2] = 0 */
CHK_ERROR(UpdateRegs(state,EB22,EB23)); CHK_ERROR(UpdateRegs(state, EB22, EB23));
state->m_Regs[EP1] = (state->m_Regs[EP1] & ~0x07) | 0x40 | BP_Filter; // Dis_Power_level = 1, Filter state->m_Regs[EP1] = (state->m_Regs[EP1] & ~0x07) | 0x40 | BP_Filter; /* Dis_Power_level = 1, Filter */
state->m_Regs[EP5] = (state->m_Regs[EP5] & ~0x07) | IR_Meas; state->m_Regs[EP5] = (state->m_Regs[EP5] & ~0x07) | IR_Meas;
state->m_Regs[EP2] = (RF_Band << 5) | GainTaper; state->m_Regs[EP2] = (RF_Band << 5) | GainTaper;
state->m_Regs[EB1] = (state->m_Regs[EB1] & ~0x07) | state->m_Regs[EB1] = (state->m_Regs[EB1] & ~0x07) |
(state->m_bMaster ? 0x04 : 0x00); // CALVCO_FortLOn = MS (state->m_bMaster ? 0x04 : 0x00); /* CALVCO_FortLOn = MS */
// AGC1_always_master = 0 /* AGC1_always_master = 0 */
// AGC_firstn = 0 /* AGC_firstn = 0 */
CHK_ERROR(UpdateReg(state,EB1)); CHK_ERROR(UpdateReg(state, EB1));
if( state->m_bMaster ) if (state->m_bMaster) {
{ CHK_ERROR(CalcMainPLL(state, Frequency + IntermediateFrequency));
CHK_ERROR(CalcMainPLL(state,Frequency + IntermediateFrequency)); CHK_ERROR(UpdateRegs(state, TM, EP5));
CHK_ERROR(UpdateRegs(state,TM,EP5)); state->m_Regs[EB4] |= 0x20; /* LO_forceSrce = 1 */
state->m_Regs[EB4] |= 0x20; // LO_forceSrce = 1 CHK_ERROR(UpdateReg(state, EB4));
CHK_ERROR(UpdateReg(state,EB4));
msleep(1); msleep(1);
state->m_Regs[EB4] &= ~0x20; // LO_forceSrce = 0 state->m_Regs[EB4] &= ~0x20; /* LO_forceSrce = 0 */
CHK_ERROR(UpdateReg(state,EB4)); CHK_ERROR(UpdateReg(state, EB4));
} } else {
else
{
u8 PostDiv; u8 PostDiv;
u8 Div; u8 Div;
CHK_ERROR(CalcCalPLL(state,Frequency + IntermediateFrequency)); CHK_ERROR(CalcCalPLL(state, Frequency + IntermediateFrequency));
SearchMap3(m_Cal_PLL_Map,Frequency + IntermediateFrequency,&PostDiv,&Div); SearchMap3(m_Cal_PLL_Map, Frequency + IntermediateFrequency, &PostDiv, &Div);
state->m_Regs[MPD] = (state->m_Regs[MPD] & ~0x7F) | (PostDiv & 0x77); state->m_Regs[MPD] = (state->m_Regs[MPD] & ~0x7F) | (PostDiv & 0x77);
CHK_ERROR(UpdateReg(state,MPD)); CHK_ERROR(UpdateReg(state, MPD));
CHK_ERROR(UpdateRegs(state,TM,EP5)); CHK_ERROR(UpdateRegs(state, TM, EP5));
state->m_Regs[EB7] |= 0x20; // CAL_forceSrce = 1 state->m_Regs[EB7] |= 0x20; /* CAL_forceSrce = 1 */
CHK_ERROR(UpdateReg(state,EB7)); CHK_ERROR(UpdateReg(state, EB7));
msleep(1); msleep(1);
state->m_Regs[EB7] &= ~0x20; // CAL_forceSrce = 0 state->m_Regs[EB7] &= ~0x20; /* CAL_forceSrce = 0 */
CHK_ERROR(UpdateReg(state,EB7)); CHK_ERROR(UpdateReg(state, EB7));
} }
msleep(20); msleep(20);
if( Standard != HF_FM_Radio ) if (Standard != HF_FM_Radio)
{ state->m_Regs[EP3] |= 0x04; /* RFAGC to normal mode */
state->m_Regs[EP3] |= 0x04; // RFAGC to normal mode CHK_ERROR(UpdateReg(state, EP3));
}
CHK_ERROR(UpdateReg(state,EP3));
} while(0); } while (0);
return status; return status;
} }
static int sleep(struct dvb_frontend* fe) static int sleep(struct dvb_frontend *fe)
{ {
struct tda_state *state = fe->tuner_priv; struct tda_state *state = fe->tuner_priv;
...@@ -938,13 +916,12 @@ static int sleep(struct dvb_frontend* fe) ...@@ -938,13 +916,12 @@ static int sleep(struct dvb_frontend* fe)
return 0; return 0;
} }
static int init(struct dvb_frontend* fe) static int init(struct dvb_frontend *fe)
{ {
//struct tda_state *state = fe->tuner_priv;
return 0; return 0;
} }
static int release(struct dvb_frontend* fe) static int release(struct dvb_frontend *fe)
{ {
kfree(fe->tuner_priv); kfree(fe->tuner_priv);
fe->tuner_priv = NULL; fe->tuner_priv = NULL;
...@@ -978,22 +955,22 @@ static int set_params(struct dvb_frontend *fe, ...@@ -978,22 +955,22 @@ static int set_params(struct dvb_frontend *fe,
} else } else
return -EINVAL; return -EINVAL;
do { do {
CHK_ERROR(RFTrackingFiltersCorrection(state,params->frequency)); CHK_ERROR(RFTrackingFiltersCorrection(state, params->frequency));
CHK_ERROR(ChannelConfiguration(state,params->frequency,Standard)); CHK_ERROR(ChannelConfiguration(state, params->frequency, Standard));
msleep(state->m_SettlingTime); // Allow AGC's to settle down msleep(state->m_SettlingTime); /* Allow AGC's to settle down */
} while(0); } while (0);
return status; return status;
} }
#if 0 #if 0
static int GetSignalStrength(s32 * pSignalStrength,u32 RFAgc,u32 IFAgc) static int GetSignalStrength(s32 *pSignalStrength, u32 RFAgc, u32 IFAgc)
{ {
if( IFAgc < 500 ) { if (IFAgc < 500) {
// Scale this from 0 to 50000 /* Scale this from 0 to 50000 */
*pSignalStrength = IFAgc * 100; *pSignalStrength = IFAgc * 100;
} else { } else {
// Scale range 500-1500 to 50000-80000 /* Scale range 500-1500 to 50000-80000 */
*pSignalStrength = 50000 + (IFAgc - 500) * 30; *pSignalStrength = 50000 + (IFAgc - 500) * 30;
} }
...@@ -1011,8 +988,8 @@ static int get_frequency(struct dvb_frontend *fe, u32 *frequency) ...@@ -1011,8 +988,8 @@ static int get_frequency(struct dvb_frontend *fe, u32 *frequency)
static int get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) static int get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
{ {
//struct tda_state *state = fe->tuner_priv; /* struct tda_state *state = fe->tuner_priv; */
//*bandwidth = priv->bandwidth; /* *bandwidth = priv->bandwidth; */
return 0; return 0;
} }
...@@ -1050,14 +1027,8 @@ struct dvb_frontend *tda18271c2dd_attach(struct dvb_frontend *fe, ...@@ -1050,14 +1027,8 @@ struct dvb_frontend *tda18271c2dd_attach(struct dvb_frontend *fe,
return fe; return fe;
} }
EXPORT_SYMBOL_GPL(tda18271c2dd_attach); EXPORT_SYMBOL_GPL(tda18271c2dd_attach);
MODULE_DESCRIPTION("TDA18271C2 driver"); MODULE_DESCRIPTION("TDA18271C2 driver");
MODULE_AUTHOR("DD"); MODULE_AUTHOR("DD");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/*
* Local variables:
* c-basic-offset: 8
* End:
*/
enum HF_S { enum HF_S {
HF_None=0, HF_B, HF_DK, HF_G, HF_I, HF_L, HF_L1, HF_MN, HF_FM_Radio, HF_None = 0, HF_B, HF_DK, HF_G, HF_I, HF_L, HF_L1, HF_MN, HF_FM_Radio,
HF_AnalogMax, HF_DVBT_6MHZ, HF_DVBT_7MHZ, HF_DVBT_8MHZ, HF_AnalogMax, HF_DVBT_6MHZ, HF_DVBT_7MHZ, HF_DVBT_8MHZ,
HF_DVBT, HF_ATSC, HF_DVBC_6MHZ, HF_DVBC_7MHZ, HF_DVBT, HF_ATSC, HF_DVBC_6MHZ, HF_DVBC_7MHZ,
HF_DVBC_8MHZ, HF_DVBC HF_DVBC_8MHZ, HF_DVBC
}; };
struct SStandardParam m_StandardTable[] = struct SStandardParam m_StandardTable[] = {
{ { 0, 0, 0x00, 0x00 }, /* HF_None */
{ 0, 0, 0x00, 0x00 }, // HF_None { 6000000, 7000000, 0x1D, 0x2C }, /* HF_B, */
{ 6000000, 7000000, 0x1D, 0x2C }, // HF_B, { 6900000, 8000000, 0x1E, 0x2C }, /* HF_DK, */
{ 6900000, 8000000, 0x1E, 0x2C }, // HF_DK, { 7100000, 8000000, 0x1E, 0x2C }, /* HF_G, */
{ 7100000, 8000000, 0x1E, 0x2C }, // HF_G, { 7250000, 8000000, 0x1E, 0x2C }, /* HF_I, */
{ 7250000, 8000000, 0x1E, 0x2C }, // HF_I, { 6900000, 8000000, 0x1E, 0x2C }, /* HF_L, */
{ 6900000, 8000000, 0x1E, 0x2C }, // HF_L, { 1250000, 8000000, 0x1E, 0x2C }, /* HF_L1, */
{ 1250000, 8000000, 0x1E, 0x2C }, // HF_L1, { 5400000, 6000000, 0x1C, 0x2C }, /* HF_MN, */
{ 5400000, 6000000, 0x1C, 0x2C }, // HF_MN, { 1250000, 500000, 0x18, 0x2C }, /* HF_FM_Radio, */
{ 1250000, 500000, 0x18, 0x2C }, // HF_FM_Radio, { 0, 0, 0x00, 0x00 }, /* HF_AnalogMax (Unused) */
{ 0, 0, 0x00, 0x00 }, // HF_AnalogMax (Unused) { 3300000, 6000000, 0x1C, 0x58 }, /* HF_DVBT_6MHZ */
{ 3300000, 6000000, 0x1C, 0x58 }, // HF_DVBT_6MHZ { 3500000, 7000000, 0x1C, 0x37 }, /* HF_DVBT_7MHZ */
{ 3500000, 7000000, 0x1C, 0x37 }, // HF_DVBT_7MHZ { 4000000, 8000000, 0x1D, 0x37 }, /* HF_DVBT_8MHZ */
{ 4000000, 8000000, 0x1D, 0x37 }, // HF_DVBT_8MHZ { 0, 0, 0x00, 0x00 }, /* HF_DVBT (Unused) */
{ 0, 0, 0x00, 0x00 }, // HF_DVBT (Unused) { 5000000, 6000000, 0x1C, 0x37 }, /* HF_ATSC (center = 3.25 MHz) */
{ 5000000, 6000000, 0x1C, 0x37 }, // HF_ATSC (center = 3.25 MHz) { 4000000, 6000000, 0x1D, 0x58 }, /* HF_DVBC_6MHZ (Chicago) */
{ 4000000, 6000000, 0x1D, 0x58 }, // HF_DVBC_6MHZ (Chicago) { 4500000, 7000000, 0x1E, 0x37 }, /* HF_DVBC_7MHZ (not documented by NXP) */
{ 4500000, 7000000, 0x1E, 0x37 }, // HF_DVBC_7MHZ (not documented by NXP) { 5000000, 8000000, 0x1F, 0x37 }, /* HF_DVBC_8MHZ */
{ 5000000, 8000000, 0x1F, 0x37 }, // HF_DVBC_8MHZ { 0, 0, 0x00, 0x00 }, /* HF_DVBC (Unused) */
{ 0, 0, 0x00, 0x00 }, // HF_DVBC (Unused)
}; };
struct SMap m_BP_Filter_Map[] = { struct SMap m_BP_Filter_Map[] = {
{ 62000000, 0x00 }, { 62000000, 0x00 },
{ 84000000, 0x01 }, { 84000000, 0x01 },
{ 100000000, 0x02 }, { 100000000, 0x02 },
{ 140000000, 0x03 }, { 140000000, 0x03 },
{ 170000000, 0x04 }, { 170000000, 0x04 },
{ 180000000, 0x05 }, { 180000000, 0x05 },
{ 865000000, 0x06 }, { 865000000, 0x06 },
{ 0, 0x00 }, // Table End { 0, 0x00 }, /* Table End */
}; };
static struct SMapI m_RF_Cal_Map[] = { static struct SMapI m_RF_Cal_Map[] = {
{ 41000000, 0x0F }, { 41000000, 0x0F },
{ 43000000, 0x1C }, { 43000000, 0x1C },
{ 45000000, 0x2F }, { 45000000, 0x2F },
{ 46000000, 0x39 }, { 46000000, 0x39 },
{ 47000000, 0x40 }, { 47000000, 0x40 },
{ 47900000, 0x50 }, { 47900000, 0x50 },
{ 49100000, 0x16 }, { 49100000, 0x16 },
{ 50000000, 0x18 }, { 50000000, 0x18 },
{ 51000000, 0x20 }, { 51000000, 0x20 },
{ 53000000, 0x28 }, { 53000000, 0x28 },
{ 55000000, 0x2B }, { 55000000, 0x2B },
{ 56000000, 0x32 }, { 56000000, 0x32 },
{ 57000000, 0x35 }, { 57000000, 0x35 },
{ 58000000, 0x3E }, { 58000000, 0x3E },
{ 59000000, 0x43 }, { 59000000, 0x43 },
{ 60000000, 0x4E }, { 60000000, 0x4E },
{ 61100000, 0x55 }, { 61100000, 0x55 },
{ 63000000, 0x0F }, { 63000000, 0x0F },
{ 64000000, 0x11 }, { 64000000, 0x11 },
{ 65000000, 0x12 }, { 65000000, 0x12 },
{ 66000000, 0x15 }, { 66000000, 0x15 },
{ 67000000, 0x16 }, { 67000000, 0x16 },
{ 68000000, 0x17 }, { 68000000, 0x17 },
{ 70000000, 0x19 }, { 70000000, 0x19 },
{ 71000000, 0x1C }, { 71000000, 0x1C },
{ 72000000, 0x1D }, { 72000000, 0x1D },
{ 73000000, 0x1F }, { 73000000, 0x1F },
{ 74000000, 0x20 }, { 74000000, 0x20 },
{ 75000000, 0x21 }, { 75000000, 0x21 },
{ 76000000, 0x24 }, { 76000000, 0x24 },
{ 77000000, 0x25 }, { 77000000, 0x25 },
{ 78000000, 0x27 }, { 78000000, 0x27 },
{ 80000000, 0x28 }, { 80000000, 0x28 },
{ 81000000, 0x29 }, { 81000000, 0x29 },
{ 82000000, 0x2D }, { 82000000, 0x2D },
{ 83000000, 0x2E }, { 83000000, 0x2E },
{ 84000000, 0x2F }, { 84000000, 0x2F },
{ 85000000, 0x31 }, { 85000000, 0x31 },
{ 86000000, 0x33 }, { 86000000, 0x33 },
{ 87000000, 0x34 }, { 87000000, 0x34 },
{ 88000000, 0x35 }, { 88000000, 0x35 },
{ 89000000, 0x37 }, { 89000000, 0x37 },
{ 90000000, 0x38 }, { 90000000, 0x38 },
{ 91000000, 0x39 }, { 91000000, 0x39 },
{ 93000000, 0x3C }, { 93000000, 0x3C },
{ 94000000, 0x3E }, { 94000000, 0x3E },
{ 95000000, 0x3F }, { 95000000, 0x3F },
{ 96000000, 0x40 }, { 96000000, 0x40 },
{ 97000000, 0x42 }, { 97000000, 0x42 },
{ 99000000, 0x45 }, { 99000000, 0x45 },
{ 100000000, 0x46 }, { 100000000, 0x46 },
{ 102000000, 0x48 }, { 102000000, 0x48 },
{ 103000000, 0x4A }, { 103000000, 0x4A },
{ 105000000, 0x4D }, { 105000000, 0x4D },
{ 106000000, 0x4E }, { 106000000, 0x4E },
{ 107000000, 0x50 }, { 107000000, 0x50 },
{ 108000000, 0x51 }, { 108000000, 0x51 },
{ 110000000, 0x54 }, { 110000000, 0x54 },
{ 111000000, 0x56 }, { 111000000, 0x56 },
{ 112000000, 0x57 }, { 112000000, 0x57 },
{ 113000000, 0x58 }, { 113000000, 0x58 },
{ 114000000, 0x59 }, { 114000000, 0x59 },
{ 115000000, 0x5C }, { 115000000, 0x5C },
{ 116000000, 0x5D }, { 116000000, 0x5D },
{ 117000000, 0x5F }, { 117000000, 0x5F },
{ 119000000, 0x60 }, { 119000000, 0x60 },
{ 120000000, 0x64 }, { 120000000, 0x64 },
{ 121000000, 0x65 }, { 121000000, 0x65 },
{ 122000000, 0x66 }, { 122000000, 0x66 },
{ 123000000, 0x68 }, { 123000000, 0x68 },
{ 124000000, 0x69 }, { 124000000, 0x69 },
{ 125000000, 0x6C }, { 125000000, 0x6C },
{ 126000000, 0x6D }, { 126000000, 0x6D },
{ 127000000, 0x6E }, { 127000000, 0x6E },
{ 128000000, 0x70 }, { 128000000, 0x70 },
{ 129000000, 0x71 }, { 129000000, 0x71 },
{ 130000000, 0x75 }, { 130000000, 0x75 },
{ 131000000, 0x77 }, { 131000000, 0x77 },
{ 132000000, 0x78 }, { 132000000, 0x78 },
{ 133000000, 0x7B }, { 133000000, 0x7B },
{ 134000000, 0x7E }, { 134000000, 0x7E },
{ 135000000, 0x81 }, { 135000000, 0x81 },
{ 136000000, 0x82 }, { 136000000, 0x82 },
{ 137000000, 0x87 }, { 137000000, 0x87 },
{ 138000000, 0x88 }, { 138000000, 0x88 },
{ 139000000, 0x8D }, { 139000000, 0x8D },
{ 140000000, 0x8E }, { 140000000, 0x8E },
{ 141000000, 0x91 }, { 141000000, 0x91 },
{ 142000000, 0x95 }, { 142000000, 0x95 },
{ 143000000, 0x9A }, { 143000000, 0x9A },
{ 144000000, 0x9D }, { 144000000, 0x9D },
{ 145000000, 0xA1 }, { 145000000, 0xA1 },
{ 146000000, 0xA2 }, { 146000000, 0xA2 },
{ 147000000, 0xA4 }, { 147000000, 0xA4 },
{ 148000000, 0xA9 }, { 148000000, 0xA9 },
{ 149000000, 0xAE }, { 149000000, 0xAE },
{ 150000000, 0xB0 }, { 150000000, 0xB0 },
{ 151000000, 0xB1 }, { 151000000, 0xB1 },
{ 152000000, 0xB7 }, { 152000000, 0xB7 },
{ 152600000, 0xBD }, { 152600000, 0xBD },
{ 154000000, 0x20 }, { 154000000, 0x20 },
{ 155000000, 0x22 }, { 155000000, 0x22 },
{ 156000000, 0x24 }, { 156000000, 0x24 },
{ 157000000, 0x25 }, { 157000000, 0x25 },
{ 158000000, 0x27 }, { 158000000, 0x27 },
{ 159000000, 0x29 }, { 159000000, 0x29 },
{ 160000000, 0x2C }, { 160000000, 0x2C },
{ 161000000, 0x2D }, { 161000000, 0x2D },
{ 163000000, 0x2E }, { 163000000, 0x2E },
{ 164000000, 0x2F }, { 164000000, 0x2F },
{ 164700000, 0x30 }, { 164700000, 0x30 },
{ 166000000, 0x11 }, { 166000000, 0x11 },
{ 167000000, 0x12 }, { 167000000, 0x12 },
{ 168000000, 0x13 }, { 168000000, 0x13 },
{ 169000000, 0x14 }, { 169000000, 0x14 },
{ 170000000, 0x15 }, { 170000000, 0x15 },
{ 172000000, 0x16 }, { 172000000, 0x16 },
{ 173000000, 0x17 }, { 173000000, 0x17 },
{ 174000000, 0x18 }, { 174000000, 0x18 },
{ 175000000, 0x1A }, { 175000000, 0x1A },
{ 176000000, 0x1B }, { 176000000, 0x1B },
{ 178000000, 0x1D }, { 178000000, 0x1D },
{ 179000000, 0x1E }, { 179000000, 0x1E },
{ 180000000, 0x1F }, { 180000000, 0x1F },
{ 181000000, 0x20 }, { 181000000, 0x20 },
{ 182000000, 0x21 }, { 182000000, 0x21 },
{ 183000000, 0x22 }, { 183000000, 0x22 },
{ 184000000, 0x24 }, { 184000000, 0x24 },
{ 185000000, 0x25 }, { 185000000, 0x25 },
{ 186000000, 0x26 }, { 186000000, 0x26 },
{ 187000000, 0x27 }, { 187000000, 0x27 },
{ 188000000, 0x29 }, { 188000000, 0x29 },
{ 189000000, 0x2A }, { 189000000, 0x2A },
{ 190000000, 0x2C }, { 190000000, 0x2C },
{ 191000000, 0x2D }, { 191000000, 0x2D },
{ 192000000, 0x2E }, { 192000000, 0x2E },
{ 193000000, 0x2F }, { 193000000, 0x2F },
{ 194000000, 0x30 }, { 194000000, 0x30 },
{ 195000000, 0x33 }, { 195000000, 0x33 },
{ 196000000, 0x35 }, { 196000000, 0x35 },
{ 198000000, 0x36 }, { 198000000, 0x36 },
{ 200000000, 0x38 }, { 200000000, 0x38 },
{ 201000000, 0x3C }, { 201000000, 0x3C },
{ 202000000, 0x3D }, { 202000000, 0x3D },
{ 203500000, 0x3E }, { 203500000, 0x3E },
{ 206000000, 0x0E }, { 206000000, 0x0E },
{ 208000000, 0x0F }, { 208000000, 0x0F },
{ 212000000, 0x10 }, { 212000000, 0x10 },
{ 216000000, 0x11 }, { 216000000, 0x11 },
{ 217000000, 0x12 }, { 217000000, 0x12 },
{ 218000000, 0x13 }, { 218000000, 0x13 },
{ 220000000, 0x14 }, { 220000000, 0x14 },
{ 222000000, 0x15 }, { 222000000, 0x15 },
{ 225000000, 0x16 }, { 225000000, 0x16 },
{ 228000000, 0x17 }, { 228000000, 0x17 },
{ 231000000, 0x18 }, { 231000000, 0x18 },
{ 234000000, 0x19 }, { 234000000, 0x19 },
{ 235000000, 0x1A }, { 235000000, 0x1A },
{ 236000000, 0x1B }, { 236000000, 0x1B },
{ 237000000, 0x1C }, { 237000000, 0x1C },
{ 240000000, 0x1D }, { 240000000, 0x1D },
{ 242000000, 0x1E }, { 242000000, 0x1E },
{ 244000000, 0x1F }, { 244000000, 0x1F },
{ 247000000, 0x20 }, { 247000000, 0x20 },
{ 249000000, 0x21 }, { 249000000, 0x21 },
{ 252000000, 0x22 }, { 252000000, 0x22 },
{ 253000000, 0x23 }, { 253000000, 0x23 },
{ 254000000, 0x24 }, { 254000000, 0x24 },
{ 256000000, 0x25 }, { 256000000, 0x25 },
{ 259000000, 0x26 }, { 259000000, 0x26 },
{ 262000000, 0x27 }, { 262000000, 0x27 },
{ 264000000, 0x28 }, { 264000000, 0x28 },
{ 267000000, 0x29 }, { 267000000, 0x29 },
{ 269000000, 0x2A }, { 269000000, 0x2A },
{ 271000000, 0x2B }, { 271000000, 0x2B },
{ 273000000, 0x2C }, { 273000000, 0x2C },
{ 275000000, 0x2D }, { 275000000, 0x2D },
{ 277000000, 0x2E }, { 277000000, 0x2E },
{ 279000000, 0x2F }, { 279000000, 0x2F },
{ 282000000, 0x30 }, { 282000000, 0x30 },
{ 284000000, 0x31 }, { 284000000, 0x31 },
{ 286000000, 0x32 }, { 286000000, 0x32 },
{ 287000000, 0x33 }, { 287000000, 0x33 },
{ 290000000, 0x34 }, { 290000000, 0x34 },
{ 293000000, 0x35 }, { 293000000, 0x35 },
{ 295000000, 0x36 }, { 295000000, 0x36 },
{ 297000000, 0x37 }, { 297000000, 0x37 },
{ 300000000, 0x38 }, { 300000000, 0x38 },
{ 303000000, 0x39 }, { 303000000, 0x39 },
{ 305000000, 0x3A }, { 305000000, 0x3A },
{ 306000000, 0x3B }, { 306000000, 0x3B },
{ 307000000, 0x3C }, { 307000000, 0x3C },
{ 310000000, 0x3D }, { 310000000, 0x3D },
{ 312000000, 0x3E }, { 312000000, 0x3E },
{ 315000000, 0x3F }, { 315000000, 0x3F },
{ 318000000, 0x40 }, { 318000000, 0x40 },
{ 320000000, 0x41 }, { 320000000, 0x41 },
{ 323000000, 0x42 }, { 323000000, 0x42 },
{ 324000000, 0x43 }, { 324000000, 0x43 },
{ 325000000, 0x44 }, { 325000000, 0x44 },
{ 327000000, 0x45 }, { 327000000, 0x45 },
{ 331000000, 0x46 }, { 331000000, 0x46 },
{ 334000000, 0x47 }, { 334000000, 0x47 },
{ 337000000, 0x48 }, { 337000000, 0x48 },
{ 339000000, 0x49 }, { 339000000, 0x49 },
{ 340000000, 0x4A }, { 340000000, 0x4A },
{ 341000000, 0x4B }, { 341000000, 0x4B },
{ 343000000, 0x4C }, { 343000000, 0x4C },
{ 345000000, 0x4D }, { 345000000, 0x4D },
{ 349000000, 0x4E }, { 349000000, 0x4E },
{ 352000000, 0x4F }, { 352000000, 0x4F },
{ 353000000, 0x50 }, { 353000000, 0x50 },
{ 355000000, 0x51 }, { 355000000, 0x51 },
{ 357000000, 0x52 }, { 357000000, 0x52 },
{ 359000000, 0x53 }, { 359000000, 0x53 },
{ 361000000, 0x54 }, { 361000000, 0x54 },
{ 362000000, 0x55 }, { 362000000, 0x55 },
{ 364000000, 0x56 }, { 364000000, 0x56 },
{ 368000000, 0x57 }, { 368000000, 0x57 },
{ 370000000, 0x58 }, { 370000000, 0x58 },
{ 372000000, 0x59 }, { 372000000, 0x59 },
{ 375000000, 0x5A }, { 375000000, 0x5A },
{ 376000000, 0x5B }, { 376000000, 0x5B },
{ 377000000, 0x5C }, { 377000000, 0x5C },
{ 379000000, 0x5D }, { 379000000, 0x5D },
{ 382000000, 0x5E }, { 382000000, 0x5E },
{ 384000000, 0x5F }, { 384000000, 0x5F },
{ 385000000, 0x60 }, { 385000000, 0x60 },
{ 386000000, 0x61 }, { 386000000, 0x61 },
{ 388000000, 0x62 }, { 388000000, 0x62 },
{ 390000000, 0x63 }, { 390000000, 0x63 },
{ 393000000, 0x64 }, { 393000000, 0x64 },
{ 394000000, 0x65 }, { 394000000, 0x65 },
{ 396000000, 0x66 }, { 396000000, 0x66 },
{ 397000000, 0x67 }, { 397000000, 0x67 },
{ 398000000, 0x68 }, { 398000000, 0x68 },
{ 400000000, 0x69 }, { 400000000, 0x69 },
{ 402000000, 0x6A }, { 402000000, 0x6A },
{ 403000000, 0x6B }, { 403000000, 0x6B },
{ 407000000, 0x6C }, { 407000000, 0x6C },
{ 408000000, 0x6D }, { 408000000, 0x6D },
{ 409000000, 0x6E }, { 409000000, 0x6E },
{ 410000000, 0x6F }, { 410000000, 0x6F },
{ 411000000, 0x70 }, { 411000000, 0x70 },
{ 412000000, 0x71 }, { 412000000, 0x71 },
{ 413000000, 0x72 }, { 413000000, 0x72 },
{ 414000000, 0x73 }, { 414000000, 0x73 },
{ 417000000, 0x74 }, { 417000000, 0x74 },
{ 418000000, 0x75 }, { 418000000, 0x75 },
{ 420000000, 0x76 }, { 420000000, 0x76 },
{ 422000000, 0x77 }, { 422000000, 0x77 },
{ 423000000, 0x78 }, { 423000000, 0x78 },
{ 424000000, 0x79 }, { 424000000, 0x79 },
{ 427000000, 0x7A }, { 427000000, 0x7A },
{ 428000000, 0x7B }, { 428000000, 0x7B },
{ 429000000, 0x7D }, { 429000000, 0x7D },
{ 432000000, 0x7F }, { 432000000, 0x7F },
{ 434000000, 0x80 }, { 434000000, 0x80 },
{ 435000000, 0x81 }, { 435000000, 0x81 },
{ 436000000, 0x83 }, { 436000000, 0x83 },
{ 437000000, 0x84 }, { 437000000, 0x84 },
{ 438000000, 0x85 }, { 438000000, 0x85 },
{ 439000000, 0x86 }, { 439000000, 0x86 },
{ 440000000, 0x87 }, { 440000000, 0x87 },
{ 441000000, 0x88 }, { 441000000, 0x88 },
{ 442000000, 0x89 }, { 442000000, 0x89 },
{ 445000000, 0x8A }, { 445000000, 0x8A },
{ 446000000, 0x8B }, { 446000000, 0x8B },
{ 447000000, 0x8C }, { 447000000, 0x8C },
{ 448000000, 0x8E }, { 448000000, 0x8E },
{ 449000000, 0x8F }, { 449000000, 0x8F },
{ 450000000, 0x90 }, { 450000000, 0x90 },
{ 452000000, 0x91 }, { 452000000, 0x91 },
{ 453000000, 0x93 }, { 453000000, 0x93 },
{ 454000000, 0x94 }, { 454000000, 0x94 },
{ 456000000, 0x96 }, { 456000000, 0x96 },
{ 457800000, 0x98 }, { 457800000, 0x98 },
{ 461000000, 0x11 }, { 461000000, 0x11 },
{ 468000000, 0x12 }, { 468000000, 0x12 },
{ 472000000, 0x13 }, { 472000000, 0x13 },
{ 473000000, 0x14 }, { 473000000, 0x14 },
{ 474000000, 0x15 }, { 474000000, 0x15 },
{ 481000000, 0x16 }, { 481000000, 0x16 },
{ 486000000, 0x17 }, { 486000000, 0x17 },
{ 491000000, 0x18 }, { 491000000, 0x18 },
{ 498000000, 0x19 }, { 498000000, 0x19 },
{ 499000000, 0x1A }, { 499000000, 0x1A },
{ 501000000, 0x1B }, { 501000000, 0x1B },
{ 506000000, 0x1C }, { 506000000, 0x1C },
{ 511000000, 0x1D }, { 511000000, 0x1D },
{ 516000000, 0x1E }, { 516000000, 0x1E },
{ 520000000, 0x1F }, { 520000000, 0x1F },
{ 521000000, 0x20 }, { 521000000, 0x20 },
{ 525000000, 0x21 }, { 525000000, 0x21 },
{ 529000000, 0x22 }, { 529000000, 0x22 },
{ 533000000, 0x23 }, { 533000000, 0x23 },
{ 539000000, 0x24 }, { 539000000, 0x24 },
{ 541000000, 0x25 }, { 541000000, 0x25 },
{ 547000000, 0x26 }, { 547000000, 0x26 },
{ 549000000, 0x27 }, { 549000000, 0x27 },
{ 551000000, 0x28 }, { 551000000, 0x28 },
{ 556000000, 0x29 }, { 556000000, 0x29 },
{ 561000000, 0x2A }, { 561000000, 0x2A },
{ 563000000, 0x2B }, { 563000000, 0x2B },
{ 565000000, 0x2C }, { 565000000, 0x2C },
{ 569000000, 0x2D }, { 569000000, 0x2D },
{ 571000000, 0x2E }, { 571000000, 0x2E },
{ 577000000, 0x2F }, { 577000000, 0x2F },
{ 580000000, 0x30 }, { 580000000, 0x30 },
{ 582000000, 0x31 }, { 582000000, 0x31 },
{ 584000000, 0x32 }, { 584000000, 0x32 },
{ 588000000, 0x33 }, { 588000000, 0x33 },
{ 591000000, 0x34 }, { 591000000, 0x34 },
{ 596000000, 0x35 }, { 596000000, 0x35 },
{ 598000000, 0x36 }, { 598000000, 0x36 },
{ 603000000, 0x37 }, { 603000000, 0x37 },
{ 604000000, 0x38 }, { 604000000, 0x38 },
{ 606000000, 0x39 }, { 606000000, 0x39 },
{ 612000000, 0x3A }, { 612000000, 0x3A },
{ 615000000, 0x3B }, { 615000000, 0x3B },
{ 617000000, 0x3C }, { 617000000, 0x3C },
{ 621000000, 0x3D }, { 621000000, 0x3D },
{ 622000000, 0x3E }, { 622000000, 0x3E },
{ 625000000, 0x3F }, { 625000000, 0x3F },
{ 632000000, 0x40 }, { 632000000, 0x40 },
{ 633000000, 0x41 }, { 633000000, 0x41 },
{ 634000000, 0x42 }, { 634000000, 0x42 },
{ 642000000, 0x43 }, { 642000000, 0x43 },
{ 643000000, 0x44 }, { 643000000, 0x44 },
{ 647000000, 0x45 }, { 647000000, 0x45 },
{ 650000000, 0x46 }, { 650000000, 0x46 },
{ 652000000, 0x47 }, { 652000000, 0x47 },
{ 657000000, 0x48 }, { 657000000, 0x48 },
{ 661000000, 0x49 }, { 661000000, 0x49 },
{ 662000000, 0x4A }, { 662000000, 0x4A },
{ 665000000, 0x4B }, { 665000000, 0x4B },
{ 667000000, 0x4C }, { 667000000, 0x4C },
{ 670000000, 0x4D }, { 670000000, 0x4D },
{ 673000000, 0x4E }, { 673000000, 0x4E },
{ 676000000, 0x4F }, { 676000000, 0x4F },
{ 677000000, 0x50 }, { 677000000, 0x50 },
{ 681000000, 0x51 }, { 681000000, 0x51 },
{ 683000000, 0x52 }, { 683000000, 0x52 },
{ 686000000, 0x53 }, { 686000000, 0x53 },
{ 688000000, 0x54 }, { 688000000, 0x54 },
{ 689000000, 0x55 }, { 689000000, 0x55 },
{ 691000000, 0x56 }, { 691000000, 0x56 },
{ 695000000, 0x57 }, { 695000000, 0x57 },
{ 698000000, 0x58 }, { 698000000, 0x58 },
{ 703000000, 0x59 }, { 703000000, 0x59 },
{ 704000000, 0x5A }, { 704000000, 0x5A },
{ 705000000, 0x5B }, { 705000000, 0x5B },
{ 707000000, 0x5C }, { 707000000, 0x5C },
{ 710000000, 0x5D }, { 710000000, 0x5D },
{ 712000000, 0x5E }, { 712000000, 0x5E },
{ 717000000, 0x5F }, { 717000000, 0x5F },
{ 718000000, 0x60 }, { 718000000, 0x60 },
{ 721000000, 0x61 }, { 721000000, 0x61 },
{ 722000000, 0x62 }, { 722000000, 0x62 },
{ 723000000, 0x63 }, { 723000000, 0x63 },
{ 725000000, 0x64 }, { 725000000, 0x64 },
{ 727000000, 0x65 }, { 727000000, 0x65 },
{ 730000000, 0x66 }, { 730000000, 0x66 },
{ 732000000, 0x67 }, { 732000000, 0x67 },
{ 735000000, 0x68 }, { 735000000, 0x68 },
{ 740000000, 0x69 }, { 740000000, 0x69 },
{ 741000000, 0x6A }, { 741000000, 0x6A },
{ 742000000, 0x6B }, { 742000000, 0x6B },
{ 743000000, 0x6C }, { 743000000, 0x6C },
{ 745000000, 0x6D }, { 745000000, 0x6D },
{ 747000000, 0x6E }, { 747000000, 0x6E },
{ 748000000, 0x6F }, { 748000000, 0x6F },
{ 750000000, 0x70 }, { 750000000, 0x70 },
{ 752000000, 0x71 }, { 752000000, 0x71 },
{ 754000000, 0x72 }, { 754000000, 0x72 },
{ 757000000, 0x73 }, { 757000000, 0x73 },
{ 758000000, 0x74 }, { 758000000, 0x74 },
{ 760000000, 0x75 }, { 760000000, 0x75 },
{ 763000000, 0x76 }, { 763000000, 0x76 },
{ 764000000, 0x77 }, { 764000000, 0x77 },
{ 766000000, 0x78 }, { 766000000, 0x78 },
{ 767000000, 0x79 }, { 767000000, 0x79 },
{ 768000000, 0x7A }, { 768000000, 0x7A },
{ 773000000, 0x7B }, { 773000000, 0x7B },
{ 774000000, 0x7C }, { 774000000, 0x7C },
{ 776000000, 0x7D }, { 776000000, 0x7D },
{ 777000000, 0x7E }, { 777000000, 0x7E },
{ 778000000, 0x7F }, { 778000000, 0x7F },
{ 779000000, 0x80 }, { 779000000, 0x80 },
{ 781000000, 0x81 }, { 781000000, 0x81 },
{ 783000000, 0x82 }, { 783000000, 0x82 },
{ 784000000, 0x83 }, { 784000000, 0x83 },
{ 785000000, 0x84 }, { 785000000, 0x84 },
{ 786000000, 0x85 }, { 786000000, 0x85 },
{ 793000000, 0x86 }, { 793000000, 0x86 },
{ 794000000, 0x87 }, { 794000000, 0x87 },
{ 795000000, 0x88 }, { 795000000, 0x88 },
{ 797000000, 0x89 }, { 797000000, 0x89 },
{ 799000000, 0x8A }, { 799000000, 0x8A },
{ 801000000, 0x8B }, { 801000000, 0x8B },
{ 802000000, 0x8C }, { 802000000, 0x8C },
{ 803000000, 0x8D }, { 803000000, 0x8D },
{ 804000000, 0x8E }, { 804000000, 0x8E },
{ 810000000, 0x90 }, { 810000000, 0x90 },
{ 811000000, 0x91 }, { 811000000, 0x91 },
{ 812000000, 0x92 }, { 812000000, 0x92 },
{ 814000000, 0x93 }, { 814000000, 0x93 },
{ 816000000, 0x94 }, { 816000000, 0x94 },
{ 817000000, 0x96 }, { 817000000, 0x96 },
{ 818000000, 0x97 }, { 818000000, 0x97 },
{ 820000000, 0x98 }, { 820000000, 0x98 },
{ 821000000, 0x99 }, { 821000000, 0x99 },
{ 822000000, 0x9A }, { 822000000, 0x9A },
{ 828000000, 0x9B }, { 828000000, 0x9B },
{ 829000000, 0x9D }, { 829000000, 0x9D },
{ 830000000, 0x9F }, { 830000000, 0x9F },
{ 831000000, 0xA0 }, { 831000000, 0xA0 },
{ 833000000, 0xA1 }, { 833000000, 0xA1 },
{ 835000000, 0xA2 }, { 835000000, 0xA2 },
{ 836000000, 0xA3 }, { 836000000, 0xA3 },
{ 837000000, 0xA4 }, { 837000000, 0xA4 },
{ 838000000, 0xA6 }, { 838000000, 0xA6 },
{ 840000000, 0xA8 }, { 840000000, 0xA8 },
{ 842000000, 0xA9 }, { 842000000, 0xA9 },
{ 845000000, 0xAA }, { 845000000, 0xAA },
{ 846000000, 0xAB }, { 846000000, 0xAB },
{ 847000000, 0xAD }, { 847000000, 0xAD },
{ 848000000, 0xAE }, { 848000000, 0xAE },
{ 852000000, 0xAF }, { 852000000, 0xAF },
{ 853000000, 0xB0 }, { 853000000, 0xB0 },
{ 858000000, 0xB1 }, { 858000000, 0xB1 },
{ 860000000, 0xB2 }, { 860000000, 0xB2 },
{ 861000000, 0xB3 }, { 861000000, 0xB3 },
{ 862000000, 0xB4 }, { 862000000, 0xB4 },
{ 863000000, 0xB6 }, { 863000000, 0xB6 },
{ 864000000, 0xB8 }, { 864000000, 0xB8 },
{ 865000000, 0xB9 }, { 865000000, 0xB9 },
{ 0, 0x00 }, // Table End { 0, 0x00 }, /* Table End */
}; };
static struct SMap2 m_KM_Map[] = { static struct SMap2 m_KM_Map[] = {
{ 47900000, 3, 2 }, { 47900000, 3, 2 },
{ 61100000, 3, 1 }, { 61100000, 3, 1 },
{ 350000000, 3, 0 }, { 350000000, 3, 0 },
{ 720000000, 2, 1 }, { 720000000, 2, 1 },
{ 865000000, 3, 3 }, { 865000000, 3, 3 },
{ 0, 0x00 }, // Table End { 0, 0x00 }, /* Table End */
}; };
static struct SMap2 m_Main_PLL_Map[] = { static struct SMap2 m_Main_PLL_Map[] = {
{ 33125000, 0x57, 0xF0 }, { 33125000, 0x57, 0xF0 },
{ 35500000, 0x56, 0xE0 }, { 35500000, 0x56, 0xE0 },
{ 38188000, 0x55, 0xD0 }, { 38188000, 0x55, 0xD0 },
{ 41375000, 0x54, 0xC0 }, { 41375000, 0x54, 0xC0 },
{ 45125000, 0x53, 0xB0 }, { 45125000, 0x53, 0xB0 },
{ 49688000, 0x52, 0xA0 }, { 49688000, 0x52, 0xA0 },
{ 55188000, 0x51, 0x90 }, { 55188000, 0x51, 0x90 },
{ 62125000, 0x50, 0x80 }, { 62125000, 0x50, 0x80 },
{ 66250000, 0x47, 0x78 }, { 66250000, 0x47, 0x78 },
{ 71000000, 0x46, 0x70 }, { 71000000, 0x46, 0x70 },
{ 76375000, 0x45, 0x68 }, { 76375000, 0x45, 0x68 },
{ 82750000, 0x44, 0x60 }, { 82750000, 0x44, 0x60 },
{ 90250000, 0x43, 0x58 }, { 90250000, 0x43, 0x58 },
{ 99375000, 0x42, 0x50 }, { 99375000, 0x42, 0x50 },
{ 110375000, 0x41, 0x48 }, { 110375000, 0x41, 0x48 },
{ 124250000, 0x40, 0x40 }, { 124250000, 0x40, 0x40 },
{ 132500000, 0x37, 0x3C }, { 132500000, 0x37, 0x3C },
{ 142000000, 0x36, 0x38 }, { 142000000, 0x36, 0x38 },
{ 152750000, 0x35, 0x34 }, { 152750000, 0x35, 0x34 },
{ 165500000, 0x34, 0x30 }, { 165500000, 0x34, 0x30 },
{ 180500000, 0x33, 0x2C }, { 180500000, 0x33, 0x2C },
{ 198750000, 0x32, 0x28 }, { 198750000, 0x32, 0x28 },
{ 220750000, 0x31, 0x24 }, { 220750000, 0x31, 0x24 },
{ 248500000, 0x30, 0x20 }, { 248500000, 0x30, 0x20 },
{ 265000000, 0x27, 0x1E }, { 265000000, 0x27, 0x1E },
{ 284000000, 0x26, 0x1C }, { 284000000, 0x26, 0x1C },
{ 305500000, 0x25, 0x1A }, { 305500000, 0x25, 0x1A },
{ 331000000, 0x24, 0x18 }, { 331000000, 0x24, 0x18 },
{ 361000000, 0x23, 0x16 }, { 361000000, 0x23, 0x16 },
{ 397500000, 0x22, 0x14 }, { 397500000, 0x22, 0x14 },
{ 441500000, 0x21, 0x12 }, { 441500000, 0x21, 0x12 },
{ 497000000, 0x20, 0x10 }, { 497000000, 0x20, 0x10 },
{ 530000000, 0x17, 0x0F }, { 530000000, 0x17, 0x0F },
{ 568000000, 0x16, 0x0E }, { 568000000, 0x16, 0x0E },
{ 611000000, 0x15, 0x0D }, { 611000000, 0x15, 0x0D },
{ 662000000, 0x14, 0x0C }, { 662000000, 0x14, 0x0C },
{ 722000000, 0x13, 0x0B }, { 722000000, 0x13, 0x0B },
{ 795000000, 0x12, 0x0A }, { 795000000, 0x12, 0x0A },
{ 883000000, 0x11, 0x09 }, { 883000000, 0x11, 0x09 },
{ 994000000, 0x10, 0x08 }, { 994000000, 0x10, 0x08 },
{ 0, 0x00, 0x00 }, // Table End { 0, 0x00, 0x00 }, /* Table End */
}; };
static struct SMap2 m_Cal_PLL_Map[] = { static struct SMap2 m_Cal_PLL_Map[] = {
{ 33813000, 0xDD, 0xD0 }, { 33813000, 0xDD, 0xD0 },
{ 36625000, 0xDC, 0xC0 }, { 36625000, 0xDC, 0xC0 },
{ 39938000, 0xDB, 0xB0 }, { 39938000, 0xDB, 0xB0 },
{ 43938000, 0xDA, 0xA0 }, { 43938000, 0xDA, 0xA0 },
{ 48813000, 0xD9, 0x90 }, { 48813000, 0xD9, 0x90 },
{ 54938000, 0xD8, 0x80 }, { 54938000, 0xD8, 0x80 },
{ 62813000, 0xD3, 0x70 }, { 62813000, 0xD3, 0x70 },
{ 67625000, 0xCD, 0x68 }, { 67625000, 0xCD, 0x68 },
{ 73250000, 0xCC, 0x60 }, { 73250000, 0xCC, 0x60 },
{ 79875000, 0xCB, 0x58 }, { 79875000, 0xCB, 0x58 },
{ 87875000, 0xCA, 0x50 }, { 87875000, 0xCA, 0x50 },
{ 97625000, 0xC9, 0x48 }, { 97625000, 0xC9, 0x48 },
{ 109875000, 0xC8, 0x40 }, { 109875000, 0xC8, 0x40 },
{ 125625000, 0xC3, 0x38 }, { 125625000, 0xC3, 0x38 },
{ 135250000, 0xBD, 0x34 }, { 135250000, 0xBD, 0x34 },
{ 146500000, 0xBC, 0x30 }, { 146500000, 0xBC, 0x30 },
{ 159750000, 0xBB, 0x2C }, { 159750000, 0xBB, 0x2C },
{ 175750000, 0xBA, 0x28 }, { 175750000, 0xBA, 0x28 },
{ 195250000, 0xB9, 0x24 }, { 195250000, 0xB9, 0x24 },
{ 219750000, 0xB8, 0x20 }, { 219750000, 0xB8, 0x20 },
{ 251250000, 0xB3, 0x1C }, { 251250000, 0xB3, 0x1C },
{ 270500000, 0xAD, 0x1A }, { 270500000, 0xAD, 0x1A },
{ 293000000, 0xAC, 0x18 }, { 293000000, 0xAC, 0x18 },
{ 319500000, 0xAB, 0x16 }, { 319500000, 0xAB, 0x16 },
{ 351500000, 0xAA, 0x14 }, { 351500000, 0xAA, 0x14 },
{ 390500000, 0xA9, 0x12 }, { 390500000, 0xA9, 0x12 },
{ 439500000, 0xA8, 0x10 }, { 439500000, 0xA8, 0x10 },
{ 502500000, 0xA3, 0x0E }, { 502500000, 0xA3, 0x0E },
{ 541000000, 0x9D, 0x0D }, { 541000000, 0x9D, 0x0D },
{ 586000000, 0x9C, 0x0C }, { 586000000, 0x9C, 0x0C },
{ 639000000, 0x9B, 0x0B }, { 639000000, 0x9B, 0x0B },
{ 703000000, 0x9A, 0x0A }, { 703000000, 0x9A, 0x0A },
{ 781000000, 0x99, 0x09 }, { 781000000, 0x99, 0x09 },
{ 879000000, 0x98, 0x08 }, { 879000000, 0x98, 0x08 },
{ 0, 0x00, 0x00 }, // Table End { 0, 0x00, 0x00 }, /* Table End */
}; };
static struct SMap m_GainTaper_Map[] = { static struct SMap m_GainTaper_Map[] = {
{ 45400000, 0x1F }, { 45400000, 0x1F },
{ 45800000, 0x1E }, { 45800000, 0x1E },
{ 46200000, 0x1D }, { 46200000, 0x1D },
{ 46700000, 0x1C }, { 46700000, 0x1C },
{ 47100000, 0x1B }, { 47100000, 0x1B },
{ 47500000, 0x1A }, { 47500000, 0x1A },
{ 47900000, 0x19 }, { 47900000, 0x19 },
{ 49600000, 0x17 }, { 49600000, 0x17 },
{ 51200000, 0x16 }, { 51200000, 0x16 },
{ 52900000, 0x15 }, { 52900000, 0x15 },
{ 54500000, 0x14 }, { 54500000, 0x14 },
{ 56200000, 0x13 }, { 56200000, 0x13 },
{ 57800000, 0x12 }, { 57800000, 0x12 },
{ 59500000, 0x11 }, { 59500000, 0x11 },
{ 61100000, 0x10 }, { 61100000, 0x10 },
{ 67600000, 0x0D }, { 67600000, 0x0D },
{ 74200000, 0x0C }, { 74200000, 0x0C },
{ 80700000, 0x0B }, { 80700000, 0x0B },
{ 87200000, 0x0A }, { 87200000, 0x0A },
{ 93800000, 0x09 }, { 93800000, 0x09 },
{ 100300000, 0x08 }, { 100300000, 0x08 },
{ 106900000, 0x07 }, { 106900000, 0x07 },
{ 113400000, 0x06 }, { 113400000, 0x06 },
{ 119900000, 0x05 }, { 119900000, 0x05 },
{ 126500000, 0x04 }, { 126500000, 0x04 },
{ 133000000, 0x03 }, { 133000000, 0x03 },
{ 139500000, 0x02 }, { 139500000, 0x02 },
{ 146100000, 0x01 }, { 146100000, 0x01 },
{ 152600000, 0x00 }, { 152600000, 0x00 },
{ 154300000, 0x1F }, { 154300000, 0x1F },
{ 156100000, 0x1E }, { 156100000, 0x1E },
{ 157800000, 0x1D }, { 157800000, 0x1D },
{ 159500000, 0x1C }, { 159500000, 0x1C },
{ 161200000, 0x1B }, { 161200000, 0x1B },
{ 163000000, 0x1A }, { 163000000, 0x1A },
{ 164700000, 0x19 }, { 164700000, 0x19 },
{ 170200000, 0x17 }, { 170200000, 0x17 },
{ 175800000, 0x16 }, { 175800000, 0x16 },
{ 181300000, 0x15 }, { 181300000, 0x15 },
{ 186900000, 0x14 }, { 186900000, 0x14 },
{ 192400000, 0x13 }, { 192400000, 0x13 },
{ 198000000, 0x12 }, { 198000000, 0x12 },
{ 203500000, 0x11 }, { 203500000, 0x11 },
{ 216200000, 0x14 }, { 216200000, 0x14 },
{ 228900000, 0x13 }, { 228900000, 0x13 },
{ 241600000, 0x12 }, { 241600000, 0x12 },
{ 254400000, 0x11 }, { 254400000, 0x11 },
{ 267100000, 0x10 }, { 267100000, 0x10 },
{ 279800000, 0x0F }, { 279800000, 0x0F },
{ 292500000, 0x0E }, { 292500000, 0x0E },
{ 305200000, 0x0D }, { 305200000, 0x0D },
{ 317900000, 0x0C }, { 317900000, 0x0C },
{ 330700000, 0x0B }, { 330700000, 0x0B },
{ 343400000, 0x0A }, { 343400000, 0x0A },
{ 356100000, 0x09 }, { 356100000, 0x09 },
{ 368800000, 0x08 }, { 368800000, 0x08 },
{ 381500000, 0x07 }, { 381500000, 0x07 },
{ 394200000, 0x06 }, { 394200000, 0x06 },
{ 406900000, 0x05 }, { 406900000, 0x05 },
{ 419700000, 0x04 }, { 419700000, 0x04 },
{ 432400000, 0x03 }, { 432400000, 0x03 },
{ 445100000, 0x02 }, { 445100000, 0x02 },
{ 457800000, 0x01 }, { 457800000, 0x01 },
{ 476300000, 0x19 }, { 476300000, 0x19 },
{ 494800000, 0x18 }, { 494800000, 0x18 },
{ 513300000, 0x17 }, { 513300000, 0x17 },
{ 531800000, 0x16 }, { 531800000, 0x16 },
{ 550300000, 0x15 }, { 550300000, 0x15 },
{ 568900000, 0x14 }, { 568900000, 0x14 },
{ 587400000, 0x13 }, { 587400000, 0x13 },
{ 605900000, 0x12 }, { 605900000, 0x12 },
{ 624400000, 0x11 }, { 624400000, 0x11 },
{ 642900000, 0x10 }, { 642900000, 0x10 },
{ 661400000, 0x0F }, { 661400000, 0x0F },
{ 679900000, 0x0E }, { 679900000, 0x0E },
{ 698400000, 0x0D }, { 698400000, 0x0D },
{ 716900000, 0x0C }, { 716900000, 0x0C },
{ 735400000, 0x0B }, { 735400000, 0x0B },
{ 753900000, 0x0A }, { 753900000, 0x0A },
{ 772500000, 0x09 }, { 772500000, 0x09 },
{ 791000000, 0x08 }, { 791000000, 0x08 },
{ 809500000, 0x07 }, { 809500000, 0x07 },
{ 828000000, 0x06 }, { 828000000, 0x06 },
{ 846500000, 0x05 }, { 846500000, 0x05 },
{ 865000000, 0x04 }, { 865000000, 0x04 },
{ 0, 0x00 }, // Table End { 0, 0x00 }, /* Table End */
}; };
static struct SMap m_RF_Cal_DC_Over_DT_Map[] = { static struct SMap m_RF_Cal_DC_Over_DT_Map[] = {
{ 47900000, 0x00 }, { 47900000, 0x00 },
{ 55000000, 0x00 }, { 55000000, 0x00 },
{ 61100000, 0x0A }, { 61100000, 0x0A },
{ 64000000, 0x0A }, { 64000000, 0x0A },
{ 82000000, 0x14 }, { 82000000, 0x14 },
{ 84000000, 0x19 }, { 84000000, 0x19 },
{ 119000000, 0x1C }, { 119000000, 0x1C },
{ 124000000, 0x20 }, { 124000000, 0x20 },
{ 129000000, 0x2A }, { 129000000, 0x2A },
{ 134000000, 0x32 }, { 134000000, 0x32 },
{ 139000000, 0x39 }, { 139000000, 0x39 },
{ 144000000, 0x3E }, { 144000000, 0x3E },
{ 149000000, 0x3F }, { 149000000, 0x3F },
{ 152600000, 0x40 }, { 152600000, 0x40 },
{ 154000000, 0x40 }, { 154000000, 0x40 },
{ 164700000, 0x41 }, { 164700000, 0x41 },
{ 203500000, 0x32 }, { 203500000, 0x32 },
{ 353000000, 0x19 }, { 353000000, 0x19 },
{ 356000000, 0x1A }, { 356000000, 0x1A },
{ 359000000, 0x1B }, { 359000000, 0x1B },
{ 363000000, 0x1C }, { 363000000, 0x1C },
{ 366000000, 0x1D }, { 366000000, 0x1D },
{ 369000000, 0x1E }, { 369000000, 0x1E },
{ 373000000, 0x1F }, { 373000000, 0x1F },
{ 376000000, 0x20 }, { 376000000, 0x20 },
{ 379000000, 0x21 }, { 379000000, 0x21 },
{ 383000000, 0x22 }, { 383000000, 0x22 },
{ 386000000, 0x23 }, { 386000000, 0x23 },
{ 389000000, 0x24 }, { 389000000, 0x24 },
{ 393000000, 0x25 }, { 393000000, 0x25 },
{ 396000000, 0x26 }, { 396000000, 0x26 },
{ 399000000, 0x27 }, { 399000000, 0x27 },
{ 402000000, 0x28 }, { 402000000, 0x28 },
{ 404000000, 0x29 }, { 404000000, 0x29 },
{ 407000000, 0x2A }, { 407000000, 0x2A },
{ 409000000, 0x2B }, { 409000000, 0x2B },
{ 412000000, 0x2C }, { 412000000, 0x2C },
{ 414000000, 0x2D }, { 414000000, 0x2D },
{ 417000000, 0x2E }, { 417000000, 0x2E },
{ 419000000, 0x2F }, { 419000000, 0x2F },
{ 422000000, 0x30 }, { 422000000, 0x30 },
{ 424000000, 0x31 }, { 424000000, 0x31 },
{ 427000000, 0x32 }, { 427000000, 0x32 },
{ 429000000, 0x33 }, { 429000000, 0x33 },
{ 432000000, 0x34 }, { 432000000, 0x34 },
{ 434000000, 0x35 }, { 434000000, 0x35 },
{ 437000000, 0x36 }, { 437000000, 0x36 },
{ 439000000, 0x37 }, { 439000000, 0x37 },
{ 442000000, 0x38 }, { 442000000, 0x38 },
{ 444000000, 0x39 }, { 444000000, 0x39 },
{ 447000000, 0x3A }, { 447000000, 0x3A },
{ 449000000, 0x3B }, { 449000000, 0x3B },
{ 457800000, 0x3C }, { 457800000, 0x3C },
{ 465000000, 0x0F }, { 465000000, 0x0F },
{ 477000000, 0x12 }, { 477000000, 0x12 },
{ 483000000, 0x14 }, { 483000000, 0x14 },
{ 502000000, 0x19 }, { 502000000, 0x19 },
{ 508000000, 0x1B }, { 508000000, 0x1B },
{ 519000000, 0x1C }, { 519000000, 0x1C },
{ 522000000, 0x1D }, { 522000000, 0x1D },
{ 524000000, 0x1E }, { 524000000, 0x1E },
{ 534000000, 0x1F }, { 534000000, 0x1F },
{ 549000000, 0x20 }, { 549000000, 0x20 },
{ 554000000, 0x22 }, { 554000000, 0x22 },
{ 584000000, 0x24 }, { 584000000, 0x24 },
{ 589000000, 0x26 }, { 589000000, 0x26 },
{ 658000000, 0x27 }, { 658000000, 0x27 },
{ 664000000, 0x2C }, { 664000000, 0x2C },
{ 669000000, 0x2D }, { 669000000, 0x2D },
{ 699000000, 0x2E }, { 699000000, 0x2E },
{ 704000000, 0x30 }, { 704000000, 0x30 },
{ 709000000, 0x31 }, { 709000000, 0x31 },
{ 714000000, 0x32 }, { 714000000, 0x32 },
{ 724000000, 0x33 }, { 724000000, 0x33 },
{ 729000000, 0x36 }, { 729000000, 0x36 },
{ 739000000, 0x38 }, { 739000000, 0x38 },
{ 744000000, 0x39 }, { 744000000, 0x39 },
{ 749000000, 0x3B }, { 749000000, 0x3B },
{ 754000000, 0x3C }, { 754000000, 0x3C },
{ 759000000, 0x3D }, { 759000000, 0x3D },
{ 764000000, 0x3E }, { 764000000, 0x3E },
{ 769000000, 0x3F }, { 769000000, 0x3F },
{ 774000000, 0x40 }, { 774000000, 0x40 },
{ 779000000, 0x41 }, { 779000000, 0x41 },
{ 784000000, 0x43 }, { 784000000, 0x43 },
{ 789000000, 0x46 }, { 789000000, 0x46 },
{ 794000000, 0x48 }, { 794000000, 0x48 },
{ 799000000, 0x4B }, { 799000000, 0x4B },
{ 804000000, 0x4F }, { 804000000, 0x4F },
{ 809000000, 0x54 }, { 809000000, 0x54 },
{ 814000000, 0x59 }, { 814000000, 0x59 },
{ 819000000, 0x5D }, { 819000000, 0x5D },
{ 824000000, 0x61 }, { 824000000, 0x61 },
{ 829000000, 0x68 }, { 829000000, 0x68 },
{ 834000000, 0x6E }, { 834000000, 0x6E },
{ 839000000, 0x75 }, { 839000000, 0x75 },
{ 844000000, 0x7E }, { 844000000, 0x7E },
{ 849000000, 0x82 }, { 849000000, 0x82 },
{ 854000000, 0x84 }, { 854000000, 0x84 },
{ 859000000, 0x8F }, { 859000000, 0x8F },
{ 865000000, 0x9A }, { 865000000, 0x9A },
{ 0, 0x00 }, // Table End { 0, 0x00 }, /* Table End */
}; };
static struct SMap m_IR_Meas_Map[] = { static struct SMap m_IR_Meas_Map[] = {
{ 200000000, 0x05 }, { 200000000, 0x05 },
{ 400000000, 0x06 }, { 400000000, 0x06 },
{ 865000000, 0x07 }, { 865000000, 0x07 },
{ 0, 0x00 }, // Table End { 0, 0x00 }, /* Table End */
}; };
static struct SMap2 m_CID_Target_Map[] = { static struct SMap2 m_CID_Target_Map[] = {
{ 46000000, 0x04, 18 }, { 46000000, 0x04, 18 },
{ 52200000, 0x0A, 15 }, { 52200000, 0x0A, 15 },
{ 70100000, 0x01, 40 }, { 70100000, 0x01, 40 },
{ 136800000, 0x18, 40 }, { 136800000, 0x18, 40 },
{ 156700000, 0x18, 40 }, { 156700000, 0x18, 40 },
{ 186250000, 0x0A, 40 }, { 186250000, 0x0A, 40 },
{ 230000000, 0x0A, 40 }, { 230000000, 0x0A, 40 },
{ 345000000, 0x18, 40 }, { 345000000, 0x18, 40 },
{ 426000000, 0x0E, 40 }, { 426000000, 0x0E, 40 },
{ 489500000, 0x1E, 40 }, { 489500000, 0x1E, 40 },
{ 697500000, 0x32, 40 }, { 697500000, 0x32, 40 },
{ 842000000, 0x3A, 40 }, { 842000000, 0x3A, 40 },
{ 0, 0x00, 0 }, // Table End { 0, 0x00, 0 }, /* Table End */
}; };
static struct SRFBandMap m_RF_Band_Map[7] = { static struct SRFBandMap m_RF_Band_Map[7] = {
{ 47900000, 46000000, 0, 0}, { 47900000, 46000000, 0, 0},
{ 61100000, 52200000, 0, 0}, { 61100000, 52200000, 0, 0},
{ 152600000, 70100000, 136800000, 0}, { 152600000, 70100000, 136800000, 0},
{ 164700000, 156700000, 0, 0}, { 164700000, 156700000, 0, 0},
{ 203500000, 186250000, 0, 0}, { 203500000, 186250000, 0, 0},
{ 457800000, 230000000, 345000000, 426000000}, { 457800000, 230000000, 345000000, 426000000},
{ 865000000, 489500000, 697500000, 842000000}, { 865000000, 489500000, 697500000, 842000000},
}; };
u8 m_Thermometer_Map_1[16] = { u8 m_Thermometer_Map_1[16] = {
60,62,66,64, 74,72,68,70, 90,88,84,86, 76,78,82,80, 60, 62, 66, 64,
74, 72, 68, 70,
90, 88, 84, 86,
76, 78, 82, 80,
}; };
u8 m_Thermometer_Map_2[16] = { u8 m_Thermometer_Map_2[16] = {
92,94,98,96, 106,104,100,102, 122,120,116,118, 108,110,114,112, 92, 94, 98, 96,
106, 104, 100, 102,
122, 120, 116, 118,
108, 110, 114, 112,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment