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

Commit df05eea6 authored by Derek Chen's avatar Derek Chen
Browse files

hal: add rear seat playback support for automotive

Add rear seat playback support for multi-zone
audio support on automotive platform.

Change-Id: Ia3d4c4a4f78950e99a8d4955e910cc8902b6bb17
parent 538f5d66
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1286,6 +1286,9 @@ int audio_extn_utils_get_license_params(const struct audio_device *adev, struct
#ifndef AUDIO_OUTPUT_FLAG_PHONE
#define AUDIO_OUTPUT_FLAG_PHONE 0x800000
#endif
#ifndef AUDIO_OUTPUT_FLAG_REAR_SEAT
#define AUDIO_OUTPUT_FLAG_REAR_SEAT 0x1000000
#endif
int audio_extn_auto_hal_init(struct audio_device *adev);
void audio_extn_auto_hal_deinit(void);
int audio_extn_auto_hal_create_audio_patch(struct audio_hw_device *dev,
+17 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ static const audio_usecase_t bus_device_usecases[] = {
    USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION,
    USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE,
    USECASE_AUDIO_PLAYBACK_PHONE,
    USECASE_AUDIO_PLAYBACK_REAR_SEAT,
};

int auto_hal_release_audio_patch(struct audio_hw_device *dev,
@@ -505,6 +506,19 @@ int auto_hal_open_output_stream(struct stream_out *out)
        if (out->flags == AUDIO_OUTPUT_FLAG_NONE)
            out->flags |= AUDIO_OUTPUT_FLAG_PHONE;
        break;
    case CAR_AUDIO_STREAM_REAR_SEAT:
        out->usecase = USECASE_AUDIO_PLAYBACK_REAR_SEAT;
        out->config = pcm_config_deep_buffer;
        out->config.period_size = fp_get_output_period_size(out->sample_rate, out->format,
                                        channels, DEEP_BUFFER_OUTPUT_PERIOD_DURATION);
        if (out->config.period_size <= 0) {
            ALOGE("Invalid configuration period size is not valid");
            ret = -EINVAL;
            goto error;
        }
        if (out->flags == AUDIO_OUTPUT_FLAG_NONE)
            out->flags |= AUDIO_OUTPUT_FLAG_REAR_SEAT;
        break;
    default:
        ALOGE("%s: Car audio stream %x not supported", __func__,
            out->car_audio_stream);
@@ -543,6 +557,9 @@ snd_device_t auto_hal_get_snd_device_for_car_audio_stream(struct stream_out *out
    case CAR_AUDIO_STREAM_PHONE:
        snd_device = SND_DEVICE_OUT_BUS_PHN;
        break;
    case CAR_AUDIO_STREAM_REAR_SEAT:
        snd_device = SND_DEVICE_OUT_BUS_RSE;
        break;
    default:
        ALOGE("%s: Unknown car audio stream (%x)",
            __func__, out->car_audio_stream);
+1 −0
Original line number Diff line number Diff line
@@ -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_NAV_GUIDANCE),
    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_PHONE),
    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_REAR_SEAT),
    STRING_TO_ENUM(AUDIO_INPUT_FLAG_NONE),
    STRING_TO_ENUM(AUDIO_INPUT_FLAG_FAST),
    STRING_TO_ENUM(AUDIO_INPUT_FLAG_HW_HOTWORD),
+2 −2
Original line number Diff line number Diff line
@@ -406,6 +406,7 @@ const char * const use_case_table[AUDIO_USECASE_MAX] = {
    [USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION] = "sys-notification-playback",
    [USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE] = "nav-guidance-playback",
    [USECASE_AUDIO_PLAYBACK_PHONE] = "phone-playback",
    [USECASE_AUDIO_PLAYBACK_REAR_SEAT] = "rear-seat-playback",
    [USECASE_AUDIO_FM_TUNER_EXT] = "fm-tuner-ext",
};

@@ -5140,8 +5141,7 @@ static int out_set_volume(struct audio_stream_out *stream, float left,
            mixer_ctl_set_array(ctl, volume, sizeof(volume)/sizeof(volume[0]));
            return 0;
        } else if ((out->devices & AUDIO_DEVICE_OUT_BUS) &&
                (audio_extn_auto_hal_get_snd_device_for_car_audio_stream(out) ==
                    SND_DEVICE_OUT_BUS_MEDIA)) {
                (out->car_audio_stream == CAR_AUDIO_STREAM_MEDIA)) {
            ALOGD("%s: Overriding offload set volume for media bus stream", __func__);
            struct listnode *node = NULL;
            list_for_each(node, &adev->active_outputs_list) {
+5 −3
Original line number Diff line number Diff line
@@ -227,6 +227,7 @@ enum {
    USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION,
    USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE,
    USECASE_AUDIO_PLAYBACK_PHONE,
    USECASE_AUDIO_PLAYBACK_REAR_SEAT,

    /*Audio FM Tuner usecase*/
    USECASE_AUDIO_FM_TUNER_EXT,
@@ -300,15 +301,16 @@ typedef enum render_mode {

/* This defines the physical car streams supported in audio HAL,
 * limited by the available frontend PCM driver.
 * Max number of physical streams supported is currently 8 and is
 * represented by stream bit flag as indicated in vehicle HAL interface.
 * Max number of physical streams supported is currently 16 and is
 * represented by stream bit flag.
 */
#define MAX_CAR_AUDIO_STREAMS    8
#define MAX_CAR_AUDIO_STREAMS    16
enum {
    CAR_AUDIO_STREAM_MEDIA            = 0x1,
    CAR_AUDIO_STREAM_SYS_NOTIFICATION = 0x2,
    CAR_AUDIO_STREAM_NAV_GUIDANCE     = 0x4,
    CAR_AUDIO_STREAM_PHONE            = 0x8,
    CAR_AUDIO_STREAM_REAR_SEAT        = 0x100,
};

struct stream_app_type_cfg {
Loading