Commit 9b89b049 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

staging: vt6656: baseband.c clean up BBbVT3184Init

White space clean up and remove camel case from variables.

pDevice-> priv
ntStatus -> status
wLength ->length
pbyAddr -> addr
pbyAgc -> agc
wLengthAgc ->length_agc
abyArray -> array
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9f8144c6
...@@ -931,191 +931,177 @@ void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode) ...@@ -931,191 +931,177 @@ void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode)
* *
*/ */
int BBbVT3184Init(struct vnt_private *pDevice) int BBbVT3184Init(struct vnt_private *priv)
{ {
int ntStatus; int status;
u16 wLength; u16 lenght;
u8 * pbyAddr; u8 *addr;
u8 * pbyAgc; u8 *agc;
u16 wLengthAgc; u16 lenght_agc;
u8 abyArray[256]; u8 array[256];
u8 data; u8 data;
ntStatus = CONTROLnsRequestIn(pDevice, status = CONTROLnsRequestIn(priv, MESSAGE_TYPE_READ, 0,
MESSAGE_TYPE_READ, MESSAGE_REQUEST_EEPROM, EEP_MAX_CONTEXT_SIZE,
0, priv->abyEEPROM);
MESSAGE_REQUEST_EEPROM, if (status != STATUS_SUCCESS)
EEP_MAX_CONTEXT_SIZE,
pDevice->abyEEPROM);
if (ntStatus != STATUS_SUCCESS) {
return false; return false;
}
// if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04) /* zonetype initial */
// return false; priv->byOriginalZonetype = priv->abyEEPROM[EEP_OFS_ZONETYPE];
//zonetype initial if (priv->config_file.ZoneType >= 0) {
pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; if ((priv->config_file.ZoneType == 0) &&
if(pDevice->config_file.ZoneType >= 0) { //read zonetype file ok! (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x00)) {
if ((pDevice->config_file.ZoneType == 0)&& priv->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
(pDevice->abyEEPROM[EEP_OFS_ZONETYPE] !=0x00)){ //for USA priv->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B; "Init Zone Type :USA\n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :USA\n"); } else if ((priv->config_file.ZoneType == 1) &&
} (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) {
else if((pDevice->config_file.ZoneType == 1)&& priv->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
(pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x01)){ //for Japan priv->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; "Init Zone Type :Japan\n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Japan\n"); } else if ((priv->config_file.ZoneType == 2) &&
} (priv->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) {
else if((pDevice->config_file.ZoneType == 2)&& priv->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
(pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x02)){ //for Europe priv->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; "Init Zone Type :Europe\n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Europe\n"); } else {
} if (priv->config_file.ZoneType !=
else { priv->abyEEPROM[EEP_OFS_ZONETYPE])
if(pDevice->config_file.ZoneType !=pDevice->abyEEPROM[EEP_OFS_ZONETYPE]) printk("zonetype in file[%02x]\
printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",pDevice->config_file.ZoneType,pDevice->abyEEPROM[EEP_OFS_ZONETYPE]); mismatch with in EEPROM[%02x]\n",
priv->config_file.ZoneType,
priv->abyEEPROM[EEP_OFS_ZONETYPE]);
else else
printk("Read Zonetype file success,use default zonetype setting[%02x]\n",pDevice->config_file.ZoneType); printk("Read Zonetype file success,\
} use default zonetype setting[%02x]\n",
} priv->config_file.ZoneType);
}
if ( !pDevice->bZoneRegExist ) { }
pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
} if (!priv->bZoneRegExist)
pDevice->byRFType = pDevice->abyEEPROM[EEP_OFS_RFTYPE]; priv->byZoneType = priv->abyEEPROM[EEP_OFS_ZONETYPE];
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Zone Type %x\n", pDevice->byZoneType); priv->byRFType = priv->abyEEPROM[EEP_OFS_RFTYPE];
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RF Type %d\n", pDevice->byRFType);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Zone Type %x\n",
if ((pDevice->byRFType == RF_AL2230) || (pDevice->byRFType == RF_AL2230S)) { priv->byZoneType);
pDevice->byBBRxConf = abyVT3184_AL2230[10];
wLength = sizeof(abyVT3184_AL2230); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RF Type %d\n", priv->byRFType);
pbyAddr = abyVT3184_AL2230;
pbyAgc = abyVT3184_AGC; if ((priv->byRFType == RF_AL2230) ||
wLengthAgc = sizeof(abyVT3184_AGC); (priv->byRFType == RF_AL2230S)) {
priv->byBBRxConf = abyVT3184_AL2230[10];
pDevice->abyBBVGA[0] = 0x1C; lenght = sizeof(abyVT3184_AL2230);
pDevice->abyBBVGA[1] = 0x10; addr = abyVT3184_AL2230;
pDevice->abyBBVGA[2] = 0x0; agc = abyVT3184_AGC;
pDevice->abyBBVGA[3] = 0x0; lenght_agc = sizeof(abyVT3184_AGC);
pDevice->ldBmThreshold[0] = -70;
pDevice->ldBmThreshold[1] = -48; priv->abyBBVGA[0] = 0x1C;
pDevice->ldBmThreshold[2] = 0; priv->abyBBVGA[1] = 0x10;
pDevice->ldBmThreshold[3] = 0; priv->abyBBVGA[2] = 0x0;
} priv->abyBBVGA[3] = 0x0;
else if (pDevice->byRFType == RF_AIROHA7230) { priv->ldBmThreshold[0] = -70;
pDevice->byBBRxConf = abyVT3184_AL2230[10]; priv->ldBmThreshold[1] = -48;
wLength = sizeof(abyVT3184_AL2230); priv->ldBmThreshold[2] = 0;
pbyAddr = abyVT3184_AL2230; priv->ldBmThreshold[3] = 0;
pbyAgc = abyVT3184_AGC; } else if (priv->byRFType == RF_AIROHA7230) {
wLengthAgc = sizeof(abyVT3184_AGC); priv->byBBRxConf = abyVT3184_AL2230[10];
lenght = sizeof(abyVT3184_AL2230);
// Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) addr = abyVT3184_AL2230;
//pbyAddr[0x09] = 0x41; agc = abyVT3184_AGC;
// Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) lenght_agc = sizeof(abyVT3184_AGC);
//pbyAddr[0x0a] = 0x28;
// Select VC1/VC2, CR215 = 0x02->0x06 addr[0xd7] = 0x06;
pbyAddr[0xd7] = 0x06;
priv->abyBBVGA[0] = 0x1c;
pDevice->abyBBVGA[0] = 0x1C; priv->abyBBVGA[1] = 0x10;
pDevice->abyBBVGA[1] = 0x10; priv->abyBBVGA[2] = 0x0;
pDevice->abyBBVGA[2] = 0x0; priv->abyBBVGA[3] = 0x0;
pDevice->abyBBVGA[3] = 0x0; priv->ldBmThreshold[0] = -70;
pDevice->ldBmThreshold[0] = -70; priv->ldBmThreshold[1] = -48;
pDevice->ldBmThreshold[1] = -48; priv->ldBmThreshold[2] = 0;
pDevice->ldBmThreshold[2] = 0; priv->ldBmThreshold[3] = 0;
pDevice->ldBmThreshold[3] = 0; } else if ((priv->byRFType == RF_VT3226) ||
} (priv->byRFType == RF_VT3226D0)) {
else if ( (pDevice->byRFType == RF_VT3226) || (pDevice->byRFType == RF_VT3226D0) ) { priv->byBBRxConf = abyVT3184_VT3226D0[10];
pDevice->byBBRxConf = abyVT3184_VT3226D0[10]; //RobertYu:20060515 lenght = sizeof(abyVT3184_VT3226D0);
wLength = sizeof(abyVT3184_VT3226D0); //RobertYu:20060515 addr = abyVT3184_VT3226D0;
pbyAddr = abyVT3184_VT3226D0; //RobertYu:20060515 agc = abyVT3184_AGC;
pbyAgc = abyVT3184_AGC; lenght_agc = sizeof(abyVT3184_AGC);
wLengthAgc = sizeof(abyVT3184_AGC);
priv->abyBBVGA[0] = 0x20;
pDevice->abyBBVGA[0] = 0x20; //RobertYu:20060104, reguest by Jack priv->abyBBVGA[1] = 0x10;
pDevice->abyBBVGA[1] = 0x10; priv->abyBBVGA[2] = 0x0;
pDevice->abyBBVGA[2] = 0x0; priv->abyBBVGA[3] = 0x0;
pDevice->abyBBVGA[3] = 0x0; priv->ldBmThreshold[0] = -70;
pDevice->ldBmThreshold[0] = -70; priv->ldBmThreshold[1] = -48;
pDevice->ldBmThreshold[1] = -48; priv->ldBmThreshold[2] = 0;
pDevice->ldBmThreshold[2] = 0; priv->ldBmThreshold[3] = 0;
pDevice->ldBmThreshold[3] = 0; /* Fix VT3226 DFC system timing issue */
// Fix VT3226 DFC system timing issue MACvRegBitsOn(priv, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT); } else if ((priv->byRFType == RF_VT3342A0)) {
//}} priv->byBBRxConf = abyVT3184_VT3226D0[10];
//{{RobertYu:20060609 lenght = sizeof(abyVT3184_VT3226D0);
} else if ( (pDevice->byRFType == RF_VT3342A0) ) { addr = abyVT3184_VT3226D0;
pDevice->byBBRxConf = abyVT3184_VT3226D0[10]; agc = abyVT3184_AGC;
wLength = sizeof(abyVT3184_VT3226D0); lenght_agc = sizeof(abyVT3184_AGC);
pbyAddr = abyVT3184_VT3226D0;
pbyAgc = abyVT3184_AGC; priv->abyBBVGA[0] = 0x20;
wLengthAgc = sizeof(abyVT3184_AGC); priv->abyBBVGA[1] = 0x10;
priv->abyBBVGA[2] = 0x0;
pDevice->abyBBVGA[0] = 0x20; priv->abyBBVGA[3] = 0x0;
pDevice->abyBBVGA[1] = 0x10; priv->ldBmThreshold[0] = -70;
pDevice->abyBBVGA[2] = 0x0; priv->ldBmThreshold[1] = -48;
pDevice->abyBBVGA[3] = 0x0; priv->ldBmThreshold[2] = 0;
pDevice->ldBmThreshold[0] = -70; priv->ldBmThreshold[3] = 0;
pDevice->ldBmThreshold[1] = -48; /* Fix VT3226 DFC system timing issue */
pDevice->ldBmThreshold[2] = 0; MACvRegBitsOn(priv, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
pDevice->ldBmThreshold[3] = 0;
// Fix VT3226 DFC system timing issue
MACvRegBitsOn(pDevice, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT);
//}}
} else { } else {
return true; return true;
} }
memcpy(abyArray, pbyAddr, wLength); memcpy(array, addr, lenght);
CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_WRITE,
0,
MESSAGE_REQUEST_BBREG,
wLength,
abyArray
);
memcpy(abyArray, pbyAgc, wLengthAgc); CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, 0,
CONTROLnsRequestOut(pDevice, MESSAGE_REQUEST_BBREG, lenght, array);
MESSAGE_TYPE_WRITE,
0,
MESSAGE_REQUEST_BBAGC,
wLengthAgc,
abyArray
);
if ((pDevice->byRFType == RF_VT3226) || //RobertYu:20051116, 20060111 remove VT3226D0 memcpy(array, agc, lenght_agc);
(pDevice->byRFType == RF_VT3342A0) //RobertYu:20060609
) { CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, 0,
ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x23); MESSAGE_REQUEST_BBAGC, lenght_agc, array);
MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
} if ((priv->byRFType == RF_VT3226) ||
else if (pDevice->byRFType == RF_VT3226D0) (priv->byRFType == RF_VT3342A0)) {
{ ControlvWriteByte(priv, MESSAGE_REQUEST_MACREG,
ControlvWriteByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_ITRTMSET,0x11); MAC_REG_ITRTMSET, 0x23);
MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01); MACvRegBitsOn(priv, MAC_REG_PAPEDELAY, 0x01);
} else if (priv->byRFType == RF_VT3226D0) {
ControlvWriteByte(priv, MESSAGE_REQUEST_MACREG,
MAC_REG_ITRTMSET, 0x11);
MACvRegBitsOn(priv, MAC_REG_PAPEDELAY, 0x01);
} }
ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x04,0x7F); ControlvWriteByte(priv, MESSAGE_REQUEST_BBREG, 0x04, 0x7f);
ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01); ControlvWriteByte(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0x01);
RFbRFTableDownload(priv);
RFbRFTableDownload(pDevice);
/* Fix for TX USB resets from vendors driver */ /* Fix for TX USB resets from vendors driver */
CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, USB_REG4, CONTROLnsRequestIn(priv, MESSAGE_TYPE_READ, USB_REG4,
MESSAGE_REQUEST_MEM, sizeof(data), &data); MESSAGE_REQUEST_MEM, sizeof(data), &data);
data |= 0x2; data |= 0x2;
CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, USB_REG4, CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, USB_REG4,
MESSAGE_REQUEST_MEM, sizeof(data), &data); MESSAGE_REQUEST_MEM, sizeof(data), &data);
return true;//ntStatus; return true;
} }
/* /*
......
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