Created
June 24, 2015 13:01
-
-
Save invisiblek/e2878fea2dd51712f91f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/amplifier/audio_amplifier.c b/amplifier/audio_amplifier.c | |
index 9ce8d4a..8db75ef 100644 | |
--- a/amplifier/audio_amplifier.c | |
+++ b/amplifier/audio_amplifier.c | |
@@ -87,6 +87,14 @@ static int amp_output_stream_start(amplifier_device_t *device, | |
return 0; | |
} | |
+static int amp_output_stream_standby(UNUSED amplifier_device_t *device, | |
+ UNUSED struct audio_stream_out *stream) | |
+{ | |
+ tfa9887_set_mute(); | |
+ | |
+ return 0; | |
+} | |
+ | |
static int amp_dev_close(hw_device_t *device) | |
{ | |
m8_device_t *dev = (m8_device_t *) device; | |
@@ -124,7 +132,7 @@ static int amp_module_open(const hw_module_t *module, UNUSED const char *name, | |
m8_dev->amp_dev.set_mode = amp_set_mode; | |
m8_dev->amp_dev.output_stream_start = amp_output_stream_start; | |
m8_dev->amp_dev.input_stream_start = NULL; | |
- m8_dev->amp_dev.output_stream_standby = NULL; | |
+ m8_dev->amp_dev.output_stream_standby = amp_output_stream_standby; | |
m8_dev->amp_dev.input_stream_standby = NULL; | |
m8_dev->current_output_devices = SND_DEVICE_NONE; | |
diff --git a/amplifier/tfa9887.c b/amplifier/tfa9887.c | |
index 715ba35..b7ae63b 100644 | |
--- a/amplifier/tfa9887.c | |
+++ b/amplifier/tfa9887.c | |
@@ -1195,6 +1195,32 @@ static int tfa9887_lock(struct tfa9887_amp_t *amp, bool lock) | |
return rc; | |
} | |
+int tfa9887_set_mute() | |
+{ | |
+ int rc, i; | |
+ struct tfa9887_amp_t *amp = NULL; | |
+ | |
+ if (!amps) { | |
+ ALOGE("%s: TFA9887 not opened\n", __func__); | |
+ return -ENODEV; | |
+ } | |
+ | |
+ for (i = 0; i < AMP_MAX; i++) { | |
+ amp = &s[i]; | |
+ | |
+ rc = tfa9887_lock(amp, true); | |
+ if (rc) { | |
+ /* Try next amp */ | |
+ continue; | |
+ } | |
+ rc = tfa9887_mute(amp, TFA9887_MUTE_DIGITAL); | |
+// rc = tfa9887_mute(amp, TFA9887_MUTE_AMPLIFIER); | |
+ rc = tfa9887_lock(amp, false); | |
+ } | |
+ | |
+ return 0; | |
+} | |
+ | |
static int tfa9887_enable_dsp(struct tfa9887_amp_t *amp, bool enable) | |
{ | |
int rc; | |
diff --git a/amplifier/tfa9887.h b/amplifier/tfa9887.h | |
index 6252e03..9c576dc 100644 | |
--- a/amplifier/tfa9887.h | |
+++ b/amplifier/tfa9887.h | |
@@ -217,5 +217,6 @@ struct tfa9887_amp_t { | |
int tfa9887_open(void); | |
int tfa9887_set_mode(audio_mode_t mode); | |
int tfa9887_close(void); | |
+int tfa9887_set_mute(void); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment