Oscar Carter [Mon, 20 Apr 2020 15:52:46 +0000 (17:52 +0200)]
staging: vt6656: Use fls instead of for loop in vnt_update_top_rates
Replace the for loops of the vnt_update_top_rates function by the fls
function.
The purpose of the two for loops is to find the most significant bit set
in a range of bits. So, they can be replace by the fls function (find
last set) with a previous mask to define the range.
This way avoid the iteration over unnecessary for loops.
The header "linux/bits.h" can be remove as it is included in the header
"linux/bitops.h".
Oscar Carter [Sat, 18 Apr 2020 13:45:53 +0000 (15:45 +0200)]
staging: vt6656: Refactor the vnt_ofdm_min_rate function
Replace the for loop by a ternary operator whose condition is an AND
bitmask against the priv->basic_rates variable.
The purpose of the for loop was to check if any of bits from RATE_54M to
RATE_6M was set, but it's not necessary to check every individual bit.
The same result can be achieved using only one single mask which
comprises all the commented bits.
This way avoid the iteration over an unnecessary for loop.
Also change the return type to bool because it's the type that this
function returns.
Xiyu Yang [Thu, 23 Apr 2020 05:15:40 +0000 (13:15 +0800)]
staging: gasket: Fix mapping refcnt leak when register/store fails
gasket_sysfs_register_store() invokes get_mapping(), which returns a
reference of the specified gasket_sysfs_mapping object to "mapping" with
increased refcnt.
When gasket_sysfs_register_store() returns, local variable "mapping"
becomes invalid, so the refcount should be decreased to keep refcount
balanced.
The reference counting issue happens in one exception handling path of
gasket_sysfs_register_store(). When gasket_dev is NULL, the function
forgets to decrease the refcnt increased by get_mapping(), causing a
refcnt leak.
Fix this issue by calling put_mapping() when gasket_dev is NULL.
Xiyu Yang [Thu, 23 Apr 2020 05:14:55 +0000 (13:14 +0800)]
staging: gasket: Fix mapping refcnt leak when put attribute fails
gasket_sysfs_put_attr() invokes get_mapping(), which returns a reference
of the specified gasket_sysfs_mapping object to "mapping" with increased
refcnt.
When gasket_sysfs_put_attr() returns, local variable "mapping" becomes
invalid, so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in one path of
gasket_sysfs_put_attr(). When mapping attribute is unknown, the function
forgets to decrease the refcnt increased by get_mapping(), causing a
refcnt leak.
Fix this issue by calling put_mapping() when put attribute fails due to
unknown attribute.
Staging: rtl8723bs: rtw_wlan_util: Add size check of SSID IE
Add size check of SSID information element in incoming 802.11
frames, to prevent memcpy() of IE in array bssid->Ssid.Ssid, with
size more than 32 bytes.
drivers/staging/rtl8723bs/hal/sdio_halinit.c: In function HalRxAggr8723BSdio:
drivers/staging/rtl8723bs/hal/sdio_halinit.c:547:24: warning: variable pregistrypriv set but not used [-Wunused-but-set-variable]
Jason Yan [Fri, 17 Apr 2020 07:34:39 +0000 (15:34 +0800)]
staging: rtl8723bs: remove defined but not used 'dB_Invert_Table'
Fix the following gcc warning:
drivers/staging/rtl8723bs/hal/odm.c:10:18: warning: ‘dB_Invert_Table’
defined but not used [-Wunused-const-variable=]
static const u16 dB_Invert_Table[8][12] = {
^~~~~~~~~~~~~~~
Jason Yan [Fri, 17 Apr 2020 07:33:10 +0000 (15:33 +0800)]
staging: rtl8723bs: remove some variables in hal_btcoex.c
Fix the following gcc warning:
drivers/staging/rtl8723bs/hal/hal_btcoex.c:45:26: warning: ‘ioStaString’
defined but not used [-Wunused-const-variable=]
static const char *const ioStaString[] = {
^~~~~~~~~~~
drivers/staging/rtl8723bs/hal/hal_btcoex.c:38:26: warning:
‘h2cStaString’ defined but not used [-Wunused-const-variable=]
static const char *const h2cStaString[] = {
^~~~~~~~~~~~
drivers/staging/rtl8723bs/hal/hal_btcoex.c:33:26: warning:
‘BtLinkRoleString’ defined but not used [-Wunused-const-variable=]
static const char *const BtLinkRoleString[] = {
^~~~~~~~~~~~~~~~
drivers/staging/rtl8723bs/hal/hal_btcoex.c:23:26: warning:
‘BtSpecString’ defined but not used [-Wunused-const-variable=]
static const char *const BtSpecString[] = {
^~~~~~~~~~~~
drivers/staging/rtl8723bs/hal/hal_btcoex.c:15:26: warning:
‘BtProfileString’ defined but not used [-Wunused-const-variable=]
static const char *const BtProfileString[] = {
^~~~~~~~~~~~~~~
In former code, the field wvif->state was more or less redundant with
vif->type. With the lasts change it has become unused. It is now time to
drop it.
In wfx_remove_interface(), the current code differentiate AP and Station
cases. However, it is not necessary. In all cases, the only important
thing is the call to hif_reset(). We can use the same code to support
all cases.
staging: wfx: drop protection for asynchronous join during scan
In former code (before the inclusion of the driver in mainline kernel),
hif_join() could run asynchronously. When a join request was in
progress, it was forbidden to launch hif_scan().
Now, hif_join() is always run synchronously. There is no more reasons to
keep a protection against this case.
staging: wfx: keys are kept during whole firmware life
Keys sent to the firmware are never reset. So, it is not necessary to
re-upload them after hif_reset(). Thus, it is no more necessary to keep
a copy of the keys in struct wfx_dev.
The structure hif_req_set_bss_params come from hardware API. It is not
intended to be manipulated in upper layers of the driver.
In add, current code for hif_req_set_bss_params() is too dumb. It should
pack data with hardware representation instead of leaving all work to
the caller.
staging: wfx: field operational_rate_set is ignored by firmware
The field bss_params.operational_rate_set is ignore by the firmware. It
is not necessary to send it. This change greatly simplify
wfx_join_finalize(). It is no more necessary to get sta and it allow to
save a RCU.
staging: wfx: also fix network parameters for IBSS networks
Current code skip some configuration during joining an IBSS network.
Indeed, it seems that this configuration is not used in IBSS. However,
it would be harmless to set them. In add, we would prefer to keep
association processes for ad-hoc and managed networks the closest as
possible. It also ensures the values of internal parameters of the
firmware.
Currently, events from firmware are handled in a work queue with a
complex event queue mechanism. It is probably overkill since there is
only two events to handle: bss_loss and CQM events. Handling these
events synchronously is sufficient.
Since wfx_bss_params_work() does not exist anymore, there is no more
reason to keep a copy of bss_params in struct wfx_dev. A local instance
in wfx_join_finalize() is sufficient.
staging: wfx: use ieee80211_beacon_loss() provided by mac80211
The firmware is able to filter beacons and send a notification if one or
multiple beacons are not received. Note that it send this notification
only once. Only if it receive beacons gain, it send a new notification.
Currently, the driver handle the connection loss itself (see
wfx_cqm_bssloss_sm()). It send null frames and watch the answers.
This patch fixes all this mess:
- settle firmware to send a notification on the first beacon loss
- call ieee80211_beacon_loss() and let mac80211 handle all the process
- since we do have notification for each beacon loss, add a period
task that call ieee80211_beacon_loss() until we receive "REGAIN"
notification.
Thus, we can drop the ugly wfx_cqm_bssloss_sm() and
wfx_bss_params_work().
Merge tag 'iio-for-5.8a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First set of new IIO device support, features and cleanup for the 5.8 cycle
Usual mix of new drivers, new support in old drivers and lots of minor
cleanup. Yaml conversions also continue to trickle in (plenty more to go!)
New device support
* ad7476
- Add ad7091 support (ID only)
* ad9467
- New driver for this 200/250 MSPS adi-axi-adc and SPI attached ADC.
* adi-axi-adc
- New driver to support ADIs generic AXI ADC IP core, used to provide
high speed interfaces to ADCs (JESD204B/C or parallel interfaces). Usually
paired with a device using a slow configuration interface (spi etc)
Includes DT bindings and some fixes for fpga headers.
* bmg160
- Add support for BMI088 (ID only)
* max1241
- New driver for this ADC.
* st_sensors
- Add support for LIS2HH12 accelerometer
* sx9310
- New driver supporting sx9310 and sx9311 proximity sensors.
Features
* st_lsm6dsx
- Add LIS3MDL as a possible sensor hub device.
* vcnl4000
- Add new concept of near level (from DT) to provide to userspace which
often needs to have some calibrated concept of 'near'.
Cleanups, minor fixes etc.
* core
- Use snprintf for functions where strings are built and there is
potential for overflow.
- Correct docs to indicate mlock should not be used directly by drivers.
- Fix up accidental dropping of a patch to use bitmap_zalloc.
- Stop allowing enabling of buffers with no channels enabled.
- Drop unused 'stufftoread' from iio_buffer.
- Drop scan_el_attrs form iio_buffer as unused.
- Reorder sanity checks in __iio_device_register to fail earlier.
- Drop all the devm_ runregister / free functions from IIO as they
were never used and encourage poor design.
* dma-buffer
- Tidy up includes.
* dma-engine-buffer
- Provide dev-managed allocator.
- Fix an issue with printing a size_t
* cross subsystem (kxsd9, bmg160, mpu3050, bmi160, mpu6050, bmc150)
- Replace some unnecessary casts of error ptrs and whilst there.
use the %pe printf parameter to print them in a more useful fashion.
* cross subsystem
- Drop casts in calls to regmap_bulk_read as they make no sense.
- Use devm_platform_ioremap_resource to reduce boilerplate.
- Fix typos in Analog Devices.
* counters/104-quad
- Add Syed Nayyar Waris as an additional maintainer.
* ad7476
- Generate CONVST signal internally rather than requiring external
trigger. Add sysfs read back as can now do so.
- use devm_add_action_or_reset to tidy up error and remove handling.
* ad7793
- Switch to read_avail from explicit attribute. Mostly done to avoid
confusing people with a - sign (without surounding spaces) that
was correct but checkpatch didn't like.
* adis library
- Add missing newlines at end of error messages.
* adis16400
- Use DEFINE_DEBUGS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTR.
* adis16460
- Use DEFINE_DEBUGS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTR.
* ad_sigma_delta
- Move some channel definitions into individual drivers to avoid
having to deal with complex options.
* ak8974
- Silence an error on deffered probe.
* bmp280
- Harden against IRQ before registration.
- Convert to read_avail instead of opencoding the equivalent.
- Explicitly mark GPIO as optional.
- Cleanup casts.
- Remove line breaks from strings.
* htts221
- Replace direct access to platform_data with dev_get_platdata().
- Use device properties rather than device tree ones to allow ACPI
probing.
- Casting cleanups.
* intel_mrfld_adc
- Don't use unaligned accessor for aligned data.
* isl29125
- Reorder buer pre and post hooks to allow for coming core rework.
* ltc2983
- Remove comp to bool.
* max1363
- Stop using mlock from the iio_dev directly in favour of a local lock
with clearly defined scope.
* max30100
- Use generic device properties to allow ACPI probe.
* mpu6050
- Convert to i2c_new_client_device.
- Add debugfs register access.
* st_lsm6dsx
- Provide means of configuring full scale on slave device if supported.
- Drop include of st_sensors header to get one value. Its not otherwise
used by this driver.
* st-sensors
- Replace direct access to platform_data with dev_get_platdata().
- Casting cleanups.
- Avoid splitting strings.
* st_uvis25
- Casting cleanups.
* tsl2563
- Typo fix.
* tsl2772
- scnprintf in a non obvious string building usecase. Note also 'fixes'
a wrong calculation of remaining space that couldn't actually cause
any trouble as there was lots of room.
* xilinx-xadc
- Fix Lars-Peter spelling his own name wrong :) + additional typos.
* tag 'iio-for-5.8a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (101 commits)
iio: magnetometer: ak8974: Silence deferred-probe error
Documentation: ABI: document IIO in_proximity_nearlevel file
iio: vcnl4000: Export near level property for proximity sensor
dt-bindings: iio: light: vcnl4000: Add proximity-near-level
dt-bindings: iio: Introduce common properties for iio sensors
dt-bindings: iio: vcnl4000: convert bindings to YAML format
iio: Fix misspellings of "Analog Devices"
iio: light: isl29125: fix iio_triggered_buffer_{predisable,postenable} positions
iio: adc: fsl-imx25-gcq: Use devm_platform_ioremap_resource
iio: adc: at91-adc: Use devm_platform_ioremap_resource
iio: adc: sun4i-gpadc-iio: Use devm_platform_ioremap_resource
iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read
iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk*
iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.
iio:chemical:bme680: Tidy up parameters to regmap_bulk_read
iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls
iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls
iio: imu: st_lsm6dsx: drop huge include in sensor-hub driver
iio: buffer: drop devm_iio_kfifo_free() API call
iio: buffer: drop devm_iio_hw_consumer_free() API call
...
It's not uncommon that voltage regulator becomes available later during
kernel's boot process. This patch adds info message about unavailable
regulators in a case of the deferred-probe error and also amends the
error message with a error code.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: vcnl4000: Export near level property for proximity sensor
When an object can be considered close to the sensor is hardware
dependent. Allowing to configure the property via device tree
allows to configure this device specific value.
This is useful for e.g. iio-sensor-proxy to indicate to userspace
if an object is close to the sensor.
Signed-off-by: Guido Günther <agx@sigxcpu.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
dt-bindings: iio: Introduce common properties for iio sensors
Introduce a file for common properties of iio sensors. So far this
contains the new proximity-near-level property for proximity sensors
that indicates when an object should be considered near.
Signed-off-by: Guido Günther <agx@sigxcpu.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The iio_triggered_buffer_{predisable,postenable} functions attach/detach
the poll functions.
For the predisable hook, the disable code should occur before detaching
the poll func, and for the postenable hook, the poll func should be
attached before the enable code.
This change reworks the predisable/postenable hooks so that the pollfunc is
attached/detached in the correct position.
It also balances the calls a bit, by grouping the preenable and the
iio_triggered_buffer_postenable() into a single
isl29125_buffer_postenable() function.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: adc: fsl-imx25-gcq: Use devm_platform_ioremap_resource
Use the helper function that wraps the calls to
platform_get_resource() and devm_ioremap_resource()
together. It reduces boilerplate and suggested by coccinelle.
Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: adc: at91-adc: Use devm_platform_ioremap_resource
Use the helper function that wraps the calls to
platform_get_resource() and devm_ioremap_resource()
together. It reduces boilerplate and suggested by coccinelle.
Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: adc: sun4i-gpadc-iio: Use devm_platform_ioremap_resource
Use the helper function that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together. Reduces boilerplate and suggested
by coccinelle.
Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read
This only occurs once in the driver and isn't needed in this case either,
so drop it.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk*
Given the parameter is void *, casting to u8 * is unnecessary.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Daniel Baluta <daniel.baluta@gmail.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.
A mixture of:
* Casts to u8 * for the val parameter which is void * and so needs no cast.
* Explicit sizes when we can use sizeof on the destination / source variable.
Not broken in anyway, I'm just trying to tidy up the is in the subsystem to
avoid it getting cut and paste into new drivers.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
iio:chemical:bme680: Tidy up parameters to regmap_bulk_read
A mixture of:
* Unnecessary casts of val parameter to u8 * which makes little sense as
the function take a void *.
* Explicit sizes where we can use the destination type to define that.
Note that's not true in all cases as we do read 3 bytes into 4 byte
destinations.
Note that noting was broken here, I'm just trying to ensure this doesn't
get cut and paste into more drivers so cleaning these out subsystem wide.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Himanshu Jha <himanshujha199640@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls
regmap_bulk_read takes a void * for its val parameter. It certainly
makes no sense to cast to a (u8 *) + no need to explicitly cast
at all when converting another pointer type to void *.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls
regmap_bulk_read takes a void * for its val parameter. It certainly
makes no sense to cast to a (u8 *) + no need to explicitly cast
at all when converting another pointer type to void *.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
iio: imu: st_lsm6dsx: drop huge include in sensor-hub driver
st_lsm6dsx is a standalone driver for STM IMU sensors and does not rely
on st_sensor common framework, so it does not include st_sensor common
definitions.
In st_lsm6dsx_shub driver st_sensors.h is used just to introduce the
default wai address for LIS3MDL sensor.
Drop this largely unconnected include file and introduce the default wai
address for LIS3MDL in st_lsm6dsx_ext_dev_settings register map
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: move 'indio_dev->info' null check first in __iio_device_register()
Moves this to be the first check, as it's very simple and fails the
registration earlier, instead of potentially initializing the
'indio_dev->label' and checking for duplicate indexes, and then failing
with this simple-check.
This is a minor optimization, since '__iio_device_register()' will waste
fewer validation cycles in case 'indio_dev->info' is NULL.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: buffer: remove 'scan_el_attrs' attribute group from buffer struct
This field doesn't seem used. It seems that only 'buffer->attrs' was ever
used to extend sysfs attributes for an IIO buffer.
Moving forward, it may not make sense to keep it. This patch removes the
field and it's initialization code.
Since we want to rework IIO buffer, to be able to add more buffers per IIO
device, we will merge [somehow] the 'buffer' & 'scan_elements' groups, and
we will continue to add the attributes to the 'buffer' group.
Removing it here, will also make the rework here a bit smaller, since
this code will not be present.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: imu: adis: Add a missing '\n' in a log message
Message logged by 'dev_xxx()' or 'pr_xxx()' should end with a '\n'.
Fixes: a06bf25ec439 ("iio: imu: adis: add support product ID check in adis_initial_startup") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Johan Jonker [Sat, 4 Apr 2020 10:27:30 +0000 (12:27 +0200)]
dt-bindings: iio: adc: rockchip-saradc: add description for px30
The description below is already in use for px30.dtsi,
but was somehow never added to a document, so add
"rockchip,px30-saradc", "rockchip,rk3399-saradc"
for saradc nodes on a px30 platform to rockchip-saradc.yaml.
Signed-off-by: Johan Jonker <jbx6244@gmail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Johan Jonker [Sat, 4 Apr 2020 10:27:29 +0000 (12:27 +0200)]
dt-bindings: iio: adc: rockchip-saradc: add description for rk3308
The description below is already in use for rk3308.dtsi,
but was somehow never added to a document, so add
"rockchip,rk3308-saradc", "rockchip,rk3399-saradc"
for saradc nodes on a rk3308 platform to rockchip-saradc.yaml.
Signed-off-by: Johan Jonker <jbx6244@gmail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Johan Jonker [Sat, 4 Apr 2020 10:27:28 +0000 (12:27 +0200)]
dt-bindings: iio: adc: convert rockchip saradc bindings to yaml
Current dts files with 'saradc' nodes are manually verified.
In order to automate this process rockchip-saradc.txt
has to be converted to yaml.
Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: dma-buffer: Cleanup buffer.h/buffer_impl.h includes
The IIO DMA buffer is a DMA buffer implementation. As such it should
include buffer_impl.h rather than buffer.h.
The include to buffer.h in buffer-dma.h should be buffer_impl.h so it has
access to the struct iio_buffer definition. The code currently only works
because all places that use buffer-dma.h include buffer_impl.h before it.
The include to buffer.h in industrialio-buffer-dma.c can be removed since
those file does not reference any of buffer consumer functions.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Tested-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Lazar [Fri, 3 Apr 2020 12:13:23 +0000 (15:13 +0300)]
iio: adc: Add MAX1241 driver
Add driver for the Maxim MAX1241 12-bit, single-channel ADC.
Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX1240-MAX1241.pdf Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Alexandru Lazar <alazar@startmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Lazar [Fri, 3 Apr 2020 12:13:22 +0000 (15:13 +0300)]
dt-bindings: iio: adc: Add MAX1241 bindings
Add device-tree bindings documentation for the MAX1241 device driver.
Signed-off-by: Alexandru Lazar <alazar@startmail.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu> Reviewed-by: Stephan Gerhold <stephan@gerhold.net> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Rohit Sarkar [Tue, 31 Mar 2020 11:47:31 +0000 (17:17 +0530)]
iio: imu: adis16460: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE
debugfs_create_file_unsafe does not protect the fops handed to it
against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of
the file lifetime and thus protects it against removal.
Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Tested-by Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Rohit Sarkar [Tue, 31 Mar 2020 11:47:30 +0000 (17:17 +0530)]
iio: imu: adis16400: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE
debugfs_create_file_unsafe does not protect the fops handed to it
against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of
the file lifetime and thus protects it against removal.
Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Tested-by Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Thu, 19 Mar 2020 21:02:45 +0000 (22:02 +0100)]
iio: imu: st_lsm6dsx: configure full scale on slave device if supported
Introduce st_lsm6dsx_shub_set_full_scale routine in order to configure
the i2c slave device sensitivity
Tested-by: Jimmy Assarsson <jimmyassarsson@gmail.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
dt-bindings: iio: adc: add bindings doc for AD9467 ADC
This change adds the binding doc for the AD9467 ADC.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The AD9467 is a 16-bit, monolithic, IF sampling analog-to-digital converter
(ADC). It is optimized for high performanceover wide bandwidths and ease of
use. The product operates at a 250 MSPS conversion rate and is designed for
wireless receivers, instrumentation, and test equipment that require a high
dynamic range. The ADC requires 1.8 V and 3.3 V power supplies and a low
voltage differential input clock for full performance operation. No
external reference or driver components are required for many applications.
Data outputs are LVDS compatible (ANSI-644 compatible) and include the
means to reduce the overall current needed for short trace distances.
Since the chip can operate at such high sample-rates (much higher than
classical interfaces), it requires that a DMA controller be used to
interface directly to the chip and push data into memory.
Typically, the AXI ADC IP core is used to interface with it.
dt-bindings: iio: adc: add bindings doc for AXI ADC driver
This change adds the bindings documentation for the AXI ADC driver.
Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: adc: adi-axi-adc: add support for AXI ADC IP core
This change adds support for the Analog Devices Generic AXI ADC IP core.
The IP core is used for interfacing with analog-to-digital (ADC) converters
that require either a high-speed serial interface (JESD204B/C) or a source
synchronous parallel interface (LVDS/CMOS).
Usually, some other interface type (i.e SPI) is used as a control interface
for the actual ADC, while the IP core (controlled via this driver), will
interface to the data-lines of the ADC and handle the streaming of data
into memory via DMA.
Because of this, the AXI ADC driver needs the other SPI-ADC driver to
register with it. The SPI-ADC needs to be register via the SPI framework,
while the AXI ADC registers as a platform driver. The two cannot be ordered
in a hierarchy as both drivers have their own registers, and trying to
organize this [in a hierarchy becomes] problematic when trying to map
memory/registers.
There are some modes where the AXI ADC can operate as standalone ADC, but
those will be implemented at a later point in time.
DocLink: https://wiki.analog.com/resources/fpga/docs/axi_adc_ip Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
iio: buffer-dmaengine: use %zu specifier for sprintf(align)
The 'size_t' type behaves differently on 64-bit architectures, and causes
compiler a warning of the sort "format '%u' expects argument of type
'unsigned int', but argument 3 has type 'size_t {aka long unsigned int}'".
This change adds the correct specifier for the 'align' field.
Fixes: a7621d0dffefb ("iio: buffer-dmaengine: Report buffer length requirements") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
include: fpga: adi-axi-common.h: add version helper macros
The format for all ADI AXI IP cores is the same.
i.e. 'major.minor.patch'.
This patch adds the helper macros to be re-used in ADI AXI drivers.
Acked-by: Moritz Fischer <mdf@kernel.org> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
include: fpga: adi-axi-common.h: fixup whitespace tab -> space
The initial version use a tab between '#define' & 'ADI_AXI_REG_VERSION'.
This changes it to space. The change is purely cosmetic.
Acked-by: Moritz Fischer <mdf@kernel.org> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This seems like a left-over from 9130350c34755 ("staging:iio: Add polling
of events on the ring access chrdev.").
Then it was moved into the sca3000 driver around c98573f911071 ("iio:
staging: sca3000: hide stufftoread logic"), and that one seemed to be the
only user of this.
Then it eventually was no longer used after 2b7d56842526
("staging:iio:accel:sca3000 move to hybrid hard / soft buffer design.")
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
because DEBUG_SHIRQ mechanism fires an IRQ before registration and drivers
ought to be able to handle an interrupt happening before request_irq() returns.
Fixes: 293d6f900507 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nishant Malpani [Sun, 22 Mar 2020 17:23:15 +0000 (22:53 +0530)]
iio: magn: bmc150: Use vsprintf extension %pe for symbolic error name
Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.
Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nishant Malpani [Sun, 22 Mar 2020 17:23:12 +0000 (22:53 +0530)]
iio: imu: inv_mpu6050_spi: Use vsprintf extension %pe for symbolic error name
Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.
Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nishant Malpani [Sun, 22 Mar 2020 17:23:11 +0000 (22:53 +0530)]
iio: imu: inv_mpu6050_i2c: Use vsprintf extension %pe for symbolic error name
Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.
Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nishant Malpani [Sun, 22 Mar 2020 17:23:10 +0000 (22:53 +0530)]
iio: imu: bmi160_spi: Use vsprintf extension %pe for symbolic error name
Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.
Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nishant Malpani [Sun, 22 Mar 2020 17:23:09 +0000 (22:53 +0530)]
iio: imu: bmi160_i2c: Use vsprintf extension %pe for symbolic error name
Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.
Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>