summaryrefslogtreecommitdiffstats
path: root/audio/audio_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/audio_hw.c')
-rw-r--r--[-rwxr-xr-x]audio/audio_hw.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index bbd849a..873f025 100755..100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -483,7 +483,7 @@ struct tuna_audio_device {
pthread_mutex_t lock; /* see note below on mutex acquisition order */
struct mixer *mixer;
struct mixer_ctls mixer_ctls;
- int mode;
+ audio_mode_t mode;
int devices;
struct pcm *pcm_modem_dl;
struct pcm *pcm_modem_ul;
@@ -616,7 +616,7 @@ static int set_route_by_array(struct mixer *mixer, struct route_setting *route,
static int start_call(struct tuna_audio_device *adev)
{
- LOGE("Opening modem PCMs");
+ ALOGE("Opening modem PCMs");
pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE;
@@ -624,7 +624,7 @@ static int start_call(struct tuna_audio_device *adev)
if (adev->pcm_modem_dl == NULL) {
adev->pcm_modem_dl = pcm_open(0, PORT_MODEM, PCM_OUT, &pcm_config_vx);
if (!pcm_is_ready(adev->pcm_modem_dl)) {
- LOGE("cannot open PCM modem DL stream: %s", pcm_get_error(adev->pcm_modem_dl));
+ ALOGE("cannot open PCM modem DL stream: %s", pcm_get_error(adev->pcm_modem_dl));
goto err_open_dl;
}
}
@@ -632,7 +632,7 @@ static int start_call(struct tuna_audio_device *adev)
if (adev->pcm_modem_ul == NULL) {
adev->pcm_modem_ul = pcm_open(0, PORT_MODEM, PCM_IN, &pcm_config_vx);
if (!pcm_is_ready(adev->pcm_modem_ul)) {
- LOGE("cannot open PCM modem UL stream: %s", pcm_get_error(adev->pcm_modem_ul));
+ ALOGE("cannot open PCM modem UL stream: %s", pcm_get_error(adev->pcm_modem_ul));
goto err_open_ul;
}
}
@@ -654,7 +654,7 @@ err_open_dl:
static void end_call(struct tuna_audio_device *adev)
{
- LOGE("Closing modem PCMs");
+ ALOGE("Closing modem PCMs");
pcm_stop(adev->pcm_modem_dl);
pcm_stop(adev->pcm_modem_ul);
@@ -876,7 +876,7 @@ static void force_all_standby(struct tuna_audio_device *adev)
static void select_mode(struct tuna_audio_device *adev)
{
if (adev->mode == AUDIO_MODE_IN_CALL) {
- LOGE("Entering IN_CALL state, in_call=%d", adev->in_call);
+ ALOGE("Entering IN_CALL state, in_call=%d", adev->in_call);
if (!adev->in_call) {
force_all_standby(adev);
/* force earpiece route for in call state if speaker is the
@@ -896,12 +896,11 @@ static void select_mode(struct tuna_audio_device *adev)
adev->devices &= ~AUDIO_DEVICE_OUT_SPEAKER;
select_output_device(adev);
start_call(adev);
- ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_START);
adev_set_voice_volume(&adev->hw_device, adev->voice_volume);
adev->in_call = 1;
}
} else {
- LOGE("Leaving IN_CALL state, in_call=%d, mode=%d",
+ ALOGE("Leaving IN_CALL state, in_call=%d, mode=%d",
adev->in_call, adev->mode);
if (adev->in_call) {
adev->in_call = 0;
@@ -1147,7 +1146,7 @@ static int start_output_stream(struct tuna_stream_out *out)
/* Close any PCMs that could not be opened properly and return an error */
for (i = 0; i < PCM_TOTAL; i++) {
if (out->pcm[i] && !pcm_is_ready(out->pcm[i])) {
- LOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm[i]));
+ ALOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm[i]));
pcm_close(out->pcm[i]);
out->pcm[i] = NULL;
success = false;
@@ -1166,7 +1165,7 @@ static int start_output_stream(struct tuna_stream_out *out)
return -ENOMEM;
}
-static int check_input_parameters(uint32_t sample_rate, int format, int channel_count)
+static int check_input_parameters(uint32_t sample_rate, audio_format_t format, int channel_count)
{
if (format != AUDIO_FORMAT_PCM_16_BIT)
return -EINVAL;
@@ -1191,7 +1190,7 @@ static int check_input_parameters(uint32_t sample_rate, int format, int channel_
return 0;
}
-static size_t get_input_buffer_size(uint32_t sample_rate, int format, int channel_count)
+static size_t get_input_buffer_size(uint32_t sample_rate, audio_format_t format, int channel_count)
{
size_t size;
size_t device_rate;
@@ -1281,7 +1280,7 @@ static int get_playback_delay(struct tuna_stream_out *out,
buffer->time_stamp.tv_sec = 0;
buffer->time_stamp.tv_nsec = 0;
buffer->delay_ns = 0;
- LOGV("get_playback_delay(): pcm_get_htimestamp error,"
+ ALOGV("get_playback_delay(): pcm_get_htimestamp error,"
"setting playbackTimestamp to 0");
return status;
}
@@ -1325,12 +1324,12 @@ static uint32_t out_get_channels(const struct audio_stream *stream)
return AUDIO_CHANNEL_OUT_STEREO;
}
-static int out_get_format(const struct audio_stream *stream)
+static audio_format_t out_get_format(const struct audio_stream *stream)
{
return AUDIO_FORMAT_PCM_16_BIT;
}
-static int out_set_format(struct audio_stream *stream, int format)
+static int out_set_format(struct audio_stream *stream, audio_format_t format)
{
return 0;
}
@@ -1642,7 +1641,7 @@ static int start_input_stream(struct tuna_stream_in *in)
/* this assumes routing is done previously */
in->pcm = pcm_open(0, PORT_MM2_UL, PCM_IN, &in->config);
if (!pcm_is_ready(in->pcm)) {
- LOGE("cannot open pcm_in driver: %s", pcm_get_error(in->pcm));
+ ALOGE("cannot open pcm_in driver: %s", pcm_get_error(in->pcm));
pcm_close(in->pcm);
adev->active_input = NULL;
return -ENOMEM;
@@ -1688,12 +1687,12 @@ static uint32_t in_get_channels(const struct audio_stream *stream)
}
}
-static int in_get_format(const struct audio_stream *stream)
+static audio_format_t in_get_format(const struct audio_stream *stream)
{
return AUDIO_FORMAT_PCM_16_BIT;
}
-static int in_set_format(struct audio_stream *stream, int format)
+static int in_set_format(struct audio_stream *stream, audio_format_t format)
{
return 0;
}
@@ -1814,7 +1813,7 @@ static void get_capture_delay(struct tuna_stream_in *in,
buffer->time_stamp.tv_sec = 0;
buffer->time_stamp.tv_nsec = 0;
buffer->delay_ns = 0;
- LOGW("read get_capture_delay(): pcm_htimestamp error");
+ ALOGW("read get_capture_delay(): pcm_htimestamp error");
return;
}
@@ -1835,7 +1834,7 @@ static void get_capture_delay(struct tuna_stream_in *in,
buffer->time_stamp = tstamp;
buffer->delay_ns = delay_ns;
- LOGV("get_capture_delay time_stamp = [%ld].[%ld], delay_ns: [%d],"
+ ALOGV("get_capture_delay time_stamp = [%ld].[%ld], delay_ns: [%d],"
" kernel_delay:[%ld], buf_delay:[%ld], rsmp_delay:[%ld], kernel_frames:[%d], "
"in->frames_in:[%d], in->proc_frames_in:[%d], frames:[%d]",
buffer->time_stamp.tv_sec , buffer->time_stamp.tv_nsec, buffer->delay_ns,
@@ -1849,7 +1848,7 @@ static int32_t update_echo_reference(struct tuna_stream_in *in, size_t frames)
struct echo_reference_buffer b;
b.delay_ns = 0;
- LOGV("update_echo_reference, frames = [%d], in->ref_frames_in = [%d], "
+ ALOGV("update_echo_reference, frames = [%d], in->ref_frames_in = [%d], "
"b.frame_count = [%d]",
frames, in->ref_frames_in, frames - in->ref_frames_in);
if (in->ref_frames_in < frames) {
@@ -1868,12 +1867,12 @@ static int32_t update_echo_reference(struct tuna_stream_in *in, size_t frames)
if (in->echo_reference->read(in->echo_reference, &b) == 0)
{
in->ref_frames_in += b.frame_count;
- LOGV("update_echo_reference: in->ref_frames_in:[%d], "
+ ALOGV("update_echo_reference: in->ref_frames_in:[%d], "
"in->ref_buf_size:[%d], frames:[%d], b.frame_count:[%d]",
in->ref_frames_in, in->ref_buf_size, frames, b.frame_count);
}
} else
- LOGW("update_echo_reference: NOT enough frames to read ref buffer");
+ ALOGW("update_echo_reference: NOT enough frames to read ref buffer");
return b.delay_ns;
}
@@ -1966,7 +1965,7 @@ static int get_next_buffer(struct resampler_buffer_provider *buffer_provider,
in->config.period_size *
audio_stream_frame_size(&in->stream.common));
if (in->read_status != 0) {
- LOGE("get_next_buffer() pcm_read error %d", in->read_status);
+ ALOGE("get_next_buffer() pcm_read error %d", in->read_status);
buffer->raw = NULL;
buffer->frame_count = 0;
return in->read_status;
@@ -2055,7 +2054,7 @@ static ssize_t process_frames(struct tuna_stream_in *in, void* buffer, ssize_t f
in->proc_buf = (int16_t *)realloc(in->proc_buf,
in->proc_buf_size *
in->config.channels * sizeof(int16_t));
- LOGV("process_frames(): in->proc_buf %p size extended to %d frames",
+ ALOGV("process_frames(): in->proc_buf %p size extended to %d frames",
in->proc_buf, in->proc_buf_size);
}
frames_rd = read_frames(in,
@@ -2236,7 +2235,7 @@ exit:
static int adev_open_output_stream(struct audio_hw_device *dev,
- uint32_t devices, int *format,
+ uint32_t devices, audio_format_t *format,
uint32_t *channels, uint32_t *sample_rate,
struct audio_stream_out **stream_out)
{
@@ -2393,7 +2392,7 @@ static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
return -ENOSYS;
}
-static int adev_set_mode(struct audio_hw_device *dev, int mode)
+static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
{
struct tuna_audio_device *adev = (struct tuna_audio_device *)dev;
@@ -2426,7 +2425,7 @@ static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state)
}
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
- uint32_t sample_rate, int format,
+ uint32_t sample_rate, audio_format_t format,
int channel_count)
{
size_t size;
@@ -2438,7 +2437,7 @@ static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
}
static int adev_open_input_stream(struct audio_hw_device *dev, uint32_t devices,
- int *format, uint32_t *channel_mask,
+ audio_format_t *format, uint32_t *channel_mask,
uint32_t *sample_rate,
audio_in_acoustics_t acoustics,
struct audio_stream_in **stream_in)
@@ -2612,7 +2611,7 @@ static int adev_open(const hw_module_t* module, const char* name,
adev->mixer = mixer_open(0);
if (!adev->mixer) {
free(adev);
- LOGE("Unable to open the mixer, aborting.");
+ ALOGE("Unable to open the mixer, aborting.");
return -EINVAL;
}
@@ -2667,7 +2666,7 @@ static int adev_open(const hw_module_t* module, const char* name,
!adev->mixer_ctls.earpiece_volume) {
mixer_close(adev->mixer);
free(adev);
- LOGE("Unable to locate all mixer controls, aborting.");
+ ALOGE("Unable to locate all mixer controls, aborting.");
return -EINVAL;
}