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

Commit 6b914255 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: audio: port missing changes from master" into av-userspace.lnx.2.0-dev

parents da8ed307 167ade55
Loading
Loading
Loading
Loading
+0 −54
Original line number Diff line number Diff line
@@ -5203,60 +5203,6 @@ done:
    return ret;
}

 /*
 * This is a lookup table to map names of speaker device with respective left and right TZ names.
 * Also the tz names for a particular left or right speaker can be overriden by adding
 * corresponding entry in audio_platform_info.xml file.
 */
struct speaker_device_to_tz_names speaker_device_tz_names = {
    SND_DEVICE_OUT_SPEAKER, "", ""
};

const char *platform_get_spkr_1_tz_name(snd_device_t snd_device)
{
    if (snd_device >= SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX)
        return speaker_device_tz_names.spkr_1_tz_name;
    else
        return "";
}

const char *platform_get_spkr_2_tz_name(snd_device_t snd_device)
{
    if (snd_device >= SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX)
        return speaker_device_tz_names.spkr_2_tz_name;
    else
        return "";
}

int platform_set_spkr_device_tz_names(snd_device_t index,
                                      const char *spkr_1_tz_name, const char *spkr_2_tz_name)
{
    int ret = 0;

    if (spkr_1_tz_name == NULL && spkr_2_tz_name == NULL) {
        ALOGE("%s: Invalid input", __func__);
        ret = -EINVAL;
        goto done;
    }
    if (index != speaker_device_tz_names.snd_device) {
        ALOGE("%s: not matching speaker device\n", __func__);
        ret = -EINVAL;
        goto done;
    }
    ALOGD("%s: Enter, spkr_1_tz_name :%s, spkr_2_tz_name:%s",
            __func__, spkr_1_tz_name, spkr_2_tz_name);

    if (spkr_1_tz_name != NULL)
        strlcpy(speaker_device_tz_names.spkr_1_tz_name, spkr_1_tz_name,
                sizeof(speaker_device_tz_names.spkr_1_tz_name));

    if (spkr_2_tz_name != NULL)
        strlcpy(speaker_device_tz_names.spkr_2_tz_name, spkr_2_tz_name,
                sizeof(speaker_device_tz_names.spkr_2_tz_name));
done:
    return ret;
}

int platform_spkr_prot_is_wsa_analog_mode(void *adev)
{
    struct audio_device *adev_h = adev;
+0 −6
Original line number Diff line number Diff line
@@ -354,10 +354,4 @@ struct audio_device_to_audio_interface {
    char device_name[100];
    char interface_name[100];
};

struct speaker_device_to_tz_names {
    snd_device_t snd_device;
    char spkr_1_tz_name[100];
    char spkr_2_tz_name[100];
};
#endif // QCOM_AUDIO_PLATFORM_H
+2 −49
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ typedef enum {
    BACKEND_NAME,
    INTERFACE_NAME,
    CONFIG_PARAMS,
    TZ_NAME,
} section_t;

typedef void (* section_process_fn)(const XML_Char **attr);
@@ -60,7 +59,6 @@ static void process_pcm_id(const XML_Char **attr);
static void process_backend_name(const XML_Char **attr);
static void process_interface_name(const XML_Char **attr);
static void process_config_params(const XML_Char **attr);
static void process_tz_name(const XML_Char **attr);
static void process_root(const XML_Char **attr);

static section_process_fn section_table[] = {
@@ -71,7 +69,6 @@ static section_process_fn section_table[] = {
    [BACKEND_NAME] = process_backend_name,
    [INTERFACE_NAME] = process_interface_name,
    [CONFIG_PARAMS] = process_config_params,
    [TZ_NAME] = process_tz_name,
};

static section_t section;
@@ -110,12 +107,6 @@ static struct platform_info my_data;
 *      ...
 *      ...
 * </config_params>
 *
 * <tz_names>
 * <device name="???" spkr_1_tz_name="???" spkr_2_tz_name="???"/>
 * ...
 * ...
 * </tz_names>
 * </audio_platform_info>
 */

@@ -310,42 +301,6 @@ static void process_interface_name(const XML_Char **attr)
        goto done;
    }

done:
    return;
}
static void process_tz_name(const XML_Char **attr)
{
    int index;

    if (strcmp(attr[0], "name") != 0) {
        ALOGE("%s: 'name' not found, no Audio Interface set!", __func__);
        goto done;
    }

    index = platform_get_snd_device_index((char *)attr[1]);
    if (index < 0) {
        ALOGE("%s: Device %s not found, no snd device set!",
              __func__, attr[1]);
        goto done;
    }

    if (strcmp(attr[2], "spkr_1_tz_name") != 0) {
        ALOGE("%s: Device %s has no spkr_1_tz_name set!",
              __func__, attr[1]);
    }

    if (strcmp(attr[4], "spkr_2_tz_name") != 0) {
        ALOGE("%s: Device %s has no spkr_2_tz_name set!",
              __func__, attr[1]);
    }

    /*  ret = platform_set_spkr_device_tz_names(index, (char *)attr[3], (char *)attr[5]);
    if (ret < 0) {
        ALOGE("%s: Audio Interface not set!", __func__);
        goto done;
    }
    */

done:
    return;
}
@@ -382,12 +337,10 @@ static void start_tag(void *userdata __unused, const XML_Char *tag_name,
        section = CONFIG_PARAMS;
    } else if (strcmp(tag_name, "interface_names") == 0) {
        section = INTERFACE_NAME;
    } else if (strcmp(tag_name, "tz_names") == 0) {
        section = TZ_NAME;
    } else if (strcmp(tag_name, "device") == 0) {
        if ((section != ACDB) && (section != BACKEND_NAME) && (section != BITWIDTH) &&
            (section != INTERFACE_NAME) && (section != TZ_NAME)) {
            ALOGE("device tag only supported for acdb/backend names/bitwitdh/interface/tz names");
            (section != INTERFACE_NAME)) {
            ALOGE("device tag only supported for acdb/backend names/bitwitdh/interface names");
            return;
        }