}
for (;;) {
gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1);
- /* completion.h does not provide any function to wait
- * completion without consume it (a kind of
- * wait_for_completion_done_timeout()). So we have to emulate
- * it.
+ /* completion.h does not provide any function to wait completion without consume it
+ * (a kind of wait_for_completion_done_timeout()). So we have to emulate it.
*/
if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, msecs_to_jiffies(2))) {
complete(&wdev->hif.ctrl_ready);
return;
} else if (max_retry-- > 0) {
- /* Older firmwares have a race in sleep/wake-up process.
- * Redo the process is sufficient to unfreeze the
- * chip.
+ /* Older firmwares have a race in sleep/wake-up process. Redo the process
+ * is sufficient to unfreeze the chip.
*/
dev_err(wdev->dev, "timeout while wake up chip\n");
gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0);
return i;
}
-/* In SDIO mode, it is necessary to make an access to a register to acknowledge
- * last received message. It could be possible to restrict this acknowledge to
- * SDIO mode and only if last operation was rx.
+/* In SDIO mode, it is necessary to make an access to a register to acknowledge last received
+ * message. It could be possible to restrict this acknowledge to SDIO mode and only if last
+ * operation was rx.
*/
static void ack_sdio_data(struct wfx_dev *wdev)
{
queue_work(system_highpri_wq, &wdev->hif.bh);
}
-/* If IRQ is not available, this function allow to manually poll the control
- * register and simulate an IRQ ahen an event happened.
+/* If IRQ is not available, this function allow to manually poll the control register and simulate
+ * an IRQ ahen an event happened.
*
- * Note that the device has a bug: If an IRQ raise while host read control
- * register, the IRQ is lost. So, use this function carefully (only duing
- * device initialisation).
+ * Note that the device has a bug: If an IRQ raise while host read control register, the IRQ is
+ * lost. So, use this function carefully (only duing device initialisation).
*/
void wfx_bh_poll_irq(struct wfx_dev *wdev)
{
bool need_swab;
};
-/* The chip reads 16bits of data at time and place them directly into (little
- * endian) CPU register. So, the chip expects bytes order to be "B1 B0 B3 B2"
- * (while LE is "B0 B1 B2 B3" and BE is "B3 B2 B1 B0")
+/* The chip reads 16bits of data at time and place them directly into (little endian) CPU register.
+ * So, the chip expects bytes order to be "B1 B0 B3 B2" (while LE is "B0 B1 B2 B3" and BE is
+ * "B3 B2 B1 B0")
*
- * A little endian host with bits_per_word == 16 should do the right job
- * natively. The code below to support big endian host and commonly used SPI
- * 8bits.
+ * A little endian host with bits_per_word == 16 should do the right job natively. The code below to
+ * support big endian host and commonly used SPI 8bits.
*/
static int wfx_spi_copy_from_io(void *priv, unsigned int addr, void *dst, size_t count)
{
static size_t wfx_spi_align_size(void *priv, size_t size)
{
- /* Most of SPI controllers avoid DMA if buffer size is not 32bit aligned
- */
+ /* Most of SPI controllers avoid DMA if buffer size is not 32bit aligned */
return ALIGN(size, 4);
}
if (arg->encryp)
hdr->flag |= RX_FLAG_DECRYPTED;
- /* Block ack negotiation is offloaded by the firmware. However,
- * re-ordering must be done by the mac80211.
+ /* Block ack negotiation is offloaded by the firmware. However, re-ordering must be done by
+ * the mac80211.
*/
if (ieee80211_is_action(frame->frame_control) &&
mgmt->u.action.category == WLAN_CATEGORY_BACK &&
}
return rate->idx + 14;
}
- /* The device only support 2GHz, else band information should be
- * retrieved from ieee80211_tx_info
+ /* The device only support 2GHz, else band information should be retrieved from
+ * ieee80211_tx_info
*/
band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
if (rate->idx >= band->n_bitrates) {
/* Fill tx request */
req = (struct wfx_hif_req_tx *)hif_msg->body;
- /* packet_id just need to be unique on device. 32bits are more than
- * necessary for that task, so we tae advantage of it to add some extra
- * data for debug.
+ /* packet_id just need to be unique on device. 32bits are more than necessary for that task,
+ * so we take advantage of it to add some extra data for debug.
*/
req->packet_id = atomic_add_return(1, &wvif->wdev->packet_id) & 0xFFFF;
req->packet_id |= IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)) << 16;
wvif = wvif_iterate(wdev, NULL);
if (WARN_ON(!wvif))
goto drop;
- /* Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any
- * BlockAck session management frame. The check below exist just in case.
+ /* Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any BlockAck session
+ * management frame. The check below exist just in case.
*/
if (wfx_is_action_back(hdr)) {
dev_info(wdev->dev, "drop BA action\n");
if (count < sizeof(struct wfx_hif_msg))
return -EINVAL;
- /* wfx_cmd_send() checks that reply buffer is wide enough, but does not
- * return precise length read. User have to know how many bytes should
- * be read. Filling reply buffer with a memory pattern may help user.
+ /* wfx_cmd_send() checks that reply buffer is wide enough, but does not return precise
+ * length read. User have to know how many bytes should be read. Filling reply buffer with a
+ * memory pattern may help user.
*/
memset(context->reply, 0xFF, sizeof(context->reply));
request = memdup_user(user_buf, count);
return ret;
if (context->ret < 0)
return context->ret;
- /* Be careful, write() is waiting for a full message while read()
- * only returns a payload
- */
+ /* Be careful, write() is waiting for a full message while read() only returns a payload */
if (copy_to_user(user_buf, context->reply, count))
return -EFAULT;
[ERR_MAC_KEY] = "MAC key not initialized",
};
-/* request_firmware() allocate data using vmalloc(). It is not compatible with
- * underlying hardware that use DMA. Function below detect this case and
- * allocate a bounce buffer if necessary.
+/* request_firmware() allocate data using vmalloc(). It is not compatible with underlying hardware
+ * that use DMA. Function below detect this case and allocate a bounce buffer if necessary.
*
- * Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to
- * detect this problem at runtime (else, kernel silently fail).
+ * Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to detect this problem at
+ * runtime (else, kernel silently fail).
*
- * NOTE: it may also be possible to use 'pages' from struct firmware and avoid
- * bounce buffer
+ * NOTE: it may also be possible to use 'pages' from struct firmware and avoid bounce buffer
*/
static int wfx_sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, size_t len)
{
if (ret < 0)
return ret;
- /* The device seems to not support writing 0 in this register
- * during first loop
- */
+ /* The device seems to not support writing 0 in this register during first loop */
offs += DNLD_BLOCK_SIZE;
ret = wfx_sram_reg_write(wdev, WFX_DCA_PUT, offs);
if (ret < 0)
};
struct wfx_hif_req_tx {
- /* packet_id is not interpreted by the device, so it is not necessary to
- * declare it little endian
+ /* packet_id is not interpreted by the device, so it is not necessary to declare it little
+ * endian
*/
u32 packet_id;
u8 max_tx_rate;
struct wfx_hif_cnf_tx {
__le32 status;
- /* packet_id is copied from struct wfx_hif_req_tx without been interpreted
- * by the device, so it is not necessary to declare it little endian
+ /* packet_id is copied from struct wfx_hif_req_tx without been interpreted by the device, so
+ * it is not necessary to declare it little endian
*/
u32 packet_id;
u8 txed_rate;
wfx_hif_receive_indication(wdev, hif, hif->body, skb);
return;
}
- /* Note: mutex_is_lock cause an implicit memory barrier that protect
- * buf_send
- */
+ /* Note: mutex_is_lock cause an implicit memory barrier that protect buf_send */
if (mutex_is_locked(&wdev->hif_cmd.lock) &&
wdev->hif_cmd.buf_send && wdev->hif_cmd.buf_send->id == hif_id) {
wfx_hif_generic_confirm(wdev, hif, hif->body);
mutex_lock(&wdev->hif_cmd.lock);
WARN(wdev->hif_cmd.buf_send, "data locking error");
- /* Note: call to complete() below has an implicit memory barrier that
- * hopefully protect buf_send
+ /* Note: call to complete() below has an implicit memory barrier that hopefully protect
+ * buf_send
*/
wdev->hif_cmd.buf_send = request;
wdev->hif_cmd.buf_recv = reply;
wfx_bh_request_tx(wdev);
if (no_reply) {
- /* Chip won't reply. Give enough time to the wq to send the
- * buffer.
- */
+ /* Chip won't reply. Give enough time to the wq to send the buffer. */
msleep(100);
wdev->hif_cmd.buf_send = NULL;
mutex_unlock(&wdev->hif_cmd.lock);
return ret;
}
-/* This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any
- * request anymore. Obviously, only call this function during device unregister.
+/* This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any request anymore.
+ * Obviously, only call this function during device unregister.
*/
int wfx_hif_shutdown(struct wfx_dev *wdev)
{
/* FIXME: swap bytes as necessary in body */
memcpy(body, arg, sizeof(*body));
if (wfx_api_older_than(wdev, 1, 5))
- /* Legacy firmwares expect that add_key to be sent on right
- * interface.
- */
+ /* Legacy firmwares expect that add_key to be sent on right interface. */
wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, sizeof(*body));
else
wfx_fill_header(hif, -1, HIF_REQ_ID_ADD_KEY, sizeof(*body));
struct wfx_dev;
-/* Caution: in the functions below, 'buf' will used with a DMA. So, it must be
- * kmalloc'd (do not use stack allocated buffers). In doubt, enable
- * CONFIG_DEBUG_SG to detect badly located buffer.
+/* Caution: in the functions below, 'buf' will used with a DMA. So, it must be kmalloc'd (do not use
+ * stack allocated buffers). In doubt, enable CONFIG_DEBUG_SG to detect badly located buffer.
*/
int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len);
int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t buf_len);
return false;
}
-/* The device needs data about the antenna configuration. This information in
- * provided by PDS (Platform Data Set, this is the wording used in WF200
- * documentation) files. For hardware integrators, the full process to create
- * PDS files is described here:
+/* The device needs data about the antenna configuration. This information in provided by PDS
+ * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware
+ * integrators, the full process to create PDS files is described here:
* https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md
*
- * So this function aims to send PDS to the device. However, the PDS file is
- * often bigger than Rx buffers of the chip, so it has to be sent in multiple
- * parts.
+ * So this function aims to send PDS to the device. However, the PDS file is often bigger than Rx
+ * buffers of the chip, so it has to be sent in multiple parts.
*
- * In add, the PDS data cannot be split anywhere. The PDS files contains tree
- * structures. Braces are used to enter/leave a level of the tree (in a JSON
- * fashion). PDS files can only been split between root nodes.
+ * In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are
+ * used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split
+ * between root nodes.
*/
int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len)
{
int err;
struct gpio_desc *gpio_saved;
- /* During first part of boot, gpio_wakeup cannot yet been used. So
- * prevent bh() to touch it.
+ /* During first part of boot, gpio_wakeup cannot yet been used. So prevent bh() to touch
+ * it.
*/
gpio_saved = wdev->pdata.gpio_wakeup;
wdev->pdata.gpio_wakeup = NULL;
const char *file_fw;
const char *file_pds;
struct gpio_desc *gpio_wakeup;
- /* if true HIF D_out is sampled on the rising edge of the clock
- * (intended to be used in 50Mhz SDIO)
+ /* if true HIF D_out is sampled on the rising edge of the clock (intended to be used in
+ * 50Mhz SDIO)
*/
bool use_rising_clk;
};
void wfx_tx_queues_init(struct wfx_vif *wvif)
{
- /* The device is in charge to respect the details of the QoS parameters.
- * The driver just ensure that it roughtly respect the priorities to
- * avoid any shortage.
+ /* The device is in charge to respect the details of the QoS parameters. The driver just
+ * ensure that it roughtly respect the priorities to avoid any shortage.
*/
const int priorities[IEEE80211_NUM_ACS] = { 1, 2, 64, 128 };
int i;
* - PS-Poll (FIF_PSPOLL) are never filtered
* - RTS, CTS and Ack (FIF_CONTROL) are always filtered
* - Broken frames (FIF_FCSFAIL and FIF_PLCPFAIL) are always filtered
- * - Firmware does (yet) allow to forward unicast traffic sent to
- * other stations (aka. promiscuous mode)
+ * - Firmware does (yet) allow to forward unicast traffic sent to other stations (aka.
+ * promiscuous mode)
*/
*total_flags &= FIF_BCN_PRBRESP_PROMISC | FIF_ALLMULTI | FIF_OTHER_BSS |
FIF_PROBE_REQ | FIF_PSPOLL;
dev_info(wvif->wdev->dev, "ignoring requested PS mode");
return -1;
}
- /* It is necessary to enable PS if channels
- * are different.
- */
+ /* It is necessary to enable PS if channels are different. */
if (enable_ps)
*enable_ps = true;
if (wvif->wdev->force_ps_timeout > -1)
ieee80211_connection_loss(wvif->vif);
wfx_reset(wvif);
} else {
- /* Due to beacon filtering it is possible that the
- * AP's beacon is not known for the mac80211 stack.
- * Disable filtering temporary to make sure the stack
- * receives at least one
+ /* Due to beacon filtering it is possible that the AP's beacon is not known for the
+ * mac80211 stack. Disable filtering temporary to make sure the stack receives at
+ * least one
*/
wfx_filter_beacon(wvif, false);
}
wvif->join_in_progress = false;
wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, info->use_short_preamble);
wfx_hif_keep_alive_period(wvif, 0);
- /* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use
- * the same value.
- */
+ /* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use the same value. */
wfx_hif_set_bss_params(wvif, info->aid, 7);
wfx_hif_set_beacon_wakeup_period(wvif, 1, 1);
wfx_update_pm(wvif);
static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable)
{
- /* Driver has Content After DTIM Beacon in queue. Driver is waiting for
- * a signal from the firmware. Since we are going to stop to send
- * beacons, this signal will never happens. See also
- * wfx_suspend_resume_mc()
+ /* Driver has Content After DTIM Beacon in queue. Driver is waiting for a signal from the
+ * firmware. Since we are going to stop to send beacons, this signal will never happens. See
+ * also wfx_suspend_resume_mc()
*/
if (!enable && wfx_tx_queues_has_cab(wvif)) {
wvif->after_dtim_tx_allowed = true;
if (vif->type != NL80211_IFTYPE_STATION)
dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", __func__);
wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, info->dtim_period);
- /* We temporary forwarded beacon for join process. It is now no
- * more necessary.
- */
+ /* We temporary forwarded beacon for join process. It is now no more necessary. */
wfx_filter_beacon(wvif, true);
}
if (notify_cmd != STA_NOTIFY_AWAKE)
return;
- /* Device won't be able to honor CAB if a scan is in progress on any
- * interface. Prefer to skip this DTIM and wait for the next one.
+ /* Device won't be able to honor CAB if a scan is in progress on any interface. Prefer to
+ * skip this DTIM and wait for the next one.
*/
wvif_it = NULL;
while ((wvif_it = wvif_iterate(wvif->wdev, wvif_it)) != NULL)
#include "hif_api_cmd.h"
#include "hif_api_mib.h"
-/* The hell below need some explanations. For each symbolic number, we need to
- * define it with TRACE_DEFINE_ENUM() and in a list for __print_symbolic.
+/* The hell below need some explanations. For each symbolic number, we need to define it with
+ * TRACE_DEFINE_ENUM() and in a list for __print_symbolic.
*
* 1. Define a new macro that call TRACE_DEFINE_ENUM():
*
* #undef xxx_name
* #define xxx_name(msg) { msg, #msg },
*
- * 5. list_name can now nearly be used with __print_symbolic() but,
- * __print_symbolic() dislike last comma of list. So we define a new list
- * with a dummy element:
+ * 5. list_name can now nearly be used with __print_symbolic() but, __print_symbolic() dislike
+ * last comma of list. So we define a new list with a dummy element:
*
* #define list_for_print_symbolic list_names { -1, NULL }
*/