M7350v1_en_gpl

This commit is contained in:
T
2024-09-09 08:52:07 +00:00
commit f9cc65cfda
65988 changed files with 26357421 additions and 0 deletions
@@ -0,0 +1,171 @@
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __APR_H_
#define __APR_H_
#include <linux/mutex.h>
enum apr_subsys_state {
APR_SUBSYS_DOWN,
APR_SUBSYS_UP,
APR_SUBSYS_LOADED,
};
struct apr_q6 {
void *pil;
atomic_t q6_state;
atomic_t modem_state;
struct mutex lock;
};
struct apr_hdr {
uint16_t hdr_field;
uint16_t pkt_size;
uint8_t src_svc;
uint8_t src_domain;
uint16_t src_port;
uint8_t dest_svc;
uint8_t dest_domain;
uint16_t dest_port;
uint32_t token;
uint32_t opcode;
};
#define APR_HDR_LEN(hdr_len) ((hdr_len)/4)
#define APR_PKT_SIZE(hdr_len, payload_len) ((hdr_len) + (payload_len))
#define APR_HDR_FIELD(msg_type, hdr_len, ver)\
(((msg_type & 0x3) << 8) | ((hdr_len & 0xF) << 4) | (ver & 0xF))
#define APR_HDR_SIZE sizeof(struct apr_hdr)
/* Version */
#define APR_PKT_VER 0x0
/* Command and Response Types */
#define APR_MSG_TYPE_EVENT 0x0
#define APR_MSG_TYPE_CMD_RSP 0x1
#define APR_MSG_TYPE_SEQ_CMD 0x2
#define APR_MSG_TYPE_NSEQ_CMD 0x3
#define APR_MSG_TYPE_MAX 0x04
/* APR Basic Response Message */
#define APR_BASIC_RSP_RESULT 0x000110E8
#define APR_RSP_ACCEPTED 0x000100BE
/* Domain IDs */
#define APR_DOMAIN_SIM 0x1
#define APR_DOMAIN_PC 0x2
#define APR_DOMAIN_MODEM 0x3
#define APR_DOMAIN_ADSP 0x4
#define APR_DOMAIN_APPS 0x5
#define APR_DOMAIN_MAX 0x6
/* ADSP service IDs */
#define APR_SVC_TEST_CLIENT 0x2
#define APR_SVC_ADSP_CORE 0x3
#define APR_SVC_AFE 0x4
#define APR_SVC_VSM 0x5
#define APR_SVC_VPM 0x6
#define APR_SVC_ASM 0x7
#define APR_SVC_ADM 0x8
#define APR_SVC_ADSP_MVM 0x09
#define APR_SVC_ADSP_CVS 0x0A
#define APR_SVC_ADSP_CVP 0x0B
#define APR_SVC_USM 0x0C
#define APR_SVC_LSM 0x0D
#define APR_SVC_VIDC 0x16
#define APR_SVC_MAX 0x17
/* Modem Service IDs */
#define APR_SVC_MVS 0x3
#define APR_SVC_MVM 0x4
#define APR_SVC_CVS 0x5
#define APR_SVC_CVP 0x6
#define APR_SVC_SRD 0x7
/* APR Port IDs */
#define APR_MAX_PORTS 0x40
#define APR_NAME_MAX 0x40
#define RESET_EVENTS 0xFFFFFFFF
#define LPASS_RESTART_EVENT 0x1000
#define LPASS_RESTART_READY 0x1001
struct apr_client_data {
uint16_t reset_event;
uint16_t reset_proc;
uint16_t payload_size;
uint16_t hdr_len;
uint16_t msg_type;
uint16_t src;
uint16_t dest_svc;
uint16_t src_port;
uint16_t dest_port;
uint32_t token;
uint32_t opcode;
void *payload;
};
typedef int32_t (*apr_fn)(struct apr_client_data *data, void *priv);
struct apr_svc {
uint16_t id;
uint16_t dest_id;
uint16_t client_id;
uint8_t rvd;
uint8_t port_cnt;
uint8_t svc_cnt;
uint8_t need_reset;
apr_fn port_fn[APR_MAX_PORTS];
void *port_priv[APR_MAX_PORTS];
apr_fn fn;
void *priv;
struct mutex m_lock;
spinlock_t w_lock;
};
struct apr_client {
uint8_t id;
uint8_t svc_cnt;
uint8_t rvd;
struct mutex m_lock;
struct apr_svc_ch_dev *handle;
struct apr_svc svc[APR_SVC_MAX];
};
int apr_load_adsp_image(void);
struct apr_client *apr_get_client(int dest_id, int client_id);
int apr_wait_for_device_up(int dest_id);
int apr_get_svc(const char *svc_name, int dest_id, int *client_id,
int *svc_idx, int *svc_id);
void apr_cb_func(void *buf, int len, void *priv);
struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn,
uint32_t src_port, void *priv);
inline int apr_fill_hdr(void *handle, uint32_t *buf, uint16_t src_port,
uint16_t msg_type, uint16_t dest_port,
uint32_t token, uint32_t opcode, uint16_t len);
int apr_send_pkt(void *handle, uint32_t *buf);
int apr_deregister(void *handle);
void change_q6_state(int state);
void q6audio_dsp_not_responding(void);
void apr_reset(void *handle);
enum apr_subsys_state apr_get_modem_state(void);
void apr_set_modem_state(enum apr_subsys_state state);
enum apr_subsys_state apr_get_q6_state(void);
int apr_set_q6_state(enum apr_subsys_state state);
void apr_set_subsys_state(void);
const char *apr_get_lpass_subsys_name(void);
#endif
@@ -0,0 +1,55 @@
/* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __APR_TAL_H_
#define __APR_TAL_H_
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/uaccess.h>
/* APR Client IDs */
#define APR_CLIENT_AUDIO 0x0
#define APR_CLIENT_VOICE 0x1
#define APR_CLIENT_MAX 0x2
#define APR_DL_SMD 0
#define APR_DL_MAX 1
#define APR_DEST_MODEM 0
#define APR_DEST_QDSP6 1
#define APR_DEST_MAX 2
#define APR_MAX_BUF 8192
#define APR_OPEN_TIMEOUT_MS 5000
typedef void (*apr_svc_cb_fn)(void *buf, int len, void *priv);
struct apr_svc_ch_dev *apr_tal_open(uint32_t svc, uint32_t dest,
uint32_t dl, apr_svc_cb_fn func, void *priv);
int apr_tal_write(struct apr_svc_ch_dev *apr_ch, void *data, int len);
int apr_tal_close(struct apr_svc_ch_dev *apr_ch);
struct apr_svc_ch_dev {
struct smd_channel *ch;
spinlock_t lock;
spinlock_t w_lock;
struct mutex m_lock;
apr_svc_cb_fn func;
char data[APR_MAX_BUF];
wait_queue_head_t wait;
void *priv;
uint32_t smd_state;
wait_queue_head_t dest;
uint32_t dest_state;
};
#endif
@@ -0,0 +1,115 @@
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __APR_US_H__
#define __APR_US_H__
#include <mach/qdsp6v2/apr.h>
/* ======================================================================= */
/* Session Level commands */
#define USM_SESSION_CMD_RUN 0x00012306
struct usm_stream_cmd_run {
struct apr_hdr hdr;
u32 flags;
u32 msw_ts;
u32 lsw_ts;
} __packed;
/* Stream level commands */
#define USM_STREAM_CMD_OPEN_READ 0x00012309
struct usm_stream_cmd_open_read {
struct apr_hdr hdr;
u32 uMode;
u32 src_endpoint;
u32 pre_proc_top;
u32 format;
} __packed;
#define USM_STREAM_CMD_OPEN_WRITE 0x00011271
struct usm_stream_cmd_open_write {
struct apr_hdr hdr;
u32 format;
} __packed;
#define USM_STREAM_CMD_CLOSE 0x0001230A
/* Encoder configuration definitions */
#define USM_STREAM_CMD_SET_ENC_PARAM 0x0001230B
/* Decoder configuration definitions */
#define USM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00011272
/* Encoder/decoder configuration block */
#define USM_PARAM_ID_ENCDEC_ENC_CFG_BLK 0x0001230D
/* Parameter structures used in USM_STREAM_CMD_SET_ENCDEC_PARAM command */
/* common declarations */
struct usm_cfg_common {
u16 ch_cfg;
u16 bits_per_sample;
u32 sample_rate;
u32 dev_id;
u32 data_map;
} __packed;
/* Max number of static located transparent data (bytes) */
#define USM_MAX_CFG_DATA_SIZE 100
struct usm_encode_cfg_blk {
u32 frames_per_buf;
u32 format_id;
/* <cfg_size> = sizeof(usm_cfg_common)+|tarnsp_data| */
u32 cfg_size;
struct usm_cfg_common cfg_common;
/* Transparent configuration data for specific encoder */
u8 transp_data[USM_MAX_CFG_DATA_SIZE];
} __packed;
struct usm_stream_cmd_encdec_cfg_blk {
struct apr_hdr hdr;
u32 param_id;
u32 param_size;
struct usm_encode_cfg_blk enc_blk;
} __packed;
struct us_encdec_cfg {
u32 format_id;
struct usm_cfg_common cfg_common;
u16 params_size;
u8 *params;
} __packed;
struct usm_stream_media_format_update {
struct apr_hdr hdr;
u32 format_id;
/* <cfg_size> = sizeof(usm_cfg_common)+|tarnsp_data| */
u32 cfg_size;
struct usm_cfg_common cfg_common;
/* Transparent configuration data for specific encoder */
u8 transp_data[USM_MAX_CFG_DATA_SIZE];
} __packed;
/* Start/stop US signal detection */
#define USM_SESSION_CMD_SIGNAL_DETECT_MODE 0x00012719
struct usm_session_cmd_detect_info {
struct apr_hdr hdr;
u32 detect_mode;
u32 skip_interval;
u32 algorithm_cfg_size;
} __packed;
/* US signal detection result */
#define USM_SESSION_EVENT_SIGNAL_DETECT_RESULT 0x00012720
#endif /* __APR_US_H__ */
@@ -0,0 +1,59 @@
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __APR_US_A_H__
#define __APR_US_A_H__
#include "apr_us.h"
/* ======================================================================= */
/* Session Level commands */
#define USM_SESSION_CMD_MEMORY_MAP 0x00012304
struct usm_stream_cmd_memory_map {
struct apr_hdr hdr;
u32 buf_add;
u32 buf_size;
u16 mempool_id;
u16 reserved;
} __packed;
#define USM_SESSION_CMD_MEMORY_UNMAP 0x00012305
struct usm_stream_cmd_memory_unmap {
struct apr_hdr hdr;
u32 buf_add;
} __packed;
#define USM_DATA_CMD_READ 0x0001230E
struct usm_stream_cmd_read {
struct apr_hdr hdr;
u32 buf_add;
u32 buf_size;
u32 uid;
u32 counter;
} __packed;
#define USM_DATA_EVENT_READ_DONE 0x0001230F
#define USM_DATA_CMD_WRITE 0x00011273
struct usm_stream_cmd_write {
struct apr_hdr hdr;
u32 buf_add;
u32 buf_size;
u32 uid;
u32 msw_ts;
u32 lsw_ts;
u32 flags;
} __packed;
#define USM_DATA_EVENT_WRITE_DONE 0x00011274
#endif /* __APR_US_A_H__ */
@@ -0,0 +1,70 @@
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __APR_US_B_H__
#define __APR_US_B_H__
#include "apr_us.h"
/* ======================================================================= */
/* Session Level commands */
#define USM_CMD_SHARED_MEM_MAP_REGION 0x00012728
struct usm_cmd_memory_map_region {
struct apr_hdr hdr;
u16 mempool_id;
u16 num_regions;
u32 flags;
u32 shm_addr_lsw;
u32 shm_addr_msw;
u32 mem_size_bytes;
} __packed;
#define USM_CMDRSP_SHARED_MEM_MAP_REGION 0x00012729
struct usm_cmdrsp_memory_map_region {
u32 mem_map_handle;
} __packed;
#define USM_CMD_SHARED_MEM_UNMAP_REGION 0x0001272A
struct usm_cmd_memory_unmap_region {
struct apr_hdr hdr;
u32 mem_map_handle;
} __packed;
#define USM_DATA_CMD_READ 0x00012724
struct usm_stream_cmd_read {
struct apr_hdr hdr;
u32 buf_addr_lsw;
u32 buf_addr_msw;
u32 mem_map_handle;
u32 buf_size;
u32 seq_id;
u32 counter;
} __packed;
#define USM_DATA_EVENT_READ_DONE 0x00012725
#define USM_DATA_CMD_WRITE 0x00012726
struct usm_stream_cmd_write {
struct apr_hdr hdr;
u32 buf_addr_lsw;
u32 buf_addr_msw;
u32 mem_map_handle;
u32 buf_size;
u32 seq_id;
u32 res0;
u32 res1;
u32 res2;
} __packed;
#define USM_DATA_EVENT_WRITE_DONE 0x00012727
#endif /* __APR_US_B_H__ */
@@ -0,0 +1,70 @@
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _AUDIO_ACDB_H
#define _AUDIO_ACDB_H
#include <linux/msm_audio_acdb.h>
#include <sound/q6adm.h>
enum {
RX_CAL,
TX_CAL,
MAX_AUDPROC_TYPES
};
enum {
VOCPROC_CAL,
VOCSTRM_CAL,
VOCVOL_CAL,
MAX_VOCPROC_TYPES
};
struct acdb_cal_block {
uint32_t cal_size;
uint32_t cal_kvaddr;
uint32_t cal_paddr;
};
struct acdb_atomic_cal_block {
atomic_t cal_size;
atomic_t cal_kvaddr;
atomic_t cal_paddr;
};
struct acdb_cal_data {
uint32_t num_cal_blocks;
struct acdb_atomic_cal_block *cal_blocks;
};
uint32_t get_voice_rx_topology(void);
uint32_t get_voice_tx_topology(void);
uint32_t get_adm_rx_topology(void);
uint32_t get_adm_tx_topology(void);
uint32_t get_asm_topology(void);
void get_voice_cal_allocation(struct acdb_cal_block *cal_block);
void get_all_voice_cal(struct acdb_cal_block *cal_block);
void get_all_cvp_cal(struct acdb_cal_block *cal_block);
void get_all_vocproc_cal(struct acdb_cal_block *cal_block);
void get_all_vocstrm_cal(struct acdb_cal_block *cal_block);
void get_all_vocvol_cal(struct acdb_cal_block *cal_block);
void get_anc_cal(struct acdb_cal_block *cal_block);
void get_afe_cal(int32_t path, struct acdb_cal_block *cal_block);
void get_audproc_cal(int32_t path, struct acdb_cal_block *cal_block);
void get_audstrm_cal(int32_t path, struct acdb_cal_block *cal_block);
void get_audvol_cal(int32_t path, struct acdb_cal_block *cal_block);
void get_vocproc_cal(struct acdb_cal_data *cal_data);
void get_vocstrm_cal(struct acdb_cal_data *cal_data);
void get_vocvol_cal(struct acdb_cal_data *cal_data);
void get_sidetone_cal(struct sidetone_cal *cal_data);
#endif
@@ -0,0 +1,221 @@
/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __MACH_QDSP6_V2_SNDDEV_H
#define __MACH_QDSP6_V2_SNDDEV_H
#include <mach/qdsp5v2/audio_def.h>
#include <sound/q6afe.h>
#define AUDIO_DEV_CTL_MAX_DEV 64
#define DIR_TX 2
#define DIR_RX 1
#define DEVICE_IGNORE 0xffff
#define COPP_IGNORE 0xffffffff
#define SESSION_IGNORE 0x0UL
/* 8 concurrent sessions with Q6 possible, session:0
reserved in DSP */
#define MAX_SESSIONS 0x09
/* This represents Maximum bit needed for representing sessions
per clients, MAX_BIT_PER_CLIENT >= MAX_SESSIONS */
#define MAX_BIT_PER_CLIENT 16
#define VOICE_STATE_INVALID 0x0
#define VOICE_STATE_INCALL 0x1
#define VOICE_STATE_OFFCALL 0x2
#define ONE_TO_MANY 1
#define MANY_TO_ONE 2
struct msm_snddev_info {
const char *name;
u32 capability;
u32 copp_id;
u32 acdb_id;
u32 dev_volume;
struct msm_snddev_ops {
int (*open)(struct msm_snddev_info *);
int (*close)(struct msm_snddev_info *);
int (*set_freq)(struct msm_snddev_info *, u32);
int (*enable_sidetone)(struct msm_snddev_info *, u32, uint16_t);
int (*set_device_volume)(struct msm_snddev_info *, u32);
int (*enable_anc)(struct msm_snddev_info *, u32);
} dev_ops;
u8 opened;
void *private_data;
bool state;
u32 sample_rate;
u32 channel_mode;
u32 set_sample_rate;
u64 sessions;
int usage_count;
s32 max_voc_rx_vol[VOC_RX_VOL_ARRAY_NUM]; /* [0] is for NB,[1] for WB */
s32 min_voc_rx_vol[VOC_RX_VOL_ARRAY_NUM];
};
struct msm_volume {
int volume; /* Volume parameter, in % Scale */
int pan;
};
extern struct msm_volume msm_vol_ctl;
void msm_snddev_register(struct msm_snddev_info *);
void msm_snddev_unregister(struct msm_snddev_info *);
int msm_snddev_devcount(void);
int msm_snddev_query(int dev_id);
unsigned short msm_snddev_route_dec(int popp_id);
unsigned short msm_snddev_route_enc(int enc_id);
int msm_snddev_set_dec(int popp_id, int copp_id, int set,
int rate, int channel_mode);
int msm_snddev_set_enc(int popp_id, int copp_id, int set,
int rate, int channel_mode);
int msm_snddev_is_set(int popp_id, int copp_id);
int msm_get_voc_route(u32 *rx_id, u32 *tx_id);
int msm_set_voc_route(struct msm_snddev_info *dev_info, int stream_type,
int dev_id);
int msm_snddev_enable_sidetone(u32 dev_id, u32 enable, uint16_t gain);
int msm_set_copp_id(int session_id, int copp_id);
int msm_clear_copp_id(int session_id, int copp_id);
int msm_clear_session_id(int session_id);
int msm_reset_all_device(void);
int reset_device(void);
int msm_clear_all_session(void);
struct msm_snddev_info *audio_dev_ctrl_find_dev(u32 dev_id);
void msm_release_voc_thread(void);
int snddev_voice_set_volume(int vol, int path);
struct auddev_evt_voc_devinfo {
u32 dev_type; /* Rx or Tx */
u32 acdb_dev_id; /* acdb id of device */
u32 dev_sample; /* Sample rate of device */
s32 max_rx_vol[VOC_RX_VOL_ARRAY_NUM]; /* unit is mb (milibel),
[0] is for NB, other for WB */
s32 min_rx_vol[VOC_RX_VOL_ARRAY_NUM]; /* unit is mb */
u32 dev_id; /* registered device id */
u32 dev_port_id;
};
struct auddev_evt_audcal_info {
u32 dev_id;
u32 acdb_id;
u32 sample_rate;
u32 dev_type;
u32 sessions;
};
union msm_vol_mute {
int vol;
bool mute;
};
struct auddev_evt_voc_mute_info {
u32 dev_type;
u32 acdb_dev_id;
u32 voice_session_id;
union msm_vol_mute dev_vm_val;
};
struct auddev_evt_freq_info {
u32 dev_type;
u32 acdb_dev_id;
u32 sample_rate;
};
union auddev_evt_data {
struct auddev_evt_voc_devinfo voc_devinfo;
struct auddev_evt_voc_mute_info voc_vm_info;
struct auddev_evt_freq_info freq_info;
u32 routing_id;
s32 session_vol;
s32 voice_state;
struct auddev_evt_audcal_info audcal_info;
u32 voice_session_id;
};
struct message_header {
uint32_t id;
uint32_t data_len;
};
#define AUDDEV_EVT_DEV_CHG_VOICE 0x01 /* device change event */
#define AUDDEV_EVT_DEV_RDY 0x02 /* device ready event */
#define AUDDEV_EVT_DEV_RLS 0x04 /* device released event */
#define AUDDEV_EVT_REL_PENDING 0x08 /* device release pending */
#define AUDDEV_EVT_DEVICE_VOL_MUTE_CHG 0x10 /* device volume changed */
#define AUDDEV_EVT_START_VOICE 0x20 /* voice call start */
#define AUDDEV_EVT_END_VOICE 0x40 /* voice call end */
#define AUDDEV_EVT_STREAM_VOL_CHG 0x80 /* device volume changed */
#define AUDDEV_EVT_FREQ_CHG 0x100 /* Change in freq */
#define AUDDEV_EVT_VOICE_STATE_CHG 0x200 /* Change in voice state */
#define AUDDEV_CLNT_VOC 0x1 /*Vocoder clients*/
#define AUDDEV_CLNT_DEC 0x2 /*Decoder clients*/
#define AUDDEV_CLNT_ENC 0x3 /* Encoder clients */
#define AUDDEV_CLNT_AUDIOCAL 0x4 /* AudioCalibration client */
#define AUDIO_DEV_CTL_MAX_LISTNER 20 /* Max Listeners Supported */
struct msm_snd_evt_listner {
uint32_t evt_id;
uint32_t clnt_type;
uint32_t clnt_id;
void *private_data;
void (*auddev_evt_listener)(u32 evt_id,
union auddev_evt_data *evt_payload,
void *private_data);
struct msm_snd_evt_listner *cb_next;
struct msm_snd_evt_listner *cb_prev;
};
struct event_listner {
struct msm_snd_evt_listner *cb;
u32 num_listner;
int state; /* Call state */ /* TODO remove this if not req*/
};
extern struct event_listner event;
int auddev_register_evt_listner(u32 evt_id, u32 clnt_type, u32 clnt_id,
void (*listner)(u32 evt_id,
union auddev_evt_data *evt_payload,
void *private_data),
void *private_data);
int auddev_unregister_evt_listner(u32 clnt_type, u32 clnt_id);
void mixer_post_event(u32 evt_id, u32 dev_id);
void broadcast_event(u32 evt_id, u32 dev_id, u64 session_id);
int auddev_cfg_tx_copp_topology(int session_id, int cfg);
int msm_snddev_request_freq(int *freq, u32 session_id,
u32 capability, u32 clnt_type);
int msm_snddev_withdraw_freq(u32 session_id,
u32 capability, u32 clnt_type);
int msm_device_is_voice(int dev_id);
int msm_get_voc_freq(int *tx_freq, int *rx_freq);
int msm_snddev_get_enc_freq(int session_id);
int msm_set_voice_vol(int dir, s32 volume, u32 session_id);
int msm_set_voice_mute(int dir, int mute, u32 session_id);
int msm_get_voice_state(void);
int msm_enable_incall_recording(int popp_id, int rec_mode, int rate,
int channel_mode);
int msm_disable_incall_recording(uint32_t popp_id, uint32_t rec_mode);
#endif
@@ -0,0 +1,22 @@
/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __DSP_DEBUG_H_
#define __DSP_DEBUG_H_
typedef int (*dsp_state_cb)(int state);
int dsp_debug_register(dsp_state_cb ptr);
#define DSP_STATE_CRASHED 0x0
#define DSP_STATE_CRASH_DUMP_DONE 0x1
#endif
@@ -0,0 +1,62 @@
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __Q6CORE_H__
#define __Q6CORE_H__
#include <mach/qdsp6v2/apr.h>
#define ADSP_CMD_REMOTE_BUS_BW_REQUEST 0x0001115D
#define AUDIO_IF_BUS_ID 1
struct adsp_cmd_remote_bus_bw_request {
struct apr_hdr hdr;
u16 bus_identifier;
u16 reserved;
u32 ab_bps;
u32 ib_bps;
} __packed;
#define ADSP_GET_VERSION 0x00011152
#define ADSP_GET_VERSION_RSP 0x00011153
struct adsp_get_version {
uint32_t build_id;
uint32_t svc_cnt;
};
struct adsp_service_info {
uint32_t svc_id;
uint32_t svc_ver;
};
#define ADSP_CMD_SET_POWER_COLLAPSE_STATE 0x0001115C
struct adsp_power_collapse {
struct apr_hdr hdr;
uint32_t power_collapse;
};
#define ADSP_CMD_SET_DTS_MODEL_ID 0x00012917
struct adsp_dts_modelid {
struct apr_hdr hdr;
uint32_t model_ID_size;
uint8_t model_ID[128];
};
int core_req_bus_bandwith(u16 bus_id, u32 ab_bps, u32 ib_bps);
uint32_t core_get_adsp_version(void);
uint32_t core_set_dts_model_id(uint32_t id_size, uint8_t *id);
#endif /* __Q6CORE_H__ */
@@ -0,0 +1,778 @@
/* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __QDSP6VOICE_H__
#define __QDSP6VOICE_H__
#include <mach/qdsp6v2/apr.h>
/* Device Event */
#define DEV_CHANGE_READY 0x1
#define VOICE_CALL_START 0x1
#define VOICE_CALL_END 0
#define VOICE_DEV_ENABLED 0x1
#define VOICE_DEV_DISABLED 0
#define MAX_VOC_PKT_SIZE 642
#define SESSION_NAME_LEN 20
struct voice_header {
uint32_t id;
uint32_t data_len;
};
struct voice_init {
struct voice_header hdr;
void *cb_handle;
};
/* Device information payload structure */
struct device_data {
uint32_t dev_acdb_id;
uint32_t volume; /* in percentage */
uint32_t mute;
uint32_t sample;
uint32_t enabled;
uint32_t dev_id;
uint32_t dev_port_id;
};
enum {
VOC_INIT = 0,
VOC_RUN,
VOC_CHANGE,
VOC_RELEASE,
};
/* TO MVM commands */
#define VSS_IMVM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x000110FF
/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_IMVM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110FE
/* Create a new full control MVM session. */
#define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_IMVM_CMD_ATTACH_STREAM 0x0001123C
/* Attach a stream to the MVM. */
#define VSS_IMVM_CMD_DETACH_STREAM 0x0001123D
/* Detach a stream from the MVM. */
#define VSS_IMVM_CMD_ATTACH_VOCPROC 0x0001123E
/* Attach a vocproc to the MVM. The MVM will symmetrically connect this vocproc
* to all the streams currently attached to it.
*/
#define VSS_IMVM_CMD_DETACH_VOCPROC 0x0001123F
/* Detach a vocproc from the MVM. The MVM will symmetrically disconnect this
* vocproc from all the streams to which it is currently attached.
*/
#define VSS_IMVM_CMD_START_VOICE 0x00011190
/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_IMVM_CMD_STOP_VOICE 0x00011192
/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_ISTREAM_CMD_ATTACH_VOCPROC 0x000110F8
/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_ISTREAM_CMD_DETACH_VOCPROC 0x000110F9
/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_ISTREAM_CMD_SET_TTY_MODE 0x00011196
/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_ICOMMON_CMD_SET_NETWORK 0x0001119C
/* Set the network type. */
#define VSS_ICOMMON_CMD_SET_VOICE_TIMING 0x000111E0
/* Set the voice timing parameters. */
struct vss_imvm_cmd_create_control_session_t {
char name[SESSION_NAME_LEN];
/*
* A variable-sized stream name.
*
* The stream name size is the payload size minus the size of the other
* fields.
*/
} __packed;
struct vss_istream_cmd_set_tty_mode_t {
uint32_t mode;
/**<
* TTY mode.
*
* 0 : TTY disabled
* 1 : HCO
* 2 : VCO
* 3 : FULL
*/
} __attribute__((packed));
struct vss_istream_cmd_attach_vocproc_t {
uint16_t handle;
/**< Handle of vocproc being attached. */
} __attribute__((packed));
struct vss_istream_cmd_detach_vocproc_t {
uint16_t handle;
/**< Handle of vocproc being detached. */
} __attribute__((packed));
struct vss_imvm_cmd_attach_stream_t {
uint16_t handle;
/* The stream handle to attach. */
} __attribute__((packed));
struct vss_imvm_cmd_detach_stream_t {
uint16_t handle;
/* The stream handle to detach. */
} __attribute__((packed));
struct vss_icommon_cmd_set_network_t {
uint32_t network_id;
/* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
} __attribute__((packed));
struct vss_icommon_cmd_set_voice_timing_t {
uint16_t mode;
/*
* The vocoder frame synchronization mode.
*
* 0 : No frame sync.
* 1 : Hard VFR (20ms Vocoder Frame Reference interrupt).
*/
uint16_t enc_offset;
/*
* The offset in microseconds from the VFR to deliver a Tx vocoder
* packet. The offset should be less than 20000us.
*/
uint16_t dec_req_offset;
/*
* The offset in microseconds from the VFR to request for an Rx vocoder
* packet. The offset should be less than 20000us.
*/
uint16_t dec_offset;
/*
* The offset in microseconds from the VFR to indicate the deadline to
* receive an Rx vocoder packet. The offset should be less than 20000us.
* Rx vocoder packets received after this deadline are not guaranteed to
* be processed.
*/
} __attribute__((packed));
struct mvm_attach_vocproc_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_attach_vocproc_t mvm_attach_cvp_handle;
} __attribute__((packed));
struct mvm_detach_vocproc_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_detach_vocproc_t mvm_detach_cvp_handle;
} __attribute__((packed));
struct mvm_create_ctl_session_cmd {
struct apr_hdr hdr;
struct vss_imvm_cmd_create_control_session_t mvm_session;
} __packed;
struct mvm_set_tty_mode_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_set_tty_mode_t tty_mode;
} __attribute__((packed));
struct mvm_attach_stream_cmd {
struct apr_hdr hdr;
struct vss_imvm_cmd_attach_stream_t attach_stream;
} __attribute__((packed));
struct mvm_detach_stream_cmd {
struct apr_hdr hdr;
struct vss_imvm_cmd_detach_stream_t detach_stream;
} __attribute__((packed));
struct mvm_set_network_cmd {
struct apr_hdr hdr;
struct vss_icommon_cmd_set_network_t network;
} __attribute__((packed));
struct mvm_set_voice_timing_cmd {
struct apr_hdr hdr;
struct vss_icommon_cmd_set_voice_timing_t timing;
} __attribute__((packed));
/* TO CVS commands */
#define VSS_ISTREAM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x00011140
/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_ISTREAM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110F7
/* Create a new full control stream session. */
#define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
#define VSS_ISTREAM_CMD_CACHE_CALIBRATION_DATA 0x000110FB
#define VSS_ISTREAM_CMD_SET_MUTE 0x00011022
#define VSS_ISTREAM_CMD_SET_MEDIA_TYPE 0x00011186
/* Set media type on the stream. */
#define VSS_ISTREAM_EVT_SEND_ENC_BUFFER 0x00011015
/* Event sent by the stream to its client to provide an encoded packet. */
#define VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER 0x00011017
/* Event sent by the stream to its client requesting for a decoder packet.
* The client should respond with a VSS_ISTREAM_EVT_SEND_DEC_BUFFER event.
*/
#define VSS_ISTREAM_EVT_SEND_DEC_BUFFER 0x00011016
/* Event sent by the client to the stream in response to a
* VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER event, providing a decoder packet.
*/
#define VSS_ISTREAM_CMD_VOC_AMR_SET_ENC_RATE 0x0001113E
/* Set AMR encoder rate. */
#define VSS_ISTREAM_CMD_VOC_AMRWB_SET_ENC_RATE 0x0001113F
/* Set AMR-WB encoder rate. */
#define VSS_ISTREAM_CMD_CDMA_SET_ENC_MINMAX_RATE 0x00011019
/* Set encoder minimum and maximum rate. */
#define VSS_ISTREAM_CMD_SET_ENC_DTX_MODE 0x0001101D
/* Set encoder DTX mode. */
#define VSS_ISTREAM_CMD_START_RECORD 0x00011236
/* Start in-call conversation recording. */
#define VSS_ISTREAM_CMD_STOP_RECORD 0x00011237
/* Stop in-call conversation recording. */
#define VSS_ISTREAM_CMD_START_PLAYBACK 0x00011238
/* Start in-call music delivery on the Tx voice path. */
#define VSS_ISTREAM_CMD_STOP_PLAYBACK 0x00011239
/* Stop the in-call music delivery on the Tx voice path. */
struct vss_istream_cmd_create_passive_control_session_t {
char name[SESSION_NAME_LEN];
/**<
* A variable-sized stream name.
*
* The stream name size is the payload size minus the size of the other
* fields.
*/
} __attribute__((packed));
struct vss_istream_cmd_set_mute_t {
uint16_t direction;
/**<
* 0 : TX only
* 1 : RX only
* 2 : TX and Rx
*/
uint16_t mute_flag;
/**<
* Mute, un-mute.
*
* 0 : Silence disable
* 1 : Silence enable
* 2 : CNG enable. Applicable to TX only. If set on RX behavior
* will be the same as 1
*/
} __attribute__((packed));
struct vss_istream_cmd_create_full_control_session_t {
uint16_t direction;
/*
* Stream direction.
*
* 0 : TX only
* 1 : RX only
* 2 : TX and RX
* 3 : TX and RX loopback
*/
uint32_t enc_media_type;
/* Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
uint32_t dec_media_type;
/* Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
uint32_t network_id;
/* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
char name[SESSION_NAME_LEN];
/*
* A variable-sized stream name.
*
* The stream name size is the payload size minus the size of the other
* fields.
*/
} __attribute__((packed));
struct vss_istream_cmd_set_media_type_t {
uint32_t rx_media_id;
/* Set the Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
uint32_t tx_media_id;
/* Set the Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
} __attribute__((packed));
struct vss_istream_evt_send_enc_buffer_t {
uint32_t media_id;
/* Media ID of the packet. */
uint8_t packet_data[MAX_VOC_PKT_SIZE];
/* Packet data buffer. */
} __attribute__((packed));
struct vss_istream_evt_send_dec_buffer_t {
uint32_t media_id;
/* Media ID of the packet. */
uint8_t packet_data[MAX_VOC_PKT_SIZE];
/* Packet data. */
} __attribute__((packed));
struct vss_istream_cmd_voc_amr_set_enc_rate_t {
uint32_t mode;
/* Set the AMR encoder rate.
*
* 0x00000000 : 4.75 kbps
* 0x00000001 : 5.15 kbps
* 0x00000002 : 5.90 kbps
* 0x00000003 : 6.70 kbps
* 0x00000004 : 7.40 kbps
* 0x00000005 : 7.95 kbps
* 0x00000006 : 10.2 kbps
* 0x00000007 : 12.2 kbps
*/
} __attribute__((packed));
struct vss_istream_cmd_voc_amrwb_set_enc_rate_t {
uint32_t mode;
/* Set the AMR-WB encoder rate.
*
* 0x00000000 : 6.60 kbps
* 0x00000001 : 8.85 kbps
* 0x00000002 : 12.65 kbps
* 0x00000003 : 14.25 kbps
* 0x00000004 : 15.85 kbps
* 0x00000005 : 18.25 kbps
* 0x00000006 : 19.85 kbps
* 0x00000007 : 23.05 kbps
* 0x00000008 : 23.85 kbps
*/
} __attribute__((packed));
struct vss_istream_cmd_cdma_set_enc_minmax_rate_t {
uint16_t min_rate;
/* Set the lower bound encoder rate.
*
* 0x0000 : Blank frame
* 0x0001 : Eighth rate
* 0x0002 : Quarter rate
* 0x0003 : Half rate
* 0x0004 : Full rate
*/
uint16_t max_rate;
/* Set the upper bound encoder rate.
*
* 0x0000 : Blank frame
* 0x0001 : Eighth rate
* 0x0002 : Quarter rate
* 0x0003 : Half rate
* 0x0004 : Full rate
*/
} __attribute__((packed));
struct vss_istream_cmd_set_enc_dtx_mode_t {
uint32_t enable;
/* Toggle DTX on or off.
*
* 0 : Disables DTX
* 1 : Enables DTX
*/
} __attribute__((packed));
#define VSS_TAP_POINT_NONE 0x00010F78
/* Indicates no tapping for specified path. */
#define VSS_TAP_POINT_STREAM_END 0x00010F79
/* Indicates that specified path should be tapped at the end of the stream. */
struct vss_istream_cmd_start_record_t {
uint32_t rx_tap_point;
/* Tap point to use on the Rx path. Supported values are:
* VSS_TAP_POINT_NONE : Do not record Rx path.
* VSS_TAP_POINT_STREAM_END : Rx tap point is at the end of the stream.
*/
uint32_t tx_tap_point;
/* Tap point to use on the Tx path. Supported values are:
* VSS_TAP_POINT_NONE : Do not record tx path.
* VSS_TAP_POINT_STREAM_END : Tx tap point is at the end of the stream.
*/
} __attribute__((packed));
struct cvs_create_passive_ctl_session_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_create_passive_control_session_t cvs_session;
} __attribute__((packed));
struct cvs_create_full_ctl_session_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_create_full_control_session_t cvs_session;
} __attribute__((packed));
struct cvs_destroy_session_cmd {
struct apr_hdr hdr;
} __attribute__((packed));
struct cvs_cache_calibration_data_cmd {
struct apr_hdr hdr;
} __attribute__ ((packed));
struct cvs_set_mute_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_set_mute_t cvs_set_mute;
} __attribute__((packed));
struct cvs_set_media_type_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_set_media_type_t media_type;
} __attribute__((packed));
struct cvs_send_dec_buf_cmd {
struct apr_hdr hdr;
struct vss_istream_evt_send_dec_buffer_t dec_buf;
} __attribute__((packed));
struct cvs_set_amr_enc_rate_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_voc_amr_set_enc_rate_t amr_rate;
} __attribute__((packed));
struct cvs_set_amrwb_enc_rate_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_voc_amrwb_set_enc_rate_t amrwb_rate;
} __attribute__((packed));
struct cvs_set_cdma_enc_minmax_rate_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_cdma_set_enc_minmax_rate_t cdma_rate;
} __attribute__((packed));
struct cvs_set_enc_dtx_mode_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_set_enc_dtx_mode_t dtx_mode;
} __attribute__((packed));
struct cvs_start_record_cmd {
struct apr_hdr hdr;
struct vss_istream_cmd_start_record_t rec_mode;
} __attribute__((packed));
/* TO CVP commands */
#define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION 0x000100C3
/**< Wait for APRV2_IBASIC_RSP_RESULT response. */
#define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
#define VSS_IVOCPROC_CMD_SET_DEVICE 0x000100C4
#define VSS_IVOCPROC_CMD_CACHE_CALIBRATION_DATA 0x000110E3
#define VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE 0x000110E4
#define VSS_IVOCPROC_CMD_SET_VP3_DATA 0x000110EB
#define VSS_IVOCPROC_CMD_SET_RX_VOLUME_INDEX 0x000110EE
#define VSS_IVOCPROC_CMD_ENABLE 0x000100C6
/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_IVOCPROC_CMD_DISABLE 0x000110E1
/**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
#define VSS_IVOCPROC_TOPOLOGY_ID_NONE 0x00010F70
#define VSS_IVOCPROC_TOPOLOGY_ID_TX_SM_ECNS 0x00010F71
#define VSS_IVOCPROC_TOPOLOGY_ID_TX_DM_FLUENCE 0x00010F72
#define VSS_IVOCPROC_TOPOLOGY_ID_RX_DEFAULT 0x00010F77
/* Newtwork IDs */
#define VSS_NETWORK_ID_DEFAULT 0x00010037
#define VSS_NETWORK_ID_VOIP_NB 0x00011240
#define VSS_NETWORK_ID_VOIP_WB 0x00011241
#define VSS_NETWORK_ID_VOIP_WV 0x00011242
/* Media types */
#define VSS_MEDIA_ID_13K_MODEM 0x00010FC1
/* Qcelp vocoder modem format */
#define VSS_MEDIA_ID_EVRC_MODEM 0x00010FC2
/* 80-VF690-47 CDMA enhanced variable rate vocoder modem format. */
#define VSS_MEDIA_ID_4GV_NB_MODEM 0x00010FC3
/* 4GV Narrowband modem format */
#define VSS_MEDIA_ID_4GV_WB_MODEM 0x00010FC4
/* 4GV Wideband modem format */
#define VSS_MEDIA_ID_AMR_NB_MODEM 0x00010FC6
/* 80-VF690-47 UMTS AMR-NB vocoder modem format. */
#define VSS_MEDIA_ID_AMR_WB_MODEM 0x00010FC7
/* 80-VF690-47 UMTS AMR-WB vocoder modem format. */
#define VSS_MEDIA_ID_EFR_MODEM 0x00010FC8
/*EFR modem format */
#define VSS_MEDIA_ID_FR_MODEM 0x00010FC9
/*FR modem format */
#define VSS_MEDIA_ID_HR_MODEM 0x00010FCA
/*HR modem format */
#define VSS_MEDIA_ID_PCM_NB 0x00010FCB
/* Linear PCM (16-bit, little-endian). */
#define VSS_MEDIA_ID_PCM_WB 0x00010FCC
/* Linear wideband PCM vocoder modem format (16 bits, little endian). */
#define VSS_MEDIA_ID_G711_ALAW 0x00010FCD
/* G.711 a-law (contains two 10ms vocoder frames). */
#define VSS_MEDIA_ID_G711_MULAW 0x00010FCE
/* G.711 mu-law (contains two 10ms vocoder frames). */
#define VSS_MEDIA_ID_G729 0x00010FD0
/* G.729AB (contains two 10ms vocoder frames. */
#define VOICE_CMD_SET_PARAM 0x00011006
#define VOICE_CMD_GET_PARAM 0x00011007
#define VOICE_EVT_GET_PARAM_ACK 0x00011008
struct vss_ivocproc_cmd_create_full_control_session_t {
uint16_t direction;
/*
* stream direction.
* 0 : TX only
* 1 : RX only
* 2 : TX and RX
*/
uint32_t tx_port_id;
/*
* TX device port ID which vocproc will connect to. If not supplying a
* port ID set to VSS_IVOCPROC_PORT_ID_NONE.
*/
uint32_t tx_topology_id;
/*
* Tx leg topology ID. If not supplying a topology ID set to
* VSS_IVOCPROC_TOPOLOGY_ID_NONE.
*/
uint32_t rx_port_id;
/*
* RX device port ID which vocproc will connect to. If not supplying a
* port ID set to VSS_IVOCPROC_PORT_ID_NONE.
*/
uint32_t rx_topology_id;
/*
* Rx leg topology ID. If not supplying a topology ID set to
* VSS_IVOCPROC_TOPOLOGY_ID_NONE.
*/
int32_t network_id;
/*
* Network ID. (Refer to VSS_NETWORK_ID_XXX). If not supplying a network
* ID set to VSS_NETWORK_ID_DEFAULT.
*/
} __attribute__((packed));
struct vss_ivocproc_cmd_set_device_t {
uint32_t tx_port_id;
/**<
* TX device port ID which vocproc will connect to.
* VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
*/
uint32_t tx_topology_id;
/**<
* TX leg topology ID.
* VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
* pre/post-processing blocks and is pass-through.
*/
int32_t rx_port_id;
/**<
* RX device port ID which vocproc will connect to.
* VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
*/
uint32_t rx_topology_id;
/**<
* RX leg topology ID.
* VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
* pre/post-processing blocks and is pass-through.
*/
} __attribute__((packed));
struct vss_ivocproc_cmd_set_volume_index_t {
uint16_t vol_index;
/**<
* Volume index utilized by the vocproc to index into the volume table
* provided in VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE and set
* volume on the VDSP.
*/
} __attribute__((packed));
struct cvp_create_full_ctl_session_cmd {
struct apr_hdr hdr;
struct vss_ivocproc_cmd_create_full_control_session_t cvp_session;
} __attribute__ ((packed));
struct cvp_command {
struct apr_hdr hdr;
} __attribute__((packed));
struct cvp_set_device_cmd {
struct apr_hdr hdr;
struct vss_ivocproc_cmd_set_device_t cvp_set_device;
} __attribute__ ((packed));
struct cvp_cache_calibration_data_cmd {
struct apr_hdr hdr;
} __attribute__((packed));
struct cvp_cache_volume_calibration_table_cmd {
struct apr_hdr hdr;
} __attribute__((packed));
struct cvp_set_vp3_data_cmd {
struct apr_hdr hdr;
} __attribute__((packed));
struct cvp_set_rx_volume_index_cmd {
struct apr_hdr hdr;
struct vss_ivocproc_cmd_set_volume_index_t cvp_set_vol_idx;
} __attribute__((packed));
/* CB for up-link packets. */
typedef void (*ul_cb_fn)(uint8_t *voc_pkt,
uint32_t pkt_len,
void *private_data);
/* CB for down-link packets. */
typedef void (*dl_cb_fn)(uint8_t *voc_pkt,
uint32_t *pkt_len,
void *private_data);
struct q_min_max_rate {
uint32_t min_rate;
uint32_t max_rate;
};
struct mvs_driver_info {
uint32_t media_type;
uint32_t rate;
uint32_t network_type;
uint32_t dtx_mode;
struct q_min_max_rate q_min_max_rate;
ul_cb_fn ul_cb;
dl_cb_fn dl_cb;
void *private_data;
};
struct incall_rec_info {
uint32_t pending;
uint32_t rec_mode;
};
struct incall_music_info {
uint32_t pending;
uint32_t playing;
};
struct voice_data {
int voc_state;/*INIT, CHANGE, RELEASE, RUN */
wait_queue_head_t mvm_wait;
wait_queue_head_t cvs_wait;
wait_queue_head_t cvp_wait;
/* cache the values related to Rx and Tx */
struct device_data dev_rx;
struct device_data dev_tx;
/* call status */
int v_call_status; /* Start or End */
u32 mvm_state;
u32 cvs_state;
u32 cvp_state;
/* Handle to MVM */
u16 mvm_handle;
/* Handle to CVS */
u16 cvs_handle;
/* Handle to CVP */
u16 cvp_handle;
struct mutex lock;
struct incall_rec_info rec_info;
struct incall_music_info music_info;
u16 session_id;
};
#define MAX_VOC_SESSIONS 2
#define SESSION_ID_BASE 0xFFF0
struct common_data {
uint32_t voc_path;
uint32_t adsp_version;
uint32_t device_events;
/* These default values are for all devices */
uint32_t default_mute_val;
uint32_t default_vol_val;
uint32_t default_sample_val;
/* APR to MVM in the modem */
void *apr_mvm;
/* APR to CVS in the modem */
void *apr_cvs;
/* APR to CVP in the modem */
void *apr_cvp;
/* APR to MVM in the Q6 */
void *apr_q6_mvm;
/* APR to CVS in the Q6 */
void *apr_q6_cvs;
/* APR to CVP in the Q6 */
void *apr_q6_cvp;
struct mutex common_lock;
struct mvs_driver_info mvs_info;
struct voice_data voice[MAX_VOC_SESSIONS];
};
int voice_set_voc_path_full(uint32_t set);
void voice_register_mvs_cb(ul_cb_fn ul_cb,
dl_cb_fn dl_cb,
void *private_data);
void voice_config_vocoder(uint32_t media_type,
uint32_t rate,
uint32_t network_type,
uint32_t dtx_mode,
struct q_min_max_rate q_min_max_rate);
int voice_start_record(uint32_t rec_mode, uint32_t set);
int voice_start_playback(uint32_t set);
u16 voice_get_session_id(const char *name);
#endif
@@ -0,0 +1,39 @@
/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __RTAC_H__
#define __RTAC_H__
/* Voice Modes */
#define RTAC_CVP 0
#define RTAC_CVS 1
#define RTAC_VOICE_MODES 2
void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id);
void rtac_remove_adm_device(u32 port_id);
void rtac_remove_popp_from_adm_devices(u32 popp_id);
void rtac_add_voice(u32 cvs_handle, u32 cvp_handle, u32 rx_afe_port,
u32 tx_afe_port, u32 session_id);
void rtac_remove_voice(u32 cvs_handle);
void rtac_set_adm_handle(void *handle);
bool rtac_make_adm_callback(uint32_t *payload, u32 payload_size);
void rtac_copy_adm_payload_to_user(void *payload, u32 payload_size);
void rtac_set_asm_handle(u32 session_id, void *handle);
bool rtac_make_asm_callback(u32 session_id, uint32_t *payload,
u32 payload_size);
void rtac_copy_asm_payload_to_user(void *payload, u32 payload_size);
void rtac_set_voice_handle(u32 mode, void *handle);
bool rtac_make_voice_callback(u32 mode, uint32_t *payload, u32 payload_size);
void rtac_copy_voice_payload_to_user(void *payload, u32 payload_size);
#endif
@@ -0,0 +1,278 @@
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __USF_H__
#define __USF_H__
#include <linux/types.h>
#include <linux/ioctl.h>
#define USF_IOCTL_MAGIC 'U'
#define US_SET_TX_INFO _IOW(USF_IOCTL_MAGIC, 0, \
struct us_tx_info_type)
#define US_START_TX _IO(USF_IOCTL_MAGIC, 1)
#define US_GET_TX_UPDATE _IOWR(USF_IOCTL_MAGIC, 2, \
struct us_tx_update_info_type)
#define US_SET_RX_INFO _IOW(USF_IOCTL_MAGIC, 3, \
struct us_rx_info_type)
#define US_SET_RX_UPDATE _IOWR(USF_IOCTL_MAGIC, 4, \
struct us_rx_update_info_type)
#define US_START_RX _IO(USF_IOCTL_MAGIC, 5)
#define US_STOP_TX _IO(USF_IOCTL_MAGIC, 6)
#define US_STOP_RX _IO(USF_IOCTL_MAGIC, 7)
#define US_SET_DETECTION _IOWR(USF_IOCTL_MAGIC, 8, \
struct us_detect_info_type)
#define US_GET_VERSION _IOWR(USF_IOCTL_MAGIC, 9, \
struct us_version_info_type)
/* Special timeout values */
#define USF_NO_WAIT_TIMEOUT 0x00000000
/* Infinitive */
#define USF_INFINITIVE_TIMEOUT 0xffffffff
/* Default value, used by the driver */
#define USF_DEFAULT_TIMEOUT 0xfffffffe
/* US detection place (HW|FW) */
enum us_detect_place_enum {
/* US is detected in HW */
US_DETECT_HW,
/* US is detected in FW */
US_DETECT_FW
};
/* US detection mode */
enum us_detect_mode_enum {
/* US detection is disabled */
US_DETECT_DISABLED_MODE,
/* US detection is enabled in continue mode */
US_DETECT_CONTINUE_MODE,
/* US detection is enabled in one shot mode */
US_DETECT_SHOT_MODE
};
/* Encoder (TX), decoder (RX) supported US data formats */
#define USF_POINT_EPOS_FORMAT 0
#define USF_RAW_FORMAT 1
/* Indexes of event types, produced by the calculators */
#define USF_TSC_EVENT_IND 0
#define USF_TSC_PTR_EVENT_IND 1
#define USF_MOUSE_EVENT_IND 2
#define USF_KEYBOARD_EVENT_IND 3
#define USF_MAX_EVENT_IND 4
/* Types of events, produced by the calculators */
#define USF_NO_EVENT 0
#define USF_TSC_EVENT (1 << USF_TSC_EVENT_IND)
#define USF_TSC_PTR_EVENT (1 << USF_TSC_PTR_EVENT_IND)
#define USF_MOUSE_EVENT (1 << USF_MOUSE_EVENT_IND)
#define USF_KEYBOARD_EVENT (1 << USF_KEYBOARD_EVENT_IND)
#define USF_ALL_EVENTS (USF_TSC_EVENT |\
USF_TSC_PTR_EVENT |\
USF_MOUSE_EVENT |\
USF_KEYBOARD_EVENT)
/* min, max array dimension */
#define MIN_MAX_DIM 2
/* coordinates (x,y,z) array dimension */
#define COORDINATES_DIM 3
/* tilts (x,y) array dimension */
#define TILTS_DIM 2
/* Max size of the client name */
#define USF_MAX_CLIENT_NAME_SIZE 20
/* Max number of the ports (mics/speakers) */
#define USF_MAX_PORT_NUM 8
/* Info structure common for TX and RX */
struct us_xx_info_type {
/* Input: general info */
/* Name of the client - event calculator */
const char *client_name;
/* Selected device identification, accepted in the kernel's CAD */
uint32_t dev_id;
/* 0 - point_epos type; (e.g. 1 - gr_mmrd) */
uint32_t stream_format;
/* Required sample rate in Hz */
uint32_t sample_rate;
/* Size of a buffer (bytes) for US data transfer between the module and USF */
uint32_t buf_size;
/* Number of the buffers for the US data transfer */
uint16_t buf_num;
/* Number of the microphones (TX) or speakers(RX) */
uint16_t port_cnt;
/* Microphones(TX) or speakers(RX) indexes in their enumeration */
uint8_t port_id[USF_MAX_PORT_NUM];
/* Bits per sample 16 or 32 */
uint16_t bits_per_sample;
/* Input: Transparent info for encoder in the LPASS */
/* Parameters data size in bytes */
uint16_t params_data_size;
/* Pointer to the parameters */
uint8_t *params_data;
};
/* Input events sources */
enum us_input_event_src_type {
US_INPUT_SRC_PEN,
US_INPUT_SRC_FINGER,
US_INPUT_SRC_UNDEF
};
struct us_input_info_type {
/* Touch screen dimensions: min & max;for input module */
int tsc_x_dim[MIN_MAX_DIM];
int tsc_y_dim[MIN_MAX_DIM];
int tsc_z_dim[MIN_MAX_DIM];
/* Touch screen tilt dimensions: min & max;for input module */
int tsc_x_tilt[MIN_MAX_DIM];
int tsc_y_tilt[MIN_MAX_DIM];
/* Touch screen pressure limits: min & max; for input module */
int tsc_pressure[MIN_MAX_DIM];
/* Bitmap of types of events (USF_X_EVENT), produced by calculator */
uint16_t event_types;
/* Input event source */
enum us_input_event_src_type event_src;
/* Bitmap of types of events from devs, conflicting with USF */
uint16_t conflicting_event_types;
};
struct us_tx_info_type {
/* Common info */
struct us_xx_info_type us_xx_info;
/* Info specific for TX*/
struct us_input_info_type input_info;
};
struct us_rx_info_type {
/* Common info */
struct us_xx_info_type us_xx_info;
/* Info specific for RX*/
};
struct point_event_type {
/* Pen coordinates (x, y, z) in units, defined by <coordinates_type> */
int coordinates[COORDINATES_DIM];
/* {x;y} in transparent units */
int inclinations[TILTS_DIM];
/* [0-1023] (10bits); 0 - pen up */
uint32_t pressure;
};
/* Mouse buttons, supported by USF */
#define USF_BUTTON_LEFT_MASK 1
#define USF_BUTTON_MIDDLE_MASK 2
#define USF_BUTTON_RIGHT_MASK 4
struct mouse_event_type {
/* The mouse relative movement (dX, dY, dZ) */
int rels[COORDINATES_DIM];
/* Bitmap of mouse buttons states: 1 - down, 0 - up; */
uint16_t buttons_states;
};
struct key_event_type {
/* Calculated MS key- see input.h. */
uint32_t key;
/* Keyboard's key state: 1 - down, 0 - up; */
uint8_t key_state;
};
struct usf_event_type {
/* Event sequence number */
uint32_t seq_num;
/* Event generation system time */
uint32_t timestamp;
/* Destination input event type index (e.g. touch screen, mouse, key) */
uint16_t event_type_ind;
union {
struct point_event_type point_event;
struct mouse_event_type mouse_event;
struct key_event_type key_event;
} event_data;
};
struct us_tx_update_info_type {
/* Input general: */
/* Number of calculated events */
uint16_t event_counter;
/* Calculated events or NULL */
struct usf_event_type *event;
/* Pointer (read index) to the end of available region */
/* in the shared US data memory */
uint32_t free_region;
/* Time (sec) to wait for data or special values: */
/* USF_NO_WAIT_TIMEOUT, USF_INFINITIVE_TIMEOUT, USF_DEFAULT_TIMEOUT */
uint32_t timeout;
/* Events (from conflicting devs) to be disabled/enabled */
uint16_t event_filters;
/* Input transparent data: */
/* Parameters size */
uint16_t params_data_size;
/* Pointer to the parameters */
uint8_t *params_data;
/* Output parameters: */
/* Pointer (write index) to the end of ready US data region */
/* in the shared memory */
uint32_t ready_region;
};
struct us_rx_update_info_type {
/* Input general: */
/* Pointer (write index) to the end of ready US data region */
/* in the shared memory */
uint32_t ready_region;
/* Input transparent data: */
/* Parameters size */
uint16_t params_data_size;
/* pPointer to the parameters */
uint8_t *params_data;
/* Output parameters: */
/* Pointer (read index) to the end of available region */
/* in the shared US data memory */
uint32_t free_region;
};
struct us_detect_info_type {
/* US detection place (HW|FW) */
/* NA in the Active and OFF states */
enum us_detect_place_enum us_detector;
/* US detection mode */
enum us_detect_mode_enum us_detect_mode;
/* US data dropped during this time (msec) */
uint32_t skip_time;
/* Transparent data size */
uint16_t params_data_size;
/* Pointer to the transparent data */
uint8_t *params_data;
/* Time (sec) to wait for US presence event */
uint32_t detect_timeout;
/* Out parameter: US presence */
bool is_us;
};
struct us_version_info_type {
/* Size of memory for the version string */
uint16_t buf_size;
/* Pointer to the memory for the version string */
char *pbuf;
};
#endif /* __USF_H__ */