History log of /linux-master/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
Revision Date Author Comments
# f936d818 14-Apr-2022 Adrien Thierry <athierry@redhat.com>

staging: bcm2835-audio: fix unnecessary space after cast

Fix issue reported by checkpatch:

CHECK: No space is necessary after a cast
FILE: drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c:240:

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220414181622.102049-4-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b526eb83 14-Apr-2022 Adrien Thierry <athierry@redhat.com>

staging: bcm2835-audio: fix line ending with '('

Fix issue reported by checkpatch:

CHECK: Lines should not end with a '('
FILE: drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c:85:

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220414181622.102049-3-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 001c6bb6 02-Apr-2021 Dom Cobley <popcornmix@gmail.com>

staging: bcm2835-pcm: Allow up to 8 channels and 192kHz data rate

The firmware driver can support this, so allow it to be selected
Increase the buffer sizes to handle the higher data rates.

Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1617373688-8715-1-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4964a430 05-Feb-2021 Juerg Haefliger <juerg.haefliger@canonical.com>

staging: bcm2835-audio: Replace unsafe strcpy() with strscpy()

Replace strcpy() with strscpy() in bcm2835-audio/bcm2835.c to prevent the
following when loading snd-bcm2835:

[ 58.480634] ------------[ cut here ]------------
[ 58.485321] kernel BUG at lib/string.c:1149!
[ 58.489650] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[ 58.495214] Modules linked in: snd_bcm2835(COE+) snd_pcm snd_timer snd dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua btsdio bluetooth ecdh_generic ecc bcm2835_v4l2(CE) bcm2835_codec(CE) brcmfmac bcm2835_isp(CE) bcm2835_mmal_vchiq(CE) brcmutil cfg80211 v4l2_mem2mem videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops raspberrypi_hwmon videobuf2_v4l2 videobuf2_common videodev bcm2835_gpiomem mc vc_sm_cma(CE) rpivid_mem uio_pdrv_genirq uio sch_fq_codel drm ip_tables x_tables autofs4 btrfs blake2b_generic raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor xor_neon raid6_pq libcrc32c raid1 raid0 multipath linear dwc2 roles spidev udc_core crct10dif_ce xhci_pci xhci_pci_renesas phy_generic aes_neon_bs aes_neon_blk crypto_simd cryptd
[ 58.563787] CPU: 3 PID: 1959 Comm: insmod Tainted: G C OE 5.11.0-1001-raspi #1
[ 58.572172] Hardware name: Raspberry Pi 4 Model B Rev 1.2 (DT)
[ 58.578086] pstate: 60400005 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[ 58.584178] pc : fortify_panic+0x20/0x24
[ 58.588161] lr : fortify_panic+0x20/0x24
[ 58.592136] sp : ffff800010a83990
[ 58.595491] x29: ffff800010a83990 x28: 0000000000000002
[ 58.600879] x27: ffffb0b07cb72928 x26: 0000000000000000
[ 58.606268] x25: ffff39e884973838 x24: ffffb0b07cb74190
[ 58.611655] x23: ffffb0b07cb72030 x22: 0000000000000000
[ 58.617042] x21: ffff39e884973014 x20: ffff39e88b793010
[ 58.622428] x19: ffffb0b07cb72670 x18: 0000000000000030
[ 58.627814] x17: 0000000000000000 x16: ffffb0b092ce2c1c
[ 58.633200] x15: ffff39e88b901500 x14: 0720072007200720
[ 58.638588] x13: 0720072007200720 x12: 0720072007200720
[ 58.643979] x11: ffffb0b0936cbdf0 x10: 00000000fffff000
[ 58.649366] x9 : ffffb0b09220cfa8 x8 : 0000000000000000
[ 58.654752] x7 : ffffb0b093673df0 x6 : ffffb0b09364e000
[ 58.660140] x5 : 0000000000000000 x4 : ffff39e93b7db948
[ 58.665526] x3 : ffff39e93b7ebcf0 x2 : 0000000000000000
[ 58.670913] x1 : 0000000000000000 x0 : 0000000000000022
[ 58.676299] Call trace:
[ 58.678775] fortify_panic+0x20/0x24
[ 58.682402] snd_bcm2835_alsa_probe+0x5b8/0x7d8 [snd_bcm2835]
[ 58.688247] platform_probe+0x74/0xe4
[ 58.691963] really_probe+0xf0/0x510
[ 58.695585] driver_probe_device+0xe0/0x100
[ 58.699826] device_driver_attach+0xcc/0xd4
[ 58.704068] __driver_attach+0xb0/0x17c
[ 58.707956] bus_for_each_dev+0x7c/0xd4
[ 58.711843] driver_attach+0x30/0x40
[ 58.715467] bus_add_driver+0x154/0x250
[ 58.719354] driver_register+0x84/0x140
[ 58.723242] __platform_driver_register+0x34/0x40
[ 58.728013] bcm2835_alsa_driver_init+0x30/0x1000 [snd_bcm2835]
[ 58.734024] do_one_initcall+0x54/0x300
[ 58.737914] do_init_module+0x60/0x280
[ 58.741719] load_module+0x680/0x770
[ 58.745344] __do_sys_finit_module+0xbc/0x130
[ 58.749761] __arm64_sys_finit_module+0x2c/0x40
[ 58.754356] el0_svc_common.constprop.0+0x88/0x220
[ 58.759216] do_el0_svc+0x30/0xa0
[ 58.762575] el0_svc+0x28/0x70
[ 58.765669] el0_sync_handler+0x1a4/0x1b0
[ 58.769732] el0_sync+0x178/0x180
[ 58.773095] Code: aa0003e1 91366040 910003fd 97ffee21 (d4210000)
[ 58.779275] ---[ end trace 29be5b17497bd898 ]---
[ 58.783955] note: insmod[1959] exited with preempt_count 1
[ 58.791921] ------------[ cut here ]------------

For the sake of it, replace all the other occurences of strcpy() under
bcm2835-audio/ as well.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Link: https://lore.kernel.org/r/20210205072502.10907-1-juergh@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 684ceb81 27-Jan-2021 Dylan Van Assche <me@dylanvanassche.be>

staging: vc4_services: bcm2835-audio: Add SNDRV_PCM_INFO_BATCH flag

Playing audio with PulseAudio and the bcm2835-pcm driver results
in distorted sound. Timer-based scheduling does not properly work
with bcm2835-pcm since configuring PulseAudio with tsched=0
avoids this problem.

Setting the SNDRV_PCM_INFO_BATCH flag prevents PulseAudio to use
timer-based scheduling by default. Settings this flag makes audio
works out of the box.

Based on: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7f2430cda819a9ecb1df5a0f3ef4f1c20db3f811

Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
Link: https://lore.kernel.org/r/20210127174348.10192-1-me@dylanvanassche.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4a585df3 13-Apr-2020 R Veera Kumar <vkor@vkten.in>

staging: vc04_services: bcm2835-audio: Make function arguments alignment match open parenthesis

Make function arguments alignment match open parenthesis.
Found using checkpatch.pl.

Signed-off-by: R Veera Kumar <vkor@vkten.in>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200413165905.6081-1-vkor@vkten.in
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# de7c18bd 10-Dec-2019 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Drop superfluous ioctl PCM ops

PCM core deals the empty ioctl field now as default.
Let's kill the redundant lines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191210141356.18074-5-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3ad10e57 10-Dec-2019 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Use managed buffer allocation

Clean up the driver with the new managed buffer allocation API.
The hw_params and hw_free callbacks became superfluous and dropped.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191210141356.18074-3-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2eed19b9 14-Sep-2019 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Fix draining behavior regression

The PCM draining behavior got broken since the recent refactoring, and
this turned out to be the incorrect expectation of the firmware
behavior regarding "draining". While I expected the "drain" flag at
the stop operation would do processing the queued samples, it seems
rather dropping the samples.

As a quick fix, just drop the SNDRV_PCM_INFO_DRAIN_TRIGGER flag, so
that the driver uses the normal PCM draining procedure. Also, put
some caution comment to the function for future readers not to fall
into the same pitfall.

Fixes: d7ca3a71545b ("staging: bcm2835-audio: Operate non-atomic PCM ops")
BugLink: https://github.com/raspberrypi/linux/issues/2983
Cc: stable@vger.kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20190914152405.7416-1-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 01c5c561 22-Oct-2018 Mike Brady <mikebrady@eircom.net>

staging: bcm2835-audio: interpolate audio delay

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>


# 07c986b9 17-Oct-2018 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: bcm2835-audio: reorder variable declarations & remove trivial comments

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>


# 08633dcb 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Simplify card object management

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>


# 8cc64ae7 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Simplify PCM creation helpers

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>


# bec95770 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Set SNDRV_PCM_INFO_SYNC_APPLPTR

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>


# fb16a383 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Use coherent device buffers

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>


# 435ba133 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Use standard error print helpers

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>


# d7ca3a71 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Operate non-atomic PCM ops

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>


# 66890d53 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Add 10ms period constraint

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>


# d446b78c 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Drop superfluous mutex lock during prepare

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>


# af6b7a37 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Drop debug messages in bcm2835-pcm.c

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>


# 947d7489 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Propagate parameter setup error

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>


# fda767b1 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Drop useless NULL check

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>


# af19edf7 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Drop unnecessary pcm indirect setup

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>


# 5d0be6da 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Use PCM runtime values instead

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>


# 50e4acab 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Kill unused spinlock

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>


# bf1ad3e0 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Fix incorrect draining handling

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>


# c5e7824b 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Drop useless running flag and check

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>


# aa45eeee 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Remove superfluous open flag

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>


# 626f28d5 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Remove redundant function calls

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>


# a9796211 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Fix mute controls, volume handling cleanup

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>


# 51002248 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Remove redundant substream mask checks

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>


# da85d3b1 04-Sep-2018 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Clean up mutex locks

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>


# 951c16bf 03-Mar-2018 Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>

staging: vc04_services: bcm2835-audio: Change to unsigned int *

Change 'unsigned *' to 'unsigned int *'. Issue found with checkpatch.

Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d3e3a2b5 03-Mar-2018 Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>

staging: vc04_services: bcm2835-audio Format multiline comment

Format multiline comment by moving '*/' to a new line. Issue found with
checkpatch.

Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0b444fb7 01-Mar-2018 Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>

staging: vc04_services: bcm2835-audio: Add blank line after declaration

Add blank line after declaration. Issue found with checkpatch.

Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f3ff723f 11-Jan-2018 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: vc04_services: bcm2835-audio: remove redundant license text

Now that the SPDX tag is in all
drivers/staging/vc04_services/bcm2835-audio/ files, that identifies the
license in a specific and legally-defined manner. So the extra GPL text
wording can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: <bcm-kernel-feedback-list@broadcom.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 598dce85 11-Jan-2018 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: vc04_services: bcm2835-audio: add SPDX identifiers

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Fix up the bcm2835-audio driver to have a proper SPDX identifier, based
on the license text in the file itself. The SPDX identifier is a
legally binding shorthand, which can be used instead of the full boiler
plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: <bcm-kernel-feedback-list@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7ab1197d 27-Sep-2017 Keerthi Reddy <keerthigd4990@gmail.com>

staging: vc04_services: please do not use multiple blank lines

Blank lines use up extra space in file and makes the file
larger. So do not use multiple blanklines

Signed-off-by: Keerthi Reddy <keerthigd4990@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8219760c 13-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

media: staging: bcm2835-audio: make snd_pcm_hardware const

Make these const as they are only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 044cb69a 13-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

staging: bcm2835-audio: make snd_pcm_hardware const

Make these const as they are only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a4400dfd 20-Jul-2017 Gustavo A. R. Silva <gustavo@embeddedor.com>

staging: bcm2835-audio: constify snd_pcm_ops structures

Check for snd_pcm_ops structures that are only stored in the ops field of
a snd_soc_platform_driver structure or passed as the third argument to
snd_pcm_set_ops. The corresponding field or parameter is declared const,
so snd_pcm_ops structures that have this property can be declared as
const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_pcm_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_platform_driver e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i;
expression e1, e2; position p;
@@
snd_pcm_set_ops(e1, e2, &i@p)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_pcm_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct snd_pcm_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9ce7b9cf 19-May-2017 Takashi Iwai <tiwai@suse.de>

staging: bcm2835-audio: Deliver indirect-PCM transfer error

Now that the indirect-PCM transfer helper gives back an error, we
should return the error from ack callbacks.

Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 951142c2 03-Apr-2017 Aishwarya Pant <aishpant@gmail.com>

staging: bcm2835-audio: remove unnecessary log messages

Remove unnecessary log messages in the driver which are just tracking
function entry and exits.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 325b5b6c 14-Mar-2017 Michael Zoran <mzoran@crowfest.net>

staging: bcm2835-audio: Add support for simultanous HDMI and Headphone audio

The firmware for the Raspberry PI already supports simultanous output
of audio through both the HDMI and the Headphone jack. The current
implementation of ALSA doesn't expose this well to user mode since
the firmware audio is represented as a single card.

A newer approach is taken here and a virtual card is created for each
output(HDMI, Headphones, and Traditional ALSA). The firmware has
the concept of channels or streams for which the number to use is
passed in the device tree. These streams are allocated to each of the
virtual cards.

As a side effect of this change, since each output is represented
independenly it's now very easy to use PulseAudio to control the
priorities of the outputs.

Testing:

Audacity and VLC were both loaded at the same time. Each application
was assigned to a different card. With this change I was able to play
different music files at the same time through the HDMI and Headphones
jacks and control the audio independently.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d01e6318 06-Mar-2017 Aishwarya Pant <aishpant@gmail.com>

staging: bcm2835-audio: remove unused semaphores

This patch removes unused semaphores alsa_stream->buffers_update_sem
and alsa_stream->control_sem from struct bcm2835_alsa_stream

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 15411ed5 26-Feb-2017 Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>

staging: bcm2835-audio: Fixed spacing around '&'

This was reported by checkpatch.pl

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ac3c5ec8 25-Feb-2017 Alexandru Jercaianu <alex.jercaianu@gmail.com>

Staging: bcm2835-audio: Removed redundant check

This was reported by checkpatch.pl

Signed-off-by: Alexandru Jercaianu <alex.jercaianu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 051420a9 27-Feb-2017 Michael Zoran <mzoran@crowfest.net>

staging: bcm2835-audio: Move driver under vc04_services

The bcm2835-audio driver is part of v04_services, so it makes
sense for it to be located under vc04_services to make
configuration clearer.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>