hal: Adds support for alerts bus

- Adds snd device, acdb id, and
  usecase for new alerts output bus
- Sets alerts output bus to use
  pcm device 59 (MM31)
- Alerts bus will only be used
  by automotive

Change-Id: I8932dfb646d301eec2d830a560f98a194e1e59fb
This commit is contained in:
Susan Wang 2022-04-06 20:11:46 -04:00 committed by Gerrit - the friendly Code Review server
parent 260f137ecb
commit 117cf6f3e1
8 changed files with 35 additions and 0 deletions

View File

@ -1345,6 +1345,9 @@ int audio_extn_utils_get_license_params(const struct audio_device *adev, struct
#ifndef AUDIO_OUTPUT_FLAG_PHONE #ifndef AUDIO_OUTPUT_FLAG_PHONE
#define AUDIO_OUTPUT_FLAG_PHONE 0x800000 #define AUDIO_OUTPUT_FLAG_PHONE 0x800000
#endif #endif
#ifndef AUDIO_OUTPUT_FLAG_ALERTS
#define AUDIO_OUTPUT_FLAG_ALERTS 0x4000000
#endif
#ifndef AUDIO_OUTPUT_FLAG_FRONT_PASSENGER #ifndef AUDIO_OUTPUT_FLAG_FRONT_PASSENGER
#define AUDIO_OUTPUT_FLAG_FRONT_PASSENGER 0x1000000 #define AUDIO_OUTPUT_FLAG_FRONT_PASSENGER 0x1000000
#endif #endif

View File

@ -406,6 +406,13 @@ int auto_hal_open_output_stream(struct stream_out *out)
out->flags |= AUDIO_OUTPUT_FLAG_PHONE; out->flags |= AUDIO_OUTPUT_FLAG_PHONE;
out->volume_l = out->volume_r = MAX_VOLUME_GAIN; out->volume_l = out->volume_r = MAX_VOLUME_GAIN;
break; break;
case CAR_AUDIO_STREAM_ALERTS:
out->usecase = USECASE_AUDIO_PLAYBACK_ALERTS;
out->config = pcm_config_system;
if (out->flags == AUDIO_OUTPUT_FLAG_NONE)
out->flags |= AUDIO_OUTPUT_FLAG_ALERTS;
out->volume_l = out->volume_r = MAX_VOLUME_GAIN;
break;
case CAR_AUDIO_STREAM_FRONT_PASSENGER: case CAR_AUDIO_STREAM_FRONT_PASSENGER:
out->usecase = USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER; out->usecase = USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER;
out->config = pcm_config_system; out->config = pcm_config_system;
@ -464,6 +471,9 @@ snd_device_t auto_hal_get_snd_device_for_car_audio_stream(int car_audio_stream)
case CAR_AUDIO_STREAM_PHONE: case CAR_AUDIO_STREAM_PHONE:
snd_device = SND_DEVICE_OUT_BUS_PHN; snd_device = SND_DEVICE_OUT_BUS_PHN;
break; break;
case CAR_AUDIO_STREAM_ALERTS:
snd_device = SND_DEVICE_OUT_BUS_ALR;
break;
case CAR_AUDIO_STREAM_FRONT_PASSENGER: case CAR_AUDIO_STREAM_FRONT_PASSENGER:
snd_device = SND_DEVICE_OUT_BUS_PAX; snd_device = SND_DEVICE_OUT_BUS_PAX;
break; break;
@ -899,6 +909,9 @@ snd_device_t auto_hal_get_output_snd_device(struct audio_device *adev,
case CAR_AUDIO_STREAM_PHONE: case CAR_AUDIO_STREAM_PHONE:
snd_device = SND_DEVICE_OUT_BUS_PHN; snd_device = SND_DEVICE_OUT_BUS_PHN;
break; break;
case CAR_AUDIO_STREAM_ALERTS:
snd_device = SND_DEVICE_OUT_BUS_ALR;
break;
case CAR_AUDIO_STREAM_FRONT_PASSENGER: case CAR_AUDIO_STREAM_FRONT_PASSENGER:
snd_device = SND_DEVICE_OUT_BUS_PAX; snd_device = SND_DEVICE_OUT_BUS_PAX;
break; break;
@ -921,6 +934,9 @@ snd_device_t auto_hal_get_output_snd_device(struct audio_device *adev,
case USECASE_AUDIO_PLAYBACK_PHONE: case USECASE_AUDIO_PLAYBACK_PHONE:
snd_device = SND_DEVICE_OUT_BUS_PHN; snd_device = SND_DEVICE_OUT_BUS_PHN;
break; break;
case USECASE_AUDIO_PLAYBACK_ALERTS:
snd_device = SND_DEVICE_OUT_BUS_ALR;
break;
case USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER: case USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER:
snd_device = SND_DEVICE_OUT_BUS_PAX; snd_device = SND_DEVICE_OUT_BUS_PAX;
break; break;

View File

@ -64,6 +64,7 @@ static const audio_usecase_t bus_device_usecases[] = {
USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION, USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION,
USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE, USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE,
USECASE_AUDIO_PLAYBACK_PHONE, USECASE_AUDIO_PLAYBACK_PHONE,
USECASE_AUDIO_PLAYBACK_ALERTS,
USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER, USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER,
USECASE_AUDIO_PLAYBACK_REAR_SEAT, USECASE_AUDIO_PLAYBACK_REAR_SEAT,
USECASE_AUDIO_RECORD_BUS, USECASE_AUDIO_RECORD_BUS,

View File

@ -150,6 +150,7 @@ const struct string_to_enum s_flag_name_to_enum_table[] = {
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION), STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION),
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_NAV_GUIDANCE), STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_NAV_GUIDANCE),
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_PHONE), STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_PHONE),
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_ALERTS),
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_FRONT_PASSENGER), STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_FRONT_PASSENGER),
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_REAR_SEAT), STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_REAR_SEAT),
STRING_TO_ENUM(AUDIO_INPUT_FLAG_NONE), STRING_TO_ENUM(AUDIO_INPUT_FLAG_NONE),

View File

@ -426,6 +426,7 @@ const char * const use_case_table[AUDIO_USECASE_MAX] = {
[USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION] = "sys-notification-playback", [USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION] = "sys-notification-playback",
[USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE] = "nav-guidance-playback", [USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE] = "nav-guidance-playback",
[USECASE_AUDIO_PLAYBACK_PHONE] = "phone-playback", [USECASE_AUDIO_PLAYBACK_PHONE] = "phone-playback",
[USECASE_AUDIO_PLAYBACK_ALERTS] = "alerts-playback",
[USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER] = "front-passenger-playback", [USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER] = "front-passenger-playback",
[USECASE_AUDIO_PLAYBACK_REAR_SEAT] = "rear-seat-playback", [USECASE_AUDIO_PLAYBACK_REAR_SEAT] = "rear-seat-playback",
[USECASE_AUDIO_FM_TUNER_EXT] = "fm-tuner-ext", [USECASE_AUDIO_FM_TUNER_EXT] = "fm-tuner-ext",

View File

@ -262,6 +262,7 @@ enum {
USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION, USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION,
USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE, USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE,
USECASE_AUDIO_PLAYBACK_PHONE, USECASE_AUDIO_PLAYBACK_PHONE,
USECASE_AUDIO_PLAYBACK_ALERTS,
USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER, USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER,
USECASE_AUDIO_PLAYBACK_REAR_SEAT, USECASE_AUDIO_PLAYBACK_REAR_SEAT,
USECASE_AUDIO_RECORD_BUS, USECASE_AUDIO_RECORD_BUS,
@ -363,6 +364,7 @@ enum {
CAR_AUDIO_STREAM_NAV_GUIDANCE = 0x4, CAR_AUDIO_STREAM_NAV_GUIDANCE = 0x4,
CAR_AUDIO_STREAM_PHONE = 0x8, CAR_AUDIO_STREAM_PHONE = 0x8,
CAR_AUDIO_STREAM_IN_PRIMARY = 0x10, CAR_AUDIO_STREAM_IN_PRIMARY = 0x10,
CAR_AUDIO_STREAM_ALERTS = 0x20,
CAR_AUDIO_STREAM_FRONT_PASSENGER = 0x100, CAR_AUDIO_STREAM_FRONT_PASSENGER = 0x100,
CAR_AUDIO_STREAM_IN_FRONT_PASSENGER = 0x200, CAR_AUDIO_STREAM_IN_FRONT_PASSENGER = 0x200,
CAR_AUDIO_STREAM_REAR_SEAT = 0x10000, CAR_AUDIO_STREAM_REAR_SEAT = 0x10000,

8
hal/msm8974/platform.c Executable file → Normal file
View File

@ -529,6 +529,8 @@ static int pcm_device_table[AUDIO_USECASE_MAX][2] = {
NAV_GUIDANCE_PCM_DEVICE}, NAV_GUIDANCE_PCM_DEVICE},
[USECASE_AUDIO_PLAYBACK_PHONE] = {PHONE_PCM_DEVICE, [USECASE_AUDIO_PLAYBACK_PHONE] = {PHONE_PCM_DEVICE,
PHONE_PCM_DEVICE}, PHONE_PCM_DEVICE},
[USECASE_AUDIO_PLAYBACK_ALERTS] = {ALERTS_PCM_DEVICE,
ALERTS_PCM_DEVICE},
[USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER] = {FRONT_PASSENGER_PCM_DEVICE, [USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER] = {FRONT_PASSENGER_PCM_DEVICE,
FRONT_PASSENGER_PCM_DEVICE}, FRONT_PASSENGER_PCM_DEVICE},
[USECASE_AUDIO_PLAYBACK_REAR_SEAT] = {REAR_SEAT_PCM_DEVICE, [USECASE_AUDIO_PLAYBACK_REAR_SEAT] = {REAR_SEAT_PCM_DEVICE,
@ -648,6 +650,7 @@ static const char * const device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_OUT_BUS_SYS] = "bus-speaker", [SND_DEVICE_OUT_BUS_SYS] = "bus-speaker",
[SND_DEVICE_OUT_BUS_NAV] = "bus-speaker", [SND_DEVICE_OUT_BUS_NAV] = "bus-speaker",
[SND_DEVICE_OUT_BUS_PHN] = "bus-speaker", [SND_DEVICE_OUT_BUS_PHN] = "bus-speaker",
[SND_DEVICE_OUT_BUS_ALR] = "bus-speaker",
[SND_DEVICE_OUT_BUS_PAX] = "bus-speaker", [SND_DEVICE_OUT_BUS_PAX] = "bus-speaker",
[SND_DEVICE_OUT_BUS_RSE] = "bus-speaker", [SND_DEVICE_OUT_BUS_RSE] = "bus-speaker",
[SND_DEVICE_OUT_CALL_PROXY] = "call-proxy", [SND_DEVICE_OUT_CALL_PROXY] = "call-proxy",
@ -952,6 +955,7 @@ static int acdb_device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_OUT_BUS_SYS] = 60, [SND_DEVICE_OUT_BUS_SYS] = 60,
[SND_DEVICE_OUT_BUS_NAV] = 14, [SND_DEVICE_OUT_BUS_NAV] = 14,
[SND_DEVICE_OUT_BUS_PHN] = 94, [SND_DEVICE_OUT_BUS_PHN] = 94,
[SND_DEVICE_OUT_BUS_ALR] = 60,
[SND_DEVICE_OUT_BUS_PAX] = 60, [SND_DEVICE_OUT_BUS_PAX] = 60,
[SND_DEVICE_OUT_BUS_RSE] = 60, [SND_DEVICE_OUT_BUS_RSE] = 60,
[SND_DEVICE_OUT_CALL_PROXY] = 32, [SND_DEVICE_OUT_CALL_PROXY] = 32,
@ -1209,6 +1213,7 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
{TO_NAME_INDEX(SND_DEVICE_OUT_BUS_SYS)}, {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_SYS)},
{TO_NAME_INDEX(SND_DEVICE_OUT_BUS_NAV)}, {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_NAV)},
{TO_NAME_INDEX(SND_DEVICE_OUT_BUS_PHN)}, {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_PHN)},
{TO_NAME_INDEX(SND_DEVICE_OUT_BUS_ALR)},
{TO_NAME_INDEX(SND_DEVICE_OUT_BUS_PAX)}, {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_PAX)},
{TO_NAME_INDEX(SND_DEVICE_OUT_BUS_RSE)}, {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_RSE)},
{TO_NAME_INDEX(SND_DEVICE_OUT_CALL_PROXY)}, {TO_NAME_INDEX(SND_DEVICE_OUT_CALL_PROXY)},
@ -1436,6 +1441,7 @@ static struct name_to_index usecase_name_index[AUDIO_USECASE_MAX] = {
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION)}, {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE)}, {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_PHONE)}, {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_PHONE)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_ALERTS)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER)}, {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_REAR_SEAT)}, {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_REAR_SEAT)},
{TO_NAME_INDEX(USECASE_AUDIO_RECORD_VOIP_LOW_LATENCY)}, {TO_NAME_INDEX(USECASE_AUDIO_RECORD_VOIP_LOW_LATENCY)},
@ -2542,6 +2548,7 @@ static void set_platform_defaults(struct platform_data * my_data)
hw_interface_table[SND_DEVICE_OUT_BUS_SYS] = strdup("TERT_TDM_RX_0"); hw_interface_table[SND_DEVICE_OUT_BUS_SYS] = strdup("TERT_TDM_RX_0");
hw_interface_table[SND_DEVICE_OUT_BUS_NAV] = strdup("TERT_TDM_RX_1"); hw_interface_table[SND_DEVICE_OUT_BUS_NAV] = strdup("TERT_TDM_RX_1");
hw_interface_table[SND_DEVICE_OUT_BUS_PHN] = strdup("TERT_TDM_RX_2"); hw_interface_table[SND_DEVICE_OUT_BUS_PHN] = strdup("TERT_TDM_RX_2");
hw_interface_table[SND_DEVICE_OUT_BUS_ALR] = strdup("TERT_TDM_RX_0");
hw_interface_table[SND_DEVICE_OUT_BUS_PAX] = strdup("QUAT_TDM_RX_0"); hw_interface_table[SND_DEVICE_OUT_BUS_PAX] = strdup("QUAT_TDM_RX_0");
hw_interface_table[SND_DEVICE_OUT_BUS_RSE] = strdup("QUIN_TDM_RX_0"); hw_interface_table[SND_DEVICE_OUT_BUS_RSE] = strdup("QUIN_TDM_RX_0");
hw_interface_table[SND_DEVICE_OUT_CALL_PROXY] = strdup("CALL_PROXY_RX"); hw_interface_table[SND_DEVICE_OUT_CALL_PROXY] = strdup("CALL_PROXY_RX");
@ -9116,6 +9123,7 @@ int64_t platform_render_latency(struct stream_out *out)
case USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION: case USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION:
case USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER: case USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER:
case USECASE_AUDIO_PLAYBACK_PHONE: case USECASE_AUDIO_PLAYBACK_PHONE:
case USECASE_AUDIO_PLAYBACK_ALERTS:
delay = LOW_LATENCY_PLATFORM_DELAY; delay = LOW_LATENCY_PLATFORM_DELAY;
break; break;
case USECASE_AUDIO_PLAYBACK_OFFLOAD: case USECASE_AUDIO_PLAYBACK_OFFLOAD:

3
hal/msm8974/platform.h Executable file → Normal file
View File

@ -201,6 +201,7 @@ enum {
SND_DEVICE_OUT_BUS_SYS, SND_DEVICE_OUT_BUS_SYS,
SND_DEVICE_OUT_BUS_NAV, SND_DEVICE_OUT_BUS_NAV,
SND_DEVICE_OUT_BUS_PHN, SND_DEVICE_OUT_BUS_PHN,
SND_DEVICE_OUT_BUS_ALR,
SND_DEVICE_OUT_BUS_PAX, SND_DEVICE_OUT_BUS_PAX,
SND_DEVICE_OUT_BUS_RSE, SND_DEVICE_OUT_BUS_RSE,
SND_DEVICE_OUT_CALL_PROXY, SND_DEVICE_OUT_CALL_PROXY,
@ -493,6 +494,7 @@ enum {
#define MULTIMEDIA2_PCM_DEVICE 1 #define MULTIMEDIA2_PCM_DEVICE 1
#define MULTIMEDIA3_PCM_DEVICE 4 #define MULTIMEDIA3_PCM_DEVICE 4
#define MULTIMEDIA9_PCM_DEVICE 32 #define MULTIMEDIA9_PCM_DEVICE 32
#define MULTIMEDIA31_PCM_DEVICE 59
#define FM_PLAYBACK_PCM_DEVICE 5 #define FM_PLAYBACK_PCM_DEVICE 5
#define FM_CAPTURE_PCM_DEVICE 6 #define FM_CAPTURE_PCM_DEVICE 6
@ -726,6 +728,7 @@ enum {
#define SYS_NOTIFICATION_PCM_DEVICE 9 #define SYS_NOTIFICATION_PCM_DEVICE 9
#define NAV_GUIDANCE_PCM_DEVICE MULTIMEDIA2_PCM_DEVICE #define NAV_GUIDANCE_PCM_DEVICE MULTIMEDIA2_PCM_DEVICE
#define PHONE_PCM_DEVICE 12 #define PHONE_PCM_DEVICE 12
#define ALERTS_PCM_DEVICE MULTIMEDIA31_PCM_DEVICE
#define FRONT_PASSENGER_PCM_DEVICE 55 #define FRONT_PASSENGER_PCM_DEVICE 55
#define REAR_SEAT_PCM_DEVICE 54 #define REAR_SEAT_PCM_DEVICE 54