|
@@ -88,6 +88,7 @@ static const struct snd_pcm_hardware dummy_dma_hardware = {
|
|
|
static int qos_vote_status;
|
|
|
static bool lpi_pcm_logging_enable;
|
|
|
static bool vote_against_sleep_enable;
|
|
|
+static unsigned int vote_against_sleep_cnt;
|
|
|
|
|
|
static struct dev_pm_qos_request latency_pm_qos_req; /* pm_qos request */
|
|
|
static unsigned int qos_client_active_cnt;
|
|
@@ -171,6 +172,8 @@ int snd_card_notify_user(snd_card_status_t card_status)
|
|
|
{
|
|
|
snd_card_pdata->card_status = card_status;
|
|
|
sysfs_notify(&snd_card_pdata->snd_card_kobj, NULL, "card_state");
|
|
|
+ if (card_status == 0)
|
|
|
+ vote_against_sleep_cnt = 0;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -1082,10 +1085,24 @@ static int msm_vote_against_sleep_ctl_put(struct snd_kcontrol *kcontrol,
|
|
|
int ret = 0;
|
|
|
|
|
|
vote_against_sleep_enable = ucontrol->value.integer.value[0];
|
|
|
- pr_debug("%s: vote against sleep enable: %d", __func__,
|
|
|
- vote_against_sleep_enable);
|
|
|
+ pr_debug("%s: vote against sleep enable: %d sleep cnt: %d", __func__,
|
|
|
+ vote_against_sleep_enable, vote_against_sleep_cnt);
|
|
|
|
|
|
- ret = audio_prm_set_vote_against_sleep((uint8_t)vote_against_sleep_enable);
|
|
|
+ if (vote_against_sleep_enable) {
|
|
|
+ vote_against_sleep_cnt++;
|
|
|
+ if (vote_against_sleep_cnt == 1) {
|
|
|
+ ret = audio_prm_set_vote_against_sleep(1);
|
|
|
+ if (ret < 0) {
|
|
|
+ --vote_against_sleep_cnt;
|
|
|
+ pr_err("%s: failed to vote against sleep ret: %d\n", __func__, ret);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (vote_against_sleep_cnt == 1)
|
|
|
+ ret = audio_prm_set_vote_against_sleep(0);
|
|
|
+ if (vote_against_sleep_cnt > 0)
|
|
|
+ vote_against_sleep_cnt--;
|
|
|
+ }
|
|
|
|
|
|
pr_debug("%s: vote against sleep vote ret: %d\n", __func__, ret);
|
|
|
return ret;
|