platform/kernel/linux-starfive.git
5 years agoiio: dac: ad5686: fix bit shift read register
Mircea Caprioru [Thu, 6 Dec 2018 13:53:15 +0000 (15:53 +0200)]
iio: dac: ad5686: fix bit shift read register

This patch solves the register readback issue with the bit shift. When the
dac resolution was lower than the register size (ex. 12 bits out of 16
bits) the readback value was not shifted with the difference in bits and
the value was higher. Also a mask is applied on the read value in order to
get the value relative to the actual bit size.

Fixes: 0357e488b8 ("iio:dac:ad5686: Refactor the driver")
Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:dac:ad5686: Add AD5310R support
Stefan Popa [Thu, 6 Dec 2018 13:38:30 +0000 (15:38 +0200)]
iio:dac:ad5686: Add AD5310R support

The AD5310R is a single channel DAC with 10-bit precision, which is
part of the same family as AD5311R, except that it uses the spi interface
instead of i2c. The device has a built-in 2.5V reference which is enabled
by default.

Another important difference is that the SPI write command operation is
16 bits long. The first four bits represent the command, while the
remaining 12 bits are for data. In the control reg, DB9 and DB10 are used
for power-down modes, while DB8 is the REF bit. In order to accommodate
this change, a new regmap type was defined and checked accordingly.

Because AD5310R does not have a readback register, the read_raw operation
will return "Operation is not supported".

Datasheet:
Link: http://www.analog.com/media/en/technical-documentation/data-sheets/AD5310R_5311R.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoRevert "Staging: iio: adt7316: Add an extra check for 'ret' equals to 0"
Jeremy Fertic [Wed, 5 Dec 2018 01:49:00 +0000 (18:49 -0700)]
Revert "Staging: iio: adt7316: Add an extra check for 'ret' equals to 0"

This reverts commit 00426e99789357dbff7e719a092ce36a3ce49d94.

i2c_smbus_read_byte() returns 0 when a byte with the value 0 is read from
the device. This is a valid read so revert the check for 0.

Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: accel: use a generic node name for lis302
Lubomir Rintel [Mon, 3 Dec 2018 11:47:40 +0000 (12:47 +0100)]
dt-bindings: iio: accel: use a generic node name for lis302

The example should follow the practice or using a generic node name
instead of the precise programming model, as recommended by the DTSpec.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: core: check 'info' value before registering the device
Andi Shyti [Sun, 2 Dec 2018 18:30:31 +0000 (20:30 +0200)]
iio: core: check 'info' value before registering the device

When the 'info' structure inside indio_dev is left uninitialized,
a segmentation fault occurs.

Check the 'info' value before using it and if it is equal to
NULL, return with -EINVAL.

Signed-off-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: fix overwrite of the returned value
Slawomir Stepien [Sun, 2 Dec 2018 11:42:35 +0000 (12:42 +0100)]
staging: iio: adc: ad7280a: fix overwrite of the returned value

The ret returned from ad7280_chain_setup() is needed to initialize the
slave_num. Don't overwrite it with call to devm_add_action_or_reset().

Fixes: cc9c58ef6e06 ("staging: iio: adc: ad7280a: use devm_* APIs")
Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: check for devm_kasprint() failure
Nicholas Mc Guire [Tue, 27 Nov 2018 17:05:04 +0000 (18:05 +0100)]
staging: iio: adc: ad7280a: check for devm_kasprint() failure

devm_kasprintf() may return NULL on failure of internal allocation thus
the assignments to  attr.name  are not safe if not checked. On error
ad7280_attr_init() returns a negative return so -ENOMEM should be
OK here (passed on as return value of the probe function). To make the
error case more readable a temporary  iio_attr  is introduced and the code
refactored.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: 2051f25d2a26 ("iio: adc: New driver for AD7280A Lithium Ion Battery Monitoring System2")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: humidity: hts221: add entry in MAINTAINERS file
Lorenzo Bianconi [Mon, 26 Nov 2018 09:05:55 +0000 (10:05 +0100)]
iio: humidity: hts221: add entry in MAINTAINERS file

Add entry for hts221 temperature/humidity driver in MAINTAINERS file

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: magnetometer: ak8975: Add the "AKM9911" ACPI HID
Stephan Gerhold [Sun, 25 Nov 2018 18:02:40 +0000 (19:02 +0100)]
iio: magnetometer: ak8975: Add the "AKM9911" ACPI HID

This HID is used on the ASUS MeMO Pad 7 (ME176C) tablet.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging:iio:ad2s90: Move out of staging
Matheus Tavares [Sat, 24 Nov 2018 00:23:12 +0000 (22:23 -0200)]
staging:iio:ad2s90: Move out of staging

Move ad2s90 resolver driver out of staging to the main tree.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Victor Colombo <victorcolombo@gmail.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging:iio:ad2s90: Add comment to device state mutex
Victor Colombo [Sat, 24 Nov 2018 00:23:11 +0000 (22:23 -0200)]
staging:iio:ad2s90: Add comment to device state mutex

Fix the checkpatch.pl issue:
"CHECK: struct mutex definition without comment".

Signed-off-by: Victor Colombo <victorcolombo@gmail.com>
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging:iio:ad2s90: Replace license text w/ SPDX identifier
Matheus Tavares [Sat, 24 Nov 2018 00:23:10 +0000 (22:23 -0200)]
staging:iio:ad2s90: Replace license text w/ SPDX identifier

This patch removes the license boilerplate text at the top of ad2s90.c
and, instead, adds the SPDX GPL-2.0 license identifier, which solves the
checkpatch.pl warning:
"WARNING: Missing or malformed SPDX-License-Identifier tag in line 1".

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings:iio:resolver: Add docs for ad2s90
Matheus Tavares [Sat, 24 Nov 2018 00:23:09 +0000 (22:23 -0200)]
dt-bindings:iio:resolver: Add docs for ad2s90

This patch adds the device tree binding documentation for the ad2s90
resolver-to-digital converter.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging:iio:ad2s90: Add max frequency check at probe
Alexandru Ardelean [Sat, 24 Nov 2018 00:23:08 +0000 (22:23 -0200)]
staging:iio:ad2s90: Add max frequency check at probe

This patch adds a max frequency check at the beginning of ad2s90_probe
function so that when it is set to a value above 0.83Mhz, dev_err is
called with an appropriate message and -EINVAL is returned.

The defined limit is 0.83Mhz instead of 2Mhz, which is the chip's max
frequency as specified in the datasheet, because, as also specified in
the datasheet, a 600ns delay is expected between the application of a
logic LO to CS and the application of SCLK. Since the delay is not
implemented in the spi code, to satisfy it, SCLK's period should be at
most 2 * 600ns, so the max frequency should be 1 / (2 * 6e-7), which
gives roughly 830000Hz.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging:iio:ad2s90: Remove spi setup that should be done via dt
Matheus Tavares [Sat, 24 Nov 2018 00:23:07 +0000 (22:23 -0200)]
staging:iio:ad2s90: Remove spi setup that should be done via dt

The ad2s90 driver currently sets some spi settings (max_speed_hz and
mode) at ad2s90_probe. Since the maximum frequency is a required element
in DT binding for spi slave devices and because the spi mode for the
device can be either (0,0) or (1,1), these settings should be handled
via device tree, not in the driver's code. This patch removes them from
the probe function.

Note: The way in which the mentioned spi settings need to be specified
on the ad2s90's node of a device tree will be documented in the future
patch "dt-bindings:iio:resolver: Add docs for ad2s90".

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging:iio:ad2s90: Add device tree support
Matheus Tavares [Sat, 24 Nov 2018 00:23:06 +0000 (22:23 -0200)]
staging:iio:ad2s90: Add device tree support

This patch adds device tree support to ad2s90 with standard
device tree id table.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: do not use a fixed read len in read_oneshot
Lorenzo Bianconi [Sat, 17 Nov 2018 18:04:27 +0000 (19:04 +0100)]
iio: imu: st_lsm6dsx: do not use a fixed read len in read_oneshot

Generalize st_lsm6dsx_shub_read_oneshot in order to not use a fixed
read length and take into account iio channel realbits for single
read operations

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: hid-sensor-hub: clean up indentation, remove extraneous tab
Colin Ian King [Sun, 18 Nov 2018 16:27:57 +0000 (16:27 +0000)]
iio: hid-sensor-hub: clean up indentation, remove extraneous tab

The statement is indented too much by one level, fix this by
removing the extraneous tab.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-adc: switch off running adc when going to low power
Fabrice Gasnier [Tue, 20 Nov 2018 10:12:32 +0000 (11:12 +0100)]
iio: adc: stm32-adc: switch off running adc when going to low power

Switch off ADC when going to low power mode, in case it has been left
running in buffer mode. Then re-enable it when resuming.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-adc: add power management support
Fabrice Gasnier [Tue, 20 Nov 2018 10:12:31 +0000 (11:12 +0100)]
iio: adc: stm32-adc: add power management support

Add support for runtime PM & sleep. Move all regulator and clock management
to dedicated HW start/stop routines. Then rely on (runtime) PM OPS to
call them.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-adc: move self-calibration to prepare routine
Fabrice Gasnier [Tue, 20 Nov 2018 10:12:30 +0000 (11:12 +0100)]
iio: adc: stm32-adc: move self-calibration to prepare routine

Move self-calibration routine to prepare routine.
- This is precursor patch to ease power management handling.
- This also allow to factorize few error cases (error handling).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID
Hans de Goede [Tue, 20 Nov 2018 11:10:14 +0000 (12:10 +0100)]
iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID

Various 2-in-1's use KIOX010A and KIOX020A as HIDs for 2 KXCJ91008
accelerometers. The KIOX010A HID is for the one in the base and the
KIOX020A for the accelerometer in the keyboard.

Since userspace does not have a way yet to deal with (or ignore) the
accelerometer in the keyboard, this commit just adds the KIOX010A HID
for now so that display rotation will work.

Related: https://github.com/hadess/iio-sensor-proxy/issues/166
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: potentiometer: Add driver for Microchip MCP41xxx/42xxx
Chris Coffey [Tue, 20 Nov 2018 14:17:13 +0000 (14:17 +0000)]
iio: potentiometer: Add driver for Microchip MCP41xxx/42xxx

This patch adds driver support for the Microchip MCP41xxx/42xxx family
of digital potentiometers:

DEVICE      Wipers  Positions   Resistance (kOhm)
MCP41010    1       256         10
MCP41050    1       256         50
MCP41100    1       256         100
MCP42010    2       256         10
MCP42050    2       256         50
MCP42100    2       256         100

Datasheet: http://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf

Signed-off-by: Chris Coffey <cmc@babblebit.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: potentiometer: Add Microchip MCP41xxx/42xxx
Chris Coffey [Tue, 20 Nov 2018 14:17:12 +0000 (14:17 +0000)]
dt-bindings: iio: potentiometer: Add Microchip MCP41xxx/42xxx

This patch adds device tree documentation for the Microchip
MCP41xxx/42xxx family of digital potentiometers.

Signed-off-by: Chris Coffey <cmc@babblebit.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoStaging: iio: adt7316: Change the name from irq_flags to irq_type
Shreeya Patel [Tue, 20 Nov 2018 16:58:36 +0000 (22:28 +0530)]
Staging: iio: adt7316: Change the name from irq_flags to irq_type

Most of the drivers in IIO uses irq_type as the name for
storing the interrupt type and hence change the name from
irq_flags to irq_type for maintaining the consistency.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoStaging: iio: adt7316: Switch irq_flags to a local variable
Shreeya Patel [Tue, 20 Nov 2018 16:56:58 +0000 (22:26 +0530)]
Staging: iio: adt7316: Switch irq_flags to a local variable

There is no need to store irq_flags into the structure as it
is always set to the same thing. Hence switch irq_flags to a
local variable.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoStaging: iio: adt7316: Use device tree data to set ldac_pin
Shreeya Patel [Tue, 20 Nov 2018 16:54:36 +0000 (22:24 +0530)]
Staging: iio: adt7316: Use device tree data to set ldac_pin

Make the driver use device tree instead of the platform data.
Hence, use devm_gpiod_get_optional function to get the data from
device tree for ldac-pin and accordingly make the needed changes
in the driver.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoStaging: iio: adt7316: Add of_device_id table
Shreeya Patel [Tue, 20 Nov 2018 16:52:30 +0000 (22:22 +0530)]
Staging: iio: adt7316: Add of_device_id table

When the kernel starts up, it kicks off compiled-in drivers
that match “compatible” entries it finds in the device tree.
At a later stage (when /lib/modules is available), all kernel modules
that match “compatible” entries in the device tree are loaded.

But if there is no dt table then there should be a fall back path
with which desired kernel modules can be loaded. Hence, add
of_device_id table in the i2c driver to be able to use when there
is no dt table.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: meson-saradc: fix internal clock names
Martin Blumenstingl [Thu, 22 Nov 2018 22:01:11 +0000 (23:01 +0100)]
iio: adc: meson-saradc: fix internal clock names

Before this patch we are registering the internal clocks (for example on
Meson8b, where the SAR ADC IP block implements the divider and gate
clocks) with the following names:
- /soc/cbus@c1100000/adc@8680#adc_div
- /soc/cbus@c1100000/adc@8680#adc_en

This is bad because the common clock framework uses the clock to create
a directory in <debugfs>/clk. With such name, the directory creation
(silently) fails and the debugfs entry ends up being created at the
debugfs root.

With this change, the new clock names are:
c1108680.adc#adc_div
c1108680.adc#adc_en

This matches the clock naming scheme used in the PWM, Ethernet and MMC
drivers. It also fixes the problem with debugfs.
The idea is shamelessly taken from commit b96e9eb62841c5 ("pwm: meson:
Fix mux clock names").

Fixes: 3921db46a8c5bc ("iio: Convert to using %pOF instead of full_name")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: meson-saradc: check for devm_kasprintf failure
Nicholas Mc Guire [Thu, 22 Nov 2018 07:46:43 +0000 (08:46 +0100)]
iio: adc: meson-saradc: check for devm_kasprintf failure

devm_kasprintf() may return NULL on failure of internal allocation thus
the assignments to  init.name  are not safe if not checked. On error
meson_sar_adc_clk_init() returns negative values so -ENOMEM in the
(unlikely) failure case of devm_kasprintf() should be fine here.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs")
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad5933: add device tree support
Marcelo Schmitt [Sat, 24 Nov 2018 13:18:57 +0000 (11:18 -0200)]
staging: iio: ad5933: add device tree support

Add a of_device_id struct variable and subsequent call to
MODULE_DEVICE_TABLE macro to complete device tree support.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: accel: kxcjk-1013: Add the "KXJ2109" ACPI HID
Stephan Gerhold [Sat, 24 Nov 2018 16:22:20 +0000 (17:22 +0100)]
iio: accel: kxcjk-1013: Add the "KXJ2109" ACPI HID

This HID is used on the ASUS MeMO Pad 7 (ME176C) tablet.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: vboxvideo: Rename uint32_t type to u32
Ricardo Reis Marques Silva [Thu, 22 Nov 2018 10:49:05 +0000 (02:49 -0800)]
staging: vboxvideo: Rename uint32_t type to u32

Issue found by checkpatch.

CHECK: Prefer kernel type 'u32' over 'uint32_t'
+static const uint32_t vbox_cursor_plane_formats[] = {

CHECK: Prefer kernel type 'u32' over 'uint32_t'
+static const uint32_t vbox_primary_plane_formats[] = {

CHECK: Prefer kernel type 'u32' over 'uint32_t'
+       const uint32_t *formats;

Signed-off-by: Ricardo Reis Marques Silva <ricardormsilva93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: remove variable from rtl8188eu_xmit_tasklet()
Michael Straube [Thu, 22 Nov 2018 13:52:18 +0000 (14:52 +0100)]
staging: rtl8188eu: remove variable from rtl8188eu_xmit_tasklet()

The local variable ret is only used to test the return value of the
call to rtl8188eu_xmitframe_complete(). Use the function directly in
the if test and remove the variable ret.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: cleanup declarations in usb_ops_linux.c
Michael Straube [Thu, 22 Nov 2018 13:52:17 +0000 (14:52 +0100)]
staging: rtl8188eu: cleanup declarations in usb_ops_linux.c

Replace tabs with spaces and/or remove spaces in declarations
to cleanup whitespace.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: add spaces around '>>' and '&'
Michael Straube [Thu, 22 Nov 2018 13:52:16 +0000 (14:52 +0100)]
staging: rtl8188eu: add spaces around '>>' and '&'

Add spaces around '>>' and '&' to follow kernel coding style.
Reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: remove unnecessary parentheses
Michael Straube [Thu, 22 Nov 2018 13:52:15 +0000 (14:52 +0100)]
staging: rtl8188eu: remove unnecessary parentheses

Remove unnecessary parentheses in usb_ops_linux.c.
Reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: correct spelling mistake in a comment
Michael Straube [Thu, 22 Nov 2018 13:52:14 +0000 (14:52 +0100)]
staging: rtl8188eu: correct spelling mistake in a comment

Correct spelling mistake in a comment reported by checkpatch.
checksumed -> checksummed

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: remove braces from single if else statement
Michael Straube [Thu, 22 Nov 2018 13:52:13 +0000 (14:52 +0100)]
staging: rtl8188eu: remove braces from single if else statement

Remove braces from single line if else statement.
Reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: cleanup line ending with a '('
Michael Straube [Thu, 22 Nov 2018 13:52:12 +0000 (14:52 +0100)]
staging: rtl8188eu: cleanup line ending with a '('

Cleanup line ending with a '(' to follow kernel coding style.
Reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: use __func__ in usb_ops_linux.c
Michael Straube [Thu, 22 Nov 2018 13:52:11 +0000 (14:52 +0100)]
staging: rtl8188eu: use __func__ in usb_ops_linux.c

Use __func__ instead of hardcoded function names.
Reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: rename strange variable names in z_erofs_vle_frontend
Gao Xiang [Thu, 22 Nov 2018 17:21:49 +0000 (01:21 +0800)]
staging: erofs: rename strange variable names in z_erofs_vle_frontend

Previously, 2 members called `initial' and `cachedzone_la' are used
for applying caching policy (whether the workgroup is at either end),
which are hard to understand, rename them to `backmost' and `headoffset'.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: decompress asynchronously if PG_readahead page at first
Gao Xiang [Thu, 22 Nov 2018 17:21:48 +0000 (01:21 +0800)]
staging: erofs: decompress asynchronously if PG_readahead page at first

For the case of nr_to_read == lookahead_size, it is better to
decompress asynchronously as well since no page will be needed immediately.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: locked before registering for all new workgroups
Gao Xiang [Thu, 22 Nov 2018 17:21:47 +0000 (01:21 +0800)]
staging: erofs: locked before registering for all new workgroups

Let's make sure that the one registering a workgroup will also
take the primary work lock at first for two reasons:
  1) There's no need to introduce such a race window (and consequently
     overhead) between registering and locking, other tasks could break
     in by chance, and the race seems unnecessary (no benefit at all);

  2) It's better to take the primary work when a workgroup
     is registered to apply the cache managed policy, for example,
     if some other tasks break in, it could turn into the in-place
     decompression rather than use as the cached decompression.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: separate into init_once / always
Gao Xiang [Thu, 22 Nov 2018 17:21:46 +0000 (01:21 +0800)]
staging: erofs: separate into init_once / always

`z_erofs_vle_workgroup' is heavily generated in the decompression,
for example, it resets 32 bytes redundantly for 64-bit platforms
even through Z_EROFS_VLE_INLINE_PAGEVECS + Z_EROFS_CLUSTER_MAX_PAGES,
default 4, pages are stored in `z_erofs_vle_workgroup'.

As an another example, `struct mutex' takes 72 bytes for our kirin
64-bit platforms, it's unnecessary to be reseted at first and
be initialized each time.

Let's avoid filling all `z_erofs_vle_workgroup' with 0 at first
since most fields are reinitialized to meaningful values later,
and pagevec is no need to initialized at all.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: add a full barrier in erofs_workgroup_unfreeze
Gao Xiang [Thu, 22 Nov 2018 17:16:03 +0000 (01:16 +0800)]
staging: erofs: add a full barrier in erofs_workgroup_unfreeze

Just like other generic locks, insert a full barrier
in case of memory reorder.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: fix `erofs_workgroup_{try_to_freeze, unfreeze}'
Gao Xiang [Thu, 22 Nov 2018 17:16:02 +0000 (01:16 +0800)]
staging: erofs: fix `erofs_workgroup_{try_to_freeze, unfreeze}'

There are two minor issues in the current freeze interface:

   1) Freeze interfaces have not related with CONFIG_DEBUG_SPINLOCK,
      therefore fix the incorrect conditions;

   2) For SMP platforms, it should also disable preemption before
      doing atomic_cmpxchg in case that some high priority tasks
      preempt between atomic_cmpxchg and disable_preempt, then spin
      on the locked refcount later.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: atomic_cond_read_relaxed on ref-locked workgroup
Gao Xiang [Thu, 22 Nov 2018 17:16:01 +0000 (01:16 +0800)]
staging: erofs: atomic_cond_read_relaxed on ref-locked workgroup

It's better to use atomic_cond_read_relaxed, which is implemented
in hardware instructions to monitor a variable changes currently
for ARM64, instead of open-coded busy waiting.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: fix race when the managed cache is enabled
Gao Xiang [Thu, 22 Nov 2018 17:16:00 +0000 (01:16 +0800)]
staging: erofs: fix race when the managed cache is enabled

When the managed cache is enabled, the last reference count
of a workgroup must be used for its workstation.

Otherwise, it could lead to incorrect (un)freezes in
the reclaim path, and it would be harmful.

A typical race as follows:

Thread 1 (In the reclaim path)  Thread 2
workgroup_freeze(grp, 1)                                refcnt = 1
...
workgroup_unfreeze(grp, 1)                              refcnt = 1
                                workgroup_get(grp)      refcnt = 2 (x)
workgroup_put(grp)                                      refcnt = 1 (x)
                                ...unexpected behaviors

* grp is detached but still used, which violates cache-managed
  freeze constraint.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: fix the definition of DBG_BUGON
Gao Xiang [Thu, 22 Nov 2018 17:15:59 +0000 (01:15 +0800)]
staging: erofs: fix the definition of DBG_BUGON

It's better not to positively BUG_ON the kernel, however developers
need a way to locate issues as soon as possible.

DBG_BUGON is introduced and it could only crash when EROFS_FS_DEBUG
(EROFS developping feature) is on. It is helpful for developers
to find and solve bugs quickly by eng builds.

Previously, DBG_BUGON is defined as ((void)0) if EROFS_FS_DEBUG is off,
but some unused variable warnings as follows could occur:

drivers/staging/erofs/unzip_vle.c: In function `init_alway:':
drivers/staging/erofs/unzip_vle.c:61:33: warning: unused variable `work' [-Wunused-variable]
  struct z_erofs_vle_work *const work =
                                 ^~~~

Fix it to #define DBG_BUGON(x) ((void)(x)).

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: fix `trace_erofs_readpage' position
Gao Xiang [Thu, 22 Nov 2018 17:15:58 +0000 (01:15 +0800)]
staging: erofs: fix `trace_erofs_readpage' position

`trace_erofs_readpage' was designed for .readpage() interface hook
in order to trace the detailed synchronized read rather than
the internal implementation `z_erofs_do_read_page' which both
.readpage() and .readpages() use.

It seems the tracepoint was placed to a wrong place by mistake and
it should be moved to the right place.

Fixes: 284db12cfda3 ("staging: erofs: add trace points for reading zipped data")
Reviewed-by: Chen Gong <gongchen4@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: rename SwLed0 to avoid CamelCase
Michael Straube [Wed, 21 Nov 2018 19:49:37 +0000 (20:49 +0100)]
staging: rtl8188eu: rename SwLed0 to avoid CamelCase

Rename struct field SwLed0 to avoid CamelCase.
SwLed0 -> sw_led

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: rename LedControl8188eu to avoid CamelCase
Michael Straube [Wed, 21 Nov 2018 19:49:36 +0000 (20:49 +0100)]
staging: rtl8188eu: rename LedControl8188eu to avoid CamelCase

Rename the function LedControl8188eu to avoid CamelCase.
LedControl8188eu -> led_control_8188eu

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: cleanup a function comment
Michael Straube [Wed, 21 Nov 2018 19:49:35 +0000 (20:49 +0100)]
staging: rtl8188eu: cleanup a function comment

The comment for blink_handler() adds no extra information
in addition to the function name, so remove it.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: rename BlinkHandler to avoid CamelCase
Michael Straube [Wed, 21 Nov 2018 19:49:34 +0000 (20:49 +0100)]
staging: rtl8188eu: rename BlinkHandler to avoid CamelCase

Rename the function BlinkHandler to avoid CamelCase.
BlinkHandler -> blink_handler

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: rename SwLedOff to avoid CamelCase
Michael Straube [Wed, 21 Nov 2018 19:49:33 +0000 (20:49 +0100)]
staging: rtl8188eu: rename SwLedOff to avoid CamelCase

Rename the function SwLedOff to avoid CamelCase.
SwLedOff -> sw_led_off

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: rename SwLedOn to avoid CamelCase
Michael Straube [Wed, 21 Nov 2018 19:49:32 +0000 (20:49 +0100)]
staging: rtl8188eu: rename SwLedOn to avoid CamelCase

Rename the function SwLedOn to avoid CamelCase.
SwLedOn -> sw_led_on

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: rename LedCfg to avoid CamelCase
Michael Straube [Wed, 21 Nov 2018 19:49:31 +0000 (20:49 +0100)]
staging: rtl8188eu: rename LedCfg to avoid CamelCase

Rename the variable LedCfg to avoid CamleCase.
LedCfg -> led_cfg

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: add spaces around '&' in rtl8188eu_led.c
Michael Straube [Wed, 21 Nov 2018 19:49:30 +0000 (20:49 +0100)]
staging: rtl8188eu: add spaces around '&' in rtl8188eu_led.c

Add spaces around '&' to follow kernel coding style.
Reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: cleanup comments in rtl8188eu_led.c
Michael Straube [Wed, 21 Nov 2018 19:49:29 +0000 (20:49 +0100)]
staging: rtl8188eu: cleanup comments in rtl8188eu_led.c

Remove comments in rtl8188eu_led.c. The function names are well
descriptive.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: remove unnecessary parentheses in rtl8188eu_led.c
Michael Straube [Wed, 21 Nov 2018 19:49:28 +0000 (20:49 +0100)]
staging: rtl8188eu: remove unnecessary parentheses in rtl8188eu_led.c

Remove unnecessary parentheses reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoMerge tag 'iio-for-4.21a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Thu, 22 Nov 2018 08:39:45 +0000 (09:39 +0100)]
Merge tag 'iio-for-4.21a' of git://git./linux/kernel/git/jic23/iio into staging-testing

Jonathan writes:

First set of new device support, features and cleanups for IIO in the 4.21 cycle

Along with the headline feature of 5 new drivers, we have the
substantial addition of auxilliary sensor support on the lsm6sdx
parts for ST.  There has also been a good set of staging cleanup
in this period with more underway.

An ever increasing number of devices supported with just a new
ID which is a good sign that at least some manufacturers are
continuing to stabilise their interfaces.

New device support,
* ad7124
  - New driver supporting Analog Devices' ad7124-4 and ad7124-8 parts
    with the inevitable DT binding.
* ad7949
  - New driver supporting Analog Devices' ad7949, AD7682 and AD7689 ADCs.
* rm3100
  - New driver supporting PNIs RM3100 magnometer with bindings and
    vendor prefix.
* ti-dac7311
  - New driver supporting DAC7311, DAC6311 and DAC5311 TI DACs, with
    DT bindings.
* vcnl5035
  - New driver supporting the light sensor part of the VCNL4035, with
    DT bindings

Features,
* bindings
  - Add a generic ADC channel binding as we keep reinventing this
    wheel.
* adc128s052
  - Add IDs for additional pin compatible parts.
  - Add APCI ID seen on E3940 UP squared boards.
* ad_sigma_delta
  - Allow for custom data register overiding default.
* kxcjk1013
  - Add KIOX0009 ACPI ID as seen on the Acer One 10.
* lsm6dsx
  - Rework leading to...
  - External sensor support using the built in I2C master.
  - Initial support for a slave lis2mdl magnetometer.
* meson-saradc
  - Add temperature sensor support and bindings.
* st_magn
  - New ID for lsm9dsl_magn with bindings
  - New ID for lis3de accelerometer
* tpl0102
  - Add supprot for IIO_AVAIL_RANGE to report the range available
    from this device to userspace and in kernel users.

Cleanups and minor fixes
* tools
  - Allow outside specification of CFLAGS
* ad2s90
  - Handle and spi_read error.
  - Handle spi_setup failure
  - Drop a pointless assignment.
  - Prevent a potentail race by moving device registration to after
    all other setup.
  - Add missing scale attribute.
  - Add a sanity check on channel type before trying to read it.
* ad2s1210
  - Move to modern gpio descriptors.
  - Drop a gpioin flag which made no sense as far as we can tell.
  - Add dt table (bindings doc to follow when this is ready for
    moving out of staging).
* ad5933
  - Drop camel-case naming of ext_clk_hz.
  - White space fixes.
* ad7150
  - Local variable to shorten overly long line.
  - Alignment and line break fixes.
* ad7280a
  - Handle an error path that was previously ignored.
  - Use crc8.h to build the crc table replacing custom code.
  - Avoid unecessary cast.
  - Power down the device if an error happens in probe
  - Use devm routines to simplify probe and remove.
* ad7606
  - Alignment fixes.
* ad7780
  - This worked as long as by coincidence an uninitialized value
    was 0.  Lets not rely on that.
  - Ensure gain update is only used with the ad778x chips that
    actually support it.
  - Tidy up pattern mask generation.
  - Read regulator when scale is requested (which should be infrequent)
    as it might have changed from initialization.
* ad7816
  - Move to modern gpio descriptors
  - Don't use a busy_pin for ad7818 as there isn't one.
  - Ensure RD/WR and CONVST pins are outputs (previously they
    were brought up as inputs which doesn't seem to make any sense)
  - DT id table.
* adc128s052
  - SPDX
* adt7316
  - Alignment fix.
  - Fix data reading.  When using I2C the driver never actually
    used the value read.  This has been broken a very long time
    hence no rush to fix it now + the driver is undergoing a lot
    of cleanup.
  - Sanity check that the i2c read didn't fail to actually read
    anything.
* dpot-dac
  - Mark a switch full through with slightly different text so that
    gcc doesn't warn on it.
* gyro-adc
  - Fix a wrong file in the MAINTAINERS entry and add binding doc to the
    listed files.
* ina2xx
  - Add some early returns to clarify error paths in switch.
* lsm6dsx
  - MAINTAINERS entry.
* max11100
  - SPDX
* max9611
  - SPDX
* mcp4131
  - use of_device_get_match_data in preference to spi_get_device_id
    approach.
* rcar-adc
  - SPDX
* sc27xx
  - Add ADC conversion timeout support to avoid possible fault.
* ssp_sensors
  - Don't free managed resources manually.
* st-magn
  - Add a comment to avoid future confusion over when to use -magn
    postfix (on multi chip in package parts)
  - Add BDU register for LIS3MDL where it seems to have been missed.
* st-sensors
  - Minor spelling, grammar etc fixes.
* tpl0102
  - Use a pointer rather than an index of an array to improve conciseness.

* tag 'iio-for-4.21a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (80 commits)
  Staging: iio: adt7316: Add an extra check for 'ret' equals to 0
  Staging: iio: adt7316: Fix i2c data reading, set the data field
  dt-bindings: iio: adc: Add docs for ad7124
  iio: adc: Add ad7124 support
  dt-bindings: iio: adc: Add common ADCs properties to a separate file
  iio: ad_sigma_delta: Allow to provide custom data register address
  staging: iio: ad7816: Add device tree table.
  iio: imu: st_lsm6dsx: add entry in MAINTAINERS file
  iio: potentiometer: mcp4131: use of_device_get_match_data()
  staging: iio: adc: ad7280a: use devm_* APIs
  staging: iio: adc: ad7280a: power down the device on error in probe
  dt-bindings: iio: imu: st_lsm6dsx: add support to i2c pullup resistors
  iio: imu: st_lsm6dsx: add hw FIFO support to i2c controller
  iio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine
  iio: imu: st_lsm6dsx: add i2c embedded controller support
  iio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine
  iio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids
  iio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark
  iio: imu: st_lsm6dsx: reload trimming parameter at bootstrap
  iio: imu: st_lsm6dsx: introduce locked read/write utility routines
  ...

5 years agostaging: vchi: Add SPDX-License-Identifier
André Almeida [Tue, 13 Nov 2018 18:58:35 +0000 (16:58 -0200)]
staging: vchi: Add SPDX-License-Identifier

Using multiple license representation as shown here [1].
[1] https://spdx.org/sites/cpstandard/files/pages/files/using_spdx_license_list_short_identifiers.pdf

Signed-off-by: André Almeida <andrealmeid@riseup.net>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchi: change type 'int32_t' to 's32'
André Almeida [Tue, 13 Nov 2018 18:58:34 +0000 (16:58 -0200)]
staging: vchi: change type 'int32_t' to 's32'

As one can see in a typedef at linux/types.h:103, s32 and int32_t are
both a 32 bits signed integer. s32 is preferred because it is defined
by the kernel maintainers and it prevents portability issues. Changed
to meet checkpatch criteria.

Signed-off-by: André Almeida <andrealmeid@riseup.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: unzip_vle.c: Align parameter to the parentesis
Cristian Sicilia [Mon, 12 Nov 2018 20:43:59 +0000 (21:43 +0100)]
staging: erofs: unzip_vle.c: Align parameter to the parentesis

Align parameters to the opened parentesis.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: unzip_vle.c: Constant in comparison on right side
Cristian Sicilia [Mon, 12 Nov 2018 20:43:58 +0000 (21:43 +0100)]
staging: erofs: unzip_vle.c: Constant in comparison on right side

Comparisons should place the constant
on the right side of the test.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: unzip_vle.c: Replace comparison to NULL.
Cristian Sicilia [Mon, 12 Nov 2018 20:43:57 +0000 (21:43 +0100)]
staging: erofs: unzip_vle.c: Replace comparison to NULL.

Replace equal to NULL with logic unary operator,
and removing not equal to NULL comparison.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wlan-ng: remove unused variable in prism2fw.c
Tim Collier [Mon, 19 Nov 2018 08:41:31 +0000 (08:41 +0000)]
staging: wlan-ng: remove unused variable in prism2fw.c

Remove the unused crcend variable from the crcimage function.

Signed-off-by: Tim Collier <osdevtc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: emxx_udc: Fixing function naming
Cristian Sicilia [Fri, 16 Nov 2018 23:46:07 +0000 (00:46 +0100)]
staging: emxx_udc: Fixing function naming

Fix function naming and parenthesis.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: axis-fifo: Split line to stay in 80 characters.
Cristian Sicilia [Fri, 16 Nov 2018 23:24:49 +0000 (00:24 +0100)]
staging: axis-fifo: Split line to stay in 80 characters.

The line is split up to stay in 80 characters-

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: Correct errors from checkpatch
Josenivaldo Benito Jr [Tue, 13 Nov 2018 01:57:16 +0000 (23:57 -0200)]
staging: rtl8723bs: Correct errors from checkpatch

Correct following errors reported by checkpath.pl:

ERROR: space required before the open parenthesis '(' #265: FILE:
drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c:265:
+                       if(!precvframe) ')'

Also similar errors on line 274 and 283.

Signed-off-by: Josenivaldo Benito Jr <jrbenito@benito.qsl.br>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtlwifi: Add new line to stay in 80 characters
Cristian Sicilia [Tue, 13 Nov 2018 19:34:39 +0000 (20:34 +0100)]
staging: rtlwifi: Add new line to stay in 80 characters

The parameter is sent to next line to stay in 80
characters

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtlwifi: Add spaces to match open parenthesis
Cristian Sicilia [Tue, 13 Nov 2018 19:34:38 +0000 (20:34 +0100)]
staging: rtlwifi: Add spaces to match open parenthesis

Added before parameters some spaces to match open parenthesis
on previous line.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: pi433: remove GPL boiler plate text
Michael Straube [Tue, 13 Nov 2018 17:13:40 +0000 (18:13 +0100)]
staging: pi433: remove GPL boiler plate text

The SPDX identifier is a legally binding shorthand,
which can be used instead of the full boiler plate text.

All source and header files have SPDX identifiers.
Remove the GPL boiler plate text to reduce file size.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoRevert "staging: greybus: remove extra space before tab"
Greg Kroah-Hartman [Tue, 20 Nov 2018 09:37:04 +0000 (10:37 +0100)]
Revert "staging: greybus: remove extra space before tab"

This reverts commit 57d053682ff55aa16a390ddb054a26deb4dfbf9e.

Johan writes:
This commit doesn't even do what it claims. It leaves the two
spaces before tabs in place and instead removes a tab that was
used to indent a continuation line, and therefore also hurts
readability while introducing an inconsistency.

Reported-by: Johan Hovold <johan@kernel.org>
Cc: Ioannis Valasakis <code@wizofe.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoRevert "staging: greybus: remove multiple blank lines"
Greg Kroah-Hartman [Tue, 20 Nov 2018 09:35:12 +0000 (10:35 +0100)]
Revert "staging: greybus: remove multiple blank lines"

This reverts commit fcb733b546ea943dd2e312cc3b556159cb44345a.

Johan writes:
This patch removes the double newlines that were used as section
headers in the lengthy protocol header file, and therefore hurts
readability.

So I'm reverting it.

Reported-by: Johan Hovold <johan@kernel.org>
Cc: Ioannis Valasakis <code@wizofe.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: iio: adt7316: Add an extra check for 'ret' equals to 0
Shreeya Patel [Fri, 16 Nov 2018 22:51:32 +0000 (04:21 +0530)]
Staging: iio: adt7316: Add an extra check for 'ret' equals to 0

ret = 0 indicates a case of no error but no data read from
the bus which is an invalid case. This case doesn't ever happen
in reality. It should perhaps be handled for correctness though.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoStaging: iio: adt7316: Fix i2c data reading, set the data field
Shreeya Patel [Fri, 16 Nov 2018 22:49:07 +0000 (04:19 +0530)]
Staging: iio: adt7316: Fix i2c data reading, set the data field

adt7316_i2c_read function nowhere sets the data field.
It is necessary to have an appropriate value for it.
Hence, assign the value stored in 'ret' variable to data field.

This is an ancient bug, and as no one seems to have noticed,
probably no sense in applying it to stable.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: Add docs for ad7124
Stefan Popa [Tue, 13 Nov 2018 11:22:18 +0000 (13:22 +0200)]
dt-bindings: iio: adc: Add docs for ad7124

Add support for Analog Devices AD7124 4-channels and 8-channels ADC.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: Add ad7124 support
Stefan Popa [Tue, 13 Nov 2018 11:21:32 +0000 (13:21 +0200)]
iio: adc: Add ad7124 support

The ad7124-4 and ad7124-8 are a family of 4 and 8 channel sigma-delta ADCs
with 24-bit precision and reference.

Three power modes are available which in turn affect the output data rate:
 * Full power: 9.38 SPS to 19,200 SPS
 * Mid power: 2.34 SPS to 4800 SPS
 * Low power: 1.17 SPS to 2400 SPS

The ad7124-4 can be configured to have four differential inputs, while
ad7124-8 can have 8. Moreover, ad7124 also supports per channel
configuration. Each configuration consists of gain, reference source,
output data rate and bipolar/unipolar configuration.

Datasheets:
Link: http://www.analog.com/media/en/technical-documentation/data-sheets/AD7124-4.pdf
Link: http://www.analog.com/media/en/technical-documentation/data-sheets/ad7124-8.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: Add common ADCs properties to a separate file
Stefan Popa [Tue, 13 Nov 2018 11:21:01 +0000 (13:21 +0200)]
dt-bindings: iio: adc: Add common ADCs properties to a separate file

There are several ADC drivers that depend on the same device tree
bindings. Rather than continue to duplicate the properties, this patch
adds a common adc binding document that can be referenced. For beginning,
only two properties are documented.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: ad_sigma_delta: Allow to provide custom data register address
Lars-Peter Clausen [Tue, 13 Nov 2018 11:20:24 +0000 (13:20 +0200)]
iio: ad_sigma_delta: Allow to provide custom data register address

Some newer devices from the Sigma-Delta ADC family do have their data
register at a different address than the current default address. Add a
parameter to the ad_sigma_delta_info struct which allows to override the
default address.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7816: Add device tree table.
Nishad Kamdar [Wed, 14 Nov 2018 17:46:14 +0000 (23:16 +0530)]
staging: iio: ad7816: Add device tree table.

Add device tree table for matching vendor ID.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add entry in MAINTAINERS file
Lorenzo Bianconi [Thu, 15 Nov 2018 09:10:57 +0000 (10:10 +0100)]
iio: imu: st_lsm6dsx: add entry in MAINTAINERS file

Add entry for st_lsm6dsx imu driver in MAINTAINERS file

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: potentiometer: mcp4131: use of_device_get_match_data()
Slawomir Stepien [Fri, 16 Nov 2018 09:47:21 +0000 (10:47 +0100)]
iio: potentiometer: mcp4131: use of_device_get_match_data()

Try to get the device's data using OF API. In case of failure, fallback
to the spi_get_device_id() method.

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: use devm_* APIs
Slawomir Stepien [Sun, 11 Nov 2018 15:59:11 +0000 (16:59 +0100)]
staging: iio: adc: ad7280a: use devm_* APIs

devm_* APIs are device managed and make code simpler.

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: power down the device on error in probe
Slawomir Stepien [Sun, 11 Nov 2018 15:59:10 +0000 (16:59 +0100)]
staging: iio: adc: ad7280a: power down the device on error in probe

Power down the device if anything goes wrong after the SPI has been
setup correctly in the probe function.

Existing code that toggles the AD7280A_CTRL_LB_SWRST bit inside
ad7280_chain_setup function is responsible for powering up the device.

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: imu: st_lsm6dsx: add support to i2c pullup resistors
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:36 +0000 (15:15 +0100)]
dt-bindings: iio: imu: st_lsm6dsx: add support to i2c pullup resistors

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add hw FIFO support to i2c controller
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:35 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: add hw FIFO support to i2c controller

Introduce hw FIFO support to lsm6dsx i2c controller.
st_lsm6dsx sensor-hub relies on SLV0 for slave configuration since SLV0
is the only channel that can be used to write into i2c slave devices.
SLV{1,2,3} channels are used to read external data and push them into
the hw FIFO

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:34 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine

Introduce st_lsm6dsx_push_tagged_data routine to push samples
to iio buffers. st_lsm6dsx_push_tagged_data will be reused adding
hw fifo support to st_lsm6dsx i2c embedded controller in order to
improve code readability

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add i2c embedded controller support
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:33 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: add i2c embedded controller support

i2c controller embedded in lsm6dx series can connect up to four
slave devices using accelerometer sensor as trigger for i2c
read/write operations.
Introduce sensor hub support for lsm6dso sensor. Add register map
for lis2mdl magnetometer sensor.
In order to perform single read/write operations st_lsm6dsx driver
relies on SLV0 channel (hw FIFO is not supported yet)

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:32 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine

Add st_lsm6dsx_sensor_set_enable routine and remove
st_lsm6dsx_sensor_{enable/disable} ones in order to make the code more
readable and remove unnecessary functions

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:31 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids

Add ST_LSM6DSX_ID_EXT{0,1,2} sensor ids as reference for slave devices
connected to st_lsm6dsx i2c controller. Moreover introduce odr dependency
between accel and ext devices since i2c embedded controller relies on the
accelerometer sensor as bus read/write trigger so we need to enable accel
device at odr = max(accel_odr, ext_odr) in order to properly communicate
with i2c slave devices

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:30 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark

Remove static qualifier from st_lsm6dsx_set_watermark routine in
order to be reused supporting st_lsm6dsx i2c controller

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: reload trimming parameter at bootstrap
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:29 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: reload trimming parameter at bootstrap

Perform a complete device reset at bootstrap reloading trimming parameter
after sw reset is completed. Device sw reset/boot is explained here:
https://www.st.com/resource/en/application_note/dm00517282.pdf,
section 5.7

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: introduce locked read/write utility routines
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:28 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: introduce locked read/write utility routines

Add st_lsm6dsx_update_bits_locked, st_lsm6dsx_read_locked and
st_lsm6dsx_write_locked utility routines in order to guarantee
the bus access is atomic respect to reg page configuration.
This is a preliminary patch to add i2c sensor hub support since
i2c master registers are accessed through a reg page multiplexer

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: sc27xx: Add ADC data conversion timeout
Freeman Liu [Fri, 9 Nov 2018 03:25:31 +0000 (11:25 +0800)]
iio: adc: sc27xx: Add ADC data conversion timeout

Sometimes the ADC controller met some problems, and it will not complete
the data conversion, that will can not wake up the read process any more
to block users. So we should add one maximum conversion time to avoid
this issue.

Signed-off-by: Freeman Liu <freeman.liu@unisoc.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7780: remove unnecessary stashed voltage value
Renato Lui Geh [Mon, 5 Nov 2018 19:16:14 +0000 (17:16 -0200)]
staging: iio: ad7780: remove unnecessary stashed voltage value

This patch removes the unnecessary field int_vref_mv in ad7780_state
referring to the device's voltage.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7780: update voltage on read
Renato Lui Geh [Mon, 5 Nov 2018 19:14:58 +0000 (17:14 -0200)]
staging: iio: ad7780: update voltage on read

The ad7780 driver previously did not read the correct device output, as
it read an outdated value set at initialization. It now updates its
voltage on read.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: magnetometer: Add driver support for PNI RM3100
Song Qiang [Thu, 8 Nov 2018 09:27:49 +0000 (17:27 +0800)]
iio: magnetometer: Add driver support for PNI RM3100

PNI RM3100 is a high resolution, large signal immunity magnetometer,
composed of 3 single sensors and a processing chip with a MagI2C
interface.

Following functions are available:
 - Single-shot measurement from
   /sys/bus/iio/devices/iio:deviceX/in_magn_{axis}_raw
 - Triggerd buffer measurement.
 - DRDY pin for data ready trigger.
 - Both i2c and spi interface are supported.
 - Both interrupt and polling measurement is supported, depends on if
   the 'interrupts' in DT is declared.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>