diff options
author | vivian,zhang <vivian.zhang@intel.com> | 2013-09-11 15:10:19 +0800 |
---|---|---|
committer | Zhang,Vivian <vivian.zhang@intel.com> | 2013-09-12 09:58:12 +0800 |
commit | 602dd7dfbeae35fd6e0981a6ae6584ab9280cffb (patch) | |
tree | 1eeca0aa34ddf8c98d4145a09965db0f1e6e8a33 | |
parent | 69dc06eb2bcde97d249f4912d3331b8b41969f81 (diff) | |
download | tel-plugin-vpc-602dd7dfbeae35fd6e0981a6ae6584ab9280cffb.tar.gz tel-plugin-vpc-602dd7dfbeae35fd6e0981a6ae6584ab9280cffb.tar.bz2 tel-plugin-vpc-602dd7dfbeae35fd6e0981a6ae6584ab9280cffb.zip |
Replace medfield_xx with vpc_xxx;
Remove enable and disable voice device workaround on vpc_init for
clovertrail platform
Change-Id: Ib3a8276247d65e13377b6c12261b270e8767fcff
-rw-r--r-- | include/vpc.h | 8 | ||||
-rw-r--r-- | src/desc-vpc.c | 8 | ||||
-rw-r--r-- | src/vpc.c | 34 |
3 files changed, 30 insertions, 20 deletions
diff --git a/include/vpc.h b/include/vpc.h index 206d3b8..c9a77a0 100644 --- a/include/vpc.h +++ b/include/vpc.h @@ -18,10 +18,10 @@ * */ -void medfield_init(void); -void medfield_cleanup(void); -void medfield_enable(int mode, unsigned int device); -void medfield_disable(void); +void vpc_init(void); +void vpc_cleanup(void); +void vpc_enable(int mode, unsigned int device); +void vpc_disable(void); typedef enum { MODE_NORMAL = 0, diff --git a/src/desc-vpc.c b/src/desc-vpc.c index 4fe8749..876361a 100644 --- a/src/desc-vpc.c +++ b/src/desc-vpc.c @@ -149,7 +149,7 @@ static enum tcore_hook_return on_hook_call_end(Server *s, return TCORE_HOOK_RETURN_CONTINUE; } - medfield_disable(); + vpc_disable(); /* amc disable */ // usleep(1000); /* Time to disable MSIC... */ @@ -188,7 +188,7 @@ static enum tcore_hook_return on_hook_set_sound_path(Server *s, dbg("sound_path->path <%d> devId <%d>",sound_path->path, devId); - medfield_enable(MODE_IN_CALL, devId); + vpc_enable(MODE_IN_CALL, devId); return TCORE_HOOK_RETURN_CONTINUE; } @@ -235,7 +235,7 @@ static gboolean on_init(TcorePlugin *p) if (p == NULL) return FALSE; - medfield_init(); + vpc_init(); s = tcore_plugin_ref_server(p); tcore_server_add_notification_hook(s, TNOTI_MODEM_POWER, @@ -260,7 +260,7 @@ static void on_unload(TcorePlugin *p) vconf_ignore_key_changed(VCONFKEY_PM_STATE, on_screen_status_changed); registered = FALSE; - medfield_cleanup(); + vpc_cleanup(); dbg("i'm unload"); } @@ -29,6 +29,7 @@ #include "vpc.h" #define PA_READY "/tmp/.pa_ready" +#define CARD_NUMBER 3 typedef enum { PROFILE_EARPIECE = 0, @@ -156,7 +157,7 @@ static const char *capture_name(int mode, uint32_t device) static void pcm_init(void) { - int card = snd_card_get_index("medfieldaudio"); + int card = snd_card_get_index("default"); dbg("Card index: %d\n", card); } @@ -595,10 +596,12 @@ err("Audience A1026 set profile failed"); } -void medfield_init(void) +void vpc_init(void) { int count = 0; + char *name = NULL; + int card = CARD_NUMBER; dbg(""); /* Check whether PA has implemented initialization, which make sure @@ -620,25 +623,32 @@ void medfield_init(void) usleep(50000); - /* Enable and disable voice device since otherwise it seems the - * first call stays silent */ - pcm_enable(MODE_IN_CALL, DEVICE_OUT_EARPIECE); - - usleep(100000); - - pcm_disable(); + /* Try to get card name from CARD_NUMBER. */ + snd_card_get_name(card , &name); + + if (name != NULL) { + dbg("Get card name: %s", name); + if (strcmp(name, "medfield_audio") == 0) { + /* Enable and disable voice device since otherwise it seems the + * first call stays silent on MFLD platform */ + pcm_enable(MODE_IN_CALL, DEVICE_OUT_EARPIECE); + usleep(100000); + pcm_disable(); + } + free(name); + } a1026_suspend(); } -void medfield_cleanup(void) +void vpc_cleanup(void) { pcm_disable(); enableBluetoothPort(FALSE); a1026_suspend(); } -void medfield_enable(int mode, uint32_t device) +void vpc_enable(int mode, uint32_t device) { dbg(""); a1026_wakeup(); @@ -651,7 +661,7 @@ void medfield_enable(int mode, uint32_t device) pcm_enable(mode, device); } -void medfield_disable(void) +void vpc_disable(void) { pcm_disable(); enableBluetoothPort(FALSE); |