diff options
Diffstat (limited to 'drivers/net/wireless/rtl818x/rtl8180_dev.c')
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8180_dev.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index 31808f96a3d6..1d8178563d76 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
@@ -103,7 +103,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
103 | { | 103 | { |
104 | struct rtl8180_priv *priv = dev->priv; | 104 | struct rtl8180_priv *priv = dev->priv; |
105 | unsigned int count = 32; | 105 | unsigned int count = 32; |
106 | u8 signal; | 106 | u8 signal, agc, sq; |
107 | 107 | ||
108 | while (count--) { | 108 | while (count--) { |
109 | struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx]; | 109 | struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx]; |
@@ -132,12 +132,16 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
132 | 132 | ||
133 | rx_status.antenna = (flags2 >> 15) & 1; | 133 | rx_status.antenna = (flags2 >> 15) & 1; |
134 | rx_status.rate_idx = (flags >> 20) & 0xF; | 134 | rx_status.rate_idx = (flags >> 20) & 0xF; |
135 | /* TODO: improve signal/rssi reporting for !rtl8185 */ | 135 | agc = (flags2 >> 17) & 0x7F; |
136 | signal = (flags2 >> 17) & 0x7F; | 136 | if (priv->r8185) { |
137 | if (rx_status.rate_idx > 3) | 137 | if (rx_status.rate_idx > 3) |
138 | signal = 90 - clamp_t(u8, signal, 25, 90); | 138 | signal = 90 - clamp_t(u8, agc, 25, 90); |
139 | else | 139 | else |
140 | signal = 95 - clamp_t(u8, signal, 30, 95); | 140 | signal = 95 - clamp_t(u8, agc, 30, 95); |
141 | } else { | ||
142 | sq = flags2 & 0xff; | ||
143 | signal = priv->rf->calc_rssi(agc, sq); | ||
144 | } | ||
141 | rx_status.signal = signal; | 145 | rx_status.signal = signal; |
142 | rx_status.freq = dev->conf.channel->center_freq; | 146 | rx_status.freq = dev->conf.channel->center_freq; |
143 | rx_status.band = dev->conf.channel->band; | 147 | rx_status.band = dev->conf.channel->band; |
@@ -357,7 +361,7 @@ static int rtl8180_init_hw(struct ieee80211_hw *dev) | |||
357 | 361 | ||
358 | /* check success of reset */ | 362 | /* check success of reset */ |
359 | if (rtl818x_ioread8(priv, &priv->map->CMD) & RTL818X_CMD_RESET) { | 363 | if (rtl818x_ioread8(priv, &priv->map->CMD) & RTL818X_CMD_RESET) { |
360 | printk(KERN_ERR "%s: reset timeout!\n", wiphy_name(dev->wiphy)); | 364 | wiphy_err(dev->wiphy, "reset timeout!\n"); |
361 | return -ETIMEDOUT; | 365 | return -ETIMEDOUT; |
362 | } | 366 | } |
363 | 367 | ||
@@ -441,8 +445,7 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev) | |||
441 | &priv->rx_ring_dma); | 445 | &priv->rx_ring_dma); |
442 | 446 | ||
443 | if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) { | 447 | if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) { |
444 | printk(KERN_ERR "%s: Cannot allocate RX ring\n", | 448 | wiphy_err(dev->wiphy, "cannot allocate rx ring\n"); |
445 | wiphy_name(dev->wiphy)); | ||
446 | return -ENOMEM; | 449 | return -ENOMEM; |
447 | } | 450 | } |
448 | 451 | ||
@@ -499,8 +502,8 @@ static int rtl8180_init_tx_ring(struct ieee80211_hw *dev, | |||
499 | 502 | ||
500 | ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); | 503 | ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); |
501 | if (!ring || (unsigned long)ring & 0xFF) { | 504 | if (!ring || (unsigned long)ring & 0xFF) { |
502 | printk(KERN_ERR "%s: Cannot allocate TX ring (prio = %d)\n", | 505 | wiphy_err(dev->wiphy, "cannot allocate tx ring (prio = %d)\n", |
503 | wiphy_name(dev->wiphy), prio); | 506 | prio); |
504 | return -ENOMEM; | 507 | return -ENOMEM; |
505 | } | 508 | } |
506 | 509 | ||
@@ -565,8 +568,7 @@ static int rtl8180_start(struct ieee80211_hw *dev) | |||
565 | ret = request_irq(priv->pdev->irq, rtl8180_interrupt, | 568 | ret = request_irq(priv->pdev->irq, rtl8180_interrupt, |
566 | IRQF_SHARED, KBUILD_MODNAME, dev); | 569 | IRQF_SHARED, KBUILD_MODNAME, dev); |
567 | if (ret) { | 570 | if (ret) { |
568 | printk(KERN_ERR "%s: failed to register IRQ handler\n", | 571 | wiphy_err(dev->wiphy, "failed to register irq handler\n"); |
569 | wiphy_name(dev->wiphy)); | ||
570 | goto err_free_rings; | 572 | goto err_free_rings; |
571 | } | 573 | } |
572 | 574 | ||
@@ -1103,9 +1105,8 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev, | |||
1103 | goto err_iounmap; | 1105 | goto err_iounmap; |
1104 | } | 1106 | } |
1105 | 1107 | ||
1106 | printk(KERN_INFO "%s: hwaddr %pM, %s + %s\n", | 1108 | wiphy_info(dev->wiphy, "hwaddr %pm, %s + %s\n", |
1107 | wiphy_name(dev->wiphy), mac_addr, | 1109 | mac_addr, chip_name, priv->rf->name); |
1108 | chip_name, priv->rf->name); | ||
1109 | 1110 | ||
1110 | return 0; | 1111 | return 0; |
1111 | 1112 | ||