staging: bcm2835-audio: Fix mute controls, volume handling cleanup
authorTakashi Iwai <tiwai@suse.de>
Tue, 4 Sep 2018 15:58:34 +0000 (17:58 +0200)
committerpopcornmix <popcornmix@gmail.com>
Mon, 13 May 2019 23:08:29 +0000 (00:08 +0100)
commitc59fc50182c15939ef319d0ba68e1aef07c8d477
tree7e0287cfe7c876156b9da26545653c13cecce5ba
parent7e9c2c6afb812d10444a8a1f1bd3f9150217998a
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>
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
drivers/staging/vc04_services/bcm2835-audio/bcm2835.h