Bartosz Golaszewski [Mon, 7 Oct 2019 02:41:31 +0000 (04:41 +0200)]
iio: pressure: bmp280: use devm action and remove labels from probe
We can drop some duplicate code if we use devm_action for disabling
regulators and pm and the managed variant of iio_device_register().
This allows us to completely remove all remove() callbacks from both
i2c and spi code.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Bartosz Golaszewski [Wed, 2 Oct 2019 08:57:56 +0000 (10:57 +0200)]
iio: pressure: bmp280: use bulk regulator ops
The vddd and vdda supplies are always operated on together. We can
shrink the code a bit by using the bulk regulator helpers.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Robert Jones [Mon, 14 Oct 2019 18:49:21 +0000 (11:49 -0700)]
iio: imu: Add support for the FXOS8700 IMU
FXOS8700CQ is a small, low-power, 3-axis linear accelerometer and 3-axis
magnetometer combined into a single package. The device features a
selectable I2C or point-to-point SPI serial interface with 14-bit
accelerometer and 16-bit magnetometer ADC resolution along with
smart-embedded functions.
FXOS8700CQ has dynamically selectable accelerationfull-scale ranges of
±2 g/±4 g/±8 g and a fixed magnetic measurement range of ±1200 μT.
Output data rates (ODR) from 1.563 Hz to 800 Hz are selectable by the user
for each sensor. Interleaved magnetic and acceleration data is available
at ODR rates of up to 400 Hz. FXOS8700CQ is available in a plastic QFN
package and it is guaranteed to operate over the extended temperature
range of –40 °C to +85 °C.
TODO: Trigger and IRQ configuration support
Datasheet:
http://cache.freescale.com/files/sensors/doc/data_sheet/FXOS8700CQ.pdf
Signed-off-by: Robert Jones <rjones@gateworks.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Robert Jones [Mon, 14 Oct 2019 18:49:20 +0000 (11:49 -0700)]
dt-bindings: iio: imu: add fxos8700 imu binding
This adds documentation for the Freescale FXOS8700 Inertial Measurement Unit
device-tree bindings.
Signed-off-by: Robert Jones <rjones@gateworks.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Chuhong Yuan [Wed, 16 Oct 2019 14:25:40 +0000 (22:25 +0800)]
staging: iio: ad9834: add a check for devm_clk_get
ad9834_probe misses a check for devm_clk_get and may cause problems.
Add a check like what ad9832 does to fix it.
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jonathan Cameron [Sun, 13 Oct 2019 16:48:48 +0000 (17:48 +0100)]
iio: adc: xilinx-xadc: use devm_platform_ioremap_resource
Reduces local boilerplate.
Suggested by coccinelle.
CHECK drivers/iio/adc/xilinx-xadc-core.c
drivers/iio/adc/xilinx-xadc-core.c:1184:1-11: WARNING: Use devm_platform_ioremap_resource for xadc -> base
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Manish Narani <manish.narani@xilinx.com>
Reviewed-by: Sven Van Asbroeck <TheSven73@gmail.com>
Jonathan Cameron [Sun, 13 Oct 2019 18:10:13 +0000 (19:10 +0100)]
iio: temp: maxim thermocouple: Drop unneeded semi colon.
Identified by coccinelle
CHECK drivers/iio/temperature/maxim_thermocouple.c
drivers/iio/temperature/maxim_thermocouple.c:197:3-4: Unneeded semicolon
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Jonathan Cameron [Sun, 13 Oct 2019 16:21:33 +0000 (17:21 +0100)]
iio: adc: cpcap-adc: Fix missing IRQF_ONESHOT as only threaded handler.
Coccinelle noticed:
CHECK drivers/iio/adc/cpcap-adc.c
drivers/iio/adc/cpcap-adc.c:1009:9-34: ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT
As far as I can see this is a simple case of it should be specified
but isn't.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Jonathan Cameron [Sun, 13 Oct 2019 15:37:59 +0000 (16:37 +0100)]
iio: adc: meson_saradc: use devm_platform_ioremap_resource
Avoid local boilerplate.
Suggested by coccinelle via coccicheck.
CHECK drivers/iio/adc/meson_saradc.c
drivers/iio/adc/meson_saradc.c:1218:1-5: WARNING: Use devm_platform_ioremap_resource for base
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jonathan Cameron [Sun, 13 Oct 2019 12:35:24 +0000 (13:35 +0100)]
iio: adc: exynos: use devm_platform_ioremap_resource
Reduce local boilerplate.
Identified by coccinelle
drivers/iio/adc/exynos_adc.c:792:1-11: WARNING: Use devm_platform_ioremap_resource for info -> regs
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Jonathan Cameron [Sun, 13 Oct 2019 12:35:23 +0000 (13:35 +0100)]
iio: adc: exynos: Drop a stray semicolon
Identified by coccinelle
drivers/iio/adc/exynos_adc.c:654:2-3: Unneeded semicolon
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Jonathan Cameron [Sun, 13 Oct 2019 10:26:00 +0000 (11:26 +0100)]
iio: proximity: pulsedlight v2: Tidy up an endian issue
Sparse identified the following
CHECK drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
This cleans up by adding a local variable to hold the value whilst
it is __be16 before applying endian converstion into eventual destination.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Jonathan Cameron [Sun, 13 Oct 2019 10:17:42 +0000 (11:17 +0100)]
iio: pressure: bmp280 endian tidy ups
There is a somewhat interesting mixture of be16 and le16 going on in
this one function. Changes here formalize that a little more.
CHECK drivers/iio/pressure/bmp280-core.c
drivers/iio/pressure/bmp280-core.c:215:35: warning: cast to restricted __le16
drivers/iio/pressure/bmp280-core.c:229:37: warning: cast to restricted __be16
drivers/iio/pressure/bmp280-core.c:229:37: warning: cast to restricted __be16
drivers/iio/pressure/bmp280-core.c:229:37: warning: cast to restricted __be16
drivers/iio/pressure/bmp280-core.c:229:37: warning: cast to restricted __be16
drivers/iio/pressure/bmp280-core.c:230:36: warning: cast to restricted __be16
drivers/iio/pressure/bmp280-core.c:230:36: warning: cast to restricted __be16
drivers/iio/pressure/bmp280-core.c:230:36: warning: cast to restricted __be16
drivers/iio/pressure/bmp280-core.c:230:36: warning: cast to restricted __be16
drivers/iio/pressure/bmp280-core.c:237:37: warning: cast to restricted __le16
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Jonathan Cameron [Sun, 13 Oct 2019 10:02:55 +0000 (11:02 +0100)]
iio: gyro: mpu3050: Explicity make a 'poison' value big endian
This clearly has no actual affect but it does show sparse and similar
static analysers that we are doing this intentionally.
CHECK drivers/iio/gyro/mpu3050-core.c
drivers/iio/gyro/mpu3050-core.c:546:48: warning: incorrect type in assignment (different base types)
drivers/iio/gyro/mpu3050-core.c:546:48: expected restricted __be16 <noident>
drivers/iio/gyro/mpu3050-core.c:546:48: got int
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Jonathan Cameron [Sun, 13 Oct 2019 09:55:15 +0000 (10:55 +0100)]
iio: chemical: sps30: Explicity truncate constant by masking
When breaking up a constant to write to two 8 bit registers
it isn't obvious to sparse that it was intentional.
CHECK drivers/iio/chemical/sps30.c
drivers/iio/chemical/sps30.c:120:30: warning: cast truncates bits from constant value (8004 becomes 4)
So in the interests of minimising noisy warnings, let us add
a mask.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Tomasz Duszynski <tduszyns@gmail.com>
Jonathan Cameron [Sun, 13 Oct 2019 09:15:41 +0000 (10:15 +0100)]
iio: adc: stmpe-adc: Cleanup endian type of local variable
Nothing stops data being of type __be16, which fixes the warning:
CHECK drivers/iio/adc/stmpe-adc.c
drivers/iio/adc/stmpe-adc.c:202:29: warning: cast to restricted __be16
drivers/iio/adc/stmpe-adc.c:202:29: warning: cast to restricted __be16
drivers/iio/adc/stmpe-adc.c:202:29: warning: cast to restricted __be16
drivers/iio/adc/stmpe-adc.c:202:29: warning: cast to restricted __be16
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: <philippe.schenker@toradex.com>
Jonathan Cameron [Sun, 13 Oct 2019 09:05:42 +0000 (10:05 +0100)]
iio: adc: mcp320x: Tidy up endian types in type cast.
Fixes the sparse warning:
drivers/iio/adc/mcp320x.c:167:41: warning: incorrect type in argument 1 (different base types)
drivers/iio/adc/mcp320x.c:167:41: expected restricted __be32 const [usertype] *p
drivers/iio/adc/mcp320x.c:167:41: got unsigned int [usertype] *<noident>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Jonathan Cameron [Sun, 13 Oct 2019 08:57:23 +0000 (09:57 +0100)]
iio: adc: at91-sama5d2: Replace 0 with NULL when clearing some pointers.
Cleans up the sparse warning:
CHECK drivers/iio/adc/at91-sama5d2_adc.c
drivers/iio/adc/at91-sama5d2_adc.c:1486:31: warning: Using plain integer as NULL pointer
drivers/iio/adc/at91-sama5d2_adc.c:1509:31: warning: Using plain integer as NULL pointer
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Eugen Hristev <eugen.hristev@microchip.com>
William Breathitt Gray [Sun, 6 Oct 2019 20:03:11 +0000 (16:03 -0400)]
counter: Fix typo in action_get description
The action_get callback returns a Synapse's action mode.
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
William Breathitt Gray [Sun, 6 Oct 2019 20:03:10 +0000 (16:03 -0400)]
docs: driver-api: generic-counter: Update Count and Signal data types
Count data is now always represented as an unsigned integer, while
Signal data is either SIGNAL_LOW or SIGNAL_HIGH. In addition,
clarification changes and additions are made to better explain the
theory of the Generic Counter interface and its use.
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
William Breathitt Gray [Sun, 6 Oct 2019 20:03:09 +0000 (16:03 -0400)]
counter: Simplify the count_read and count_write callbacks
The count_read and count_write callbacks are simplified to pass val as
unsigned long rather than as an opaque data structure. The opaque
counter_count_read_value and counter_count_write_value structures,
counter_count_value_type enum, and relevant counter_count_read_value_set
and counter_count_write_value_get functions, are removed as they are no
longer used.
Cc: Patrick Havelange <patrick.havelange@essensium.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Acked-by: David Lechner <david@lechnology.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jonathan Cameron [Fri, 18 Oct 2019 18:46:10 +0000 (19:46 +0100)]
Merge branch 'ib-ab8500-5.4-rc1' into HEAD
Immutable branch as considerable overlap with mfd, power and hwmon.
Linus Walleij [Fri, 11 Oct 2019 07:18:05 +0000 (09:18 +0200)]
mfd: Switch the AB8500 GPADC to IIO
The AB8500 GPADC driver is indeed a "general purpose ADC" driver,
and while the IIO subsystem did not exist when the driver was
first merged, it is never too late to clean things up and move it
to the right place.
Nowadays IIO provides the right abstractions and interfaces to
do generic ADC work in the kernel.
We have to cut a bunch of debugfs luggage to make this transition
swift, but all these files to is read out the raw values of the
ADC and the IIO subsystem already has a standard sysfs ABI for
doing exactly this: no debugfs is needed.
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Linus Walleij [Fri, 11 Oct 2019 07:18:04 +0000 (09:18 +0200)]
iio: adc: New driver for the AB8500 GPADC
This is a new driver for the ST-Ericsson AB8500 GPADC, which
replaces the old driver in drivers/mfd/ab8500-gpadc.c and
thus gets rid of another necessarily different custom driver
from the times before IIO existed.
The AB8500 GPADC can convert 10 different channels and these
are used for monitoring voltages in the U8500 chipset, some
are used for battery charging, some for temperature
monitoring.
As this is very core functionality that a lot of drivers
depend on and was formerly compiled in with the AB8500 core
driver, we deafault it to 'y' in Kconfig: it can be compiled
out but it is really not advisible: the platform can
for example overheat if we do.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Linus Walleij [Fri, 11 Oct 2019 07:18:03 +0000 (09:18 +0200)]
mfd: ab8500: Augment DT bindings
As we migrate the AB8500 GPADC driver to use IIO, we need to augment
the bindings to account for defining the ADC channels in the device
tree.
Cc: devicetree@vger.kernel.org
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Linus Walleij [Fri, 11 Oct 2019 07:18:02 +0000 (09:18 +0200)]
hwmon: ab8500: Convert to IIO ADC
This switches the AB8500 hardware monitor driver to using
the standard IIO ADC channel lookup and conversion routines.
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Linus Walleij [Fri, 11 Oct 2019 07:18:01 +0000 (09:18 +0200)]
power: supply: ab8500_fg: Convert to IIO ADC
This switches the AB8500 fuel gauge driver to using
the standard IIO ADC channel lookup and conversion routines.
Acked-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Linus Walleij [Fri, 11 Oct 2019 07:18:00 +0000 (09:18 +0200)]
power: supply: ab8500_charger: Convert to IIO ADC
This switches the AB8500 battery charger driver to using
the standard IIO ADC channel lookup and conversion routines.
Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Linus Walleij [Fri, 11 Oct 2019 07:17:59 +0000 (09:17 +0200)]
power: supply: ab8500_btemp: Convert to IIO ADC
This switches the AB8500 battery temperature driver to using
the standard IIO ADC channel lookup and conversion routines.
Acked-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jonathan Cameron [Thu, 17 Oct 2019 21:08:43 +0000 (22:08 +0100)]
Merge branch 'ib-ti-eqep-5.4-rc1' into togreg
Immutable branch being merged in. Created as this also involves
moving some dependencies around, outside of the counter subsystem.
It's possible it will want to be pulled into other trees.
David Lechner [Sun, 1 Sep 2019 22:58:24 +0000 (17:58 -0500)]
counter: new TI eQEP driver
This adds a new counter driver for the Texas Instruments Enhanced
Quadrature Encoder Pulse (eQEP) module.
Only very basic functionality is currently implemented - only enough to
be able to read the position. The actual device has many more features
which can be added to the driver on an as-needed basis.
It is not possible to read the QEPA/B signal values in hardware, so
that feature is omitted.
The TI_PWMSS kernel option is selected in Kconfig to enable the parent
bus, which is needed for power management.
Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Lechner [Sun, 1 Sep 2019 22:58:23 +0000 (17:58 -0500)]
dt-bindings: counter: new bindings for TI eQEP
This documents device tree binding for the Texas Instruments Enhanced
Quadrature Encoder Pulse (eQEP) Module found in various TI SoCs.
Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
David Lechner [Sun, 1 Sep 2019 22:58:22 +0000 (17:58 -0500)]
bus/ti-pwmss: move TI PWMSS driver from PWM to bus subsystem
The TI PWMSS driver is a simple bus driver for providing power
power management for the PWM peripherals on TI AM33xx SoCs, namely
eCAP, eHRPWM and eQEP. The eQEP is a counter rather than a PWM, so
it does not make sense to have the bus driver in the PWM subsystem
since the PWMSS is not exclusive to PWM devices.
Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Vincent Pelletier [Tue, 26 Mar 2019 14:51:38 +0000 (16:51 +0200)]
iio: adc: intel_mrfld_adc: Add Basin Cove ADC driver
Exposes the ADC device present on, at least, Intel Merrifield platform.
Based on work done by:
Yang Bin <bin.yang@intel.com>
Huiquan Zhong <huiquan.zhong@intel.com>
Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Pavan Kumar S <pavan.kumar.s@intel.com>
Though it has been heavily rewritten for upstream.
Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Mon, 7 Oct 2019 09:43:38 +0000 (11:43 +0200)]
dt-bindings: iio: imu: st_lsm6dsx: add lsm6ds0 device bindings
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Mon, 7 Oct 2019 09:43:37 +0000 (11:43 +0200)]
iio: imu: st_lsm6dsx: add support to LSM6DS0
Add support to STM LSM6DS0 6-axis (acc + gyro) Mems sensor
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Mon, 7 Oct 2019 09:12:13 +0000 (11:12 +0200)]
iio: imu: st_lsm6dsx: fix gyro gain definitions for LSM9DS1
Fix typos in gyro gain definitions for LSM9DS1 sensor
Fixes:
52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 7 Oct 2019 08:26:42 +0000 (11:26 +0300)]
iio: dac: ad7303: replace mlock with own lock
This change replaces indio_dev's mlock with the driver's own lock. The lock
is mostly needed to protect state when changing the `dac_cache` info.
The lock has been extended to `ad7303_read_raw()`, to make sure that the
cache is updated if an SPI-write is already in progress.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Andreas Klinger [Mon, 7 Oct 2019 17:02:20 +0000 (19:02 +0200)]
dt-bindings: iio: maxbotix,mb1232.yaml: transform to yaml
transform existing documentation of maxbotix,mb1232 ultrasonic ranger
from text documentation format into yaml.
Changes in v3:
- add a i2c node around device node to set up #address-cells and
#size-cells for omitting error during make dt_binding_check
Changes in v2:
- removed description of reg property
- added a line:
additionalProperties: false
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Mario Tesi [Mon, 7 Oct 2019 13:56:26 +0000 (15:56 +0200)]
iio: imu: st_lsm6dsx: add odr calibration feature
On LSM6DSO/LSM6DSR/LSM6DSOX/ASM330LHH and ISH330DHCX
devices it is possible to trim the hardware timestamp
resolution through the FREQ_FINE[7:0] bits of the
INTERNAL_FREQ_FINE register, which contains the difference
in percentage of the effective ODR (and timestamp rate)
with respect to the typical value.
The formula for calculating the effective ODR reported
in the application notes has been linearized to the first
order to simplify the calculation (pls. see note on source
code).
This change may be useful in the outcome of CTS
tests regarding the SingleSensorTests and the
SensorTest#testSensorTimeStamps for high ODRs
Signed-off-by: Mario Tesi <mario.tesi@st.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Tue, 8 Oct 2019 12:05:02 +0000 (14:05 +0200)]
iio: imu: st_lsm6dsx: enable drdy-mask if available
Enable drdy mask if available in order to mark invalid samples during
sensor bootstrap phase
Tested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fabrice Gasnier [Wed, 9 Oct 2019 13:48:38 +0000 (15:48 +0200)]
iio: dac: stm32: add power management support
Add support for runtime PM & sleep.
Provide pclk to regmap as registers access doesn't need full power
(e.g. regulator). Always restore HFSEL when resuming. It may get lost
depending on low power level that has been achieved.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:22:07 +0000 (15:22 +0200)]
iio: imu: st_lsm6dsx: enable wake-up event for LSM6DSO
Add missing wake-up register info for LSM6DSO/LSM6DSOX sensor
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:22:06 +0000 (15:22 +0200)]
dt-bindings: iio: imu: st_lsm6dsx: document missing wakeup-source property
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:22:05 +0000 (15:22 +0200)]
iio: imu: st_lsm6dsx: add missing kernel documenation
Add missing kernel doc for st_lsm6dsx_hw data structure
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:22:04 +0000 (15:22 +0200)]
iio: imu: st_lsm6dsx: add wakeup_source in st_sensors_platform_data
Add the possibility to enable/disable wakeup source through
st_sensors_platform_data and not only through device tree
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:22:03 +0000 (15:22 +0200)]
iio: imu: st_lsm6dsx: fix checkpatch warning
Fix following checkpatch warnings:
CHECK: Alignment should match open parenthesis
+static int st_lsm6dsx_read_event(struct iio_dev *iio_dev,
+ const struct iio_chan_spec *chan,
CHECK: Alignment should match open parenthesis
+static int st_lsm6dsx_write_event(struct iio_dev *iio_dev,
+ const struct iio_chan_spec *chan,
CHECK: Alignment should match open parenthesis
+static int st_lsm6dsx_read_event_config(struct iio_dev *iio_dev,
+ const struct iio_chan_spec *chan,
CHECK: Alignment should match open parenthesis
+static int st_lsm6dsx_write_event_config(struct iio_dev *iio_dev,
+ const struct iio_chan_spec *chan,
WARNING: line over 80 characters
+ if (dev->of_node && of_property_read_bool(dev->of_node, "wakeup-source"))
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:22:02 +0000 (15:22 +0200)]
iio: imu: st_lsm6dsx: grab conf mutex in st_lsm6dsx_write_event_config
Always grub conf mutex in st_lsm6dsx_write_event_config since it can run
concurrently with FIFO configuration
Fixes:
b5969abfa8b8 ("iio: imu: st_lsm6dsx: add motion events")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:22:01 +0000 (15:22 +0200)]
iio: imu: st_lsm6dsx: rely on st_lsm6dsx_update_bits_locked configuring events
Rely on st_lsm6dsx_update_bits_locked in st_lsm6dsx_write_event and
st_lsm6dsx_event_setup routines since they can run concurrently with
sensor hub configuration
Fixes:
b5969abfa8b8 ("iio: imu: st_lsm6dsx: add motion events")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:22:00 +0000 (15:22 +0200)]
iio: imu: st_lsm6dsx: always check enable_reg in st_lsm6dsx_event_setup
Check if enable_reg of event_settings data structure is defined before
writing on it
Fixes:
b5969abfa8b8 ("iio: imu: st_lsm6dsx: add motion events")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:21:59 +0000 (15:21 +0200)]
iio: imu: st_lsm6dsx: move bdu/boot and reset register info in hw_settings
Move bdu, boot and reset register definitions in hw_settings register
map since not all supported sensors (e.g lsm9ds1) rely on the same
definitions
Fixes:
52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:21:58 +0000 (15:21 +0200)]
iio: imu: st_lsm6dsx: do not access active-low/open-drain regs if not supported
Move active low and open drain register definitions in hw_settings
register map since not all supported sensors (e.g lsm9ds1) rely on the
same definitions
Fixes:
52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:21:57 +0000 (15:21 +0200)]
iio: imu: st_lsm6dsx: move irq related definitions in irq_config
Group irq related definition in irq_config structure in
st_lsm6dsx_settings. This is a preliminary patch to move
OpenDrain/Active low registers in st_lsm6dsx_settings.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:21:56 +0000 (15:21 +0200)]
iio: imu: st_lsm6dsx: add sanity check for read_fifo pointer
Check read_fifo pointer before using it since we can't assume it
is always set adding new sensors. This patch fixes the following crash:
irq 277: nobody cared (try booting with the "irqpoll" option)
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.3.0-rc5-00322-g792b824-dirty #7
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[<
c0112750>] (unwind_backtrace) from [<
c010d018>] (show_stack+0x10/0x14)
[<
c010d018>] (show_stack) from [<
c0c2bfc8>] (dump_stack+0xd8/0x10c)
[<
c0c2bfc8>] (dump_stack) from [<
c01923fc>] (__report_bad_irq+0x24/0xc0)
[<
c01923fc>] (__report_bad_irq) from [<
c0192820>] (note_interrupt+0x27c/0x2dc)
[<
c0192820>] (note_interrupt) from [<
c018f174>] (handle_irq_event_percpu+0x54/0x7c)
[<
c018f174>] (handle_irq_event_percpu) from [<
c018f1d4>] (handle_irq_event+0x38/0x5c)
[<
c018f1d4>] (handle_irq_event) from [<
c0193664>] (handle_level_irq+0xc8/0x154)
[<
c0193664>] (handle_level_irq) from [<
c018df58>] (generic_handle_irq+0x20/0x34)
[<
c018df58>] (generic_handle_irq) from [<
c053c348>] (mxc_gpio_irq_handler+0xc4/0xf8)
[<
c053c348>] (mxc_gpio_irq_handler) from [<
c053c3e0>] (mx3_gpio_irq_handler+0x64/0xb8)
[<
c053c3e0>] (mx3_gpio_irq_handler) from [<
c018df58>] (generic_handle_irq+0x20/0x34)
[<
c018df58>] (generic_handle_irq) from [<
c018e550>] (__handle_domain_irq+0x64/0xe0)
[<
c018e550>] (__handle_domain_irq) from [<
c0529610>] (gic_handle_irq+0x4c/0xa0)
[<
c0529610>] (gic_handle_irq) from [<
c0101a70>] (__irq_svc+0x70/0x98)
Exception stack(0xc1301f10 to 0xc1301f58
1f00:
00000001 00000006 00000000 c130c340
1f20:
c1300000 c1308928 00000001 c1308960 00000000 c12b9db0 c1308908 00000000
1f40:
00000000 c1301f60 c0182010 c0109508 20000013 ffffffff
[<
c0101a70>] (__irq_svc) from [<
c0109508>] (arch_cpu_idle+0x20/0x3c)
[<
c0109508>] (arch_cpu_idle) from [<
c015ed70>] (do_idle+0x1bc/0x2bc)
[<
c015ed70>] (do_idle) from [<
c015f204>] (cpu_startup_entry+0x18/0x1c)
[<
c015f204>] (cpu_startup_entry) from [<
c1200e68>] (start_kernel+0x440/0x504)
[<
c1200e68>] (start_kernel) from [<
00000000>] (0x0)
handlers:
[<
62052c0d>] st_lsm6dsx_handler_irq threaded
[<
f2004b92>] st_lsm6dsx_handler_thread
Fixes:
52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")
Tested-by: Bobby Jones <rjones@gateworks.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi [Sun, 6 Oct 2019 13:21:55 +0000 (15:21 +0200)]
iio: imu: st_lsm6dsx: use st_lsm6dsx_read_locked in st_lsm6dsx_report_motion_event
Rely on st_lsm6dsx_read_locked in st_lsm6dsx_report_motion_event since
it can run concurrently with sensor hub configuration. Move event
related code in st_lsm6dsx_report_motion_event
Fixes:
1aabad1fb5e9 ("iio: imu: st_lsm6dsx: add motion report function and call from interrupt")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Fri, 11 Oct 2019 14:43:47 +0000 (16:43 +0200)]
dt-bindings: Add max12xx SPI ADC series as trivial devices
Update the compatible list with three Maxim ADCs compatibles.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Fri, 11 Oct 2019 14:43:46 +0000 (16:43 +0200)]
dt-bindings: Add 1027/1029/1031 SPI ADCs as trivial devices
In the same time, remove the dedicated bindings file which is now
useless.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Fri, 11 Oct 2019 14:43:45 +0000 (16:43 +0200)]
dt-bindings: iio: adc: max1027: Mark interrupts as optional
The chips have a 'start conversion' and a 'end of conversion' pair of
pins. They can be used but this is absolutely not mandatory as regular
polling is supported by the chip depending on its internal clocking
setup.
There is no physical reason to force the use of interrupts so turn
them optional.
Also, once the interrupt turned optional, these devices fit perfectly
the "trivial devices" described in the generic (yaml) bindings file, so
instead of converting this text file to json schema, we can just add
the relevant compatibles in:
Documentation/devicetree/bindings/trivial-devices.yaml.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Fri, 11 Oct 2019 14:43:44 +0000 (16:43 +0200)]
iio: adc: max1027: Introduce 12-bit devices support
Maxim's max12xx series is very similar to the max10xx series, with the
difference of the measurements depth which is upgraded from 10 to 12
bits per channel. Everything else looks the same.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Fri, 11 Oct 2019 14:43:43 +0000 (16:43 +0200)]
iio: adc: max1027: Prepare the introduction of different resolutions
Maxim's max1027/29/31 series returns the measured voltages with a
resolution of 10 bits. There is a very similar series, max1227/29/31
which works identically but uses a resolution of 12 bits. Prepare the
support for these chips by turning the 'depth' into a macro parameter
instead of hardcoding it everywhere. Also reorganize just a bit the
macros at the top to avoid repeating tens of lines when adding support
for a new chip.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Fri, 11 Oct 2019 14:43:42 +0000 (16:43 +0200)]
iio: adc: max1027: Reset the device at probe time
All the registers are configured by the driver, let's reset the chip
at probe time, avoiding any conflict with a possible earlier
configuration.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Fri, 11 Oct 2019 14:43:41 +0000 (16:43 +0200)]
iio: adc: max1027: Make it optional to use interrupts
The chip has a 'start conversion' and a 'end of conversion' pair of
pins. They can be used but this is absolutely not mandatory as regular
polling of the value is totally fine with the current internal
clocking setup. Turn the interrupts optional and do not error out if
they are not inquired in the device tree. This has the effect to
prevent triggered buffers use though.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Miquel Raynal [Fri, 11 Oct 2019 14:43:40 +0000 (16:43 +0200)]
iio: adc: max1027: Add debugfs register read support
Until now, only write operations were supported. Force two bytes read
operation when reading, which should fit most of the development
purposes. Of course, extended operations like buffered reads on
multiple channels or even temperature + voltage reads will not be read
entirely. Usually, just starting a new operation will work but in any
case a software reset (done through the debufs interface too) will
return the device in a usable state.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Manivannan Sadhasivam [Fri, 11 Oct 2019 18:48:52 +0000 (00:18 +0530)]
iio: light: Add support for ADUX1020 sensor
Add initial support for Analog Devices ADUX1020 Photometric sensor.
Only proximity mode has been enabled for now.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Manivannan Sadhasivam [Fri, 11 Oct 2019 18:48:51 +0000 (00:18 +0530)]
dt-bindings: iio: light: Add binding for ADUX1020
Add devicetree binding for Analog Devices ADUX1020 Photometric
sensor.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jérôme Pouiller [Fri, 11 Oct 2019 16:47:51 +0000 (16:47 +0000)]
staging: wfx: fix potential vulnerability to spectre
array_index_nospec() should be applied after a bound check.
Fixes:
9bca45f3d692 ("staging: wfx: allow to send 802.11 frames")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20191011164746.2518-1-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jérôme Pouiller [Fri, 11 Oct 2019 10:16:41 +0000 (10:16 +0000)]
staging: wfx: fix error handling in wfx_tx_get_raw_link_id()
Since wfx_tx_get_raw_link_id() return an unsigned, it makes no sense to
return a negative value. "15" is a better value since it is used by
firmware for stations that have not yet associated link-ids.
Note that this should never happens since driver set max_ap_assoc_sta
to 14.
Fixes:
9bca45f3d692 ("staging: wfx: allow to send 802.11 frames")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20191011101639.31025-1-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wambui Karuga [Sun, 13 Oct 2019 19:10:27 +0000 (22:10 +0300)]
staging: rtl8723bs: use DIV_ROUND_UP helper macro
Use the DIV_ROUND_UP macro to replace open-coded divisor calculation
to improve readability.
Issue found using coccinelle:
@@
expression n,d;
@@
(
- ((n + d - 1) / d)
+ DIV_ROUND_UP(n,d)
|
- ((n + (d - 1)) / d)
+ DIV_ROUND_UP(n,d)
)
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/20191013191027.6470-1-wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wambui Karuga [Sun, 13 Oct 2019 18:47:50 +0000 (21:47 +0300)]
staging: vc04_services: use DIV_ROUND_UP helper macro
Replace open-coded division calculation with the DIV_ROUND_UP
helper macro for better readability.
Issue found using coccinelle:
@@
expression n,d;
@@
(
- ((n + d - 1) / d)
+ DIV_ROUND_UP(n,d)
|
- ((n + (d - 1)) / d)
+ DIV_ROUND_UP(n,d)
)
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Link: https://lore.kernel.org/r/20191013184750.32766-1-wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michael Straube [Sun, 13 Oct 2019 13:12:49 +0000 (15:12 +0200)]
staging: rtl8188eu: remove unnecessary conversion to bool
Comparsions evaluate to bool, explicit conversion with ternary
operator is overly verbose and unnecessary, so remove it.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20191013131249.34422-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michael Straube [Sun, 13 Oct 2019 13:12:48 +0000 (15:12 +0200)]
staging: rtl8188eu: remove braces from single statement if block
Remove braces from single statement if block to comply with kernel
coding style. Reported by checkpatch.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20191013131249.34422-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wambui Karuga [Sat, 12 Oct 2019 22:19:16 +0000 (01:19 +0300)]
staging: rtl8712: clean up function headers
Remove unnecessary line-breaks in function headers to
improve readability of function headers.
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Link: https://lore.kernel.org/r/c14b9e60b1e9bab635bc9527cbd2a2a07436ba44.1570918228.git.wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wambui Karuga [Sat, 12 Oct 2019 22:19:15 +0000 (01:19 +0300)]
staging: rtl8712: remove unnecessary return variables
Remove variables that are only used to hold and return constants and
have the functions directly return the constants.
Issue found by coccinelle:
@@
local idexpression ret;
expression e;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Link: https://lore.kernel.org/r/f61a0f036af24228c682c6b12c3a8e6cf6736185.1570918228.git.wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wambui Karuga [Sat, 12 Oct 2019 18:04:35 +0000 (21:04 +0300)]
staging: octeon: remove typedef declaration for cvmx_fau_op_size
Remove addition of new typedef for enum cvmx_fau_op_size.
Issue found by checkpatch.pl
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/0130bbbffd4c3c9e0e2ab0fc02cb7fa704ee410c.1570821661.git.wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wambui Karuga [Sat, 12 Oct 2019 18:04:34 +0000 (21:04 +0300)]
staging: octeon: remove typedef declartion for cvmx_pko_command_word0
Removes addition of new typedef declaration for
cvmx_pko_command_word0.
Also replace previous instances with new union declaration.
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/40bb26b250d7ba5b0d5199072e773be2fb0fed90.1570821661.git.wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wambui Karuga [Sat, 12 Oct 2019 18:04:33 +0000 (21:04 +0300)]
staging: octeon: remove typedef declaration for cvmx_fau_reg_32
Remove typedef declaration for enum cvmx_fau_reg_32.
Also replace its previous uses with new declaration format.
Issue found by checkpatch.pl
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/b7216f423d8e06b2ed7ac2df643a9215cd95be32.1570821661.git.wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wambui Karuga [Sat, 12 Oct 2019 18:04:32 +0000 (21:04 +0300)]
staging: octeon: remove typedef declaration for cvmx_helper_link_info
Remove declaration of union cvmx_helper_link_info as typedef.
Also replace its previous uses with new union declaration.
Issue found by checkpatch.pl
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/fb373aed8fd2b04d01198f5a5769fd2476714e88.1570821661.git.wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wambui Karuga [Sat, 12 Oct 2019 18:04:31 +0000 (21:04 +0300)]
staging: octeon: remove typedef declaration for cvmx_wqe
Remove typedef declaration from struct cvmx_wqe.
Also replace its previous uses with new struct declaration.
Issue found by checkpatch.pl
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/fa82104ea8d7ff54dc66bfbfedb6cca541701991.1570821661.git.wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Kroah-Hartman [Mon, 14 Oct 2019 05:07:36 +0000 (07:07 +0200)]
Merge 5.4-rc3 into staging-next
We want the staging driver fixes in here as well to build on and test
with.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Torvalds [Sun, 13 Oct 2019 23:37:36 +0000 (16:37 -0700)]
Linux 5.4-rc3
Linus Torvalds [Sun, 13 Oct 2019 21:47:10 +0000 (14:47 -0700)]
Merge tag 'trace-v5.4-rc2' of git://git./linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt:
"A few tracing fixes:
- Remove lockdown from tracefs itself and moved it to the trace
directory. Have the open functions there do the lockdown checks.
- Fix a few races with opening an instance file and the instance
being deleted (Discovered during the lockdown updates). Kept
separate from the clean up code such that they can be backported to
stable easier.
- Clean up and consolidated the checks done when opening a trace
file, as there were multiple checks that need to be done, and it
did not make sense having them done in each open instance.
- Fix a regression in the record mcount code.
- Small hw_lat detector tracer fixes.
- A trace_pipe read fix due to not initializing trace_seq"
* tag 'trace-v5.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
tracing: Initialize iter->seq after zeroing in tracing_read_pipe()
tracing/hwlat: Don't ignore outer-loop duration when calculating max_latency
tracing/hwlat: Report total time spent in all NMIs during the sample
recordmcount: Fix nop_mcount() function
tracing: Do not create tracefs files if tracefs lockdown is in effect
tracing: Add locked_down checks to the open calls of files created for tracefs
tracing: Add tracing_check_open_get_tr()
tracing: Have trace events system open call tracing_open_generic_tr()
tracing: Get trace_array reference for available_tracers files
ftrace: Get a reference counter for the trace_array on filter files
tracefs: Revert
ccbd54ff54e8 ("tracefs: Restrict tracefs when the kernel is locked down")
Linus Torvalds [Sun, 13 Oct 2019 15:40:31 +0000 (08:40 -0700)]
Merge tag 'hwmon-for-v5.4-rc3' of git://git./linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck:
- Update/fix inspur-ipsps1 and k10temp Documentation
- Fix nct7904 driver
- Fix HWMON_P_MIN_ALARM mask in hwmon core
* tag 'hwmon-for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: docs: Extend inspur-ipsps1 title underline
hwmon: (nct7904) Add array fan_alarm and vsen_alarm to store the alarms in nct7904_data struct.
docs: hwmon: Include 'inspur-ipsps1.rst' into docs
hwmon: Fix HWMON_P_MIN_ALARM mask
hwmon: (k10temp) Update documentation and add temp2_input info
hwmon: (nct7904) Fix the incorrect value of vsen_mask in nct7904_data struct
Linus Torvalds [Sun, 13 Oct 2019 15:26:54 +0000 (08:26 -0700)]
Merge tag 'fixes-for-5.4-rc3' of git://git./linux/kernel/git/mtd/linux
Pull MTD fixes from Richard Weinberger:
"Two fixes for MTD:
- spi-nor: Fix for a regression in write_sr()
- rawnand: Regression fix for the au1550nd driver"
* tag 'fixes-for-5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
mtd: rawnand: au1550nd: Fix au_read_buf16() prototype
mtd: spi-nor: Fix direction of the write_sr() transfer
Linus Torvalds [Sun, 13 Oct 2019 15:15:35 +0000 (08:15 -0700)]
Merge tag 'for-linus-
20191012' of git://git.kernel.dk/linux-block
Pull io_uring fix from Jens Axboe:
"Single small fix for a regression in the sequence logic for linked
commands"
* tag 'for-linus-
20191012' of git://git.kernel.dk/linux-block:
io_uring: fix sequence logic for timeout requests
Greg Kroah-Hartman [Sun, 13 Oct 2019 08:59:05 +0000 (10:59 +0200)]
Merge tag 'iio-for-5.5a-take3' of https://git./linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First set of IIO new device support, cleanups and features for the 5.5 cycle
Third version with the adis rework set dropped as better to just have
a fresh version of that at some future date.
The usual mixed backs of new device support being added to drivers,
long term reworks continuing and little per driver cleanups and
features.
Also a few trivial counter subsystem tidy ups on behalf of William.
Core new feature
* Device label support. A long requested feature no one got around to
implementing before. Allows DT based provision of a 'label' that
identifies a device uniquely within a system. This differs from existing
'name' which is meant to be the part number.
New device support
* ingenic-adc
- Support for the JZ4770 SoC ADC including bindings.
* inv_mpu6050
- Add support for magnetometer in MPU925x parts.
Fiddly to do as this is actually a separate device sitting inside the
package, but with the master device being able to schedule reads etc.
Will only run if the auxiliary bus is not in use for any other devices.
Features
* ad7192
- Userspace calibration controls to do zero and full scale.
* st_lsm6dsx
- Enable latched interrupts by default for sensors events with related clear.
- Motion events and related wakeup source. This needed quite a bit of
refactoring as well.
Cleanups and minor features
* ad7192
- sysfs ABI docs
* ad7949
- Remove code to readback configuration word as driver never actually enabled
it.
- Fix incorrect xfer length. Not actually known to cause problems other
than wasted bus usage.
* adis16080
- Replace core mlock usage with local lock with more appropriate scope.
* adis16130
- Remove pointless mlock usage.
* adis16240
- Remove include of gpio.h as no gpio usage.
* atlas-ph-sensor
- Improve logical ordering of buffer predisable / postenable functions.
This is part of a longer term rework Alexandru is driving towards.
* bh1750
- Fix up a static compiler warning and make the code more readable.
- yaml conversion of binding + MAINTAINERS entry.
* bmp280
- Drop a stray newline.
* cm36651
- Drop a redundant assignment
* itg3200
- Alignment cleanup.
* max31856
- Add missing of_node and parent references, useful to identify the device.
* sc27xx_adc
- Use devm_hwspin_lock_request_specific rather than local rolled version.
* stm32-lptimer counter
- kernel-doc warning.
* stm32-timer counter
- kernel-doc warning.
- Alignment cleanup.
* sx9500
- Improve logical ordering of buffer predisable / postenable functions.
This is part of a longer term rework Alexandru is driving towards.
* tcs3414
- Improve logical ordering of buffer predisable / postenable functions.
This is part of a longer term rework Alexandru is driving towards.
* tag 'iio-for-5.5a-take3' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (41 commits)
iio: pressure: bmp280: remove stray newline
iio: adc: sc27xx: Use devm_hwspin_lock_request_specific() to simplify code
iio: chemical: atlas-ph-sensor: fix iio_triggered_buffer_predisable() position
iio: gyro: clean up indentation issue
counter: stm32: clean up indentation issue
iio: proximity: sx9500: fix iio_triggered_buffer_{predisable,postenable} positions
iio: core: Add optional symbolic label to device attributes
dt-binding: iio: Add optional label property
iio: gyro: adis16080: replace mlock with own lock
counter: stm32-lptimer-cnt: fix a kernel-doc warning
counter: stm32-timer-cnt: fix a kernel-doc warning
iio: gyro: adis16130: remove mlock usage
MAINTAINERS: add entry for ROHM BH1750 driver
dt-bindings: iio: light: bh1750: convert bindings to yaml
iio: imu: st_lsm6dsx: add motion report function and call from interrupt
iio: imu: st_lsm6dsx: always enter interrupt thread
iio: imu: st_lsm6dsx: add wakeup-source option
iio: imu: st_lsm6dsx: add motion events
iio: imu: st_lsm6dsx: move interrupt thread to core
iio: imu: inv_mpu6050: add fifo support for magnetometer data
...
Wambui Karuga [Thu, 10 Oct 2019 13:20:58 +0000 (16:20 +0300)]
staging: rtl8723bs: Remove comparison to NULL
Remove comparison to NULL in drivers/staging/rtl8723bs/core/rtw_ap.c:1449.
Issue found by checkpatch.pl
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Link: https://lore.kernel.org/r/20191010132058.20887-1-wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michael Hennerich [Fri, 11 Oct 2019 11:24:41 +0000 (14:24 +0300)]
staging: fbtft: fbtft-core: Fix last line displayed on fbcon
For the special case when fbtft_mkdirty() is called with with -1 for the y
coordinate, the height is truncated by 1.
This isn't required, and causes the last line to not update.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20191011112441.31003-1-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jules Irenge [Sat, 12 Oct 2019 15:18:05 +0000 (16:18 +0100)]
staging: vc04_services: place the AND operator at the end of the previous line
Place the AND logical operator at the end of the previous line;
to fix warning of "Logical continuations should be on the previous line".
Issue detected by checkpatch tool.
Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
Link: https://lore.kernel.org/r/20191012151805.17988-1-jbi.octave@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bartosz Golaszewski [Wed, 2 Oct 2019 08:57:58 +0000 (10:57 +0200)]
iio: pressure: bmp280: remove stray newline
Remove a stray newline from the probe callback.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Baolin Wang [Fri, 27 Sep 2019 02:41:19 +0000 (10:41 +0800)]
iio: adc: sc27xx: Use devm_hwspin_lock_request_specific() to simplify code
Change to use devm_hwspin_lock_request_specific() to help to simplify the
cleanup code for drivers requesting one hwlock.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Fri, 20 Sep 2019 07:31:22 +0000 (10:31 +0300)]
iio: chemical: atlas-ph-sensor: fix iio_triggered_buffer_predisable() position
The iio_triggered_buffer_{predisable,postenable} functions attach/detach
the poll functions.
The iio_triggered_buffer_predisable() should be called last, to detach the
poll func after the devices has been suspended.
The position of iio_triggered_buffer_postenable() is correct.
Note this is not stable material. It's a fix in the logical
model rather fixing an actual bug. These are being tidied up
throughout the subsystem to allow more substantial rework that
was blocked by variations in how things were done.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Petr Mladek [Fri, 11 Oct 2019 14:21:34 +0000 (16:21 +0200)]
tracing: Initialize iter->seq after zeroing in tracing_read_pipe()
A customer reported the following softlockup:
[899688.160002] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [test.sh:16464]
[899688.160002] CPU: 0 PID: 16464 Comm: test.sh Not tainted 4.12.14-6.23-azure #1 SLE12-SP4
[899688.160002] RIP: 0010:up_write+0x1a/0x30
[899688.160002] Kernel panic - not syncing: softlockup: hung tasks
[899688.160002] RIP: 0010:up_write+0x1a/0x30
[899688.160002] RSP: 0018:
ffffa86784d4fde8 EFLAGS:
00000257 ORIG_RAX:
ffffffffffffff12
[899688.160002] RAX:
ffffffff970fea00 RBX:
0000000000000001 RCX:
0000000000000000
[899688.160002] RDX:
ffffffff00000001 RSI:
0000000000000080 RDI:
ffffffff970fea00
[899688.160002] RBP:
ffffffffffffffff R08:
ffffffffffffffff R09:
0000000000000000
[899688.160002] R10:
0000000000000000 R11:
0000000000000000 R12:
ffff8b59014720d8
[899688.160002] R13:
ffff8b59014720c0 R14:
ffff8b5901471090 R15:
ffff8b5901470000
[899688.160002] tracing_read_pipe+0x336/0x3c0
[899688.160002] __vfs_read+0x26/0x140
[899688.160002] vfs_read+0x87/0x130
[899688.160002] SyS_read+0x42/0x90
[899688.160002] do_syscall_64+0x74/0x160
It caught the process in the middle of trace_access_unlock(). There is
no loop. So, it must be looping in the caller tracing_read_pipe()
via the "waitagain" label.
Crashdump analyze uncovered that iter->seq was completely zeroed
at this point, including iter->seq.seq.size. It means that
print_trace_line() was never able to print anything and
there was no forward progress.
The culprit seems to be in the code:
/* reset all but tr, trace, and overruns */
memset(&iter->seq, 0,
sizeof(struct trace_iterator) -
offsetof(struct trace_iterator, seq));
It was added by the commit
53d0aa773053ab182877 ("ftrace:
add logic to record overruns"). It was v2.6.27-rc1.
It was the time when iter->seq looked like:
struct trace_seq {
unsigned char buffer[PAGE_SIZE];
unsigned int len;
};
There was no "size" variable and zeroing was perfectly fine.
The solution is to reinitialize the structure after or without
zeroing.
Link: http://lkml.kernel.org/r/20191011142134.11997-1-pmladek@suse.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Srivatsa S. Bhat (VMware) [Thu, 10 Oct 2019 18:51:01 +0000 (11:51 -0700)]
tracing/hwlat: Don't ignore outer-loop duration when calculating max_latency
max_latency is intended to record the maximum ever observed hardware
latency, which may occur in either part of the loop (inner/outer). So
we need to also consider the outer-loop sample when updating
max_latency.
Link: http://lkml.kernel.org/r/157073345463.17189.18124025522664682811.stgit@srivatsa-ubuntu
Fixes:
e7c15cd8a113 ("tracing: Added hardware latency tracer")
Cc: stable@vger.kernel.org
Signed-off-by: Srivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Srivatsa S. Bhat (VMware) [Thu, 10 Oct 2019 18:50:46 +0000 (11:50 -0700)]
tracing/hwlat: Report total time spent in all NMIs during the sample
nmi_total_ts is supposed to record the total time spent in *all* NMIs
that occur on the given CPU during the (active portion of the)
sampling window. However, the code seems to be overwriting this
variable for each NMI, thereby only recording the time spent in the
most recent NMI. Fix it by accumulating the duration instead.
Link: http://lkml.kernel.org/r/157073343544.17189.13911783866738671133.stgit@srivatsa-ubuntu
Fixes:
7b2c86250122 ("tracing: Add NMI tracing in hwlat detector")
Cc: stable@vger.kernel.org
Signed-off-by: Srivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Steven Rostedt (VMware) [Wed, 9 Oct 2019 15:05:38 +0000 (11:05 -0400)]
recordmcount: Fix nop_mcount() function
The removal of the longjmp code in recordmcount.c mistakenly made the return
of make_nop() being negative an exit of nop_mcount(). It should not exit the
routine, but instead just not process that part of the code. By exiting with
an error code, it would cause the update of recordmcount to fail some files
which would fail the build if ftrace function tracing was enabled.
Link: http://lkml.kernel.org/r/20191009110538.5909fec6@gandalf.local.home
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fixes:
3f1df12019f3 ("recordmcount: Rewrite error/success handling")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Steven Rostedt (VMware) [Sat, 12 Oct 2019 00:41:41 +0000 (20:41 -0400)]
tracing: Do not create tracefs files if tracefs lockdown is in effect
If on boot up, lockdown is activated for tracefs, don't even bother creating
the files. This can also prevent instances from being created if lockdown is
in effect.
Link: http://lkml.kernel.org/r/CAHk-=whC6Ji=fWnjh2+eS4b15TnbsS4VPVtvBOwCy1jjEG_JHQ@mail.gmail.com
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Steven Rostedt (VMware) [Fri, 11 Oct 2019 21:22:50 +0000 (17:22 -0400)]
tracing: Add locked_down checks to the open calls of files created for tracefs
Added various checks on open tracefs calls to see if tracefs is in lockdown
mode, and if so, to return -EPERM.
Note, the event format files (which are basically standard on all machines)
as well as the enabled_functions file (which shows what is currently being
traced) are not lockde down. Perhaps they should be, but it seems counter
intuitive to lockdown information to help you know if the system has been
modified.
Link: http://lkml.kernel.org/r/CAHk-=wj7fGPKUspr579Cii-w_y60PtRaiDgKuxVtBAMK0VNNkA@mail.gmail.com
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Steven Rostedt (VMware) [Fri, 11 Oct 2019 21:39:57 +0000 (17:39 -0400)]
tracing: Add tracing_check_open_get_tr()
Currently, most files in the tracefs directory test if tracing_disabled is
set. If so, it should return -ENODEV. The tracing_disabled is called when
tracing is found to be broken. Originally it was done in case the ring
buffer was found to be corrupted, and we wanted to prevent reading it from
crashing the kernel. But it's also called if a tracing selftest fails on
boot. It's a one way switch. That is, once it is triggered, tracing is
disabled until reboot.
As most tracefs files can also be used by instances in the tracefs
directory, they need to be carefully done. Each instance has a trace_array
associated to it, and when the instance is removed, the trace_array is
freed. But if an instance is opened with a reference to the trace_array,
then it requires looking up the trace_array to get its ref counter (as there
could be a race with it being deleted and the open itself). Once it is
found, a reference is added to prevent the instance from being removed (and
the trace_array associated with it freed).
Combine the two checks (tracing_disabled and trace_array_get()) into a
single helper function. This will also make it easier to add lockdown to
tracefs later.
Link: http://lkml.kernel.org/r/20191011135458.7399da44@gandalf.local.home
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Steven Rostedt (VMware) [Fri, 11 Oct 2019 23:12:21 +0000 (19:12 -0400)]
tracing: Have trace events system open call tracing_open_generic_tr()
Instead of having the trace events system open call open code the taking of
the trace_array descriptor (with trace_array_get()) and then calling
trace_open_generic(), have it use the tracing_open_generic_tr() that does
the combination of the two. This requires making tracing_open_generic_tr()
global.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Steven Rostedt (VMware) [Fri, 11 Oct 2019 22:19:17 +0000 (18:19 -0400)]
tracing: Get trace_array reference for available_tracers files
As instances may have different tracers available, we need to look at the
trace_array descriptor that shows the list of the available tracers for the
instance. But there's a race between opening the file and an admin
deleting the instance. The trace_array_get() needs to be called before
accessing the trace_array.
Cc: stable@vger.kernel.org
Fixes:
607e2ea167e56 ("tracing: Set up infrastructure to allow tracers for instances")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>