htcleo: some improvements for audio
This commit is contained in:
parent
be652c8965
commit
0f32648604
@ -25,7 +25,7 @@
|
||||
|
||||
#define BUFSZ (0)
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
#define AUDIO_INFO(x...) pr_info("Audio: "x)
|
||||
#else
|
||||
#define AUDIO_INFO(x...) do{}while(0)
|
||||
@ -48,7 +48,7 @@ static int q6_voice_start(uint32_t rx_acdb_id, uint32_t tx_acdb_id)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
printk("VOICE START (%d %d)\n", rx_acdb_id, tx_acdb_id);
|
||||
AUDIO_INFO("VOICE START (%d %d)\n", rx_acdb_id, tx_acdb_id);
|
||||
mutex_lock(&voice_lock);
|
||||
|
||||
if (voice_started) {
|
||||
@ -82,12 +82,12 @@ static int q6_voice_stop(void)
|
||||
{
|
||||
mutex_lock(&voice_lock);
|
||||
global_now_phone_call = 0;
|
||||
if (voice_started)
|
||||
if (voice_started)
|
||||
{
|
||||
q6voice_close(voc_tx_clnt);
|
||||
q6voice_close(voc_rx_clnt);
|
||||
voice_started = 0;
|
||||
}
|
||||
voice_started = 0;
|
||||
}
|
||||
mutex_unlock(&voice_lock);
|
||||
return 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,22 +36,16 @@
|
||||
#define AUDIO_DAL_DEVICE 0x02000028
|
||||
#define AUDIO_DAL_PORT "DSP_DAL_AQ_AUD"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
#if defined(CONFIG_MACH_HTCLEO)
|
||||
AUDIO_OP_OPEN = DAL_OP_FIRST_DEVICE_API,
|
||||
AUDIO_OP_WRITE,
|
||||
AUDIO_OP_READ,
|
||||
AUDIO_OP_IOCTL,
|
||||
AUDIO_OP_INIT,
|
||||
AUDIO_OP_CLOSE,
|
||||
AUDIO_OP_FLUSH
|
||||
#else
|
||||
AUDIO_OP_CONTROL = DAL_OP_FIRST_DEVICE_API,
|
||||
AUDIO_OP_DATA,
|
||||
AUDIO_OP_INIT,
|
||||
|
||||
#endif
|
||||
AUDIO_OP_OPEN = DAL_OP_FIRST_DEVICE_API,
|
||||
AUDIO_OP_WRITE,
|
||||
AUDIO_OP_READ,
|
||||
AUDIO_OP_IOCTL,
|
||||
AUDIO_OP_INIT,
|
||||
AUDIO_OP_CLOSE,
|
||||
AUDIO_OP_FLUSH
|
||||
};
|
||||
|
||||
/* ---- common audio structures ---- */
|
||||
@ -84,14 +78,14 @@ enum
|
||||
#define ADSP_AUDIO_BUFFER_FLAG_CONTINUATION 0x40
|
||||
|
||||
struct adsp_audio_buffer {
|
||||
u32 addr; /* Physical Address of buffer */
|
||||
u32 max_size; /* Maximum size of buffer */
|
||||
u32 actual_size; /* Actual size of valid data in the buffer */
|
||||
u32 offset; /* Offset to the first valid byte */
|
||||
u32 flags; /* ADSP_AUDIO_BUFFER_FLAGs that has been set */
|
||||
s64 start; /* Start timestamp, if any */
|
||||
s64 stop; /* Stop timestamp, if any */
|
||||
s64 preroll; /* Preroll timestamp, if any */
|
||||
u32 addr; /* Physical Address of buffer */
|
||||
u32 max_size; /* Maximum size of buffer */
|
||||
u32 actual_size; /* Actual size of valid data in the buffer */
|
||||
u32 offset; /* Offset to the first valid byte */
|
||||
u32 flags; /* ADSP_AUDIO_BUFFER_FLAGs that has been set */
|
||||
s64 start; /* Start timestamp, if any */
|
||||
s64 stop; /* Stop timestamp, if any */
|
||||
s64 preroll; /* Preroll timestamp, if any */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
@ -102,31 +96,31 @@ struct adsp_audio_buffer {
|
||||
#define ADSP_AUDIO_RESPONSE_COMMAND 0
|
||||
#define ADSP_AUDIO_RESPONSE_ASYNC 1
|
||||
|
||||
#if !defined(CONFIG_MACH_HTCLEO)
|
||||
#if 0
|
||||
struct adsp_command_hdr {
|
||||
u32 size; /* sizeof(cmd) - sizeof(u32) */
|
||||
u32 size; /* sizeof(cmd) - sizeof(u32) */
|
||||
|
||||
u32 dst;
|
||||
u32 src;
|
||||
u32 dst;
|
||||
u32 src;
|
||||
|
||||
u32 opcode;
|
||||
u32 response_type;
|
||||
u32 seq_number;
|
||||
u32 opcode;
|
||||
u32 response_type;
|
||||
u32 seq_number;
|
||||
|
||||
u32 context; /* opaque to DSP */
|
||||
u32 data;
|
||||
u32 context; /* opaque to DSP */
|
||||
u32 data;
|
||||
|
||||
u32 padding;
|
||||
u32 padding;
|
||||
} __attribute__ ((packed));
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
struct adsp_command_hdr
|
||||
{
|
||||
u32 context;
|
||||
u32 data;
|
||||
u32 context;
|
||||
u32 data;
|
||||
} __attribute__ ((packed));
|
||||
#endif
|
||||
|
||||
|
||||
#define AUDIO_DOMAIN_APP 0
|
||||
#define AUDIO_DOMAIN_MODEM 1
|
||||
@ -147,8 +141,8 @@ struct adsp_command_hdr
|
||||
#define ADSP_AUDIO_ENC_ENHANCED_AAC_PLUS_MODE 2
|
||||
|
||||
struct adsp_audio_aac_enc_cfg {
|
||||
u32 bit_rate; /* bits per second */
|
||||
u32 encoder_mode; /* ADSP_AUDIO_ENC_* */
|
||||
u32 bit_rate; /* bits per second */
|
||||
u32 encoder_mode; /* ADSP_AUDIO_ENC_* */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define ADSP_AUDIO_ENC_SBC_ALLOCATION_METHOD_LOUNDNESS 0
|
||||
@ -160,11 +154,11 @@ struct adsp_audio_aac_enc_cfg {
|
||||
#define ADSP_AUDIO_ENC_SBC_CHANNEL_MODE_JOINT_STEREO 9
|
||||
|
||||
struct adsp_audio_sbc_encoder_cfg {
|
||||
u32 num_subbands;
|
||||
u32 block_len;
|
||||
u32 channel_mode;
|
||||
u32 allocation_method;
|
||||
u32 bit_rate;
|
||||
u32 num_subbands;
|
||||
u32 block_len;
|
||||
u32 channel_mode;
|
||||
u32 allocation_method;
|
||||
u32 bit_rate;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* AMR NB encoder modes */
|
||||
@ -185,27 +179,27 @@ struct adsp_audio_sbc_encoder_cfg {
|
||||
|
||||
/* AMR Encoder configuration */
|
||||
struct adsp_audio_amr_enc_cfg {
|
||||
u32 mode; /* ADSP_AUDIO_AMR_MR* */
|
||||
u32 dtx_mode; /* ADSP_AUDIO_AMR_DTX_MODE* */
|
||||
u32 enable; /* 1 = enable, 0 = disable */
|
||||
u32 mode; /* ADSP_AUDIO_AMR_MR* */
|
||||
u32 dtx_mode; /* ADSP_AUDIO_AMR_DTX_MODE* */
|
||||
u32 enable; /* 1 = enable, 0 = disable */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct adsp_audio_qcelp13k_enc_cfg {
|
||||
u16 min_rate;
|
||||
u16 max_rate;
|
||||
u16 min_rate;
|
||||
u16 max_rate;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct adsp_audio_evrc_enc_cfg {
|
||||
u16 min_rate;
|
||||
u16 max_rate;
|
||||
u16 min_rate;
|
||||
u16 max_rate;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
union adsp_audio_codec_config {
|
||||
struct adsp_audio_amr_enc_cfg amr;
|
||||
struct adsp_audio_aac_enc_cfg aac;
|
||||
struct adsp_audio_qcelp13k_enc_cfg qcelp13k;
|
||||
struct adsp_audio_evrc_enc_cfg evrc;
|
||||
struct adsp_audio_sbc_encoder_cfg sbc;
|
||||
struct adsp_audio_amr_enc_cfg amr;
|
||||
struct adsp_audio_aac_enc_cfg aac;
|
||||
struct adsp_audio_qcelp13k_enc_cfg qcelp13k;
|
||||
struct adsp_audio_evrc_enc_cfg evrc;
|
||||
struct adsp_audio_sbc_encoder_cfg sbc;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
@ -222,68 +216,61 @@ union adsp_audio_codec_config {
|
||||
/* This bit, if set, indicates that the sync clock is enabled */
|
||||
#define ADSP_AUDIO_OPEN_STREAM_MODE_ENABLE_SYNC_CLOCK 0x0004
|
||||
|
||||
#if !defined(CONFIG_MACH_HTCLEO)
|
||||
#if 0
|
||||
struct adsp_open_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
struct adsp_command_hdr hdr;
|
||||
|
||||
u32 device;
|
||||
u32 endpoint; /* address */
|
||||
u32 device;
|
||||
u32 endpoint; /* address */
|
||||
|
||||
u32 stream_context;
|
||||
u32 mode;
|
||||
u32 stream_context;
|
||||
u32 mode;
|
||||
|
||||
u32 buf_max_size;
|
||||
u32 buf_max_size;
|
||||
|
||||
union adsp_audio_format format;
|
||||
union adsp_audio_codec_config config;
|
||||
union adsp_audio_format format;
|
||||
union adsp_audio_codec_config config;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Opcode to open a device stream session to capture audio */
|
||||
#define ADSP_AUDIO_IOCTL_CMD_OPEN_READ 0x0108dd79
|
||||
|
||||
/* Opcode to open a device stream session to render audio */
|
||||
#define ADSP_AUDIO_IOCTL_CMD_OPEN_WRITE 0x0108dd7a
|
||||
|
||||
/* Opcode to open a device session, must open a device */
|
||||
#define ADSP_AUDIO_IOCTL_CMD_OPEN_DEVICE 0x0108dd7b
|
||||
|
||||
/* Close an existing stream or device */
|
||||
#define ADSP_AUDIO_IOCTL_CMD_CLOSE 0x0108d8bc
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
struct adsp_open_command
|
||||
{
|
||||
struct adsp_command_hdr hdr;
|
||||
|
||||
u32 opcode;
|
||||
u32 numdev;
|
||||
u32 dev[4];
|
||||
u32 stream_context;
|
||||
struct adsp_command_hdr hdr;
|
||||
|
||||
u32 opcode;
|
||||
u32 numdev;
|
||||
u32 dev[4];
|
||||
u32 stream_context;
|
||||
|
||||
u32 format;
|
||||
u32 pblock;
|
||||
u32 blocklen;
|
||||
u32 format;
|
||||
u32 pblock;
|
||||
u32 blocklen;
|
||||
|
||||
u32 buf_max_size;
|
||||
u32 priority;
|
||||
|
||||
u32 buf_max_size;
|
||||
u32 priority;
|
||||
|
||||
union adsp_audio_codec_config config;
|
||||
u32 mode;
|
||||
union adsp_audio_codec_config config;
|
||||
u32 mode;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* --- audio control and stream session ioctls ---- */
|
||||
|
||||
/* Opcode to open a device stream session to capture audio */
|
||||
#define ADSP_AUDIO_OPCODE_OPEN_READ 0x01
|
||||
//#define ADSP_AUDIO_IOCTL_CMD_OPEN_READ 0x0108dd79
|
||||
|
||||
/* Opcode to open a device stream session to render audio */
|
||||
#define ADSP_AUDIO_OPCODE_OPEN_WRITE 0x02
|
||||
//#define ADSP_AUDIO_IOCTL_CMD_OPEN_WRITE 0x0108dd7a
|
||||
|
||||
/* Opcode to open a device session, must open a device */
|
||||
#define ADSP_AUDIO_OPCODE_OPEN_DEV 0x04
|
||||
//#define ADSP_AUDIO_IOCTL_CMD_OPEN_DEVICE 0x0108dd7b
|
||||
|
||||
/* Close an existing stream or device */
|
||||
//#define ADSP_AUDIO_IOCTL_CMD_CLOSE 0x0108d8bc
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* A device switch requires three IOCTL */
|
||||
/* commands in the following sequence: PREPARE, STANDBY, COMMIT */
|
||||
@ -307,11 +294,11 @@ struct adsp_open_command
|
||||
#define ADSP_AUDIO_IOCTL_CMD_DEVICE_SWITCH_COMMIT 0x01075ee7
|
||||
|
||||
struct adsp_device_switch_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 old_device;
|
||||
u32 new_device;
|
||||
u8 device_class; /* 0 = i.rx, 1 = i.tx, 2 = e.rx, 3 = e.tx */
|
||||
u8 device_type; /* 0 = rx, 1 = tx, 2 = both */
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 old_device;
|
||||
u32 new_device;
|
||||
u8 device_class; /* 0 = i.rx, 1 = i.tx, 2 = e.rx, 3 = e.tx */
|
||||
u8 device_type; /* 0 = rx, 1 = tx, 2 = both */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
@ -330,10 +317,10 @@ struct adsp_device_switch_command {
|
||||
#define ADSP_AUDIO_IOCTL_CMD_SET_DEVICE_VOL 0x0107605c
|
||||
|
||||
struct adsp_set_dev_volume_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 device_id;
|
||||
u32 path; /* 0 = rx, 1 = tx, 2 = both */
|
||||
s32 volume;
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 device_id;
|
||||
u32 path; /* 0 = rx, 1 = tx, 2 = both */
|
||||
s32 volume;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Set Device stereo volume. This command has data payload, */
|
||||
@ -348,10 +335,10 @@ struct adsp_set_dev_volume_command {
|
||||
#define ADSP_AUDIO_IOCTL_CMD_SET_DEVICE_MUTE 0x0107605f
|
||||
|
||||
struct adsp_set_dev_mute_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 device_id;
|
||||
u32 path; /* 0 = rx, 1 = tx, 2 = both */
|
||||
u32 mute; /* 1 = mute */
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 device_id;
|
||||
u32 path; /* 0 = rx, 1 = tx, 2 = both */
|
||||
u32 mute; /* 1 = mute */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Configure Equalizer for a device. */
|
||||
@ -363,24 +350,24 @@ struct adsp_set_dev_mute_command {
|
||||
#define ADSP_AUDIO_IOCTL_SET_DEVICE_CONFIG 0x0108b6cb
|
||||
|
||||
struct adsp_set_dev_cfg_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 device_id;
|
||||
u32 block_id;
|
||||
u32 interface_id;
|
||||
u32 phys_addr;
|
||||
u32 phys_size;
|
||||
u32 phys_used;
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 device_id;
|
||||
u32 block_id;
|
||||
u32 interface_id;
|
||||
u32 phys_addr;
|
||||
u32 phys_size;
|
||||
u32 phys_used;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Set configuration data for all interfaces of a device. */
|
||||
#define ADSP_AUDIO_IOCTL_SET_DEVICE_CONFIG_TABLE 0x0108b6bf
|
||||
|
||||
struct adsp_set_dev_cfg_table_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 device_id;
|
||||
u32 phys_addr;
|
||||
u32 phys_size;
|
||||
u32 phys_used;
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 device_id;
|
||||
u32 phys_addr;
|
||||
u32 phys_size;
|
||||
u32 phys_used;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* ---- audio stream data commands ---- */
|
||||
@ -389,8 +376,8 @@ struct adsp_set_dev_cfg_table_command {
|
||||
#define ADSP_AUDIO_IOCTL_CMD_DATA_RX 0x0108dd80
|
||||
|
||||
struct adsp_buffer_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
struct adsp_audio_buffer buffer;
|
||||
struct adsp_command_hdr hdr;
|
||||
struct adsp_audio_buffer buffer;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
@ -487,18 +474,18 @@ struct adsp_buffer_command {
|
||||
|
||||
/* Definition for any one band of Equalizer. */
|
||||
struct adsp_audio_eq_band {
|
||||
u16 band_idx;
|
||||
u32 filter_type;
|
||||
u32 center_freq_hz;
|
||||
s32 filter_gain;
|
||||
s32 q_factor;
|
||||
u16 band_idx;
|
||||
u32 filter_type;
|
||||
u32 center_freq_hz;
|
||||
s32 filter_gain;
|
||||
s32 q_factor;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct adsp_audio_set_equalizer_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 enable;
|
||||
u32 num_bands;
|
||||
struct adsp_audio_eq_band eq_bands[ADSP_AUDIO_MAX_EQ_BANDS];
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 enable;
|
||||
u32 num_bands;
|
||||
struct adsp_audio_eq_band eq_bands[ADSP_AUDIO_MAX_EQ_BANDS];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
@ -514,13 +501,13 @@ struct adsp_audio_set_equalizer_command {
|
||||
/* these command structures are used for both STREAM and SESSION ioctls */
|
||||
|
||||
struct adsp_set_volume_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
s32 volume;
|
||||
struct adsp_command_hdr hdr;
|
||||
s32 volume;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct adsp_set_mute_command {
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 mute; /* 1 == mute */
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 mute; /* 1 == mute */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
@ -558,58 +545,58 @@ struct adsp_set_mute_command {
|
||||
|
||||
struct adsp_event_hdr
|
||||
{
|
||||
u32 evt_handle; /* DAL common header */
|
||||
u32 evt_cookie;
|
||||
u32 evt_length;
|
||||
u32 evt_handle; /* DAL common header */
|
||||
u32 evt_cookie;
|
||||
u32 evt_length;
|
||||
|
||||
u32 src; /* "source" audio address */
|
||||
u32 dst; /* "destination" audio address */
|
||||
u32 src; /* "source" audio address */
|
||||
u32 dst; /* "destination" audio address */
|
||||
|
||||
u32 event_id;
|
||||
u32 response_type;
|
||||
u32 seq_number;
|
||||
u32 event_id;
|
||||
u32 response_type;
|
||||
u32 seq_number;
|
||||
|
||||
u32 context; /* opaque to DSP */
|
||||
u32 data;
|
||||
u32 context; /* opaque to DSP */
|
||||
u32 data;
|
||||
|
||||
u32 status;
|
||||
u32 status;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#if defined(CONFIG_MACH_HTCLEO)
|
||||
|
||||
union adsp_event_data
|
||||
{
|
||||
u32 val32;
|
||||
uint8_t data[32];
|
||||
u32 val32;
|
||||
uint8_t data[32];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct adsp_audio_event
|
||||
{
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 session;
|
||||
u32 event_id;
|
||||
u32 status;
|
||||
u32 datalen;
|
||||
union adsp_event_data data;
|
||||
struct adsp_command_hdr hdr;
|
||||
u32 session;
|
||||
u32 event_id;
|
||||
u32 status;
|
||||
u32 datalen;
|
||||
union adsp_event_data data;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct adsp_audio_dal_event
|
||||
{
|
||||
u32 cb_evt;
|
||||
u32 loc_evt;
|
||||
u32 size;
|
||||
struct adsp_audio_event ae;
|
||||
u32 cb_evt;
|
||||
u32 loc_evt;
|
||||
u32 size;
|
||||
struct adsp_audio_event ae;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#else
|
||||
/*
|
||||
struct adsp_buffer_event
|
||||
{
|
||||
struct adsp_event_hdr hdr;
|
||||
struct adsp_audio_buffer buffer;
|
||||
struct adsp_event_hdr hdr;
|
||||
struct adsp_audio_buffer buffer;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
/* ---- audio device IDs ---- */
|
||||
@ -680,9 +667,9 @@ struct adsp_buffer_event
|
||||
#define ADSP_AUDIO_EQUALIZER_BAND_CUT 6
|
||||
|
||||
struct cad_audio_eq_cfg {
|
||||
u32 enable;
|
||||
u32 num_bands;
|
||||
struct adsp_audio_eq_band eq_bands[ADSP_AUDIO_MAX_EQ_BANDS];
|
||||
u32 enable;
|
||||
u32 num_bands;
|
||||
struct adsp_audio_eq_band eq_bands[ADSP_AUDIO_MAX_EQ_BANDS];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
int q6audio_set_stream_eq(struct audio_client *ac, struct cad_audio_eq_cfg *eq_cfg);
|
||||
|
@ -60,34 +60,34 @@
|
||||
#if 1
|
||||
|
||||
// LEO
|
||||
static struct q6_hw_info q6_audio_hw[Q6_HW_COUNT] =
|
||||
static struct q6_hw_info q6_audio_hw[Q6_HW_COUNT] =
|
||||
{
|
||||
[Q6_HW_HANDSET] =
|
||||
[Q6_HW_HANDSET] =
|
||||
{
|
||||
.min_gain = -2000,
|
||||
.max_gain = 0,
|
||||
},
|
||||
[Q6_HW_HEADSET] =
|
||||
[Q6_HW_HEADSET] =
|
||||
{
|
||||
.min_gain = -2000,
|
||||
.max_gain = 0,
|
||||
},
|
||||
[Q6_HW_SPEAKER] =
|
||||
[Q6_HW_SPEAKER] =
|
||||
{
|
||||
.min_gain = -1000,
|
||||
.max_gain = 500,
|
||||
},
|
||||
[Q6_HW_TTY] =
|
||||
[Q6_HW_TTY] =
|
||||
{
|
||||
.min_gain = 0,
|
||||
.max_gain = 0,
|
||||
},
|
||||
[Q6_HW_BT_SCO] =
|
||||
[Q6_HW_BT_SCO] =
|
||||
{
|
||||
.min_gain = -1100,
|
||||
.max_gain = 400,
|
||||
},
|
||||
[Q6_HW_BT_A2DP] =
|
||||
[Q6_HW_BT_A2DP] =
|
||||
{
|
||||
.min_gain = -1100,
|
||||
.max_gain = 400,
|
||||
@ -97,7 +97,7 @@ static struct q6_hw_info q6_audio_hw[Q6_HW_COUNT] =
|
||||
#else
|
||||
|
||||
// Old one (from Desire)
|
||||
static struct q6_hw_info q6_audio_hw[Q6_HW_COUNT] =
|
||||
static struct q6_hw_info q6_audio_hw[Q6_HW_COUNT] =
|
||||
{
|
||||
[Q6_HW_HANDSET] = {
|
||||
.min_gain = -2000,
|
||||
@ -493,7 +493,7 @@ static int audio_out_open(struct audio_client *ac, uint32_t bufsz,
|
||||
struct adsp_open_command rpc;
|
||||
union adsp_audio_format *ptr;
|
||||
|
||||
printk("audio_out_open: %x %d %d\n", bufsz, rate, channels);
|
||||
TRACE("audio_out_open: %x %d %d\n", bufsz, rate, channels);
|
||||
mutex_lock(&open_mem_lock);
|
||||
|
||||
memset(&rpc, 0, sizeof(rpc));
|
||||
@ -543,7 +543,7 @@ static int audio_in_open(struct audio_client *ac, uint32_t bufsz,
|
||||
struct adsp_open_command rpc;
|
||||
union adsp_audio_format *ptr;
|
||||
|
||||
printk("audio_in_open: %x %d %d\n", bufsz, rate, channels);
|
||||
TRACE("audio_in_open: %x %d %d\n", bufsz, rate, channels);
|
||||
mutex_lock(&open_mem_lock);
|
||||
memset(&rpc, 0, sizeof(rpc));
|
||||
ptr = (union adsp_audio_format*)params_data;
|
||||
@ -587,7 +587,7 @@ static int audio_mp3_open(struct audio_client *ac, uint32_t bufsz,
|
||||
struct adsp_open_command rpc;
|
||||
union adsp_audio_format *ptr;
|
||||
|
||||
printk("audio_mp3_open: %x %d %d\n", bufsz, rate, channels);
|
||||
TRACE("audio_mp3_open: %x %d %d\n", bufsz, rate, channels);
|
||||
mutex_lock(&open_mem_lock);
|
||||
memset(&rpc, 0, sizeof(rpc));
|
||||
ptr = (union adsp_audio_format*)params_data;
|
||||
@ -613,7 +613,7 @@ static int audio_mp3_open(struct audio_client *ac, uint32_t bufsz,
|
||||
// wait for async event
|
||||
if (!wait_event_timeout(ac->wait, (ac->open_done == 1), 3 * HZ))
|
||||
{
|
||||
mutex_unlock(&open_mem_lock);
|
||||
mutex_unlock(&open_mem_lock);
|
||||
pr_err("wait for open async event failed (MP3)!\n");
|
||||
return -1;
|
||||
}
|
||||
@ -1218,7 +1218,7 @@ static int q6audio_init(void)
|
||||
sdac_clk = clk_get(0, "sdac_clk");
|
||||
audio_data = dma_alloc_coherent(NULL, 4096, &audio_phys, GFP_KERNEL);
|
||||
params_data = dma_alloc_coherent(NULL, 4096, ¶ms_phys, GFP_KERNEL);
|
||||
// printk("allocated: %p %x\n", params_data, params_phys);
|
||||
// printk("allocated: %p %x\n", params_data, params_phys);
|
||||
|
||||
// pr_info("audio: init: INIT\n");
|
||||
|
||||
@ -1290,7 +1290,7 @@ done:
|
||||
if ((res < 0) && ac)
|
||||
{
|
||||
audio_client_free(ac);
|
||||
printk(" init failed!\n");
|
||||
pr_err(" init failed!\n");
|
||||
}
|
||||
mutex_unlock(&audio_lock);
|
||||
return res;
|
||||
@ -1303,7 +1303,7 @@ static int map_cad_dev_to_virtual(int cd)
|
||||
{
|
||||
return cd;
|
||||
}
|
||||
|
||||
|
||||
switch (cd)
|
||||
{
|
||||
case 1: return 507;
|
||||
@ -1313,8 +1313,8 @@ static int map_cad_dev_to_virtual(int cd)
|
||||
case 6: return 507;
|
||||
case 7: return 607;
|
||||
case 17: return 408;
|
||||
default: return cd;
|
||||
}
|
||||
default: return cd;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1350,7 +1350,7 @@ static int acdb_get_config_table(uint32_t device_id, uint32_t sample_rate)
|
||||
r = dal_call(acdb, ACDB_OP_IOCTL, 8, &rpc, sizeof(rpc), &res, sizeof(res));
|
||||
// r = dal_call_f8(acdb, ACDB_OP_IOCTL, &rpc, sizeof(rpc), &res, sizeof(res));
|
||||
|
||||
pr_info("acdb ret: %d %X %X %X %d\n", res. dal_status, res.size, res.unmapped_buf, res.used_bytes, res.result);
|
||||
pr_info("acdb ret: %d %X %X %X %d\n", res. dal_status, res.size, res.unmapped_buf, res.used_bytes, res.result);
|
||||
if ((r == sizeof(res)) && (res.result == 0))
|
||||
{
|
||||
pr_info("acdb: %d bytes for device %d, rate %d.\n", res.used_bytes, device_id, sample_rate);
|
||||
@ -1518,17 +1518,17 @@ static int audio_update_acdb(uint32_t adev, uint32_t acdb_id)
|
||||
{
|
||||
sz = acdb_get_config_table(acdb_id, sample_rate);
|
||||
}
|
||||
printk("res1 = %d\n", sz);
|
||||
TRACE("res1 = %d\n", sz);
|
||||
if (sz <= 0)
|
||||
{
|
||||
acdb_id = q6_device_to_cad_id(adev);
|
||||
printk(" new acdb = %d\n", acdb_id);
|
||||
sz = acdb_get_config_table(acdb_id, sample_rate);
|
||||
}
|
||||
printk("res2 = %d\n", sz);
|
||||
TRACE("res2 = %d\n", sz);
|
||||
if (sz > 0)
|
||||
{
|
||||
printk("call audio_set_table\n");
|
||||
TRACE("call audio_set_table\n");
|
||||
audio_set_table(ac_control, adev, sz);
|
||||
}
|
||||
return 0;
|
||||
@ -1951,7 +1951,7 @@ int q6audio_set_rx_dev_volume(int level)
|
||||
mutex_lock(&audio_path_lock);
|
||||
|
||||
vol = q6_device_volume(audio_rx_device_id, level);
|
||||
printk("$$ DEV=%08X: vol is %d\n", audio_rx_device_id, vol);
|
||||
TRACE("$$ DEV=%08X: vol is %d\n", audio_rx_device_id, vol);
|
||||
audio_rx_volume(ac_control, audio_rx_device_id, vol);
|
||||
|
||||
mutex_unlock(&audio_path_lock);
|
||||
@ -1994,14 +1994,14 @@ static int q6audio_init_rx_volumes()
|
||||
|
||||
mutex_lock(&audio_path_lock);
|
||||
|
||||
printk("$$$ q6audio_init_rx_volumes\n");
|
||||
TRACE("$$$ q6audio_init_rx_volumes\n");
|
||||
while (1)
|
||||
{
|
||||
if (di->id == 0) break;
|
||||
|
||||
vol = q6_device_volume(di->id, 100);
|
||||
audio_rx_volume(ac_control, di->id, vol);
|
||||
printk("$$ DEV=%08X: vol is %d\n", di->id, vol);
|
||||
TRACE("$$ DEV=%08X: vol is %d\n", di->id, vol);
|
||||
|
||||
di++;
|
||||
}
|
||||
@ -2149,7 +2149,7 @@ struct audio_client *q6audio_open_pcm(uint32_t bufsz, uint32_t rate,
|
||||
ac = audio_client_alloc(bufsz);
|
||||
if (!ac)
|
||||
{
|
||||
printk("audio_client_alloc failed\n");
|
||||
pr_err("audio_client_alloc failed\n");
|
||||
return 0;
|
||||
}
|
||||
// printk("after alloc);\n");
|
||||
@ -2301,9 +2301,20 @@ struct audio_client *q6voice_open(uint32_t flags, uint32_t acdb_id)
|
||||
if (ac->flags & AUDIO_FLAG_WRITE) {
|
||||
audio_rx_path_enable(1, acdb_id);
|
||||
audio_rx_mute(ac_control, ADSP_AUDIO_DEVICE_ID_VOICE, 0);
|
||||
// fix for non update acdb at start of call, if other stream is active
|
||||
audio_update_acdb(audio_rx_device_id, rx_acdb);
|
||||
qdsp6_devchg_notify(ac_control, ADSP_AUDIO_RX_DEVICE, audio_rx_device_id);
|
||||
qdsp6_standby(ac_control);
|
||||
qdsp6_start(ac_control);
|
||||
|
||||
} else {
|
||||
tx_clk_freq = 8000;
|
||||
audio_tx_path_enable(1, acdb_id);
|
||||
// fix for non update acdb at start of call, if other stream is active
|
||||
audio_update_acdb(audio_tx_device_id, tx_acdb);
|
||||
qdsp6_devchg_notify(ac_control, ADSP_AUDIO_TX_DEVICE, audio_tx_device_id);
|
||||
qdsp6_standby(ac_control);
|
||||
qdsp6_start(ac_control);
|
||||
}
|
||||
|
||||
return ac;
|
||||
@ -2327,7 +2338,7 @@ struct audio_client *q6audio_open_mp3(uint32_t bufsz, uint32_t rate,
|
||||
{
|
||||
struct audio_client *ac;
|
||||
|
||||
printk("q6audio_open_mp3()\n");
|
||||
TRACE("q6audio_open_mp3()\n");
|
||||
|
||||
if (q6audio_init())
|
||||
return 0;
|
||||
@ -2531,7 +2542,7 @@ static struct audio_client * audio_test(void)
|
||||
sdac_clk = clk_get(0, "sdac_clk");
|
||||
audio_data = dma_alloc_coherent(NULL, 4096, &audio_phys, GFP_KERNEL);
|
||||
params_data = dma_alloc_coherent(NULL, 4096, ¶ms_phys, GFP_KERNEL);
|
||||
printk("allocated: %p %08X\n", params_data, params_phys);
|
||||
TRACE("allocated: %p %08X\n", params_data, params_phys);
|
||||
|
||||
clk_set_rate(icodec_rx_clk, 12288000);
|
||||
clk_enable(icodec_rx_clk);
|
||||
|
Loading…
x
Reference in New Issue
Block a user