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

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

Merge "hal: avoid usage of extern functions and tables"

parents ee1a7564 263d80ca
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -61,7 +61,7 @@ typedef int snd_device_t;
 * Each usecase is mapped to a specific PCM device.
 * Each usecase is mapped to a specific PCM device.
 * Refer to pcm_device_table[].
 * Refer to pcm_device_table[].
 */
 */
typedef enum {
enum {
    USECASE_INVALID = -1,
    USECASE_INVALID = -1,
    /* Playback usecases */
    /* Playback usecases */
    USECASE_AUDIO_PLAYBACK_DEEP_BUFFER = 0,
    USECASE_AUDIO_PLAYBACK_DEEP_BUFFER = 0,
@@ -115,7 +115,9 @@ typedef enum {
    USECASE_AUDIO_SPKR_CALIB_RX,
    USECASE_AUDIO_SPKR_CALIB_RX,
    USECASE_AUDIO_SPKR_CALIB_TX,
    USECASE_AUDIO_SPKR_CALIB_TX,
    AUDIO_USECASE_MAX
    AUDIO_USECASE_MAX
} audio_usecase_t;
};

const char * const use_case_table[AUDIO_USECASE_MAX];


#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))


+5 −7
Original line number Original line Diff line number Diff line
@@ -41,8 +41,6 @@ struct pcm_config pcm_config_voice_call = {
    .format = PCM_FORMAT_S16_LE,
    .format = PCM_FORMAT_S16_LE,
};
};


extern const char * const use_case_table[AUDIO_USECASE_MAX];

static struct voice_session *voice_get_session_from_use_case(struct audio_device *adev,
static struct voice_session *voice_get_session_from_use_case(struct audio_device *adev,
                              audio_usecase_t usecase_id)
                              audio_usecase_t usecase_id)
{
{
@@ -57,7 +55,7 @@ static struct voice_session *voice_get_session_from_use_case(struct audio_device
    return session;
    return session;
}
}


int stop_call(struct audio_device *adev, audio_usecase_t usecase_id)
int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
{
{
    int i, ret = 0;
    int i, ret = 0;
    struct audio_usecase *uc_info;
    struct audio_usecase *uc_info;
@@ -108,7 +106,7 @@ int stop_call(struct audio_device *adev, audio_usecase_t usecase_id)
    return ret;
    return ret;
}
}


int start_call(struct audio_device *adev, audio_usecase_t usecase_id)
int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
{
{
    int i, ret = 0;
    int i, ret = 0;
    struct audio_usecase *uc_info;
    struct audio_usecase *uc_info;
@@ -195,7 +193,7 @@ int start_call(struct audio_device *adev, audio_usecase_t usecase_id)
    goto done;
    goto done;


error_start_voice:
error_start_voice:
    stop_call(adev, usecase_id);
    voice_stop_usecase(adev, usecase_id);


done:
done:
    ALOGD("%s: exit: status(%d)", __func__, ret);
    ALOGD("%s: exit: status(%d)", __func__, ret);
@@ -372,7 +370,7 @@ int voice_start_call(struct audio_device *adev)


    ret = voice_extn_start_call(adev);
    ret = voice_extn_start_call(adev);
    if (ret == -ENOSYS) {
    if (ret == -ENOSYS) {
        ret = start_call(adev, USECASE_VOICE_CALL);
        ret = voice_start_usecase(adev, USECASE_VOICE_CALL);
    }
    }
    adev->voice.in_call = true;
    adev->voice.in_call = true;


@@ -386,7 +384,7 @@ int voice_stop_call(struct audio_device *adev)
    adev->voice.in_call = false;
    adev->voice.in_call = false;
    ret = voice_extn_stop_call(adev);
    ret = voice_extn_stop_call(adev);
    if (ret == -ENOSYS) {
    if (ret == -ENOSYS) {
        ret = stop_call(adev, USECASE_VOICE_CALL);
        ret = voice_stop_usecase(adev, USECASE_VOICE_CALL);
    }
    }


    return ret;
    return ret;
+4 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ struct audio_device;
struct str_parms;
struct str_parms;
struct stream_in;
struct stream_in;
struct stream_out;
struct stream_out;
typedef int audio_usecase_t;


struct call_state {
struct call_state {
    int current;
    int current;
@@ -71,6 +72,9 @@ enum {
    INCALL_REC_UPLINK_AND_DOWNLINK,
    INCALL_REC_UPLINK_AND_DOWNLINK,
};
};


int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id);
int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id);

int voice_start_call(struct audio_device *adev);
int voice_start_call(struct audio_device *adev);
int voice_stop_call(struct audio_device *adev);
int voice_stop_call(struct audio_device *adev);
int voice_set_parameters(struct audio_device *adev, struct str_parms *parms);
int voice_set_parameters(struct audio_device *adev, struct str_parms *parms);
+4 −6
Original line number Original line Diff line number Diff line
@@ -71,8 +71,6 @@ struct pcm_config pcm_config_incall_music = {
    .avail_min = LOW_LATENCY_OUTPUT_PERIOD_SIZE / 4,
    .avail_min = LOW_LATENCY_OUTPUT_PERIOD_SIZE / 4,
};
};


extern int start_call(struct audio_device *adev, audio_usecase_t usecase_id);
extern int stop_call(struct audio_device *adev, audio_usecase_t usecase_id);
int voice_extn_is_call_state_active(struct audio_device *adev, bool *is_call_active);
int voice_extn_is_call_state_active(struct audio_device *adev, bool *is_call_active);


static bool is_valid_call_state(int call_state)
static bool is_valid_call_state(int call_state)
@@ -169,9 +167,9 @@ static int update_calls(struct audio_device *adev)
            {
            {
            case CALL_INACTIVE:
            case CALL_INACTIVE:
                ALOGD("%s: INACTIVE -> ACTIVE vsid:%x", __func__, session->vsid);
                ALOGD("%s: INACTIVE -> ACTIVE vsid:%x", __func__, session->vsid);
                ret = start_call(adev, usecase_id);
                ret = voice_start_usecase(adev, usecase_id);
                if(ret < 0) {
                if(ret < 0) {
                    ALOGE("%s: voice_start_call() failed for usecase: %d\n",
                    ALOGE("%s: voice_start_usecase() failed for usecase: %d\n",
                          __func__, usecase_id);
                          __func__, usecase_id);
                } else {
                } else {
                    session->state.current = session->state.new;
                    session->state.current = session->state.new;
@@ -207,9 +205,9 @@ static int update_calls(struct audio_device *adev)
            case CALL_HOLD:
            case CALL_HOLD:
            case CALL_LOCAL_HOLD:
            case CALL_LOCAL_HOLD:
                ALOGD("%s: ACTIVE/HOLD/LOCAL_HOLD -> INACTIVE vsid:%x", __func__, session->vsid);
                ALOGD("%s: ACTIVE/HOLD/LOCAL_HOLD -> INACTIVE vsid:%x", __func__, session->vsid);
                ret = stop_call(adev, usecase_id);
                ret = voice_stop_usecase(adev, usecase_id);
                if(ret < 0) {
                if(ret < 0) {
                    ALOGE("%s: voice_end_call() failed for usecase: %d\n",
                    ALOGE("%s: voice_stop_usecase() failed for usecase: %d\n",
                          __func__, usecase_id);
                          __func__, usecase_id);
                } else {
                } else {
                    session->state.current = session->state.new;
                    session->state.current = session->state.new;