diff options
Diffstat (limited to 'drivers/net/wireless/rtl818x/rtl8180/dev.c')
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8180/dev.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index 026d912f516b..ded967aa6ecb 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c | |||
@@ -189,6 +189,9 @@ static const int rtl8187se_queues_map[RTL8187SE_NR_TX_QUEUES] = {5, 4, 3, 2, 7}; | |||
189 | 189 | ||
190 | static const int rtl8180_queues_map[RTL8180_NR_TX_QUEUES] = {4, 7}; | 190 | static const int rtl8180_queues_map[RTL8180_NR_TX_QUEUES] = {4, 7}; |
191 | 191 | ||
192 | /* LNA gain table for rtl8187se */ | ||
193 | static const u8 rtl8187se_lna_gain[4] = {02, 17, 29, 39}; | ||
194 | |||
192 | void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data) | 195 | void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data) |
193 | { | 196 | { |
194 | struct rtl8180_priv *priv = dev->priv; | 197 | struct rtl8180_priv *priv = dev->priv; |
@@ -210,13 +213,14 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
210 | struct rtl8180_priv *priv = dev->priv; | 213 | struct rtl8180_priv *priv = dev->priv; |
211 | struct rtl818x_rx_cmd_desc *cmd_desc; | 214 | struct rtl818x_rx_cmd_desc *cmd_desc; |
212 | unsigned int count = 32; | 215 | unsigned int count = 32; |
213 | u8 agc, sq, signal = 1; | 216 | u8 agc, sq; |
217 | s8 signal = 1; | ||
214 | dma_addr_t mapping; | 218 | dma_addr_t mapping; |
215 | 219 | ||
216 | while (count--) { | 220 | while (count--) { |
217 | void *entry = priv->rx_ring + priv->rx_idx * priv->rx_ring_sz; | 221 | void *entry = priv->rx_ring + priv->rx_idx * priv->rx_ring_sz; |
218 | struct sk_buff *skb = priv->rx_buf[priv->rx_idx]; | 222 | struct sk_buff *skb = priv->rx_buf[priv->rx_idx]; |
219 | u32 flags, flags2; | 223 | u32 flags, flags2, flags3 = 0; |
220 | u64 tsft; | 224 | u64 tsft; |
221 | 225 | ||
222 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8187SE) { | 226 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8187SE) { |
@@ -229,6 +233,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
229 | * the ownership flag | 233 | * the ownership flag |
230 | */ | 234 | */ |
231 | rmb(); | 235 | rmb(); |
236 | flags3 = le32_to_cpu(desc->flags3); | ||
232 | flags2 = le32_to_cpu(desc->flags2); | 237 | flags2 = le32_to_cpu(desc->flags2); |
233 | tsft = le64_to_cpu(desc->tsft); | 238 | tsft = le64_to_cpu(desc->tsft); |
234 | } else { | 239 | } else { |
@@ -287,8 +292,21 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
287 | signal = priv->rf->calc_rssi(agc, sq); | 292 | signal = priv->rf->calc_rssi(agc, sq); |
288 | break; | 293 | break; |
289 | case RTL818X_CHIP_FAMILY_RTL8187SE: | 294 | case RTL818X_CHIP_FAMILY_RTL8187SE: |
290 | /* TODO: rtl8187se rssi */ | 295 | /* OFDM measure reported by HW is signed, |
291 | signal = 10; | 296 | * in 0.5dBm unit, with zero centered @ -41dBm |
297 | * input signal. | ||
298 | */ | ||
299 | if (rx_status.rate_idx > 3) { | ||
300 | signal = (s8)((flags3 >> 16) & 0xff); | ||
301 | signal = signal / 2 - 41; | ||
302 | } else { | ||
303 | int idx, bb; | ||
304 | |||
305 | idx = (agc & 0x60) >> 5; | ||
306 | bb = (agc & 0x1F) * 2; | ||
307 | /* bias + BB gain + LNA gain */ | ||
308 | signal = 4 - bb - rtl8187se_lna_gain[idx]; | ||
309 | } | ||
292 | break; | 310 | break; |
293 | } | 311 | } |
294 | rx_status.signal = signal; | 312 | rx_status.signal = signal; |
@@ -1835,7 +1853,7 @@ static int rtl8180_probe(struct pci_dev *pdev, | |||
1835 | pci_try_set_mwi(pdev); | 1853 | pci_try_set_mwi(pdev); |
1836 | } | 1854 | } |
1837 | 1855 | ||
1838 | if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8185) | 1856 | if (priv->chip_family != RTL818X_CHIP_FAMILY_RTL8180) |
1839 | dev->flags |= IEEE80211_HW_SIGNAL_DBM; | 1857 | dev->flags |= IEEE80211_HW_SIGNAL_DBM; |
1840 | else | 1858 | else |
1841 | dev->flags |= IEEE80211_HW_SIGNAL_UNSPEC; | 1859 | dev->flags |= IEEE80211_HW_SIGNAL_UNSPEC; |