platform/kernel/linux-rpi3.git
5 years agoAdded IQaudIO Pi-Codec board support (#2969)
IQaudIO [Mon, 13 May 2019 20:53:05 +0000 (21:53 +0100)]
Added IQaudIO Pi-Codec board support (#2969)

Add support for the IQaudIO Pi-Codec board.

Signed-off-by: Gordon <gordon@iqaudio.com>
5 years agoRevert "video: bcm2708_fb: Try allocating on the ARM and passing to VPU"
Dave Stevenson [Mon, 13 May 2019 16:34:29 +0000 (17:34 +0100)]
Revert "video: bcm2708_fb: Try allocating on the ARM and passing to VPU"

This reverts commit ca36c709fce57e8023d2b8b354376bf161601a49.

The driver tries a cma_alloc to avoid using gpu_mem, but should
that fail the core code is logging an error with no easy way to
test whether it will succeed or fail first.

Revert until we either totally give up on gpu_mem and increase
CMA always, or find a way to try an allocation.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
5 years agostaging: vchiq-mmal: Fix memory leak of vchiq instance
Dave Stevenson [Fri, 3 May 2019 12:27:51 +0000 (13:27 +0100)]
staging: vchiq-mmal: Fix memory leak of vchiq instance

The vchiq instance was allocated from vchiq_mmal_init via
vchi_initialise, but was never released with vchi_disconnect.

Retain the handle and release it from vchiq_mmal_finalise.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
5 years agostaging: mmal-vchiq: Fix memory leak in error path
Dave Stevenson [Thu, 2 May 2019 14:50:01 +0000 (15:50 +0100)]
staging: mmal-vchiq: Fix memory leak in error path

On error, vchiq_mmal_component_init could leave the
event context allocated for ports.
Clean them up in the error path.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
5 years agoarm: dts: overlays: rpi-sense: add upstream humidity compatible
Peter Robinson [Sun, 5 May 2019 20:07:12 +0000 (21:07 +0100)]
arm: dts: overlays: rpi-sense: add upstream humidity compatible

The upstream humidiity driver uses "st,hts221" for the compatible
string so add that in as well so it will work with an unmodified
upstream kernel driver. We leave the downstream as the priority.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
5 years agoconfigs: Enable ICS-43432 I2S microphone module
Russell Joyce [Thu, 2 May 2019 14:18:36 +0000 (15:18 +0100)]
configs: Enable ICS-43432 I2S microphone module

Signed-off-by: Russell Joyce <russell.joyce@york.ac.uk>
5 years agoBCM270X_DT: Also set coherent_pool=1M for BT Pis
Phil Elwell [Thu, 2 May 2019 21:14:34 +0000 (22:14 +0100)]
BCM270X_DT: Also set coherent_pool=1M for BT Pis

See: https://github.com/raspberrypi/linux/issues/2924

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
5 years agostaging: mmal-vchiq: Replace spinlock protecting context_map with mutex
Dave Stevenson [Wed, 1 May 2019 14:17:00 +0000 (15:17 +0100)]
staging: mmal-vchiq: Replace spinlock protecting context_map with mutex

950fd86 staging: bcm2835-camera: Replace open-coded idr with a struct idr.
replaced an internal implementation of an idr with the standard functions
and a spinlock.
idr_alloc(GFP_KERNEL) can sleep whilst calling kmem_cache_alloc to allocate
the new node, but this is not valid whilst in an atomic context due to the
spinlock.

There is no need for this to be a spinlock as a standard mutex is
sufficient.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
5 years agostaging: mmal-vchiq: Free the event context for control ports
Dave Stevenson [Wed, 1 May 2019 12:27:23 +0000 (13:27 +0100)]
staging: mmal-vchiq: Free the event context for control ports

vchiq_mmal_component_init calls init_event_context for the
control port, but vchiq_mmal_component_finalise didn't free
it, causing a memory leak..

Add the free call.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
5 years agostaging: bcm2835-codec: Remove height padding for ISP role
Dave Stevenson [Thu, 2 May 2019 13:32:21 +0000 (14:32 +0100)]
staging: bcm2835-codec: Remove height padding for ISP role

The ISP has no need for heights to be a multiple of macroblock
sizes, therefore doesn't require the align on the height.
Remove it for the ISP role. (It is required for the codecs).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
5 years agostaging: bcm2835-codec: Correct port width calc for truncation
Dave Stevenson [Thu, 2 May 2019 13:30:24 +0000 (14:30 +0100)]
staging: bcm2835-codec: Correct port width calc for truncation

The calculation converting from V4L2 bytesperline to MMAL
width had an operator ordering issue that lead to Bayer raw 10
(and 12 and 14) setting an incorrect stride for the buffer.
Correct this operation ordering issue.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
5 years agolan78xx: use default alignment for rx buffers
P33M [Thu, 2 May 2019 10:53:45 +0000 (11:53 +0100)]
lan78xx: use default alignment for rx buffers

The lan78xx uses a 12-byte hardware rx header, so there is no need
to allocate SKBs with NET_IP_ALIGN set. Removes alignment faults
in both dwc_otg and in ipv6 processing.

5 years agosmsc95xx: dynamically fix up TX buffer alignment with padding bytes
P33M [Wed, 1 May 2019 16:04:32 +0000 (17:04 +0100)]
smsc95xx: dynamically fix up TX buffer alignment with padding bytes

dwc_otg requires a 32-bit aligned buffer start address, otherwise
expensive bounce buffers are used. The LAN951x hardware can skip up to
3 bytes between the TX header and the start of frame data, which can
be used to force alignment of the URB passed to dwc_otg.

As found in https://github.com/raspberrypi/linux/issues/2924

5 years agoconfigs: Enable netdev LED trigger
Russell Joyce [Wed, 1 May 2019 15:43:27 +0000 (16:43 +0100)]
configs: Enable netdev LED trigger

Signed-off-by: Russell Joyce <russell.joyce@york.ac.uk>
5 years agoRevert "staging: bcm2835-audio: Drop DT dependency"
popcornmix [Wed, 1 May 2019 13:23:39 +0000 (14:23 +0100)]
Revert "staging: bcm2835-audio: Drop DT dependency"

This reverts commit 60a2e557a4f81480216066f22b84c3dda31b3470.

5 years agodts: Increase default coherent pool size
P33M [Wed, 1 May 2019 14:00:05 +0000 (15:00 +0100)]
dts: Increase default coherent pool size

dwc_otg allocates DMA-coherent buffers in atomic context for misaligned
transfer buffers. The pool that these allocations come from is set up
at boot-time but can be overridden by a commandline parameter -
increase this for now to prevent failures seen on 4.19 with multiple
USB Ethernet devices.

see: https://github.com/raspberrypi/linux/issues/2924

5 years agostaging: bcm2835-audio: double free in init error path
Dan Carpenter [Mon, 17 Dec 2018 07:08:54 +0000 (10:08 +0300)]
staging: bcm2835-audio: double free in init error path

commit 136ff5e49271c4c8fceeca5491c48e66b961564b upstream.

We free instance here and in the caller.  It should be only the caller
which handles it.

Fixes: d7ca3a71545b ("staging: bcm2835-audio: Operate non-atomic PCM ops")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Drop DT dependency
Stefan Wahren [Thu, 6 Dec 2018 18:28:58 +0000 (19:28 +0100)]
staging: bcm2835-audio: Drop DT dependency

commit 438fc48260a0afc4cee733e5bc20234ff2bbef56 upstream.

Just like the bcm2835-video make this a platform driver which is probed
by vchiq. In order to change the number of channels use a module
parameter instead, but use the maximum as default.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: use module_platform_driver() macro
Stefan Wahren [Thu, 6 Dec 2018 18:28:57 +0000 (19:28 +0100)]
staging: bcm2835-audio: use module_platform_driver() macro

commit 1e55d56344b0777d6cee9b9e4a813d53728ee798 upstream.

There is not much value behind this boilerplate, so use
module_platform_driver() instead.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Enable compile test
Stefan Wahren [Thu, 6 Dec 2018 18:28:56 +0000 (19:28 +0100)]
staging: bcm2835-audio: Enable compile test

commit 458d4866a34d0c129ffc3bd56345b2166ba46d77 upstream.

Enable the compilation test for bcm2835-audio to gain more build coverage.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: interpolate audio delay
Mike Brady [Mon, 22 Oct 2018 19:17:08 +0000 (20:17 +0100)]
staging: bcm2835-audio: interpolate audio delay

commit a105a3a72824e0ac685a0711a67e4dbe29de62d0 upstream.

When the BCM2835 audio output is used, userspace sees a jitter up to 10ms
in the audio position, aka "delay" -- the number of frames that must
be output before a new frame would be played.
Make this a bit nicer for userspace by interpolating the position
using the CPU clock.
The overhead is small -- an extra ktime_get() every time a GPU message
is sent -- and another call and a few calculations whenever the delay
is sought from userland.
At 48,000 frames per second, i.e. approximately 20 microseconds per
frame, it would take a clock inaccuracy of
20 microseconds in 10 milliseconds -- 2,000 parts per million --
to result in an inaccurate estimate, whereas
crystal- or resonator-based clocks typically have an
inaccuracy of 10s to 100s of parts per million.

Signed-off-by: Mike Brady <mikebrady@eircom.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: update TODO
Nicolas Saenz Julienne [Wed, 17 Oct 2018 19:01:56 +0000 (21:01 +0200)]
staging: bcm2835-audio: update TODO

commit 01ec7398c56e8f1b903ecb3c5c75400e263eef43 upstream.

The following tasks were completed or not the right solution:

1/2- Not the proper solution, we should register a platform device in
vchiq the same way it's done with bcm2835-camera as commented here:
https://lkml.org/lkml/2018/10/16/1131

2/3- Fixed by Takashi Iwai here: https://lkml.org/lkml/2018/9/4/587

Also, adds a new task as per mailing list conversation.

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: bcm2835-audio: rename platform_driver structure
Nicolas Saenz Julienne [Wed, 17 Oct 2018 19:01:55 +0000 (21:01 +0200)]
staging: bcm2835-audio: rename platform_driver structure

commit 82cdc0c6b6faf877e2aecb957cffa9cb578cc572 upstream.

It was called bcm2835_alsa0_driver, that "0" didn't mean much.

Suggested-by: Takashi Iwai <tiwai@suse.de>
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: bcm2835-audio: more generic probe function name
Nicolas Saenz Julienne [Wed, 17 Oct 2018 19:01:54 +0000 (21:01 +0200)]
staging: bcm2835-audio: more generic probe function name

commit 96f3bd8ae6516898c7b411ecb87064bb0dd25415 upstream.

There will only be one probe function, there is no use for appendig
"_dt" the end of the name.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: use anonymous union in struct vc_audio_msg
Nicolas Saenz Julienne [Wed, 17 Oct 2018 19:01:53 +0000 (21:01 +0200)]
staging: bcm2835-audio: use anonymous union in struct vc_audio_msg

commit 9c2eaf7da855d314a369d48b9cbf8ac80717a1d0 upstream.

In this case explicitly naming the union doesn't help overall code
comprehension and clutters it.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: reorder variable declarations & remove trivial comments
Nicolas Saenz Julienne [Wed, 17 Oct 2018 19:01:52 +0000 (21:01 +0200)]
staging: bcm2835-audio: reorder variable declarations & remove trivial comments

commit d048385a070552ae819f99f05bd03ec41072783d upstream.

When it comes to declaring variables it's preferred, when possible, to
use an inverted tree organization scheme.

Also, removes some comments that were useless.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: don't initialize memory twice
Nicolas Saenz Julienne [Wed, 17 Oct 2018 19:01:51 +0000 (21:01 +0200)]
staging: bcm2835-audio: don't initialize memory twice

commit 2e5f59fb77397cab3bc3d156e8be4164a67d32ef upstream.

The memory is being allocated with devres_alloc(), wich ultimately uses
__GFP_ZERO to call kmalloc. We don't need to zero the memory area again
in bcm2835-audio.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: unify FOURCC command definitions
Nicolas Saenz Julienne [Wed, 17 Oct 2018 19:01:50 +0000 (21:01 +0200)]
staging: bcm2835-audio: unify FOURCC command definitions

commit a90d8f49cc7fd7220aa24b85fc74ef3cfd62b96f upstream.

The device communicates with the audio core using FOURCC codes. The
driver was generating them using different macros/expressions. We now
use the same macro to create them and centralize all the definitions.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Simplify card object management
Takashi Iwai [Tue, 4 Sep 2018 15:58:58 +0000 (17:58 +0200)]
staging: bcm2835-audio: Simplify card object management

commit 872ae2d63d516a2a3b9c833d8685afcfa7814542 upstream.

Instead of creating a dummy child device to manage the card object,
just use devm stuff directly for releasing with snd_card_free().
This results in a lot of code reduction.

Since the dummy child devices are gone, the device object to be passed
to the memory allocator needs to be adjusted as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Simplify kctl creation helpers
Takashi Iwai [Tue, 4 Sep 2018 15:58:57 +0000 (17:58 +0200)]
staging: bcm2835-audio: Simplify kctl creation helpers

commit dc5c0eb1e8601206dffbfc302cbd190f89dcd040 upstream.

Just a minor code refactoring and adding some const prefix.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Simplify PCM creation helpers
Takashi Iwai [Tue, 4 Sep 2018 15:58:56 +0000 (17:58 +0200)]
staging: bcm2835-audio: Simplify PCM creation helpers

commit 74470ffeb9aed5548654cfca881bf1d7469fe9c4 upstream.

All three functions to create PCM objects are fairly resemble, and can
be unified to a single common helper.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Set SNDRV_PCM_INFO_SYNC_APPLPTR
Takashi Iwai [Tue, 4 Sep 2018 15:58:55 +0000 (17:58 +0200)]
staging: bcm2835-audio: Set SNDRV_PCM_INFO_SYNC_APPLPTR

commit b59d6a5f73501f74848d6700101e7736afe3d54a upstream.

The recent ALSA PCM core supports the SNDRV_PCM_INFO_SYNC_APPLPTR flag
indicating that the driver needs the ack call at each appl_ptr
update.  This is requirement for the indirect PCM implementations like
bcm2835-audio driver, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Use coherent device buffers
Takashi Iwai [Tue, 4 Sep 2018 15:58:54 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use coherent device buffers

commit ad29c6e6cbf6f2af7362b043adad51a3be3d39c7 upstream.

The memory access to the pages allocated with
SNDRV_DMA_TYPE_CONTINUOUS are basically non-coherent, and it becomes a
problem when a process accesses via mmap.

For the more consistent access, use the device coherent memory, just
by replacing the call pattern in the allocator helpers.

The only point we need to be careful for is the device object passed
there; since bcm2835-audio driver creates fake devices and each card
is created on top of that, we need to pass its parent device as the
real device object.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Move module parameter description
Takashi Iwai [Tue, 4 Sep 2018 15:58:53 +0000 (17:58 +0200)]
staging: bcm2835-audio: Move module parameter description

commit b876f2075808e95e244053caa53fa7e86e929a99 upstream.

For more consistency, move the module parameter description right
after its variable definition.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Remove unnecessary header file includes
Takashi Iwai [Tue, 4 Sep 2018 15:58:52 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove unnecessary header file includes

commit 7e46fff5f19ce2b8a9891e4c08631c64d06e9e17 upstream.

Yet a few header files are included unnecessarily.  Drop them.

Also remove trivial comments.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Use standard error print helpers
Takashi Iwai [Tue, 4 Sep 2018 15:58:51 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use standard error print helpers

commit b7584b64168208ebc14160770c0966b8b12fc16b upstream.

For making the whole code more consistent, replace the home-made debug
print macros with the standard dev_err() & co.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Use card->private_data
Takashi Iwai [Tue, 4 Sep 2018 15:58:50 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use card->private_data

commit 898001a0c845cefe5d47d133485712412853f0a8 upstream.

Instead of allocating a separate snd_device object, let snd_card_new()
allocate the private resource.  This simplifies the code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Operate non-atomic PCM ops
Takashi Iwai [Tue, 4 Sep 2018 15:58:49 +0000 (17:58 +0200)]
staging: bcm2835-audio: Operate non-atomic PCM ops

commit 5c7883e5f27e829f3f3a2ba174d4a724bfd5f026 upstream.

This is the most significant part in the patch series.

The bcm2835-audio driver used to queue the commands to vc04 core via
workqueue, but basically the whole accesses to vc04 core are done in
the sleepable context, including the callback calls.  In such a case,
rewriting the code using non-atomic PCM ops will simplify the logic a
lot.

This patch does it: all workqueue are gone and each former-work
implementation is now directly called from PCM ops like trigger and
write transfer.

Along with it, the DMA position updater, bcm2835_playback_fifo(), was
also rewritten to use a simpler logic.  Now it handles the XRUN and
draining properly by calling snd_pcm_stop() conditionally.

The current position is kept in atomic_t value so that it can be read
concurrently from the pointer callback.

Also, the bcm2835_audio_instance object is allocated at the beginning
of bcm2835_audio_open().  This makes the resource management clearer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Code refactoring of vchiq accessor codes
Takashi Iwai [Tue, 4 Sep 2018 15:58:48 +0000 (17:58 +0200)]
staging: bcm2835-audio: Code refactoring of vchiq accessor codes

commit 769a8e9bf5cf39813f52962fdafdf7e4d52ad585 upstream.

This is a cleanup and code refactoring in bcm2835-vchiq.c.

The major code changes are to provide local helpers for easier use of
lock / unlock, and message passing with/without response wait.  This
allows us to reduce lots of open codes.

Also, the max packet is set at opening the stream, not at each time
when the write gets called.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Make single vchi handle
Takashi Iwai [Tue, 4 Sep 2018 15:58:47 +0000 (17:58 +0200)]
staging: bcm2835-audio: Make single vchi handle

commit 326a6edcb2ada56375bd7d3fc24c83f58e8da7f3 upstream.

The bcm2835_audio_instance object contains the array of
VCHI_SERVICE_HANDLE_T, while the code assumes and uses only the first
element explicitly.  Let's reduce to a single vchi handle for
simplifying the code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Add 10ms period constraint
Takashi Iwai [Tue, 4 Sep 2018 15:58:46 +0000 (17:58 +0200)]
staging: bcm2835-audio: Add 10ms period constraint

commit 93c66acaf68b5247c3121a46a71ff6a70fc1d492 upstream.

It seems that the resolution of vc04 callback is in 10 msec; i.e. the
minimal period size is also 10 msec.

This patch adds the corresponding hw constraint.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Drop superfluous mutex lock during prepare
Takashi Iwai [Tue, 4 Sep 2018 15:58:45 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop superfluous mutex lock during prepare

commit f0eb15d055380ff127e5f12c8fad2b36bdb3c006 upstream.

The chip->audio_mutex is used basically for protecting the opened
stream assignment, and the prepare callback is irrelevant with it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Drop debug messages in bcm2835-pcm.c
Takashi Iwai [Tue, 4 Sep 2018 15:58:44 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop debug messages in bcm2835-pcm.c

commit 055e1c330d04df87d4730a5db837161c11ddaafc upstream.

These debug messages worsen the code readability a lot while they give
little debuggability (which we already have via tracing, in anyway).

Let's clean them up.  This allows us to reduce the
snd_bcm2835_pcm_lib_ioctl() function to be a direct call of the
snd_pcm_lib_ioctl callback (like most other drivers do), too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Propagate parameter setup error
Takashi Iwai [Tue, 4 Sep 2018 15:58:43 +0000 (17:58 +0200)]
staging: bcm2835-audio: Propagate parameter setup error

commit fee5638fe552ff8222c3a5bdcc4a34255e248d8c upstream.

When the parameter setup fails, the driver should propagate the error
code instead of silently ignoring it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Drop useless NULL check
Takashi Iwai [Tue, 4 Sep 2018 15:58:42 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop useless NULL check

commit 8bcf9f252c29c2d5bcce3db605c0ebf1ef230f9c upstream.

alsa_stream->chip can be never NULL.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Drop unnecessary pcm indirect setup
Takashi Iwai [Tue, 4 Sep 2018 15:58:41 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop unnecessary pcm indirect setup

commit 7318ec896f4856fae2bb013858e422fa078201e1 upstream.

The hw_queue_size of PCM indirect helper doesn't need to be set up if
you use the whole given buffer size.  Drop the useless
initialization, which just confuses readers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Use PCM runtime values instead
Takashi Iwai [Tue, 4 Sep 2018 15:58:40 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use PCM runtime values instead

commit b8f7fdd50890b848e085c0519469aed4ff4d9b54 upstream.

Some fields in alsa_stream are the values we keep already in PCM
runtime object, hence they are redundant.  Use the standard PCM
runtime values instead of the private copies.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Kill unused spinlock
Takashi Iwai [Tue, 4 Sep 2018 15:58:39 +0000 (17:58 +0200)]
staging: bcm2835-audio: Kill unused spinlock

commit 5332f6f012c0bf3a45c77dbc0f79814443a884d4 upstream.

The alsa_stream->lock is never used.  Kill it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Fix incorrect draining handling
Takashi Iwai [Tue, 4 Sep 2018 15:58:38 +0000 (17:58 +0200)]
staging: bcm2835-audio: Fix incorrect draining handling

commit 7d2a91f5f1bcf08ca257bcf1ed9721fcd341f834 upstream.

The handling of SNDRV_PCM_TRIGGER_STOP at the trigger callback is
incorrect: when the STOP is issued, the driver is supposed to drop the
stream immediately.  Meanwhile bcm2835 driver checks the DRAINING
state and tries to issue some different command.

This patch straightens things a bit, dropping the incorrect state
checks.  The draining behavior would be still not perfect at this
point, but will be improved in a later patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Drop useless running flag and check
Takashi Iwai [Tue, 4 Sep 2018 15:58:37 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop useless running flag and check

commit 02f2376321d75e78117f39ff81f215254ee6b4ef upstream.

The running flag of alsa_stream is basically useless.  The running
state is strictly controlled in ALSA PCM core side, hence the check in
PCM trigger and close callbacks are superfluous.

Also, the prefill ack at trigger start became superfluous nowadays
with the ALSA PCM core update.

Let's rip them off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Remove superfluous open flag
Takashi Iwai [Tue, 4 Sep 2018 15:58:36 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove superfluous open flag

commit ad13924de6b07cb52714ea1809c57b2e72a24504 upstream.

All the alsa_stream->open flag checks in the current code are
redundant, and they cannot be racy.  For the code simplification,
let's remove the flag and its check.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Remove redundant function calls
Takashi Iwai [Tue, 4 Sep 2018 15:58:35 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove redundant function calls

commit 124950ebe9fa8547c59e8d4acc8d6c59e6278ed6 upstream.

bcm2835_audio_setup(), bcm2835_audio_flush_buffers() and
bcm2835_audio_flush_playback_buffers() functions do implement
nothing.

Also, bcm2835_audio_set_ctls() is already called inside
bcm2835_audio_set_params(), so the later call is superfluous.

This patch removes these superfluous implementations.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Fix mute controls, volume handling cleanup
Takashi Iwai [Tue, 4 Sep 2018 15:58:34 +0000 (17:58 +0200)]
staging: bcm2835-audio: Fix mute controls, volume handling cleanup

commit 495e5a0d83d3902c741771f267a702ae19da8ab6 upstream.

In the current code, the mute control is dealt in a special manner,
modifying the current volume and saving the old volume, etc.  This is
inconsistent (e.g. change the volume while muted, then unmute), and
way too complex.

Also, the whole volume handling code has conversion between ALSA
volume and raw volume values, which can lead to another
inconsistency and complexity.

This patch simplifies these points:
- The ALSA volume value is saved in chip->volume
- volume->mute saves the mute state
- The mute state is evaluated only when the actual volume is passed to
  the hardware, bcm2835_audio_set_ctls()

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Remove redundant substream mask checks
Takashi Iwai [Tue, 4 Sep 2018 15:58:33 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove redundant substream mask checks

commit 14b1f4cba853a11c7b381ad919622f38eb194bd7 upstream.

The avail_substreams bit mask is checked for the possible racy
accesses, but this cannot happen in practice; i.e. the assignment and
the check are superfluous.

Let's rip them off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Clean up include files in bcm2835-ctl.c
Takashi Iwai [Tue, 4 Sep 2018 15:58:32 +0000 (17:58 +0200)]
staging: bcm2835-audio: Clean up include files in bcm2835-ctl.c

commit 821950d3da4bf97bcfedcb812176a0f26b833db0 upstream.

Only a few of them are really needed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Remove redundant spdif stream ctls
Takashi Iwai [Tue, 4 Sep 2018 15:58:31 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove redundant spdif stream ctls

commit ab91e26229eaca2832df51e13c1285aea3be33ab upstream.

The "IEC958 Playback Stream" control does basically the very same
thing as "IEC958 Playback Default" redundantly.  The former should
have been stream-specific and restored after closing the stream, but
we don't do in that way.

Since it's nothing but confusion, remove this fake.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Clean up mutex locks
Takashi Iwai [Tue, 4 Sep 2018 15:58:30 +0000 (17:58 +0200)]
staging: bcm2835-audio: Clean up mutex locks

commit ce4bb1aa271a97047b80ac917a5d91b54925913b upstream.

snd-bcm2835 driver takes the lock with mutex_lock_interruptible() in
all places, which don't make sense.  Replace them with the simple
mutex_lock().

Also taking a mutex lock right after creating it for each PCM object
is nonsense, too.  It cannot be racy at that point.  We can get rid of
it.

Last but not least, initializing chip->audio_mutex at each place is
error-prone.  Initialize properly at creating the chip object in
snd_bcm2835_create() instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoRevert "staging: bcm2835-audio: use module_platform_driver() macro"
popcornmix [Mon, 29 Apr 2019 18:16:16 +0000 (19:16 +0100)]
Revert "staging: bcm2835-audio: use module_platform_driver() macro"

commit ed4c2e5dc4216d5dded502bfcf594d3984e6bccd upstream.

This reverts commit 786ced30fec053b27248ed5b24dcde61ed3f47f6.

5 years agoRevert "staging: bcm2835-audio: Enable compile test"
popcornmix [Mon, 29 Apr 2019 18:16:15 +0000 (19:16 +0100)]
Revert "staging: bcm2835-audio: Enable compile test"

commit 4eae66777a262ac9707980ea0cfe902afadfb577 upstream.

This reverts commit 02d205a57c4c943fc2a5b1ac7c912ce01944f700.

5 years agoRevert "bcm2835: interpolate audio delay"
popcornmix [Mon, 29 Apr 2019 18:16:14 +0000 (19:16 +0100)]
Revert "bcm2835: interpolate audio delay"

commit fb4b9f02986fcb5ae751106ef9b027806b5dd750 upstream.

This reverts commit fb8cc99f05687ca5565dc53a7ee0dd86aefad952.

5 years agoconfigs: enable LED driver for PiGlow
Stefan Wahren [Mon, 29 Apr 2019 17:28:51 +0000 (19:28 +0200)]
configs: enable LED driver for PiGlow

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
5 years agooverlays: Add PiGlow overlay
Stefan Wahren [Mon, 29 Apr 2019 17:35:33 +0000 (19:35 +0200)]
overlays: Add PiGlow overlay

The PiGlow is a small add-on board for the Raspberry Pi that provides
18 individually controllable LEDs (SN3218) and uses the following pins:

P1 & P17 (3V3)
P2 (5V)
P3 (SDA)
P5 (SCL)
P14 (GND)

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
5 years agoRevert "defconfigs: disable memory and IO cgroups (#2908)"
P33M [Wed, 24 Apr 2019 13:25:41 +0000 (14:25 +0100)]
Revert "defconfigs: disable memory and IO cgroups (#2908)"

This reverts commit 9881cdbf446081f71c62f39f4c56a21001baea73.

5 years agoRevert "cgroup: Disable cgroup "memory" by default"
P33M [Wed, 24 Apr 2019 13:25:09 +0000 (14:25 +0100)]
Revert "cgroup: Disable cgroup "memory" by default"

This reverts commit cd6ce4d0ded13c94ff5208c679ed5e030263149b.

5 years agosound: Fixes for audioinjector-octo under 4.19
Phil Elwell [Thu, 21 Mar 2019 11:19:46 +0000 (11:19 +0000)]
sound: Fixes for audioinjector-octo under 4.19

1. Move the DT alias declaration to the I2C shim in the cases
where the shim is enabled. This works around a problem caused by a
4.19 commit [1] that generates DT/OF uevents for I2C drivers.

2. Fix the diagnostics in an error path of the soundcard driver to
correctly identify the reason for the failure to load.

3. Move the declaration of the clock node in the overlay outside
the I2C node to avoid warnings.

4. Sort the overlay nodes so that dependencies are only to earlier
fragments, in an attempt to get runtime dtoverlay application to
work (it still doesn't...)

See: https://github.com/Audio-Injector/Octo/issues/14
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
[1] af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF")

5 years agomedia: m88ds3103: serialize reset messages in m88ds3103_set_frontend
James Hutchinson [Sun, 13 Jan 2019 21:13:47 +0000 (16:13 -0500)]
media: m88ds3103: serialize reset messages in m88ds3103_set_frontend

commit 981fbe3da20a6f35f17977453bce7dfc1664d74f upstream.

Ref: https://bugzilla.kernel.org/show_bug.cgi?id=199323

Users are experiencing problems with the DVBSky S960/S960C USB devices
since the following commit:

9d659ae: ("locking/mutex: Add lock handoff to avoid starvation")

The device malfunctions after running for an indeterminable period of
time, and the problem can only be cleared by rebooting the machine.

It is possible to encourage the problem to surface by blocking the
signal to the LNB.

Further debugging revealed the cause of the problem.

In the following capture:
- thread #1325 is running m88ds3103_set_frontend
- thread #42 is running ts2020_stat_work

a> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 80
   [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 08
   [42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 68 3f
   [42] usb 1-1: dvb_usb_v2_generic_io: <<< 08 ff
   [42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
   [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
   [42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 3d
   [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
b> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 00
   [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
   [42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
   [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
   [42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 21
   [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
   [42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
   [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
   [42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 66
   [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
   [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
   [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
   [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 60 02 10 0b
   [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07

Two i2c messages are sent to perform a reset in m88ds3103_set_frontend:

  a. 0x07, 0x80
  b. 0x07, 0x00

However, as shown in the capture, the regmap mutex is being handed over
to another thread (ts2020_stat_work) in between these two messages.

>From here, the device responds to every i2c message with an 07 message,
and will only return to normal operation following a power cycle.

Use regmap_multi_reg_write to group the two reset messages, ensuring
both are processed before the regmap mutex is unlocked.

Signed-off-by: James Hutchinson <jahutchinson99@googlemail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agoMaxim MAX98357A I2S DAC overlay (#2935)
wavelet2 [Mon, 15 Apr 2019 09:00:20 +0000 (10:00 +0100)]
Maxim MAX98357A I2S DAC overlay (#2935)

Add overlay for Maxim MAX98357A I2S DAC.

Signed-off-by: Richard Steedman <richard.steedman@gmail.com>
5 years agooverlays: Add rv3028 backup switchover support to i2c-rtc
Phil Howard [Fri, 29 Mar 2019 10:59:55 +0000 (10:59 +0000)]
overlays: Add rv3028 backup switchover support to i2c-rtc

Signed-off-by: Phil Howard <phil@pimoroni.com>
5 years agodt-bindings: rv3028 backup switchover support
Phil Howard [Fri, 29 Mar 2019 10:57:07 +0000 (10:57 +0000)]
dt-bindings: rv3028 backup switchover support

Signed-off-by: Phil Howard <phil@pimoroni.com>
5 years agortc: rv3028: Add backup switchover mode support
Phil Howard [Fri, 29 Mar 2019 10:53:14 +0000 (10:53 +0000)]
rtc: rv3028: Add backup switchover mode support

Signed-off-by: Phil Howard <phil@pimoroni.com>
5 years agodwc_otg: fix locking around dequeueing and killing URBs
P33M [Tue, 9 Apr 2019 15:40:48 +0000 (16:40 +0100)]
dwc_otg: fix locking around dequeueing and killing URBs

kill_urbs_in_qh_list() is practically only ever called with the fiq lock
already held, so don't spinlock twice in the case where we need to cancel
an isochronous transfer.

Also fix up a case where the global interrupt register could be read with
the fiq lock not held.

Fixes the deadlock seen in https://github.com/raspberrypi/linux/issues/2907

5 years agoBCM2708: Add core Device Tree support, ilitek251x
Samuel Hsu [Mon, 8 Apr 2019 15:06:44 +0000 (17:06 +0200)]
BCM2708: Add core Device Tree support, ilitek251x

Signed-off-by: Samuel Hsu <hsu@distec.de>
5 years agoconfigs: Add TOUCHSCREEN_ILI210X=m
Samuel Hsu [Mon, 8 Apr 2019 14:54:34 +0000 (16:54 +0200)]
configs: Add TOUCHSCREEN_ILI210X=m

Signed-off-by: Samuel Hsu <hsu@distec.de>
5 years agoInput: ili210x - add DT binding document
Samuel Hsu [Mon, 8 Apr 2019 14:49:51 +0000 (16:49 +0200)]
Input: ili210x - add DT binding document

commit 41a852e002e65ab7a1e6841b485d72d022e95df2 upstream

Add DT binding document for the Ilitek ILI210x and ILI251x
touchscreen controllers.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
5 years agoInput: ili210x - fetch touchscreen geometry from DT
Samuel Hsu [Mon, 8 Apr 2019 14:42:17 +0000 (16:42 +0200)]
Input: ili210x - fetch touchscreen geometry from DT

commit f67cc3e927d8414ad3872e046764534ea1f5db0d upstream

Fetching the geometry from the ILI251x registers seems unreliable and
sometimes returns all zeroes. Add support for fetching the geometry and
axis inversion from DT instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
5 years agodwc_otg: only do_split when we actually need to do a split
P33M [Mon, 8 Apr 2019 11:45:23 +0000 (12:45 +0100)]
dwc_otg: only do_split when we actually need to do a split

The previous test would fail if the root port was in fullspeed mode
and there was a hub between the FS device and the root port. While
the transfer worked, the schedule mangling performed for high-speed
split transfers would break leading to an 8ms polling interval.

5 years agodtoverlays: Add Support for the UDRC/DRAWS
Annaliese McDermond [Sun, 17 Mar 2019 23:48:36 +0000 (16:48 -0700)]
dtoverlays: Add Support for the UDRC/DRAWS

Adds a new overlay to support the Northwest Digital Radio
DRAWS and UDRC HATs.  See http://nwdigitalradio.com.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
5 years agoASoC: tlv320aic32x4: Add Playback PowerTune Controls
Annaliese McDermond [Thu, 4 Apr 2019 04:01:55 +0000 (21:01 -0700)]
ASoC: tlv320aic32x4: Add Playback PowerTune Controls

commit d3e6e374566e1154820a9a3dc82f7eef646fcf95 upstream.

PowerTune controls the power level of the chip.  On playback this
indirectly controls things like the gain of the various output
amplifiers.  This can allow for the decrease of output levels
from the codec.  This adds controls for those power levels to
the driver.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Add Switch for Setting Common Mode Voltage
Annaliese McDermond [Thu, 4 Apr 2019 04:01:54 +0000 (21:01 -0700)]
ASoC: tlv320aic32x4: Add Switch for Setting Common Mode Voltage

commit 44ceee847e27c828f2f1ef4e400e6bc0c8d04de3 upstream.

Add a switch for setting common mode voltage.  This can allow
for higher drive levels on the amplifier outputs.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Update copyright and use SPDX identifier
Annaliese McDermond [Thu, 4 Apr 2019 04:17:16 +0000 (21:17 -0700)]
ASoC: tlv320aic32x4: Update copyright and use SPDX identifier

commit 8a1d95c393d971e624fc28f11516b0bc3a7fa706 upstream.

Update the copyright dates and use the SPDX identifier instead
of reciting the license.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Change author's name
Annaliese McDermond [Thu, 4 Apr 2019 04:17:15 +0000 (21:17 -0700)]
ASoC: tlv320aic32x4: Change author's name

commit 7297ba6c74c5b9e78d8e936af82eecfcf7d32dfb upstream.

The author of these files has changed her name.  Update
instances in the code of her dead name to current legal
name.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoAudiophonics I-Sabre 9038Q2M DAC driver
FERHAT Nicolas [Fri, 5 Apr 2019 12:06:42 +0000 (13:06 +0100)]
Audiophonics I-Sabre 9038Q2M DAC driver

Signed-off-by: Audiophonics <contact@audiophonics.fr>
5 years agoASoC: tlv320aic32x4: Only enable with common clock
Mark Brown [Tue, 26 Mar 2019 13:10:13 +0000 (13:10 +0000)]
ASoC: tlv320aic32x4: Only enable with common clock

commit 64f01d2b5ccc621c3aa66b82daf9154f5581f36a upstream.

Some architectures do not yet support the common clock API at all but
the tlv320aic32x4 driver now requires it.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Allow 192000 Sample Rate
Annaliese McDermond [Fri, 22 Mar 2019 00:58:54 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Allow 192000 Sample Rate

commit 6d56ee1550b8a81bc63c80051ff78d8d704b09ba upstream.

The clocking and processing blocks are now properly set up to
support 192000 sample rates.  Allow drivers to ask for that.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Remove mclk references
Annaliese McDermond [Fri, 22 Mar 2019 00:58:53 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Remove mclk references

commit 78f2d58a289302e56a7def96a783a7686ebf27e2 upstream.

mclk is not used by anything anymore.  Remove support for it.
All that information now comes from the clock tree.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Restructure set_dai_sysclk
Annaliese McDermond [Fri, 22 Mar 2019 00:58:52 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Restructure set_dai_sysclk

commit aa6a60f7be925210d5156f0e8025f3afe1f4f54d upstream.

The sysclk is now managed by the CCF.  Change this function
to merely find the system clock and set it using
clk_set_rate.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Dynamically Determine Clocking
Annaliese McDermond [Fri, 22 Mar 2019 00:58:51 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Dynamically Determine Clocking

commit 96c3bb00239de4fb5f4ddca42c1f90d6d9b3c697 upstream.

The existing code uses a static lookup table to determine the
settings of the various clock devices on board the chip.  This is
limiting in a couple of ways.  First, this doesn't allow for any
master clock rates other than the three that have been
precalculated.  Additionally, new sample rates are difficult to
add to the table.  Witness that the chip is capable of 192000 Hz
sampling, but it is not provided by this driver.  Last, if the
driver is clocked by something that isn't a crystal, the
upstream clock may not be able to achieve exactly the rate
requested in the driver.  This will mean that clocking will be
slightly off for the sampling clock or that it won't work at all.

This patch determines the settings for all of the clocks at
runtime considering the real conditions of the clocks in the
system.  The rules for the clocks are in TI's SLAA557 application
guide on pages 37, 51 and 77.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Move aosr and dosr setting to separate functions
Annaliese McDermond [Fri, 22 Mar 2019 00:58:50 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Move aosr and dosr setting to separate functions

commit fbafbf6517274a797e6e6508c18dd8dba5920c89 upstream.

Move these to separate helper functions.  This looks cleaner and fits
better with the new clock setting in CCF.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Control clock gating with CCF
Annaliese McDermond [Fri, 22 Mar 2019 00:58:49 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Control clock gating with CCF

commit d25970b5fd51e9fcf0afbe190908ea4049454da4 upstream.

Control the clock gating to the various clock components to use
the CCF.  This allows us to prepare_enalbe only 3 clocks and the
relationships assigned to them will cause upstream clockss to
enable automatically.  Additionally we can do this in a single
call to the CCF.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Model BDIV divider in CCF
Annaliese McDermond [Fri, 22 Mar 2019 00:58:48 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Model BDIV divider in CCF

commit 9b484124ebd906c4d6bc826cc0d417e80cc1105c upstream.

Model and manage BDIV divider as components in the Core
Clock Framework.  This should allow us to do some more complex
clock management and power control.  Also, some of the
on-board chip clocks can be exposed to the outside, and this
change will make those clocks easier to consume by other
parts of the kernel.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Model DAC/ADC dividers in CCF
Annaliese McDermond [Fri, 22 Mar 2019 00:58:47 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Model DAC/ADC dividers in CCF

commit a51b50062091619915c5155085bbe13a7aca6903 upstream.

Model and manage DAC/ADC dividers as components in the Core
Clock Framework.  This should allow us to do some more complex
clock management and power control.  Also, some of the
on-board chip clocks can be exposed to the outside, and this
change will make those clocks easier to consume by other
parts of the kernel.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Model CODEC_CLKIN in CCF
Annaliese McDermond [Fri, 22 Mar 2019 00:58:46 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Model CODEC_CLKIN in CCF

commit fd2df3aeafa4b4cc468d58e147e0822967034b71 upstream.

Model and manage codec clock input as a component in the Core
Clock Framework.  This should allow us to do some more complex
clock management and power control.  Also, some of the
on-board chip clocks can be exposed to the outside, and this
change will make those clocks easier to consume by other
parts of the kernel.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Model PLL in CCF
Annaliese McDermond [Fri, 22 Mar 2019 00:58:45 +0000 (17:58 -0700)]
ASoC: tlv320aic32x4: Model PLL in CCF

commit 514b044cba667e4b7c383ec79b42b997e624b91d upstream.

Model and manage the on-board PLL as a component in the Core
Clock Framework.  This should allow us to do some more complex
clock management and power control.  Also, some of the
on-board chip clocks can be exposed to the outside, and this
change will make those clocks easier to consume by other
parts of the kernel.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Properly Set Processing Blocks
Annaliese McDermond [Thu, 21 Mar 2019 02:38:44 +0000 (19:38 -0700)]
ASoC: tlv320aic32x4: Properly Set Processing Blocks

commit c95e3a4b96293403a427b5185e60fad28af51fdd upstream.

Different processing blocks are required for different sampling
rates and power parameters.  Set the processing blocks based
on this information.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Break out clock setting into separate function
Annaliese McDermond [Tue, 19 Mar 2019 03:37:44 +0000 (20:37 -0700)]
ASoC: tlv320aic32x4: Break out clock setting into separate function

commit bf31cbfbe25001036e1e096b1c260bf871766ea5 upstream.

Break the clock setting logic out from the main hw_params.  It's
rather large and unweildy and makes for a large function.  This
also better enables some of the following changes to the clock
tree access in the driver.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: SND_SOC_DAPM_MICBIAS is deprecated
b-ak [Wed, 9 Jan 2019 17:11:21 +0000 (22:41 +0530)]
ASoC: tlv320aic32x4: SND_SOC_DAPM_MICBIAS is deprecated

commit 04d979d7a7bac2f645cd827ea37e5ffa5b4e1f97 upstream.

SND_SOC_DAPM_MICBIAS is deprecated, replace it with SND_SOC_DAPM_SUPPLY.

MICBIAS voltage wasn't supplied to the microphone with the older
SND_SOC_DAPM_MICBIAS widget, hence the microphone wouldn't work.

This patch fixes the problem.

Signed-off-by: b-ak <anur.bhargav@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agooverlays: Add rv3028 to i2c-rtc
Phil Elwell [Thu, 28 Mar 2019 13:26:59 +0000 (13:26 +0000)]
overlays: Add rv3028 to i2c-rtc

See: https://github.com/raspberrypi/linux/issues/2912

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
5 years agoconfigs: Add RTC_DRV_RV3028=m
Phil Elwell [Thu, 28 Mar 2019 13:13:52 +0000 (13:13 +0000)]
configs: Add RTC_DRV_RV3028=m

See: https://github.com/raspberrypi/linux/issues/2912

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
5 years agortc: rv3028: add new driver
Alexandre Belloni [Tue, 12 Feb 2019 23:21:36 +0000 (00:21 +0100)]
rtc: rv3028: add new driver

upstream commit e6e7376cfd7b3f9b63de3a22792f64d9bfb2ab53.

Add a driver for the MicroCrystal RV-3028. It is a SMT Real-Time Clock
Module that incorporates an integrated CMOS circuit together with an XTAL.
It has an i2c interface.

The driver handles date/time, alarms, trickle charging, timestamping,
frequency offset correction, EEPROM and NVRAM.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
5 years agonvmem: add type attribute
Alexandre Belloni [Fri, 30 Nov 2018 11:53:20 +0000 (11:53 +0000)]
nvmem: add type attribute

commit 16688453661b6d5159be558a1f8c1f54463a420f upstream.

Add a type attribute so userspace is able to know how the data is stored as
this can help taking the correct decision when selecting which device to
use. This will also help program display the proper warnings when burning
fuses for example.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>