Skip to content

Commit

Permalink
Merge tag 'wireless-drivers-next-for-davem-2015-01-02' of git://git.k…
Browse files Browse the repository at this point in the history
…ernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next

Changes:

* ath9k: enable Transmit Power Control (TPC) for ar9003 chips

* rtlwifi: cleanup and updates from the vendor driver

* rsi: fix memory leak related to firmware image

* ath: parameter fix for FCC DFS pattern

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jan 2, 2015
2 parents 3adc0be + 354f473 commit c2f471f
Show file tree
Hide file tree
Showing 36 changed files with 510 additions and 1,337 deletions.
71 changes: 71 additions & 0 deletions drivers/net/wireless/ath/ath9k/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,75 @@ static const struct file_operations fops_ackto = {
};
#endif

static ssize_t read_file_tpc(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
struct ath_hw *ah = sc->sc_ah;
unsigned int len = 0, size = 32;
ssize_t retval;
char *buf;

buf = kzalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;

len += scnprintf(buf + len, size - len, "%s\n",
ah->tpc_enabled ? "ENABLED" : "DISABLED");

if (len > size)
len = size;

retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);

return retval;
}

static ssize_t write_file_tpc(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
struct ath_hw *ah = sc->sc_ah;
unsigned long val;
char buf[32];
ssize_t len;
bool tpc_enabled;

if (!AR_SREV_9300_20_OR_LATER(ah)) {
/* ar9002 does not support TPC for the moment */
return -EOPNOTSUPP;
}

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;

buf[len] = '\0';
if (kstrtoul(buf, 0, &val))
return -EINVAL;

if (val < 0 || val > 1)
return -EINVAL;

tpc_enabled = !!val;

if (tpc_enabled != ah->tpc_enabled) {
ah->tpc_enabled = tpc_enabled;
ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false);
}

return count;
}

static const struct file_operations fops_tpc = {
.read = read_file_tpc,
.write = write_file_tpc,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};

/* Ethtool support for get-stats */

#define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
Expand Down Expand Up @@ -1324,6 +1393,8 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_file("ack_to", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
sc, &fops_ackto);
#endif
debugfs_create_file("tpc", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, sc, &fops_tpc);

return 0;
}
3 changes: 3 additions & 0 deletions drivers/net/wireless/ath/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
ah->power_mode = ATH9K_PM_UNDEFINED;
ah->htc_reset_init = true;

/* ar9002 does not support TPC for the moment */
ah->tpc_enabled = !!AR_SREV_9300_20_OR_LATER(ah);

ah->ani_function = ATH9K_ANI_ALL;
if (!AR_SREV_9300_20_OR_LATER(ah))
ah->ani_function &= ~ATH9K_ANI_MRC_CCK;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath9k/xmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf,
return MAX_RATE_POWER;

if (!AR_SREV_9300_20_OR_LATER(ah)) {
/* ar9002 is not sipported for the moment */
/* ar9002 does not support TPC for the moment */
return MAX_RATE_POWER;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/dfs_pattern_detector.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static const struct radar_detector_specs fcc_radar_ref_types[] = {
FCC_PATTERN(1, 0, 5, 150, 230, 1, 23),
FCC_PATTERN(2, 6, 10, 200, 500, 1, 16),
FCC_PATTERN(3, 11, 20, 200, 500, 1, 12),
FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 20),
FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 1),
FCC_PATTERN(5, 0, 1, 333, 333, 1, 9),
};

Expand Down
4 changes: 1 addition & 3 deletions drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
(struct rsi_91x_sdiodev *)adapter->rsi_dev;
u32 len;
u32 num_blocks;
const u8 *fw;
const struct firmware *fw_entry = NULL;
u32 block_size = dev->tx_blk_size;
int status = 0;
Expand Down Expand Up @@ -201,7 +200,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
return status;
}

fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
len = fw_entry->size;

if (len % 4)
Expand All @@ -212,7 +210,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len);
rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);

status = rsi_copy_to_card(common, fw, len, num_blocks);
status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks);
release_firmware(fw_entry);
return status;
}
Expand Down
156 changes: 114 additions & 42 deletions drivers/net/wireless/rtlwifi/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,63 +867,135 @@ static u8 _rtl_get_highest_n_rate(struct ieee80211_hw *hw,
*
* B/G rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92_RATE1M-->DESC92_RATE54M ==> idx is 0-->11,
* DESC_RATE1M-->DESC_RATE54M ==> idx is 0-->11,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92_RATEMCS0-->DESC92_RATEMCS15 ==> idx is 0-->15
* DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
*
* 5G band:rx_status->band == IEEE80211_BAND_5GHZ
* A rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92_RATE6M-->DESC92_RATE54M ==> idx is 0-->7,
* DESC_RATE6M-->DESC_RATE54M ==> idx is 0-->7,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92_RATEMCS0-->DESC92_RATEMCS15 ==> idx is 0-->15
* DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
*
* VHT rates:
* DESC_RATEVHT1SS_MCS0-->DESC_RATEVHT1SS_MCS9 ==> idx is 0-->9
* DESC_RATEVHT2SS_MCS0-->DESC_RATEVHT2SS_MCS9 ==> idx is 0-->9
*/
int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
bool isht, u8 desc_rate, bool first_ampdu)
int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht, bool isvht,
u8 desc_rate)
{
int rate_idx;

if (isvht) {
switch (desc_rate) {
case DESC_RATEVHT1SS_MCS0:
rate_idx = 0;
break;
case DESC_RATEVHT1SS_MCS1:
rate_idx = 1;
break;
case DESC_RATEVHT1SS_MCS2:
rate_idx = 2;
break;
case DESC_RATEVHT1SS_MCS3:
rate_idx = 3;
break;
case DESC_RATEVHT1SS_MCS4:
rate_idx = 4;
break;
case DESC_RATEVHT1SS_MCS5:
rate_idx = 5;
break;
case DESC_RATEVHT1SS_MCS6:
rate_idx = 6;
break;
case DESC_RATEVHT1SS_MCS7:
rate_idx = 7;
break;
case DESC_RATEVHT1SS_MCS8:
rate_idx = 8;
break;
case DESC_RATEVHT1SS_MCS9:
rate_idx = 9;
break;
case DESC_RATEVHT2SS_MCS0:
rate_idx = 0;
break;
case DESC_RATEVHT2SS_MCS1:
rate_idx = 1;
break;
case DESC_RATEVHT2SS_MCS2:
rate_idx = 2;
break;
case DESC_RATEVHT2SS_MCS3:
rate_idx = 3;
break;
case DESC_RATEVHT2SS_MCS4:
rate_idx = 4;
break;
case DESC_RATEVHT2SS_MCS5:
rate_idx = 5;
break;
case DESC_RATEVHT2SS_MCS6:
rate_idx = 6;
break;
case DESC_RATEVHT2SS_MCS7:
rate_idx = 7;
break;
case DESC_RATEVHT2SS_MCS8:
rate_idx = 8;
break;
case DESC_RATEVHT2SS_MCS9:
rate_idx = 9;
break;
default:
rate_idx = 0;
break;
}
return rate_idx;
}
if (false == isht) {
if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
switch (desc_rate) {
case DESC92_RATE1M:
case DESC_RATE1M:
rate_idx = 0;
break;
case DESC92_RATE2M:
case DESC_RATE2M:
rate_idx = 1;
break;
case DESC92_RATE5_5M:
case DESC_RATE5_5M:
rate_idx = 2;
break;
case DESC92_RATE11M:
case DESC_RATE11M:
rate_idx = 3;
break;
case DESC92_RATE6M:
case DESC_RATE6M:
rate_idx = 4;
break;
case DESC92_RATE9M:
case DESC_RATE9M:
rate_idx = 5;
break;
case DESC92_RATE12M:
case DESC_RATE12M:
rate_idx = 6;
break;
case DESC92_RATE18M:
case DESC_RATE18M:
rate_idx = 7;
break;
case DESC92_RATE24M:
case DESC_RATE24M:
rate_idx = 8;
break;
case DESC92_RATE36M:
case DESC_RATE36M:
rate_idx = 9;
break;
case DESC92_RATE48M:
case DESC_RATE48M:
rate_idx = 10;
break;
case DESC92_RATE54M:
case DESC_RATE54M:
rate_idx = 11;
break;
default:
Expand All @@ -932,28 +1004,28 @@ int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
}
} else {
switch (desc_rate) {
case DESC92_RATE6M:
case DESC_RATE6M:
rate_idx = 0;
break;
case DESC92_RATE9M:
case DESC_RATE9M:
rate_idx = 1;
break;
case DESC92_RATE12M:
case DESC_RATE12M:
rate_idx = 2;
break;
case DESC92_RATE18M:
case DESC_RATE18M:
rate_idx = 3;
break;
case DESC92_RATE24M:
case DESC_RATE24M:
rate_idx = 4;
break;
case DESC92_RATE36M:
case DESC_RATE36M:
rate_idx = 5;
break;
case DESC92_RATE48M:
case DESC_RATE48M:
rate_idx = 6;
break;
case DESC92_RATE54M:
case DESC_RATE54M:
rate_idx = 7;
break;
default:
Expand All @@ -963,52 +1035,52 @@ int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
}
} else {
switch (desc_rate) {
case DESC92_RATEMCS0:
case DESC_RATEMCS0:
rate_idx = 0;
break;
case DESC92_RATEMCS1:
case DESC_RATEMCS1:
rate_idx = 1;
break;
case DESC92_RATEMCS2:
case DESC_RATEMCS2:
rate_idx = 2;
break;
case DESC92_RATEMCS3:
case DESC_RATEMCS3:
rate_idx = 3;
break;
case DESC92_RATEMCS4:
case DESC_RATEMCS4:
rate_idx = 4;
break;
case DESC92_RATEMCS5:
case DESC_RATEMCS5:
rate_idx = 5;
break;
case DESC92_RATEMCS6:
case DESC_RATEMCS6:
rate_idx = 6;
break;
case DESC92_RATEMCS7:
case DESC_RATEMCS7:
rate_idx = 7;
break;
case DESC92_RATEMCS8:
case DESC_RATEMCS8:
rate_idx = 8;
break;
case DESC92_RATEMCS9:
case DESC_RATEMCS9:
rate_idx = 9;
break;
case DESC92_RATEMCS10:
case DESC_RATEMCS10:
rate_idx = 10;
break;
case DESC92_RATEMCS11:
case DESC_RATEMCS11:
rate_idx = 11;
break;
case DESC92_RATEMCS12:
case DESC_RATEMCS12:
rate_idx = 12;
break;
case DESC92_RATEMCS13:
case DESC_RATEMCS13:
rate_idx = 13;
break;
case DESC92_RATEMCS14:
case DESC_RATEMCS14:
rate_idx = 14;
break;
case DESC92_RATEMCS15:
case DESC_RATEMCS15:
rate_idx = 15;
break;
default:
Expand Down
Loading

0 comments on commit c2f471f

Please sign in to comment.