]> asedeno.scripts.mit.edu Git - linux.git/log
linux.git
4 years agoMerge tag 'iio-for-5.6b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Sun, 19 Jan 2020 13:59:05 +0000 (14:59 +0100)]
Merge tag 'iio-for-5.6b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of new device support, features and minor fixes for IIO in the 5.6 cycle

Just a small set this time.

As we are very near the merge window, I've rolled a few fixes in here
rather than adding noise just before release.  A short delay here will
do little harm.

New device support
* adis16480
  - Add support for adis16490. After earlier rework this is simple ID plus
    chip info.

Features
* kxcjk1013
  - mount matrix support.
* lsm_6dsx
  - mount matrix support.

Cleanups / minor or late breaking fixes
* ad7124
  - add support to ad-sigma-delta and use it in this driver to allow
    the the interrupt type to be IRQF_TRIGGER_LOW unlike most other devices
    using this framework.
* adis
  - use delay structure now available in SPI to handle transfer delays
  - introduce a timeouts structure to allow support of new devices
* ak8975
  - drop platform data support.  No one is using it and it adds complexity.
  - use device_get_match_data rather than open coding much the same thing.
* dht11
  - drop meaningless todo
* at91-samad2_adc
  - switch to dma_request_chan
* altas-sensor
  - add a helper function to compute number of channels.  Needed for new device
    support that is under review.
* bma400
  - add a lower bound check on scale.
* inv_mpu6050
  - add support for temperature data in the fifos for all chips.
  - support an odd situation where a board supports only interrupt triggering
    on both edges.
* st_lsm6dsx
  - check and handle potential error return.
* st_sensors
  - fix some values for the LSM9DS0 which is ever so slightly different from
    other devices using the same whoami value.
  - switch over to generic functions from dt ones, avoiding need for separate
    ACPI support.
* stm32-adc
  - switch to dma_request_chan
  - suppress an error print in deferred probe case.
* stm32-dac
  - drop private data structure element for reset controller as only used in
    probe.
  - reflect more cleanly that the reset controller is optional whilst ensuring
    that if is specified any errors are caught.
* stm32-dfsdm
  - switch to dma_request_chan
  - fix missing application of formatting to single conversions.
  - ensure the sampling rate is updated when the oversampling ratio is changed.

* tag 'iio-for-5.6b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (29 commits)
  iio: dac: stm32-dac: better handle reset controller failures
  iio: dac: stm32-dac: use reset controller only at probe time
  dt-bindings: iio: accel: kxcjk1013: Document mount-matrix property
  iio: accel: kxcjk1013: Support orientation matrix
  iio: imu: st_lsm6dsx: add mount matrix support
  iio: adc: stm32-adc: don't print an error on probe deferral
  dt-bindings: iio: adis16480: add compatible entry for ADIS16490
  iio: imu: adis16480: Add support for ADIS16490
  iio: accel: bma400: prevent setting accel scale too low
  iio: imu/mpu6050: support dual-edge IRQ
  iio: imu: inv_mpu6050: add fifo temperature data support
  iio: magnetometer: ak8975: Convert to use device_get_match_data()
  iio: magnetometer: ak8975: Get rid of platform data
  iio: adc: ad7124: Set IRQ type to falling
  iio: adc: ad-sigma-delta: Allow custom IRQ flags
  iio: imu: adis: use new `delay` structure for SPI transfer delays
  iio: adc: stm32-dfsdm: adapt sampling rate to oversampling ratio
  iio: adc: stm32-dfsdm: fix single conversion
  iio: st_sensors: Make use of device properties
  iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe()
  ...

4 years agoiio: dac: stm32-dac: better handle reset controller failures
Etienne Carriere [Mon, 13 Jan 2020 13:14:26 +0000 (14:14 +0100)]
iio: dac: stm32-dac: better handle reset controller failures

Use devm_reset_control_get_optional_exclusive() instead of
devm_reset_control_get_exclusive() as reset controller is optional.

Nevertheless if reset controller is expected but reports an
error, propagate the error code to the caller. In such case
a nice error trace is emitted unless we're deferring the probe
operation.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: dac: stm32-dac: use reset controller only at probe time
Etienne Carriere [Mon, 13 Jan 2020 13:14:25 +0000 (14:14 +0100)]
iio: dac: stm32-dac: use reset controller only at probe time

This change removes the reset controller reference from the local
DAC instance since it is used only at probe time.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: accel: kxcjk1013: Document mount-matrix property
Dmitry Osipenko [Sun, 12 Jan 2020 20:33:01 +0000 (23:33 +0300)]
dt-bindings: iio: accel: kxcjk1013: Document mount-matrix property

The generic IIO mount-matrix property conveys physical orientation of the
hardware chip.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: accel: kxcjk1013: Support orientation matrix
Dmitry Osipenko [Sun, 12 Jan 2020 20:33:00 +0000 (23:33 +0300)]
iio: accel: kxcjk1013: Support orientation matrix

Hardware could be physically mounted in any possible direction and
userpspace needs to be aware of the mounting orientation in order to
process sensor's data correctly. In particular this helps iio-sensor-proxy
to report display's orientation properly on a phone/tablet devices.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: add mount matrix support
Martin Kepplinger [Mon, 13 Jan 2020 10:11:40 +0000 (11:11 +0100)]
iio: imu: st_lsm6dsx: add mount matrix support

Allow to read the mount-matrix device tree property and provide the
mount_matrix file for userspace to read.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: stm32-adc: don't print an error on probe deferral
Etienne Carriere [Mon, 13 Jan 2020 13:18:59 +0000 (14:18 +0100)]
iio: adc: stm32-adc: don't print an error on probe deferral

Do not print an error trace when deferring probe for some resource.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: adis16480: add compatible entry for ADIS16490
Alexandru Ardelean [Thu, 16 Jan 2020 13:11:48 +0000 (15:11 +0200)]
dt-bindings: iio: adis16480: add compatible entry for ADIS16490

This change adds an entry for ADIS16490 in the list of compatible devices
defined in the dt-bindings of the adis16480 driver.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis16480: Add support for ADIS16490
Stefan Popa [Thu, 16 Jan 2020 13:11:47 +0000 (15:11 +0200)]
iio: imu: adis16480: Add support for ADIS16490

The ADIS16490 is part of the same family with ADIS16495 and ADIS16497,
the main difference is the temperature, accelerometer and gyroscope
scales.

Datasheet:
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/adis16490.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: accel: bma400: prevent setting accel scale too low
Dan Carpenter [Thu, 16 Jan 2020 10:08:29 +0000 (13:08 +0300)]
iio: accel: bma400: prevent setting accel scale too low

This puts an upper bound on "val2" but it also needs to have a lower
bound (BMA400_SCALE_MIN).

Fixes: 465c811f1f20 ("iio: accel: Add driver for the BMA400")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu/mpu6050: support dual-edge IRQ
Michał Mirosław [Sat, 11 Jan 2020 15:19:11 +0000 (16:19 +0100)]
iio: imu/mpu6050: support dual-edge IRQ

Make mpu6050 usable on platforms which provide only any-edge interrupts.
One example of this kind of platform is AT91SAM9G45

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: add fifo temperature data support
Jean-Baptiste Maneyrol [Thu, 16 Jan 2020 17:56:45 +0000 (18:56 +0100)]
iio: imu: inv_mpu6050: add fifo temperature data support

Add support of temperature data in fifo for all chips.
Enable unification of scan elements for icm20602.
Add macros for generating scan elements.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: magnetometer: ak8975: Convert to use device_get_match_data()
Andy Shevchenko [Wed, 15 Jan 2020 17:44:25 +0000 (19:44 +0200)]
iio: magnetometer: ak8975: Convert to use device_get_match_data()

Convert to use device_get_match_data() instead of open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: magnetometer: ak8975: Get rid of platform data
Andy Shevchenko [Wed, 15 Jan 2020 17:44:24 +0000 (19:44 +0200)]
iio: magnetometer: ak8975: Get rid of platform data

Since IIO framework supports device property API and driver has been moved
already to the use of GPIO descriptors the logical continuation is to
get rid of platform data completely. We are on the safe side here since
there are no users of it in the kernel.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7124: Set IRQ type to falling
Alexandru Tachici [Mon, 13 Jan 2020 10:26:53 +0000 (12:26 +0200)]
iio: adc: ad7124: Set IRQ type to falling

Ad7124 data-sheet specifies that the falling edge
of the DOUT line should be used for an interrupt.
The current irq flag (IRQF_TRIGGER_LOW) used will
cause unwanted behaviour. When enabling the interrupt
it will fire once because the DOUT line is already low.
This will make the driver to read an unfinished conversion
from the chip.

This patch sets the irq type to the one specified in
the data-sheet.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad-sigma-delta: Allow custom IRQ flags
Alexandru Tachici [Mon, 13 Jan 2020 10:26:52 +0000 (12:26 +0200)]
iio: adc: ad-sigma-delta: Allow custom IRQ flags

Before this patch the ad_sigma_delta implementation hardcoded
the irq trigger type to low, assuming that all Sigma-Delta ADCs
have the same interrupt-type.

This patch allows all drivers using the ad_sigma_delta layer to set the
irq trigger type to the one specified in the datasheet.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agostaging: wfx: update TODO
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:38 +0000 (13:55 +0000)]
staging: wfx: update TODO

Some work has been done :)

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-66-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_multi_tx_confirm()
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:37 +0000 (13:55 +0000)]
staging: wfx: simplify hif_multi_tx_confirm()

Usage of the "buf_loc" variable does not simplify the function.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-65-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_tx_queue_get_num_queued()
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:35 +0000 (13:55 +0000)]
staging: wfx: simplify wfx_tx_queue_get_num_queued()

wfx_tx_queue_get_num_queued() can take advantage of BIT() instead of
maintaining one variable for a counter and another for a mask.

In add, wfx_tx_queue_get_num_queued() has no real reason to return a
size_t instead of an int.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-64-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_handle_tx_data()
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:34 +0000 (13:55 +0000)]
staging: wfx: simplify hif_handle_tx_data()

Since enum action has now only two cases, it can be dropped. Then
hif_handle_tx_data() can be simplified.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-63-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: remove check for interface state
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:31 +0000 (13:55 +0000)]
staging: wfx: remove check for interface state

Obviously, the value of wvif->state as no reason to be wrong. At least,
if it the case, dropping the frame is probably not the bast thing to do.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-62-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: remove unused do_probe
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:30 +0000 (13:55 +0000)]
staging: wfx: remove unused do_probe

The identifier do_probe is unused since "staging: wfx: remove workaround
to send probe requests"

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-61-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: ensure that packet_id is unique
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:28 +0000 (13:55 +0000)]
staging: wfx: ensure that packet_id is unique

In current code, packet_id is derivated from mac802.11 packet sequence
number, but this number is only unique for a station. It is not
sufficient.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-60-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_ps_notify_sta()
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:27 +0000 (13:55 +0000)]
staging: wfx: simplify wfx_ps_notify_sta()

wfx_ps_notify_sta() is too complex compared to the task it do.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-59-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify handling of IEEE80211_TX_CTL_SEND_AFTER_DTIM
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:25 +0000 (13:55 +0000)]
staging: wfx: simplify handling of IEEE80211_TX_CTL_SEND_AFTER_DTIM

When mac80211 ask for a frame to be sent after a DTIM, driver should:
  1. Update TIM with multicast bit set (using update_ie). This function
     can be called whenever.
  2. Keep buffered all frames marked "after dtim"
  3. When it receive a suspend_resume indication (see
     wfx_suspend_resume_mc()), send all the buffered frames. This
     indication is sent by the firmware 4ms before the dtim.
  4. If one of the frames returns status "REQUEUE", it means that the
     DTIM period was ended before to be able to send the frame.
  5. When all the buffered frames were sent or if DTIM period was ended,
     driver should update the TIM with multicast bit reset.

All the mess with the asynchronous works can be dropped.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-58-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_suspend_resume_mc()
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:24 +0000 (13:55 +0000)]
staging: wfx: simplify wfx_suspend_resume_mc()

Indeed, it is not necessary to pass whole hif_ind_suspend_resume_tx to
wfx_suspend_resume_mc().

In add, the structure hif_ind_suspend_resume_tx come from hardware API.
It is not intended to be manipulated in upper layers of the driver.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-57-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: firmware never return PS status for stations
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:22 +0000 (13:55 +0000)]
staging: wfx: firmware never return PS status for stations

At the beginning, firmware could send suspend_resume indication to
notify that a station wake up or sleep down. However, mac80211 already
handles power save status of stations and this behavior has been removed
from the firmware. So now, when suspend_resume indication is received,
it is always to notify that a DTIM is about to be sent.

So, it is possible to simply wfx_suspend_resume().

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-56-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: sta and dtim
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:21 +0000 (13:55 +0000)]
staging: wfx: sta and dtim

wfx_ps_notify() is called for any changes in the TIM. However,
association ID 0 is a very special case that should be handled
independently.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-55-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: pspoll_mask make no sense
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:19 +0000 (13:55 +0000)]
staging: wfx: pspoll_mask make no sense

pspoll_mask is here to send data buffered in driver. But since station
is marked buffered, TIM for this station is 1 and mac80211 will call
sta_notify when a ps-poll is received. So pspoll_mask is useless and
sta_alseep_mask is sufficient.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-54-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: replace wfx_tx_get_tid() with ieee80211_get_tid()
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:18 +0000 (13:55 +0000)]
staging: wfx: replace wfx_tx_get_tid() with ieee80211_get_tid()

wfx_tx_get_tid() was used as a wrapper around ieee80211_get_tid(). It
did sometime return WFX_MAX_TID to ask to upper layers to not include
the frame in "buffered" counter. The objective of this behavior is not
clear, but tests has shown that wfx_tx_get_tid() can be replaced by
ieee80211_get_tid() without any regressions.

BTW, it is not necessary to save the tid in tx_rpiv since it can be
retrieved from the 802.11 header.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-53-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: check that no tx is pending before release sta
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:16 +0000 (13:55 +0000)]
staging: wfx: check that no tx is pending before release sta

Just for sanity.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-52-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify the link-id allocation
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:15 +0000 (13:55 +0000)]
staging: wfx: simplify the link-id allocation

The "link-id" is a slot number provided to the chip. A link-id is
allocated to every station associated with the chip (mainly when the
chip is in AP mode). It is more or less the same thing than the
association ID, but it is limited to 14 values.

Firmware uses the link-id to track the power save status of the
stations.

The current code try to associate a link-id as soon as data are
exchanged with station. It is far easier to rely on sta_add() and
sta_remove().

Until now the value WFX_LINK_ID_NO_ASSOC, was only used when no more
link-id was available. Now, we also use this value for
not-yet-associated stations (that was its primary behavior).

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-51-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_set_tim_impl()
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:13 +0000 (13:55 +0000)]
staging: wfx: simplify wfx_set_tim_impl()

Argument provided to wfx_set_tim_impl() is always wvif->aid0_bit_set and
there is no reason to provide another argument.

Also rename wfx_set_tim_impl() into wfx_update_tim() to reflect the new
behavior.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-50-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: fix RCU usage
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:12 +0000 (13:55 +0000)]
staging: wfx: fix RCU usage

Indeed, sta was used after call to rcu_unlock()

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-49-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: fix bss_loss
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:10 +0000 (13:55 +0000)]
staging: wfx: fix bss_loss

wfx_tx_confirm_cb()  retrieves the station associated with a frame using
the MAC address from the 802.11 header. In the other side wfx_tx()
retrieves the station using sta field from the ieee80211_tx_control
argument.

In wfx_cqm_bssloss_sm(), wfx_tx() was called directly without valid sta
field, but with a valid MAC address in 802.11 header. So there the
processing of this packet was unbalanced and may produce weird bugs.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-48-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: relocate "buffered" information to sta_priv
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:09 +0000 (13:55 +0000)]
staging: wfx: relocate "buffered" information to sta_priv

It simplify the code if field buffered is hosted in the struct sta_priv
instead of in the struct wfx_link_entry. More globally, struct
wfx_link_entry has no real reasons to exist and should be dropped soon.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-47-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: remove handling of "early_data"
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:08 +0000 (13:55 +0000)]
staging: wfx: remove handling of "early_data"

It seems that purpose of "early_data" was to prevent sending data to
mac80211 before station was completely associated. It is a useless
precaution.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-46-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: fix possible overflow on jiffies comparaison
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:06 +0000 (13:55 +0000)]
staging: wfx: fix possible overflow on jiffies comparaison

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It is recommended to use function time_*() to compare jiffies.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-45-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: fix case where RTS threshold is 0
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:05 +0000 (13:55 +0000)]
staging: wfx: fix case where RTS threshold is 0

If RTS threshold is 0, it currently disables RTS. It should mean
"enabled for every frames".

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-44-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: do not update uapsd if not necessary
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:03 +0000 (13:55 +0000)]
staging: wfx: do not update uapsd if not necessary

wfx_conf_tx() is called for each queue. On every call, the function
updates UAPSD mask and PM mode for all queues. It is a pity since the
UAPSD configuration very rarely changes and it makes exchanges between
the host and the chip more difficult to track.

This patch avoid to update UAPSD and Power Mode in most usual cases.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-43-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: with multiple vifs, force PS only if channels differs
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:02 +0000 (13:55 +0000)]
staging: wfx: with multiple vifs, force PS only if channels differs

When multiple vif are in use (the only supported configuration is one
station and one AP), the driver force power save flag on station.
This behavior allows the station to leave the station channel and make
its business on AP channel.

However, this has a big impact on station performances (especially since
only legacy PS is supported).

When both vifs use the same channel, it is not necessary to keep this
restriction. This greatly improve station performances.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-42-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: update power-save per interface
Jérôme Pouiller [Wed, 15 Jan 2020 13:55:01 +0000 (13:55 +0000)]
staging: wfx: update power-save per interface

mac80211 and the device are both able to control power-save per vif.
But, the current code retrieve power-save from wfx_config(). So, it does
not allow to setup power-save independently for each vif. Driver just
has to rely on wfx_bss_info_changed() instead of wfx_config().

wfx_config() has nothing to do anymore, but we keep it since it is
mandatory for mac80211.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-41-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_scan_complete()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:59 +0000 (13:54 +0000)]
staging: wfx: simplify wfx_scan_complete()

wfx_scan_complete() do nothing with argument hif_ind_scan_cmpl. In add,
hif_ind_scan_cmpl come from hardware API and is not expected to be used
with upper layers of the driver.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-40-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_update_filtering()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:58 +0000 (13:54 +0000)]
staging: wfx: simplify wfx_update_filtering()

wfx_update_filtering() has no reason to instantiate a struct
hif_mib_bcn_filter_enable. Drop it and simplify the code.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-39-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_set_mcast_filter()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:56 +0000 (13:54 +0000)]
staging: wfx: simplify wfx_set_mcast_filter()

HIF functions return only serious errors (OOM or device freeze). The
current handling of errors in wfx_set_mcast_filter() does not bring
anything. Finally it may disturb the developer more than it helps.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-38-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_set_config_data_filter()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:55 +0000 (13:54 +0000)]
staging: wfx: simplify hif_set_config_data_filter()

The structure hif_mib_config_data_filter come from hardware
API. It is not intended to be manipulated in upper layers of the driver.

In add, current code for hif_set_config_data_filter() is too dumb. It
should pack data with hardware representation instead of leaving all
work to the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-37-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_set_mac_addr_condition()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:54 +0000 (13:54 +0000)]
staging: wfx: simplify hif_set_mac_addr_condition()

The structure hif_mib_mac_addr_data_frame_condition come from hardware
API. It is not intended to be manipulated in upper layers of the driver.

In add, current code for hif_set_mac_addr_condition() is too dumb. It
should pack data with hardware representation instead of leaving all
work to the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-36-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_set_data_filtering()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:52 +0000 (13:54 +0000)]
staging: wfx: simplify hif_set_data_filtering()

The structure hif_mib_set_data_filtering come from hardware API. It is
not intended to be manipulated in upper layers of the driver.

In add, current code for hif_set_data_filtering() is too dumb. It should
pack data with hardware representation instead of leaving all work to
the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-35-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_mib_set_data_filtering
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:51 +0000 (13:54 +0000)]
staging: wfx: simplify hif_mib_set_data_filtering

The field "default_filter" was not obvious.

In add, explicitly declare that fields default_filter and enable are
booleans.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-34-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_mib_uc_mc_bc_data_frame_condition
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:49 +0000 (13:54 +0000)]
staging: wfx: simplify hif_mib_uc_mc_bc_data_frame_condition

The current API defines bitfields. It is not very convenient. Prefer to
use bitmasks.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-33-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_set_uc_mc_bc_condition()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:48 +0000 (13:54 +0000)]
staging: wfx: simplify hif_set_uc_mc_bc_condition()

The structure hif_mib_uc_mc_bc_data_frame_condition come from hardware
API. It is not intended to be manipulated in upper layers of the driver.

In add, current code for hif_set_uc_mc_bc_condition() is too dumb. It
should pack data with hardware representation instead of leaving all
work to the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-32-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_set_association_mode()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:46 +0000 (13:54 +0000)]
staging: wfx: simplify hif_set_association_mode()

The structure hif_mib_set_association_mode come from hardware API. It is
not intended to be manipulated in upper layers of the driver.

In add, current code for hif_set_association_mode() is too dumb. It
should pack data with hardware representation instead of leaving all
work to the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-31-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_join()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:44 +0000 (13:54 +0000)]
staging: wfx: simplify hif_join()

The structure hif_req_join come from hardware API. It is not intended
to be manipulated in upper layers of the driver.

In add, current code for hif_join() is too dumb. It should pack data
with hardware representation instead of leaving all work to the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-30-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_update_ie()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:43 +0000 (13:54 +0000)]
staging: wfx: simplify hif_update_ie()

hif_update_ie() is only called to change the beacon template. So,
specialize this function and simplify the way to call it.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-29-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: SSID should be provided to hif_start() even if hidden
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:41 +0000 (13:54 +0000)]
staging: wfx: SSID should be provided to hif_start() even if hidden

SSID is hidden in beacon but firmware has to know to which probe
requests it has to answer.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-28-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: drop wfx_set_cts_work()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:40 +0000 (13:54 +0000)]
staging: wfx: drop wfx_set_cts_work()

wfx_bss_info_changed() is not called from atomic contexts. So, it is not
necessary to raise an asynchronous work to change ERP. Thus
wfx_set_cts_work() become useless.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-27-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: drop wvif->setbssparams_done
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:38 +0000 (13:54 +0000)]
staging: wfx: drop wvif->setbssparams_done

setbssparams_done was here to ensure that the firmware does not enable
powersave before to get the first beacon. However, mac80211 already
ensures it gets a beacon before to associate to the BSS. And even, if
it won't, the firmware wake up at least on every DTIM, which is
sufficient to finalize the association.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-26-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: drop wvif->cqm_rssi_thold
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:37 +0000 (13:54 +0000)]
staging: wfx: drop wvif->cqm_rssi_thold

Current code keeps a copy of bss_conf->cqm_rssi_thold in wfx_vif. There
is no sane reason for that.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-25-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: drop wvif->enable_beacon
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:35 +0000 (13:54 +0000)]
staging: wfx: drop wvif->enable_beacon

It seems that current code try to save calls to hif_beacon_transmit() by
keeping a copy of the previous value of bss_conf->enable_beacon.
However, hif_beacon_transmit() does not cost so much and mac80211
already take care to not send useless events.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-24-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: drop wvif->dtim_period
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:34 +0000 (13:54 +0000)]
staging: wfx: drop wvif->dtim_period

It is not necessary to keep a copy of dtim_period in wfx_vif. Prefer to
just rely on bss_conf->dtim_period.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-23-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify update of DTIM period
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:32 +0000 (13:54 +0000)]
staging: wfx: simplify update of DTIM period

Current code parse the TIM and retrieve the DTIM period. It is far
easier to rely on bss_info_changed() for this job.

It is no more necessary to run task asynchronously. So
set_beacon_wakeup_period_work is now useless.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-22-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_flush()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:30 +0000 (13:54 +0000)]
staging: wfx: simplify wfx_flush()

Current code of wfx_flush() force to drop packets in some contexts.
However, there is no obvious reasons to do that. It looks like a
workaround for a bug with the old implementation of __wfx_flush().

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-21-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: fix __wfx_flush() when drop == false
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:29 +0000 (13:54 +0000)]
staging: wfx: fix __wfx_flush() when drop == false

wfx_tx_queues_clear() only clear not yet sent requests. So, it always
necessary to wait for tx_queue_stats.wait_link_id_empty whatever the
value of "drop" argument.

In add, it is not necessary to return with tx queue locked since all
calls to __wfx_flush() unlock the tx queue just after the call to
__wfx_tx_flush().

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-20-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_update_beaconing()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:27 +0000 (13:54 +0000)]
staging: wfx: simplify wfx_update_beaconing()

Remove most of indentation of wfx_update_beaconing() by reworking the
error handling.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-19-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_upload_ap_templates()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:26 +0000 (13:54 +0000)]
staging: wfx: simplify wfx_upload_ap_templates()

This function built probe response from data retrieved in beacon. Yet,
this job can be done with ieee80211_proberesp_get(). So, we can simplify
that code (and fix bugs like inclusion of TIM in probe responses).

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-18-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: rename wfx_upload_beacon()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:24 +0000 (13:54 +0000)]
staging: wfx: rename wfx_upload_beacon()

In fact, wfx_upload_beacon() uploads beacon and probe response. So,
rename it in wfx_upload_ap_templates().

The call to wfx_fwd_probe_req() has nothing to do with template
uploading, so relocate it.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-17-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify wfx_config()
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:23 +0000 (13:54 +0000)]
staging: wfx: simplify wfx_config()

Now that wfx_config() only handles IEEE80211_CONF_CHANGE_PS, it can be
simplified.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-16-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: drop wdev->output_power
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:21 +0000 (13:54 +0000)]
staging: wfx: drop wdev->output_power

mac80211 and the device are both able to control tx power per vif. But,
the current code retrieve tx power from wfx_config(). So, it does not
allow to setup the tx power independently for each vif. Driver just has
to rely on bss_conf->txpower to get the correct information.

In add, it is no more necessary to protect access to wdev->output_power
with scan_lock.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-15-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: drop struct wfx_ht_info
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:20 +0000 (13:54 +0000)]
staging: wfx: drop struct wfx_ht_info

This struct is no more used.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-14-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: retrieve greenfield mode from sta->ht_cap and bss_conf
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:19 +0000 (13:54 +0000)]
staging: wfx: retrieve greenfield mode from sta->ht_cap and bss_conf

wvif->ht_info contains useless copies of sta->ht_cap and
bss_conf->ht_operation_mode. Prefer to retrieve information from the
original structs instead of rely on wvif->ht_info.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-13-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: retrieve ampdu_density from sta->ht_cap
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:17 +0000 (13:54 +0000)]
staging: wfx: retrieve ampdu_density from sta->ht_cap

wvif->ht_info.ht_cap is a useless copy of sta->ht_cap. It makes no sense
to rely on it.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-12-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: use specialized structs for HIF arguments
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:16 +0000 (13:54 +0000)]
staging: wfx: use specialized structs for HIF arguments

Most of the commands that are sent to device should take struct in
argument. In the current code, when this struct is binary compatible
with a __le32, the driver use a __le32. This behavior is error prone.
This patch fixes that and uses the specialized structs instead.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-11-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_start() usage
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:14 +0000 (13:54 +0000)]
staging: wfx: simplify hif_start() usage

The structure hif_req_start come from hardware API. It is not intended
to be manipulated in upper layers of the driver.

In add, current code for hif_start() is too dumb. It should pack data
with hardware representation instead of leaving all work to the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-10-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_set_arp_ipv4_filter() usage
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:13 +0000 (13:54 +0000)]
staging: wfx: simplify hif_set_arp_ipv4_filter() usage

The structure hif_mib_arp_ip_addr_table come from hardware API. It is
not intended to be manipulated in upper layers of the driver.

In add, current code for hif_set_arp_ipv4_filter() is too dumb. It
should pack data using the hardware representation instead of leaving
all work to the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-9-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_set_rcpi_rssi_threshold() usage
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:12 +0000 (13:54 +0000)]
staging: wfx: simplify hif_set_rcpi_rssi_threshold() usage

The structure hif_mib_rcpi_rssi_threshold come from hardware API. It is
not intended to be manipulated in upper layers of the driver.

In add, current code for hif_set_rcpi_rssi_threshold() is dumb. It
should pack data using the hardware representation instead of leaving
all work to the caller.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-8-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_set_output_power() usage
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:10 +0000 (13:54 +0000)]
staging: wfx: simplify hif_set_output_power() usage

Hardware API use 10th of dBm for output power unit. Upper layers should
use same units than mac80211 and the conversion should be done by low
level layer of the driver (hif_set_output_power())

In add, current code of hif_set_output_power() use a __le32 while the
device API specify a specific structure for this.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-7-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: simplify hif_set_tx_rate_retry_policy() usage
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:09 +0000 (13:54 +0000)]
staging: wfx: simplify hif_set_tx_rate_retry_policy() usage

The structure hif_mib_set_tx_rate_retry_policy come from hardware
API. It is not intended to be manipulated in upper layers of the driver.

So, this patch relocate handling of this structure to
hif_set_tx_rate_retry_policy() (the low level function).

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-6-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: send rate policies one by one
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:07 +0000 (13:54 +0000)]
staging: wfx: send rate policies one by one

Rate policies (aka. tx_rate_retry_policy in hardware API) are sent to
device asynchronously from tx requests. So, the device maintains a list
of active rate policies and the tx requests only reference an existent
rate policy.

The device API allows to send multiple rate policies at once. However,
this property is very rarely used. We prefer to send rate policies one
by one and simplify the architecture.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-5-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: add missing PROBE_RESP_OFFLOAD feature
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:06 +0000 (13:54 +0000)]
staging: wfx: add missing PROBE_RESP_OFFLOAD feature

Some userspace tools (hostapd) rely on probe_resp_offload fields for
certain features.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-4-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: make hif_scan() usage clearer
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:05 +0000 (13:54 +0000)]
staging: wfx: make hif_scan() usage clearer

hif_scan() return max number of jiffies to wait before the completion
indication. However, if this value is negative, an error has occurred.

Reword the code to reflect that behavior.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-3-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wfx: revert unexpected change in debugfs output
Jérôme Pouiller [Wed, 15 Jan 2020 13:54:03 +0000 (13:54 +0000)]
staging: wfx: revert unexpected change in debugfs output

It appears that commit 8c7128c4cf4e ("staging: align to fix warnings of
line over 80 characters") do slightly more than what is explained in
commit log.

Especially, it changes the output of the file rx_stats from debugfs.
From some point of view, this file can be considered as a part of the
API. Any change on it should be clearly announced.

Since the change introduced does not seems to have any justification,
revert it.

Reported-by: Pascal Prime <pascal.prime@silabs.com>
Cc: Jules Irenge <jbi.octave@gmail.com>
Fixes: 8c7128c4cf4e ("staging: align to fix warnings of line over 80 characters")
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-2-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: most: remove header include path to drivers/staging
Masahiro Yamada [Wed, 15 Jan 2020 16:44:51 +0000 (01:44 +0900)]
staging: most: remove header include path to drivers/staging

There is no need to add "ccflags-y += -I $(srctree)/drivers/staging"
just for including <most/most.h>.

Use the #include "..." directive with the correct relative path.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20200115164451.13203-1-masahiroy@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: most: core: remove noisy log messages
Christian Gromm [Tue, 14 Jan 2020 15:57:52 +0000 (16:57 +0100)]
staging: most: core: remove noisy log messages

In order to not generate unnecessary noise in the kernel log,this patch
removes debug log messages.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1579017478-3339-4-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: most: core: use dev_* function for logging
Christian Gromm [Tue, 14 Jan 2020 15:57:51 +0000 (16:57 +0100)]
staging: most: core: use dev_* function for logging

This patch replaces all calls to pr_* functions and uses
the dev_* functions instead.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1579017478-3339-3-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: most: core: fix date in file comment
Christian Gromm [Tue, 14 Jan 2020 15:57:50 +0000 (16:57 +0100)]
staging: most: core: fix date in file comment

This patch updates the date range in the comment section.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1579017478-3339-2-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8192u: replace printk with natdev_<LEVEL> statements in ieee80211
Paulo Miguel Almeida [Wed, 15 Jan 2020 10:12:08 +0000 (23:12 +1300)]
staging: rtl8192u: replace printk with natdev_<LEVEL> statements in ieee80211

Checkpatch reports 'WARNING: printk() should include KERN_<LEVEL>
facility level'. Fix this by specifying a relevant KERN_<LEVEL> value
for each line in which it was missing.

Once they are fixed, checkpatch reports 'WARNING: Prefer [subsystem eg:
netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then
pr_debug(...  to printk(KERN_DEBUG ...'. Fix this by replacing
relevant printk_<level> statements with their netdev_<level>
equivalent.

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Link: https://lore.kernel.org/r/20200115101208.GA683742@localhost.localdomain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: vt6655: remove redundant assignment to variable ret
Colin Ian King [Tue, 14 Jan 2020 17:11:45 +0000 (17:11 +0000)]
staging: vt6655: remove redundant assignment to variable ret

The variable ret is being initialized with a value that
is never read and is being re-assigned later on. The
assignment is redundant and hence can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200114171145.375356-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wilc1000: remove redundant assignment to variable result
Colin Ian King [Tue, 14 Jan 2020 17:27:20 +0000 (17:27 +0000)]
staging: wilc1000: remove redundant assignment to variable result

The variable result is being initialized with a value that
is never read and is being re-assigned later on. The assignment
is redundant and hence can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200114172720.376286-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: wlan-ng: ensure error return is actually returned
Colin Ian King [Tue, 14 Jan 2020 18:16:04 +0000 (18:16 +0000)]
staging: wlan-ng: ensure error return is actually returned

Currently when the call to prism2sta_ifst fails a netdev_err error
is reported, error return variable result is set to -1 but the
function always returns 0 for success.  Fix this by returning
the error value in variable result rather than 0.

Addresses-Coverity: ("Unused value")
Fixes: 00b3ed168508 ("Staging: add wlan-ng prism2 usb driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200114181604.390235-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: android: ashmem: Replace strcpy with strscpy
Ole Wiedemann [Fri, 13 Dec 2019 13:10:32 +0000 (14:10 +0100)]
staging: android: ashmem: Replace strcpy with strscpy

Replaced strcpy call with safer strscpy call with given length.
This elimates the need to manually null-terminate the given string,
since strscpy will null terminate the destination anyway.:

Signed-off-by: Ole Wiedemann <ole.wiedemann@fau.de>
Co-developed-by: Sebastian Scherbel <sebastian.scherbel@fau.de>
Signed-off-by: Sebastian Scherbel <sebastian.scherbel@fau.de>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Acked-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Acked-by: Todd Kjos <tkjos@google.com>
Link: https://lore.kernel.org/r/20191213131032.22579-1-ole.wiedemann@fau.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8188eu: cleanup whitespace in rtl8188e_dm.c
Michael Straube [Tue, 14 Jan 2020 13:44:22 +0000 (14:44 +0100)]
staging: rtl8188eu: cleanup whitespace in rtl8188e_dm.c

Replace tabs with spaces and/or remove spaces to use typical kernel
horizontal whitespace.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200114134422.13598-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8188eu: remove unnecessary parentheses in rtl8188e_dm.c
Michael Straube [Tue, 14 Jan 2020 13:44:21 +0000 (14:44 +0100)]
staging: rtl8188eu: remove unnecessary parentheses in rtl8188e_dm.c

Remove unnecessary parentheses reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200114134422.13598-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8188eu: cleanup long lines in rtl8188e_dm.c
Michael Straube [Tue, 14 Jan 2020 13:44:20 +0000 (14:44 +0100)]
staging: rtl8188eu: cleanup long lines in rtl8188e_dm.c

Cleanup lines over 80 characters in rtl8188e_dm.c by adding
appropriate line breaks.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200114134422.13598-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8188eu: convert rtw_hal_antdiv_before_linked() to bool
Michael Straube [Tue, 14 Jan 2020 13:44:19 +0000 (14:44 +0100)]
staging: rtl8188eu: convert rtw_hal_antdiv_before_linked() to bool

Function rtw_hal_antdiv_before_linked() returns boolean values, so
change the return type from u8 to bool.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200114134422.13598-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8188eu: refactor rtw_hal_antdiv_before_linked()
Michael Straube [Tue, 14 Jan 2020 13:44:18 +0000 (14:44 +0100)]
staging: rtl8188eu: refactor rtw_hal_antdiv_before_linked()

Refactor rtw_hal_antdiv_before_linked() to clear checkpatch warnings.

WARNING: line over 80 characters
WARNING: else is not generally useful after a break or return

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200114134422.13598-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8723bs: remove ODM_GetRightChnlPlaceforIQK()
Michael Straube [Fri, 10 Jan 2020 21:04:56 +0000 (22:04 +0100)]
staging: rtl8723bs: remove ODM_GetRightChnlPlaceforIQK()

Function ODM_GetRightChnlPlaceforIQK() returns non-zero values only
for channels > 14. According to the TODO code valid only for 5 GHz
should be removed.

- find and remove remaining code valid only for 5 GHz. Most of the
  obvious ones have been removed, but things like channel > 14 still
  exist.

Remove ODM_GetRightChnlPlaceforIQK() and replace the uses of the
return value with zero.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200110210456.13178-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: exfat: Fix alignment warnings
Pragat Pandya [Sat, 11 Jan 2020 14:22:33 +0000 (19:52 +0530)]
staging: exfat: Fix alignment warnings

Fix checkpatch warning "Alignment should match open parenthesis".

Signed-off-by: Pragat Pandya <pragat.pandya@gmail.com>
Link: https://lore.kernel.org/r/20200111142233.11354-1-pragat.pandya@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8188eu: remove unused parameters from rtw_check_network_type
Michael Straube [Mon, 13 Jan 2020 21:29:39 +0000 (22:29 +0100)]
staging: rtl8188eu: remove unused parameters from rtw_check_network_type

Parameters 'ratelen' and 'channel' of function rtw_check_network_type are
unused, remove them. Reduces object file size by 62 bytes.

  text    data     bss     dec     hex filename
398525   12896    4688  416109   6596d drivers/staging/rtl8188eu/r8188eu.o
398463   12896    4688  416047   6592f drivers/staging/rtl8188eu/r8188eu.o

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200113212939.9738-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoiio: imu: adis: use new `delay` structure for SPI transfer delays
Alexandru Ardelean [Tue, 10 Dec 2019 14:07:55 +0000 (16:07 +0200)]
iio: imu: adis: use new `delay` structure for SPI transfer delays

In a recent change to the SPI subsystem [1], a new `delay` struct was added
to replace the `delay_usecs`. This change replaces the current `delay_usecs`
with `delay` for this driver.

The `spi_transfer_delay_exec()` function [in the SPI framework] makes sure
that both `delay_usecs` & `delay` are used (in this order to preserve
backwards compatibility).

[1] commit bebcfd272df6485 ("spi: introduce `delay` field for
`spi_transfer` + spi_transfer_delay_exec()")

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: stm32-dfsdm: adapt sampling rate to oversampling ratio
Olivier Moysan [Wed, 27 Nov 2019 13:10:08 +0000 (14:10 +0100)]
iio: adc: stm32-dfsdm: adapt sampling rate to oversampling ratio

Update sampling rate when oversampling ratio is changed
through the IIO ABI.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>