platform/kernel/linux-rpi.git
8 years agortl8723au: Update TX descriptor words 4 and 5 definitions
Jes Sorensen [Mon, 29 Feb 2016 22:05:33 +0000 (17:05 -0500)]
rtl8723au: Update TX descriptor words 4 and 5 definitions

TX data words 4 and 5 differ significantly between 32 byte and 40 byte
descriptors.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set sequence number correctly for 40 byte TX descriptors
Jes Sorensen [Mon, 29 Feb 2016 22:05:32 +0000 (17:05 -0500)]
rtl8xxxu: Set sequence number correctly for 40 byte TX descriptors

SEQ changed location in the 40 byte TX descriptor. Set it correctly.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set the correct TX descriptor bits for agg and break on 8723b
Jes Sorensen [Mon, 29 Feb 2016 22:05:31 +0000 (17:05 -0500)]
rtl8xxxu: Set the correct TX descriptor bits for agg and break on 8723b

Fixup victim of the relocated bits for AGG_ENABLE/AGG_BREAK in the 40
byte TX descriptor

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add more 40 byte TX desc bit definitions
Jes Sorensen [Mon, 29 Feb 2016 22:05:30 +0000 (17:05 -0500)]
rtl8xxxu: Add more 40 byte TX desc bit definitions

Add additional bit definitions for 40 byte TX descriptors, and rename
bits for 32 byte descriptors that are located differently in the 40
byte descriptor format.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add additional tx descriptor bits for data word 0
Jes Sorensen [Mon, 29 Feb 2016 22:05:29 +0000 (17:05 -0500)]
rtl8xxxu: Add additional tx descriptor bits for data word 0

This adds documentation for some additional bits in TX descriptor word
0.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not unconditionally print debug info in rtl8723bu_handle_c2h()
Jes Sorensen [Mon, 29 Feb 2016 22:05:28 +0000 (17:05 -0500)]
rtl8xxxu: Do not unconditionally print debug info in rtl8723bu_handle_c2h()

Reduce the log level in rtl8723bu_handle_c2h()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle 40 byte TX descriptors for rtl8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:27 +0000 (17:05 -0500)]
rtl8xxxu: Handle 40 byte TX descriptors for rtl8723bu

Note the descriptor checksum is still only calculated over the initial
32 bytes of the descriptor, ignoring the last 8 bytes of the
descriptor.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add definition for 8723bu tx descriptor
Jes Sorensen [Mon, 29 Feb 2016 22:05:26 +0000 (17:05 -0500)]
rtl8xxxu: Add definition for 8723bu tx descriptor

Newer generation chips use a 40 byte TX descriptor, compared to the
32 byte descriptor used on older chips.

This adds the definition for the 40 byte descriptor.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set the correct thermal meter register for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:25 +0000 (17:05 -0500)]
rtl8xxxu: Set the correct thermal meter register for 8723bu

Older chips use RF register 0x24 to set the thermal meter. Newer chips
use register 0x42.

This change makes sure to set the correct thermal meter register
depending on the chip.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set 8723bu MCS TX power
Jes Sorensen [Mon, 29 Feb 2016 22:05:24 +0000 (17:05 -0500)]
rtl8xxxu: Set 8723bu MCS TX power

This adds the missing support for setting MCS TX power rates on 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set 8723bu TX power for CCK and OFDM rates
Jes Sorensen [Mon, 29 Feb 2016 22:05:23 +0000 (17:05 -0500)]
rtl8xxxu: Set 8723bu TX power for CCK and OFDM rates

This implements support for setting TX power for CCK and OFDM rates on
8723bu. MCS rates is still pending.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Parse efuse power indices for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:22 +0000 (17:05 -0500)]
rtl8xxxu: Parse efuse power indices for 8723bu

This should (hopefully) parse the power indices correctly for the
8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Bump TX power arrays to handle larger channel groups
Jes Sorensen [Mon, 29 Feb 2016 22:05:21 +0000 (17:05 -0500)]
rtl8xxxu: Bump TX power arrays to handle larger channel groups

Newer generation chips have more channels groups. In order to carry
the larger arrays in common structures, bump the array sizes to
match.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use size of source pointer when copying efuse data
Jes Sorensen [Mon, 29 Feb 2016 22:05:20 +0000 (17:05 -0500)]
rtl8xxxu: Use size of source pointer when copying efuse data

Some newer chips have more channel groups in their efuse parameter
tables, so use the size of the source, rather than the destination
when copying them out. This avoids copying garbage when increasing the
common array sizes.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Introduce set_tx_power() fileop and a new 8723b dummy derivative
Jes Sorensen [Mon, 29 Feb 2016 22:05:19 +0000 (17:05 -0500)]
rtl8xxxu: Introduce set_tx_power() fileop and a new 8723b dummy derivative

The 8723b series is significantly different from the older generation
in this sense. So far the 8723b version doesn't do anything useful.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Correct struct rtl8723bu_efuse to list power bases correctly
Jes Sorensen [Mon, 29 Feb 2016 22:05:18 +0000 (17:05 -0500)]
rtl8xxxu: Correct struct rtl8723bu_efuse to list power bases correctly

Correct TX power definitions in rtl8723bu_efuse

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not use hard-wired RF enable settings for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:17 +0000 (17:05 -0500)]
rtl8xxxu: Do not use hard-wired RF enable settings for 8723bu

These settings simply block the 8723bu, for now leave an empty
function.

With this change we can finally communicate with aliens using the
8723bu!

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Setup coex table correctly (hopefully)
Jes Sorensen [Mon, 29 Feb 2016 22:05:16 +0000 (17:05 -0500)]
rtl8xxxu: Setup coex table correctly (hopefully)

Use the same values as the vendor driver when setting up the BTCOEX
table for 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use REG_RFE_CTRL_ANTA_SRC rather than hard coded value
Jes Sorensen [Mon, 29 Feb 2016 22:05:15 +0000 (17:05 -0500)]
rtl8xxxu: Use REG_RFE_CTRL_ANTA_SRC rather than hard coded value

Another case where we should use the register name rather than the
hard coded value when accessing it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use name for REG_RFE_BUFFER rather than hard coded value
Jes Sorensen [Mon, 29 Feb 2016 22:05:14 +0000 (17:05 -0500)]
rtl8xxxu: Use name for REG_RFE_BUFFER rather than hard coded value

Register 0x0944 is REG_RFE_BUFFER. Use the name rather than hard coded
value when accessing it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: 8723bu: REG_BT_COEX_TABLE4 is only 8 bits
Jes Sorensen [Mon, 29 Feb 2016 22:05:13 +0000 (17:05 -0500)]
rtl8xxxu: 8723bu: REG_BT_COEX_TABLE4 is only 8 bits

The BT_COEX_TABLE register list contains 3 32 bit registers and one 8
bit register. Hence, use rtl8xxxu_write8() when writing the 8 bit
register.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set WLAN_ACT_CONTROL per vendor driver setting
Jes Sorensen [Mon, 29 Feb 2016 22:05:12 +0000 (17:05 -0500)]
rtl8xxxu: Set WLAN_ACT_CONTROL per vendor driver setting

The initial code set the wrong setting in WLAN_ACT_CONTROL for the
8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: RF_T_METER is different on the newer chips
Jes Sorensen [Mon, 29 Feb 2016 22:05:11 +0000 (17:05 -0500)]
rtl8xxxu: RF_T_METER is different on the newer chips

Provide RF_T_METER register location for nextgen chips.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement init_statistics for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:10 +0000 (17:05 -0500)]
rtl8xxxu: Implement init_statistics for 8723bu

Vendor driver implements this for 8723b and 8821 series

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add missing blank space in front of bracket
Jes Sorensen [Mon, 29 Feb 2016 22:05:09 +0000 (17:05 -0500)]
rtl8xxxu: Add missing blank space in front of bracket

Keep the automated tools happy

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Setup RX aggregation
Jes Sorensen [Mon, 29 Feb 2016 22:05:08 +0000 (17:05 -0500)]
rtl8xxxu: Setup RX aggregation

This initializes RX DMA aggregation on 8723bu. We should do this for
all parts eventually, and also init TX aggregation.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Group chip quirks together
Jes Sorensen [Mon, 29 Feb 2016 22:05:07 +0000 (17:05 -0500)]
rtl8xxxu: Group chip quirks together

Group chip quirks together instead of having them scattered all over
in the init code.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add REG_DWBCN1_CTRL_8723B define
Jes Sorensen [Mon, 29 Feb 2016 22:05:06 +0000 (17:05 -0500)]
rtl8xxxu: Add REG_DWBCN1_CTRL_8723B define

List yet another new register found on the 8723b.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: 8723bu lock phy after RF init
Jes Sorensen [Mon, 29 Feb 2016 22:05:05 +0000 (17:05 -0500)]
rtl8xxxu: 8723bu lock phy after RF init

Set PHY lock after running the RF init sequence on 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Call device specific _config_channel()
Jes Sorensen [Mon, 29 Feb 2016 22:05:04 +0000 (17:05 -0500)]
rtl8xxxu: Call device specific _config_channel()

Having a version for the newer chips without calling it doesn't do
much good.....

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initialize burst parameters for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:03 +0000 (17:05 -0500)]
rtl8xxxu: Initialize burst parameters for 8723bu

Implement burst parameter sequence for 8723bu parts. Eventually this
should be moved into device specific sections.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set RX boundary for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:02 +0000 (17:05 -0500)]
rtl8xxxu: Set RX boundary for 8723bu

Set the correct TRXFF boundary for 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not set FPGA0_TX_INFO for 8723bu and use a larger PBP page size
Jes Sorensen [Mon, 29 Feb 2016 22:05:01 +0000 (17:05 -0500)]
rtl8xxxu: Do not set FPGA0_TX_INFO for 8723bu and use a larger PBP page size

The vendor driver does not set FPGA0_TX_INFO here. In additiona the
8723bu can handler a larger PBP page size.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do queue init in same order as 8723bu vendor driver
Jes Sorensen [Mon, 29 Feb 2016 22:05:00 +0000 (17:05 -0500)]
rtl8xxxu: Do queue init in same order as 8723bu vendor driver

Reorganize the init sequence in order to be able to compare to the
8723bu vendor driver's init sequence.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: 80M spur hack is for 8723au only
Jes Sorensen [Mon, 29 Feb 2016 22:04:59 +0000 (17:04 -0500)]
rtl8xxxu: 80M spur hack is for 8723au only

Only apply the 80M spur hack for 8723au parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Init H2C command register for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:58 +0000 (17:04 -0500)]
rtl8xxxu: Init H2C command register for 8723bu

In addition make register read/write flow match closer to vendor
driver flow. This is mainly to be able to compare the register write
log with the vendor driver, and can be optimized later once 8723bu
support is working.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Another 8723bu magic register set during init
Jes Sorensen [Mon, 29 Feb 2016 22:04:57 +0000 (17:04 -0500)]
rtl8xxxu: Another 8723bu magic register set during init

No indication of what register 0xa3 does anywhere in the vendor source.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Another 8723bu patch for rtl8xxxu_init_phy_bb()
Jes Sorensen [Mon, 29 Feb 2016 22:04:56 +0000 (17:04 -0500)]
rtl8xxxu: Another 8723bu patch for rtl8xxxu_init_phy_bb()

This function is going to need to be split up into chip specific
variants.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle XTAL_K value in efuse specific location
Jes Sorensen [Mon, 29 Feb 2016 22:04:55 +0000 (17:04 -0500)]
rtl8xxxu: Handle XTAL_K value in efuse specific location

Retrieve the XTAL_K value in the parse_efuse() functions as it's
location various on a per device basis. For parts that do not provide
an XTAL_K value, skip setting it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Additional fixes for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:54 +0000 (17:04 -0500)]
rtl8xxxu: Additional fixes for 8723bu

Additional tweaks to further map the init sequence for the 8723bu to
that of the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Setup LLT before downloading firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:53 +0000 (17:04 -0500)]
rtl8xxxu: Setup LLT before downloading firmware

This matches the order of the 8723bu vendor driver

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement 8723bu power on sequence
Jes Sorensen [Mon, 29 Feb 2016 22:04:52 +0000 (17:04 -0500)]
rtl8xxxu: Implement 8723bu power on sequence

This implements the 8723bu specific power on sequence as it is
different from that of the 8723au chips.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not set REG_AFE_XTAL_CTRL on 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:51 +0000 (17:04 -0500)]
rtl8xxxu: Do not set REG_AFE_XTAL_CTRL on 8723bu

The 8723bu does not like REG_AFE_XTAL_CTRL being set, so skip this for
now, to match the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Issue BT_INFO command
Jes Sorensen [Mon, 29 Feb 2016 22:04:50 +0000 (17:04 -0500)]
rtl8xxxu: Issue BT_INFO command

Issue a BT_INFO command to verify the status of BT/WiFi settings.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle BT register writes and MP_OPER events
Jes Sorensen [Mon, 29 Feb 2016 22:04:49 +0000 (17:04 -0500)]
rtl8xxxu: Handle BT register writes and MP_OPER events

8723bu BT registers are written via the mailbox interface. Add support
for writing these and corresponding C2H event responses.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initial functionality to handle C2H events for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:48 +0000 (17:04 -0500)]
rtl8xxxu: Initial functionality to handle C2H events for 8723bu

The 64 bit mailbox commands also provide a different method for
mailbox command responses (C2H events).

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle 8723bu style rx descriptors
Jes Sorensen [Mon, 29 Feb 2016 22:04:47 +0000 (17:04 -0500)]
rtl8xxxu: Handle 8723bu style rx descriptors

This adds code to parse the new RX descriptor format used by the
8723bu/8192eu parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723bu (nextgen) rx descriptor definition
Jes Sorensen [Mon, 29 Feb 2016 22:04:46 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723bu (nextgen) rx descriptor definition

The nextgen chips use a slightly different RX descriptor format. This
adds support for the new format.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set the right type for ps tdma on 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:45 +0000 (17:04 -0500)]
rtl8xxxu: Set the right type for ps tdma on 8723bu

Use the correct type when setting PS TDMA for 8723bu. This matches the
vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not ignore wlan activity on 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:44 +0000 (17:04 -0500)]
rtl8xxxu: Do not ignore wlan activity on 8723bu

The 8723bu is a WiFi/BT combo part. When initializing it for WiFi,
make sure to tell it not to ignore WiFi activity.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Improve 8723bu init code
Jes Sorensen [Mon, 29 Feb 2016 22:04:43 +0000 (17:04 -0500)]
rtl8xxxu: Improve 8723bu init code

Implement additional init sequence code for the 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove unused variable
Jes Sorensen [Mon, 29 Feb 2016 22:04:42 +0000 (17:04 -0500)]
rtl8xxxu: Remove unused variable

Remove an unused variable to make the compiler happy.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initial rtl8723bu_init_bt() code
Jes Sorensen [Mon, 29 Feb 2016 22:04:41 +0000 (17:04 -0500)]
rtl8xxxu: Initial rtl8723bu_init_bt() code

This should initialize the antennas on the 8723bu, but so far I am
still not receiving anything :( More work is needed.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initial implementation of rtl8723bu_config_channel()
Jes Sorensen [Mon, 29 Feb 2016 22:04:40 +0000 (17:04 -0500)]
rtl8xxxu: Initial implementation of rtl8723bu_config_channel()

This is a first stab of implementing rtl8723bu_config_channel(). For
now this will only do 20MHz channels.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8192eu: Map out EFUSE TX power area
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:39 +0000 (17:04 -0500)]
rtl8xxxu: rtl8192eu: Map out EFUSE TX power area

TX power values are laid out differently in EFUSE found in RTL8192EU &
RTL8188EU devices.  TX power indices and differences for each RF path
are not interleaved (A, B, A, B), as in other chips, but follow one
another (A, B, C, D).

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove backing up certain registers, which was never used
Jes Sorensen [Mon, 29 Feb 2016 22:04:38 +0000 (17:04 -0500)]
rtl8xxxu: Remove backing up certain registers, which was never used

This was inspired by the vendor driver, but in the end never used for
anything.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do LC calibration before IQK calibration
Jes Sorensen [Mon, 29 Feb 2016 22:04:37 +0000 (17:04 -0500)]
rtl8xxxu: Do LC calibration before IQK calibration

This matches the flow of the vendor driver for newer hardware, and
doesn't seem to cause issues for the older parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle S0S1 register in lc_calibrate()
Jes Sorensen [Mon, 29 Feb 2016 22:04:36 +0000 (17:04 -0500)]
rtl8xxxu: Handle S0S1 register in lc_calibrate()

Newer chips (8723bu/8192eu) has S0S1 settings which needs to be dealt
with during LC calibration.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: First stab at adding IQK calibration for 8723bu parts
Jes Sorensen [Mon, 29 Feb 2016 22:04:35 +0000 (17:04 -0500)]
rtl8xxxu: First stab at adding IQK calibration for 8723bu parts

The 8723bu also has it's own IQK calibration process. This is similar
in flow, but still different enough to warrent it's own
implementation, at least for now.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add a couple of new register definitions
Jes Sorensen [Mon, 29 Feb 2016 22:04:34 +0000 (17:04 -0500)]
rtl8xxxu: Add a couple of new register definitions

This adds some additional register definitions for 8723bu, as well as
a bit define for USB RXDMA aggregation in REG_RXDMA_AGG_PG_TH.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Make rtl8xxxu_add_path_on() use device specific init values
Jes Sorensen [Mon, 29 Feb 2016 22:04:33 +0000 (17:04 -0500)]
rtl8xxxu: Make rtl8xxxu_add_path_on() use device specific init values

rtl8192cu/rtl8188cu/rtl8723au use the same values, but 8723bu and
8192eu have their own.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use correct formatting type to print sizeof()
Jes Sorensen [Mon, 29 Feb 2016 22:04:32 +0000 (17:04 -0500)]
rtl8xxxu: Use correct formatting type to print sizeof()

Usual gcc i386 issue reported by kbuildbot

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not overwrite rtl8xxxu_debug for untested chips
Jes Sorensen [Mon, 29 Feb 2016 22:04:31 +0000 (17:04 -0500)]
rtl8xxxu: Do not overwrite rtl8xxxu_debug for untested chips

Fix a silly bug where the debug level was overwritten rather than
amended for untested chips.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do BT_WLAN_CALIBRATION before doing IQK calibration
Jes Sorensen [Mon, 29 Feb 2016 22:04:30 +0000 (17:04 -0500)]
rtl8xxxu: Do BT_WLAN_CALIBRATION before doing IQK calibration

Newer generation chips require the firmware be notified before we
start the IQK calibration.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8xxxu_h2c_cmd(): Add size argument
Jes Sorensen [Mon, 29 Feb 2016 22:04:29 +0000 (17:04 -0500)]
rtl8xxxu: rtl8xxxu_h2c_cmd(): Add size argument

The firmware command API differs slightly between new and old
devices. The new generation requires the size since there is no
extension bit encoded into the command number.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8723bu_parse_efuse(): Use a pointer to the struct rtl8723bu_efuse
Jes Sorensen [Mon, 29 Feb 2016 22:04:28 +0000 (17:04 -0500)]
rtl8xxxu: rtl8723bu_parse_efuse(): Use a pointer to the struct rtl8723bu_efuse

Likewise for 8723bu, use a pointer to the efuse.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8192eu_parse_efuse(): Use a pointer to the struct rtl8192eu_efuse
Jes Sorensen [Mon, 29 Feb 2016 22:04:27 +0000 (17:04 -0500)]
rtl8xxxu: rtl8192eu_parse_efuse(): Use a pointer to the struct rtl8192eu_efuse

Make the code easier to read and less error prone by using a pointer
to the efuse.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8192cu: Introduce a pointer to efuse
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:26 +0000 (17:04 -0500)]
rtl8xxxu: rtl8192cu: Introduce a pointer to efuse

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8723au: Introduce a pointer to efuse
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:25 +0000 (17:04 -0500)]
rtl8xxxu: rtl8723au: Introduce a pointer to efuse

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Skip disabled efuse words early
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:24 +0000 (17:04 -0500)]
rtl8xxxu: Skip disabled efuse words early

Avoid a negative conditional and an extra level of indentation in the
bigger part of the loop body.

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Don't check for illegal offset when reading from efuse
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:23 +0000 (17:04 -0500)]
rtl8xxxu: Don't check for illegal offset when reading from efuse

It is enough to check for either illegal offset or illegal map address
because map address is a value derived from an offset:

  map_addr = offset * 8
  EFUSE_MAP_LEN = EFUSE_MAX_SECTION_8723A * 8

Leave just the check for an illegal map address because its upper
bound (EFUSE_MAP_LEN) is used also in a couple other places.

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add definitions for new generation h2c commands
Jes Sorensen [Mon, 29 Feb 2016 22:04:22 +0000 (17:04 -0500)]
rtl8xxxu: Add definitions for new generation h2c commands

The larger mailboxes also use a different set of mailbox commands.
This provides a list of the 64 bit commands.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Group USB fixups together for all chips
Jes Sorensen [Mon, 29 Feb 2016 22:04:21 +0000 (17:04 -0500)]
rtl8xxxu: Group USB fixups together for all chips

In addition do not apply fixups for 8188/8191/8192 A-cut UMC parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add some missing register definitions for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:20 +0000 (17:04 -0500)]
rtl8xxxu: Add some missing register definitions for 8723bu

This introduces additional register definitions for newer generation
chips.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle 32 bit mailbox extension regs found on 8723bu/8192eu/8812
Jes Sorensen [Mon, 29 Feb 2016 22:04:19 +0000 (17:04 -0500)]
rtl8xxxu: Handle 32 bit mailbox extension regs found on 8723bu/8192eu/8812

Gen1 chips use a 16 bit mailbox extension register, for upto 48 bit
mailbox commands. The newer generation chips use a 32 bit mailbox
extension register instead, for upto 64 bit mailbox commands.

Handle writing the larger mailboxes.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add 8723by AGC table
Jes Sorensen [Mon, 29 Feb 2016 22:04:18 +0000 (17:04 -0500)]
rtl8xxxu: Add 8723by AGC table

The different RF module seems to require a different AGC table as well

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723b_mac_init_table
Jes Sorensen [Mon, 29 Feb 2016 22:04:17 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723b_mac_init_table

Newer chips seem to have some different mac registers, requiring
a different init table.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723bu_phy_init_antenna_selection()
Jes Sorensen [Mon, 29 Feb 2016 22:04:16 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723bu_phy_init_antenna_selection()

So far this is just for 8723BU. It includes writing to a number of
registers I have seen no description for so far.

0x0064
0x0930
0x0944

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723bu_radioa_1t_init_table
Jes Sorensen [Mon, 29 Feb 2016 22:04:15 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723bu_radioa_1t_init_table

Add 8723bu 1T radio init table. The vendor driver indicates that some
registers need special treatment for TFBGA90, TFBGA80, and TFBGA79
packaging. However the vendor driver never actually checks the package
type, so just stick to default values here.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723b_phy_1t_init_table
Jes Sorensen [Mon, 29 Feb 2016 22:04:14 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723b_phy_1t_init_table

This adds the 8723bu PHY 1T init table.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Only setup USB interrupts for parts which support it
Jes Sorensen [Mon, 29 Feb 2016 22:04:13 +0000 (17:04 -0500)]
rtl8xxxu: Only setup USB interrupts for parts which support it

Only 1st generation chips do provide USB interrupts, so do not try to
setup interrupts for newer chips (8192eu and 8723bu).

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use 1024 byte writes for writing 8723bu firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:12 +0000 (17:04 -0500)]
rtl8xxxu: Use 1024 byte writes for writing 8723bu firmware

The 8723bu, like the 8192eu, can also handle 1024 byte block writes.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723bu_parse_efuse() and 8723bu efuse definition
Jes Sorensen [Mon, 29 Feb 2016 22:04:11 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723bu_parse_efuse() and 8723bu efuse definition

Implement first stab at parsing the 8723bu's efuse.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initial rtl8723bu chip identification
Jes Sorensen [Mon, 29 Feb 2016 22:04:10 +0000 (17:04 -0500)]
rtl8xxxu: Initial rtl8723bu chip identification

This provides initial detection of 8723bu devices, and selects the
correct firmware image to load.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Init REG_HIMR[01] for 8192eu parts
Jes Sorensen [Mon, 29 Feb 2016 22:04:09 +0000 (17:04 -0500)]
rtl8xxxu: Init REG_HIMR[01] for 8192eu parts

The newer generation chips have different interrupt registers.
Initialize this correct registers on 8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Kludge to drop incorrect USB OUT EP for 8192EU
Jes Sorensen [Mon, 29 Feb 2016 22:04:08 +0000 (17:04 -0500)]
rtl8xxxu: Kludge to drop incorrect USB OUT EP for 8192EU

The 8192eu (and some other parts) will report an incorrect USB OUT
EP. This tells the chip to drop it - as per the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix incorrect test for auto LLT failure
Jes Sorensen [Mon, 29 Feb 2016 22:04:07 +0000 (17:04 -0500)]
rtl8xxxu: Fix incorrect test for auto LLT failure

The logic for testing auto load failure in rtl8xxxu_auto_llt_table()
was inverted.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Init the LLT after we start the firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:06 +0000 (17:04 -0500)]
rtl8xxxu: Init the LLT after we start the firmware

To match the flow of the vendor driver, move the LLT init to after the
firmware is started.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Init page boundaries before starting the firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:05 +0000 (17:04 -0500)]
rtl8xxxu: Init page boundaries before starting the firmware

This reorganizes the device initialization to init page boundaries
before starting the firmware. This matches the flow in the 8192eu
vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8xxxu_auto_llt_table()
Jes Sorensen [Mon, 29 Feb 2016 22:04:04 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8xxxu_auto_llt_table()

Newer chips can auto load the LLT table, it is no longer necessary to
build it manually in the driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implment rtl8192eu_power_on()
Jes Sorensen [Mon, 29 Feb 2016 22:04:03 +0000 (17:04 -0500)]
rtl8xxxu: Implment rtl8192eu_power_on()

This implements the rtl8192eu power on sequence, and splits it off
from the rtl8192cu/rtl8723au power on sequence.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8192eu_nic.bin to the MODULE_FIRMWARE list
Jes Sorensen [Mon, 29 Feb 2016 22:04:02 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8192eu_nic.bin to the MODULE_FIRMWARE list

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use 1024 byte block loads for 8192eu firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:01 +0000 (17:04 -0500)]
rtl8xxxu: Use 1024 byte block loads for 8192eu firmware

The rtl8192eu can handle 1024 byte block writes, unlike it's
predecessors (8192cu/8188cu).

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Identify chip vendors correctly
Jes Sorensen [Mon, 29 Feb 2016 22:04:00 +0000 (17:04 -0500)]
rtl8xxxu: Identify chip vendors correctly

This identifies the chip vendors correctly and also picks the correct
firmware for rtl8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add initial code to parse rtl8192eu efuse
Jes Sorensen [Mon, 29 Feb 2016 22:03:59 +0000 (17:03 -0500)]
rtl8xxxu: Add initial code to parse rtl8192eu efuse

This is the start of 8192eu support. For now just detect the device
and parse the efuse.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore/wl18xx: add radar_debug_mode handling
Eliad Peller [Sun, 6 Mar 2016 22:28:09 +0000 (00:28 +0200)]
wlcore/wl18xx: add radar_debug_mode handling

Add debugfs key (under CFG80211_CERTIFICATION_ONUS
configuration) to set/clear radar_debug_mode.
In this mode, the driver simply ignores radar
events (but prints them).

The fw is notified about this mode through
a special generic_cfg_feature command.

This mode is relevant only for ap mode. look for
it when initializing ap vif.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore: don't WARN_ON in case of existing ROC
Eliad Peller [Sun, 6 Mar 2016 22:28:08 +0000 (00:28 +0200)]
wlcore: don't WARN_ON in case of existing ROC

When working with AP + P2P, it's possible to get into
a state when the AP is in ROC (due to assiciating station)
while trying to ROC on the P2P interface.

Replace the WARN_ON with wl1271_error to avoid warnings
in this case.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: Empty Tx queue during suspend
Amitkumar Karwar [Wed, 9 Mar 2016 12:21:11 +0000 (04:21 -0800)]
mwifiex: Empty Tx queue during suspend

In cfg80211 suspend handler, stop the netif queue and
wait until all the Tx queues become empty. Start the
queues in resume handler.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Remove waitqueue_active check
Hui Wang [Wed, 9 Mar 2016 07:25:26 +0000 (15:25 +0800)]
brcmfmac: Remove waitqueue_active check

We met a problem of pm_suspend  when repeated closing/opening the lid
on a Lenovo laptop (1/20 reproduce rate), below is the log:

[ 199.735876] PM: Entering mem sleep
[ 199.750516] e1000e: EEE TX LPI TIMER: 00000011
[ 199.856638] Trying to free nonexistent resource <000000000000d000-000000000000d0ff>
[ 201.753566] brcmfmac: brcmf_pcie_suspend: Timeout on response for entering D3 substate
[ 201.753581] pci_legacy_suspend(): brcmf_pcie_suspend+0x0/0x1f0 [brcmfmac] returns -5
[ 201.753585] dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -5
[ 201.753589] PM: Device 0000:04:00.0 failed to suspend async: error -5

Through debugging, we found when problem happens, it is not the device
fails to enter D3, but the signal D3_ACK comes too early to pass the
waitqueue_active() check.

Just like this:
brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D3_INFORM);
// signal is triggered here
wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
   BRCMF_PCIE_MBDATA_TIMEOUT);

So far I think it is safe to remove waitqueue_active check since there
is only one place to trigger this signal (sending
BRCMF_H2D_HOST_D3_INFORM). And it is not a problem calling wake_up
event earlier than calling wait_event.

Cc: Brett Rudley <brudley@broadcom.com>
Cc: Hante Meuleman <meuleman@broadcom.com>
Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Cc: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Cc: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agolibertas: fix an error code in probe
Dan Carpenter [Tue, 8 Mar 2016 12:04:08 +0000 (15:04 +0300)]
libertas: fix an error code in probe

We accidentally return success instead of a negative error code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>