platform/kernel/linux-rpi.git
5 years agostaging: vchiq_core: do not initialize semaphores twice
Nicolas Saenz Julienne [Tue, 20 Nov 2018 14:53:44 +0000 (15:53 +0100)]
staging: vchiq_core: do not initialize semaphores twice

vchiq_init_state() initialises a series of semaphores to then call
remote_event_create() on the same semaphores, which initializes them
again. We get rid of the second initialization.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq_core: remove unnecessary safety checks in vchiq_init_state
Nicolas Saenz Julienne [Tue, 20 Nov 2018 14:53:43 +0000 (15:53 +0100)]
staging: vchiq_core: remove unnecessary safety checks in vchiq_init_state

vchiq_init_state() checks the initial contents of slot_zero are correct.
These are set in vchiq_init_slots(), using the same hard-coded defaults
as the checks. Both functions are called sequentially and Video Core
isn't yet aware of the slot's address. There is no way the contents of
slot_zero changed in between functions, making the checks useless.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq-core: get rid of is_master distinction
Nicolas Saenz Julienne [Tue, 20 Nov 2018 14:53:42 +0000 (15:53 +0100)]
staging: vchiq-core: get rid of is_master distinction

VCHIQ bulk transfers are what most people call DMA transfers. The CPU
sends a list of physical addresses to the VideoCore which then access
the memory directly without the need for CPU interaction.  With this
setup we call the CPU the "slave" and the VideoCore the "master".

There seems to be an option to switch roles in vchiq. Which nobody is
using nor is properly implemented. So we get rid of the "is_master == 1"
option, and all the related code.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq_arm: rework vchiq_ioc_copy_element_data
Nicolas Saenz Julienne [Tue, 20 Nov 2018 14:53:41 +0000 (15:53 +0100)]
staging: vchiq_arm: rework vchiq_ioc_copy_element_data

The function is passed to vchiq_core.c for it to go trough all the
transfer elements (an array of pointers to data) and copy them into the
actual transfer memory (contiguous memory).

The logic in the function was "copy an element and return, except when
the element is empty, in which case look for the next non-empty element
and copy it. The function will be called as many times as necessary until
all the elements are copied".

Now, this approach already forces the function to loop around elements
and felt convoluted, so it was changed to a more straightforward "Copy
all the elements into memory as long as they fit".

The resulting function is shorter and simpler.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq_arm: get rid of vchi_mh.h
Nicolas Saenz Julienne [Tue, 20 Nov 2018 14:53:40 +0000 (15:53 +0100)]
staging: vchiq_arm: get rid of vchi_mh.h

The concept of VCHI_MEM_HANDLE_T is introduced by this header file and
was meant to be used with bulk transfers. After a quick look in
vchiq_core.c it is pretty clear that it actually accomplishes nothing
nor alters the bulk transfers in any way.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq_arm: use list_for_each_entry when accessing bulk_waiter_list
Nicolas Saenz Julienne [Tue, 20 Nov 2018 14:53:39 +0000 (15:53 +0100)]
staging: vchiq_arm: use list_for_each_entry when accessing bulk_waiter_list

The resulting code is way more readeable and intuitive compared to plain
list_for_each.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq_shim: delete vchi_service_create
Nicolas Saenz Julienne [Tue, 20 Nov 2018 14:53:38 +0000 (15:53 +0100)]
staging: vchiq_shim: delete vchi_service_create

No one is using the API neither in the actual staging tree nor in the
downstream tree (https://github.com/raspberrypi/linux).

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq_arm: rework close/remove_service IOCTLS
Nicolas Saenz Julienne [Tue, 20 Nov 2018 14:53:37 +0000 (15:53 +0100)]
staging: vchiq_arm: rework close/remove_service IOCTLS

The implementation of both IOCTLS was the same except for one function
call. This joins both implementations and updates the code to avoid
unneeded indentations.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq_core: rework vchiq_get_config
Nicolas Saenz Julienne [Tue, 20 Nov 2018 14:53:36 +0000 (15:53 +0100)]
staging: vchiq_core: rework vchiq_get_config

The function is overly complicated for what it's ultimately achieving.
It's simply filling up a structure.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rb8822be Change line not to end with '('
Ricardo Silva [Mon, 26 Nov 2018 19:42:17 +0000 (11:42 -0800)]
staging: rb8822be Change line not to end with '('

To comply with checkpatch.

CHECK: Lines should not end with a '('
+u8 rtl_mrate_idx_to_arfr_id(

Signed-off-by: Ricardo Silva <ricsilvs1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: greybus: Parenthesis alignment
Cristian Sicilia [Sun, 25 Nov 2018 16:58:15 +0000 (17:58 +0100)]
staging: greybus: Parenthesis alignment

Some parameters are aligned with parentheses.
Some parentheses was opened at end of line.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: avoid using clk_* operations
Sergio Paracuellos [Sat, 24 Nov 2018 17:54:55 +0000 (18:54 +0100)]
staging: mt7621-pci: avoid using clk_* operations

There is no clock driver for ralink mips and clk_enable
are no-ops for this architecture. This has been also tested
without using clocks and seems to work so avoid to use them
in this driver.

Fixes: ad9c87e129d1: "staging: mt7621-pci: parse and init
port data from device tree"
Reported-by: NeilBrown <neil@brown.name>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: fix reset lines for each pcie port
Sergio Paracuellos [Sat, 24 Nov 2018 17:54:54 +0000 (18:54 +0100)]
staging: mt7621-pci: fix reset lines for each pcie port

Depending of chip revision reset lines are inverted. It is also
necessary to read PCIE_FTS_NUM register before enabling the phy.
Hence update the code to achieve this.

Fixes: 745eeeac68d7 ("staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function")
Reported-by: NeilBrown <neil@brown.name>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: dt-bindings: update bindings doc removing sysctls registers
Sergio Paracuellos [Sat, 24 Nov 2018 17:54:53 +0000 (18:54 +0100)]
staging: mt7621-pci: dt-bindings: update bindings doc removing sysctls registers

The sysctl register are already claimed by palmbus, so
pci fails to claim it. Device tree has been updated to not
use it at all with pcie. Update bindings documentation.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-dts: remove sysctl registers from pcie bindings
Sergio Paracuellos [Sat, 24 Nov 2018 17:54:52 +0000 (18:54 +0100)]
staging: mt7621-dts: remove sysctl registers from pcie bindings

The sysctl register are already claimed by palmbus, so
pci fails to claim it. Remove registers accordly from DT
bindings.

Fixes: 624c5227ed0a: staging: mt7621-dts: add sysctl registers base address to pcie
Reported-by: NeilBrown <neil@brown.name>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: avoid mapping sysctls registers
Sergio Paracuellos [Sat, 24 Nov 2018 17:54:51 +0000 (18:54 +0100)]
staging: mt7621-pci: avoid mapping sysctls registers

The sysctl register are already claimed by palmbus, so
pci fails to claim it. The best way to access the sysc registers
is to use rt_sysc_[rwm]32().

Fixes: 89e9f6e6adfc: staging: mt7621-pci: remap and use sysctl from device tree
Reported-by: NeilBrown <neil@brown.name>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: pi433: fix potential null dereference
Michael Straube [Sun, 25 Nov 2018 09:22:25 +0000 (10:22 +0100)]
staging: pi433: fix potential null dereference

Add a test for successful call to cdev_alloc() to avoid
potential null dereference. Issue reported by smatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Fixes: 874bcba65f9a ("staging: pi433: New driver")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: remove redundant null check on pregpriv
Wen Yang [Sat, 24 Nov 2018 11:22:19 +0000 (11:22 +0000)]
staging: rtl8723bs: remove redundant null check on pregpriv

The null check on &padapter->registrypriv is redundant since registrypriv
is a struct inside padapter and can never be null, so the check is always
true.  we may remove it.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
CC: devel@driverdev.osuosl.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: cleanup lines over 80 characters
Michael Straube [Fri, 23 Nov 2018 20:41:06 +0000 (21:41 +0100)]
staging: rtl8188eu: cleanup lines over 80 characters

Cleanup lines over 80 characters by replacing tabs with spaces
or adding appropriate line breaks.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: correct indentation
Michael Straube [Fri, 23 Nov 2018 20:41:05 +0000 (21:41 +0100)]
staging: rtl8188eu: correct indentation

Correct indentation to clear a checkpatch warning.
WARNING: suspect code indent for conditional statements (8, 24)

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: remove return from void function
Michael Straube [Fri, 23 Nov 2018 20:41:04 +0000 (21:41 +0100)]
staging: rtl8188eu: remove return from void function

Remove return from a void function to clear a checkpatch warning.
WARNING: void function return statements are not generally useful

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: refactor if else statement
Michael Straube [Fri, 23 Nov 2018 20:41:03 +0000 (21:41 +0100)]
staging: rtl8188eu: refactor if else statement

Refactor if else statement to clear checkpatch warnings.
WARNING: else is not generally useful after a break or return
WARNING: line over 80 characters

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 rtw_mlme.c
Michael Straube [Fri, 23 Nov 2018 20:41:02 +0000 (21:41 +0100)]
staging: rtl8188eu: cleanup declarations in rtw_mlme.c

Replace tabs with spaces, remove spaces, remove blank lines
and break lines appropriatly in declarations.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: remove rtw_android_set_block()
Michael Straube [Fri, 23 Nov 2018 20:41:01 +0000 (21:41 +0100)]
staging: rtl8188eu: remove rtw_android_set_block()

The function rtw_android_set_block() just returns zero. The only user
is the function rtw_android_priv_cmd(). The variable bytes_written is
initialized to zero and not changed before the use of
rtw_android_set_block(). Remove rtw_android_set_block() and it's only
use.

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 rtw_mlme.c
Michael Straube [Fri, 23 Nov 2018 20:41:00 +0000 (21:41 +0100)]
staging: rtl8188eu: use __func__ in rtw_mlme.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: rtl8188eu: remove unnecessary parentheses in rtw_mlme.c
Michael Straube [Fri, 23 Nov 2018 20:40:59 +0000 (21:40 +0100)]
staging: rtl8188eu: remove unnecessary parentheses in rtw_mlme.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 agostaging: rtl8188eu: cleanup remaining comparsions to true
Michael Straube [Fri, 23 Nov 2018 20:40:58 +0000 (21:40 +0100)]
staging: rtl8188eu: cleanup remaining comparsions to true

Cleanup remaining comparsions to true.
if (x == true) -> if (x)
if (x != true) -> if (!x)
if (!x == true) -> if (!x)

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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>
5 years agoiio: magnetometer: Add DT support for PNI RM3100
Song Qiang [Thu, 8 Nov 2018 09:27:48 +0000 (17:27 +0800)]
iio: magnetometer: Add DT support for PNI RM3100

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: Add PNI to the vendor prefixes
Song Qiang [Thu, 8 Nov 2018 09:27:47 +0000 (17:27 +0800)]
dt-bindings: Add PNI to the vendor prefixes

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: st-accel: add support for lis3de
Heiko Stuebner [Wed, 7 Nov 2018 15:45:21 +0000 (16:45 +0100)]
iio: st-accel: add support for lis3de

This commit add support for STMicroelectronics lis3de accelerometer.
Datasheet for this device can be found here:

https://www.st.com/resource/en/datasheet/lis3de.pdf

Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: Add device tree binding for vishay vcnl4035
Parthiban Nallathambi [Wed, 7 Nov 2018 17:08:21 +0000 (18:08 +0100)]
iio: light: Add device tree binding for vishay vcnl4035

Adding device tree binding for vcnl4035 and vendor
prefix for Vishay Intertechnology

Signed-off-by: Parthiban Nallathambi <pn@denx.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: Add support for vishay vcnl4035
Parthiban Nallathambi [Wed, 7 Nov 2018 17:08:20 +0000 (18:08 +0100)]
iio: light: Add support for vishay vcnl4035

Add support for VCNL4035, which is capable of Ambient light
sensing (ALS) and proximity function. This patch adds support
only for ALS function

Signed-off-by: Parthiban Nallathambi <pn@denx.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>