Documentation: dt-bindings: add the Amlogic Meson SAR ADC documentation
This adds the devicetree binding documentation for the SAR ADC found in
Amlogic Meson SoCs.
Currently only the GXBB, GXL and GXM SoCs are supported.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Tested-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Maury Anderson <maury.anderson@rockwellcollins.com> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com> Signed-off-by: Slawomir Stepien <sst@poczta.fm> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Marek Vasut [Fri, 27 Jan 2017 23:08:37 +0000 (00:08 +0100)]
iio: adc: Add Renesas GyroADC driver
Add IIO driver for the Renesas RCar GyroADC block. This block is a
simple 4/8-channel ADC which samples 12/15/24 bits of data every
cycle from all channels.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Simon Horman <horms+renesas@verge.net.au> Cc: Jonathan Cameron <jic23@kernel.org> Cc: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Marek Vasut [Fri, 27 Jan 2017 23:08:36 +0000 (00:08 +0100)]
iio: adc: Add Renesas GyroADC bindings
Add DT bindings for the Renesas RCar GyroADC block. This block is
a simple 4/8-channel ADC which samples 12/15/24 bits of data every
cycle from all channels.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Simon Horman <horms+renesas@verge.net.au> Cc: Jonathan Cameron <jic23@kernel.org> Cc: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang <wsa@the-dreams.de> Cc: Rob Herring <robh@kernel.org> Acked-by: Rob Herring <robh@kernel.org> Cc: devicetree@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Colin Vidal [Thu, 26 Jan 2017 19:22:00 +0000 (20:22 +0100)]
staging/rtl8192u: add endianness conversions
Fields frag_size and playload_size of struct ieee80211_txb are encoded
as short little-endian. This patch adds conversions to / from cpu byte
order when copy / write these values in variables of architecture
independent byte order. It also avoid a sparse type warning.
Signed-off-by: Colin Vidal <colin@cvidal.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Arnd Bergmann [Wed, 25 Jan 2017 22:36:34 +0000 (23:36 +0100)]
staging: lustre: ptlrpc: avoid warning on missing return
The newly added function triggers a harmless warning:
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c: In function 'lustre_shrink_msg':
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c:472:1: error: control reaches end of non-void function [-Werror=return-type]
This probably happens because LASSERTF() contains an 'unlikely()' that
sometimes prevents gcc from analysing the control flow correctly.
Adding a return statement here seems harmless and lets us keep that
unlikely().
Fixes: 96049bd1ecd0 ("staging: lustre: ptlrpc: embed highest XID in each request") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Johan Hovold [Thu, 26 Jan 2017 11:37:32 +0000 (12:37 +0100)]
staging: greybus: loopback: fix broken udelay
The loopback driver allows the user to set a minimum delay of up to one
second to be inserted between test iterations (i.e. request
submissions). The delay is currently specified in microseconds and is
implemented using udelay.
Busy looping for long periods is not just anti-social; udelay must not
be used for delays longer than a few milliseconds due to the risk of
integer overflow.
Replace the broken udelay with a usleep_range with a 100 us range for
short delays (< 20 ms) and otherwise revert to using msleep.
Linus Walleij [Fri, 20 Jan 2017 09:46:05 +0000 (10:46 +0100)]
iio: accel: fix Kconfig warning
commit 762227721fe6225be5b6d233ef681aea5871f5f3
"iio: accel: st_accel: handle deprecated bindings"
attempted to be smart and let users use the old I2C
driver and the new SPI driver, or the old SPI driver and
the new I2C driver in combination for the LIS3LV02,
and put the restrictions on the I2C and SPI subdrivers
not not be combined with the old subdrivers.
This doesn't work since the IIO ST accel top-level
component selects the I2C and SPI subdrivers, resulting
in the following Kconfig noise:
warning: (IIO_ST_ACCEL_3AXIS) selects IIO_ST_ACCEL_I2C_3AXIS
which has unmet direct dependencies (IIO && !SENSORS_LIS3_I2C
&& IIO_ST_ACCEL_3AXIS && IIO_ST_SENSORS_I2C)
warning: (IIO_ST_ACCEL_3AXIS) selects IIO_ST_ACCEL_SPI_3AXIS
which has unmet direct dependencies (IIO && !SENSORS_LIS3_SPI
&& IIO_ST_ACCEL_3AXIS && IIO_ST_SENSORS_SPI)
(...)
This fixes the issue by putting the dependencies directly
in the top-level component instead, so that it never gets
to select its unselectable subcomponent.
Merge tag 'iio-for-4.11b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into work-next
Jonathan writes:
Second round of IIO new device support, cleanups and features for the 4.11 cycle
New device support:
* lsm6dsx imu
- new driver and bindings.
* max11100 adc
- new driver and bindings.
* tlc4541
- new driver
* tmp007 thermopile
- new driver.
Core
* in kernel interfaces
- pass through raw values if no scaling provided and a processed value is
requested.
* trigger
- close a race condition in acquiring trigger reference.
- constify device_type structures.
- rework the viio_trigger_alloc function to be much neater and easier to
read.
- free trigger resources correctly on some error paths. Avoids putting a
module we don't have.
Documentation
* ABI
- specify a unit for proximity measurements.
Cleanups and features
* ads1015
- constify iio_info structure.
* ads7950 cleanups following merge in previous pull
- Add device tree bindings
- Drop the ti prefix from the module name in common with other drivers.
- Change regulator name to vref to match datasheet and other drivers.
* ak8974
- remove a redundant zero timeout check.
* bmi160
- use variable names for sizeof instead of types.
* cm3605
- mark PM functions as __maybe_unused to avoid a build warning.
* isl29028 (on it's way towards moving out of staging).
- alignment fixes and newline improvements.
- combine proxim_get and read_proxim for simpler code.
- drop unused ISL29028_DEV_ATTR macro
- move some error logging into functions to cut out repitition.
- make error messages more consistent.
- tidy up some brackets.
- drop the enable flag that nothing uses.
- only set proximity rate and ALS scale when relevant channel type is enabled.
- runtime pm support.
* lsm6dsx
- fix wrong values for gyro sensitivitiy.
* mag3110
- claim direct mode during sysfs reads to avoid a race condition.
* max1363
- export OF device table IDs as module aliases.
* max30100
- use msleep for long uncritical delays.
* mcp4531
- export OF device table as module aliases.
* ms5611
- claim direct mode during sysfs reads to avoid a race condition.
* opt3001
- export OF device table as module aliases.
* sx9500
- claim direct mode during oversampling changes to avoid a race condition.
Alison Schofield [Fri, 20 Jan 2017 03:47:38 +0000 (19:47 -0800)]
iio: trigger: free trigger resource correctly
These stand-alone trigger drivers were using iio_trigger_put()
where they should have been using iio_trigger_free(). The
iio_trigger_put() adds a module_put which is bad since they
never did a module_get.
In the sysfs driver, module_get/put's are used as triggers are
added & removed. This extra module_put() occurs on an error path
in the probe routine (probably rare).
In the bfin-timer & interrupt trigger drivers, the module resources
are not explicitly managed, so it's doing a put on something that
was never get'd. It occurs on the probe error path and on the
remove path (not so rare).
Tested with the sysfs trigger driver.
The bfin & interrupt drivers were build tested & inspected only.
Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Dan Carpenter [Sat, 21 Jan 2017 04:55:58 +0000 (07:55 +0300)]
iio: trigger: clean up viio_trigger_alloc()
1) Reverse the test for kmalloc() failure so we can pull everything
back one tab.
2) Use gotos for unwinding.
3) Some of the extra line breaks for the 80 character limit are no
longer needed so we can remove them.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Bhumika Goyal [Sat, 21 Jan 2017 17:03:00 +0000 (22:33 +0530)]
iio: adc: constify iio_info structures
Declare iio_info structures as const as they are only stored in
the info field of a iio_dev structure. This field is of type const,
so iio_info structures having similar properties can be made const too.
File size before:
text data bss dec hex filename
6944 792 0 7736 1e38 drivers/iio/adc/ti-ads1015.o
File size after:
text data bss dec hex filename
7264 472 0 7736 1e38 drivers/iio/adc/ti-ads1015.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Declare device_type structure as const as it is only stored in the
type field of a device structure. This field is of type const, so add
const to declaration of device_type structure.
File size before:
text data bss dec hex filename
5389 208 48 5645 160d iio/industrialio-trigger.o
File size after:
text data bss dec hex filename
5453 176 48 5677 162d iio/industrialio-trigger.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Sun, 22 Jan 2017 03:28:52 +0000 (19:28 -0800)]
iio: trigger: close race condition in acquiring trigger reference
In iio_trigger_write_current() we find the trigger we want while
holding mutex on the list of triggers, but we don't actually do a
get on it while holding mutex. We wait until further validations
are completed and we're sure it's the one we want. Race condition
is that it could be freed by the time we do the get.
Solution is to grab the trigger (iio_trigger_get) as soon as we
find it while holding mutex on the list of triggers. If later
we decide it's not the right one, put it back. (iio_trigger_put).
Brian Masney [Tue, 17 Jan 2017 09:25:02 +0000 (04:25 -0500)]
staging: iio: isl29028: add runtime power management support
This patch adds runtime power management support to the isl29028 driver.
It defaults to powering off the device after two seconds of inactivity.
isl29028_chip_init_and_power_on() currently only zeros the CONFIGURE
register on the chip, which will cause the chip to turn off. This patch
also renames that function to isl29028_clear_configure_reg() since it is
now used in several places.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:25:01 +0000 (04:25 -0500)]
staging: iio: isl29028: only set ALS scale when ALS/IR sensing is enabled
isl29028_chip_init_and_power_on() calls isl29028_set_als_scale() and
this is not needed until the user actually needs to take a reading from
the ALS/IR sensor. This patch moves the isl29028_set_als_scale() call
from isl29028_chip_init_and_power_on() to isl29028_set_als_ir_mode().
This sets the stage for faster resume times from runtime power
management if the user is only querying the proximity sensor.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:25:00 +0000 (04:25 -0500)]
staging: iio: isl29028: only set proximity sampling rate when proximity is enabled
isl29028_chip_init_and_power_on() calls isl29028_set_proxim_sampling()
and this is not needed until the user actually needs to take a proximity
reading. This patch moves the isl29028_set_proxim_sampling() call from
isl29028_chip_init_and_power_on() to isl29028_enable_proximity().
This sets the stage for faster resume times from the runtime power
management if the user is only querying the ALS/IR sensor.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:59 +0000 (04:24 -0500)]
staging: iio: isl29028: remove enable flag from isl29028_enable_proximity()
isl29028_enable_proximity() has a boolean argument named enable. This
function is only called once and the enable flag is set to true in that
call. This patch removes the enable parameter from that function.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29028_write_raw() contains unnecessary parenthesis when checking to
see if the passed in lux scale is valid. This patch removes the
unnecessary parenthesis.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:57 +0000 (04:24 -0500)]
staging: iio: isl29028: remove out of memory log message
If the call to devm_iio_device_alloc() fails, then isl29028_probe()
logs a message saying that memory cannot be allocated. The user's system
most likely has larger issues at this point. This patch removes that
error message since the error code is passed on and the message is not
necessary.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:56 +0000 (04:24 -0500)]
staging: iio: isl29028: remove unnecessary error logging in isl29028_chip_init_and_power_on()
If the call to isl29028_chip_init_and_power_on() in isl29028_probe()
fails, then isl29028_probe() will log an error message. All of the
error paths in that call path already have error logging in place. This
patch removes the unnecessary logging.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:54 +0000 (04:24 -0500)]
staging: iio: isl29028: move failure logging into isl29028_set_als_scale()
When isl29028_set_als_scale() fails, it was up to both callers to log
the failure message. This patch moves the logging into
isl29028_set_als_scale() to reduce the overall amount of code in the
driver.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:53 +0000 (04:24 -0500)]
staging: iio: isl29028: move failure logging into isl29028_set_proxim_sampling()
When isl29028_set_proxim_sampling() fails, it was up to both callers to
log the failure message. This patch moves the logging into
isl29028_set_proxim_sampling() to reduce the overall amount of code in
the driver.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:48 +0000 (04:24 -0500)]
staging: iio: isl29028: made alignment of variables in struct isl29028_chip consistent
The alignment of the variables in the struct isl29028_chip is not
consistent. This changes all of the variables to use consistent
alignment to improve the code readability.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:50 +0000 (04:24 -0500)]
staging: iio: isl29028: combine isl29028_proxim_get() and isl29028_read_proxim()
isl29028_proxim_get() checks to see if the promixity needs to be
enabled on the chip and then calls isl29028_read_proxim(). There
are no other callers of isl29028_read_proxim(). The naming between
these two functions can be confusing so this patch combines the
two to avoid the confusion.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 17 Jan 2017 09:24:49 +0000 (04:24 -0500)]
staging: iio: isl29028: fix alignment of function arguments
Two separate calls to regmap_update_bits() in isl29028_set_als_scale()
and isl29028_set_als_ir_mode() did not have their function arguments
on the next line aligned correctly to the open parenthesis. This patch
corrects the alignment.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: max1363: Export OF device ID table as module aliases
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the
device was registered via OF, this means that exporting the OF device ID
table device aliases in the module is not needed. But in order to change
how the core reports modaliases to user-space, it's better to export it.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: potentiometer: mcp4531: Export OF device ID table as module aliases
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the
device was registered via OF, this means that exporting the OF device ID
table device aliases in the module is not needed. But in order to change
how the core reports modaliases to user-space, it's better to export it.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: light: opt3001: Export OF device ID table as module aliases
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the
device was registered via OF, this means that exporting the OF device ID
table device aliases in the module is not needed. But in order to change
how the core reports modaliases to user-space, it's better to export it.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: health: max30100: use msleep() for long uncritical delays
ulseep_range() uses hrtimers and provides no advantage over msleep()
for larger delays. Fix up the 35ms delays here to use msleep() and
reduce the load on the hrtimer subsystem.
Fixes: commit 4d33615df58b ("iio: light: add MAX30100 oximeter driver support") Link: http://lkml.org/lkml/2017/1/11/377 Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Phil Reid [Mon, 16 Jan 2017 08:38:24 +0000 (16:38 +0800)]
iio: adc: tlc4541: add support for TI tlc4541 adc
This adds TI's tlc4541 16-bit ADC driver. Which is a single channel
ADC. Supports raw and trigger buffer access.
Also supports the tlc3541 14-bit device, which has not been tested.
Implementation of the tlc3541 is fairly straight forward thou.
Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Mon, 16 Jan 2017 05:01:10 +0000 (21:01 -0800)]
iio: bmi160: use variable names for sizeof() operator
Replace the types with the actual variable names when using the
sizeof() operator. This is kernel preferred style as it's
more obvious that it is correct.
Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Arnd Bergmann [Fri, 20 Jan 2017 16:25:15 +0000 (17:25 +0100)]
iio: light: cm3605: mark PM functions as __maybe_unused
When CONFIG_PM_SLEEP is disabled, we get a harmless warning
drivers/iio/light/cm3605.c:292:12: error: 'cm3605_pm_resume' defined but not used [-Werror=unused-function]
drivers/iio/light/cm3605.c:281:12: error: 'cm3605_pm_suspend' defined but not used [-Werror=unused-function]
Marking the functions as possibly unused avoids the warning without
needing to add an #ifdef.
Fixes: 8afa505c1230 ("iio: light: add driver for Capella CM3605") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Fri, 20 Jan 2017 20:22:58 +0000 (12:22 -0800)]
iio: pressure: ms5611: claim direct mode during oversampling changes
Driver was checking for direct mode before changing oversampling
ratios, but was not locking it. Use the claim/release helper
functions to guarantee the device stays in direct mode while the
oversampling ratios are being updated. Continue to use the drivers
private state lock to protect against conflicting direct mode access
of the state data.
Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Fri, 20 Jan 2017 22:11:30 +0000 (14:11 -0800)]
iio: proximity: sx9500: claim direct mode during raw proximity reads
Driver was checking for direct mode but not locking it. Use the
claim/release helper functions to guarantee the device stays in
direct mode during raw reads of proximity data.
Alison Schofield [Fri, 20 Jan 2017 20:39:32 +0000 (12:39 -0800)]
iio: magnetometer: mag3110: claim direct mode during raw writes
Driver was checking for direct mode but not locking it. Use
claim/release helper functions to guarantee the device stays
in direct mode during raw writes.
Signed-off-by: Alison Schofield <amsfield22@gmail.com> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Andy Shevchenko [Thu, 19 Jan 2017 10:45:44 +0000 (12:45 +0200)]
staging: fbtft: fb_ssd1306: Support smaller screen sizes
There is 64x48 display exists. In order to support that set multiplexer
to 48 pixels and window address to proper position in the graphic display
data RAM.
Andy Shevchenko [Thu, 19 Jan 2017 10:45:42 +0000 (12:45 +0200)]
staging: fbtft: remove custom DMA mapped buffer
There is no need to duplicate what SPI core already does, i.e. mapping buffers
for DMA capable transfers.
Remove all related pices of code.
Note, that code, besides its redundancy, was buggy: DMA address potentially can
be 0, SPI slave device has nothing to do with DMA capable device properties and
DMA mask in particular.
Andy Shevchenko [Thu, 19 Jan 2017 10:45:41 +0000 (12:45 +0200)]
staging: fbtft: convert fbtft_reset() to be non-atomic
First of all, fbtft in current state doesn't allow to override GPIOs to be
optional, like "reset" one. It might be a bug somewhere, but rather out of
scope of this fix.
Second, not all GPIOs available on the board would be SoC based, some of them
might sit on I2C GPIO expanders, for example, on Intel Edison/Arduino, and thus
any communication with them might sleep.
Besides that using udelay() and mdelay() is kinda resource wasteful.
Summarize all of the above, convert fbtft_reset() function to non-atomic
variant by using gpio_set_value_cansleep(), usleep_range(), and msleep().
Shyam Saini [Mon, 16 Jan 2017 04:18:19 +0000 (09:48 +0530)]
staging: rtl8188eu: core: Remove NULL test before vfree
vfree frees the virtually continuous block of memory beginning at
addr. If addr is NULL, no operation is performed. So, NULL test is not
needed before vfree().