Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae8c42d9 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge 3751e3e2 on remote branch

Change-Id: I8f7a581b8312e9c1c4f259ac9da505911ae4df6d
parents 71f14240 3751e3e2
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -342,15 +342,15 @@
    <ctl name="ADC2 Volume" value="12" />
    <ctl name="ADC3 Volume" value="0" />
    <ctl name="ADC4 Volume" value="0" />
    <ctl name="DEC0 Volume" value="102" />
    <ctl name="DEC1 Volume" value="102" />
    <ctl name="DEC2 Volume" value="102" />
    <ctl name="DEC3 Volume" value="102" />
    <ctl name="DEC4 Volume" value="102" />
    <ctl name="DEC5 Volume" value="102" />
    <ctl name="DEC6 Volume" value="102" />
    <ctl name="DEC7 Volume" value="102" />
    <ctl name="DEC8 Volume" value="102" />
    <ctl name="DEC0 Volume" value="84" />
    <ctl name="DEC1 Volume" value="84" />
    <ctl name="DEC2 Volume" value="84" />
    <ctl name="DEC3 Volume" value="84" />
    <ctl name="DEC4 Volume" value="84" />
    <ctl name="DEC5 Volume" value="84" />
    <ctl name="DEC6 Volume" value="84" />
    <ctl name="DEC7 Volume" value="84" />
    <ctl name="DEC8 Volume" value="84" />

    <!-- Compander controls -->
    <ctl name="COMP1 Switch" value="1" />

configure.ac

100644 → 100755
+4 −0
Original line number Diff line number Diff line
@@ -81,6 +81,10 @@ if (test x$TARGET_SUPPORT = x8x96autogvmquintcu); then
         AC_SUBST([TARGET_PLATFORM], ["msm8974"])
         TARGET_CFLAGS="-DPLATFORM_MSM8996"
fi
if (test x$TARGET_SUPPORT = xsdmsteppe); then
         AC_SUBST([TARGET_PLATFORM], ["msm8974"])
         TARGET_CFLAGS="-DPLATFORM_MSMSTEPPE"
fi
AC_SUBST([TARGET_CFLAGS])

AM_CONDITIONAL([QTI_AUDIO_SERVER_ENABLED],[test x$BOARD_SUPPORTS_QTI_AUDIO_SERVER = xtrue])
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ AM_CFLAGS = -I ${WORKSPACE}/external/tinyalsa/include \
        -I $(top_srcdir)/hal \
        -I $(top_srcdir)/hal/audio_extn \
        -I $(top_srcdir)/hal/voice_extn \
        -I $(PKG_CONFIG_SYSROOT_DIR)/usr/include/audio-kernel \
        -I $(top_srcdir)/hal/${TARGET_PLATFORM}

c_sources = audio_hw.c \
+45 −8
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#define AUDIO_PARAMETER_KEY_REC_PLAY_CONC "rec_play_conc_on"
#define AUDIO_PARAMETER_KEY_FM_MUTE "fm_mute"
#define AUDIO_PARAMETER_KEY_FM_RESTORE_VOLUME "fm_restore_volume"
#define AUDIO_PARAMETER_KEY_FM_ROUTING "fm_routing"
#define FM_LOOPBACK_DRAIN_TIME_MS 2

static struct pcm_config pcm_config_fm = {
@@ -64,6 +65,7 @@ struct fm_module {
    bool is_fm_muted;
    float fm_volume;
    bool restart_fm;
    audio_devices_t fm_device;
    card_status_t card_status;
};

@@ -74,6 +76,7 @@ static struct fm_module fmmod = {
  .is_fm_running = 0,
  .is_fm_muted = 0,
  .restart_fm = 0,
  .fm_device = 0,
  .card_status = CARD_STATUS_ONLINE,
};

@@ -153,30 +156,46 @@ static int32_t fm_stop(struct audio_device *adev)
    disable_snd_device(adev, uc_info->in_snd_device);

    list_remove(&uc_info->list);
    free(uc_info->stream.out);
    free(uc_info);

    ALOGD("%s: exit: status(%d)", __func__, ret);
    return ret;
}

static int32_t fm_start(struct audio_device *adev)

static int32_t fm_start(struct audio_device *adev, audio_devices_t outputDevices)
{
    struct stream_out *fm_out;
    int32_t ret = 0;
    struct audio_usecase *uc_info;
    int32_t pcm_dev_rx_id, pcm_dev_tx_id;

    ALOGD("%s: enter", __func__);

    ALOGD("%s: Start FM over output device %d ", __func__, outputDevices);
    fmmod.is_fm_running = true;

    fm_out = (struct stream_out *)calloc(1, sizeof(struct stream_out));
    if (!fm_out)
        return -ENOMEM;

    fm_out->sample_rate = 48000;
    fm_out->format = AUDIO_FORMAT_PCM_16_BIT;
    fm_out->usecase = USECASE_AUDIO_PLAYBACK_FM;
    fm_out->config = pcm_config_fm;
    fm_out->devices = outputDevices;

    uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));

    if (!uc_info)
    if (!uc_info) {
        free(fm_out);
        return -ENOMEM;
    }

    uc_info->id = USECASE_AUDIO_PLAYBACK_FM;
    uc_info->type = PCM_PLAYBACK;
    uc_info->stream.out = adev->primary_output;
    uc_info->devices = adev->primary_output->devices;
    uc_info->stream.out = fm_out;
    uc_info->devices = outputDevices;
    uc_info->in_snd_device = SND_DEVICE_NONE;
    uc_info->out_snd_device = SND_DEVICE_NONE;

@@ -221,6 +240,9 @@ static int32_t fm_start(struct audio_device *adev)
    pcm_start(fmmod.fm_pcm_rx);
    pcm_start(fmmod.fm_pcm_tx);

    fmmod.fm_device = fm_out->devices;
    fm_set_volume(adev, fmmod.fm_volume, false);

    ALOGD("%s: exit: status(%d)", __func__, ret);
    return 0;

@@ -266,7 +288,7 @@ void audio_extn_fm_set_parameters(struct audio_device *adev,
    if (fmmod.restart_fm && (fmmod.card_status == CARD_STATUS_ONLINE)) {
        ALOGD("sound card is ONLINE, restart FM");
        fmmod.restart_fm = 0;
        fm_start(adev);
        fm_start(adev, fmmod.fm_device);
    }

    ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_HANDLE_FM,
@@ -277,8 +299,8 @@ void audio_extn_fm_set_parameters(struct audio_device *adev,
        if (val != 0) {
            if(val & AUDIO_DEVICE_OUT_FM
               && fmmod.is_fm_running == false) {
                adev->primary_output->devices = val & ~AUDIO_DEVICE_OUT_FM;
                fm_start(adev);
                audio_devices_t OutputDevice = val & ~AUDIO_DEVICE_OUT_FM;
                fm_start(adev, OutputDevice);
            } else if (!(val & AUDIO_DEVICE_OUT_FM)
                     && fmmod.is_fm_running == true) {
                fm_set_volume(adev, 0, false);
@@ -288,6 +310,21 @@ void audio_extn_fm_set_parameters(struct audio_device *adev,
       }
    }

    ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_FM_ROUTING,
                            value, sizeof(value));
    if (ret >= 0 && fmmod.is_fm_running) {
        val = atoi(value);
        ALOGD("%s: FM usecase", __func__);
        if (val != 0) {
            if(val & AUDIO_DEVICE_OUT_FM) {
                audio_devices_t OutputDevice = val & ~AUDIO_DEVICE_OUT_FM;
                fm_set_volume(adev, 0, false);
                fm_stop(adev);
                fm_start(adev, OutputDevice);
            }
        }
    }

    memset(value, 0, sizeof(value));
    ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_FM_VOLUME,
                            value, sizeof(value));
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ void audio_extn_keep_alive_init(struct audio_device *adev)
    ka.state = STATE_IDLE;
    ka.pcm = NULL;
    pthread_condattr_t attr;
    if (property_get_bool("vendor.audio.keep_alive.disabled", false)) {
    if (property_get_bool("vendor.audio.keep_alive.disabled", true)) {
        ALOGE("keep alive disabled");
        ka.state = STATE_DISABLED;
        return;
Loading