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

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

Merge "hal: add snd card status callback in auto hal for ssr"

parents 7aa36b35 d6f371d3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1224,6 +1224,7 @@ int audio_extn_utils_get_license_params(const struct audio_device *adev, struct
#define audio_extn_auto_hal_get_snd_device_for_car_audio_stream(out) (0)
#define audio_extn_auto_hal_get_audio_port(dev, config) (0)
#define audio_extn_auto_hal_set_audio_port_config(dev, config) (0)
#define audio_extn_auto_hal_set_parameters(adev, parms) (0)
#else
int32_t audio_extn_auto_hal_init(struct audio_device *adev);
void audio_extn_auto_hal_deinit(void);
@@ -1245,6 +1246,8 @@ int audio_extn_auto_hal_get_audio_port(struct audio_hw_device *dev,
                                struct audio_port *config);
int audio_extn_auto_hal_set_audio_port_config(struct audio_hw_device *dev,
                                const struct audio_port_config *config);
void audio_extn_auto_hal_set_parameters(struct audio_device *adev,
                                        struct str_parms *parms);
#endif

bool audio_extn_edid_is_supported_sr(edid_audio_info* info, int sr);
+26 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ struct hostless_config {

typedef struct auto_hal_module {
    struct audio_device *adev;
    card_status_t card_status;
    struct hostless_config hostless;
} auto_hal_module_t;

@@ -560,6 +561,31 @@ int audio_extn_auto_hal_set_audio_port_config(struct audio_hw_device *dev,
    return ret;
}

void audio_extn_auto_hal_set_parameters(struct audio_device *adev __unused,
                                        struct str_parms *parms)
{
    int ret = 0;
    char value[32]={0};

    ALOGV("%s: enter", __func__);

    ret = str_parms_get_str(parms, "SND_CARD_STATUS", value, sizeof(value));
    if (ret >= 0) {
        char *snd_card_status = value+2;
        ALOGV("%s: snd card status %s", __func__, snd_card_status);
        if (strstr(snd_card_status, "OFFLINE")) {
            auto_hal->card_status = CARD_STATUS_OFFLINE;
            audio_extn_auto_hal_disable_hostless();
        }
        else if (strstr(snd_card_status, "ONLINE")) {
            auto_hal->card_status = CARD_STATUS_ONLINE;
            audio_extn_auto_hal_enable_hostless();
        }
    }

    ALOGV("%s: exit", __func__);
}

int32_t audio_extn_auto_hal_init(struct audio_device *adev)
{
    int32_t ret = 0;
+1 −0
Original line number Diff line number Diff line
@@ -9272,6 +9272,7 @@ static void adev_snd_mon_cb(void *cookie, struct str_parms *parms)
            adev->card_status = status;
            platform_snd_card_update(adev->platform, status);
            audio_extn_fm_set_parameters(adev, parms);
            audio_extn_auto_hal_set_parameters(adev, parms);
        } else if (is_ext_device_status) {
            platform_set_parameters(adev->platform, parms);
        }