summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-09-04 17:58:34 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-10 11:14:58 +0200
commita97962111e6710adb127bff28092236687b742c3 (patch)
treeb8c368603c8beabd8982624461438aab83b374b5 /drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
parent51002248a68f2d7e4fcd254c9ae726ab6f40c71e (diff)
downloadlinux-a97962111e6710adb127bff28092236687b742c3.tar.bz2
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>
Diffstat (limited to 'drivers/staging/vc04_services/bcm2835-audio/bcm2835.h')
-rw-r--r--drivers/staging/vc04_services/bcm2835-audio/bcm2835.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
index c0e7df4914ed..8ee25a837b08 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
@@ -74,6 +74,8 @@ enum {
// convert chip to alsa volume
#define chip2alsa(vol) -(((vol) * 100) >> 8)
+#define CHIP_MIN_VOLUME 26214 /* minimum level aka mute */
+
/* Some constants for values .. */
enum snd_bcm2835_route {
AUDIO_DEST_AUTO = 0,
@@ -102,7 +104,6 @@ struct bcm2835_chip {
struct bcm2835_alsa_stream *alsa_stream[MAX_SUBSTREAMS];
int volume;
- int old_volume; /* stores the volume value whist muted */
int dest;
int mute;
@@ -160,7 +161,7 @@ int bcm2835_audio_set_params(struct bcm2835_alsa_stream *alsa_stream,
int bcm2835_audio_setup(struct bcm2835_alsa_stream *alsa_stream);
int bcm2835_audio_start(struct bcm2835_alsa_stream *alsa_stream);
int bcm2835_audio_stop(struct bcm2835_alsa_stream *alsa_stream);
-int bcm2835_audio_set_ctls(struct bcm2835_chip *chip);
+int bcm2835_audio_set_ctls(struct bcm2835_alsa_stream *alsa_stream);
int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,
unsigned int count,
void *src);