diff options
author | Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 2009-08-26 12:54:09 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-28 14:40:52 -0400 |
commit | ca9152e37f57259ca92486ca5753af16fd9155c6 (patch) | |
tree | 90b36f241e67ae2decf7043d78249591b09ad707 /drivers/net/wireless/rtl818x/rtl8187_dev.c | |
parent | 6a8171f261eec3577c2a5985e3a2b51377e48931 (diff) |
rtl8187: Implement rfkill support
This change implements rfkill support for RTL8187B and RTL8187L devices,
using new cfg80211 rfkill API.
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtl818x/rtl8187_dev.c')
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8187_dev.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c index 5573e3476802..9679b29e1c49 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #ifdef CONFIG_RTL8187_LEDS | 32 | #ifdef CONFIG_RTL8187_LEDS |
33 | #include "rtl8187_leds.h" | 33 | #include "rtl8187_leds.h" |
34 | #endif | 34 | #endif |
35 | #include "rtl8187_rfkill.h" | ||
35 | 36 | ||
36 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); | 37 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); |
37 | MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); | 38 | MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); |
@@ -648,10 +649,10 @@ static int rtl8187_init_hw(struct ieee80211_hw *dev) | |||
648 | 649 | ||
649 | /* setup card */ | 650 | /* setup card */ |
650 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0); | 651 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0); |
651 | rtl818x_iowrite8(priv, &priv->map->GPIO, 0); | 652 | rtl818x_iowrite8(priv, &priv->map->GPIO0, 0); |
652 | 653 | ||
653 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8)); | 654 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8)); |
654 | rtl818x_iowrite8(priv, &priv->map->GPIO, 1); | 655 | rtl818x_iowrite8(priv, &priv->map->GPIO0, 1); |
655 | rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0); | 656 | rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0); |
656 | 657 | ||
657 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); | 658 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); |
@@ -674,11 +675,11 @@ static int rtl8187_init_hw(struct ieee80211_hw *dev) | |||
674 | 675 | ||
675 | /* host_usb_init */ | 676 | /* host_usb_init */ |
676 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0); | 677 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0); |
677 | rtl818x_iowrite8(priv, &priv->map->GPIO, 0); | 678 | rtl818x_iowrite8(priv, &priv->map->GPIO0, 0); |
678 | reg = rtl818x_ioread8(priv, (u8 *)0xFE53); | 679 | reg = rtl818x_ioread8(priv, (u8 *)0xFE53); |
679 | rtl818x_iowrite8(priv, (u8 *)0xFE53, reg | (1 << 7)); | 680 | rtl818x_iowrite8(priv, (u8 *)0xFE53, reg | (1 << 7)); |
680 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8)); | 681 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8)); |
681 | rtl818x_iowrite8(priv, &priv->map->GPIO, 0x20); | 682 | rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x20); |
682 | rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0); | 683 | rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0); |
683 | rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x80); | 684 | rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x80); |
684 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x80); | 685 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x80); |
@@ -907,12 +908,12 @@ static int rtl8187_start(struct ieee80211_hw *dev) | |||
907 | u32 reg; | 908 | u32 reg; |
908 | int ret; | 909 | int ret; |
909 | 910 | ||
911 | mutex_lock(&priv->conf_mutex); | ||
912 | |||
910 | ret = (!priv->is_rtl8187b) ? rtl8187_init_hw(dev) : | 913 | ret = (!priv->is_rtl8187b) ? rtl8187_init_hw(dev) : |
911 | rtl8187b_init_hw(dev); | 914 | rtl8187b_init_hw(dev); |
912 | if (ret) | 915 | if (ret) |
913 | return ret; | 916 | goto rtl8187_start_exit; |
914 | |||
915 | mutex_lock(&priv->conf_mutex); | ||
916 | 917 | ||
917 | init_usb_anchor(&priv->anchored); | 918 | init_usb_anchor(&priv->anchored); |
918 | priv->dev = dev; | 919 | priv->dev = dev; |
@@ -939,8 +940,7 @@ static int rtl8187_start(struct ieee80211_hw *dev) | |||
939 | (7 << 21 /* MAX TX DMA */)); | 940 | (7 << 21 /* MAX TX DMA */)); |
940 | rtl8187_init_urbs(dev); | 941 | rtl8187_init_urbs(dev); |
941 | rtl8187b_init_status_urb(dev); | 942 | rtl8187b_init_status_urb(dev); |
942 | mutex_unlock(&priv->conf_mutex); | 943 | goto rtl8187_start_exit; |
943 | return 0; | ||
944 | } | 944 | } |
945 | 945 | ||
946 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); | 946 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); |
@@ -984,9 +984,10 @@ static int rtl8187_start(struct ieee80211_hw *dev) | |||
984 | reg |= RTL818X_CMD_RX_ENABLE; | 984 | reg |= RTL818X_CMD_RX_ENABLE; |
985 | rtl818x_iowrite8(priv, &priv->map->CMD, reg); | 985 | rtl818x_iowrite8(priv, &priv->map->CMD, reg); |
986 | INIT_DELAYED_WORK(&priv->work, rtl8187_work); | 986 | INIT_DELAYED_WORK(&priv->work, rtl8187_work); |
987 | mutex_unlock(&priv->conf_mutex); | ||
988 | 987 | ||
989 | return 0; | 988 | rtl8187_start_exit: |
989 | mutex_unlock(&priv->conf_mutex); | ||
990 | return ret; | ||
990 | } | 991 | } |
991 | 992 | ||
992 | static void rtl8187_stop(struct ieee80211_hw *dev) | 993 | static void rtl8187_stop(struct ieee80211_hw *dev) |
@@ -1277,7 +1278,8 @@ static const struct ieee80211_ops rtl8187_ops = { | |||
1277 | .bss_info_changed = rtl8187_bss_info_changed, | 1278 | .bss_info_changed = rtl8187_bss_info_changed, |
1278 | .prepare_multicast = rtl8187_prepare_multicast, | 1279 | .prepare_multicast = rtl8187_prepare_multicast, |
1279 | .configure_filter = rtl8187_configure_filter, | 1280 | .configure_filter = rtl8187_configure_filter, |
1280 | .conf_tx = rtl8187_conf_tx | 1281 | .conf_tx = rtl8187_conf_tx, |
1282 | .rfkill_poll = rtl8187_rfkill_poll | ||
1281 | }; | 1283 | }; |
1282 | 1284 | ||
1283 | static void rtl8187_eeprom_register_read(struct eeprom_93cx6 *eeprom) | 1285 | static void rtl8187_eeprom_register_read(struct eeprom_93cx6 *eeprom) |
@@ -1517,6 +1519,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, | |||
1517 | reg &= 0xFF; | 1519 | reg &= 0xFF; |
1518 | rtl8187_leds_init(dev, reg); | 1520 | rtl8187_leds_init(dev, reg); |
1519 | #endif | 1521 | #endif |
1522 | rtl8187_rfkill_init(dev); | ||
1520 | 1523 | ||
1521 | return 0; | 1524 | return 0; |
1522 | 1525 | ||
@@ -1540,6 +1543,7 @@ static void __devexit rtl8187_disconnect(struct usb_interface *intf) | |||
1540 | #ifdef CONFIG_RTL8187_LEDS | 1543 | #ifdef CONFIG_RTL8187_LEDS |
1541 | rtl8187_leds_exit(dev); | 1544 | rtl8187_leds_exit(dev); |
1542 | #endif | 1545 | #endif |
1546 | rtl8187_rfkill_exit(dev); | ||
1543 | ieee80211_unregister_hw(dev); | 1547 | ieee80211_unregister_hw(dev); |
1544 | 1548 | ||
1545 | priv = dev->priv; | 1549 | priv = dev->priv; |