iio: light: isl29018: Only declare ACPI table when ACPI is enabled
This fixes the following warning when building with clang:
drivers/iio/light/isl29018.c:808:36: error: variable
'isl29018_acpi_match' is not needed and will not be emitted
[-Werror,-Wunneeded-internal-declaration]
HID sensor hubs using Integrated Senor Hub (ISH) has added capability to
support batch mode. This allows host processor to go to sleep for extended
duration, while the sensor hub is storing samples in its internal buffers.
'Commit f4f4673b7535 ("iio: add support for hardware fifo")' implements
feature in IIO core to implement such feature. This feature is used in
bmc150-accel-core.c to implement batch mode. This implementation allows
software device buffer watermark to be used as a hint to adjust hardware
FIFO.
But HID sensor hubs don't allow to change internal buffer size of FIFOs.
Instead an additional usage id to set "maximum report latency" is defined.
This allows host to go to sleep upto this latency period without getting
any report. Since there is no ABI to set this latency, a new attribute
"hwfifo_timeout" is added so that user mode can specify a latency.
This change checks presence of usage id to get/set maximum report latency
and if present, it will expose hwfifo_timeout.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 25 Apr 2017 08:06:33 +0000 (04:06 -0400)]
iio: tsl2583: add runtime power management support
This patch adds runtime power management support to the tsl2583 driver.
The device is powered off after two seconds of inactivity. Verified that
the driver still functions correctly using a TSL2581 hooked up to a
Raspberry Pi 2.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Mike Looijmans [Mon, 8 May 2017 07:26:24 +0000 (09:26 +0200)]
iio:ad5064: Add support for ltc2633 and similar devices
The Linear Technology LTC2631, LTC2633 and LTC2635 are very similar
to the AD5064 device, in particular the LTC2627.
This patch adds support for those devices. Only the LTC2633 has been
tested, which is the 2-channel variant. The LTC2631 is the 1-channel,
and the LTC2635 the 4-channel version. The actual DAC resolution depends
on the exact chip type and can be 12, 10 or 8 bits, using the upper bits
so this has no effect on the register map. The internal reference is set
to 2.5V on "L" versions, and it's 4.096V for "H" versions.
iio: pressure: zpa2326: report interrupted case as failure
If the timeout-case prints a warning message then probably the interrupted
case should also. Further, wait_for_completion_interruptible_timeout()
returns long not int.
Fixes: commit 03b262f2bbf4 ("iio:pressure: initial zpa2326 barometer support") Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fabrice Gasnier [Tue, 2 May 2017 12:33:45 +0000 (14:33 +0200)]
iio: stm32 trigger: Add support for TRGO2 triggers
Add support for TRGO2 trigger that can be found on STM32F7.
Add additional master modes supported by TRGO2.
Register additional "tim[1/8]_trgo2" triggers for timer1 & timer8.
Detect TRGO2 timer capability (master mode selection 2).
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Stefan Brüns [Mon, 1 May 2017 11:19:42 +0000 (13:19 +0200)]
iio: adc: Fix bad GENMASK use, typos, whitespace
Commit 7906dd52c5a0 ("iio: ina2xx: Fix whitespace and re-order code")
changed the register number of the MASK_ENABLE register from 0x06 to the
value equivalent GENMASK(2,1), although its no mask.
Also fix a typo (INA2_6_6 instead of INA2_2_6), and use the datasheet
name ("Mask/Enable") for the register number define.
Fix bad indentation for channel attributes.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Julia Lawall [Thu, 4 May 2017 20:10:52 +0000 (22:10 +0200)]
iio: hid-sensor-accel-3d: Drop unnecessary static
Drop static on a local variable, when the variable is initialized before
use, on every possible execution path through the function. The static has
no benefit, and dropping it reduces the code size.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@bad exists@
position p;
identifier x;
type T;
@@
static T x@p;
...
x = <+...x...+>
@@
identifier x;
expression e;
type T;
position p != bad.p;
@@
-static
T x@p;
... when != x
when strict
?x = e;
// </smpl>
The change in code size is indicates by the following output from the size
command.
before:
text data bss dec hex filename
3879 512 8 4399 112f drivers/iio/accel/hid-sensor-accel-3d.o
after:
text data bss dec hex filename
3863 512 0 4375 1117 drivers/iio/accel/hid-sensor-accel-3d.o
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
tsl2x7x: remove paragraph about writing to the FSF's mailing address
Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF
has changed addresses in the past, and may do so again. Linux
already includes a copy of the GPL.
Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Meson GX SoCs however use some magic bits to prevent simultaneous (=
conflicting, because only consumer should use the FIFO buffer with the
ADC results) usage by the Linux kernel and the bootloader (the BL30
bootloader uses the SAR ADC to read the CPU temperature).
This patch changes guards all BL30 functionality so it is skipped on
SoCs which don't have it. Since the hardware itself doesn't know whether
BL30 is available the internal meson_sar_adc_data is extended so this
information can be provided per of_device_id.data inside the driver.
Additionally the clocks "adc_clk" and "adc_sel" are not provided by the
clock-controller itself. "adc_sel" is not available at all. "adc_clk"
is provided by the SAR ADC IP block itself on Meson8b (and earlier).
This is already supported by the meson_saradc driver.
Finally this introduces new of_device_ids for the Meson8 and Meson8b
SoCs so the driver can be wired up in the corresponding DT.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
dt-bindings: iio: adc: add Meson8 and Meson8b support
The Amlogic Meson SAR ADC driver can be used on Meson8 and Meson8b
(probably on earlier SoC generations as well, but I don't have any
hardware available for testing that).
Add a separate compatible for Meson8 and Meson8b because it does not
need any of the BL30 magic (unlike the GX SoCs).
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: meson-saradc: mark all meson_sar_adc_data static and const
These are only passed as of_device_id.data and never modified. Thus we
can mark them as static const, just like the of_device_id instances
where they are used.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Song Hongyan [Sun, 7 May 2017 10:24:26 +0000 (18:24 +0800)]
iio: hid-sensor-rotation: Add "scale" and "offset" properties parse support
Add orientation sensor "scale" and "offset" parse support.
These two properties are needed for exponent data conversion.
Signed-off-by: Song Hongyan <hongyan.song@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Xu Even <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Geomagnetic orientation(AM) sensor is one kind of orientation 6dof sensor.
It gives the device rotation in respect to the earth center and the
magnetic north. The sensor is implemented through use of an accelerometer
and magnetometer do not use gyroscope. It is a standard HID sensor.
More information can be found in:
http://www.usb.org/developers/hidpage/HUTRR59_-_Usages_for_Wearables.pdf
Geomagnetic orientation(AM) sensor and dev rotation sensor have same
channel and share channel usage id. So the most of the code for relative
orientation sensor can be reused.
Signed-off-by: Song Hongyan <hongyan.song@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Song Hongyan [Sun, 7 May 2017 10:24:24 +0000 (18:24 +0800)]
iio: hid-sensor-rotation: Add relative orientation sensor hid support
Relative orientation(AG) sensor is a 6dof orientation sensor,
it depends on acceleration and gyroscope sensor data. It gives
a quaternion describing the orientation of the device relative
to an initial orientation. It is a standard HID sensor.
More information can be found in:
http://www.usb.org/developers/hidpage/HUTRR59_-_Usages_for_Wearables.pdf
Relative orientation(AG) sensor and dev rotation sensor have same
channels and share channel usage id. So the most of the code for
relative orientation sensor can be reused.
Signed-off-by: Song Hongyan <hongyan.song@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Xu Even <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lorenzo Bianconi [Thu, 27 Apr 2017 20:31:56 +0000 (22:31 +0200)]
iio: imu: st_lsm6dsx: add system power management support
Add system sleep power management support to st_lsm6dsx driver.
In particular during suspend phase each sensor is disabled and
hw fifo is configured in bypass in order to avoid subsequent
I/O operations. The patch has been tested on HiKey board device
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29030 is basically the same chip. The only difference
is the chip's first pin. For isl29028 its named ADDR0 and
can be used to change the chip's i2c address. For isl29030
on the other hand that pin is named Ials and is an analog
current output proportional to ALS/IR. This change is
irrelevant for the Linux driver.
This has been tested on Motorola Droid 4.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Colin Ian King [Wed, 19 Apr 2017 14:35:48 +0000 (15:35 +0100)]
iio: hid-sensor: fix return of -EINVAL on invalid values in ret or value
Ensure that when an invalid value in ret or value is found -EINVAL
is returned. A previous commit broke the way the return error is
being returned and instead caused the return code in ret to be
re-assigned rather than be returned.
Fixes: 5d9854eaea776 ("iio: hid-sensor: Store restore poll and hysteresis on S3") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sekhar Nori [Fri, 21 Apr 2017 12:31:25 +0000 (18:01 +0530)]
tools/iio: Use include/uapi with __EXPORTED_HEADERS__
Use the local uapi headers to keep in sync with "recently" added enum
values like IIO_UVINDEX.
Build tested using:
$ make -C <kernelsrcdir> tools/iio
$ make -C <kernelsrcdir>/tools iio
$ make -C <kernelsrcdir>/tools/iio
This follows a strategy similar to that used by tools/hv, tools/net and
tools/leds among others.
Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Marek Vasut [Thu, 20 Apr 2017 15:42:16 +0000 (17:42 +0200)]
iio: adc: rcar-gyroadc: Drop if clock from Renesas GyroADC bindings
The "if" interface clock speed is actually derived from the "fck"
block clock, as in the hardware they are the same clock. Drop the
incorrect second "if" clock and retain only the "fck" clock.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Rob Herring <robh@kernel.org> Cc: linux-renesas-soc@vger.kernel.org
To: devicetree@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Marek Vasut [Thu, 20 Apr 2017 15:43:10 +0000 (17:43 +0200)]
iio: adc: rcar-gyroadc: Derive interface clock speed from fck clock
The "if" interface clock speed is actually derived from the "fck"
block clock, as in the hardware they are the same clock. Drop the
incorrect second "if" clock and get the clock speed from "fck".
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Cc: linux-renesas-soc@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: st_pressure: st_accel: Initialise sensor platform data properly
This patch fixes the sensor platform data initialisation for st_pressure
and st_accel device drivers. Without this patch, the driver fails to
register the sensors when the user removes and re-loads the driver.
1. Unload the kernel modules for st_pressure
$ sudo rmmod st_pressure_i2c
$ sudo rmmod st_pressure
Brian Masney [Tue, 25 Apr 2017 01:34:33 +0000 (21:34 -0400)]
staging: iio: isl29028: correct proximity sleep times
The sysfs attribute in_proximity_sampling_frequency_available currently
shows the values 1 3 5 10 13 20 83 100. These values are supposed to
correspond to the sleep values 800 400 200 100 75 50 12.5 0 (all in ms).
When passing in a sampling frequency of 3, it actually uses a sleep
time of 200ms instead of the expected 400ms value. This patch changes
the value shown by this sysfs attribute to use fixed-point numbers so
that the correct sampling frequency is shown to the user. This patch
also changes the code that updates the proximity sampling frequency to
only allow values that are shown in the _available sysfs attribute.
The original code showed the value 83 that corresponds to the sleep
time 12 ms. The data sheet actually lists 12.5 ms as the sleep time,
so the proximity frequency was updated to 80.
Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Rosin [Thu, 20 Apr 2017 21:01:57 +0000 (23:01 +0200)]
iio: inkern: fix a static checker error
Avoid this smatch error:
drivers/iio/inkern.c:751 iio_read_avail_channel_raw() error: double unlock 'mutex:&chan->indio_dev->info_exist_lock'
Fixes: 00c5f80c2fad ("iio: inkern: add helpers to query available values from channels") Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:12 +0000 (11:27 -0700)]
staging: android: ion: Remove ion_handle and ion_client
ion_handle was introduced as an abstraction to represent a reference to
a buffer via an ion_client. As frameworks outside of Ion evolved, the dmabuf
emerged as the preferred standard for use in the kernel. This has made
the ion_handle an unnecessary abstraction and prone to race
conditions. ion_client is also now only used internally. We have enough
mechanisms for race conditions and leaks already so just drop ion_handle
and ion_client. This also includes ripping out most of the debugfs
infrastructure since much of that was tied to clients and handles.
The debugfs infrastructure was prone to give confusing data (orphaned
allocations) so it can be replaced with something better if people
actually want it.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The current model of Ion heap registration is based on the outdated
model of board files. The replacement for board files (devicetree)
isn't a good replacement for what Ion wants to do. In actuality, Ion
wants to show what memory is available in the system for something else
to figure out what to use. Switch to a model where Ion creates its
device unconditionally and heaps are registed as available regions.
Currently, only system and CMA heaps are converted over to the new
model. Carveout and chunk heaps can be converted over when someone wants
to figure out how.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ion current has ion_priv.h and ion.h as header files. ion.h was intended
to be used for public APIs but Ion never ended up really having anything
public. Combine the two headers so there is only one internal header.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:08 +0000 (11:27 -0700)]
staging: android: ion: Get rid of ion_phys_addr_t
Once upon a time, phys_addr_t was not everywhere in the kernel. These
days it is used enough places that having a separate Ion type doesn't
make sense. Remove the extra type and just use phys_addr_t directly.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:07 +0000 (11:27 -0700)]
staging: android: ion: Break the ABI in the name of forward progress
Several of the Ion ioctls were designed in such a way that they
necessitate compat ioctls. We're breaking a bunch of other ABIs and
cleaning stuff up anyway so let's follow the ioctl guidelines and clean
things up while everyone is busy converting things over anyway. As part
of this, also remove the useless alignment field from the allocation
structure.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:05 +0000 (11:27 -0700)]
staging: android: ion: Use CMA APIs directly
When CMA was first introduced, its primary use was for DMA allocation
and the only way to get CMA memory was to call dma_alloc_coherent. This
put Ion in an awkward position since there was no device structure
readily available and setting one up messed up the coherency model.
These days, CMA can be allocated directly from the APIs. Switch to using
this model to avoid needing a dummy device. This also mitigates some of
the caching problems (e.g. dma_alloc_coherent only returning uncached
memory).
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Tue, 18 Apr 2017 18:27:03 +0000 (11:27 -0700)]
cma: Store a name in the cma structure
Frameworks that may want to enumerate CMA heaps (e.g. Ion) will find it
useful to have an explicit name attached to each region. Store the name
in each CMA structure.
Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge tag 'iio-fixes-for-4.11e' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Fifth set of IIO fixes for the 4.11 cycle.
As these are rather late in the cycle, they may sneak over into 4.12.
There is a fix for a regression caused by another fix (hid sensors
hardware seems to vary a lot in how various corner cases are handled).
* ad7303
- fix channel description. Numeric values were being passed as characters
presumably leading to garbage from the userspace interface.
* as3935
- the write data macro was wrong so fix it.
* bmp280
- incorrect handling of negative values as being unsigned broke humidity
calculation.
* hid-sensor
- Restore the poll and hysteresis values after resume as some hardware
doesn't do it.
* stm32-trigger
- buglet in reading the sampling frequency
Merge tag 'iio-for-4.12d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Fourth set of IIO new device support, features and cleanups for the 4.12 cycle
New device support
* max1117, 1118 and 1119
- new ADC driver
* max9611
- new ADC driver
* pm8xxx hk/xoadc
- new driver with some shared features broken out from the SPMI vadc.
* sun4i-gpadc
- A33 thermal sensor support (with associated rework)
* stm32-dac
- new driver and bindings
* stm32 trigger
- enable support of quadrature encoder device and counter modes
Features
* apds9960
- use the runtime pm for normal suspend
* stm32-adc
- add opition to sest resolution via devicetree
* xoadc
- augment DT bindings to deal with some weird mux cases
Cleanups
* ad5933
- protect direct mode using claim and release helpers
* ade7759
- S_IRUGO and friends to octal in two goes
* adis16203
- drop unnecessary brackets
* hid-sensor
- fix unbalanced pm_runtieme_enable error when probing after remove
* lsm6dsx
- use actual part numbers for device name when known
- simplify data read pin parsing
* mpu3050
- avoid double reporting errors
Martin Karamihov [Mon, 17 Apr 2017 17:00:25 +0000 (20:00 +0300)]
staging: rtl8192u: fix incorrect type in assignment in ieee80211_tx.c
This patch fixes the following sparse warning:
ieee80211_tx.c:174:36: incorrect type in assignment (different base types)
ieee80211_tx.c:174:36: expected unsigned short [unsigned] [short] [usertype] <noident>
ieee80211_tx.c:174:36: got restricted __be16 [usertype] <noident>
by adding left side cast to __be16.
Signed-off-by: Martin Karamihov <martinowar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8188eu: fix sparse signedness warnings in rtw_generate_ie
Changed the type of wpa_ie_len from (int *) to (unsigned int *) in the
function rtw_get_wpa_ie(..) to suppress signedness mismatch warnings in
rtw_generate_ie of the type-
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60: warning: incorrect
type in argument 2 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60: expected int
*wpa_ie_len
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:1009:60: got unsigned
int *<noident>
staging: rtl8188eu: fix sparse signedness warnings in rtw_set_ie
Changed the type of sz from (int) to (unsigned int) to suppress
signedness mismatch warnings of the type-
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97: warning:
incorrect type in argument 5 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97: expected
unsigned int [usertype] *frlen
drivers/staging/rtl8188eu//core/rtw_ieee80211.c:258:97: got int
*<noident>
staging: rtl8188eu: fix sparse signedness warnings in rtw_get_ie
Changed the type of len from (int *) to (unsigned int *) in the
function rtw_get_ie(..) and wherever this function is called to
suppress signedness mismatch warnings of the type-
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60: warning: incorrect type
in argument 3 (different signedness)
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60: expected int *len
drivers/staging/rtl8188eu//core/rtw_ap.c:78:60: got unsigned int
*<noident>
Colin Ian King [Thu, 13 Apr 2017 15:46:36 +0000 (16:46 +0100)]
staging: rtl8723bs: clean up identical code on an if statement
The two different paths for an if statement are identical and hence
we can just replace it with the single statement.
Detected by CoverityScan, CID#1428443 ("Identical code for
different branches")
Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Colin Ian King [Thu, 13 Apr 2017 14:13:46 +0000 (15:13 +0100)]
staging: rtl8723bs: remove redundant comparisons of unsigned ints with >= 0
The comparison of mode >= 0 is redundant as mode is a u32 and this
is always true. Remove this redundant code.
Detected with CoverityScan ("Unsigned compared against 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gstreamer's v4l2src reacted poorly to certain outputs from the bcm2835
video driver's ioctl ops function vidioc_enum_framesizes, so a
workaround was created that could be activated by user input. This
workaround would replace the driver's ioctl ops struct with another,
similar struct--only with no function pointed to by
vidioc_enum_framesizes. With no response, gstreamer would attempt to
continue with some default settings that happened to work better.
However, this bug has been fixed in gstreamer since 2014, so we
shouldn't include this workaround in the stable version of the driver.
Signed-off-by: Kevin Wern <kevin.m.wern@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Driver SDIO code uses helper functions to do IO to the SDIO
device. Current helpers handle IO of a single byte as well as
multi-byte. Driver predominately uses single byte IO. If the
common case is made simple it simplifies the whole driver. The common
case can be made simple by splitting the multi-byte and single byte
calls into separate functions, i.e 4 functions in total, read single
byte, read multi-byte, write single byte, write multi-byte.
Also, we need to handle the debug code. Currently debug calls after
read/write fail access the IO buffer. This buffer, at best, does not hold
useful data on the error path, at worst is uninitialized and holds
garbage.
Split read/write helper functions into two functions each, one for
single byte IO and one for multi-byte IO. Fix all call sites. Do not
change the program logic.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
SDIO code currently has a number of unneeded comments. Following
kernel coding style we do not need extraneous comments, especially on
code where it is clear what is being done. Spelling typos can be
fixed.
Remove unnecessary comments, fix typos in comments.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: ks7010: move hw info into dev private data
Currently driver uses a hardware information struct description to
group some SDIO related functionality (work, work queue, sdio private
data pointer). This structure is then embedded in the device private
data structure. Having nested structures described in different header
files means that to view the device private data programmers must open
two header files. This structure could be embedded anonymously in the
device private data and achieve the same result (grouping of function
specific to SDIO) without the need to open multiple headers. However,
the SDIO private data structure already has various different data and
pointers, adding the embedded structure adds little extra meaning and
lengthens all the dereferences throughout the driver, often meaning
addition line breaks and braces. We can increase readability and
reduce code complexity by moving the hardware information data and
pointers to directly be within the device private data structure
description.
While preparing for this refactoring it was noted that the identifier
currently used for the delayed work is 'rw_wq', this is confusing
since the 'wq' suffix typically means 'work queue'. This identifier
would be more meaningful if it used the suffix 'dwork' as does the
declaration of queue_delayed_work() (include/linux/workqueue.h).
The identifier for the work queue is currently 'ks7010sdio_wq'. This
identifier can be shortened without loss of meaning because there is
only one work queue within the driver. Identifier 'wq' is typical
within in-tree driver code and aptly describes the pointer.
Current pointer to the SDIO private data is identified by 'sdio_card',
this is sufficiently meaningful from within the hw_info structure but
once the hw_info_t structure is removed the pointer would be better to
have a prefix appended to it to retain the prior level of meaning.
Move members from struct hw_info_t to struct ks_wlan_private.
Rename identifiers;
struct delayed_work pointer 'rw_wq' to 'rw_dwork'.
struct workqueue_struct pointer 'ks7010sdio_wq' to 'wq'.
struct ks_sdio_card pointer 'sdio_card' to 'ks_sdio_card'.
Remove structure description hw_info_t. Fix init/destroy calls. Fix
all call sites, SDIO private data access calls, and queuing calls.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: ks7010: move tasklet_struct to ks_wlan_private
Currently a pointer to the tasklet_struct used for bottom half
processing on the receive path is within the hw_info_t structure. This
structure is then embedded in the device private data
structure. Having the tasklet_struct nested does not add meaning to
the device private data, device private data already (and typically)
has various data relating to the device, there is no real need to
separate the tasklet_struct to a SDIO specific structure. While not
adding allot of extra meaning having the nested structure means the
programmer must open two header files to read the description of the
device private data, the code would be easier to read if the device
private data struct description was not spread over two files.
Move tasklet_struct out of sdio header file and into the device
private data structure description.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
struct work_struct uses identifier ks_wlan_wakeup_task, this is
confusing because the 'task' suffix implies that this is a
tasklet_struct instead of a work struct. Suffix 'work' would be more
clear. The code would be easier to read if it followed the principle
of least surprise and used the 'work' suffix for a work_struct
identifier.
Rename work_struct structure 'ks_wlan_wakeup_task' to 'wakeup_work'.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
SDIO header file does not use kernel doc format struct
comments. Adding them aids readability and enables documentation to be
built from the source code. Other comments may be tidied up as we do this.
Add kernel format struct comments. Tidy up comments.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
complete_handler() takes void * types as parameters. void * parameters are then
cast to struct types. Call sites for this function either pass in NULL
or pointers to the struct types cast to void *. This casting is
unnecessary and can be removed.
Struct tx_device_buffer (which contains a pointer member to the
complete_handler() function) has as member 'ks_wlan_priv *priv' this is
unnecessary, we always have a pointer to this struct there is no need
to store it here.
The complete_handler can be more clearly defined by using struct
pointer types instead of void * types. The code is currently
unnecessarily complex, storing and passing extraneous pointer
parameters.
Header has multiple constants defined using preprocessor
directive. In the cases where these are an integer progression an
enumeration type can be used. Doing so adds documentation to the code
and makes the usage explicit. Maintain original constant value, this
value is returned by the device.
Replace (integer progression) preprocessor constants with enumeration
type.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
SDIO header currently defines unused constants READ_STATUS_BUSY and
WRITE_STATUS_IDLE. There are reciprocal constants that are used
READ_STATUS_IDLE and WRITE_STATUS_BUSY. We can roll these into a
single enumeration type and remove the two that are unused.
Add enumeration type containing IDLE/BUSY pair that are currently used
within the SDIO source. Change source to use new enum types.
Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32
The struct lu_dirpage elements in lustre_idl.h file are modified to
__le64 and __le32 types since the elements are always converted from
litte endian to processor native format in mdc_request.c file.
Following warnings are removed by this fix.
drivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted __le32
drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted __le64
Staging: lustre cleanup macros in libcfs_private.h
This resolves a checkpatch warning that "Single statement macros should
not use a do {} while (0) loop" by removing the loop and adjusting line
length accordingly.
Alexandre Bailon [Sun, 26 Mar 2017 16:58:23 +0000 (18:58 +0200)]
staging: greybus: make cport_quiesce() method optional
The cport_quiesce() method is mandatory in the case of
the es2 Greybus hd controller to shutdown the cports on
the es2 controller.
In order to add support of another controller which may not
need to shutdown its cports, make the cport_quiesce() optional,
and check if the controller implement it before to use it.
Andreas Klinger [Mon, 10 Apr 2017 17:00:01 +0000 (19:00 +0200)]
IIO: bmp280-core.c: fix error in humidity calculation
While calculating the compensation of the humidity there are negative values
interpreted as unsigned because of unsigned variables used. These values as
well as the constants need to be casted to signed as indicated by the
documentation of the sensor.
Signed-off-by: Andreas Klinger <ak@it-klinger.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support for STMicroelectronics STM32 DAC. It's a 12-bit, voltage
output digital-to-analog converter. It has two output channels, each
with its own converter.
It supports 8 bits or 12bits left/right aligned data format. Only
12bits right-aligned is used here. It has built-in noise or
triangle waveform generator, and supports external triggers for
conversions.
Each channel can be used independently, with separate trigger, then
separate IIO devices are used to handle this. Core driver is intended
to share common resources such as clock, reset, reference voltage and
registers.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging: iio: ad5933: Protect DIRECT mode using claim/release helpers
This device operates in DIRECT_MODE and BUFFER_HARDWARE mode.
Replace usages of iio_dev->mlock with iio_device_{claim|release}_direct_mode()
helper functions to guarantee DIRECT mode and consequently protect
BUFFER mode too.
Add and use a device private lock to protect against conflicting access of the
state data.
This helps with IIO subsystem redefining iio_dev->mlock to be used by
the IIO core only for protecting device operating mode changes.
ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.
Protect changing of attributes inside ad5933_store(). Attributes
can no longer be changed while in buffered mode.
Remove lock from ad5933_work() because buffer mode should be enabled
when we reach this, and claiming DIRECT mode in all the other places
should protect it.
Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Akinobu Mita [Tue, 28 Mar 2017 16:34:48 +0000 (01:34 +0900)]
iio: adc: add max1117/max1118/max1119 ADC driver
This adds max1117/max1118/max1119 8-bit, dual-channel ADC driver.
This new driver uses the zero length spi_transfers with the cs_change
flag set and/or the non-zero delay_usecs.
1. The zero length transfer with the spi_transfer.cs_change set is
required in order to select CH1. The chip select line must be brought
high and low again without transfer.
2. The zero length transfer with the spi_transfer.delay_usecs > 0 is
required for waiting the conversion to be complete. The conversion
begins with the falling edge of the chip select. During the conversion
process, SCLK is ignored.
These two usages are unusual. But the spi controller drivers that use
a default implementation of transfer_one_message() are likely to work.
(I've tested this adc driver with spi-omap2-mcspi and spi-xilinx)
On the other hand, some spi controller drivers that have their own
transfer_one_message() may not work. But at least for the zero length
transfer with delay_usecs > 0, I'm proposing a new testcase for the
spi-loopback-test that can test whether the delay_usecs setting has
taken effect.
Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Cc: Rob Herring <robh+dt@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
One of the features of STM32 trigger hardware block is a quadrature
encoder that can counts up/down depending of the levels and edges
of the selected external pins.
This patch allow to read/write the counter, get it direction,
set/get quadrature modes and get scale factor.
When counting up preset value is the limit of the counter.
When counting down the counter start from preset value down to 0.
This preset value could be set/get by using
/sys/bus/iio/devices/iio:deviceX/in_count0_preset attribute.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com> Reviewed-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Matt Ranostay [Fri, 14 Apr 2017 06:21:56 +0000 (23:21 -0700)]
iio: proximity: as3935: fix as3935_write
AS3935_WRITE_DATA macro bit is incorrect and the actual write
sequence is two leading zeros.
Cc: George McCollister <george.mccollister@gmail.com> Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>