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

Commit 240ac657 authored by Ramjee Singh's avatar Ramjee Singh Committed by Pradosh Das
Browse files

hal: add FM_TUNER capture support

Add FM_TUNER as supported capture source and device.
Remove unused FM devices

Change-Id: I575125ca485d41b04e31d60f37619037329b0895
parent 716bd195
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -843,7 +843,10 @@ int start_input_stream(struct stream_in *in)
    struct audio_device *adev = in->dev;
    int snd_card_status = get_snd_card_state(adev);

    in->usecase = platform_update_usecase_from_source(in->source,in->usecase);
    int usecase = platform_update_usecase_from_source(in->source,in->usecase);
    if (get_usecase_from_list(adev, usecase) == NULL)
        in->usecase = usecase;

    ALOGD("%s: enter: stream(%p)usecase(%d: %s)",
          __func__, &in->stream, in->usecase, use_case_table[in->usecase]);

@@ -860,6 +863,12 @@ int start_input_stream(struct stream_in *in)
    else
        ALOGV("%s: usecase(%d)", __func__, in->usecase);

    if (get_usecase_from_list(adev, in->usecase) != NULL) {
        ALOGE("%s: use case assigned already in use, stream(%p)usecase(%d: %s)",
            __func__, &in->stream, in->usecase, use_case_table[in->usecase]);
        goto error_config;
    }

    in->pcm_device_id = platform_get_pcm_device_id(in->usecase, PCM_CAPTURE);
    if (in->pcm_device_id < 0) {
        ALOGE("%s: Could not find PCM device id for the usecase(%d)",
+3 −10
Original line number Diff line number Diff line
@@ -1428,11 +1428,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
                set_echo_reference(adev, true);
            }
        }
#ifdef FM_ENABLED
    } else if (source == AUDIO_SOURCE_FM_RX ||
               source == AUDIO_SOURCE_FM_RX_A2DP) {
    } else if (source == AUDIO_SOURCE_FM_TUNER) {
        snd_device = SND_DEVICE_IN_CAPTURE_FM;
#endif
    } else if (source == AUDIO_SOURCE_DEFAULT) {
        goto exit;
    }
@@ -1467,10 +1464,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
        } else if (in_device & AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET ||
                   in_device & AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET) {
            snd_device = SND_DEVICE_IN_USB_HEADSET_MIC;
#ifdef FM_ENABLED
        } else if (in_device & AUDIO_DEVICE_IN_FM_RX) {
        } else if (in_device & AUDIO_DEVICE_IN_FM_TUNER) {
            snd_device = SND_DEVICE_IN_CAPTURE_FM;
#endif
        } else {
            ALOGE("%s: Unknown input device(s) %#x", __func__, in_device);
            ALOGW("%s: Using default handset-mic", __func__);
@@ -1823,10 +1818,8 @@ int64_t platform_render_latency(audio_usecase_t usecase)
int platform_update_usecase_from_source(int source, int usecase)
{
    ALOGV("%s: input source :%d", __func__, source);
#ifdef FM_ENABLED
    if(source == AUDIO_SOURCE_FM_RX_A2DP)
    if(source == AUDIO_SOURCE_FM_TUNER)
        usecase = USECASE_AUDIO_RECORD_FM_VIRTUAL;
#endif
    return usecase;
}