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

Commit 05dbcc5b authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "qahw: Add support for new stream APIs"

parents 79492b32 c03f31d9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ AM_CONDITIONAL([CUSTOM_STEREO], [test x$AUDIO_FEATURE_ENABLED_CUSTOM_STEREO = xt
AM_CONDITIONAL([RUN_KEEP_ALIVE_IN_ARM_FFV], [test x$AUDIO_FEATURE_ENABLED_KEEP_ALIVE_ARM_FFV = xtrue])
AM_CONDITIONAL([INSTANCE_ID], [test x$AUDIO_FEATURE_ENABLED_INSTANCE_ID = xtrue])
AM_CONDITIONAL([LL_AS_PRIMARY_OUTPUT], [test x$AUDIO_USE_LL_AS_PRIMARY_OUTPUT = xtrue])
AM_CONDITIONAL([QAHW_V1], [test x$AUDIO_FEATURE_ENABLED_QAHW_1_0 = xtrue])

AC_CONFIG_FILES([ \
        Makefile \
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@ if SVA_AUDIO_CONCURRENCY
AM_CFLAGS += -DSVA_AUDIO_CONC
endif

if QAHW_V1
AM_CFLAGS += -DQAHW_V1
endif

libqahwwrapper_la_CFLAGS  = $(AM_CFLAGS)
libqahwwrapper_la_CFLAGS += -include stddef.h
libqahwwrapper_la_CFLAGS += -Dstrlcpy=g_strlcpy $(GLIB_CFLAGS) -include glib.h
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG

AM_CONDITIONAL([SVA_AUDIO_CONCURRENCY],[test x$BOARD_SUPPORTS_SVA_AUDIO_CONCURRENCY = xtrue])
AM_CONDITIONAL([QAHW_V1], [test x$AUDIO_FEATURE_ENABLED_QAHW_1_0 = xtrue])
AC_ARG_WITH([glib],
      AC_HELP_STRING([--with-glib],
         [enable glib, Build against glib. Use this when building for HLOS systems which use glib]))
+4 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2011 The Android Open Source Project *
@@ -45,6 +45,9 @@ __BEGIN_DECLS
/* First generation of audio devices had version hardcoded to 0. all devices with
 * versions < 1.0 will be considered of first generation API.
 */
#if QAHW_V1
#define QAHW_MODULE_API_VERSION_1_0 QAHW_MAKE_API_VERSION(1, 0)
#endif
#define QAHW_MODULE_API_VERSION_0_0 QAHW_MAKE_API_VERSION(0, 0)

/* Minimal QTI audio HAL version supported by the audio framework */
+142 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <sys/cdefs.h>
#include <stdint.h>
#include <system/audio.h>

#ifndef QTI_AUDIO_HAL_DEFS_H
#define QTI_AUDIO_HAL_DEFS_H
@@ -171,6 +172,9 @@ __BEGIN_DECLS
#define QAHW_INPUT_FLAG_TIMESTAMP 0x80000000
#define QAHW_INPUT_FLAG_COMPRESS  0x40000000
#define QAHW_INPUT_FLAG_PASSTHROUGH 0x20000000
#define QAHW_OUTPUT_FLAG_INCALL_MUSIC 0x80000000
#define QAHW_AUDIO_FLAG_HPCM_TX 0x00020000
#define QAHW_AUDIO_FLAG_HPCM_RX 0x00040000

/* Query fm volume */
#define QAHW_PARAMETER_KEY_FM_VOLUME "fm_volume"
@@ -267,6 +271,14 @@ typedef struct {
    uint32_t reserved[64]; /*reserved for future */
} qahw_in_buffer_t;

typedef struct {
    void *buffer;    /* write buffer pointer */
    size_t size;          /* size of buffer */
    size_t offset;         /* offset in buffer from where valid byte starts */
    int64_t *timestamp;    /* timestmap */
    qahw_meta_data_flags_t flags; /* meta data flags */
} qahw_buffer_t;

#define MAX_SECTORS 8

struct qahw_source_tracking_param {
@@ -391,6 +403,42 @@ typedef struct qahw_license_params {
    char license[QAHW_LICENCE_STR_MAX_LENGTH + 1];
} qahw_license_params_t;

typedef struct qahw_dtmf_gen_params {
   bool enable;
   uint16_t low_freq;
   uint16_t high_freq;
   uint16_t gain;
} qahw_dtmf_gen_params_t;

enum {
    QAHW_TTY_MODE_OFF,
    QAHW_TTY_MODE_FULL,
    QAHW_TTY_MODE_VCO,
    QAHW_TTY_MODE_HCO,
    QAHW_TTY_MODE_MAX,
};

typedef struct qahw_tty_params {
   uint32_t mode;
} qahw_tty_params_t;

typedef enum {
    QAHW_HPCM_TAP_POINT_RX = 1,
    QAHW_HPCM_TAP_POINT_TX = 2,
    QAHW_HPCM_TAP_POINT_RX_TX = 3,
} qahw_hpcm_tap_point;

typedef enum {
    QAHW_HPCM_DIRECTION_OUT,
    QAHW_HPCM_DIRECTION_IN,
    QAHW_HPCM_DIRECTION_OUT_IN,
} qahw_hpcm_direction;

typedef struct qahw_hpcm_params {
   qahw_hpcm_tap_point tap_point;
   qahw_hpcm_direction direction;
} qahw_hpcm_params_t;

typedef union {
    struct qahw_source_tracking_param st_params;
    struct qahw_sound_focus_param sf_params;
@@ -406,6 +454,9 @@ typedef union {
    struct qahw_mix_matrix_params mix_matrix_params;
    struct qahw_license_params license_params;
    struct qahw_out_presentation_position_param pos_param;
    struct qahw_dtmf_gen_params dtmf_gen_params;
    struct qahw_tty_params tty_mode_params;
    struct qahw_hpcm_params hpcm_params;
} qahw_param_payload;

typedef enum {
@@ -426,6 +477,9 @@ typedef enum {
    QAHW_PARAM_CH_MIX_MATRIX_PARAMS,
    QAHW_PARAM_LICENSE_PARAMS,
    QAHW_PARAM_OUT_PRESENTATION_POSITION,
    QAHW_PARAM_DTMF_GEN,
    QAHW_PARAM_TTY_MODE,
    QAHW_PARAM_HPCM,
} qahw_param_id;

typedef union {
@@ -436,6 +490,94 @@ typedef enum {
    QAHW_PARAM_LOOPBACK_RENDER_WINDOW /* PARAM to set render window */
} qahw_loopback_param_id;

/** stream direction enumeration */
typedef enum {
    QAHW_STREAM_INPUT,
    QAHW_STREAM_OUTPUT,
    QAHW_STREAM_INPUT_OUTPUT,
} qahw_stream_direction;

/** stream types */
typedef enum {
    QAHW_STREAM_TYPE_INVALID,
    QAHW_AUDIO_PLAYBACK_LOW_LATENCY,      /**< low latency, higher power*/
    QAHW_AUDIO_PLAYBACK_DEEP_BUFFER,          /**< low power, higher latency*/
    QAHW_AUDIO_PLAYBACK_COMPRESSED,           /**< compresssed audio*/
    QAHW_AUDIO_PLAYBACK_VOIP,                 /**< pcm voip audio*/
    QAHW_AUDIO_PLAYBACK_VOICE_CALL_MUSIC,     /**< pcm voip audio*/

    QAHW_AUDIO_CAPTURE_LOW_LATENCY,           /**< low latency, higher power*/
    QAHW_AUDIO_CAPTURE_DEEP_BUFFER,           /**< low power, higher latency*/
    QAHW_AUDIO_CAPTURE_COMPRESSED,            /**< compresssed audio*/
    QAHW_AUDIO_CAPTURE_RAW,                   /**< pcm no post processing*/
    QAHW_AUDIO_CAPTURE_VOIP,                  /**< pcm voip audio*/
    QAHW_AUDIO_CAPTURE_VOICE_ACTIVATION,      /**< voice activation*/
    QAHW_AUDIO_CAPTURE_VOICE_CALL_RX,         /**< incall record, downlink */
    QAHW_AUDIO_CAPTURE_VOICE_CALL_TX,         /**< incall record, uplink */
    QAHW_AUDIO_CAPTURE_VOICE_CALL_RX_TX,      /**< incall record, uplink & Downlink */

    QAHW_VOICE_CALL,                          /**< voice call */

    QAHW_AUDIO_TRANSCODE,                     /**< audio transcode */
    QAHW_AUDIO_HOST_PCM_TX,
    QAHW_AUDIO_HOST_PCM_RX,
    QAHW_AUDIO_HOST_PCM_TX_RX,
    QAHW_AUDIO_STREAM_TYPE_MAX,
} qahw_audio_stream_type;

typedef uint32_t qahw_device_t;

/**< Key value pair to identify the topology of a usecase from default  */
struct qahw_modifier_kv  {
    uint32_t key;
    uint32_t value;
};

struct qahw_shared_attributes{
     audio_config_t config;
};
struct qahw_voice_attributes{
     audio_config_t config;
     const char *vsid;
};

struct qahw_audio_attributes{
    audio_config_t config;
};

typedef union {
    struct qahw_shared_attributes shared;
    struct qahw_voice_attributes voice;
    struct qahw_audio_attributes audio;
} qahw_stream_attributes_config;

struct qahw_stream_attributes {
     qahw_audio_stream_type type;
     qahw_stream_direction direction;
     qahw_stream_attributes_config attr;
};

typedef enum {
    QAHW_CHANNEL_L = 0, /*left channel*/
    QAHW_CHANNEL_R = 1, /*right channel*/
    QAHW_CHANNELS_MAX = 2, /*max number of supported streams*/
} qahw_channel_map;

struct qahw_channel_vol {
    qahw_channel_map channel;
    float vol;
};

struct qahw_volume_data {
    uint32_t num_of_channels;
    struct qahw_channel_vol *vol_pair;
};

struct qahw_mute_data {
    bool enable;
    qahw_stream_direction direction;
};

__END_DECLS

#endif  // QTI_AUDIO_HAL_DEFS_H
Loading