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

Commit 15dae809 authored by Mingming Yin's avatar Mingming Yin Committed by Alexy Joseph
Browse files

hal: send DTS HPX license to ADSP after ssr

Send DTS HPX license to ADSP after SSR.

Change-Id: I60ac2a2ab3f575e671bcd0af133755b2089526dc
parent 73e2e8bd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -292,6 +292,7 @@ void audio_extn_compr_cap_deinit();
#define audio_extn_dts_eagle_set_parameters(adev, parms)     (0)
#define audio_extn_dts_eagle_get_parameters(adev, query, reply) (0)
#define audio_extn_dts_eagle_fade(adev, fade_in, out) (0)
#define audio_extn_dts_eagle_send_lic()               (0)
#define audio_extn_dts_create_state_notifier_node(stream_out) (0)
#define audio_extn_dts_notify_playback_state(stream_out, has_video, sample_rate, \
                                    channels, is_playing) (0)
@@ -303,6 +304,7 @@ void audio_extn_dts_eagle_set_parameters(struct audio_device *adev,
int audio_extn_dts_eagle_get_parameters(const struct audio_device *adev,
                  struct str_parms *query, struct str_parms *reply);
int audio_extn_dts_eagle_fade(const struct audio_device *adev, bool fade_in, const struct stream_out *out);
void audio_extn_dts_eagle_send_lic();
void audio_extn_dts_create_state_notifier_node(int stream_out);
void audio_extn_dts_notify_playback_state(int stream_out, int has_video, int sample_rate,
                                  int channels, int is_playing);
+22 −0
Original line number Diff line number Diff line
@@ -190,6 +190,28 @@ int audio_extn_dts_eagle_fade(const struct audio_device *adev, bool fade_in, con
    return 0;
}

void audio_extn_dts_eagle_send_lic() {
    char prop[PROPERTY_VALUE_MAX] = {0};
    bool enabled;
    property_get("use.dts_eagle", prop, "0");
    enabled = !strncmp("true", prop, sizeof("true")) || atoi(prop);
    if (!enabled)
        return;
    int fd = open(DEVICE_NODE, O_RDWR);
    int index = 1;
    if (fd >= 0) {
        if (ioctl(fd, DTS_EAGLE_IOCTL_SEND_LICENSE, &index) < 0) {
            ALOGE("DTS_EAGLE_HAL: error sending license after adsp ssr");
        } else {
            ALOGD("DTS_EAGLE_HAL: sent license after adsp ssr");
        }
        close(fd);
    } else {
        ALOGE("DTS_EAGLE_HAL: error opening eagle");
    }
    return;
}

void audio_extn_dts_eagle_set_parameters(struct audio_device *adev, struct str_parms *parms) {
    int ret, val;
    char value[32] = { 0 }, prop[PROPERTY_VALUE_MAX];
+2 −0
Original line number Diff line number Diff line
@@ -3132,6 +3132,8 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
        } else if (strstr(snd_card_status, "ONLINE")) {
            ALOGD("Received sound card ONLINE status");
            set_snd_card_state(adev,SND_CARD_STATE_ONLINE);
            //send dts hpx license if enabled
            audio_extn_dts_eagle_send_lic();
        }
    }