Skip to content

Commit

Permalink
audio: fix ion buffer even though we don't use it
Browse files Browse the repository at this point in the history
  • Loading branch information
Daz Jones committed Jan 25, 2013
1 parent 6acc069 commit 18f592d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 8 deletions.
12 changes: 4 additions & 8 deletions audio/AudioHardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,9 @@ status_t AudioHardware::initCheck()
AudioStreamOut* AudioHardware::openOutputStream(uint32_t devices, int *format, uint32_t *channels,
uint32_t *sampleRate, status_t *status)
{
ALOGD("openOutputStream: devices = %u format = %x channels = %u sampleRate = %u\n",
devices, *format, *channels, *sampleRate);

audio_output_flags_t flags = static_cast<audio_output_flags_t> (*status);

ALOGD("openOutputStream: devices = %u format = %x channels = %u sampleRate = %u flags %x\n",
devices, *format, *channels, *sampleRate, flags);
{ // scope for the lock
status_t lStatus;
Mutex::Autolock lock(mLock);
Expand Down Expand Up @@ -3558,12 +3556,11 @@ status_t AudioHardware::AudioSessionOutLPA::openAudioSessionDevice( )
}

start();
//bufferAlloc();
bufferAlloc();

return status;
}

/*
void AudioHardware::AudioSessionOutLPA::bufferAlloc( )
{
// Allocate ION buffers
Expand Down Expand Up @@ -3712,7 +3709,6 @@ void AudioHardware::AudioSessionOutLPA::bufferDeAlloc()
ionfd = -1;
}
}
*/

uint32_t AudioHardware::AudioSessionOutLPA::latency() const
{
Expand Down Expand Up @@ -4002,7 +3998,7 @@ void AudioHardware::AudioSessionOutLPA::reset()
mIsDriverStarted = false;
requestAndWaitForEventThreadExit();
status_t status = NO_ERROR;
//bufferDeAlloc();
bufferDeAlloc();
::close(afd);
ALOGD("AudioSessionOutLPA::reset() complete");
}
Expand Down
62 changes: 62 additions & 0 deletions include/linux/msm_audio.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* include/linux/msm_audio.h
*
* Copyright (C) 2008 Google, Inc.
* Copyright (c) 2012 Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
Expand Down Expand Up @@ -63,6 +64,9 @@
unsigned short)
#define AUDIO_GET_BITSTREAM_ERROR_INFO _IOR(AUDIO_IOCTL_MAGIC, 42, \
struct msm_audio_bitstream_error_info)

#define AUDIO_SET_SRS_TRUMEDIA_PARAM _IOW(AUDIO_IOCTL_MAGIC, 43, unsigned)

/* Qualcomm extensions */
#define AUDIO_SET_STREAM_CONFIG _IOW(AUDIO_IOCTL_MAGIC, 80, \
struct msm_audio_stream_config)
Expand Down Expand Up @@ -90,6 +94,9 @@
#define AUDIO_GET_ACDB_BLK _IOW(AUDIO_IOCTL_MAGIC, 96, \
struct msm_acdb_cmd_device)

#define AUDIO_REGISTER_ION _IOW(AUDIO_IOCTL_MAGIC, 97, unsigned)
#define AUDIO_DEREGISTER_ION _IOW(AUDIO_IOCTL_MAGIC, 98, unsigned)

#define AUDIO_MAX_COMMON_IOCTL_NUM 100


Expand Down Expand Up @@ -129,6 +136,8 @@
#define IIR_ENABLE 0x0004
#define QCONCERT_PLUS_ENABLE 0x0008
#define MBADRC_ENABLE 0x0010
#define SRS_ENABLE 0x0020
#define SRS_DISABLE 0x0040

#define AGC_ENABLE 0x0001
#define NS_ENABLE 0x0002
Expand Down Expand Up @@ -166,6 +175,11 @@ struct msm_audio_stats {
uint32_t unused[2];
};

struct msm_audio_ion_info {
int fd;
void *vaddr;
};

struct msm_audio_pmem_info {
int fd;
void *vaddr;
Expand Down Expand Up @@ -208,6 +222,28 @@ struct msm_snd_device_config {

#define SND_SET_DEVICE _IOW(SND_IOCTL_MAGIC, 2, struct msm_device_config *)

enum cad_device_path_type {
CAD_DEVICE_PATH_RX, /*For Decoding session*/
CAD_DEVICE_PATH_TX, /* For Encoding session*/
CAD_DEVICE_PATH_RX_TX, /* For Voice call */
CAD_DEVICE_PATH_LB, /* For loopback (FM Analog)*/
CAD_DEVICE_PATH_MAX
};

struct cad_devices_type {
uint32_t rx_device;
uint32_t tx_device;
enum cad_device_path_type pathtype;
};

struct msm_cad_device_config {
struct cad_devices_type device;
uint32_t ear_mute;
uint32_t mic_mute;
};

#define CAD_SET_DEVICE _IOW(SND_IOCTL_MAGIC, 2, struct msm_cad_device_config *)

#define SND_METHOD_VOICE 0

struct msm_snd_volume_config {
Expand All @@ -218,6 +254,14 @@ struct msm_snd_volume_config {

#define SND_SET_VOLUME _IOW(SND_IOCTL_MAGIC, 3, struct msm_snd_volume_config *)

struct msm_cad_volume_config {
struct cad_devices_type device;
uint32_t method;
uint32_t volume;
};

#define CAD_SET_VOLUME _IOW(SND_IOCTL_MAGIC, 3, struct msm_cad_volume_config *)

/* Returns the number of SND endpoints supported. */

#define SND_GET_NUM_ENDPOINTS _IOR(SND_IOCTL_MAGIC, 4, unsigned *)
Expand All @@ -240,6 +284,24 @@ struct msm_snd_endpoint {
#define SND_AVC_CTL _IOW(SND_IOCTL_MAGIC, 6, unsigned *)
#define SND_AGC_CTL _IOW(SND_IOCTL_MAGIC, 7, unsigned *)

/*return the number of CAD endpoints supported. */

#define CAD_GET_NUM_ENDPOINTS _IOR(SND_IOCTL_MAGIC, 4, unsigned *)

struct msm_cad_endpoint {
int id; /* input and output */
char name[64]; /* output only */
};

/* Takes an index between 0 and one less than the number returned by
* SND_GET_NUM_ENDPOINTS, and returns the CAD index and name of a
* CAD endpoint. On input, the .id field contains the number of the
* endpoint, and on exit it contains the SND index, while .name contains
* the description of the endpoint.
*/

#define CAD_GET_ENDPOINT _IOWR(SND_IOCTL_MAGIC, 5, struct msm_cad_endpoint *)

struct msm_audio_pcm_config {
uint32_t pcm_feedback; /* 0 - disable > 0 - enable */
uint32_t buffer_count; /* Number of buffers to allocate */
Expand Down

0 comments on commit 18f592d

Please sign in to comment.