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

Commit 2804fa29 authored by Preetam Singh Ranawat's avatar Preetam Singh Ranawat
Browse files

hal : Overwrite the APP type for PCM RX and TX path

 -For all the rx/tx sessions hal sends the default app type 'general playback'
  with acdb cal data if output policy conf file is not added.So it sets the SA+
  topo id for POPP.
 -With output policy conf file it would create the
  multiple instance of COPP for different output with different app type,
  which is not recommended for resource constrained target.So we can not
  add the output policy conf file with different app types to avoid SA+
 -Overwrite the app type for PCM Rx and Tx path to avoid setting SA+ for POPP.

Change-Id: I1a3e0cbb01360e4d2e7b0ba0ecf8a1bee7fecda7
parent 858d316f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -552,13 +552,13 @@ void audio_extn_utils_send_audio_calibration(struct audio_device *adev,
        int snd_device = usecase->out_snd_device;
        snd_device = (snd_device == SND_DEVICE_OUT_SPEAKER) ?
                     audio_extn_get_spkr_prot_snd_device(snd_device) : snd_device;
        platform_send_audio_calibration(adev->platform, usecase->out_snd_device,
        platform_send_audio_calibration(adev->platform, usecase,
                                        out->app_type_cfg.app_type,
                                        out->app_type_cfg.sample_rate);
    }
    if ((type == PCM_HFP_CALL) || (type == PCM_CAPTURE)) {
        /* when app type is default. the sample rate is not used to send cal */
        platform_send_audio_calibration(adev->platform, usecase->in_snd_device,
        platform_send_audio_calibration(adev->platform, usecase,
                                        platform_get_default_app_type(adev->platform),
                                        48000);
    }
+26 −2
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@
#define AUDIO_PARAMETER_KEY_HD_VOICE      "hd_voice"
#define AUDIO_PARAMETER_KEY_VOLUME_BOOST  "volume_boost"
#define MAX_CAL_NAME 20
#define APP_TYPE_SYSTEM_SOUNDS 0x00011131
#define APP_TYPE_GENERAL_RECORDING 0x00011132

char cal_name_info[WCD9XXX_MAX_CAL][MAX_CAL_NAME] = {
        [WCD9XXX_ANC_CAL] = "anc_cal",
@@ -1169,13 +1171,35 @@ int platform_get_snd_device_acdb_id(snd_device_t snd_device)
    return acdb_device_table[snd_device];
}

int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
int platform_send_audio_calibration(void *platform, struct audio_usecase *usecase,
                                    int app_type, int sample_rate)
{
    struct platform_data *my_data = (struct platform_data *)platform;
    int acdb_dev_id, acdb_dev_type;

    struct audio_device *adev = my_data->adev;
    int snd_device = SND_DEVICE_OUT_SPEAKER;

    if (usecase->type == PCM_PLAYBACK)
        snd_device = platform_get_output_snd_device(adev->platform,
                                            usecase->stream.out->devices);
    else if ((usecase->type == PCM_HFP_CALL) || (usecase->type == PCM_CAPTURE))
        snd_device = platform_get_input_snd_device(adev->platform,
                                            adev->primary_output->devices);
    acdb_dev_id = acdb_device_table[snd_device];


    switch (usecase->id) {
        case USECASE_AUDIO_PLAYBACK_DEEP_BUFFER:
            app_type = APP_TYPE_SYSTEM_SOUNDS;
            break;
        case USECASE_AUDIO_PLAYBACK_LOW_LATENCY:
            app_type = APP_TYPE_SYSTEM_SOUNDS;
            break;
        case USECASE_AUDIO_RECORD:
            app_type = APP_TYPE_GENERAL_RECORDING;
            break;
    }

    if (acdb_dev_id < 0) {
        ALOGE("%s: Could not find acdb id for device(%d)",
              __func__, snd_device);
+10 −2
Original line number Diff line number Diff line
@@ -463,12 +463,20 @@ int platform_get_default_app_type(void *platform __unused)
    return -ENOSYS;
}

int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
int platform_send_audio_calibration(void *platform, struct audio_usecase *usecase,
                                    int app_type __unused, int sample_rate __unused)
{
    struct platform_data *my_data = (struct platform_data *)platform;
    int acdb_dev_id, acdb_dev_type;

    struct audio_device *adev = my_data->adev;
    int snd_device = SND_DEVICE_OUT_SPEAKER;

    if (usecase->type == PCM_PLAYBACK)
        snd_device = platform_get_output_snd_device(adev->platform,
                                            usecase->stream.out->devices);
    else if ((usecase->type == PCM_HFP_CALL) || (usecase->type == PCM_CAPTURE))
        snd_device = platform_get_input_snd_device(adev->platform,
                                            adev->primary_output->devices);
    acdb_dev_id = acdb_device_table[snd_device];
    if (acdb_dev_id < 0) {
        ALOGE("%s: Could not find acdb id for device(%d)",
+10 −2
Original line number Diff line number Diff line
@@ -1278,12 +1278,20 @@ int platform_get_snd_device_acdb_id(snd_device_t snd_device)
    return acdb_device_table[snd_device];
}

int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
int platform_send_audio_calibration(void *platform, struct audio_usecase *usecase,
                                    int app_type, int sample_rate)
{
    struct platform_data *my_data = (struct platform_data *)platform;
    int acdb_dev_id, acdb_dev_type;

    struct audio_device *adev = my_data->adev;
    int snd_device = SND_DEVICE_OUT_SPEAKER;

    if (usecase->type == PCM_PLAYBACK)
        snd_device = platform_get_output_snd_device(adev->platform,
                                            usecase->stream.out->devices);
    else if ((usecase->type == PCM_HFP_CALL) || (usecase->type == PCM_CAPTURE))
        snd_device = platform_get_input_snd_device(adev->platform,
                                            adev->primary_output->devices);
    acdb_dev_id = acdb_device_table[audio_extn_get_spkr_prot_snd_device(snd_device)];
    if (acdb_dev_id < 0) {
        ALOGE("%s: Could not find acdb id for device(%d)",
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ int platform_set_fluence_type(void *platform, char *value);
int platform_get_fluence_type(void *platform, char *value, uint32_t len);
int platform_set_snd_device_acdb_id(snd_device_t snd_device, unsigned int acdb_id);
int platform_get_snd_device_acdb_id(snd_device_t snd_device);
int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
int platform_send_audio_calibration(void *platform, struct audio_usecase *usecase,
                                    int app_type, int sample_rate);
int platform_get_default_app_type(void *platform);
int platform_switch_voice_call_device_pre(void *platform);