pwr: Wait for IPC_PWR_PHONE_PWR_UP to complete startup
authorPaul Kocialkowski <contact@paulk.fr>
Wed, 6 Mar 2013 18:45:12 +0000 (19:45 +0100)
committerPaul Kocialkowski <contact@paulk.fr>
Wed, 6 Mar 2013 18:45:12 +0000 (19:45 +0100)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
pwr.c
samsung-ril.c
samsung-ril.h

diff --git a/pwr.c b/pwr.c
index e4cf5a7..766390e 100644 (file)
--- a/pwr.c
+++ b/pwr.c
@@ -35,7 +35,7 @@ void ipc_pwr_phone_pwr_up(void)
        ril_data.state.radio_state = RADIO_STATE_OFF;
        ril_data.state.power_state = IPC_PWR_PHONE_STATE_LPM;
 
-       ril_request_unsolicited(RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, NULL, 0);
+       RIL_START_UNLOCK();
 }
 
 /**
index b10a624..f79022a 100644 (file)
@@ -759,5 +759,9 @@ end:
 
        RIL_UNLOCK();
 
+       // Wait for power up
+       RIL_START_LOCK();
+       RIL_START_LOCK();
+
        return &ril_ops;
 }
index 796c0ad..25f7539 100644 (file)
@@ -52,6 +52,8 @@
 
 #define RIL_LOCK() pthread_mutex_lock(&ril_data.mutex)
 #define RIL_UNLOCK() pthread_mutex_unlock(&ril_data.mutex)
+#define RIL_START_LOCK() pthread_mutex_lock(&ril_data.start_mutex)
+#define RIL_START_UNLOCK() pthread_mutex_unlock(&ril_data.start_mutex)
 #define RIL_CLIENT_LOCK(client) pthread_mutex_lock(&(client->mutex))
 #define RIL_CLIENT_UNLOCK(client) pthread_mutex_unlock(&(client->mutex))
 
@@ -200,6 +202,7 @@ struct ril_data {
        struct ril_client *srs_client;
 
        pthread_mutex_t mutex;
+       pthread_mutex_t start_mutex;
 };
 
 extern struct ril_data ril_data;