Merge "hal: Fix incorrect FM volume after reboot"
diff --git a/hal/audio_extn/fm.c b/hal/audio_extn/fm.c
index 53499b9..eeba404 100644
--- a/hal/audio_extn/fm.c
+++ b/hal/audio_extn/fm.c
@@ -50,7 +50,7 @@
struct pcm *fm_pcm_rx;
struct pcm *fm_pcm_tx;
bool is_fm_running;
- int fm_volume;
+ float fm_volume;
};
static struct fm_module fmmod = {
@@ -66,7 +66,7 @@
struct mixer_ctl *ctl;
const char *mixer_ctl_name = "Internal FM RX Volume";
- ALOGD("%s: entry", __func__);
+ ALOGV("%s: entry", __func__);
ALOGD("%s: (%f)\n", __func__, value);
if (value < 0.0) {
@@ -77,8 +77,7 @@
value = 1.0;
}
vol = lrint((value * 0x2000) + 0.5);
-
- fmmod.fm_volume = vol;
+ fmmod.fm_volume = value;
if (!fmmod.is_fm_running) {
ALOGV("%s: FM not active, ignoring set_fm_volume call", __func__);
@@ -92,9 +91,9 @@
__func__, mixer_ctl_name);
return -EINVAL;
}
- mixer_ctl_set_value(ctl, 0, fmmod.fm_volume);
+ mixer_ctl_set_value(ctl, 0, vol);
- ALOGD("%s: exit", __func__);
+ ALOGV("%s: exit", __func__);
return ret;
}