diff options
author | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2013-04-13 12:33:40 +0000 |
---|---|---|
committer | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2013-04-13 12:33:40 +0000 |
commit | b85434c16ffe031270e6c8c62bd26fc46ddce37f (patch) | |
tree | d5a97bf3e72b8c40f670ee4d3fa4b0d7735d5ee8 /audio | |
parent | 02cb2585b1f0415e35623a284ef843ffedccd4ad (diff) | |
download | device_samsung_p3100-b85434c16ffe031270e6c8c62bd26fc46ddce37f.zip device_samsung_p3100-b85434c16ffe031270e6c8c62bd26fc46ddce37f.tar.gz device_samsung_p3100-b85434c16ffe031270e6c8c62bd26fc46ddce37f.tar.bz2 |
p31xx: add support for dock audio
Change-Id: I35363baf1d0ad4930bee049faf6e8ae25ad94211
Diffstat (limited to 'audio')
-rwxr-xr-x | audio/audio_hw.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 01f2b2b..60ad2cf 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -492,6 +492,7 @@ static void set_incall_device(struct espresso_audio_device *adev) device_type = SOUND_AUDIO_PATH_HANDSET; break; case AUDIO_DEVICE_OUT_SPEAKER: + case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET: case AUDIO_DEVICE_OUT_AUX_DIGITAL: case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: device_type = SOUND_AUDIO_PATH_SPEAKER; @@ -628,9 +629,18 @@ static void select_output_device(struct espresso_audio_device *adev) case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: ALOGD("%s: AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET", __func__); break; + case AUDIO_DEVICE_OUT_AUX_DIGITAL: + ALOGD("%s: AUDIO_DEVICE_OUT_AUX_DIGITAL", __func__); + break; case AUDIO_DEVICE_OUT_ALL_SCO: ALOGD("%s: AUDIO_DEVICE_OUT_ALL_SCO", __func__); break; + case AUDIO_DEVICE_OUT_USB_ACCESSORY: + ALOGD("%s: AUDIO_DEVICE_OUT_USB_ACCESSORY", __func__); + break; + case AUDIO_DEVICE_OUT_USB_DEVICE: + ALOGD("%s: AUDIO_DEVICE_OUT_USB_DEVICE", __func__); + break; default: ALOGD("%s: AUDIO_DEVICE_OUT_ALL", __func__); break; @@ -2427,17 +2437,21 @@ static int adev_open_output_stream(struct audio_hw_device *dev, struct espresso_stream_out *out; int ret; int output_type; + *stream_out = NULL; out = (struct espresso_stream_out *)calloc(1, sizeof(struct espresso_stream_out)); - if (!out) + if (!out) { + ALOGE("%s: out of memory!", __func__); return -ENOMEM; + } out->sup_channel_masks[0] = AUDIO_CHANNEL_OUT_STEREO; out->channel_mask = AUDIO_CHANNEL_OUT_STEREO; if (ladev->outputs[OUTPUT_DEEP_BUF] != NULL) { ret = -ENOSYS; + ALOGW("%s: output not available!", __func__); goto err_open; } output_type = OUTPUT_DEEP_BUF; @@ -2453,8 +2467,10 @@ static int adev_open_output_stream(struct audio_hw_device *dev, RESAMPLER_QUALITY_DEFAULT, NULL, &out->resampler); - if (ret != 0) + if (ret != 0) { + ALOGE("%s: error on resampler create!", __func__); goto err_open; + } out->stream.common.set_sample_rate = out_set_sample_rate; out->stream.common.get_channels = out_get_channels; @@ -2489,6 +2505,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev, return 0; err_open: + ALOGE("%s: error opening output stream", __func__); free(out); return ret; } @@ -2783,7 +2800,8 @@ static const struct { { AUDIO_DEVICE_OUT_SPEAKER, "speaker" }, { AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "headphone" }, { AUDIO_DEVICE_OUT_EARPIECE, "earpiece" }, - { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analog-dock" }, + { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "dock" }, + { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "dock" }, { AUDIO_DEVICE_OUT_ALL_SCO, "sco-out" }, { AUDIO_DEVICE_IN_BUILTIN_MIC, "builtin-mic" }, @@ -2993,7 +3011,7 @@ static int adev_open(const hw_module_t* module, const char* name, hw_device_t** device) { struct espresso_audio_device *adev; - int ret; + int i, ret; if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0) return -EINVAL; @@ -3040,6 +3058,10 @@ static int adev_open(const hw_module_t* module, const char* name, adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; select_devices(adev); + for (i = 0; i < OUTPUT_TOTAL; i++) { + adev->outputs[i] = NULL; + } + adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; adev->pcm_bt_dl = NULL; |