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

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

Merge "hal: add support for dolby license validation"

parents d4fbf856 89ea3bd9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -211,8 +211,10 @@ void audio_extn_compr_cap_deinit();

#if defined(DS1_DOLBY_DDP_ENABLED) || defined(DS1_DOLBY_DAP_ENABLED)
void audio_extn_dolby_set_dmid(struct audio_device *adev);
void audio_extn_dolby_set_license(struct audio_device *adev);
#else
#define audio_extn_dolby_set_dmid(adev)                 (0)
#define audio_extn_dolby_set_license(adev)              (0)
#endif

#ifndef DS1_DOLBY_DDP_ENABLED
+34 −0
Original line number Diff line number Diff line
@@ -287,6 +287,15 @@ void audio_extn_ddp_set_parameters(struct audio_device *adev,
    int ddp_dev, dev_ch_cap;
    int val, ret;
    char value[32]={0};

    ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SND_CARD_STATUS, value,
                            sizeof(value));
    if (ret >= 0) {
        char *snd_card_status = value + 2;
        if (strncmp(snd_card_status, "ONLINE", sizeof("ONLINE")) == 0)
            audio_extn_dolby_set_license(adev);
    }

    ret = str_parms_get_str(parms, AUDIO_PARAMETER_DDP_DEV, value,
                            sizeof(value));
    if (ret >= 0) {
@@ -470,4 +479,29 @@ void audio_extn_dolby_set_dmid(struct audio_device *adev)

    return;
}

void audio_extn_dolby_set_license(struct audio_device *adev)
{
    int ret, key=0;
    char value[128] = {0};
    struct mixer_ctl *ctl;
    const char *mixer_ctl_name = "DS1 License";

    ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
    if (!ctl) {
        ALOGE("%s: Could not get ctl for mixer cmd - %s",
              __func__, mixer_ctl_name);
        return;
    }

    property_get("audio.ds1.metainfo.key",value,"0");
    key = atoi(value);

    ALOGV("%s Setting DS1 License, key:0x%x",__func__, key);
    ret = mixer_ctl_set_value(ctl, 0, key);
    if (ret)
        ALOGE("%s: cannot set license, error:%d",__func__, ret);

    return;
}
#endif /* DS1_DOLBY_DDP_ENABLED || DS1_DOLBY_DAP_ENABLED */
+3 −0
Original line number Diff line number Diff line
@@ -706,6 +706,9 @@ void *platform_init(struct audio_device *adev)
    /* Read one time ssr property */
    audio_extn_ssr_update_enabled();
    audio_extn_spkr_prot_init(adev);

    audio_extn_dolby_set_license(adev);

    return my_data;
}

+3 −0
Original line number Diff line number Diff line
@@ -785,6 +785,9 @@ void *platform_init(struct audio_device *adev)
    /* Read one time ssr property */
    audio_extn_ssr_update_enabled();
    audio_extn_spkr_prot_init(adev);

    audio_extn_dolby_set_license(adev);

    return my_data;
}