diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_main.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 3daba6c0c77f..49779e588e30 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -1816,6 +1816,36 @@ static struct ieee80211_channel wl1271_channels[] = { | |||
1816 | { .hw_value = 13, .center_freq = 2472, .max_power = 25 }, | 1816 | { .hw_value = 13, .center_freq = 2472, .max_power = 25 }, |
1817 | }; | 1817 | }; |
1818 | 1818 | ||
1819 | /* mapping to indexes for wl1271_rates */ | ||
1820 | const static u8 wl1271_rate_to_idx_2ghz[] = { | ||
1821 | /* MCS rates are used only with 11n */ | ||
1822 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS7 */ | ||
1823 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS6 */ | ||
1824 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS5 */ | ||
1825 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS4 */ | ||
1826 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS3 */ | ||
1827 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS2 */ | ||
1828 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS1 */ | ||
1829 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS0 */ | ||
1830 | |||
1831 | 11, /* CONF_HW_RXTX_RATE_54 */ | ||
1832 | 10, /* CONF_HW_RXTX_RATE_48 */ | ||
1833 | 9, /* CONF_HW_RXTX_RATE_36 */ | ||
1834 | 8, /* CONF_HW_RXTX_RATE_24 */ | ||
1835 | |||
1836 | /* TI-specific rate */ | ||
1837 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_22 */ | ||
1838 | |||
1839 | 7, /* CONF_HW_RXTX_RATE_18 */ | ||
1840 | 6, /* CONF_HW_RXTX_RATE_12 */ | ||
1841 | 3, /* CONF_HW_RXTX_RATE_11 */ | ||
1842 | 5, /* CONF_HW_RXTX_RATE_9 */ | ||
1843 | 4, /* CONF_HW_RXTX_RATE_6 */ | ||
1844 | 2, /* CONF_HW_RXTX_RATE_5_5 */ | ||
1845 | 1, /* CONF_HW_RXTX_RATE_2 */ | ||
1846 | 0 /* CONF_HW_RXTX_RATE_1 */ | ||
1847 | }; | ||
1848 | |||
1819 | /* can't be const, mac80211 writes to this */ | 1849 | /* can't be const, mac80211 writes to this */ |
1820 | static struct ieee80211_supported_band wl1271_band_2ghz = { | 1850 | static struct ieee80211_supported_band wl1271_band_2ghz = { |
1821 | .channels = wl1271_channels, | 1851 | .channels = wl1271_channels, |
@@ -1898,6 +1928,35 @@ static struct ieee80211_channel wl1271_channels_5ghz[] = { | |||
1898 | { .hw_value = 165, .center_freq = 5825}, | 1928 | { .hw_value = 165, .center_freq = 5825}, |
1899 | }; | 1929 | }; |
1900 | 1930 | ||
1931 | /* mapping to indexes for wl1271_rates_5ghz */ | ||
1932 | const static u8 wl1271_rate_to_idx_5ghz[] = { | ||
1933 | /* MCS rates are used only with 11n */ | ||
1934 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS7 */ | ||
1935 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS6 */ | ||
1936 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS5 */ | ||
1937 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS4 */ | ||
1938 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS3 */ | ||
1939 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS2 */ | ||
1940 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS1 */ | ||
1941 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS0 */ | ||
1942 | |||
1943 | 7, /* CONF_HW_RXTX_RATE_54 */ | ||
1944 | 6, /* CONF_HW_RXTX_RATE_48 */ | ||
1945 | 5, /* CONF_HW_RXTX_RATE_36 */ | ||
1946 | 4, /* CONF_HW_RXTX_RATE_24 */ | ||
1947 | |||
1948 | /* TI-specific rate */ | ||
1949 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_22 */ | ||
1950 | |||
1951 | 3, /* CONF_HW_RXTX_RATE_18 */ | ||
1952 | 2, /* CONF_HW_RXTX_RATE_12 */ | ||
1953 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_11 */ | ||
1954 | 1, /* CONF_HW_RXTX_RATE_9 */ | ||
1955 | 0, /* CONF_HW_RXTX_RATE_6 */ | ||
1956 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_5_5 */ | ||
1957 | CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_2 */ | ||
1958 | CONF_HW_RXTX_RATE_UNSUPPORTED /* CONF_HW_RXTX_RATE_1 */ | ||
1959 | }; | ||
1901 | 1960 | ||
1902 | static struct ieee80211_supported_band wl1271_band_5ghz = { | 1961 | static struct ieee80211_supported_band wl1271_band_5ghz = { |
1903 | .channels = wl1271_channels_5ghz, | 1962 | .channels = wl1271_channels_5ghz, |
@@ -1906,6 +1965,11 @@ static struct ieee80211_supported_band wl1271_band_5ghz = { | |||
1906 | .n_bitrates = ARRAY_SIZE(wl1271_rates_5ghz), | 1965 | .n_bitrates = ARRAY_SIZE(wl1271_rates_5ghz), |
1907 | }; | 1966 | }; |
1908 | 1967 | ||
1968 | const static u8 *wl1271_band_rate_to_idx[] = { | ||
1969 | [IEEE80211_BAND_2GHZ] = wl1271_rate_to_idx_2ghz, | ||
1970 | [IEEE80211_BAND_5GHZ] = wl1271_rate_to_idx_5ghz | ||
1971 | }; | ||
1972 | |||
1909 | static const struct ieee80211_ops wl1271_ops = { | 1973 | static const struct ieee80211_ops wl1271_ops = { |
1910 | .start = wl1271_op_start, | 1974 | .start = wl1271_op_start, |
1911 | .stop = wl1271_op_stop, | 1975 | .stop = wl1271_op_stop, |
@@ -1923,6 +1987,27 @@ static const struct ieee80211_ops wl1271_ops = { | |||
1923 | CFG80211_TESTMODE_CMD(wl1271_tm_cmd) | 1987 | CFG80211_TESTMODE_CMD(wl1271_tm_cmd) |
1924 | }; | 1988 | }; |
1925 | 1989 | ||
1990 | |||
1991 | u8 wl1271_rate_to_idx(struct wl1271 *wl, int rate) | ||
1992 | { | ||
1993 | u8 idx; | ||
1994 | |||
1995 | BUG_ON(wl->band >= sizeof(wl1271_band_rate_to_idx)/sizeof(u8 *)); | ||
1996 | |||
1997 | if (unlikely(rate >= CONF_HW_RXTX_RATE_MAX)) { | ||
1998 | wl1271_error("Illegal RX rate from HW: %d", rate); | ||
1999 | return 0; | ||
2000 | } | ||
2001 | |||
2002 | idx = wl1271_band_rate_to_idx[wl->band][rate]; | ||
2003 | if (unlikely(idx == CONF_HW_RXTX_RATE_UNSUPPORTED)) { | ||
2004 | wl1271_error("Unsupported RX rate from HW: %d", rate); | ||
2005 | return 0; | ||
2006 | } | ||
2007 | |||
2008 | return idx; | ||
2009 | } | ||
2010 | |||
1926 | static ssize_t wl1271_sysfs_show_bt_coex_state(struct device *dev, | 2011 | static ssize_t wl1271_sysfs_show_bt_coex_state(struct device *dev, |
1927 | struct device_attribute *attr, | 2012 | struct device_attribute *attr, |
1928 | char *buf) | 2013 | char *buf) |