Lines Matching full:state

101 static int PowerScan(struct tda_state *state,
124 static int WriteRegs(struct tda_state *state, in WriteRegs() argument
138 return i2c_write(state->i2c, state->adr, data, nRegs + 1); in WriteRegs()
141 static int WriteReg(struct tda_state *state, u8 SubAddr, u8 Reg) in WriteReg() argument
145 return i2c_write(state->i2c, state->adr, msg, 2); in WriteReg()
148 static int Read(struct tda_state *state, u8 * Regs) in Read() argument
150 return i2c_readn(state->i2c, state->adr, Regs, 16); in Read()
153 static int ReadExtented(struct tda_state *state, u8 * Regs) in ReadExtented() argument
155 return i2c_readn(state->i2c, state->adr, Regs, NUM_REGS); in ReadExtented()
158 static int UpdateRegs(struct tda_state *state, u8 RegFrom, u8 RegTo) in UpdateRegs() argument
160 return WriteRegs(state, RegFrom, in UpdateRegs()
161 &state->m_Regs[RegFrom], RegTo-RegFrom+1); in UpdateRegs()
163 static int UpdateReg(struct tda_state *state, u8 Reg) in UpdateReg() argument
165 return WriteReg(state, Reg, state->m_Regs[Reg]); in UpdateReg()
170 static void reset(struct tda_state *state) in reset() argument
182 state->m_Frequency = 0; in reset()
183 state->m_SettlingTime = 100; in reset()
184 state->m_IFLevelAnalog = (ulIFLevelAnalog & 0x07) << 2; in reset()
185 state->m_IFLevelDigital = (ulIFLevelDigital & 0x07) << 2; in reset()
186 state->m_IFLevelDVBC = (ulIFLevelDVBC & 0x07) << 2; in reset()
187 state->m_IFLevelDVBT = (ulIFLevelDVBT & 0x07) << 2; in reset()
189 state->m_EP4 = 0x20; in reset()
191 state->m_EP4 |= 0x40; in reset()
193 state->m_EP3_Standby = ((ulStandbyMode & 0x07) << 5) | 0x0F; in reset()
194 state->m_bMaster = (ulSlave == 0); in reset()
196 state->m_SettlingTime = ulSettlingTime; in reset()
198 state->m_bFMInput = (ulFMInput == 2); in reset()
256 static int ThermometerRead(struct tda_state *state, u8 *pTM_Value) in ThermometerRead() argument
262 state->m_Regs[TM] |= 0x10; in ThermometerRead()
263 status = UpdateReg(state, TM); in ThermometerRead()
266 status = Read(state, Regs); in ThermometerRead()
271 state->m_Regs[TM] ^= 0x20; in ThermometerRead()
272 status = UpdateReg(state, TM); in ThermometerRead()
276 status = Read(state, Regs); in ThermometerRead()
283 state->m_Regs[TM] &= ~0x10; /* Thermometer off */ in ThermometerRead()
284 status = UpdateReg(state, TM); in ThermometerRead()
287 state->m_Regs[EP4] &= ~0x03; /* CAL_mode = 0 ????????? */ in ThermometerRead()
288 status = UpdateReg(state, EP4); in ThermometerRead()
296 static int StandBy(struct tda_state *state) in StandBy() argument
300 state->m_Regs[EB12] &= ~0x20; /* PD_AGC1_Det = 0 */ in StandBy()
301 status = UpdateReg(state, EB12); in StandBy()
304 state->m_Regs[EB18] &= ~0x83; /* AGC1_loop_off = 0, AGC1_Gain = 6 dB */ in StandBy()
305 status = UpdateReg(state, EB18); in StandBy()
308 state->m_Regs[EB21] |= 0x03; /* AGC2_Gain = -6 dB */ in StandBy()
309 state->m_Regs[EP3] = state->m_EP3_Standby; in StandBy()
310 status = UpdateReg(state, EP3); in StandBy()
313 state->m_Regs[EB23] &= ~0x06; /* ForceLP_Fc2_En = 0, LP_Fc[2] = 0 */ in StandBy()
314 status = UpdateRegs(state, EB21, EB23); in StandBy()
321 static int CalcMainPLL(struct tda_state *state, u32 freq) in CalcMainPLL() argument
337 state->m_Regs[MPD] = PostDiv & 0x77; in CalcMainPLL()
338 state->m_Regs[MD1] = ((MainDiv >> 16) & 0x7F); in CalcMainPLL()
339 state->m_Regs[MD2] = ((MainDiv >> 8) & 0xFF); in CalcMainPLL()
340 state->m_Regs[MD3] = (MainDiv & 0xFF); in CalcMainPLL()
342 return UpdateRegs(state, MPD, MD3); in CalcMainPLL()
345 static int CalcCalPLL(struct tda_state *state, u32 freq) in CalcCalPLL() argument
361 state->m_Regs[CPD] = PostDiv; in CalcCalPLL()
362 state->m_Regs[CD1] = ((CalDiv >> 16) & 0xFF); in CalcCalPLL()
363 state->m_Regs[CD2] = ((CalDiv >> 8) & 0xFF); in CalcCalPLL()
364 state->m_Regs[CD3] = (CalDiv & 0xFF); in CalcCalPLL()
366 return UpdateRegs(state, CPD, CD3); in CalcCalPLL()
369 static int CalibrateRF(struct tda_state *state, in CalibrateRF() argument
380 state->m_Regs[EP4] &= ~0x03; /* CAL_mode = 0 */ in CalibrateRF()
381 status = UpdateReg(state, EP4); in CalibrateRF()
384 state->m_Regs[EB18] |= 0x03; /* AGC1_Gain = 3 */ in CalibrateRF()
385 status = UpdateReg(state, EB18); in CalibrateRF()
391 if (state->m_Regs[ID] != 0x83) /* C1: ID == 83, C2: ID == 84 */ in CalibrateRF()
392 state->m_Regs[EP3] |= 0x40; /* SM_LT = 1 */ in CalibrateRF()
399 state->m_Regs[EP1] = (state->m_Regs[EP1] & ~0x07) | BP_Filter; in CalibrateRF()
400 state->m_Regs[EP2] = (RFBand << 5) | GainTaper; in CalibrateRF()
402 state->m_Regs[EB13] = (state->m_Regs[EB13] & ~0x7C) | (RFC_K << 4) | (RFC_M << 2); in CalibrateRF()
404 status = UpdateRegs(state, EP1, EP3); in CalibrateRF()
407 status = UpdateReg(state, EB13); in CalibrateRF()
411 state->m_Regs[EB4] |= 0x20; /* LO_ForceSrce = 1 */ in CalibrateRF()
412 status = UpdateReg(state, EB4); in CalibrateRF()
416 state->m_Regs[EB7] |= 0x20; /* CAL_ForceSrce = 1 */ in CalibrateRF()
417 status = UpdateReg(state, EB7); in CalibrateRF()
421 state->m_Regs[EB14] = 0; /* RFC_Cprog = 0 */ in CalibrateRF()
422 status = UpdateReg(state, EB14); in CalibrateRF()
426 state->m_Regs[EB20] &= ~0x20; /* ForceLock = 0; */ in CalibrateRF()
427 status = UpdateReg(state, EB20); in CalibrateRF()
431 state->m_Regs[EP4] |= 0x03; /* CAL_Mode = 3 */ in CalibrateRF()
432 status = UpdateRegs(state, EP4, EP5); in CalibrateRF()
436 status = CalcCalPLL(state, freq); in CalibrateRF()
439 status = CalcMainPLL(state, freq + 1000000); in CalibrateRF()
444 status = UpdateReg(state, EP2); in CalibrateRF()
447 status = UpdateReg(state, EP1); in CalibrateRF()
450 status = UpdateReg(state, EP2); in CalibrateRF()
453 status = UpdateReg(state, EP1); in CalibrateRF()
457 state->m_Regs[EB4] &= ~0x20; /* LO_ForceSrce = 0 */ in CalibrateRF()
458 status = UpdateReg(state, EB4); in CalibrateRF()
462 state->m_Regs[EB7] &= ~0x20; /* CAL_ForceSrce = 0 */ in CalibrateRF()
463 status = UpdateReg(state, EB7); in CalibrateRF()
468 state->m_Regs[EB20] |= 0x20; /* ForceLock = 1; */ in CalibrateRF()
469 status = UpdateReg(state, EB20); in CalibrateRF()
474 state->m_Regs[EP4] &= ~0x03; /* CAL_Mode = 0 */ in CalibrateRF()
475 state->m_Regs[EP3] &= ~0x40; /* SM_LT = 0 */ in CalibrateRF()
476 state->m_Regs[EB18] &= ~0x03; /* AGC1_Gain = 0 */ in CalibrateRF()
477 status = UpdateReg(state, EB18); in CalibrateRF()
480 status = UpdateRegs(state, EP3, EP4); in CalibrateRF()
483 status = UpdateReg(state, EP1); in CalibrateRF()
487 status = ReadExtented(state, Regs); in CalibrateRF()
497 static int RFTrackingFiltersInit(struct tda_state *state, in RFTrackingFiltersInit() argument
514 state->m_RF_A1[RFBand] = 0; in RFTrackingFiltersInit()
515 state->m_RF_B1[RFBand] = 0; in RFTrackingFiltersInit()
516 state->m_RF_A2[RFBand] = 0; in RFTrackingFiltersInit()
517 state->m_RF_B2[RFBand] = 0; in RFTrackingFiltersInit()
520 status = PowerScan(state, RFBand, RF1, &RF1, &bcal); in RFTrackingFiltersInit()
524 status = CalibrateRF(state, RFBand, RF1, &Cprog_cal1); in RFTrackingFiltersInit()
531 state->m_RF_B1[RFBand] = Cprog_cal1 - Cprog_table1; in RFTrackingFiltersInit()
532 /* state->m_RF_A1[RF_Band] = ???? */ in RFTrackingFiltersInit()
537 status = PowerScan(state, RFBand, RF2, &RF2, &bcal); in RFTrackingFiltersInit()
541 status = CalibrateRF(state, RFBand, RF2, &Cprog_cal2); in RFTrackingFiltersInit()
549 state->m_RF_A1[RFBand] = in RFTrackingFiltersInit()
556 status = PowerScan(state, RFBand, RF3, &RF3, &bcal); in RFTrackingFiltersInit()
560 status = CalibrateRF(state, RFBand, RF3, &Cprog_cal3); in RFTrackingFiltersInit()
567state->m_RF_A2[RFBand] = (Cprog_cal3 - Cprog_table3 - Cprog_cal2 + Cprog_table2) / ((s32)(RF3) - (… in RFTrackingFiltersInit()
568 state->m_RF_B2[RFBand] = Cprog_cal2 - Cprog_table2; in RFTrackingFiltersInit()
572 state->m_RF1[RFBand] = RF1; in RFTrackingFiltersInit()
573 state->m_RF2[RFBand] = RF2; in RFTrackingFiltersInit()
574 state->m_RF3[RFBand] = RF3; in RFTrackingFiltersInit()
578 RFBand, RF1, state->m_RF_A1[RFBand], state->m_RF_B1[RFBand], RF2, in RFTrackingFiltersInit()
579 state->m_RF_A2[RFBand], state->m_RF_B2[RFBand], RF3); in RFTrackingFiltersInit()
585 static int PowerScan(struct tda_state *state, in PowerScan() argument
609 state->m_Regs[EP2] = (RFBand << 5) | Gain_Taper; in PowerScan()
610 state->m_Regs[EB14] = (RFC_Cprog); in PowerScan()
611 status = UpdateReg(state, EP2); in PowerScan()
614 status = UpdateReg(state, EB14); in PowerScan()
619 status = CalcMainPLL(state, freq_MainPLL); in PowerScan()
623 state->m_Regs[EP4] = (state->m_Regs[EP4] & ~0x03) | 1; /* CAL_mode = 1 */ in PowerScan()
624 status = UpdateReg(state, EP4); in PowerScan()
627 status = UpdateReg(state, EP2); /* Launch power measurement */ in PowerScan()
630 status = ReadExtented(state, Regs); in PowerScan()
634 state->m_Regs[ID] = Regs[ID]; /* Chip version, (needed for C1 workaround in CalibrateRF) */ in PowerScan()
640 status = CalcMainPLL(state, freq_MainPLL); in PowerScan()
645 status = UpdateReg(state, EP2); /* Launch power measurement */ in PowerScan()
648 status = ReadExtented(state, Regs); in PowerScan()
675 static int PowerScanInit(struct tda_state *state) in PowerScanInit() argument
679 state->m_Regs[EP3] = (state->m_Regs[EP3] & ~0x1F) | 0x12; in PowerScanInit()
680 state->m_Regs[EP4] = (state->m_Regs[EP4] & ~0x1F); /* If level = 0, Cal mode = 0 */ in PowerScanInit()
681 status = UpdateRegs(state, EP3, EP4); in PowerScanInit()
684 state->m_Regs[EB18] = (state->m_Regs[EB18] & ~0x03); /* AGC 1 Gain = 0 */ in PowerScanInit()
685 status = UpdateReg(state, EB18); in PowerScanInit()
688 state->m_Regs[EB21] = (state->m_Regs[EB21] & ~0x03); /* AGC 2 Gain = 0 (Datasheet = 3) */ in PowerScanInit()
689 state->m_Regs[EB23] = (state->m_Regs[EB23] | 0x06); /* ForceLP_Fc2_En = 1, LPFc[2] = 1 */ in PowerScanInit()
690 status = UpdateRegs(state, EB21, EB23); in PowerScanInit()
697 static int CalcRFFilterCurve(struct tda_state *state) in CalcRFFilterCurve() argument
702 status = PowerScanInit(state); in CalcRFFilterCurve()
705 status = RFTrackingFiltersInit(state, 0); in CalcRFFilterCurve()
708 status = RFTrackingFiltersInit(state, 1); in CalcRFFilterCurve()
711 status = RFTrackingFiltersInit(state, 2); in CalcRFFilterCurve()
714 status = RFTrackingFiltersInit(state, 3); in CalcRFFilterCurve()
717 status = RFTrackingFiltersInit(state, 4); in CalcRFFilterCurve()
720 status = RFTrackingFiltersInit(state, 5); in CalcRFFilterCurve()
723 status = RFTrackingFiltersInit(state, 6); in CalcRFFilterCurve()
726 status = ThermometerRead(state, &state->m_TMValue_RFCal); /* also switches off Cal mode !!! */ in CalcRFFilterCurve()
734 static int FixedContentsI2CUpdate(struct tda_state *state) in FixedContentsI2CUpdate() argument
749 memcpy(&state->m_Regs[TM], InitRegs, EB23 - TM + 1); in FixedContentsI2CUpdate()
751 status = UpdateRegs(state, TM, EB23); in FixedContentsI2CUpdate()
756 state->m_Regs[EB17] = 0x00; in FixedContentsI2CUpdate()
757 status = UpdateReg(state, EB17); in FixedContentsI2CUpdate()
760 state->m_Regs[EB17] = 0x03; in FixedContentsI2CUpdate()
761 status = UpdateReg(state, EB17); in FixedContentsI2CUpdate()
764 state->m_Regs[EB17] = 0x43; in FixedContentsI2CUpdate()
765 status = UpdateReg(state, EB17); in FixedContentsI2CUpdate()
768 state->m_Regs[EB17] = 0x4C; in FixedContentsI2CUpdate()
769 status = UpdateReg(state, EB17); in FixedContentsI2CUpdate()
774 state->m_Regs[EP3] = 0x1F; in FixedContentsI2CUpdate()
775 state->m_Regs[EP4] = 0x66; in FixedContentsI2CUpdate()
776 state->m_Regs[EP5] = 0x81; in FixedContentsI2CUpdate()
777 state->m_Regs[CPD] = 0xCC; in FixedContentsI2CUpdate()
778 state->m_Regs[CD1] = 0x6C; in FixedContentsI2CUpdate()
779 state->m_Regs[CD2] = 0x00; in FixedContentsI2CUpdate()
780 state->m_Regs[CD3] = 0x00; in FixedContentsI2CUpdate()
781 state->m_Regs[MPD] = 0xC5; in FixedContentsI2CUpdate()
782 state->m_Regs[MD1] = 0x77; in FixedContentsI2CUpdate()
783 state->m_Regs[MD2] = 0x08; in FixedContentsI2CUpdate()
784 state->m_Regs[MD3] = 0x00; in FixedContentsI2CUpdate()
785 status = UpdateRegs(state, EP2, MD3); /* diff between sw and datasheet (ep3-md3) */ in FixedContentsI2CUpdate()
790 state->m_Regs[EB4] = 0x61; /* missing in sw */ in FixedContentsI2CUpdate()
791 status = UpdateReg(state, EB4); in FixedContentsI2CUpdate()
795 state->m_Regs[EB4] = 0x41; in FixedContentsI2CUpdate()
796 status = UpdateReg(state, EB4); in FixedContentsI2CUpdate()
802 status = UpdateReg(state, EP1); in FixedContentsI2CUpdate()
807 state->m_Regs[EP5] = 0x85; in FixedContentsI2CUpdate()
808 state->m_Regs[CPD] = 0xCB; in FixedContentsI2CUpdate()
809 state->m_Regs[CD1] = 0x66; in FixedContentsI2CUpdate()
810 state->m_Regs[CD2] = 0x70; in FixedContentsI2CUpdate()
811 status = UpdateRegs(state, EP3, CD3); in FixedContentsI2CUpdate()
815 status = UpdateReg(state, EP2); in FixedContentsI2CUpdate()
821 state->m_Regs[EP5] = 0x82; in FixedContentsI2CUpdate()
822 state->m_Regs[CPD] = 0xA8; in FixedContentsI2CUpdate()
823 state->m_Regs[CD2] = 0x00; in FixedContentsI2CUpdate()
824 state->m_Regs[MPD] = 0xA1; /* Datasheet = 0xA9 */ in FixedContentsI2CUpdate()
825 state->m_Regs[MD1] = 0x73; in FixedContentsI2CUpdate()
826 state->m_Regs[MD2] = 0x1A; in FixedContentsI2CUpdate()
827 status = UpdateRegs(state, EP3, MD3); in FixedContentsI2CUpdate()
832 status = UpdateReg(state, EP1); in FixedContentsI2CUpdate()
837 state->m_Regs[EP5] = 0x86; in FixedContentsI2CUpdate()
838 state->m_Regs[CPD] = 0xA8; in FixedContentsI2CUpdate()
839 state->m_Regs[CD1] = 0x66; in FixedContentsI2CUpdate()
840 state->m_Regs[CD2] = 0xA0; in FixedContentsI2CUpdate()
841 status = UpdateRegs(state, EP3, CD3); in FixedContentsI2CUpdate()
845 status = UpdateReg(state, EP2); in FixedContentsI2CUpdate()
851 state->m_Regs[EP5] = 0x83; in FixedContentsI2CUpdate()
852 state->m_Regs[CPD] = 0x98; in FixedContentsI2CUpdate()
853 state->m_Regs[CD1] = 0x65; in FixedContentsI2CUpdate()
854 state->m_Regs[CD2] = 0x00; in FixedContentsI2CUpdate()
855 state->m_Regs[MPD] = 0x91; /* Datasheet = 0x91 */ in FixedContentsI2CUpdate()
856 state->m_Regs[MD1] = 0x71; in FixedContentsI2CUpdate()
857 state->m_Regs[MD2] = 0xCD; in FixedContentsI2CUpdate()
858 status = UpdateRegs(state, EP3, MD3); in FixedContentsI2CUpdate()
862 status = UpdateReg(state, EP1); in FixedContentsI2CUpdate()
866 state->m_Regs[EP5] = 0x87; in FixedContentsI2CUpdate()
867 state->m_Regs[CD1] = 0x65; in FixedContentsI2CUpdate()
868 state->m_Regs[CD2] = 0x50; in FixedContentsI2CUpdate()
869 status = UpdateRegs(state, EP3, CD3); in FixedContentsI2CUpdate()
873 status = UpdateReg(state, EP2); in FixedContentsI2CUpdate()
879 state->m_Regs[EP4] = 0x64; in FixedContentsI2CUpdate()
880 status = UpdateReg(state, EP4); in FixedContentsI2CUpdate()
883 status = UpdateReg(state, EP1); in FixedContentsI2CUpdate()
891 static int InitCal(struct tda_state *state) in InitCal() argument
896 status = FixedContentsI2CUpdate(state); in InitCal()
899 status = CalcRFFilterCurve(state); in InitCal()
902 status = StandBy(state); in InitCal()
910 static int RFTrackingFiltersCorrection(struct tda_state *state, in RFTrackingFiltersCorrection() argument
926 u32 RF1 = state->m_RF1[RFBand]; in RFTrackingFiltersCorrection()
927 u32 RF2 = state->m_RF1[RFBand]; in RFTrackingFiltersCorrection()
928 u32 RF3 = state->m_RF1[RFBand]; in RFTrackingFiltersCorrection()
929 s32 RF_A1 = state->m_RF_A1[RFBand]; in RFTrackingFiltersCorrection()
930 s32 RF_B1 = state->m_RF_B1[RFBand]; in RFTrackingFiltersCorrection()
931 s32 RF_A2 = state->m_RF_A2[RFBand]; in RFTrackingFiltersCorrection()
932 s32 RF_B2 = state->m_RF_B2[RFBand]; in RFTrackingFiltersCorrection()
936 state->m_Regs[EP3] &= ~0xE0; /* Power up */ in RFTrackingFiltersCorrection()
937 status = UpdateReg(state, EP3); in RFTrackingFiltersCorrection()
941 status = ThermometerRead(state, &TMValue_Current); in RFTrackingFiltersCorrection()
950 TComp = (int)(dCoverdT) * ((int)(TMValue_Current) - (int)(state->m_TMValue_RFCal))/1000; in RFTrackingFiltersCorrection()
962 state->m_Regs[EB14] = Capprox; in RFTrackingFiltersCorrection()
964 status = UpdateReg(state, EB14); in RFTrackingFiltersCorrection()
972 static int ChannelConfiguration(struct tda_state *state, in ChannelConfiguration() argument
984 state->IF = IntermediateFrequency; in ChannelConfiguration()
998 state->m_Regs[EP3] = (state->m_Regs[EP3] & ~0x1F) | m_StandardTable[Standard].m_EP3_4_0; in ChannelConfiguration()
999 state->m_Regs[EP3] &= ~0x04; /* switch RFAGC to high speed mode */ in ChannelConfiguration()
1002state->m_Regs[EP4] = state->m_EP4 | ((Standard > HF_AnalogMax) ? state->m_IFLevelDigital : state->… in ChannelConfiguration()
1003 /* state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDigital; */ in ChannelConfiguration()
1005 state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelAnalog; in ChannelConfiguration()
1007 state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDVBT; in ChannelConfiguration()
1009 state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDVBC; in ChannelConfiguration()
1011 state->m_Regs[EP4] = state->m_EP4 | state->m_IFLevelDigital; in ChannelConfiguration()
1013 if ((Standard == HF_FM_Radio) && state->m_bFMInput) in ChannelConfiguration()
1014 state->m_Regs[EP4] |= 0x80; in ChannelConfiguration()
1016 state->m_Regs[MPD] &= ~0x80; in ChannelConfiguration()
1018 state->m_Regs[MPD] |= 0x80; /* Add IF_notch for digital */ in ChannelConfiguration()
1020 state->m_Regs[EB22] = m_StandardTable[Standard].m_EB22; in ChannelConfiguration()
1024 state->m_Regs[EB23] |= 0x06; /* ForceLP_Fc2_En = 1, LPFc[2] = 1 */ in ChannelConfiguration()
1026 state->m_Regs[EB23] &= ~0x06; /* ForceLP_Fc2_En = 0, LPFc[2] = 0 */ in ChannelConfiguration()
1028 status = UpdateRegs(state, EB22, EB23); in ChannelConfiguration()
1032state->m_Regs[EP1] = (state->m_Regs[EP1] & ~0x07) | 0x40 | BP_Filter; /* Dis_Power_level = 1, Fi… in ChannelConfiguration()
1033 state->m_Regs[EP5] = (state->m_Regs[EP5] & ~0x07) | IR_Meas; in ChannelConfiguration()
1034 state->m_Regs[EP2] = (RF_Band << 5) | GainTaper; in ChannelConfiguration()
1036 state->m_Regs[EB1] = (state->m_Regs[EB1] & ~0x07) | in ChannelConfiguration()
1037 (state->m_bMaster ? 0x04 : 0x00); /* CALVCO_FortLOn = MS */ in ChannelConfiguration()
1040 status = UpdateReg(state, EB1); in ChannelConfiguration()
1044 if (state->m_bMaster) { in ChannelConfiguration()
1045 status = CalcMainPLL(state, Frequency + IntermediateFrequency); in ChannelConfiguration()
1048 status = UpdateRegs(state, TM, EP5); in ChannelConfiguration()
1051 state->m_Regs[EB4] |= 0x20; /* LO_forceSrce = 1 */ in ChannelConfiguration()
1052 status = UpdateReg(state, EB4); in ChannelConfiguration()
1056 state->m_Regs[EB4] &= ~0x20; /* LO_forceSrce = 0 */ in ChannelConfiguration()
1057 status = UpdateReg(state, EB4); in ChannelConfiguration()
1063 status = CalcCalPLL(state, Frequency + IntermediateFrequency); in ChannelConfiguration()
1068 state->m_Regs[MPD] = (state->m_Regs[MPD] & ~0x7F) | (PostDiv & 0x77); in ChannelConfiguration()
1069 status = UpdateReg(state, MPD); in ChannelConfiguration()
1072 status = UpdateRegs(state, TM, EP5); in ChannelConfiguration()
1076 state->m_Regs[EB7] |= 0x20; /* CAL_forceSrce = 1 */ in ChannelConfiguration()
1077 status = UpdateReg(state, EB7); in ChannelConfiguration()
1081 state->m_Regs[EB7] &= ~0x20; /* CAL_forceSrce = 0 */ in ChannelConfiguration()
1082 status = UpdateReg(state, EB7); in ChannelConfiguration()
1088 state->m_Regs[EP3] |= 0x04; /* RFAGC to normal mode */ in ChannelConfiguration()
1089 status = UpdateReg(state, EP3); in ChannelConfiguration()
1099 struct tda_state *state = fe->tuner_priv; in sleep() local
1101 StandBy(state); in sleep()
1119 struct tda_state *state = fe->tuner_priv; in set_params() local
1125 state->m_Frequency = fe->dtv_property_cache.frequency; in set_params()
1157 status = RFTrackingFiltersCorrection(state, state->m_Frequency); in set_params()
1160 status = ChannelConfiguration(state, state->m_Frequency, in set_params()
1165 msleep(state->m_SettlingTime); /* Allow AGC's to settle down */ in set_params()
1187 struct tda_state *state = fe->tuner_priv; in get_if_frequency() local
1189 *frequency = state->IF; in get_if_frequency()
1195 /* struct tda_state *state = fe->tuner_priv; */ in get_bandwidth()
1219 struct tda_state *state; in tda18271c2dd_attach() local
1221 state = kzalloc(sizeof(struct tda_state), GFP_KERNEL); in tda18271c2dd_attach()
1222 if (!state) in tda18271c2dd_attach()
1225 fe->tuner_priv = state; in tda18271c2dd_attach()
1226 state->adr = adr; in tda18271c2dd_attach()
1227 state->i2c = i2c; in tda18271c2dd_attach()
1229 reset(state); in tda18271c2dd_attach()
1230 InitCal(state); in tda18271c2dd_attach()