mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
Merge branch 'cm-14.1' into followmsi-nougat
This commit is contained in:
commit
8618c0f416
15 changed files with 124 additions and 837 deletions
|
@ -32,6 +32,7 @@
|
|||
static struct dentry *clients;
|
||||
static struct dentry *dir;
|
||||
static DEFINE_MUTEX(msm_bus_dbg_fablist_lock);
|
||||
static DEFINE_MUTEX(msm_bus_dbg_cllist_lock);
|
||||
struct msm_bus_dbg_state {
|
||||
uint32_t cl;
|
||||
uint8_t enable;
|
||||
|
@ -275,16 +276,21 @@ static ssize_t client_data_read(struct file *file, char __user *buf,
|
|||
size_t count, loff_t *ppos)
|
||||
{
|
||||
int bsize = 0;
|
||||
ssize_t read_count = 0;
|
||||
uint32_t cl = (uint32_t)file->private_data;
|
||||
struct msm_bus_cldata *cldata = NULL;
|
||||
|
||||
mutex_lock(&msm_bus_dbg_cllist_lock);
|
||||
list_for_each_entry(cldata, &cl_list, list) {
|
||||
if (cldata->clid == cl)
|
||||
if (cldata->clid == cl) {
|
||||
bsize = cldata->size;
|
||||
read_count = simple_read_from_buffer(buf, count, ppos,
|
||||
cldata->buffer, bsize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bsize = cldata->size;
|
||||
return simple_read_from_buffer(buf, count, ppos,
|
||||
cldata->buffer, bsize);
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
return read_count;
|
||||
}
|
||||
|
||||
static int client_data_open(struct inode *inode, struct file *file)
|
||||
|
@ -314,9 +320,11 @@ static int msm_bus_dbg_record_client(const struct msm_bus_scale_pdata *pdata,
|
|||
{
|
||||
struct msm_bus_cldata *cldata;
|
||||
|
||||
mutex_lock(&msm_bus_dbg_cllist_lock);
|
||||
cldata = kmalloc(sizeof(struct msm_bus_cldata), GFP_KERNEL);
|
||||
if (!cldata) {
|
||||
MSM_BUS_DBG("Failed to allocate memory for client data\n");
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
cldata->pdata = pdata;
|
||||
|
@ -325,6 +333,7 @@ static int msm_bus_dbg_record_client(const struct msm_bus_scale_pdata *pdata,
|
|||
cldata->file = file;
|
||||
cldata->size = 0;
|
||||
list_add_tail(&cldata->list, &cl_list);
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -332,6 +341,7 @@ static void msm_bus_dbg_free_client(uint32_t clid)
|
|||
{
|
||||
struct msm_bus_cldata *cldata = NULL;
|
||||
|
||||
mutex_lock(&msm_bus_dbg_cllist_lock);
|
||||
list_for_each_entry(cldata, &cl_list, list) {
|
||||
if (cldata->clid == clid) {
|
||||
debugfs_remove(cldata->file);
|
||||
|
@ -340,23 +350,34 @@ static void msm_bus_dbg_free_client(uint32_t clid)
|
|||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
}
|
||||
|
||||
static int msm_bus_dbg_fill_cl_buffer(const struct msm_bus_scale_pdata *pdata,
|
||||
int index, uint32_t clid)
|
||||
{
|
||||
int i = 0, j;
|
||||
int i = 0, j, found = 0;
|
||||
char *buf = NULL;
|
||||
struct msm_bus_cldata *cldata = NULL;
|
||||
struct timespec ts;
|
||||
|
||||
mutex_lock(&msm_bus_dbg_cllist_lock);
|
||||
list_for_each_entry(cldata, &cl_list, list) {
|
||||
if (cldata->clid == clid)
|
||||
if (cldata->clid == clid) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
MSM_BUS_DBG("Client(clid=%d) doesn't exist\n", clid);
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (cldata->file == NULL) {
|
||||
if (pdata->name == NULL) {
|
||||
MSM_BUS_DBG("Client doesn't have a name\n");
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
cldata->file = msm_bus_dbg_create(pdata->name, S_IRUGO,
|
||||
|
@ -394,6 +415,9 @@ static int msm_bus_dbg_fill_cl_buffer(const struct msm_bus_scale_pdata *pdata,
|
|||
i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\n");
|
||||
|
||||
cldata->size = i;
|
||||
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -430,6 +454,7 @@ static ssize_t msm_bus_dbg_update_request_write(struct file *file,
|
|||
chid = buf;
|
||||
MSM_BUS_DBG("buffer: %s\n size: %d\n", buf, sizeof(ubuf));
|
||||
|
||||
mutex_lock(&msm_bus_dbg_cllist_lock);
|
||||
list_for_each_entry(cldata, &cl_list, list) {
|
||||
if (strstr(chid, cldata->pdata->name)) {
|
||||
cldata = cldata;
|
||||
|
@ -439,16 +464,19 @@ static ssize_t msm_bus_dbg_update_request_write(struct file *file,
|
|||
if (ret) {
|
||||
MSM_BUS_DBG("Index conversion"
|
||||
" failed\n");
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
return -EFAULT;
|
||||
}
|
||||
} else
|
||||
MSM_BUS_DBG("Error parsing input. Index not"
|
||||
" found\n");
|
||||
msm_bus_dbg_update_request(cldata, index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
msm_bus_dbg_update_request(cldata, index);
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
|
||||
kfree(buf);
|
||||
return cnt;
|
||||
}
|
||||
|
@ -462,17 +490,18 @@ static ssize_t fabric_data_read(struct file *file, char __user *buf,
|
|||
{
|
||||
struct msm_bus_fab_list *fablist = NULL;
|
||||
int bsize = 0;
|
||||
ssize_t ret;
|
||||
ssize_t ret = 0;
|
||||
const char *name = file->private_data;
|
||||
|
||||
mutex_lock(&msm_bus_dbg_fablist_lock);
|
||||
list_for_each_entry(fablist, &fabdata_list, list) {
|
||||
if (strcmp(fablist->name, name) == 0)
|
||||
if (strcmp(fablist->name, name) == 0) {
|
||||
bsize = fablist->size;
|
||||
ret = simple_read_from_buffer(buf, count, ppos,
|
||||
fablist->buffer, bsize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bsize = fablist->size;
|
||||
ret = simple_read_from_buffer(buf, count, ppos,
|
||||
fablist->buffer, bsize);
|
||||
mutex_unlock(&msm_bus_dbg_fablist_lock);
|
||||
return ret;
|
||||
}
|
||||
|
@ -523,16 +552,25 @@ static int msm_bus_dbg_fill_fab_buffer(const char *fabname,
|
|||
void *cdata, int nmasters, int nslaves,
|
||||
int ntslaves)
|
||||
{
|
||||
int i;
|
||||
int i, found = 0;
|
||||
char *buf = NULL;
|
||||
struct msm_bus_fab_list *fablist = NULL;
|
||||
struct timespec ts;
|
||||
|
||||
mutex_lock(&msm_bus_dbg_fablist_lock);
|
||||
list_for_each_entry(fablist, &fabdata_list, list) {
|
||||
if (strcmp(fablist->name, fabname) == 0)
|
||||
if (strcmp(fablist->name, fabname) == 0) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
MSM_BUS_DBG("Fabric dbg entry %s does not exist\n", fabname);
|
||||
mutex_unlock(&msm_bus_dbg_fablist_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (fablist->file == NULL) {
|
||||
MSM_BUS_DBG("Fabric dbg entry does not exist\n");
|
||||
mutex_unlock(&msm_bus_dbg_fablist_lock);
|
||||
|
@ -546,7 +584,6 @@ static int msm_bus_dbg_fill_fab_buffer(const char *fabname,
|
|||
fablist->size = 0;
|
||||
}
|
||||
buf = fablist->buffer;
|
||||
mutex_unlock(&msm_bus_dbg_fablist_lock);
|
||||
ts = ktime_to_timespec(ktime_get());
|
||||
i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\n%d.%d\n",
|
||||
(int)ts.tv_sec, (int)ts.tv_nsec);
|
||||
|
@ -554,7 +591,6 @@ static int msm_bus_dbg_fill_fab_buffer(const char *fabname,
|
|||
msm_bus_rpm_fill_cdata_buffer(&i, buf, MAX_BUFF_SIZE, cdata,
|
||||
nmasters, nslaves, ntslaves);
|
||||
i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\n");
|
||||
mutex_lock(&msm_bus_dbg_fablist_lock);
|
||||
fablist->size = i;
|
||||
mutex_unlock(&msm_bus_dbg_fablist_lock);
|
||||
return 0;
|
||||
|
@ -664,6 +700,7 @@ static int __init msm_bus_debugfs_init(void)
|
|||
clients, NULL, &msm_bus_dbg_update_request_fops) == NULL)
|
||||
goto err;
|
||||
|
||||
mutex_lock(&msm_bus_dbg_cllist_lock);
|
||||
list_for_each_entry(cldata, &cl_list, list) {
|
||||
if (cldata->pdata->name == NULL) {
|
||||
MSM_BUS_DBG("Client name not found\n");
|
||||
|
@ -672,6 +709,7 @@ static int __init msm_bus_debugfs_init(void)
|
|||
cldata->file = msm_bus_dbg_create(cldata->
|
||||
pdata->name, S_IRUGO, clients, cldata->clid);
|
||||
}
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
|
||||
mutex_lock(&msm_bus_dbg_fablist_lock);
|
||||
list_for_each_entry(fablist, &fabdata_list, list) {
|
||||
|
@ -698,10 +736,13 @@ static void __exit msm_bus_dbg_teardown(void)
|
|||
struct msm_bus_cldata *cldata = NULL, *cldata_temp;
|
||||
|
||||
debugfs_remove_recursive(dir);
|
||||
mutex_lock(&msm_bus_dbg_cllist_lock);
|
||||
list_for_each_entry_safe(cldata, cldata_temp, &cl_list, list) {
|
||||
list_del(&cldata->list);
|
||||
kfree(cldata);
|
||||
}
|
||||
mutex_unlock(&msm_bus_dbg_cllist_lock);
|
||||
|
||||
mutex_lock(&msm_bus_dbg_fablist_lock);
|
||||
list_for_each_entry_safe(fablist, fablist_temp, &fabdata_list, list) {
|
||||
list_del(&fablist->list);
|
||||
|
|
|
@ -140,7 +140,10 @@ static int audio_aio_ion_lookup_vaddr(struct q6audio_aio *audio, void *addr,
|
|||
list_for_each_entry(region_elt, &audio->ion_region_queue, list) {
|
||||
if (addr >= region_elt->vaddr &&
|
||||
addr < region_elt->vaddr + region_elt->len &&
|
||||
addr + len <= region_elt->vaddr + region_elt->len) {
|
||||
addr + len <= region_elt->vaddr + region_elt->len &&
|
||||
addr+len > addr) {
|
||||
/* to avoid integer addition overflow */
|
||||
|
||||
/* offset since we could pass vaddr inside a registerd
|
||||
* ion buffer
|
||||
*/
|
||||
|
|
|
@ -310,7 +310,7 @@ err:
|
|||
* global one. Requires architecture specific get_dev_cma_area() helper
|
||||
* function.
|
||||
*/
|
||||
struct page *dma_alloc_from_contiguous(struct device *dev, int count,
|
||||
struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
|
||||
unsigned int align)
|
||||
{
|
||||
unsigned long mask, pfn, pageno, start = 0;
|
||||
|
|
|
@ -753,11 +753,9 @@ static int msm_open(struct file *filep)
|
|||
BUG_ON(!pvdev);
|
||||
|
||||
/* !!! only ONE open is allowed !!! */
|
||||
if (atomic_read(&pvdev->opened))
|
||||
if (atomic_cmpxchg(&pvdev->opened, 0, 1))
|
||||
return -EBUSY;
|
||||
|
||||
atomic_set(&pvdev->opened, 1);
|
||||
|
||||
spin_lock_irqsave(&msm_pid_lock, flags);
|
||||
msm_pid = get_pid(task_pid(current));
|
||||
spin_unlock_irqrestore(&msm_pid_lock, flags);
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/shmem_fs.h>
|
||||
#include <linux/ashmem.h>
|
||||
#include <asm/cacheflush.h>
|
||||
|
||||
#define ASHMEM_NAME_PREFIX "dev/ashmem/"
|
||||
#define ASHMEM_NAME_PREFIX_LEN (sizeof(ASHMEM_NAME_PREFIX) - 1)
|
||||
|
@ -681,51 +680,6 @@ done:
|
|||
}
|
||||
#endif
|
||||
|
||||
static int ashmem_cache_op(struct ashmem_area *asma,
|
||||
void (*cache_func)(unsigned long vstart, unsigned long length,
|
||||
unsigned long pstart))
|
||||
{
|
||||
int ret = 0;
|
||||
struct vm_area_struct *vma;
|
||||
#ifdef CONFIG_OUTER_CACHE
|
||||
unsigned long vaddr;
|
||||
#endif
|
||||
if (!asma->vm_start)
|
||||
return -EINVAL;
|
||||
|
||||
down_read(¤t->mm->mmap_sem);
|
||||
vma = find_vma(current->mm, asma->vm_start);
|
||||
if (!vma) {
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if (vma->vm_file != asma->file) {
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if ((asma->vm_start + asma->size) > vma->vm_end) {
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
#ifndef CONFIG_OUTER_CACHE
|
||||
cache_func(asma->vm_start, asma->size, 0);
|
||||
#else
|
||||
for (vaddr = asma->vm_start; vaddr < asma->vm_start + asma->size;
|
||||
vaddr += PAGE_SIZE) {
|
||||
unsigned long physaddr;
|
||||
physaddr = virtaddr_to_physaddr(vaddr);
|
||||
if (!physaddr)
|
||||
return -EINVAL;
|
||||
cache_func(vaddr, PAGE_SIZE, physaddr);
|
||||
}
|
||||
#endif
|
||||
done:
|
||||
up_read(¤t->mm->mmap_sem);
|
||||
if (ret)
|
||||
asma->vm_start = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct ashmem_area *asma = file->private_data;
|
||||
|
@ -771,15 +725,6 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
ashmem_shrink(&ashmem_shrinker, &sc);
|
||||
}
|
||||
break;
|
||||
case ASHMEM_CACHE_FLUSH_RANGE:
|
||||
ret = ashmem_cache_op(asma, &clean_and_invalidate_caches);
|
||||
break;
|
||||
case ASHMEM_CACHE_CLEAN_RANGE:
|
||||
ret = ashmem_cache_op(asma, &clean_caches);
|
||||
break;
|
||||
case ASHMEM_CACHE_INV_RANGE:
|
||||
ret = ashmem_cache_op(asma, &invalidate_caches);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -1507,6 +1507,7 @@ static int do_execve_common(const char *filename,
|
|||
bool clear_in_exec;
|
||||
int retval;
|
||||
const struct cred *cred = current_cred();
|
||||
bool is_su;
|
||||
|
||||
/*
|
||||
* We move the actual failure in case of RLIMIT_NPROC excess from
|
||||
|
@ -1583,11 +1584,14 @@ static int do_execve_common(const char *filename,
|
|||
if (retval < 0)
|
||||
goto out;
|
||||
|
||||
/* search_binary_handler can release file and it may be freed */
|
||||
is_su = d_is_su(file->f_dentry);
|
||||
|
||||
retval = search_binary_handler(bprm,regs);
|
||||
if (retval < 0)
|
||||
goto out;
|
||||
|
||||
if (d_is_su(file->f_dentry) && capable(CAP_SYS_ADMIN)) {
|
||||
if (is_su && capable(CAP_SYS_ADMIN)) {
|
||||
current->flags |= PF_SU;
|
||||
su_exec();
|
||||
}
|
||||
|
|
|
@ -44,9 +44,6 @@ struct ashmem_pin {
|
|||
#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
|
||||
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
|
||||
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
|
||||
#define ASHMEM_CACHE_FLUSH_RANGE _IO(__ASHMEMIOC, 11)
|
||||
#define ASHMEM_CACHE_CLEAN_RANGE _IO(__ASHMEMIOC, 12)
|
||||
#define ASHMEM_CACHE_INV_RANGE _IO(__ASHMEMIOC, 13)
|
||||
|
||||
int get_ashmem_file(int fd, struct file **filp, struct file **vm_file,
|
||||
unsigned long *len);
|
||||
|
|
|
@ -71,7 +71,7 @@ void dma_contiguous_reserve(phys_addr_t addr_limit);
|
|||
int dma_declare_contiguous(struct device *dev, unsigned long size,
|
||||
phys_addr_t base, phys_addr_t limit);
|
||||
|
||||
struct page *dma_alloc_from_contiguous(struct device *dev, int count,
|
||||
struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
|
||||
unsigned int order);
|
||||
bool dma_release_from_contiguous(struct device *dev, struct page *pages,
|
||||
int count);
|
||||
|
@ -90,7 +90,7 @@ int dma_declare_contiguous(struct device *dev, unsigned long size,
|
|||
}
|
||||
|
||||
static inline
|
||||
struct page *dma_alloc_from_contiguous(struct device *dev, int count,
|
||||
struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
|
||||
unsigned int order)
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
@ -670,7 +670,7 @@ void l2cap_cleanup_sockets(void);
|
|||
|
||||
u8 l2cap_get_ident(struct l2cap_conn *conn);
|
||||
void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data);
|
||||
int l2cap_build_conf_req(struct sock *sk, void *data);
|
||||
int l2cap_build_conf_req(struct sock *sk, void *data, size_t data_size);
|
||||
int __l2cap_wait_ack(struct sock *sk);
|
||||
|
||||
struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len);
|
||||
|
|
|
@ -926,7 +926,7 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
|
|||
|
||||
l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
|
||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||
l2cap_build_conf_req(sk, buf), buf);
|
||||
l2cap_build_conf_req(sk, buf, sizeof(buf)), buf);
|
||||
l2cap_pi(sk)->num_conf_req++;
|
||||
}
|
||||
|
||||
|
@ -2915,12 +2915,15 @@ static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned
|
|||
return len;
|
||||
}
|
||||
|
||||
static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val)
|
||||
static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val, size_t size)
|
||||
{
|
||||
struct l2cap_conf_opt *opt = *ptr;
|
||||
|
||||
BT_DBG("type 0x%2.2x len %d val 0x%lx", type, len, val);
|
||||
|
||||
if (size < L2CAP_CONF_OPT_SIZE + len)
|
||||
return;
|
||||
|
||||
opt->type = type;
|
||||
opt->len = len;
|
||||
|
||||
|
@ -3304,12 +3307,13 @@ static void l2cap_get_ertm_timeouts(struct l2cap_conf_rfc *rfc,
|
|||
}
|
||||
}
|
||||
|
||||
int l2cap_build_conf_req(struct sock *sk, void *data)
|
||||
int l2cap_build_conf_req(struct sock *sk, void *data, size_t data_size)
|
||||
{
|
||||
struct l2cap_pinfo *pi = l2cap_pi(sk);
|
||||
struct l2cap_conf_req *req = data;
|
||||
struct l2cap_conf_rfc rfc = { .mode = pi->mode };
|
||||
void *ptr = req->data;
|
||||
void *endptr = data + data_size;
|
||||
|
||||
BT_DBG("sk %p mode %d", sk, pi->mode);
|
||||
|
||||
|
@ -3330,7 +3334,7 @@ int l2cap_build_conf_req(struct sock *sk, void *data)
|
|||
|
||||
done:
|
||||
if (pi->imtu != L2CAP_DEFAULT_MTU)
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu, endptr - ptr);
|
||||
|
||||
switch (pi->mode) {
|
||||
case L2CAP_MODE_BASIC:
|
||||
|
@ -3344,7 +3348,7 @@ done:
|
|||
rfc.max_pdu_size = 0;
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
|
||||
(unsigned long) &rfc);
|
||||
(unsigned long) &rfc, endptr - ptr);
|
||||
break;
|
||||
|
||||
case L2CAP_MODE_ERTM:
|
||||
|
@ -3361,12 +3365,12 @@ done:
|
|||
rfc.max_pdu_size = cpu_to_le16(pi->imtu);
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
|
||||
(unsigned long) &rfc);
|
||||
(unsigned long) &rfc, endptr - ptr);
|
||||
|
||||
if ((pi->conn->feat_mask & L2CAP_FEAT_EXT_WINDOW) &&
|
||||
pi->extended_control) {
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EXT_WINDOW, 2,
|
||||
pi->tx_win);
|
||||
pi->tx_win, endptr - ptr);
|
||||
}
|
||||
|
||||
if (pi->amp_id) {
|
||||
|
@ -3374,7 +3378,7 @@ done:
|
|||
struct l2cap_conf_ext_fs fs = {1, 1, 0xFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EXT_FS,
|
||||
sizeof(fs), (unsigned long) &fs);
|
||||
sizeof(fs), (unsigned long) &fs, endptr - ptr);
|
||||
}
|
||||
|
||||
if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS))
|
||||
|
@ -3383,7 +3387,7 @@ done:
|
|||
if (pi->fcs == L2CAP_FCS_NONE ||
|
||||
pi->conf_state & L2CAP_CONF_NO_FCS_RECV) {
|
||||
pi->fcs = L2CAP_FCS_NONE;
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, pi->fcs);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, pi->fcs, endptr - ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -3398,11 +3402,11 @@ done:
|
|||
rfc.max_pdu_size = cpu_to_le16(pi->imtu);
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
|
||||
(unsigned long) &rfc);
|
||||
(unsigned long) &rfc, endptr - ptr);
|
||||
|
||||
if ((pi->conn->feat_mask & L2CAP_FEAT_EXT_WINDOW) &&
|
||||
pi->extended_control) {
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EXT_WINDOW, 2, 0);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EXT_WINDOW, 2, 0, endptr - ptr);
|
||||
}
|
||||
|
||||
if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS))
|
||||
|
@ -3411,7 +3415,7 @@ done:
|
|||
if (pi->fcs == L2CAP_FCS_NONE ||
|
||||
pi->conf_state & L2CAP_CONF_NO_FCS_RECV) {
|
||||
pi->fcs = L2CAP_FCS_NONE;
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, pi->fcs);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, pi->fcs, endptr - ptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3423,12 +3427,13 @@ done:
|
|||
}
|
||||
|
||||
|
||||
static int l2cap_build_amp_reconf_req(struct sock *sk, void *data)
|
||||
static int l2cap_build_amp_reconf_req(struct sock *sk, void *data, size_t data_size)
|
||||
{
|
||||
struct l2cap_pinfo *pi = l2cap_pi(sk);
|
||||
struct l2cap_conf_req *req = data;
|
||||
struct l2cap_conf_rfc rfc = { .mode = pi->mode };
|
||||
void *ptr = req->data;
|
||||
void *endptr = data + data_size;
|
||||
|
||||
BT_DBG("sk %p", sk);
|
||||
|
||||
|
@ -3449,7 +3454,7 @@ static int l2cap_build_amp_reconf_req(struct sock *sk, void *data)
|
|||
}
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
|
||||
(unsigned long) &rfc);
|
||||
(unsigned long) &rfc, endptr - ptr);
|
||||
|
||||
if (pi->conn->feat_mask & L2CAP_FEAT_FCS) {
|
||||
/* TODO assign fcs for br/edr based on socket config option */
|
||||
|
@ -3460,7 +3465,7 @@ static int l2cap_build_amp_reconf_req(struct sock *sk, void *data)
|
|||
else
|
||||
pi->local_conf.fcs = L2CAP_FCS_CRC16;
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, pi->local_conf.fcs);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, pi->local_conf.fcs, endptr - ptr);
|
||||
pi->fcs = pi->local_conf.fcs | pi->remote_conf.fcs;
|
||||
}
|
||||
|
||||
|
@ -3470,11 +3475,12 @@ static int l2cap_build_amp_reconf_req(struct sock *sk, void *data)
|
|||
return ptr - data;
|
||||
}
|
||||
|
||||
static int l2cap_parse_conf_req(struct sock *sk, void *data)
|
||||
static int l2cap_parse_conf_req(struct sock *sk, void *data, size_t data_size)
|
||||
{
|
||||
struct l2cap_pinfo *pi = l2cap_pi(sk);
|
||||
struct l2cap_conf_rsp *rsp = data;
|
||||
void *ptr = rsp->data;
|
||||
void *endptr = data + data_size;
|
||||
void *req = pi->conf_req;
|
||||
int len = pi->conf_len;
|
||||
int type, hint, olen;
|
||||
|
@ -3597,7 +3603,8 @@ done:
|
|||
return -ECONNREFUSED;
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
||||
sizeof(rfc), (unsigned long) &rfc);
|
||||
sizeof(rfc), (unsigned long) &rfc,
|
||||
endptr - ptr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3616,7 +3623,7 @@ done:
|
|||
pi->omtu = mtu;
|
||||
pi->conf_state |= L2CAP_CONF_MTU_DONE;
|
||||
}
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu, endptr - ptr);
|
||||
|
||||
switch (rfc.mode) {
|
||||
case L2CAP_MODE_BASIC:
|
||||
|
@ -3634,11 +3641,11 @@ done:
|
|||
pi->conf_state |= L2CAP_CONF_MODE_DONE;
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
||||
sizeof(rfc), (unsigned long) &rfc);
|
||||
sizeof(rfc), (unsigned long) &rfc, endptr - ptr);
|
||||
|
||||
if (pi->conf_state & L2CAP_CONF_LOCKSTEP)
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EXT_FS,
|
||||
sizeof(fs), (unsigned long) &fs);
|
||||
sizeof(fs), (unsigned long) &fs, endptr - ptr);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -3648,7 +3655,7 @@ done:
|
|||
pi->conf_state |= L2CAP_CONF_MODE_DONE;
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
||||
sizeof(rfc), (unsigned long) &rfc);
|
||||
sizeof(rfc), (unsigned long) &rfc, endptr - ptr);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -3688,11 +3695,12 @@ done:
|
|||
return ptr - data;
|
||||
}
|
||||
|
||||
static int l2cap_parse_amp_move_reconf_req(struct sock *sk, void *data)
|
||||
static int l2cap_parse_amp_move_reconf_req(struct sock *sk, void *data, size_t data_size)
|
||||
{
|
||||
struct l2cap_pinfo *pi = l2cap_pi(sk);
|
||||
struct l2cap_conf_rsp *rsp = data;
|
||||
void *ptr = rsp->data;
|
||||
void *endptr = data + data_size;
|
||||
void *req = pi->conf_req;
|
||||
int len = pi->conf_len;
|
||||
int type, hint, olen;
|
||||
|
@ -3779,13 +3787,13 @@ static int l2cap_parse_amp_move_reconf_req(struct sock *sk, void *data)
|
|||
|
||||
BT_DBG("mtu %d omtu %d", mtu, pi->omtu);
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu, endptr - ptr);
|
||||
|
||||
/* Don't allow extended transmit window to change. */
|
||||
if (tx_win != pi->remote_tx_win) {
|
||||
result = L2CAP_CONF_UNACCEPT;
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EXT_WINDOW, 2,
|
||||
pi->remote_tx_win);
|
||||
pi->remote_tx_win, endptr - ptr);
|
||||
}
|
||||
|
||||
pi->remote_mps = rfc.max_pdu_size;
|
||||
|
@ -3798,7 +3806,7 @@ static int l2cap_parse_amp_move_reconf_req(struct sock *sk, void *data)
|
|||
}
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
||||
sizeof(rfc), (unsigned long) &rfc);
|
||||
sizeof(rfc), (unsigned long) &rfc, endptr - ptr);
|
||||
}
|
||||
|
||||
if (result != L2CAP_CONF_SUCCESS)
|
||||
|
@ -3817,11 +3825,12 @@ done:
|
|||
return ptr - data;
|
||||
}
|
||||
|
||||
static int l2cap_parse_conf_rsp(struct sock *sk, void *rsp, int len, void *data, u16 *result)
|
||||
static int l2cap_parse_conf_rsp(struct sock *sk, void *rsp, int len, void *data, size_t size, u16 *result)
|
||||
{
|
||||
struct l2cap_pinfo *pi = l2cap_pi(sk);
|
||||
struct l2cap_conf_req *req = data;
|
||||
void *ptr = req->data;
|
||||
void *endptr = data + size;
|
||||
int type, olen;
|
||||
unsigned long val;
|
||||
struct l2cap_conf_rfc rfc;
|
||||
|
@ -3844,13 +3853,13 @@ static int l2cap_parse_conf_rsp(struct sock *sk, void *rsp, int len, void *data,
|
|||
pi->imtu = L2CAP_DEFAULT_MIN_MTU;
|
||||
} else
|
||||
pi->imtu = val;
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu, endptr - ptr);
|
||||
break;
|
||||
|
||||
case L2CAP_CONF_FLUSH_TO:
|
||||
pi->flush_to = val;
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO,
|
||||
2, pi->flush_to);
|
||||
2, pi->flush_to, endptr - ptr);
|
||||
break;
|
||||
|
||||
case L2CAP_CONF_RFC:
|
||||
|
@ -3864,14 +3873,14 @@ static int l2cap_parse_conf_rsp(struct sock *sk, void *rsp, int len, void *data,
|
|||
pi->fcs = 0;
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
||||
sizeof(rfc), (unsigned long) &rfc);
|
||||
sizeof(rfc), (unsigned long) &rfc, endptr - ptr);
|
||||
break;
|
||||
|
||||
case L2CAP_CONF_EXT_WINDOW:
|
||||
pi->ack_win = min_t(u16, val, pi->ack_win);
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EXT_WINDOW,
|
||||
2, pi->tx_win);
|
||||
2, pi->tx_win, endptr - ptr);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -4242,7 +4251,7 @@ sendresp:
|
|||
u8 buf[128];
|
||||
l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
|
||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||
l2cap_build_conf_req(sk, buf), buf);
|
||||
l2cap_build_conf_req(sk, buf, sizeof(buf)), buf);
|
||||
l2cap_pi(sk)->num_conf_req++;
|
||||
}
|
||||
|
||||
|
@ -4293,7 +4302,7 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
|
|||
l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
|
||||
|
||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||
l2cap_build_conf_req(sk, req), req);
|
||||
l2cap_build_conf_req(sk, req, sizeof(req)), req);
|
||||
l2cap_pi(sk)->num_conf_req++;
|
||||
break;
|
||||
|
||||
|
@ -4397,9 +4406,9 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
|
|||
|
||||
/* Complete config. */
|
||||
if (!amp_move_reconf)
|
||||
len = l2cap_parse_conf_req(sk, rspbuf);
|
||||
len = l2cap_parse_conf_req(sk, rspbuf, sizeof(rspbuf));
|
||||
else
|
||||
len = l2cap_parse_amp_move_reconf_req(sk, rspbuf);
|
||||
len = l2cap_parse_amp_move_reconf_req(sk, rspbuf, sizeof(rspbuf));
|
||||
|
||||
if (len < 0) {
|
||||
l2cap_send_disconn_req(conn, sk, ECONNRESET);
|
||||
|
@ -4448,7 +4457,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
|
|||
u8 buf[64];
|
||||
l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
|
||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||
l2cap_build_conf_req(sk, buf), buf);
|
||||
l2cap_build_conf_req(sk, buf, sizeof(buf)), buf);
|
||||
l2cap_pi(sk)->num_conf_req++;
|
||||
}
|
||||
|
||||
|
@ -4540,7 +4549,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
|
|||
/* throw out any old stored conf requests */
|
||||
result = L2CAP_CONF_SUCCESS;
|
||||
len = l2cap_parse_conf_rsp(sk, rsp->data,
|
||||
len, req, &result);
|
||||
len, req, sizeof(req), &result);
|
||||
if (len < 0) {
|
||||
l2cap_send_disconn_req(conn, sk, ECONNRESET);
|
||||
goto done;
|
||||
|
@ -5340,7 +5349,7 @@ void l2cap_amp_physical_complete(int result, u8 local_id, u8 remote_id,
|
|||
l2cap_send_cmd(pi->conn,
|
||||
l2cap_get_ident(pi->conn),
|
||||
L2CAP_CONF_REQ,
|
||||
l2cap_build_conf_req(sk, buf), buf);
|
||||
l2cap_build_conf_req(sk, buf, sizeof(buf)), buf);
|
||||
l2cap_pi(sk)->num_conf_req++;
|
||||
}
|
||||
} else {
|
||||
|
@ -6902,7 +6911,7 @@ static int l2cap_amp_move_reconf(struct sock *sk)
|
|||
pi = l2cap_pi(sk);
|
||||
|
||||
l2cap_send_cmd(pi->conn, l2cap_get_ident(pi->conn), L2CAP_CONF_REQ,
|
||||
l2cap_build_amp_reconf_req(sk, buf), buf);
|
||||
l2cap_build_amp_reconf_req(sk, buf, sizeof(buf)), buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -7637,7 +7646,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
|
|||
l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
|
||||
l2cap_send_cmd(conn, l2cap_get_ident(conn),
|
||||
L2CAP_CONF_REQ,
|
||||
l2cap_build_conf_req(sk, buf),
|
||||
l2cap_build_conf_req(sk, buf, sizeof(buf)),
|
||||
buf);
|
||||
l2cap_pi(sk)->num_conf_req++;
|
||||
}
|
||||
|
|
|
@ -1035,7 +1035,7 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms
|
|||
|
||||
l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
|
||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
|
||||
l2cap_build_conf_req(sk, buf), buf);
|
||||
l2cap_build_conf_req(sk, buf, sizeof(buf)), buf);
|
||||
l2cap_pi(sk)->num_conf_req++;
|
||||
|
||||
release_sock(sk);
|
||||
|
|
|
@ -1194,11 +1194,10 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg)
|
|||
sipx->sipx_network = ipxif->if_netnum;
|
||||
memcpy(sipx->sipx_node, ipxif->if_node,
|
||||
sizeof(sipx->sipx_node));
|
||||
rc = -EFAULT;
|
||||
if (copy_to_user(arg, &ifr, sizeof(ifr)))
|
||||
break;
|
||||
ipxitf_put(ipxif);
|
||||
rc = 0;
|
||||
if (copy_to_user(arg, &ifr, sizeof(ifr)))
|
||||
rc = -EFAULT;
|
||||
ipxitf_put(ipxif);
|
||||
break;
|
||||
}
|
||||
case SIOCAIPXITFCRT:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
snd-soc-qdsp6v2-objs += msm-dai-q6-v2.o msm-pcm-q6-v2.o msm-pcm-routing-v2.o msm-compr-q6-v2.o msm-multi-ch-pcm-q6-v2.o
|
||||
snd-soc-qdsp6v2-objs += msm-dai-q6-v2.o msm-pcm-q6-v2.o msm-pcm-routing-v2.o msm-multi-ch-pcm-q6-v2.o
|
||||
snd-soc-qdsp6v2-objs += msm-pcm-lpa-v2.o msm-pcm-afe-v2.o msm-pcm-voip-v2.o msm-pcm-voice-v2.o
|
||||
obj-$(CONFIG_SND_SOC_QDSP6V2) += snd-soc-qdsp6v2.o
|
||||
obj-y += q6adm.o q6afe.o q6asm.o q6audio-v2.o q6voice.o q6core.o
|
||||
|
|
|
@ -1,673 +0,0 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/soc-dapm.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/initval.h>
|
||||
#include <sound/control.h>
|
||||
#include <asm/dma.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/android_pmem.h>
|
||||
|
||||
#include "msm-compr-q6-v2.h"
|
||||
#include "msm-pcm-routing-v2.h"
|
||||
|
||||
struct snd_msm {
|
||||
struct msm_audio *prtd;
|
||||
unsigned volume;
|
||||
};
|
||||
static struct snd_msm compressed_audio = {NULL, 0x2000} ;
|
||||
|
||||
static struct audio_locks the_locks;
|
||||
|
||||
static struct snd_pcm_hardware msm_compr_hardware_playback = {
|
||||
.info = (SNDRV_PCM_INFO_MMAP |
|
||||
SNDRV_PCM_INFO_BLOCK_TRANSFER |
|
||||
SNDRV_PCM_INFO_MMAP_VALID |
|
||||
SNDRV_PCM_INFO_INTERLEAVED |
|
||||
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
|
||||
.formats = SNDRV_PCM_FMTBIT_S16_LE,
|
||||
.rates = SNDRV_PCM_RATE_8000_48000,
|
||||
.rate_min = 8000,
|
||||
.rate_max = 48000,
|
||||
.channels_min = 1,
|
||||
.channels_max = 2,
|
||||
.buffer_bytes_max = 1200 * 1024 * 2,
|
||||
.period_bytes_min = 4800,
|
||||
.period_bytes_max = 1200 * 1024,
|
||||
.periods_min = 2,
|
||||
.periods_max = 512,
|
||||
.fifo_size = 0,
|
||||
};
|
||||
|
||||
/* Conventional and unconventional sample rate supported */
|
||||
static unsigned int supported_sample_rates[] = {
|
||||
8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000
|
||||
};
|
||||
|
||||
static struct snd_pcm_hw_constraint_list constraints_sample_rates = {
|
||||
.count = ARRAY_SIZE(supported_sample_rates),
|
||||
.list = supported_sample_rates,
|
||||
.mask = 0,
|
||||
};
|
||||
|
||||
static void compr_event_handler(uint32_t opcode,
|
||||
uint32_t token, uint32_t *payload, void *priv)
|
||||
{
|
||||
struct compr_audio *compr = priv;
|
||||
struct msm_audio *prtd = &compr->prtd;
|
||||
struct snd_pcm_substream *substream = prtd->substream;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct audio_aio_write_param param;
|
||||
struct audio_buffer *buf = NULL;
|
||||
int i = 0;
|
||||
|
||||
pr_debug("%s opcode =%08x\n", __func__, opcode);
|
||||
switch (opcode) {
|
||||
case ASM_DATA_EVENT_WRITE_DONE_V2: {
|
||||
uint32_t *ptrmem = (uint32_t *)¶m;
|
||||
pr_debug("ASM_DATA_EVENT_WRITE_DONE\n");
|
||||
pr_debug("Buffer Consumed = 0x%08x\n", *ptrmem);
|
||||
prtd->pcm_irq_pos += prtd->pcm_count;
|
||||
if (atomic_read(&prtd->start))
|
||||
snd_pcm_period_elapsed(substream);
|
||||
atomic_inc(&prtd->out_count);
|
||||
wake_up(&the_locks.write_wait);
|
||||
if (!atomic_read(&prtd->start)) {
|
||||
atomic_set(&prtd->pending_buffer, 1);
|
||||
break;
|
||||
} else
|
||||
atomic_set(&prtd->pending_buffer, 0);
|
||||
|
||||
if (runtime->status->hw_ptr >= runtime->control->appl_ptr)
|
||||
break;
|
||||
buf = prtd->audio_client->port[IN].buf;
|
||||
pr_debug("%s:writing %d bytes of buffer[%d] to dsp 2\n",
|
||||
__func__, prtd->pcm_count, prtd->out_head);
|
||||
pr_debug("%s:writing buffer[%d] from 0x%08x\n",
|
||||
__func__, prtd->out_head,
|
||||
((unsigned int)buf[0].phys
|
||||
+ (prtd->out_head * prtd->pcm_count)));
|
||||
|
||||
param.paddr = (unsigned long)buf[0].phys
|
||||
+ (prtd->out_head * prtd->pcm_count);
|
||||
param.len = prtd->pcm_count;
|
||||
param.msw_ts = 0;
|
||||
param.lsw_ts = 0;
|
||||
param.flags = NO_TIMESTAMP;
|
||||
param.uid = (unsigned long)buf[0].phys
|
||||
+ (prtd->out_head * prtd->pcm_count);
|
||||
for (i = 0; i < sizeof(struct audio_aio_write_param)/4;
|
||||
i++, ++ptrmem)
|
||||
pr_debug("cmd[%d]=0x%08x\n", i, *ptrmem);
|
||||
if (q6asm_async_write(prtd->audio_client,
|
||||
¶m) < 0)
|
||||
pr_err("%s:q6asm_async_write failed\n",
|
||||
__func__);
|
||||
else
|
||||
prtd->out_head =
|
||||
(prtd->out_head + 1) & (runtime->periods - 1);
|
||||
break;
|
||||
}
|
||||
case ASM_DATA_EVENT_RENDERED_EOS:
|
||||
pr_debug("ASM_DATA_CMDRSP_EOS\n");
|
||||
prtd->cmd_ack = 1;
|
||||
wake_up(&the_locks.eos_wait);
|
||||
break;
|
||||
case APR_BASIC_RSP_RESULT: {
|
||||
switch (payload[0]) {
|
||||
case ASM_SESSION_CMD_RUN_V2: {
|
||||
if (!atomic_read(&prtd->pending_buffer))
|
||||
break;
|
||||
pr_debug("%s:writing %d bytes of buffer[%d] to dsp\n",
|
||||
__func__, prtd->pcm_count, prtd->out_head);
|
||||
buf = prtd->audio_client->port[IN].buf;
|
||||
pr_debug("%s:writing buffer[%d] from 0x%08x\n",
|
||||
__func__, prtd->out_head,
|
||||
((unsigned int)buf[0].phys
|
||||
+ (prtd->out_head * prtd->pcm_count)));
|
||||
param.paddr = (unsigned long)buf[prtd->out_head].phys;
|
||||
param.len = prtd->pcm_count;
|
||||
param.msw_ts = 0;
|
||||
param.lsw_ts = 0;
|
||||
param.flags = NO_TIMESTAMP;
|
||||
param.uid = (unsigned long)buf[prtd->out_head].phys;
|
||||
if (q6asm_async_write(prtd->audio_client,
|
||||
¶m) < 0)
|
||||
pr_err("%s:q6asm_async_write failed\n",
|
||||
__func__);
|
||||
else
|
||||
prtd->out_head =
|
||||
(prtd->out_head + 1)
|
||||
& (runtime->periods - 1);
|
||||
atomic_set(&prtd->pending_buffer, 0);
|
||||
}
|
||||
break;
|
||||
case ASM_STREAM_CMD_FLUSH:
|
||||
pr_debug("ASM_STREAM_CMD_FLUSH\n");
|
||||
prtd->cmd_ack = 1;
|
||||
wake_up(&the_locks.eos_wait);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
pr_debug("Not Supported Event opcode[0x%x]\n", opcode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int msm_compr_playback_prepare(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct compr_audio *compr = runtime->private_data;
|
||||
struct msm_audio *prtd = &compr->prtd;
|
||||
struct asm_aac_cfg aac_cfg;
|
||||
int ret;
|
||||
|
||||
pr_debug("%s\n", __func__);
|
||||
prtd->pcm_size = snd_pcm_lib_buffer_bytes(substream);
|
||||
prtd->pcm_count = snd_pcm_lib_period_bytes(substream);
|
||||
prtd->pcm_irq_pos = 0;
|
||||
/* rate and channels are sent to audio driver */
|
||||
prtd->samp_rate = runtime->rate;
|
||||
prtd->channel_mode = runtime->channels;
|
||||
prtd->out_head = 0;
|
||||
atomic_set(&prtd->out_count, runtime->periods);
|
||||
|
||||
if (prtd->enabled)
|
||||
return 0;
|
||||
|
||||
switch (compr->info.codec_param.codec.id) {
|
||||
case SND_AUDIOCODEC_MP3:
|
||||
/* No media format block for mp3 */
|
||||
break;
|
||||
case SND_AUDIOCODEC_AAC:
|
||||
pr_debug("SND_AUDIOCODEC_AAC\n");
|
||||
memset(&aac_cfg, 0x0, sizeof(struct asm_aac_cfg));
|
||||
aac_cfg.aot = AAC_ENC_MODE_EAAC_P;
|
||||
aac_cfg.format = 0x03;
|
||||
aac_cfg.ch_cfg = runtime->channels;
|
||||
aac_cfg.sample_rate = runtime->rate;
|
||||
ret = q6asm_media_format_block_aac(prtd->audio_client,
|
||||
&aac_cfg);
|
||||
if (ret < 0)
|
||||
pr_err("%s: CMD Format block failed\n", __func__);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
prtd->enabled = 1;
|
||||
prtd->cmd_ack = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_compr_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
{
|
||||
int ret = 0;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct compr_audio *compr = runtime->private_data;
|
||||
struct msm_audio *prtd = &compr->prtd;
|
||||
|
||||
pr_debug("%s\n", __func__);
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
prtd->pcm_irq_pos = 0;
|
||||
case SNDRV_PCM_TRIGGER_RESUME:
|
||||
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||
pr_debug("%s: Trigger start\n", __func__);
|
||||
q6asm_run_nowait(prtd->audio_client, 0, 0, 0);
|
||||
atomic_set(&prtd->start, 1);
|
||||
break;
|
||||
case SNDRV_PCM_TRIGGER_STOP:
|
||||
pr_debug("SNDRV_PCM_TRIGGER_STOP\n");
|
||||
atomic_set(&prtd->start, 0);
|
||||
break;
|
||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
pr_debug("SNDRV_PCM_TRIGGER_PAUSE\n");
|
||||
q6asm_cmd_nowait(prtd->audio_client, CMD_PAUSE);
|
||||
atomic_set(&prtd->start, 0);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void populate_codec_list(struct compr_audio *compr,
|
||||
struct snd_pcm_runtime *runtime)
|
||||
{
|
||||
pr_debug("%s\n", __func__);
|
||||
/* MP3 Block */
|
||||
compr->info.compr_cap.num_codecs = 1;
|
||||
compr->info.compr_cap.min_fragment_size = runtime->hw.period_bytes_min;
|
||||
compr->info.compr_cap.max_fragment_size = runtime->hw.period_bytes_max;
|
||||
compr->info.compr_cap.min_fragments = runtime->hw.periods_min;
|
||||
compr->info.compr_cap.max_fragments = runtime->hw.periods_max;
|
||||
compr->info.compr_cap.codecs[0] = SND_AUDIOCODEC_MP3;
|
||||
compr->info.compr_cap.codecs[1] = SND_AUDIOCODEC_AAC;
|
||||
/* Add new codecs here */
|
||||
}
|
||||
|
||||
static int msm_compr_open(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct compr_audio *compr;
|
||||
struct msm_audio *prtd;
|
||||
int ret = 0;
|
||||
struct asm_softpause_params softpause = {
|
||||
.enable = SOFT_PAUSE_ENABLE,
|
||||
.period = SOFT_PAUSE_PERIOD,
|
||||
.step = SOFT_PAUSE_STEP,
|
||||
.rampingcurve = SOFT_PAUSE_CURVE_LINEAR,
|
||||
};
|
||||
struct asm_softvolume_params softvol = {
|
||||
.period = SOFT_VOLUME_PERIOD,
|
||||
.step = SOFT_VOLUME_STEP,
|
||||
.rampingcurve = SOFT_VOLUME_CURVE_LINEAR,
|
||||
};
|
||||
|
||||
/* Capture path */
|
||||
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
|
||||
return -EINVAL;
|
||||
|
||||
pr_debug("%s\n", __func__);
|
||||
compr = kzalloc(sizeof(struct compr_audio), GFP_KERNEL);
|
||||
if (compr == NULL) {
|
||||
pr_err("Failed to allocate memory for msm_audio\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
prtd = &compr->prtd;
|
||||
prtd->substream = substream;
|
||||
prtd->audio_client = q6asm_audio_client_alloc(
|
||||
(app_cb)compr_event_handler, compr);
|
||||
if (!prtd->audio_client) {
|
||||
pr_info("%s: Could not allocate memory\n", __func__);
|
||||
kfree(prtd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
runtime->hw = msm_compr_hardware_playback;
|
||||
|
||||
pr_info("%s: session ID %d\n", __func__, prtd->audio_client->session);
|
||||
|
||||
prtd->session_id = prtd->audio_client->session;
|
||||
prtd->cmd_ack = 1;
|
||||
|
||||
ret = snd_pcm_hw_constraint_list(runtime, 0,
|
||||
SNDRV_PCM_HW_PARAM_RATE,
|
||||
&constraints_sample_rates);
|
||||
if (ret < 0)
|
||||
pr_info("snd_pcm_hw_constraint_list failed\n");
|
||||
/* Ensure that buffer size is a multiple of period size */
|
||||
ret = snd_pcm_hw_constraint_integer(runtime,
|
||||
SNDRV_PCM_HW_PARAM_PERIODS);
|
||||
if (ret < 0)
|
||||
pr_info("snd_pcm_hw_constraint_integer failed\n");
|
||||
|
||||
prtd->dsp_cnt = 0;
|
||||
atomic_set(&prtd->pending_buffer, 1);
|
||||
compr->codec = FORMAT_MP3;
|
||||
populate_codec_list(compr, runtime);
|
||||
runtime->private_data = compr;
|
||||
compressed_audio.prtd = &compr->prtd;
|
||||
ret = compressed_set_volume(compressed_audio.volume);
|
||||
if (ret < 0)
|
||||
pr_err("%s : Set Volume failed : %d", __func__, ret);
|
||||
|
||||
ret = q6asm_set_softpause(compressed_audio.prtd->audio_client,
|
||||
&softpause);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Send SoftPause Param failed ret=%d\n",
|
||||
__func__, ret);
|
||||
ret = q6asm_set_softvolume(compressed_audio.prtd->audio_client,
|
||||
&softvol);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Send SoftVolume Param failed ret=%d\n",
|
||||
__func__, ret);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int compressed_set_volume(unsigned volume)
|
||||
{
|
||||
int rc = 0;
|
||||
if (compressed_audio.prtd && compressed_audio.prtd->audio_client) {
|
||||
rc = q6asm_set_volume(compressed_audio.prtd->audio_client,
|
||||
volume);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: Send Volume command failed rc=%d\n",
|
||||
__func__, rc);
|
||||
}
|
||||
}
|
||||
compressed_audio.volume = volume;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int msm_compr_playback_close(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
|
||||
struct compr_audio *compr = runtime->private_data;
|
||||
struct msm_audio *prtd = &compr->prtd;
|
||||
int dir = 0;
|
||||
|
||||
pr_debug("%s\n", __func__);
|
||||
|
||||
dir = IN;
|
||||
atomic_set(&prtd->pending_buffer, 0);
|
||||
q6asm_cmd(prtd->audio_client, CMD_CLOSE);
|
||||
compressed_audio.prtd = NULL;
|
||||
q6asm_audio_client_buf_free_contiguous(dir,
|
||||
prtd->audio_client);
|
||||
|
||||
msm_pcm_routing_dereg_phy_stream(soc_prtd->dai_link->be_id,
|
||||
SNDRV_PCM_STREAM_PLAYBACK);
|
||||
q6asm_audio_client_free(prtd->audio_client);
|
||||
kfree(prtd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_compr_close(struct snd_pcm_substream *substream)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
ret = msm_compr_playback_close(substream);
|
||||
else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
|
||||
ret = EINVAL;
|
||||
return ret;
|
||||
}
|
||||
static int msm_compr_prepare(struct snd_pcm_substream *substream)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
ret = msm_compr_playback_prepare(substream);
|
||||
else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
|
||||
ret = EINVAL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static snd_pcm_uframes_t msm_compr_pointer(struct snd_pcm_substream *substream)
|
||||
{
|
||||
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct compr_audio *compr = runtime->private_data;
|
||||
struct msm_audio *prtd = &compr->prtd;
|
||||
|
||||
if (prtd->pcm_irq_pos >= prtd->pcm_size)
|
||||
prtd->pcm_irq_pos = 0;
|
||||
|
||||
pr_debug("pcm_irq_pos = %d\n", prtd->pcm_irq_pos);
|
||||
return bytes_to_frames(runtime, (prtd->pcm_irq_pos));
|
||||
}
|
||||
|
||||
static int msm_compr_mmap(struct snd_pcm_substream *substream,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
int result = 0;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct compr_audio *compr = runtime->private_data;
|
||||
struct msm_audio *prtd = &compr->prtd;
|
||||
|
||||
pr_debug("%s\n", __func__);
|
||||
prtd->mmap_flag = 1;
|
||||
if (runtime->dma_addr && runtime->dma_bytes) {
|
||||
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
|
||||
result = remap_pfn_range(vma, vma->vm_start,
|
||||
runtime->dma_addr >> PAGE_SHIFT,
|
||||
runtime->dma_bytes,
|
||||
vma->vm_page_prot);
|
||||
} else {
|
||||
pr_err("Physical address or size of buf is NULL");
|
||||
return -EINVAL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int msm_compr_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
|
||||
struct compr_audio *compr = runtime->private_data;
|
||||
struct msm_audio *prtd = &compr->prtd;
|
||||
struct snd_dma_buffer *dma_buf = &substream->dma_buffer;
|
||||
struct audio_buffer *buf;
|
||||
int dir, ret;
|
||||
|
||||
pr_debug("%s\n", __func__);
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dir = IN;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
ret = q6asm_open_write(prtd->audio_client, compr->codec);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: Session out open failed\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
msm_pcm_routing_reg_phy_stream(soc_prtd->dai_link->be_id,
|
||||
prtd->session_id, substream->stream);
|
||||
|
||||
ret = q6asm_set_io_mode(prtd->audio_client, ASYNC_IO_MODE);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: Set IO mode failed\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = q6asm_audio_client_buf_alloc_contiguous(dir,
|
||||
prtd->audio_client,
|
||||
runtime->hw.period_bytes_min,
|
||||
runtime->hw.periods_max);
|
||||
if (ret < 0) {
|
||||
pr_err("Audio Start: Buffer Allocation failed rc = %d\n",
|
||||
ret);
|
||||
return -ENOMEM;
|
||||
}
|
||||
buf = prtd->audio_client->port[dir].buf;
|
||||
|
||||
pr_debug("%s:buf = %p\n", __func__, buf);
|
||||
dma_buf->dev.type = SNDRV_DMA_TYPE_DEV;
|
||||
dma_buf->dev.dev = substream->pcm->card->dev;
|
||||
dma_buf->private_data = NULL;
|
||||
dma_buf->area = buf[0].data;
|
||||
dma_buf->addr = buf[0].phys;
|
||||
dma_buf->bytes = runtime->hw.buffer_bytes_max;
|
||||
if (!dma_buf->area)
|
||||
return -ENOMEM;
|
||||
|
||||
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_compr_ioctl(struct snd_pcm_substream *substream,
|
||||
unsigned int cmd, void *arg)
|
||||
{
|
||||
int rc = 0;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct compr_audio *compr = runtime->private_data;
|
||||
struct msm_audio *prtd = &compr->prtd;
|
||||
uint64_t timestamp;
|
||||
uint64_t temp;
|
||||
|
||||
switch (cmd) {
|
||||
case SNDRV_COMPRESS_TSTAMP: {
|
||||
struct snd_compr_tstamp tstamp;
|
||||
pr_debug("SNDRV_COMPRESS_TSTAMP\n");
|
||||
|
||||
memset(&tstamp, 0x0, sizeof(struct snd_compr_tstamp));
|
||||
rc = q6asm_get_session_time(prtd->audio_client, ×tamp);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: Get Session Time return value =%lld\n",
|
||||
__func__, timestamp);
|
||||
return -EAGAIN;
|
||||
}
|
||||
temp = (timestamp * 2 * runtime->channels);
|
||||
temp = temp * (runtime->rate/1000);
|
||||
temp = div_u64(temp, 1000);
|
||||
tstamp.sampling_rate = runtime->rate;
|
||||
tstamp.timestamp = timestamp;
|
||||
pr_debug("%s: bytes_consumed:,timestamp = %lld,\n",
|
||||
__func__,
|
||||
tstamp.timestamp);
|
||||
if (copy_to_user((void *) arg, &tstamp,
|
||||
sizeof(struct snd_compr_tstamp)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
case SNDRV_COMPRESS_GET_CAPS:
|
||||
pr_debug("SNDRV_COMPRESS_GET_CAPS\n");
|
||||
if (copy_to_user((void *) arg, &compr->info.compr_cap,
|
||||
sizeof(struct snd_compr_caps))) {
|
||||
rc = -EFAULT;
|
||||
pr_err("%s: ERROR: copy to user\n", __func__);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
case SNDRV_COMPRESS_SET_PARAMS:
|
||||
pr_debug("SNDRV_COMPRESS_SET_PARAMS: ");
|
||||
if (copy_from_user(&compr->info.codec_param, (void *) arg,
|
||||
sizeof(struct snd_compr_params))) {
|
||||
rc = -EFAULT;
|
||||
pr_err("%s: ERROR: copy from user\n", __func__);
|
||||
return rc;
|
||||
}
|
||||
switch (compr->info.codec_param.codec.id) {
|
||||
case SND_AUDIOCODEC_MP3:
|
||||
/* For MP3 we dont need any other parameter */
|
||||
pr_debug("SND_AUDIOCODEC_MP3\n");
|
||||
compr->codec = FORMAT_MP3;
|
||||
break;
|
||||
case SND_AUDIOCODEC_AAC:
|
||||
pr_debug("SND_AUDIOCODEC_AAC\n");
|
||||
compr->codec = FORMAT_MPEG4_AAC;
|
||||
break;
|
||||
default:
|
||||
pr_debug("FORMAT_LINEAR_PCM\n");
|
||||
compr->codec = FORMAT_LINEAR_PCM;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
case SNDRV_PCM_IOCTL1_RESET:
|
||||
prtd->cmd_ack = 0;
|
||||
rc = q6asm_cmd(prtd->audio_client, CMD_FLUSH);
|
||||
if (rc < 0)
|
||||
pr_err("%s: flush cmd failed rc=%d\n", __func__, rc);
|
||||
rc = wait_event_timeout(the_locks.eos_wait,
|
||||
prtd->cmd_ack, 5 * HZ);
|
||||
if (rc < 0)
|
||||
pr_err("Flush cmd timeout\n");
|
||||
prtd->pcm_irq_pos = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return snd_pcm_lib_ioctl(substream, cmd, arg);
|
||||
}
|
||||
|
||||
static struct snd_pcm_ops msm_compr_ops = {
|
||||
.open = msm_compr_open,
|
||||
.hw_params = msm_compr_hw_params,
|
||||
.close = msm_compr_close,
|
||||
.ioctl = msm_compr_ioctl,
|
||||
.prepare = msm_compr_prepare,
|
||||
.trigger = msm_compr_trigger,
|
||||
.pointer = msm_compr_pointer,
|
||||
.mmap = msm_compr_mmap,
|
||||
};
|
||||
|
||||
static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_card *card = rtd->card->snd_card;
|
||||
int ret = 0;
|
||||
|
||||
if (!card->dev->coherent_dma_mask)
|
||||
card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_platform_driver msm_soc_platform = {
|
||||
.ops = &msm_compr_ops,
|
||||
.pcm_new = msm_asoc_pcm_new,
|
||||
};
|
||||
|
||||
static __devinit int msm_compr_probe(struct platform_device *pdev)
|
||||
{
|
||||
if (pdev->dev.of_node)
|
||||
dev_set_name(&pdev->dev, "%s", "msm-compr-dsp");
|
||||
|
||||
dev_info(&pdev->dev, "%s: dev name %s\n",
|
||||
__func__, dev_name(&pdev->dev));
|
||||
return snd_soc_register_platform(&pdev->dev,
|
||||
&msm_soc_platform);
|
||||
}
|
||||
|
||||
static int msm_compr_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id msm_compr_dt_match[] = {
|
||||
{.compatible = "qcom,msm-compr-dsp"},
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, msm_compr_dt_match);
|
||||
|
||||
static struct platform_driver msm_compr_driver = {
|
||||
.driver = {
|
||||
.name = "msm-compr-dsp",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = msm_compr_dt_match,
|
||||
},
|
||||
.probe = msm_compr_probe,
|
||||
.remove = __devexit_p(msm_compr_remove),
|
||||
};
|
||||
|
||||
static int __init msm_soc_platform_init(void)
|
||||
{
|
||||
init_waitqueue_head(&the_locks.enable_wait);
|
||||
init_waitqueue_head(&the_locks.eos_wait);
|
||||
init_waitqueue_head(&the_locks.write_wait);
|
||||
init_waitqueue_head(&the_locks.read_wait);
|
||||
|
||||
return platform_driver_register(&msm_compr_driver);
|
||||
}
|
||||
module_init(msm_soc_platform_init);
|
||||
|
||||
static void __exit msm_soc_platform_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&msm_compr_driver);
|
||||
}
|
||||
module_exit(msm_soc_platform_exit);
|
||||
|
||||
MODULE_DESCRIPTION("PCM module platform driver");
|
||||
MODULE_LICENSE("GPL v2");
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* 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 _MSM_COMPR_H
|
||||
#define _MSM_COMPR_H
|
||||
#include <sound/apr_audio-v2.h>
|
||||
#include <sound/q6asm-v2.h>
|
||||
#include <sound/compress_params.h>
|
||||
#include <sound/compress_offload.h>
|
||||
#include <sound/compress_driver.h>
|
||||
|
||||
#include "msm-pcm-q6-v2.h"
|
||||
|
||||
struct compr_info {
|
||||
struct snd_compr_caps compr_cap;
|
||||
struct snd_compr_codec_caps codec_caps;
|
||||
struct snd_compr_params codec_param;
|
||||
};
|
||||
|
||||
struct compr_audio {
|
||||
struct msm_audio prtd;
|
||||
struct compr_info info;
|
||||
uint32_t codec;
|
||||
};
|
||||
|
||||
#endif /*_MSM_COMPR_H*/
|
Loading…
Reference in a new issue