GitHub/moto-9609/android_kernel_motorola_exynos9610.git
8 years agoath10k: update bss channel survey information
Rajkumar Manoharan [Wed, 27 Apr 2016 10:53:22 +0000 (16:23 +0530)]
ath10k: update bss channel survey information

During hw scan, firmware sends two channel information events (pre-
complete, complete) to host for each channel change. The snap shot of cycle
counters (rx_clear and total) between these two events are given for
survey dump. In order to get latest survey statistics of all channels, a
scan request has to be issued. In general, an AP DUT is brought up, it
won't leave BSS channel except few cases like overlapping bss or radar
detection. So survey statistics of bss channel is always referring to
older data that are collected before starting AP (either ACS/OBSS scan).

To collect latest survey information from target, firmware provides WMI
interface to read cycle counters from hardware. For each survey dump
request, BSS channel cycle counters are read and cleared in hardware.
This makes sure that behavior is in align with ath9k survey report.
So survey dump always gives snap shot of cycle counters b/w two survey
requests.

Signed-off-by: Yanbo Li <yanbol@qca.qualcomm.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: handle pdev_chan_info wmi event
Rajkumar Manoharan [Wed, 27 Apr 2016 10:53:21 +0000 (16:23 +0530)]
ath10k: handle pdev_chan_info wmi event

Add handler to process bss channel information wmi event that
will be received upon sending pdev_chan_info_request wmi command.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: implement wmi_pdev_bss_chan_info_request
Rajkumar Manoharan [Wed, 27 Apr 2016 10:53:20 +0000 (16:23 +0530)]
ath10k: implement wmi_pdev_bss_chan_info_request

Add WMI ops to send pdev_bss_chan_info_request command to target.
This command will be used to retrieve updated cycle counters and noise
floor value of current operating channel (bss channel).

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add pdev bss channel info wmi definitions
Rajkumar Manoharan [Wed, 27 Apr 2016 10:53:19 +0000 (16:23 +0530)]
ath10k: add pdev bss channel info wmi definitions

Add WMI definitions for pdev bss channel information request and
event.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix kernel panic, move arvifs list head init before htt init
Anilkumar Kolli [Tue, 26 Apr 2016 16:05:48 +0000 (21:35 +0530)]
ath10k: fix kernel panic, move arvifs list head init before htt init

It is observed that while loading and unloading ath10k modules
in an infinite loop, before ath10k_core_start() completion HTT
rx frames are received, while processing these frames,
dereferencing the arvifs list code is getting hit before
initilizing the arvifs list, causing a kernel panic.

This patch initilizes the arvifs list before initilizing htt.

Fixes the below issue:
 [<bf88b058>] (ath10k_htt_rx_pktlog_completion_handler+0x278/0xd08 [ath10k_core])
 [<bf88b058>] (ath10k_htt_rx_pktlog_completion_handler [ath10k_core])
 [<bf88c0dc>] (ath10k_htt_txrx_compl_task+0x5f4/0xeb0 [ath10k_core])
 [<bf88c0dc>] (ath10k_htt_txrx_compl_task [ath10k_core])
 [<c0234100>] (tasklet_action+0x8c/0xec)
 [<c0234100>] (tasklet_action)
 [<c02337c0>] (__do_softirq+0xf8/0x228)
 [<c02337c0>] (__do_softirq)  [<c0233920>] (run_ksoftirqd+0x30/0x90)
 Code: e5954ad8 e2899008 e1540009 0a00000d (e5943008)
 ---[ end trace 71de5c2e011dbf56 ]---
 Kernel panic - not syncing: Fatal exception in interrupt

Fixes: 500ff9f9389d ("ath10k: implement chanctx API")
Cc: <stable@vger.kernel.org>
Signed-off-by: Anilkumar Kolli <akolli@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: move spectral related structures under ath10k debugfs
Mohammed Shafi Shajakhan [Tue, 26 Apr 2016 15:24:36 +0000 (20:54 +0530)]
ath10k: move spectral related structures under ath10k debugfs

Spectral related structures are accessed / modified only if ath10k
debugfs is enabled, so it makes more sense to move them under
ATH10K_DEBUGFS

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: remove VHT capabilities from 2.4GHz
Johannes Berg [Thu, 21 Apr 2016 13:17:49 +0000 (16:17 +0300)]
ath10k: remove VHT capabilities from 2.4GHz

According to the spec, VHT doesn't exist in 2.4GHz.

There are vendor extensions to allow a subset of VHT to work
(notably 256-QAM), but since mac80211 doesn't support those
advertising VHT capability on 2.4GHz leads to the behaviour
of reporting VHT capabilities but not being able to use any
of them due to mac80211's code requiring 80 MHz support.

Remove the VHT capabilities from 2.4GHz for now. If mac80211
gets extended to use the (likely Broadcom) vendor IEs for it
and handles the lack of 80 MHz support, it can be added back.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Set SMD timeout to 10 seconds
Bjorn Andersson [Thu, 21 Apr 2016 21:09:42 +0000 (14:09 -0700)]
wcn36xx: Set SMD timeout to 10 seconds

After booting the wireless subsystem and uploading the NV blob to the
WCNSS_CTRL service the remote continues to do things and will not start
servicing wlan-requests for another 2-5 seconds (measured).

The downstream code does not have any special handling for this case,
but has a timeout of 10 seconds for the communication layer. By
extending the wcn36xx timeout to match this we follows the same flow for
the boot procedure and can successfully configure WiFi as wlan0 is
registered.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: prevent deep sleep of 60G device in critical paths
Maya Erez [Tue, 26 Apr 2016 11:41:41 +0000 (14:41 +0300)]
wil6210: prevent deep sleep of 60G device in critical paths

In idle times 60G device can enter deep sleep and turn off
its XTAL clock.
Host access triggers the device power-up flow which will hold
the AHB during XTAL stabilization until device switches from
slow-clock to XTAL clock.
This behavior can stall the PCIe bus for some arbitrary period
of time.
In order to prevent this stall, host can vote for High Latency
Access Policy (HALP) before reading from PCIe bus.
This vote will wakeup the device from deep sleep and prevent
deep sleep until unvote is done.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: unmask RX_HTRSH interrupt only when connected
Maya Erez [Tue, 26 Apr 2016 11:41:40 +0000 (14:41 +0300)]
wil6210: unmask RX_HTRSH interrupt only when connected

RX_HTRSH interrupt sometimes triggered during device reset
procedure.
To prevent handling this interrupt when not required, unmask
this interrupt only if we are connected and mask it when
disconnected.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: print debug message when transmitting while disconnected
Maya Erez [Tue, 26 Apr 2016 11:41:39 +0000 (14:41 +0300)]
wil6210: print debug message when transmitting while disconnected

Network stack can try to transmit data while AP / STA is
disconnected.
Change this print-out to debug level as this should not be
handled as error.
This patch also adds wil_dbg_ratelimited, used to limit the
above print-out.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: change RX_HTRSH interrupt print level to debug
Maya Erez [Tue, 26 Apr 2016 11:41:39 +0000 (14:41 +0300)]
wil6210: change RX_HTRSH interrupt print level to debug

When using interrupt moderation RX_HTRSH interrupt can occur
frequently during high throughput and should not be considered
as error.
Such print-outs can degrade the performance hence should be printed
in debug print level.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: support regular scan on P2P_DEVICE interface
Lior David [Tue, 26 Apr 2016 11:41:38 +0000 (14:41 +0300)]
wil6210: support regular scan on P2P_DEVICE interface

P2P search can only run on the social channel (channel 2).
When issuing a scan request on the P2P_DEVICE interface,
driver ignored the channels argument and always performed a P2P
search.
Fix this by checking the channels argument, if it is
not specified (meaning full scan) or if a non-social channel
was specified, perform a regular scan and not a P2P search.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: add function name to wil log macros
Maya Erez [Tue, 26 Apr 2016 11:41:38 +0000 (14:41 +0300)]
wil6210: add function name to wil log macros

Add __func__ to wil_err and wil_info for easier
debugging.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath6kl: add ability to set debug uart baud rate
Steve deRosier [Tue, 26 Apr 2016 11:41:37 +0000 (14:41 +0300)]
ath6kl: add ability to set debug uart baud rate

It's useful to permit the customization of the debug uart baud rate. Enable
this and send down the value to the chip if we're enabling debug.

Signed-off-by: Steve deRosier <steve.derosier@lairdtech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath6kl: fix missing uart debug pin for 6004 HW 3.0
Steve deRosier [Tue, 26 Apr 2016 11:41:37 +0000 (14:41 +0300)]
ath6kl: fix missing uart debug pin for 6004 HW 3.0

For some reason, the 6004 HW 3.0 definition was missing the value for the
uarttx_pin (used for firmware debug). This corrects this situation.

Signed-off-by: Steve deRosier <steve.derosier@lairdtech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix a typo in ath10k_start()
Mohammed Shafi Shajakhan [Tue, 26 Apr 2016 11:41:36 +0000 (14:41 +0300)]
ath10k: fix a typo in ath10k_start()

fix a typo (spelling mistake) in 'ath10k_start'

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add max_tx_power for QCA6174 WLAN.RM.2.0 firmware
Alan Liu [Tue, 26 Apr 2016 11:41:33 +0000 (14:41 +0300)]
ath10k: add max_tx_power for QCA6174 WLAN.RM.2.0 firmware

QCA6174 WLAN.RM.2.0 firmware uses max_tx_power instead of using max_reg_power
to set transmission power. The tx power was about -50dbm, after applying this
change, it become -32dbm.

Signed-off-by: Alan Liu <alanliu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoMerge ath-next from ath.git
Kalle Valo [Tue, 26 Apr 2016 11:13:59 +0000 (14:13 +0300)]
Merge ath-next from ath.git

ath.git patches for 4.7. Major changes:

ath10k

* implement set_tsf() for 10.2.4 branch
* remove rare MSI range support
* remove deprecated firmware API 1 support

ath9k

* add module parameter to invert LED polarity

wcn36xx

* fixes to get the driver properly working on Dragonboard 410c

8 years agoiwlwifi: fix fw version reading for DVM devices
Luca Coelho [Mon, 25 Apr 2016 17:02:09 +0000 (20:02 +0300)]
iwlwifi: fix fw version reading for DVM devices

In commit 97f95c93c8ed ("iwlwifi: remove support for fw older than
-16.ucode") we accidentally changed the fw version reading code for
DVM devices.  The code intended to remove the old fw version API,
because all MVM firmwares version 16 and above that we support don't
use it anymore.  But DVM devices still use the old FW API.

Fix that by bringing the code back in.

Reported-by: Pat Erley <pat-lkml@erley.org>
Tested-by: Kalle Valo <kvalo@codeaurora.org>
Fixes: 97f95c93c8ed ("iwlwifi: remove support for fw older than-16.ucode")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agort2800lib: enable MFP if hw crypt is disabled
Chun-Yeow Yeoh [Wed, 20 Apr 2016 16:41:34 +0000 (00:41 +0800)]
rt2800lib: enable MFP if hw crypt is disabled

If rt2800usb is loaded with nohwcrypt=1, mac80211 takes
care of the crypto with software encryption/decryption
and thus, MFP can be used.

Tested for secured mesh using ath9k_htc and ath9k.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: testing the wrong variable in brcmf_rx_hdrpull()
Dan Carpenter [Tue, 19 Apr 2016 14:25:43 +0000 (07:25 -0700)]
brcmfmac: testing the wrong variable in brcmf_rx_hdrpull()

Smatch complains about this code:

    drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c:335 brcmf_rx_hdrpull()
    error: we previously assumed '*ifp' could be null (see line 333)

The problem is that we recently changed these from "ifp" to "*ifp" but
there was one that we didn't update.

-       if (ret || !ifp || !ifp->ndev) {
+       if (ret || !(*ifp) || !(*ifp)->ndev) {
                if (ret != -ENODATA && ifp)
                                       ^^^
-                       ifp->stats.rx_errors++;
+                       (*ifp)->stats.rx_errors++;

I have updated it to *ifp as well.  We always call this function is a
non-NULL "ifp" pointer, btw.

Fixes: c462ebcdfe42 ('brcmfmac: create common function for handling brcmf_proto_hdrpull()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: fix loop timeout in mwifiex_prog_fw_w_helper()
Dan Carpenter [Tue, 19 Apr 2016 14:23:44 +0000 (07:23 -0700)]
mwifiex: fix loop timeout in mwifiex_prog_fw_w_helper()

USB8XXX_FW_MAX_RETRY is 3.  We were using a post-op loop
"while (retries--) {" but then the lines after that assume the loop
exits with retries set to zero.

I've fixed this by changing to a pre-op loop.  I started with retries
set to 4 instead of 3 so that we still go through the loop the same
number of times.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: missing error code on allocation failure
Dan Carpenter [Tue, 19 Apr 2016 14:21:58 +0000 (07:21 -0700)]
mwifiex: missing error code on allocation failure

We accidentally return success instead of -ENOMEM.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_iqk_phy_iq_bb_reg
Jes Sorensen [Mon, 18 Apr 2016 15:49:36 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_iqk_phy_iq_bb_reg

There is nothing 8723au specific about rtl8723au_iqk_phy_iq_bb_reg so
rename the array to rtl8xxxu_iqk_phy_iq_bb_reg.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723bu_simularity_compare()
Jes Sorensen [Mon, 18 Apr 2016 15:49:35 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723bu_simularity_compare()

This renames rtl8723bu_simularity_compare() to
rtl8xxxu_gen2_simularity_compare() to reflect it is used for all gen2
parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723b_channel_to_group()
Jes Sorensen [Mon, 18 Apr 2016 15:49:34 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723b_channel_to_group()

This renames rtl8723b_channel_to_group() to
rtl8xxxu_gen2_channel_to_group() to reflect it is used by all
currently supported gen2 parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723a_mac_init_table to rtl8xxxu_gen1_mac_init_table
Jes Sorensen [Mon, 18 Apr 2016 15:49:33 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723a_mac_init_table to rtl8xxxu_gen1_mac_init_table

All currently supported gen1 parts use the same mac_init_table, so
rename it to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723a_enable_rf() to rtl8xxxu_gen1_enable_rf()
Jes Sorensen [Mon, 18 Apr 2016 15:49:32 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723a_enable_rf() to rtl8xxxu_gen1_enable_rf()

All gen1 parts use the same enable_rf() function, so rename it to
reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723a_set_tx_power() to rtl8xxxu_gen1_set_tx_power()
Jes Sorensen [Mon, 18 Apr 2016 15:49:31 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723a_set_tx_power() to rtl8xxxu_gen1_set_tx_power()

All gen1 parts use the same interface for setting TX power, so rename
the function to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_init_phy_bb() to rtl8xxxu_gen1_init_phy_bb()
Jes Sorensen [Mon, 18 Apr 2016 15:49:30 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_init_phy_bb() to rtl8xxxu_gen1_init_phy_bb()

All gen1 parts use the same init_phy_bb() function, so rename it to
reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_phy_iq_calibrate() to rtl8xxxu_gen1_phy_iq_calibrate()
Jes Sorensen [Mon, 18 Apr 2016 15:49:29 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_phy_iq_calibrate() to rtl8xxxu_gen1_phy_iq_calibrate()

All supported gen1 parts use the same phy_iq_calibrate() function
(unlike their gen2 counterparts). Rename the function to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_update_rate_mask() to rtl8xxxu_update_rate_mask()
Jes Sorensen [Mon, 18 Apr 2016 15:49:28 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_update_rate_mask() to rtl8xxxu_update_rate_mask()

All currently supported gen1 parts use the same function for updating
the rate mask, so rename it to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_config_channel() to rtl8xxxu_gen1_config_channel()
Jes Sorensen [Mon, 18 Apr 2016 15:49:27 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_config_channel() to rtl8xxxu_gen1_config_channel()

All supported gen1 parts use the same config_channel() function, so
rename it to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723a_disable_rf() to rtl8xxxu_gen1_disable_rf()
Jes Sorensen [Mon, 18 Apr 2016 15:49:26 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723a_disable_rf() to rtl8xxxu_gen1_disable_rf()

All currently supported gen1 parts use the same disable_rf() routine,
so rename the function to reflect that.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723b_disable_rf() to rtl8xxxu_gen2_disable_rf()
Jes Sorensen [Mon, 18 Apr 2016 15:49:25 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723b_disable_rf() to rtl8xxxu_gen2_disable_rf()

At least for now, all gen2 parts use the same disable_rf() function

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723bu_config_channel() to rtl8xxxu_gen2_config_channel()
Jes Sorensen [Mon, 18 Apr 2016 15:49:24 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723bu_config_channel() to rtl8xxxu_gen2_config_channel()

Rename the function to indicate it is applicable to most/all gen2
parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_report_connect() to rtl8xxxu_gen1_report_connect()
Jes Sorensen [Mon, 18 Apr 2016 15:49:23 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_report_connect() to rtl8xxxu_gen1_report_connect()

Rename the function to reflect it is for all/most gen1 parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723bu_report_connect() to rtl8xxxu_gen2_report_connect()
Jes Sorensen [Mon, 18 Apr 2016 15:49:22 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723bu_report_connect() to rtl8xxxu_gen2_report_connect()

Make the name reflect this is for most/all gen2 parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723bu_update_rate_mask() to rtl8xxxu_gen2_update_rate_mask()
Jes Sorensen [Mon, 18 Apr 2016 15:49:21 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723bu_update_rate_mask() to rtl8xxxu_gen2_update_rate_mask()

Update the name of rtl8723bu_update_rate_mask() to make it reflect
it's applicable for all/most gen2 N parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: stop background scan when net device closed
Xinming Hu [Mon, 18 Apr 2016 13:42:55 +0000 (06:42 -0700)]
mwifiex: stop background scan when net device closed

Transmit data path should not touch background scan. We will stop
background scan when net device is closed.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: add platform specific wakeup interrupt support
Xinming Hu [Mon, 18 Apr 2016 12:22:23 +0000 (05:22 -0700)]
mwifiex: add platform specific wakeup interrupt support

On some arm-based platforms, we need to configure platform specific
parameters by device tree node and also define our node as a child
node of parent SDIO host controller.
This patch parses these parameters from device tree. It includes
calibration data dowoload to firmware, wakeup pin configured to firmware,
and soc specific wake up gpio, which will be set as wakeup interrupt pin.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agodt: bindings: add MARVELL's sd8xxx wireless device
Xinming Hu [Mon, 18 Apr 2016 12:22:22 +0000 (05:22 -0700)]
dt: bindings: add MARVELL's sd8xxx wireless device

Add device tree binding documentation for MARVELL's sd8xxx
(sd8897 and sd8997) wlan chip.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmf: Fix null pointer exception in bcdc_hdrpull
Per Forlin [Sun, 17 Apr 2016 13:25:03 +0000 (15:25 +0200)]
brcmf: Fix null pointer exception in bcdc_hdrpull

In fwsignal.c: brcmf_fws_commit_skb()
...
if (rc < 0) {
  entry->transit_count--;
    if (entry->suppressed)
      entry->suppr_transit_count--;
      (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
                                                     ^^^^^^^
    goto rollback;
}
...

The call to hdrpull will trigger a null pointer exception
unless a null check is made in the method implementation.

Signed-off-by: Per Forlin <per.forlin@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: add support for nl80211 BSS_SELECT feature
Arend van Spriel [Sun, 17 Apr 2016 14:44:58 +0000 (16:44 +0200)]
brcmfmac: add support for nl80211 BSS_SELECT feature

Announce support for nl80211 feature BSS_SELECT and process
BSS selection behaviour provided in .connect() callback.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Lei Zhang <leizh@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: rtl8821ae: Make sure loop counter is signed on all architectures
David Müller [Fri, 15 Apr 2016 06:50:25 +0000 (08:50 +0200)]
rtlwifi: rtl8821ae: Make sure loop counter is signed on all architectures

The for-loop condition does not work correctly on architectures where
"char" is unsigned. Fix it by using an "int", which may also result in
more efficient code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoprism54: isl_38xx: Replace 'struct timeval'
Tina Ruchandani [Wed, 13 Apr 2016 06:09:16 +0000 (23:09 -0700)]
prism54: isl_38xx: Replace 'struct timeval'

'struct timeval' uses a 32-bit seconds field which will overflow in
year 2038 and beyond. This patch is part of a larger effort to remove
all instances of 'struct timeval' from the kernel and replace them
with 64-bit timekeeping variables.
The patch also fixes the debug printf specifier to avoid the
seconds value being truncated.
The patch was build-tested / debugged by removing the
"if VERBOSE > SHOW_ERROR_MESSAGES" guards.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl818x_pci: Fix a memory leak in rtl8180_init_rx_ring
Jia-Ju Bai [Fri, 18 Mar 2016 02:27:09 +0000 (13:27 +1100)]
rtl818x_pci: Fix a memory leak in rtl8180_init_rx_ring

When dev_alloc_skb or pci_dma_mapping_error in rtl8180_init_rx_ring fails,
the memory allocated by pci_zalloc_consistent is not freed.

This patch fixes the bug by adding pci_free_consistent
in error handling code.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowcn36xx: Fill in capability list
Bjorn Andersson [Tue, 19 Apr 2016 05:00:56 +0000 (22:00 -0700)]
wcn36xx: Fill in capability list

Fill in the capability list with more values from the downstream driver.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Correct remove bss key response encoding
Bjorn Andersson [Tue, 19 Apr 2016 05:00:55 +0000 (22:00 -0700)]
wcn36xx: Correct remove bss key response encoding

The WCN36XX_HAL_RMV_BSSKEY_RSP carries a single u32 with "status", so we
can use the standard status check function for decoding the result.

This is the last user of the v2 status checker, so remove the struct and
helper function.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Delete BSS before idling link
Bjorn Andersson [Tue, 19 Apr 2016 05:00:54 +0000 (22:00 -0700)]
wcn36xx: Delete BSS before idling link

When disabling the beacon we must delete the bss before idling the link.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Use correct command struct for EXIT_BMPS_REQ
Pontus Fuchs [Tue, 19 Apr 2016 05:00:53 +0000 (22:00 -0700)]
wcn36xx: Use correct command struct for EXIT_BMPS_REQ

EXIT_BMPS_REQ was using the command struct for ENTER_BMPS_REQ. I
spotted this when looking at command dumps.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Implement multicast filtering
Pontus Fuchs [Tue, 19 Apr 2016 05:00:52 +0000 (22:00 -0700)]
wcn36xx: Implement multicast filtering

Pass the multicast list to FW.

This patch also adds a way to build the smd command in place. This is
needed because the MC list command is too big for the stack.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
[bjorn: dropped FIF_PROMISC_IN_BSS usage]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Track association state
Pontus Fuchs [Tue, 19 Apr 2016 05:00:51 +0000 (22:00 -0700)]
wcn36xx: Track association state

Knowing the association state is needed for mc filtering.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Clear encrypt_type when deleting bss key
Pontus Fuchs [Tue, 19 Apr 2016 05:00:50 +0000 (22:00 -0700)]
wcn36xx: Clear encrypt_type when deleting bss key

This fixes a problem connecting to an open network after being
connected to an encrypted network.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Use allocated self sta index instead of hard coded
Pontus Fuchs [Tue, 19 Apr 2016 05:00:49 +0000 (22:00 -0700)]
wcn36xx: Use allocated self sta index instead of hard coded

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Copy all members in config_sta v1 conversion
Pontus Fuchs [Tue, 19 Apr 2016 05:00:48 +0000 (22:00 -0700)]
wcn36xx: Copy all members in config_sta v1 conversion

When converting to version 1 of the config_sta struct not all
members where copied. This fixes the problem of multicast frames
not being delivered on an encrypted network.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Parse trigger_ba response properly
Pontus Fuchs [Tue, 19 Apr 2016 05:00:47 +0000 (22:00 -0700)]
wcn36xx: Parse trigger_ba response properly

This message does not follow the canonical format and needs it's own
parser.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Remove sta pointer in private vif struct
Pontus Fuchs [Tue, 19 Apr 2016 05:00:46 +0000 (22:00 -0700)]
wcn36xx: Remove sta pointer in private vif struct

This does not work with multiple sta's in a vif.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Fetch private sta data from sta entry instead of from vif
Pontus Fuchs [Tue, 19 Apr 2016 05:00:45 +0000 (22:00 -0700)]
wcn36xx: Fetch private sta data from sta entry instead of from vif

For consistency with other code.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Add helper macros to cast sta to priv
Pontus Fuchs [Tue, 19 Apr 2016 05:00:44 +0000 (22:00 -0700)]
wcn36xx: Add helper macros to cast sta to priv

While poking at this I also change two related things. I rename one
variable to make the names consistent. I also move one assignment of
priv_sta to the declaration to save a few lines.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Use define for invalid index and fix typo
Pontus Fuchs [Tue, 19 Apr 2016 05:00:43 +0000 (22:00 -0700)]
wcn36xx: Use define for invalid index and fix typo

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Use consistent name for private vif
Pontus Fuchs [Tue, 19 Apr 2016 05:00:42 +0000 (22:00 -0700)]
wcn36xx: Use consistent name for private vif

Some code used priv_vif and some used vif_priv. Convert all to vif_priv
for consistency.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Add helper macros to cast vif to private vif and vice versa
Pontus Fuchs [Tue, 19 Apr 2016 05:00:41 +0000 (22:00 -0700)]
wcn36xx: Add helper macros to cast vif to private vif and vice versa

Makes the code a little easier to read.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Pad TIM PVM if needed
Pontus Fuchs [Tue, 19 Apr 2016 05:00:40 +0000 (22:00 -0700)]
wcn36xx: Pad TIM PVM if needed

The wcn36xx FW expects a fixed size TIM PVM in the beacon template. If
supplied with a shorter than expected PVM it will overwrite the IE
following the TIM.

Squashed with fix from Jason Mobarak <jam@cozybit.com>:
Patch "wcn36xx: Pad TIM PVM if needed" has caused a regression in mesh
beaconing.  The field tim_off is always 0 for mesh mode, and thus
pvm_len (referring to the TIM length field) and pad are both incorrectly
calculated.  Thus, msg_body.beacon_length is incorrectly calculated for
mesh mode. Fix this.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Jason Mobarak <jam@cozybit.com>
[bjorn: squashed in Jason's fixup]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: Clean up wcn36xx_smd_send_beacon
Pontus Fuchs [Tue, 19 Apr 2016 05:00:39 +0000 (22:00 -0700)]
wcn36xx: Clean up wcn36xx_smd_send_beacon

Needed for coming improvements. No functional changes.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
[bjorn: restored BEACON_TEMPLATE_SIZE define to 0x180]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: Fix LED polarity for some Mini PCI AR9220 MB92 cards.
Vittorio Gambaletta (VittGam) [Mon, 11 Apr 2016 02:48:55 +0000 (04:48 +0200)]
ath9k: Fix LED polarity for some Mini PCI AR9220 MB92 cards.

The Wistron DNMA-92 and Compex WLM200NX have inverted LED polarity
(active high instead of active low).

The same PCI Subsystem ID is used by both cards, which are based on
the same Atheros MB92 design.

Cc: <linux-wireless@vger.kernel.org>
Cc: <ath9k-devel@qca.qualcomm.com>
Cc: <ath9k-devel@lists.ath9k.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: Add a module parameter to invert LED polarity.
Vittorio Gambaletta (VittGam) [Mon, 11 Apr 2016 02:48:54 +0000 (04:48 +0200)]
ath9k: Add a module parameter to invert LED polarity.

The LED can be active high instead of active low on some hardware.

Add the led_active_high module parameter. It defaults to -1 to obey
platform data as before.

Setting the parameter to 1 or 0 will force the LED respectively
active high or active low.

Cc: <linux-wireless@vger.kernel.org>
Cc: <ath9k-devel@qca.qualcomm.com>
Cc: <ath9k-devel@lists.ath9k.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agortl8xxxu: hide unused tables
Arnd Bergmann [Mon, 18 Apr 2016 21:59:31 +0000 (23:59 +0200)]
rtl8xxxu: hide unused tables

The references to some arrays in the rtl8xxxu driver were moved inside
of an #ifdef, but the symbols remain outside, resulting in build warnings:

rtl8xxxu/rtl8xxxu.c:1506:33: error: 'rtl8188ru_radioa_1t_highpa_table' defined but not used
rtl8xxxu/rtl8xxxu.c:1431:33: error: 'rtl8192cu_radioa_1t_init_table' defined but not used
rtl8xxxu/rtl8xxxu.c:1407:33: error: 'rtl8192cu_radiob_2t_init_table' defined but not used
rtl8xxxu/rtl8xxxu.c:1332:33: error: 'rtl8192cu_radioa_2t_init_table' defined but not used
rtl8xxxu/rtl8xxxu.c:239:35: error: 'rtl8192c_power_base' defined but not used
rtl8xxxu/rtl8xxxu.c:217:35: error: 'rtl8188r_power_base' defined but not used

This adds an extra #ifdef around them to shut up the warnings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 2fc0b8e5a17d ("rtl8xxxu: Add TX power base values for gen1 parts")
Fixes: 4062b8ffec36 ("rtl8xxxu: Move PHY RF init into device specific functions")
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoath10k: remove enum ath10k_swap_code_seg_bin_type
Kalle Valo [Wed, 20 Apr 2016 16:46:16 +0000 (19:46 +0300)]
ath10k: remove enum ath10k_swap_code_seg_bin_type

It's not needed for anything so just get rid of it.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: switch testmode to use ath10k_core_fetch_firmware_api_n()
Kalle Valo [Wed, 20 Apr 2016 16:46:01 +0000 (19:46 +0300)]
ath10k: switch testmode to use ath10k_core_fetch_firmware_api_n()

Now that all firmware-N.bin related are within struct ath10k_fw_file we can
switch to use ath10k_core_fetch_firmware_api_n() and delete almost identical
ath10k_tm_fetch_utf_firmware_api_2().

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: move htt_op_version to struct ath10k_fw_file
Kalle Valo [Wed, 20 Apr 2016 16:45:47 +0000 (19:45 +0300)]
ath10k: move htt_op_version to struct ath10k_fw_file

Preparation for testmode.c to use ath10k_core_fetch_board_data_api_n().

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: move wmi_op_version to struct ath10k_fw_file
Kalle Valo [Wed, 20 Apr 2016 16:45:33 +0000 (19:45 +0300)]
ath10k: move wmi_op_version to struct ath10k_fw_file

Preparation for testmode.c to use ath10k_core_fetch_board_data_api_n().

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: move fw_features to struct ath10k_fw_file
Kalle Valo [Wed, 20 Apr 2016 16:45:18 +0000 (19:45 +0300)]
ath10k: move fw_features to struct ath10k_fw_file

Preparation for testmode.c to use ath10k_core_fetch_board_data_api_n().

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: move fw_version inside struct ath10k_fw_file
Kalle Valo [Wed, 20 Apr 2016 16:45:05 +0000 (19:45 +0300)]
ath10k: move fw_version inside struct ath10k_fw_file

Preparation for testmode.c to use ath10k_core_fetch_board_data_api_n().

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: refactor firmware images to struct ath10k_fw_components
Kalle Valo [Wed, 20 Apr 2016 16:44:51 +0000 (19:44 +0300)]
ath10k: refactor firmware images to struct ath10k_fw_components

To make it easier to share ath10k_core_fetch_board_data_api_n() with testmode.c
refactor all firmware components to struct ath10k_fw_components. This structure
will hold firmware related files, for example firmware-N.bin and board-N.bin.

For firmware-N.bin create a new struct ath10k_fw_file which contains the actual
firmware image as well as the parsed data from the image.

Modify ath10k_core_start() to take struct ath10k_fw_components() as an argument
which makes it possible in following patches to drop some ugly hacks from
testmode.c.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: remove deprecated firmware API 1 support
Kalle Valo [Wed, 20 Apr 2016 16:44:36 +0000 (19:44 +0300)]
ath10k: remove deprecated firmware API 1 support

This has ben deprecated years ago, I haven't heard anyone using it since and
most likely it won't even work anymore. So just remove all of it.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: remove duplicate assignment of variable ah
Colin Ian King [Sun, 10 Apr 2016 11:25:31 +0000 (12:25 +0100)]
ath9k: remove duplicate assignment of variable ah

ah is written twice with the same value, remove one of the
redundant assignments to ah.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: interpret requested txpower in EIRP domain
Zefir Kurtisi [Fri, 1 Apr 2016 09:37:08 +0000 (11:37 +0200)]
ath9k: interpret requested txpower in EIRP domain

Tx power limitations at upper layers are interpreted in
the EIRP domain. When the user requests a given maximum
txpower, e.g. with: 'iw phy0 set txpower fixed 1500',
he expects the EIRP to be at or below 15dBm.

In ath9k_hw_apply_txpower(), the interpretation is
different: the antenna-gain is capped against the
current txpower limit in the regulatory, but not
against the user set value. It ensures that the
resulting EIRP is below the limit defined by the
active countrycode, but not below the value the
user requested.

In a scenario like e.g.
 a) antenna_gain=6
 b) countrycode limits to eirp=18
 c) user set txpower=15
this will cause a setting for AR_PHY_POWER_TX_RATE
regs resulting in an EIRP > 15.

This patch ensures that antenna-gain is considered
whenever the txpower limit is adjusted and with that
the user set limits are kept.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()
Markus Elfring [Fri, 1 Jan 2016 18:09:32 +0000 (19:09 +0100)]
ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

Replace an explicit initialisation for one local variable at the beginning
by a conditional assignment.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add dynamic tx mode switch config support for qca4019
Raja Mani [Tue, 12 Apr 2016 14:45:53 +0000 (20:15 +0530)]
ath10k: add dynamic tx mode switch config support for qca4019

push-pull mode needs certain amount the host driver involvement for
managing queues in the host memory and packet delivery to firmware.
qca4019 wifi firmware has an option to stay in push mode for less
number of active traffic flow and then switch to push-pull mode when
the active traffic flow goes beyond the certain limit.

The advantage of staying in push mode for less active traffic is, the
host cpu consumption is reduced. qca4019 firmware supports this
flexibility of the mode switch. It takes the host driver interest
(LOW_PERF/HIGH_PERF) via WMI_EXT_RESOURCE_CFG_CMDID,

 LOW_PERF  - fw would stay in push mode and switch to push-pull
               based on demand.
 HIGH_PERF - fw would stay in push-pull mode from the boot.

To make this configuration generic, new WMI services
WMI_SERVICE_TX_MODE_PUSH_ONLY, WMI_SERVICE_TX_MODE_PUSH_PULL,
WMI_SERVICE_TX_MODE_DYNAMIC are introduced to take dynamic tx mode
switch support availability in firmware.
Based on WMI_SERVICE_TX_MODE_DYNAMIC, LOW_PERF or HIGHT_PERF is
configured to the firmware.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add some sanity checks to peer_map_event() functions
Dan Carpenter [Mon, 11 Apr 2016 08:15:20 +0000 (11:15 +0300)]
ath10k: add some sanity checks to peer_map_event() functions

Smatch complains that since "ev->peer_id" comes from skb->data that
means we can't trust it and have to do a bounds check on it to prevent
an array overflow.

Fixes: 6942726f7f7b ('ath10k: add fast peer_map lookup')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix rx_channel during hw reconfigure
Rajkumar Manoharan [Thu, 7 Apr 2016 06:41:54 +0000 (12:11 +0530)]
ath10k: fix rx_channel during hw reconfigure

Upon firmware assert, restart work will be triggered so that mac80211
will reconfigure the driver. An issue is reported that after restart
work, survey dump data do not contain in-use (SURVEY_INFO_IN_USE) info
for operating channel. During reconfigure, since mac80211 already has
valid channel context for given radio, channel context iteration return
num_chanctx > 0. Hence rx_channel is always NULL. Fix this by assigning
channel context to rx_channel when driver restart is in progress.

Cc: stable@vger.kernel.org
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix return value for btcoex and peer stats debugfs
Mohammed Shafi Shajakhan [Tue, 5 Apr 2016 15:28:26 +0000 (20:58 +0530)]
ath10k: fix return value for btcoex and peer stats debugfs

Return value is incorrect for btcoex and peer stats debugfs
'write' entries if the user provides a value that matches with
the already available debugfs entry, this results in the debugfs
entry getting stuck and the operation has to be terminated manually.
Fix this by returning the appropriate return 'count' as we do it for
other debugfs entries like pktlog etc.

Fixes: cc61a1bbbc0e ("ath10k: enable debugfs provision to enable Peer Stats feature")
Fixes: c28e6f06ff40 ("ath10k: fix sanity check on enabling btcoex via debugfs")
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agortl8xxxu: MAINTAINERS: Update to point to the active devel branch
Jes Sorensen [Thu, 14 Apr 2016 20:37:21 +0000 (16:37 -0400)]
rtl8xxxu: MAINTAINERS: Update to point to the active devel branch

Update the MAINTAINERS info to reflect active development of the
rtl8xxxu driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Pause TX before calling disable_rf()
Jes Sorensen [Thu, 14 Apr 2016 20:37:20 +0000 (16:37 -0400)]
rtl8xxxu: Pause TX before calling disable_rf()

All the disable_rf() functions were setting REG_TXPAUSE to 0xff to
stop transmission. Do it centrally before calling disable_rf()
instead.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement rtl8192e_enable_rf()
Jes Sorensen [Thu, 14 Apr 2016 20:37:19 +0000 (16:37 -0400)]
rtl8xxxu: Implement rtl8192e_enable_rf()

This implements an 8192eu specific enable_rf() function. The 8192eu is
not a combo device, so no need for doing the BT specific bits needed
by the 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix OOPS if user tries to add device via /sys
Jes Sorensen [Thu, 14 Apr 2016 20:37:18 +0000 (16:37 -0400)]
rtl8xxxu: Fix OOPS if user tries to add device via /sys

This driver relies on driver_info in struct usb_device_id, so allowing
adding a device via /sys/bus/usb/drivers/rtl8xxxu/new_id will cause a
NULL pointer dereference.

Set .no_dynamic_id = 1 to disable hot add of USB IDs.

Reported-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix 8188RU support
Jes Sorensen [Thu, 14 Apr 2016 20:37:17 +0000 (16:37 -0400)]
rtl8xxxu: Fix 8188RU support

The 8188RU does not like PAPE to be enabled, while all the other gen1
parts seem to require it.

This makes the RTL8188RU able to associate for me.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add TX power base values for gen1 parts
Jes Sorensen [Thu, 14 Apr 2016 20:37:16 +0000 (16:37 -0400)]
rtl8xxxu: Add TX power base values for gen1 parts

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set register 0xfe10 on rtl8192cu based parts
Jes Sorensen [Thu, 14 Apr 2016 20:37:15 +0000 (16:37 -0400)]
rtl8xxxu: Set register 0xfe10 on rtl8192cu based parts

This register is undocumented in the vendor code, but it is set
unconditionally for all 8192cu/8188cu/8188ru parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Update copyright statement to include 2016
Jes Sorensen [Thu, 14 Apr 2016 20:37:14 +0000 (16:37 -0400)]
rtl8xxxu: Update copyright statement to include 2016

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Unregister from mac80211 before shutting down the device
Jes Sorensen [Thu, 14 Apr 2016 20:37:13 +0000 (16:37 -0400)]
rtl8xxxu: Unregister from mac80211 before shutting down the device

This fixes a long standing bug where mac80211 would send disconnect
packets to the device, after we had shut down the device.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Match 8723bu power down sequence to vendor driver
Jes Sorensen [Thu, 14 Apr 2016 20:37:12 +0000 (16:37 -0400)]
rtl8xxxu: Match 8723bu power down sequence to vendor driver

In particular set APS_FSMCO_WLON_RESET in the right register, and do
not overwrite too much of REG_CR.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use rtl_chip == RTL8188R to identify high PA parts
Jes Sorensen [Thu, 14 Apr 2016 20:37:11 +0000 (16:37 -0400)]
rtl8xxxu: Use rtl_chip == RTL8188R to identify high PA parts

This is simpler than checking for RTL8188C && hi_pa.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Apply 8188RU workaround for UMC B cut parts correctly
Jes Sorensen [Thu, 14 Apr 2016 20:37:10 +0000 (16:37 -0400)]
rtl8xxxu: Apply 8188RU workaround for UMC B cut parts correctly

This patch was being missed since rtl_chip will never match RTL8188C
if hi_pa is true.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: For devices with external PA (8188RU), limit CCK TX power
Jes Sorensen [Thu, 14 Apr 2016 20:37:09 +0000 (16:37 -0400)]
rtl8xxxu: For devices with external PA (8188RU), limit CCK TX power

Per the vendor driver, devices with an external PA needs limiting it's
TX power to 0x20.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Move PHY RF init into device specific functions
Jes Sorensen [Thu, 14 Apr 2016 20:37:08 +0000 (16:37 -0400)]
rtl8xxxu: Move PHY RF init into device specific functions

Load the RF table in init_phy_rf(), which allows for applying device
specific RF hacks in the same place. Getting rid of more ugly if ()
clutter.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: fix uninitialized return value in ret
Colin Ian King [Thu, 14 Apr 2016 20:37:07 +0000 (16:37 -0400)]
rtl8xxxu: fix uninitialized return value in ret

several functions are not initializing a return status in ret
resulting in garbage to be returned instead of 0 for success.
Currently, the calls to these functions are not checking the
return, however, it seems prudent to return the correct status
in case they are to be checked at a later date.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Mark 0x050d:0x1004 as tested
Jes Sorensen [Thu, 14 Apr 2016 20:37:06 +0000 (16:37 -0400)]
rtl8xxxu: Mark 0x050d:0x1004 as tested

This dongle was tested successfully by Andrea Merello

Reported-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>