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

Commit 270b7762 authored by jasmine cha's avatar jasmine cha Committed by Jasmine Cha
Browse files

audio: porting MAXXAUDIO

  - use effect module to monitor stream's volume
  - the control(maxxaudio) monitors active device and
    changed volume from HAL, and send audio calibration
    to acdb via acdb_loader.
  - support specific USB headset

  Enabled function:
  - LR channels swap
  - load external tuning table for volume preset feature

Bug: 74360112
Test: manual effect test, usb headset test
Change-Id: I9b35436d6abebcfa250beb4857dfa0be9248f2b5
parent c89321b3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -183,10 +183,16 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SND_MONITOR)), true)
    LOCAL_SRC_FILES += audio_extn/sndmonitor.c
endif


ifeq ($(strip $(AUDIO_FEATURE_ENABLED_USB_SERVICE_INTERVAL)), true)
    LOCAL_CFLAGS += -DUSB_SERVICE_INTERVAL_ENABLED
endif

ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MAXX_AUDIO)), true)
    LOCAL_CFLAGS += -DMAXXAUDIO_QDSP_ENABLED
    LOCAL_SRC_FILES += audio_extn/maxxaudio.c
endif

LOCAL_SHARED_LIBRARIES += libbase libhidlbase libhwbinder libutils android.hardware.power@1.2 liblog

LOCAL_SRC_FILES += audio_perf.cpp
+627 −0

File added.

Preview size limit exceeded, changes collapsed.

+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef MAXXAUDIO_H_
#define MAXXAUDIO_H_

#ifndef MAXXAUDIO_QDSP_ENABLED
#define audio_extn_ma_init(platform)                                      (0)
#define audio_extn_ma_deinit()                                            (0)
#define audio_extn_ma_set_state(adev, type, vol, active)                  (false)
#define audio_extn_ma_set_device(adev, usecase)                           (0)
#define audio_extn_ma_set_parameters(adev, param)                         (0)
#define audio_extn_ma_supported_usb()                                     (false)
#else
void audio_extn_ma_init(void *platform);
void audio_extn_ma_deinit();
bool audio_extn_ma_set_state(struct audio_device *adev, int stream_type, float vol, bool active);
void audio_extn_ma_set_device(struct audio_device *adev, struct audio_usecase *usecase);
void audio_extn_ma_set_parameters(struct audio_device *adev, struct str_parms *parms);
bool audio_extn_ma_supported_usb();
#endif /* MAXXAUDIO_QDSP_ENABLED */

#endif /* MAXXAUDIO_H_ */
+32 −1

File changed.

Preview size limit exceeded, changes collapsed.

+9 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include <sound/devdep_params.h>
#endif

#include "maxxaudio.h"
#include <resolv.h>

#define MIXER_XML_DEFAULT_PATH "mixer_paths.xml"
@@ -266,6 +267,7 @@ static const char * const device_table[SND_DEVICE_MAX] = {
    [SND_DEVICE_OUT_USB_HEADSET] = "usb-headset",
    [SND_DEVICE_OUT_VOICE_USB_HEADSET] = "usb-headset",
    [SND_DEVICE_OUT_USB_HEADPHONES] = "usb-headphones",
    [SND_DEVICE_OUT_USB_HEADSET_SPEC] = "usb-headset",
    [SND_DEVICE_OUT_VOICE_USB_HEADPHONES] = "usb-headphones",
    [SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET] = "speaker-and-usb-headphones",
    [SND_DEVICE_OUT_SPEAKER_SAFE_AND_USB_HEADSET] = "speaker-safe-and-usb-headphones",
@@ -382,6 +384,7 @@ static int acdb_device_table[SND_DEVICE_MAX] = {
    [SND_DEVICE_OUT_USB_HEADSET] = 45,
    [SND_DEVICE_OUT_VOICE_USB_HEADSET] = 45,
    [SND_DEVICE_OUT_USB_HEADPHONES] = 45,
    [SND_DEVICE_OUT_USB_HEADSET_SPEC] = 45,
    [SND_DEVICE_OUT_VOICE_USB_HEADPHONES] = 45,
    [SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET] = 14,
    [SND_DEVICE_OUT_SPEAKER_SAFE_AND_USB_HEADSET] = 14,
@@ -511,6 +514,7 @@ static const struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
    {TO_NAME_INDEX(SND_DEVICE_OUT_SPEAKER_SAFE_AND_USB_HEADSET)},
    {TO_NAME_INDEX(SND_DEVICE_OUT_SPEAKER_PROTECTED)},
    {TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED)},
    {TO_NAME_INDEX(SND_DEVICE_OUT_USB_HEADSET_SPEC)},

    /* in */
    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_MIC)},
@@ -1200,6 +1204,7 @@ static void set_platform_defaults(struct platform_data * my_data)
    backend_tag_table[SND_DEVICE_IN_USB_HEADSET_MIC_AEC] = strdup("usb-headset-mic");
    backend_tag_table[SND_DEVICE_OUT_BT_A2DP] = strdup("bt-a2dp");
    backend_tag_table[SND_DEVICE_OUT_SPEAKER_AND_BT_A2DP] = strdup("speaker-and-bt-a2dp");
    backend_tag_table[SND_DEVICE_OUT_USB_HEADSET_SPEC] = strdup("usb-headset");

    hw_interface_table[SND_DEVICE_OUT_HANDSET] = strdup("SLIMBUS_0_RX");
    hw_interface_table[SND_DEVICE_OUT_SPEAKER] = strdup("SLIMBUS_0_RX");
@@ -1233,6 +1238,7 @@ static void set_platform_defaults(struct platform_data * my_data)
    hw_interface_table[SND_DEVICE_OUT_VOICE_USB_HEADSET] = strdup("USB_AUDIO_RX");
    hw_interface_table[SND_DEVICE_OUT_USB_HEADPHONES] = strdup("USB_AUDIO_RX");
    hw_interface_table[SND_DEVICE_OUT_VOICE_USB_HEADPHONES] = strdup("USB_AUDIO_RX");
    hw_interface_table[SND_DEVICE_OUT_USB_HEADSET_SPEC] = strdup("USB_AUDIO_RX");
    hw_interface_table[SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET] = strdup("SLIMBUS_0_RX-and-USB_AUDIO_RX");
    hw_interface_table[SND_DEVICE_OUT_SPEAKER_SAFE_AND_USB_HEADSET] = strdup("SLIMBUS_0_RX-and-USB_AUDIO_RX");
    hw_interface_table[SND_DEVICE_OUT_VOICE_TX] = strdup("AFE_PCM_RX");
@@ -2718,7 +2724,9 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi
    } else if (devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
        snd_device = SND_DEVICE_OUT_HDMI ;
    } else if (audio_is_usb_out_device(devices)) {
        if (audio_extn_usb_is_capture_supported())
        if (audio_extn_ma_supported_usb())
            snd_device = SND_DEVICE_OUT_USB_HEADSET_SPEC;
        else if (audio_extn_usb_is_capture_supported())
            snd_device = SND_DEVICE_OUT_USB_HEADSET;
        else
            snd_device = SND_DEVICE_OUT_USB_HEADPHONES;
Loading