phy.c (446279168e030fd0ed68e2bba336bef8bb3da352) | phy.c (86331c7e0cd819bf0c1d0dcf895e0c90b0aa9a6f) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2/* Copyright(c) 2018-2019 Realtek Corporation 3 */ 4 5#include <linux/bcd.h> 6 7#include "main.h" 8#include "reg.h" --- 802 unchanged lines hidden (view full) --- 811} 812 813static u8 rtw_phy_linear_2_db(u64 linear) 814{ 815 u8 i; 816 u8 j; 817 u32 dB; 818 | 1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2/* Copyright(c) 2018-2019 Realtek Corporation 3 */ 4 5#include <linux/bcd.h> 6 7#include "main.h" 8#include "reg.h" --- 802 unchanged lines hidden (view full) --- 811} 812 813static u8 rtw_phy_linear_2_db(u64 linear) 814{ 815 u8 i; 816 u8 j; 817 u32 dB; 818 |
819 if (linear >= db_invert_table[11][7]) 820 return 96; /* maximum 96 dB */ 821 | |
822 for (i = 0; i < 12; i++) { | 819 for (i = 0; i < 12; i++) { |
823 if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][7]) 824 break; 825 else if (i > 2 && linear <= db_invert_table[i][7]) 826 break; | 820 for (j = 0; j < 8; j++) { 821 if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][j]) 822 goto cnt; 823 else if (i > 2 && linear <= db_invert_table[i][j]) 824 goto cnt; 825 } |
827 } 828 | 826 } 827 |
829 for (j = 0; j < 8; j++) { 830 if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][j]) 831 break; 832 else if (i > 2 && linear <= db_invert_table[i][j]) 833 break; 834 } | 828 return 96; /* maximum 96 dB */ |
835 | 829 |
830cnt: |
|
836 if (j == 0 && i == 0) 837 goto end; 838 839 if (j == 0) { 840 if (i != 3) { 841 if (db_invert_table[i][0] - linear > 842 linear - db_invert_table[i - 1][7]) { 843 i = i - 1; --- 1705 unchanged lines hidden --- | 831 if (j == 0 && i == 0) 832 goto end; 833 834 if (j == 0) { 835 if (i != 3) { 836 if (db_invert_table[i][0] - linear > 837 linear - db_invert_table[i - 1][7]) { 838 i = i - 1; --- 1705 unchanged lines hidden --- |