hal: unload the modem image based on IS_ONLINE event

Timing issue is observed in which unvote of modem
from audio hal is called before the peripheral service
vote for the modem image causing modem image to unload.
Call unvote from audio hal based on the event
EVENT_PERIPH_IS_ONLINE

Change-Id: I9fbf249707b4e4abf0708937d423e5fc41eeb9d5
This commit is contained in:
Surendar karka 2016-12-08 16:31:03 +05:30 committed by Divya Narayanan Poojary
parent 913a250cf7
commit 0a97d5e768
1 changed files with 27 additions and 24 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014, 2017 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -40,10 +40,8 @@ static s_audio_subsys audio_ss;
int audio_extn_pm_vote(void)
{
int err, intfd, ret;
int ret;
enum pm_event subsys_state;
char halPropVal[PROPERTY_VALUE_MAX];
bool prop_unload_image = false;
bool pm_reg = false;
bool pm_supp = false;
@ -73,26 +71,6 @@ int audio_extn_pm_vote(void)
pm_reg == true) {
ALOGD("%s: Voting for subsystem power up", __func__);
pm_client_connect(audio_ss.pm_handle);
if (property_get("sys.audio.init", halPropVal, NULL)) {
prop_unload_image = !(strncmp("false", halPropVal, sizeof("false")));
}
/*
* adsp-loader loads modem/adsp image at boot up to play boot tone,
* before peripheral manager service is up. Once PM is up, vote to PM
* and unload the image to give control to PM to load/unload image
*/
if (prop_unload_image) {
intfd = open(BOOT_IMG_SYSFS_PATH, O_WRONLY);
if (intfd == -1) {
ALOGE("failed to open fd in write mode, %d", errno);
} else {
ALOGD("%s: write to sysfs to unload image", __func__);
err = write(intfd, UNLOAD_IMAGE, 1);
close(intfd);
property_set("sys.audio.init", "true");
}
}
}
return 0;
}
@ -122,6 +100,11 @@ void audio_extn_pm_set_parameters(struct str_parms *parms)
void audio_extn_pm_event_notifier(void *client_data, enum pm_event event)
{
int err, intfd;
char halPropVal[PROPERTY_VALUE_MAX];
bool prop_unload_image = false;
pm_client_event_acknowledge(audio_ss.pm_handle, event);
/* Closing and re-opening of session is done based on snd card status given
@ -142,6 +125,26 @@ void audio_extn_pm_event_notifier(void *client_data, enum pm_event event)
case EVENT_PERIPH_IS_ONLINE:
ALOGV("%s: %s is online", __func__, audio_ss.img_name);
if (property_get("sys.audio.init", halPropVal, NULL)) {
prop_unload_image = !(strncmp("false", halPropVal, sizeof("false")));
}
/*
* adsp-loader loads modem/adsp image at boot up to play boot tone,
* before peripheral manager service is up. Once PM is up, vote to PM
* and unload the image to give control to PM to load/unload image
*/
if (prop_unload_image) {
intfd = open(BOOT_IMG_SYSFS_PATH, O_WRONLY);
if (intfd == -1) {
ALOGE("failed to open fd in write mode, %d", errno);
} else {
ALOGD("%s: write to sysfs to unload image", __func__);
err = write(intfd, UNLOAD_IMAGE, 1);
close(intfd);
property_set("sys.audio.init", "true");
}
}
break;
default: