Lines Matching refs:rtldm

674 	struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw));  in rtl92ee_dm_dynamic_atc_switch()  local
681 if (rtldm->atc_status == ATC_STATUS_OFF) { in rtl92ee_dm_dynamic_atc_switch()
684 rtldm->atc_status = ATC_STATUS_ON; in rtl92ee_dm_dynamic_atc_switch()
696 if (rtldm->crystal_cap != rtlpriv->efuse.crystalcap) { in rtl92ee_dm_dynamic_atc_switch()
697 rtldm->crystal_cap = rtlpriv->efuse.crystalcap; in rtl92ee_dm_dynamic_atc_switch()
698 crystal_cap = rtldm->crystal_cap & 0x3f; in rtl92ee_dm_dynamic_atc_switch()
703 cfo_khz_a = (int)(rtldm->cfo_tail[0] * 3125) / 1280; in rtl92ee_dm_dynamic_atc_switch()
704 cfo_khz_b = (int)(rtldm->cfo_tail[1] * 3125) / 1280; in rtl92ee_dm_dynamic_atc_switch()
705 packet_count = rtldm->packet_count; in rtl92ee_dm_dynamic_atc_switch()
707 if (packet_count == rtldm->packet_count_pre) in rtl92ee_dm_dynamic_atc_switch()
710 rtldm->packet_count_pre = packet_count; in rtl92ee_dm_dynamic_atc_switch()
717 cfo_ave_diff = (rtldm->cfo_ave_pre >= cfo_ave) ? in rtl92ee_dm_dynamic_atc_switch()
718 (rtldm->cfo_ave_pre - cfo_ave) : in rtl92ee_dm_dynamic_atc_switch()
719 (cfo_ave - rtldm->cfo_ave_pre); in rtl92ee_dm_dynamic_atc_switch()
721 if (cfo_ave_diff > 20 && !rtldm->large_cfo_hit) { in rtl92ee_dm_dynamic_atc_switch()
722 rtldm->large_cfo_hit = true; in rtl92ee_dm_dynamic_atc_switch()
725 rtldm->large_cfo_hit = false; in rtl92ee_dm_dynamic_atc_switch()
727 rtldm->cfo_ave_pre = cfo_ave; in rtl92ee_dm_dynamic_atc_switch()
729 if (cfo_ave >= -rtldm->cfo_threshold && in rtl92ee_dm_dynamic_atc_switch()
730 cfo_ave <= rtldm->cfo_threshold && rtldm->is_freeze == 0) { in rtl92ee_dm_dynamic_atc_switch()
731 if (rtldm->cfo_threshold == CFO_THRESHOLD_XTAL) { in rtl92ee_dm_dynamic_atc_switch()
732 rtldm->cfo_threshold = CFO_THRESHOLD_XTAL + 10; in rtl92ee_dm_dynamic_atc_switch()
733 rtldm->is_freeze = 1; in rtl92ee_dm_dynamic_atc_switch()
735 rtldm->cfo_threshold = CFO_THRESHOLD_XTAL; in rtl92ee_dm_dynamic_atc_switch()
739 if (cfo_ave > rtldm->cfo_threshold && rtldm->crystal_cap < 0x3f) in rtl92ee_dm_dynamic_atc_switch()
746 rtldm->is_freeze = 0; in rtl92ee_dm_dynamic_atc_switch()
747 rtldm->crystal_cap += adjust_xtal; in rtl92ee_dm_dynamic_atc_switch()
749 if (rtldm->crystal_cap > 0x3f) in rtl92ee_dm_dynamic_atc_switch()
750 rtldm->crystal_cap = 0x3f; in rtl92ee_dm_dynamic_atc_switch()
751 else if (rtldm->crystal_cap < 0) in rtl92ee_dm_dynamic_atc_switch()
752 rtldm->crystal_cap = 0; in rtl92ee_dm_dynamic_atc_switch()
754 crystal_cap = rtldm->crystal_cap & 0x3f; in rtl92ee_dm_dynamic_atc_switch()
761 if (rtldm->atc_status == ATC_STATUS_ON) { in rtl92ee_dm_dynamic_atc_switch()
764 rtldm->atc_status = ATC_STATUS_OFF; in rtl92ee_dm_dynamic_atc_switch()
767 if (rtldm->atc_status == ATC_STATUS_OFF) { in rtl92ee_dm_dynamic_atc_switch()
770 rtldm->atc_status = ATC_STATUS_ON; in rtl92ee_dm_dynamic_atc_switch()