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

Commit 40459026 authored by Lakshman Chaluvaraju's avatar Lakshman Chaluvaraju Committed by Gerrit - the friendly Code Review server
Browse files

fm: Restore fm on Speaker

During fm plaback even though routing device is changed from WHP
to SPK on UI, fm continues to route through WHP on targets with
shared backend for WHP and SPK. This is due to APM unaware of
routing device is change to SPK and selects WHP to play LL touch
tones causes all active usecase on SPK to move to WHP and fm
routes through WHP.

Change is to handle this scenario by re-routing fm on SPK once
standby is received for LL touch tones.

Change-Id: Ia503d4c134a3679fc2a51e2f9b7b8343e7b7cd1e
parent 62633769
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1097,6 +1097,7 @@ void audio_extn_source_track_get_parameters(const struct audio_device *adev,
void audio_extn_fm_set_parameters(struct audio_device *adev,
                                   struct str_parms *parms);
void audio_extn_fm_get_parameters(struct str_parms *query, struct str_parms *reply);
void audio_extn_fm_route_on_selected_device(struct audio_device *adev, audio_devices_t device);

#ifndef APTX_DECODER_ENABLED
#define audio_extn_aptx_dec_set_license(adev); (0)
+20 −0
Original line number Diff line number Diff line
@@ -387,3 +387,23 @@ void fm_set_parameters(struct audio_device *adev,
exit:
    ALOGV("%s: exit", __func__);
}

void audio_extn_fm_route_on_selected_device(struct audio_device *adev, audio_devices_t device)
{
    struct listnode *node;
    struct audio_usecase *usecase;

    if (fmmod.is_fm_running) {
        list_for_each(node, &adev->usecase_list) {
            usecase = node_to_item(node, struct audio_usecase, list);
            if (usecase->id == USECASE_AUDIO_PLAYBACK_FM) {
                if (fmmod.fm_device != device) {
                    ALOGV("%s selected routing device %x current device %x"
                          "are different, reroute on selected device", __func__,
                          fmmod.fm_device, device);
                    select_devices(adev, usecase->id);
                }
            }
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -4198,6 +4198,8 @@ static int out_standby(struct audio_stream *stream)
        if (do_stop) {
            stop_output_stream(out);
        }
        // if fm is active route on selected device in UI
        audio_extn_fm_route_on_selected_device(adev, out->devices);
        pthread_mutex_unlock(&adev->lock);
    }
    pthread_mutex_unlock(&out->lock);