Merge tag 'LA.BR.1.3.6-03910-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-03910-8976.0" Change-Id: I16643fc055aa2965fe5903396a8e5158c42cf1bc
This commit is contained in:
commit
18aceede84
|
@ -77,6 +77,7 @@ static uint8_t _std_init_vector_sha256_uint8[] = {
|
|||
|
||||
static DEFINE_MUTEX(send_cmd_lock);
|
||||
static DEFINE_MUTEX(qcedev_sent_bw_req);
|
||||
static DEFINE_MUTEX(hash_access_lock);
|
||||
|
||||
static void qcedev_ce_high_bw_req(struct qcedev_control *podev,
|
||||
bool high_bw_req)
|
||||
|
@ -1517,6 +1518,11 @@ static int qcedev_check_cipher_params(struct qcedev_cipher_op_req *req,
|
|||
}
|
||||
/* Check for sum of all dst length is equal to data_len */
|
||||
for (i = 0, total = 0; i < req->entries; i++) {
|
||||
if (!req->vbuf.dst[i].vaddr && req->vbuf.dst[i].len) {
|
||||
pr_err("%s: NULL req dst vbuf[%d] with length %d\n",
|
||||
__func__, i, req->vbuf.dst[i].len);
|
||||
goto error;
|
||||
}
|
||||
if (req->vbuf.dst[i].len >= U32_MAX - total) {
|
||||
pr_err("%s: Integer overflow on total req dst vbuf length\n",
|
||||
__func__);
|
||||
|
@ -1531,6 +1537,11 @@ static int qcedev_check_cipher_params(struct qcedev_cipher_op_req *req,
|
|||
}
|
||||
/* Check for sum of all src length is equal to data_len */
|
||||
for (i = 0, total = 0; i < req->entries; i++) {
|
||||
if (!req->vbuf.src[i].vaddr && req->vbuf.src[i].len) {
|
||||
pr_err("%s: NULL req src vbuf[%d] with length %d\n",
|
||||
__func__, i, req->vbuf.src[i].len);
|
||||
goto error;
|
||||
}
|
||||
if (req->vbuf.src[i].len > U32_MAX - total) {
|
||||
pr_err("%s: Integer overflow on total req src vbuf length\n",
|
||||
__func__);
|
||||
|
@ -1664,12 +1675,18 @@ long qcedev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
|||
(void __user *)arg,
|
||||
sizeof(struct qcedev_sha_op_req)))
|
||||
return -EFAULT;
|
||||
if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev))
|
||||
mutex_lock(&hash_access_lock);
|
||||
if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev)) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
qcedev_areq.op_type = QCEDEV_CRYPTO_OPER_SHA;
|
||||
err = qcedev_hash_init(&qcedev_areq, handle, &sg_src);
|
||||
if (err)
|
||||
if (err) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return err;
|
||||
}
|
||||
mutex_unlock(&hash_access_lock);
|
||||
if (copy_to_user((void __user *)arg, &qcedev_areq.sha_op_req,
|
||||
sizeof(struct qcedev_sha_op_req)))
|
||||
return -EFAULT;
|
||||
|
@ -1686,31 +1703,41 @@ long qcedev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
|||
(void __user *)arg,
|
||||
sizeof(struct qcedev_sha_op_req)))
|
||||
return -EFAULT;
|
||||
if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev))
|
||||
mutex_lock(&hash_access_lock);
|
||||
if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev)) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
qcedev_areq.op_type = QCEDEV_CRYPTO_OPER_SHA;
|
||||
|
||||
if (qcedev_areq.sha_op_req.alg == QCEDEV_ALG_AES_CMAC) {
|
||||
err = qcedev_hash_cmac(&qcedev_areq, handle, &sg_src);
|
||||
if (err)
|
||||
if (err) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
if (handle->sha_ctxt.init_done == false) {
|
||||
pr_err("%s Init was not called\n", __func__);
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = qcedev_hash_update(&qcedev_areq, handle, &sg_src);
|
||||
if (err)
|
||||
if (err) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
if (handle->sha_ctxt.diglen > QCEDEV_MAX_SHA_DIGEST) {
|
||||
pr_err("Invalid sha_ctxt.diglen %d\n",
|
||||
handle->sha_ctxt.diglen);
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
memcpy(&qcedev_areq.sha_op_req.digest[0],
|
||||
&handle->sha_ctxt.digest[0],
|
||||
handle->sha_ctxt.diglen);
|
||||
mutex_unlock(&hash_access_lock);
|
||||
if (copy_to_user((void __user *)arg, &qcedev_areq.sha_op_req,
|
||||
sizeof(struct qcedev_sha_op_req)))
|
||||
return -EFAULT;
|
||||
|
@ -1727,16 +1754,22 @@ long qcedev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
|||
(void __user *)arg,
|
||||
sizeof(struct qcedev_sha_op_req)))
|
||||
return -EFAULT;
|
||||
if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev))
|
||||
mutex_lock(&hash_access_lock);
|
||||
if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev)) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
qcedev_areq.op_type = QCEDEV_CRYPTO_OPER_SHA;
|
||||
err = qcedev_hash_final(&qcedev_areq, handle);
|
||||
if (err)
|
||||
if (err) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return err;
|
||||
}
|
||||
qcedev_areq.sha_op_req.diglen = handle->sha_ctxt.diglen;
|
||||
memcpy(&qcedev_areq.sha_op_req.digest[0],
|
||||
&handle->sha_ctxt.digest[0],
|
||||
handle->sha_ctxt.diglen);
|
||||
mutex_unlock(&hash_access_lock);
|
||||
if (copy_to_user((void __user *)arg, &qcedev_areq.sha_op_req,
|
||||
sizeof(struct qcedev_sha_op_req)))
|
||||
return -EFAULT;
|
||||
|
@ -1750,20 +1783,28 @@ long qcedev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
|||
(void __user *)arg,
|
||||
sizeof(struct qcedev_sha_op_req)))
|
||||
return -EFAULT;
|
||||
if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev))
|
||||
mutex_lock(&hash_access_lock);
|
||||
if (qcedev_check_sha_params(&qcedev_areq.sha_op_req, podev)) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
qcedev_areq.op_type = QCEDEV_CRYPTO_OPER_SHA;
|
||||
qcedev_hash_init(&qcedev_areq, handle, &sg_src);
|
||||
err = qcedev_hash_update(&qcedev_areq, handle, &sg_src);
|
||||
if (err)
|
||||
if (err) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return err;
|
||||
}
|
||||
err = qcedev_hash_final(&qcedev_areq, handle);
|
||||
if (err)
|
||||
if (err) {
|
||||
mutex_unlock(&hash_access_lock);
|
||||
return err;
|
||||
}
|
||||
qcedev_areq.sha_op_req.diglen = handle->sha_ctxt.diglen;
|
||||
memcpy(&qcedev_areq.sha_op_req.digest[0],
|
||||
&handle->sha_ctxt.digest[0],
|
||||
handle->sha_ctxt.diglen);
|
||||
mutex_unlock(&hash_access_lock);
|
||||
if (copy_to_user((void __user *)arg, &qcedev_areq.sha_op_req,
|
||||
sizeof(struct qcedev_sha_op_req)))
|
||||
return -EFAULT;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2008-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2008-2017, 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
|
||||
|
@ -231,8 +231,11 @@ kgsl_mem_entry_create(void)
|
|||
{
|
||||
struct kgsl_mem_entry *entry = kzalloc(sizeof(*entry), GFP_KERNEL);
|
||||
|
||||
if (entry)
|
||||
if (entry) {
|
||||
kref_init(&entry->refcount);
|
||||
/* put this ref in the caller functions after init */
|
||||
kref_get(&entry->refcount);
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
@ -1809,9 +1812,9 @@ long kgsl_ioctl_drawctxt_create(struct kgsl_device_private *dev_priv,
|
|||
/* Commit the pointer to the context in context_idr */
|
||||
write_lock(&device->context_lock);
|
||||
idr_replace(&device->context_idr, context, context->id);
|
||||
param->drawctxt_id = context->id;
|
||||
write_unlock(&device->context_lock);
|
||||
|
||||
param->drawctxt_id = context->id;
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
|
@ -2422,6 +2425,9 @@ long kgsl_ioctl_gpuobj_import(struct kgsl_device_private *dev_priv,
|
|||
trace_kgsl_mem_map(entry, fd);
|
||||
|
||||
kgsl_mem_entry_commit_process(private, entry);
|
||||
|
||||
/* put the extra refcount for kgsl_mem_entry_create() */
|
||||
kgsl_mem_entry_put(entry);
|
||||
return 0;
|
||||
|
||||
unmap:
|
||||
|
@ -2694,6 +2700,9 @@ long kgsl_ioctl_map_user_mem(struct kgsl_device_private *dev_priv,
|
|||
trace_kgsl_mem_map(entry, param->fd);
|
||||
|
||||
kgsl_mem_entry_commit_process(private, entry);
|
||||
|
||||
/* put the extra refcount for kgsl_mem_entry_create() */
|
||||
kgsl_mem_entry_put(entry);
|
||||
return result;
|
||||
|
||||
error_attach:
|
||||
|
@ -3134,6 +3143,9 @@ long kgsl_ioctl_gpuobj_alloc(struct kgsl_device_private *dev_priv,
|
|||
param->mmapsize = kgsl_memdesc_mmapsize(&entry->memdesc);
|
||||
param->id = entry->id;
|
||||
|
||||
/* put the extra refcount for kgsl_mem_entry_create() */
|
||||
kgsl_mem_entry_put(entry);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3157,6 +3169,8 @@ long kgsl_ioctl_gpumem_alloc(struct kgsl_device_private *dev_priv,
|
|||
param->size = (size_t) entry->memdesc.size;
|
||||
param->flags = (unsigned int) entry->memdesc.flags;
|
||||
|
||||
/* put the extra refcount for kgsl_mem_entry_create() */
|
||||
kgsl_mem_entry_put(entry);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3180,6 +3194,8 @@ long kgsl_ioctl_gpumem_alloc_id(struct kgsl_device_private *dev_priv,
|
|||
kgsl_memdesc_mmapsize(&entry->memdesc);
|
||||
param->gpuaddr = (unsigned long) entry->memdesc.gpuaddr;
|
||||
|
||||
/* put the extra refcount for kgsl_mem_entry_create() */
|
||||
kgsl_mem_entry_put(entry);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <linux/debugfs.h>
|
||||
|
||||
#define DATA_LENGTH_UINT 512
|
||||
#define CMD_HEAD_LENGTH (sizeof(struct st_cmd_head) - sizeof(u8 *))
|
||||
#define CMD_HEAD_LENGTH (sizeof(struct st_cmd_head))
|
||||
static char procname[20] = {0};
|
||||
|
||||
struct st_cmd_head {
|
||||
|
@ -44,10 +44,10 @@ struct st_cmd_head {
|
|||
u8 addr_len; /* address length */
|
||||
u8 addr[2]; /* address */
|
||||
u8 res[3]; /* reserved */
|
||||
u8 *data; /* data pointer */
|
||||
} __packed;
|
||||
|
||||
static struct st_cmd_head cmd_head;
|
||||
static u8 *cmd_data;
|
||||
|
||||
static struct i2c_client *gt_client;
|
||||
|
||||
|
@ -194,7 +194,7 @@ static void unregister_i2c_func(void)
|
|||
|
||||
void uninit_wr_node(void)
|
||||
{
|
||||
cmd_head.data = NULL;
|
||||
cmd_data = NULL;
|
||||
unregister_i2c_func();
|
||||
proc_remove(goodix_proc_entry);
|
||||
}
|
||||
|
@ -311,7 +311,6 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf,
|
|||
size_t count, loff_t *ppos)
|
||||
{
|
||||
s32 ret = 0;
|
||||
u8 *dataptr = NULL;
|
||||
|
||||
mutex_lock(&lock);
|
||||
ret = copy_from_user(&cmd_head, userbuf, CMD_HEAD_LENGTH);
|
||||
|
@ -343,14 +342,14 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf,
|
|||
}
|
||||
|
||||
if (cmd_head.wr == GTP_RW_WRITE) {
|
||||
ret = copy_from_user(&cmd_head.data[GTP_ADDR_LENGTH],
|
||||
ret = copy_from_user(&cmd_data[GTP_ADDR_LENGTH],
|
||||
&userbuf[CMD_HEAD_LENGTH], cmd_head.data_len);
|
||||
if (ret) {
|
||||
dev_err(>_client->dev, "copy_from_user failed.");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
memcpy(&cmd_head.data[GTP_ADDR_LENGTH - cmd_head.addr_len],
|
||||
memcpy(&cmd_data[GTP_ADDR_LENGTH - cmd_head.addr_len],
|
||||
cmd_head.addr, cmd_head.addr_len);
|
||||
|
||||
if (cmd_head.flag == GTP_NEED_FLAG) {
|
||||
|
@ -363,7 +362,7 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf,
|
|||
/* Need interrupt! */
|
||||
}
|
||||
if (tool_i2c_write(
|
||||
&cmd_head.data[GTP_ADDR_LENGTH - cmd_head.addr_len],
|
||||
&cmd_data[GTP_ADDR_LENGTH - cmd_head.addr_len],
|
||||
cmd_head.data_len + cmd_head.addr_len) <= 0) {
|
||||
dev_err(>_client->dev, "Write data failed!");
|
||||
ret = -EIO;
|
||||
|
@ -376,7 +375,7 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf,
|
|||
ret = cmd_head.data_len + CMD_HEAD_LENGTH;
|
||||
goto exit;
|
||||
} else if (cmd_head.wr == GTP_RW_WRITE_IC_TYPE) { /* Write ic type */
|
||||
ret = copy_from_user(&cmd_head.data[0],
|
||||
ret = copy_from_user(&cmd_data[0],
|
||||
&userbuf[CMD_HEAD_LENGTH],
|
||||
cmd_head.data_len);
|
||||
if (ret) {
|
||||
|
@ -391,7 +390,7 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf,
|
|||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
memcpy(ic_type, cmd_head.data, cmd_head.data_len);
|
||||
memcpy(ic_type, cmd_data, cmd_head.data_len);
|
||||
|
||||
register_i2c_func();
|
||||
|
||||
|
@ -418,13 +417,14 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf,
|
|||
goto exit;
|
||||
} else if (cmd_head.wr == GTP_RW_CHECK_RAWDIFF_MODE) {
|
||||
struct goodix_ts_data *ts = i2c_get_clientdata(gt_client);
|
||||
ret = copy_from_user(&cmd_head.data[GTP_ADDR_LENGTH],
|
||||
|
||||
ret = copy_from_user(&cmd_data[GTP_ADDR_LENGTH],
|
||||
&userbuf[CMD_HEAD_LENGTH], cmd_head.data_len);
|
||||
if (ret) {
|
||||
pr_debug("copy_from_user failed.");
|
||||
goto exit;
|
||||
}
|
||||
if (cmd_head.data[GTP_ADDR_LENGTH]) {
|
||||
if (cmd_data[GTP_ADDR_LENGTH]) {
|
||||
pr_debug("gtp enter rawdiff.");
|
||||
ts->gtp_rawdiff_mode = true;
|
||||
} else {
|
||||
|
@ -452,11 +452,11 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf,
|
|||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
memset(cmd_head.data, 0, cmd_head.data_len + 1);
|
||||
memcpy(cmd_head.data, &userbuf[CMD_HEAD_LENGTH],
|
||||
memset(cmd_data, 0, cmd_head.data_len + 1);
|
||||
memcpy(cmd_data, &userbuf[CMD_HEAD_LENGTH],
|
||||
cmd_head.data_len);
|
||||
|
||||
if (gup_update_proc((void *)cmd_head.data) == FAIL) {
|
||||
if (gup_update_proc((void *)cmd_data) == FAIL) {
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
|
@ -464,10 +464,8 @@ static s32 goodix_tool_write(struct file *filp, const char __user *userbuf,
|
|||
ret = CMD_HEAD_LENGTH;
|
||||
|
||||
exit:
|
||||
dataptr = cmd_head.data;
|
||||
memset(&cmd_head, 0, sizeof(cmd_head));
|
||||
cmd_head.wr = 0xFF;
|
||||
cmd_head.data = dataptr;
|
||||
|
||||
mutex_unlock(&lock);
|
||||
return ret;
|
||||
|
@ -507,10 +505,10 @@ static s32 goodix_tool_read(struct file *file, char __user *user_buf,
|
|||
/* Need interrupt! */
|
||||
}
|
||||
|
||||
memcpy(cmd_head.data, cmd_head.addr, cmd_head.addr_len);
|
||||
memcpy(cmd_data, cmd_head.addr, cmd_head.addr_len);
|
||||
|
||||
pr_debug("[CMD HEAD DATA] ADDR:0x%02x%02x.", cmd_head.data[0],
|
||||
cmd_head.data[1]);
|
||||
pr_debug("[CMD HEAD DATA] ADDR:0x%02x%02x.", cmd_data[0],
|
||||
cmd_data[1]);
|
||||
pr_debug("[CMD HEAD ADDR] ADDR:0x%02x%02x.", cmd_head.addr[0],
|
||||
cmd_head.addr[1]);
|
||||
|
||||
|
@ -527,13 +525,13 @@ static s32 goodix_tool_read(struct file *file, char __user *user_buf,
|
|||
if (data_len > count)
|
||||
data_len = count;
|
||||
|
||||
if (tool_i2c_read(cmd_head.data, data_len) <= 0) {
|
||||
if (tool_i2c_read(cmd_data, data_len) <= 0) {
|
||||
dev_err(>_client->dev, "Read data failed!\n");
|
||||
ret = -EIO;
|
||||
goto exit;
|
||||
}
|
||||
ret = simple_read_from_buffer(user_buf, count, ppos,
|
||||
&cmd_head.data[GTP_ADDR_LENGTH], data_len);
|
||||
&cmd_data[GTP_ADDR_LENGTH], data_len);
|
||||
break;
|
||||
case GTP_RW_FILL_INFO:
|
||||
ret = fill_update_info(user_buf, count, ppos);
|
||||
|
@ -568,13 +566,13 @@ s32 init_wr_node(struct i2c_client *client)
|
|||
|
||||
gt_client = client;
|
||||
memset(&cmd_head, 0, sizeof(cmd_head));
|
||||
cmd_head.data = NULL;
|
||||
cmd_data = NULL;
|
||||
|
||||
i = GTP_I2C_RETRY_5;
|
||||
while ((!cmd_head.data) && i) {
|
||||
cmd_head.data = devm_kzalloc(&client->dev,
|
||||
while ((!cmd_data) && i) {
|
||||
cmd_data = devm_kzalloc(&client->dev,
|
||||
i * DATA_LENGTH_UINT, GFP_KERNEL);
|
||||
if (cmd_head.data)
|
||||
if (cmd_data)
|
||||
break;
|
||||
i--;
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
(fwu->config_data[2] == config_id[2]) && \
|
||||
(fwu->config_data[3] == config_id[3]))
|
||||
|
||||
#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS
|
||||
static ssize_t fwu_sysfs_show_image(struct file *data_file,
|
||||
struct kobject *kobj, struct bin_attribute *attributes,
|
||||
char *buf, loff_t pos, size_t count);
|
||||
|
@ -157,6 +158,7 @@ static ssize_t fwu_sysfs_config_id_show(struct device *dev,
|
|||
|
||||
static ssize_t fwu_sysfs_package_id_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
#endif
|
||||
|
||||
enum bl_version {
|
||||
V5 = 5,
|
||||
|
@ -296,6 +298,7 @@ struct synaptics_rmi4_fwu_handle {
|
|||
struct synaptics_rmi4_data *rmi4_data;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS
|
||||
static struct bin_attribute dev_attr_data = {
|
||||
.attr = {
|
||||
.name = "data",
|
||||
|
@ -305,9 +308,11 @@ static struct bin_attribute dev_attr_data = {
|
|||
.read = fwu_sysfs_show_image,
|
||||
.write = fwu_sysfs_store_image,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
static struct device_attribute attrs[] = {
|
||||
#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS
|
||||
__ATTR(force_update_fw, S_IWUSR | S_IWGRP,
|
||||
NULL,
|
||||
fwu_sysfs_force_reflash_store),
|
||||
|
@ -353,6 +358,7 @@ static struct device_attribute attrs[] = {
|
|||
__ATTR(package_id, S_IRUGO,
|
||||
fwu_sysfs_package_id_show,
|
||||
synaptics_rmi4_store_error),
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct synaptics_rmi4_fwu_handle *fwu;
|
||||
|
@ -1220,6 +1226,7 @@ write_config:
|
|||
return retval;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS
|
||||
static int fwu_start_write_config(void)
|
||||
{
|
||||
int retval;
|
||||
|
@ -1395,6 +1402,7 @@ exit:
|
|||
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int fwu_do_lockdown(void)
|
||||
{
|
||||
|
@ -1585,6 +1593,7 @@ int synaptics_dsx_fw_updater(unsigned char *fw_data)
|
|||
}
|
||||
EXPORT_SYMBOL(synaptics_dsx_fw_updater);
|
||||
|
||||
#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS
|
||||
static ssize_t fwu_sysfs_show_image(struct file *data_file,
|
||||
struct kobject *kobj, struct bin_attribute *attributes,
|
||||
char *buf, loff_t pos, size_t count)
|
||||
|
@ -1972,6 +1981,7 @@ static ssize_t fwu_sysfs_package_id_show(struct device *dev,
|
|||
(package_id[1] << 8) | package_id[0],
|
||||
(package_id[3] << 8) | package_id[2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void synaptics_rmi4_fwu_attn(struct synaptics_rmi4_data *rmi4_data,
|
||||
unsigned char intr_mask)
|
||||
|
@ -2045,6 +2055,7 @@ static int synaptics_rmi4_fwu_init(struct synaptics_rmi4_data *rmi4_data)
|
|||
fwu->do_lockdown = DO_LOCKDOWN;
|
||||
fwu->initialized = true;
|
||||
|
||||
#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS
|
||||
retval = sysfs_create_bin_file(&rmi4_data->input_dev->dev.kobj,
|
||||
&dev_attr_data);
|
||||
if (retval < 0) {
|
||||
|
@ -2053,6 +2064,7 @@ static int synaptics_rmi4_fwu_init(struct synaptics_rmi4_data *rmi4_data)
|
|||
__func__);
|
||||
goto exit_free_fwu;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (attr_count = 0; attr_count < ARRAY_SIZE(attrs); attr_count++) {
|
||||
retval = sysfs_create_file(&rmi4_data->input_dev->dev.kobj,
|
||||
|
@ -2074,7 +2086,9 @@ exit_remove_attrs:
|
|||
&attrs[attr_count].attr);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS
|
||||
sysfs_remove_bin_file(&rmi4_data->input_dev->dev.kobj, &dev_attr_data);
|
||||
#endif
|
||||
|
||||
exit_free_fwu:
|
||||
kfree(fwu);
|
||||
|
@ -2096,7 +2110,9 @@ static void synaptics_rmi4_fwu_remove(struct synaptics_rmi4_data *rmi4_data)
|
|||
&attrs[attr_count].attr);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_EXTRA_SYSFS
|
||||
sysfs_remove_bin_file(&rmi4_data->input_dev->dev.kobj, &dev_attr_data);
|
||||
#endif
|
||||
|
||||
kfree(fwu->read_config_buf);
|
||||
kfree(fwu);
|
||||
|
|
|
@ -1943,7 +1943,7 @@ static void msm_isp_process_overflow_irq(
|
|||
{
|
||||
uint32_t overflow_mask, vfe_id;
|
||||
struct dual_vfe_resource *dual_vfe_res = NULL;
|
||||
|
||||
enum msm_vfe_input_src input_src = 0;
|
||||
/* if there are no active streams - do not start recovery */
|
||||
if (!vfe_dev->axi_data.num_active_stream)
|
||||
return;
|
||||
|
@ -1977,8 +1977,20 @@ static void msm_isp_process_overflow_irq(
|
|||
return;
|
||||
}
|
||||
|
||||
ISP_DBG("%s: Bus overflow detected: 0x%x, start recovery!\n",
|
||||
__func__, overflow_mask);
|
||||
overflow_mask &= 0xFE00;
|
||||
overflow_mask >>= 9;
|
||||
|
||||
if (overflow_mask & vfe_dev->axi_data.rdi_wm_mask)
|
||||
input_src = VFE_RAW_0;
|
||||
else if ((overflow_mask << 8) & vfe_dev->axi_data.rdi_wm_mask)
|
||||
input_src = VFE_RAW_1;
|
||||
else if ((overflow_mask << 16) & vfe_dev->axi_data.rdi_wm_mask)
|
||||
input_src = VFE_RAW_2;
|
||||
else
|
||||
input_src = VFE_PIX_0;
|
||||
|
||||
ISP_DBG("%s: intf %d Bus overflow detected: 0x%x, start recovery!\n",
|
||||
__func__, input_src, overflow_mask);
|
||||
|
||||
halt_cmd.overflow_detected = 1;
|
||||
halt_cmd.stop_camif = 1;
|
||||
|
@ -1996,9 +2008,11 @@ static void msm_isp_process_overflow_irq(
|
|||
*irq_status0 = 0;
|
||||
*irq_status1 = 0;
|
||||
|
||||
memset(&error_event, 0, sizeof(error_event));
|
||||
error_event.frame_id =
|
||||
vfe_dev->axi_data.src_info[VFE_PIX_0].frame_id;
|
||||
vfe_dev->axi_data.src_info[input_src].frame_id;
|
||||
error_event.u.error_info.err_type = ISP_ERROR_BUS_OVERFLOW;
|
||||
error_event.u.error_info.stream_id_mask = input_src;
|
||||
msm_isp_send_event(vfe_dev, ISP_EVENT_ERROR, &error_event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -523,6 +523,42 @@ static int32_t msm_flash_init(
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static int32_t msm_flash_init_prepare(
|
||||
struct msm_flash_ctrl_t *flash_ctrl,
|
||||
struct msm_flash_cfg_data_t *flash_data)
|
||||
{
|
||||
return msm_flash_init(flash_ctrl, flash_data);
|
||||
}
|
||||
#else
|
||||
static int32_t msm_flash_init_prepare(
|
||||
struct msm_flash_ctrl_t *flash_ctrl,
|
||||
struct msm_flash_cfg_data_t *flash_data)
|
||||
{
|
||||
struct msm_flash_cfg_data_t flash_data_k;
|
||||
struct msm_flash_init_info_t flash_init_info;
|
||||
int32_t i = 0;
|
||||
|
||||
flash_data_k.cfg_type = flash_data->cfg_type;
|
||||
for (i = 0; i < MAX_LED_TRIGGERS; i++) {
|
||||
flash_data_k.flash_current[i] =
|
||||
flash_data->flash_current[i];
|
||||
flash_data_k.flash_duration[i] =
|
||||
flash_data->flash_duration[i];
|
||||
}
|
||||
|
||||
flash_data_k.cfg.flash_init_info = &flash_init_info;
|
||||
if (copy_from_user(&flash_init_info,
|
||||
(void *)(flash_data->cfg.flash_init_info),
|
||||
sizeof(struct msm_flash_init_info_t))) {
|
||||
pr_err("%s copy_from_user failed %d\n",
|
||||
__func__, __LINE__);
|
||||
return -EFAULT;
|
||||
}
|
||||
return msm_flash_init(flash_ctrl, &flash_data_k);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int32_t msm_flash_low(
|
||||
struct msm_flash_ctrl_t *flash_ctrl,
|
||||
struct msm_flash_cfg_data_t *flash_data)
|
||||
|
@ -629,7 +665,7 @@ static int32_t msm_flash_config(struct msm_flash_ctrl_t *flash_ctrl,
|
|||
|
||||
switch (flash_data->cfg_type) {
|
||||
case CFG_FLASH_INIT:
|
||||
rc = msm_flash_init(flash_ctrl, flash_data);
|
||||
rc = msm_flash_init_prepare(flash_ctrl, flash_data);
|
||||
break;
|
||||
case CFG_FLASH_RELEASE:
|
||||
if (flash_ctrl->flash_state == MSM_CAMERA_FLASH_INIT)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, 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
|
||||
|
@ -792,6 +792,8 @@ static int __init msm_vidc_init(void)
|
|||
if (rc) {
|
||||
dprintk(VIDC_ERR,
|
||||
"Failed to register platform driver\n");
|
||||
msm_vidc_debugfs_deinit_drv();
|
||||
debugfs_remove_recursive(vidc_driver->debugfs_root);
|
||||
kfree(vidc_driver);
|
||||
vidc_driver = NULL;
|
||||
}
|
||||
|
@ -802,6 +804,7 @@ static int __init msm_vidc_init(void)
|
|||
static void __exit msm_vidc_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&msm_vidc_driver);
|
||||
msm_vidc_debugfs_deinit_drv();
|
||||
debugfs_remove_recursive(vidc_driver->debugfs_root);
|
||||
kfree(vidc_driver);
|
||||
vidc_driver = NULL;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, 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
|
||||
|
@ -32,6 +32,7 @@ u32 msm_vidc_firmware_unload_delay = 15000;
|
|||
int msm_vidc_thermal_mitigation_disabled = 0x0;
|
||||
|
||||
struct debug_buffer {
|
||||
struct mutex lock;
|
||||
char ptr[MAX_DBG_BUF_SIZE];
|
||||
char *curr;
|
||||
u32 filled_size;
|
||||
|
@ -58,8 +59,12 @@ static u32 write_str(struct debug_buffer *buffer, const char *fmt, ...)
|
|||
{
|
||||
va_list args;
|
||||
u32 size;
|
||||
|
||||
char *curr = buffer->curr;
|
||||
char *end = buffer->ptr + MAX_DBG_BUF_SIZE;
|
||||
|
||||
va_start(args, fmt);
|
||||
size = vscnprintf(buffer->curr, MAX_DBG_BUF_SIZE - 1, fmt, args);
|
||||
size = vscnprintf(curr, end - curr, fmt, args);
|
||||
va_end(args);
|
||||
buffer->curr += size;
|
||||
buffer->filled_size += size;
|
||||
|
@ -73,12 +78,15 @@ static ssize_t core_info_read(struct file *file, char __user *buf,
|
|||
struct hfi_device *hdev;
|
||||
struct hal_fw_info fw_info;
|
||||
int i = 0, rc = 0;
|
||||
ssize_t len = 0;
|
||||
|
||||
if (!core || !core->device) {
|
||||
dprintk(VIDC_ERR, "Invalid params, core: %pK\n", core);
|
||||
return 0;
|
||||
}
|
||||
hdev = core->device;
|
||||
|
||||
mutex_lock(&dbg_buf.lock);
|
||||
INIT_DBG_BUF(dbg_buf);
|
||||
write_str(&dbg_buf, "===============================\n");
|
||||
write_str(&dbg_buf, "CORE %d: 0x%pK\n", core->id, core);
|
||||
|
@ -102,8 +110,11 @@ err_fw_info:
|
|||
completion_done(&core->completions[SYS_MSG_INDEX(i)]) ?
|
||||
"pending" : "done");
|
||||
}
|
||||
return simple_read_from_buffer(buf, count, ppos,
|
||||
len = simple_read_from_buffer(buf, count, ppos,
|
||||
dbg_buf.ptr, dbg_buf.filled_size);
|
||||
|
||||
mutex_unlock(&dbg_buf.lock);
|
||||
return len;
|
||||
}
|
||||
|
||||
static const struct file_operations core_info_fops = {
|
||||
|
@ -140,7 +151,10 @@ static const struct file_operations ssr_fops = {
|
|||
|
||||
struct dentry *msm_vidc_debugfs_init_drv(void)
|
||||
{
|
||||
struct dentry *dir = debugfs_create_dir("msm_vidc", NULL);
|
||||
struct dentry *dir = NULL;
|
||||
|
||||
mutex_init(&dbg_buf.lock);
|
||||
dir = debugfs_create_dir("msm_vidc", NULL);
|
||||
if (IS_ERR_OR_NULL(dir)) {
|
||||
dir = NULL;
|
||||
goto failed_create_dir;
|
||||
|
@ -246,6 +260,7 @@ struct dentry *msm_vidc_debugfs_init_core(struct msm_vidc_core *core,
|
|||
dprintk(VIDC_ERR, "Failed to create debugfs for msm_vidc\n");
|
||||
goto failed_create_dir;
|
||||
}
|
||||
|
||||
if (!debugfs_create_file("info", S_IRUGO, dir, core, &core_info_fops)) {
|
||||
dprintk(VIDC_ERR, "debugfs_create_file: fail\n");
|
||||
goto failed_create_dir;
|
||||
|
@ -299,10 +314,14 @@ static ssize_t inst_info_read(struct file *file, char __user *buf,
|
|||
{
|
||||
struct msm_vidc_inst *inst = file->private_data;
|
||||
int i, j;
|
||||
ssize_t len = 0;
|
||||
|
||||
if (!inst) {
|
||||
dprintk(VIDC_ERR, "Invalid params, core: %pK\n", inst);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mutex_lock(&dbg_buf.lock);
|
||||
INIT_DBG_BUF(dbg_buf);
|
||||
write_str(&dbg_buf, "===============================\n");
|
||||
write_str(&dbg_buf, "INSTANCE: 0x%pK (%s)\n", inst,
|
||||
|
@ -359,9 +378,10 @@ static ssize_t inst_info_read(struct file *file, char __user *buf,
|
|||
write_str(&dbg_buf, "FBD Count: %d\n", inst->count.fbd);
|
||||
|
||||
publish_unreleased_reference(inst);
|
||||
|
||||
return simple_read_from_buffer(buf, count, ppos,
|
||||
len = simple_read_from_buffer(buf, count, ppos,
|
||||
dbg_buf.ptr, dbg_buf.filled_size);
|
||||
mutex_unlock(&dbg_buf.lock);
|
||||
return len;
|
||||
}
|
||||
|
||||
static const struct file_operations inst_info_fops = {
|
||||
|
@ -442,3 +462,8 @@ void msm_vidc_debugfs_update(struct msm_vidc_inst *inst,
|
|||
}
|
||||
}
|
||||
|
||||
void msm_vidc_debugfs_deinit_drv(void)
|
||||
{
|
||||
mutex_destroy(&dbg_buf.lock);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2014, 2017 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
|
||||
|
@ -125,6 +125,7 @@ struct dentry *msm_vidc_debugfs_init_inst(struct msm_vidc_inst *inst,
|
|||
struct dentry *parent);
|
||||
void msm_vidc_debugfs_update(struct msm_vidc_inst *inst,
|
||||
enum msm_vidc_debugfs_event e);
|
||||
void msm_vidc_debugfs_deinit_drv(void);
|
||||
|
||||
static inline void tic(struct msm_vidc_inst *i, enum profiling_points p,
|
||||
char *b)
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#define DEFAULT_WIDTH 1920
|
||||
#define MIN_SUPPORTED_WIDTH 32
|
||||
#define MIN_SUPPORTED_HEIGHT 32
|
||||
#define MAX_SUPPORTED_INSTANCES_COUNT 13
|
||||
|
||||
/* Maintains the number of FTB's between each FBD over a window */
|
||||
#define DCVS_FTB_WINDOW 32
|
||||
|
|
|
@ -933,15 +933,12 @@ static int venus_hfi_vote_active_buses(void *dev,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* (Re-)alloc memory to store the new votes (in case we internally
|
||||
* re-vote after power collapse, which is transparent to client) */
|
||||
cached_vote_data = krealloc(device->bus_load.vote_data, num_data *
|
||||
sizeof(*cached_vote_data), GFP_KERNEL);
|
||||
if (!cached_vote_data) {
|
||||
dprintk(VIDC_ERR, "Can't alloc memory to cache bus votes\n");
|
||||
rc = -ENOMEM;
|
||||
goto err_no_mem;
|
||||
}
|
||||
cached_vote_data = device->bus_load.vote_data;
|
||||
if (!cached_vote_data) {
|
||||
dprintk(VIDC_ERR,"Invalid bus load vote data\n");
|
||||
rc = -ENOMEM;
|
||||
goto err_no_mem;
|
||||
}
|
||||
|
||||
/* Alloc & init the load table */
|
||||
num_bus = device->res->bus_set.count;
|
||||
|
@ -4135,9 +4132,15 @@ static int venus_hfi_init_bus(struct venus_hfi_device *device)
|
|||
dprintk(VIDC_DBG, "Registered bus client %s\n", name);
|
||||
}
|
||||
|
||||
device->bus_load.vote_data = NULL;
|
||||
device->bus_load.vote_data_count = 0;
|
||||
device->bus_load.vote_data = (struct vidc_bus_vote_data *)
|
||||
kzalloc(sizeof(struct vidc_bus_vote_data)*MAX_SUPPORTED_INSTANCES_COUNT, GFP_KERNEL);
|
||||
|
||||
if (device->bus_load.vote_data == NULL) {
|
||||
dprintk(VIDC_ERR,"Failed to allocate memory for vote_data\n");
|
||||
rc = -ENOMEM;
|
||||
goto err_init_bus;
|
||||
}
|
||||
device->bus_load.vote_data_count = 0;
|
||||
return rc;
|
||||
err_init_bus:
|
||||
venus_hfi_deinit_bus(device);
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "q6audio_common.h"
|
||||
#include "audio_utils_aio.h"
|
||||
#include <sound/msm-audio-effects-q6-v2.h>
|
||||
#include <sound/msm-dts-eagle.h>
|
||||
|
||||
#define MAX_CHANNELS_SUPPORTED 8
|
||||
#define WAIT_TIMEDOUT_DURATION_SECS 1
|
||||
|
@ -53,31 +52,11 @@ static void audio_effects_init_pp(struct audio_client *ac)
|
|||
pr_err("%s: audio client null to init pp\n", __func__);
|
||||
return;
|
||||
}
|
||||
switch (ac->topology) {
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER:
|
||||
|
||||
ret = q6asm_set_softvolume_v2(ac, &softvol,
|
||||
SOFT_VOLUME_INSTANCE_1);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Send SoftVolume1 Param failed ret=%d\n",
|
||||
__func__, ret);
|
||||
ret = q6asm_set_softvolume_v2(ac, &softvol,
|
||||
SOFT_VOLUME_INSTANCE_2);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Send SoftVolume2 Param failed ret=%d\n",
|
||||
__func__, ret);
|
||||
|
||||
msm_dts_eagle_init_master_module(ac);
|
||||
|
||||
break;
|
||||
default:
|
||||
ret = q6asm_set_softvolume_v2(ac, &softvol,
|
||||
SOFT_VOLUME_INSTANCE_1);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Send SoftVolume Param failed ret=%d\n",
|
||||
__func__, ret);
|
||||
break;
|
||||
}
|
||||
ret = q6asm_set_softvolume_v2(ac, &softvol,
|
||||
SOFT_VOLUME_INSTANCE_1);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Send SoftVolume Param failed ret=%d\n",
|
||||
__func__, ret);
|
||||
}
|
||||
|
||||
static void audio_effects_deinit_pp(struct audio_client *ac)
|
||||
|
@ -86,13 +65,6 @@ static void audio_effects_deinit_pp(struct audio_client *ac)
|
|||
pr_err("%s: audio client null to deinit pp\n", __func__);
|
||||
return;
|
||||
}
|
||||
switch (ac->topology) {
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER:
|
||||
msm_dts_eagle_deinit_master_module(ac);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void audio_effects_event_handler(uint32_t opcode, uint32_t token,
|
||||
|
@ -148,6 +120,8 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
case AUDIO_START: {
|
||||
pr_debug("%s: AUDIO_START\n", __func__);
|
||||
|
||||
mutex_lock(&effects->lock);
|
||||
|
||||
rc = q6asm_open_read_write_v2(effects->ac,
|
||||
FORMAT_LINEAR_PCM,
|
||||
FORMAT_MULTI_CHANNEL_LINEAR_PCM,
|
||||
|
@ -159,6 +133,7 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
pr_err("%s: Open failed for hw accelerated effects:rc=%d\n",
|
||||
__func__, rc);
|
||||
rc = -EINVAL;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto ioctl_fail;
|
||||
}
|
||||
effects->opened = 1;
|
||||
|
@ -175,6 +150,7 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
pr_err("%s: Write buffer Allocation failed rc = %d\n",
|
||||
__func__, rc);
|
||||
rc = -ENOMEM;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto ioctl_fail;
|
||||
}
|
||||
atomic_set(&effects->in_count, effects->config.input.num_buf);
|
||||
|
@ -185,6 +161,7 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
pr_err("%s: Read buffer Allocation failed rc = %d\n",
|
||||
__func__, rc);
|
||||
rc = -ENOMEM;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto readbuf_fail;
|
||||
}
|
||||
atomic_set(&effects->out_count, effects->config.output.num_buf);
|
||||
|
@ -199,6 +176,7 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
if (rc < 0) {
|
||||
pr_err("%s: pcm read block config failed\n", __func__);
|
||||
rc = -EINVAL;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto cfg_fail;
|
||||
}
|
||||
pr_debug("%s: dec: sample_rate: %d, num_channels: %d, bit_width: %d\n",
|
||||
|
@ -213,6 +191,7 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
pr_err("%s: pcm write format block config failed\n",
|
||||
__func__);
|
||||
rc = -EINVAL;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto cfg_fail;
|
||||
}
|
||||
|
||||
|
@ -225,6 +204,7 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
effects->started = 0;
|
||||
pr_err("%s: ASM run state failed\n", __func__);
|
||||
}
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
case AUDIO_EFFECTS_WRITE: {
|
||||
|
@ -246,7 +226,7 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
if (!rc) {
|
||||
pr_err("%s: write wait_event_timeout\n", __func__);
|
||||
rc = -EFAULT;
|
||||
mutex_unlock(&effects->lock);
|
||||
mutex_unlock(&effects->lock);
|
||||
goto ioctl_fail;
|
||||
}
|
||||
if (!atomic_read(&effects->out_count)) {
|
||||
|
@ -286,8 +266,11 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
uint32_t idx = 0;
|
||||
uint32_t size = 0;
|
||||
|
||||
mutex_lock(&effects->lock);
|
||||
|
||||
if (!effects->started) {
|
||||
rc = -EFAULT;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto ioctl_fail;
|
||||
}
|
||||
|
||||
|
@ -304,11 +287,13 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
if (!rc) {
|
||||
pr_err("%s: read wait_event_timeout\n", __func__);
|
||||
rc = -EFAULT;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto ioctl_fail;
|
||||
}
|
||||
if (!atomic_read(&effects->in_count)) {
|
||||
pr_err("%s: pcm stopped in_count 0\n", __func__);
|
||||
rc = -EFAULT;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto ioctl_fail;
|
||||
}
|
||||
|
||||
|
@ -316,15 +301,18 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned cmd,
|
|||
if (bufptr) {
|
||||
if (!((void *)arg)) {
|
||||
rc = -EFAULT;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto ioctl_fail;
|
||||
}
|
||||
if ((effects->config.buf_cfg.input_len > size) ||
|
||||
copy_to_user((void *)arg, bufptr,
|
||||
effects->config.buf_cfg.input_len)) {
|
||||
rc = -EFAULT;
|
||||
mutex_unlock(&effects->lock);
|
||||
goto ioctl_fail;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -412,33 +400,6 @@ static long audio_effects_set_pp_param(struct q6audio_effects *effects,
|
|||
&(effects->audio_effects.topo_switch_vol),
|
||||
(long *)&values[1], SOFT_VOLUME_INSTANCE_2);
|
||||
break;
|
||||
case DTS_EAGLE_MODULE_ENABLE:
|
||||
pr_debug("%s: DTS_EAGLE_MODULE_ENABLE\n", __func__);
|
||||
if (msm_audio_effects_is_effmodule_supp_in_top(
|
||||
effects_module, effects->ac->topology)) {
|
||||
/*
|
||||
* HPX->OFF: first disable HPX and then
|
||||
* enable SA+
|
||||
* HPX->ON: first disable SA+ and then
|
||||
* enable HPX
|
||||
*/
|
||||
bool hpx_state = (bool)values[1];
|
||||
if (hpx_state)
|
||||
msm_audio_effects_enable_extn(effects->ac,
|
||||
&(effects->audio_effects),
|
||||
false);
|
||||
msm_dts_eagle_enable_asm(effects->ac,
|
||||
hpx_state,
|
||||
AUDPROC_MODULE_ID_DTS_HPX_PREMIX);
|
||||
msm_dts_eagle_enable_asm(effects->ac,
|
||||
hpx_state,
|
||||
AUDPROC_MODULE_ID_DTS_HPX_POSTMIX);
|
||||
if (!hpx_state)
|
||||
msm_audio_effects_enable_extn(effects->ac,
|
||||
&(effects->audio_effects),
|
||||
true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pr_err("%s: Invalid effects config module\n", __func__);
|
||||
rc = -EINVAL;
|
||||
|
@ -456,6 +417,7 @@ static long audio_effects_ioctl(struct file *file, unsigned int cmd,
|
|||
switch (cmd) {
|
||||
case AUDIO_SET_EFFECTS_CONFIG: {
|
||||
pr_debug("%s: AUDIO_SET_EFFECTS_CONFIG\n", __func__);
|
||||
mutex_lock(&effects->lock);
|
||||
memset(&effects->config, 0, sizeof(effects->config));
|
||||
if (copy_from_user(&effects->config, (void *)arg,
|
||||
sizeof(effects->config))) {
|
||||
|
@ -473,6 +435,7 @@ static long audio_effects_ioctl(struct file *file, unsigned int cmd,
|
|||
effects->config.input.num_buf,
|
||||
effects->config.input.sample_rate,
|
||||
effects->config.input.num_channels);
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
case AUDIO_EFFECTS_SET_BUF_LEN: {
|
||||
|
@ -494,6 +457,7 @@ static long audio_effects_ioctl(struct file *file, unsigned int cmd,
|
|||
|
||||
buf_avail.input_num_avail = atomic_read(&effects->in_count);
|
||||
buf_avail.output_num_avail = atomic_read(&effects->out_count);
|
||||
mutex_lock(&effects->lock);
|
||||
pr_debug("%s: write buf avail: %d, read buf avail: %d\n",
|
||||
__func__, buf_avail.output_num_avail,
|
||||
buf_avail.input_num_avail);
|
||||
|
@ -503,16 +467,20 @@ static long audio_effects_ioctl(struct file *file, unsigned int cmd,
|
|||
__func__);
|
||||
rc = -EFAULT;
|
||||
}
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
case AUDIO_EFFECTS_SET_PP_PARAMS: {
|
||||
mutex_lock(&effects->lock);
|
||||
if (copy_from_user(argvalues, (void *)arg,
|
||||
MAX_PP_PARAMS_SZ*sizeof(long))) {
|
||||
pr_err("%s: copy from user for pp params failed\n",
|
||||
__func__);
|
||||
mutex_unlock(&effects->lock);
|
||||
return -EFAULT;
|
||||
}
|
||||
rc = audio_effects_set_pp_param(effects, argvalues);
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -578,12 +546,14 @@ static long audio_effects_compat_ioctl(struct file *file, unsigned int cmd,
|
|||
case AUDIO_SET_EFFECTS_CONFIG32: {
|
||||
struct msm_hwacc_effects_config32 config32;
|
||||
struct msm_hwacc_effects_config *config = &effects->config;
|
||||
mutex_lock(&effects->lock);
|
||||
memset(&effects->config, 0, sizeof(effects->config));
|
||||
if (copy_from_user(&config32, (void *)arg,
|
||||
sizeof(config32))) {
|
||||
pr_err("%s: copy to user for AUDIO_SET_EFFECTS_CONFIG failed\n",
|
||||
__func__);
|
||||
rc = -EFAULT;
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
config->input.buf_size = config32.input.buf_size;
|
||||
|
@ -620,16 +590,19 @@ static long audio_effects_compat_ioctl(struct file *file, unsigned int cmd,
|
|||
effects->config.input.num_buf,
|
||||
effects->config.input.sample_rate,
|
||||
effects->config.input.num_channels);
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
case AUDIO_EFFECTS_SET_BUF_LEN32: {
|
||||
struct msm_hwacc_buf_cfg32 buf_cfg32;
|
||||
struct msm_hwacc_effects_config *config = &effects->config;
|
||||
mutex_lock(&effects->lock);
|
||||
if (copy_from_user(&buf_cfg32, (void *)arg,
|
||||
sizeof(buf_cfg32))) {
|
||||
pr_err("%s: copy from user for AUDIO_EFFECTS_SET_BUF_LEN failed\n",
|
||||
__func__);
|
||||
rc = -EFAULT;
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
config->buf_cfg.input_len = buf_cfg32.input_len;
|
||||
|
@ -637,6 +610,7 @@ static long audio_effects_compat_ioctl(struct file *file, unsigned int cmd,
|
|||
pr_debug("%s: write buf len: %d, read buf len: %d\n",
|
||||
__func__, effects->config.buf_cfg.output_len,
|
||||
effects->config.buf_cfg.input_len);
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
case AUDIO_EFFECTS_GET_BUF_AVAIL32: {
|
||||
|
@ -644,6 +618,7 @@ static long audio_effects_compat_ioctl(struct file *file, unsigned int cmd,
|
|||
|
||||
memset(&buf_avail, 0, sizeof(buf_avail));
|
||||
|
||||
mutex_lock(&effects->lock);
|
||||
buf_avail.input_num_avail = atomic_read(&effects->in_count);
|
||||
buf_avail.output_num_avail = atomic_read(&effects->out_count);
|
||||
pr_debug("%s: write buf avail: %d, read buf avail: %d\n",
|
||||
|
@ -655,22 +630,26 @@ static long audio_effects_compat_ioctl(struct file *file, unsigned int cmd,
|
|||
__func__);
|
||||
rc = -EFAULT;
|
||||
}
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
case AUDIO_EFFECTS_SET_PP_PARAMS32: {
|
||||
long argvalues[MAX_PP_PARAMS_SZ] = {0};
|
||||
int argvalues32[MAX_PP_PARAMS_SZ] = {0};
|
||||
|
||||
mutex_lock(&effects->lock);
|
||||
if (copy_from_user(argvalues32, (void *)arg,
|
||||
MAX_PP_PARAMS_SZ*sizeof(int))) {
|
||||
pr_err("%s: copy from user failed for pp params\n",
|
||||
__func__);
|
||||
mutex_unlock(&effects->lock);
|
||||
return -EFAULT;
|
||||
}
|
||||
for (i = 0; i < MAX_PP_PARAMS_SZ; i++)
|
||||
argvalues[i] = argvalues32[i];
|
||||
|
||||
rc = audio_effects_set_pp_param(effects, argvalues);
|
||||
mutex_unlock(&effects->lock);
|
||||
break;
|
||||
}
|
||||
case AUDIO_START32: {
|
||||
|
@ -764,8 +743,6 @@ static int audio_effects_open(struct inode *inode, struct file *file)
|
|||
init_waitqueue_head(&effects->write_wait);
|
||||
mutex_init(&effects->lock);
|
||||
|
||||
mutex_init(&effects->lock);
|
||||
|
||||
effects->opened = 0;
|
||||
effects->started = 0;
|
||||
effects->buf_alloc = 0;
|
||||
|
|
|
@ -846,6 +846,7 @@ static long audio_aio_process_event_req_compat(struct q6audio_aio *audio,
|
|||
long rc;
|
||||
struct msm_audio_event32 usr_evt_32;
|
||||
struct msm_audio_event usr_evt;
|
||||
memset(&usr_evt, 0, sizeof(struct msm_audio_event));
|
||||
|
||||
if (copy_from_user(&usr_evt_32, arg,
|
||||
sizeof(struct msm_audio_event32))) {
|
||||
|
@ -855,6 +856,11 @@ static long audio_aio_process_event_req_compat(struct q6audio_aio *audio,
|
|||
usr_evt.timeout_ms = usr_evt_32.timeout_ms;
|
||||
|
||||
rc = audio_aio_process_event_req_common(audio, &usr_evt);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: audio process event failed, rc = %ld",
|
||||
__func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
usr_evt_32.event_type = usr_evt.event_type;
|
||||
switch (usr_evt_32.event_type) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2017, 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
|
||||
|
@ -172,7 +172,7 @@ static const int s_button_map[] = {
|
|||
};
|
||||
|
||||
/* The opened devices container */
|
||||
static int s_opened_devs[MAX_DEVS_NUMBER];
|
||||
static atomic_t s_opened_devs[MAX_DEVS_NUMBER];
|
||||
|
||||
#define USF_NAME_PREFIX "usf_"
|
||||
#define USF_NAME_PREFIX_SIZE 4
|
||||
|
@ -2297,14 +2297,11 @@ static uint16_t add_opened_dev(int minor)
|
|||
uint16_t ind = 0;
|
||||
|
||||
for (ind = 0; ind < MAX_DEVS_NUMBER; ++ind) {
|
||||
if (minor == s_opened_devs[ind]) {
|
||||
if (minor == atomic_cmpxchg(&s_opened_devs[ind], 0, minor)) {
|
||||
pr_err("%s: device %d is already opened\n",
|
||||
__func__, minor);
|
||||
return USF_UNDEF_DEV_ID;
|
||||
}
|
||||
|
||||
if (s_opened_devs[ind] == 0) {
|
||||
s_opened_devs[ind] = minor;
|
||||
} else {
|
||||
pr_debug("%s: device %d is added; ind=%d\n",
|
||||
__func__, minor, ind);
|
||||
return ind;
|
||||
|
@ -2359,7 +2356,7 @@ static int usf_release(struct inode *inode, struct file *file)
|
|||
usf_disable(&usf->usf_tx);
|
||||
usf_disable(&usf->usf_rx);
|
||||
|
||||
s_opened_devs[usf->dev_ind] = 0;
|
||||
atomic_set(&s_opened_devs[usf->dev_ind], 0);
|
||||
|
||||
mutex_unlock(&usf->mutex);
|
||||
mutex_destroy(&usf->mutex);
|
||||
|
|
|
@ -2084,7 +2084,13 @@ static int qseecom_load_app(struct qseecom_dev_handle *data, void __user *argp)
|
|||
ret);
|
||||
goto loadapp_err;
|
||||
}
|
||||
|
||||
if (load_img_req.mdt_len > len || load_img_req.img_len > len) {
|
||||
pr_err("ion len %zu is smaller than mdt_len %u or img_len %u\n",
|
||||
len, load_img_req.mdt_len,
|
||||
load_img_req.img_len);
|
||||
ret = -EINVAL;
|
||||
goto loadapp_err;
|
||||
}
|
||||
/* Populate the structure for sending scm call to load image */
|
||||
if (qseecom.qsee_version < QSEE_VERSION_40) {
|
||||
load_req.qsee_cmd_id = QSEOS_APP_START_COMMAND;
|
||||
|
@ -2391,23 +2397,6 @@ int __qseecom_process_rpmb_svc_cmd(struct qseecom_dev_handle *data_ptr,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (((uintptr_t)req_ptr->cmd_req_buf <
|
||||
data_ptr->client.user_virt_sb_base)
|
||||
|| ((uintptr_t)req_ptr->cmd_req_buf >=
|
||||
(data_ptr->client.user_virt_sb_base +
|
||||
data_ptr->client.sb_length))) {
|
||||
pr_err("cmd buffer address not within shared bufffer\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (((uintptr_t)req_ptr->resp_buf <
|
||||
data_ptr->client.user_virt_sb_base) ||
|
||||
((uintptr_t)req_ptr->resp_buf >=
|
||||
(data_ptr->client.user_virt_sb_base +
|
||||
data_ptr->client.sb_length))){
|
||||
pr_err("response buffer address not within shared bufffer\n");
|
||||
}
|
||||
|
||||
if (data_ptr->client.sb_length <
|
||||
sizeof(struct qseecom_rpmb_provision_key)) {
|
||||
pr_err("shared buffer is too small to hold key type\n");
|
||||
|
@ -4950,6 +4939,12 @@ static int qseecom_load_external_elf(struct qseecom_dev_handle *data,
|
|||
ret);
|
||||
return ret;
|
||||
}
|
||||
if (load_img_req.mdt_len > len || load_img_req.img_len > len) {
|
||||
pr_err("ion len %zu is smaller than mdt_len %u or img_len %u\n",
|
||||
len, load_img_req.mdt_len,
|
||||
load_img_req.img_len);
|
||||
return ret;
|
||||
}
|
||||
/* Populate the structure for sending scm call to load image */
|
||||
if (qseecom.qsee_version < QSEE_VERSION_40) {
|
||||
load_req.qsee_cmd_id = QSEOS_LOAD_EXTERNAL_ELF_COMMAND;
|
||||
|
@ -6787,7 +6782,11 @@ long qseecom_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
|||
break;
|
||||
}
|
||||
pr_debug("SET_MEM_PARAM: qseecom addr = 0x%pK\n", data);
|
||||
mutex_lock(&app_access_lock);
|
||||
atomic_inc(&data->ioctl_count);
|
||||
ret = qseecom_set_client_mem_param(data, argp);
|
||||
atomic_dec(&data->ioctl_count);
|
||||
mutex_unlock(&app_access_lock);
|
||||
if (ret)
|
||||
pr_err("failed Qqseecom_set_mem_param request: %d\n",
|
||||
ret);
|
||||
|
|
|
@ -769,6 +769,15 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
|
|||
idata = mmc_blk_ioctl_copy_from_user(ic_ptr);
|
||||
if (IS_ERR_OR_NULL(idata))
|
||||
return PTR_ERR(idata);
|
||||
if (idata->ic.postsleep_max_us < idata->ic.postsleep_min_us) {
|
||||
pr_err("%s: min value: %u must not be greater than max value: %u\n",
|
||||
__func__, idata->ic.postsleep_min_us,
|
||||
idata->ic.postsleep_max_us);
|
||||
WARN_ON(1);
|
||||
err = -EPERM;
|
||||
goto cmd_err;
|
||||
}
|
||||
|
||||
md = mmc_blk_get(bdev->bd_disk);
|
||||
if (!md) {
|
||||
err = -EINVAL;
|
||||
|
@ -785,6 +794,14 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
|
|||
cmd.arg = idata->ic.arg;
|
||||
cmd.flags = idata->ic.flags;
|
||||
|
||||
if (idata->ic.postsleep_max_us < idata->ic.postsleep_min_us) {
|
||||
pr_err("%s: min value: %u must not be greater than max value: %u\n",
|
||||
__func__, idata->ic.postsleep_min_us,
|
||||
idata->ic.postsleep_max_us);
|
||||
WARN_ON(1);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
if (idata->buf_bytes) {
|
||||
int len;
|
||||
data.blksz = idata->ic.blksz;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2015, 2017, 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
|
||||
|
@ -400,7 +400,6 @@ static struct {
|
|||
int user_cal_available;
|
||||
u32 user_cal_rcvd;
|
||||
int user_cal_exp_size;
|
||||
int device_opened;
|
||||
int iris_xo_mode_set;
|
||||
int fw_vbatt_state;
|
||||
char wlan_nv_macAddr[WLAN_MAC_ADDR_SIZE];
|
||||
|
@ -3280,14 +3279,6 @@ static int wcnss_node_open(struct inode *inode, struct file *file)
|
|||
return -EFAULT;
|
||||
}
|
||||
|
||||
mutex_lock(&penv->dev_lock);
|
||||
penv->user_cal_rcvd = 0;
|
||||
penv->user_cal_read = 0;
|
||||
penv->user_cal_available = false;
|
||||
penv->user_cal_data = NULL;
|
||||
penv->device_opened = 1;
|
||||
mutex_unlock(&penv->dev_lock);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -3296,7 +3287,7 @@ static ssize_t wcnss_wlan_read(struct file *fp, char __user
|
|||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!penv || !penv->device_opened)
|
||||
if (!penv)
|
||||
return -EFAULT;
|
||||
|
||||
rc = wait_event_interruptible(penv->read_wait, penv->fw_cal_rcvd
|
||||
|
@ -3333,55 +3324,66 @@ static ssize_t wcnss_wlan_write(struct file *fp, const char __user
|
|||
*user_buffer, size_t count, loff_t *position)
|
||||
{
|
||||
int rc = 0;
|
||||
u32 size = 0;
|
||||
char *cal_data = NULL;
|
||||
|
||||
if (!penv || !penv->device_opened || penv->user_cal_available)
|
||||
if (!penv || penv->user_cal_available)
|
||||
return -EFAULT;
|
||||
|
||||
if (penv->user_cal_rcvd == 0 && count >= 4
|
||||
&& !penv->user_cal_data) {
|
||||
rc = copy_from_user((void *)&size, user_buffer, 4);
|
||||
if (!size || size > MAX_CALIBRATED_DATA_SIZE) {
|
||||
pr_err(DEVICE " invalid size to write %d\n", size);
|
||||
if (!penv->user_cal_rcvd && count >= 4 && !penv->user_cal_exp_size) {
|
||||
mutex_lock(&penv->dev_lock);
|
||||
rc = copy_from_user((void *)&penv->user_cal_exp_size,
|
||||
user_buffer, 4);
|
||||
if (!penv->user_cal_exp_size ||
|
||||
penv->user_cal_exp_size > MAX_CALIBRATED_DATA_SIZE) {
|
||||
pr_err(DEVICE " invalid size to write %d\n",
|
||||
penv->user_cal_exp_size);
|
||||
penv->user_cal_exp_size = 0;
|
||||
mutex_unlock(&penv->dev_lock);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
rc += count;
|
||||
count -= 4;
|
||||
penv->user_cal_exp_size = size;
|
||||
penv->user_cal_data = kmalloc(size, GFP_KERNEL);
|
||||
if (penv->user_cal_data == NULL) {
|
||||
pr_err(DEVICE " no memory to write\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (0 == count)
|
||||
goto exit;
|
||||
|
||||
} else if (penv->user_cal_rcvd == 0 && count < 4)
|
||||
mutex_unlock(&penv->dev_lock);
|
||||
return count;
|
||||
} else if (!penv->user_cal_rcvd && count < 4) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
mutex_lock(&penv->dev_lock);
|
||||
if ((UINT32_MAX - count < penv->user_cal_rcvd) ||
|
||||
(penv->user_cal_exp_size < count + penv->user_cal_rcvd)) {
|
||||
pr_err(DEVICE " invalid size to write %zu\n", count +
|
||||
penv->user_cal_rcvd);
|
||||
rc = -ENOMEM;
|
||||
goto exit;
|
||||
mutex_unlock(&penv->dev_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
rc = copy_from_user((void *)penv->user_cal_data +
|
||||
penv->user_cal_rcvd, user_buffer, count);
|
||||
if (0 == rc) {
|
||||
|
||||
cal_data = kmalloc(count, GFP_KERNEL);
|
||||
if (!cal_data) {
|
||||
mutex_unlock(&penv->dev_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
rc = copy_from_user(cal_data, user_buffer, count);
|
||||
if (!rc) {
|
||||
memcpy(penv->user_cal_data + penv->user_cal_rcvd,
|
||||
cal_data, count);
|
||||
penv->user_cal_rcvd += count;
|
||||
rc += count;
|
||||
}
|
||||
|
||||
kfree(cal_data);
|
||||
if (penv->user_cal_rcvd == penv->user_cal_exp_size) {
|
||||
penv->user_cal_available = true;
|
||||
pr_info_ratelimited("wcnss: user cal written");
|
||||
}
|
||||
mutex_unlock(&penv->dev_lock);
|
||||
|
||||
exit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int wcnss_node_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wcnss_notif_cb(struct notifier_block *this, unsigned long code,
|
||||
void *ss_handle)
|
||||
|
@ -3440,6 +3442,7 @@ static const struct file_operations wcnss_node_fops = {
|
|||
.open = wcnss_node_open,
|
||||
.read = wcnss_wlan_read,
|
||||
.write = wcnss_wlan_write,
|
||||
.release = wcnss_node_release,
|
||||
};
|
||||
|
||||
static struct miscdevice wcnss_misc = {
|
||||
|
@ -3467,6 +3470,13 @@ wcnss_wlan_probe(struct platform_device *pdev)
|
|||
}
|
||||
penv->pdev = pdev;
|
||||
|
||||
penv->user_cal_data =
|
||||
devm_kzalloc(&pdev->dev, MAX_CALIBRATED_DATA_SIZE, GFP_KERNEL);
|
||||
if (!penv->user_cal_data) {
|
||||
dev_err(&pdev->dev, "Failed to alloc memory for cal data.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* register sysfs entries */
|
||||
ret = wcnss_create_sysfs(&pdev->dev);
|
||||
if (ret) {
|
||||
|
@ -3487,6 +3497,11 @@ wcnss_wlan_probe(struct platform_device *pdev)
|
|||
mutex_init(&penv->pm_qos_mutex);
|
||||
init_waitqueue_head(&penv->read_wait);
|
||||
|
||||
penv->user_cal_rcvd = 0;
|
||||
penv->user_cal_read = 0;
|
||||
penv->user_cal_exp_size = 0;
|
||||
penv->user_cal_available = false;
|
||||
|
||||
/* Since we were built into the kernel we'll be called as part
|
||||
* of kernel initialization. We don't know if userspace
|
||||
* applications are available to service PIL at this time
|
||||
|
|
|
@ -553,6 +553,8 @@ ssize_t ipa_read(struct file *filp, char __user *buf, size_t count,
|
|||
mutex_unlock(&ipa_ctx->msg_lock);
|
||||
if (copy_to_user(buf, &msg->meta,
|
||||
sizeof(struct ipa_msg_meta))) {
|
||||
kfree(msg);
|
||||
msg = NULL;
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
@ -561,6 +563,8 @@ ssize_t ipa_read(struct file *filp, char __user *buf, size_t count,
|
|||
if (msg->buff) {
|
||||
if (copy_to_user(buf, msg->buff,
|
||||
msg->meta.msg_len)) {
|
||||
kfree(msg);
|
||||
msg = NULL;
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2014-2017, 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
|
||||
|
@ -1388,6 +1388,8 @@ static int ipa_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
|||
memcpy(mux_channel[rmnet_index].vchannel_name,
|
||||
extend_ioctl_data.u.rmnet_mux_val.vchannel_name,
|
||||
sizeof(mux_channel[rmnet_index].vchannel_name));
|
||||
mux_channel[rmnet_index].vchannel_name[
|
||||
IFNAMSIZ - 1] = '\0';
|
||||
IPAWANDBG("cashe device[%s:%d] in IPA_wan[%d]\n",
|
||||
mux_channel[rmnet_index].vchannel_name,
|
||||
mux_channel[rmnet_index].mux_id,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2014-2017, 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
|
||||
|
@ -188,22 +188,6 @@ static const struct file_operations mhi_dbgfs_ev_fops = {
|
|||
.write = NULL,
|
||||
};
|
||||
|
||||
static ssize_t mhi_dbgfs_trigger_msi(struct file *fp, const char __user *buf,
|
||||
size_t count, loff_t *offp)
|
||||
{
|
||||
u32 msi_nr = 0;
|
||||
void *irq_ctxt = &((mhi_devices.device_list[0]).pcie_device->dev);
|
||||
if (copy_from_user(&msi_nr, buf, sizeof(msi_nr)))
|
||||
return -ENOMEM;
|
||||
mhi_msi_handlr(msi_nr, irq_ctxt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations mhi_dbgfs_trigger_msi_fops = {
|
||||
.read = NULL,
|
||||
.write = mhi_dbgfs_trigger_msi,
|
||||
};
|
||||
|
||||
static ssize_t mhi_dbgfs_state_read(struct file *fp, char __user *buf,
|
||||
size_t count, loff_t *offp)
|
||||
{
|
||||
|
@ -303,7 +287,6 @@ int mhi_init_debugfs(struct mhi_device_ctxt *mhi_dev_ctxt)
|
|||
{
|
||||
struct dentry *mhi_chan_stats;
|
||||
struct dentry *mhi_state_stats;
|
||||
struct dentry *mhi_msi_trigger;
|
||||
struct dentry *mhi_ev_stats;
|
||||
mhi_dev_ctxt->mhi_parent_folder =
|
||||
debugfs_create_dir("mhi", NULL);
|
||||
|
@ -332,21 +315,12 @@ int mhi_init_debugfs(struct mhi_device_ctxt *mhi_dev_ctxt)
|
|||
&mhi_dbgfs_state_fops);
|
||||
if (mhi_state_stats == NULL)
|
||||
goto clean_ev_stats;
|
||||
mhi_msi_trigger = debugfs_create_file("mhi_msi_trigger",
|
||||
0444,
|
||||
mhi_dev_ctxt->mhi_parent_folder,
|
||||
mhi_dev_ctxt,
|
||||
&mhi_dbgfs_trigger_msi_fops);
|
||||
if (mhi_msi_trigger == NULL)
|
||||
goto clean_state;
|
||||
|
||||
mhi_dev_ctxt->chan_info = kmalloc(MHI_LOG_SIZE, GFP_KERNEL);
|
||||
if (mhi_dev_ctxt->chan_info == NULL)
|
||||
goto clean_all;
|
||||
return 0;
|
||||
clean_all:
|
||||
debugfs_remove(mhi_msi_trigger);
|
||||
clean_state:
|
||||
debugfs_remove(mhi_state_stats);
|
||||
clean_ev_stats:
|
||||
debugfs_remove(mhi_ev_stats);
|
||||
|
|
|
@ -386,6 +386,8 @@ static int pil_alloc_region(struct pil_priv *priv, phys_addr_t min_addr,
|
|||
if (region == NULL) {
|
||||
pil_err(priv->desc, "Failed to allocate relocatable region of size %zx\n",
|
||||
size);
|
||||
priv->region_start = 0;
|
||||
priv->region_end = 0;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -819,7 +821,8 @@ out:
|
|||
&desc->attrs);
|
||||
priv->region = NULL;
|
||||
}
|
||||
pil_clear_segment(desc);
|
||||
if (desc->clear_fw_region && priv->region_start)
|
||||
pil_clear_segment(desc);
|
||||
pil_release_mmap(desc);
|
||||
}
|
||||
return ret;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2010-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2010-2015,2017, 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
|
||||
|
@ -36,6 +36,7 @@ struct pil_priv;
|
|||
* @unmap_fw_mem: Custom function used to undo mapping by map_fw_mem.
|
||||
* This defaults to iounmap if not specified.
|
||||
* @shutdown_fail: Set if PIL op for shutting down subsystem fails.
|
||||
* @clear_fw_region: Clear fw region on failure in loading.
|
||||
*/
|
||||
struct pil_desc {
|
||||
const char *name;
|
||||
|
@ -53,6 +54,7 @@ struct pil_desc {
|
|||
void (*unmap_fw_mem)(void *virt, size_t size, void *data);
|
||||
void *map_data;
|
||||
bool shutdown_fail;
|
||||
bool clear_fw_region;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, 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
|
||||
|
@ -560,7 +560,15 @@ int pil_mss_reset_load_mba(struct pil_desc *pil)
|
|||
goto err_mba_data;
|
||||
}
|
||||
count = fw->size;
|
||||
memcpy(mba_virt, data, count);
|
||||
if (count <= SZ_1M) {
|
||||
/* Ensures memcpy is done for max 1MB fw size */
|
||||
memcpy(mba_virt, data, count);
|
||||
} else {
|
||||
dev_err(pil->dev, "%s fw image loading into memory is failed due to fw size overflow\n",
|
||||
__func__);
|
||||
ret = -EINVAL;
|
||||
goto err_mba_data;
|
||||
}
|
||||
wmb();
|
||||
|
||||
/* Load modem debug policy */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2015,2017, 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
|
||||
|
@ -466,6 +466,7 @@ struct q6v5_data *pil_q6v5_init(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
desc->clear_fw_region = false;
|
||||
desc->dev = &pdev->dev;
|
||||
|
||||
drv->qdsp6v5_2_0 = of_device_is_compatible(pdev->dev.of_node,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2009-2015, 2017, 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
|
||||
|
@ -44,6 +44,7 @@
|
|||
#define SMEM_IMAGE_VERSION_OEM_OFFSET 96
|
||||
#define SMEM_IMAGE_VERSION_PARTITION_APPS 10
|
||||
|
||||
static DECLARE_RWSEM(current_image_rwsem);
|
||||
enum {
|
||||
HW_PLATFORM_UNKNOWN = 0,
|
||||
HW_PLATFORM_SURF = 1,
|
||||
|
@ -811,7 +812,9 @@ msm_get_image_version(struct device *dev,
|
|||
__func__);
|
||||
return snprintf(buf, SMEM_IMAGE_VERSION_NAME_SIZE, "Unknown");
|
||||
}
|
||||
down_read(¤t_image_rwsem);
|
||||
string_address += current_image * SMEM_IMAGE_VERSION_SINGLE_BLOCK_SIZE;
|
||||
up_read(¤t_image_rwsem);
|
||||
return snprintf(buf, SMEM_IMAGE_VERSION_NAME_SIZE, "%-.75s\n",
|
||||
string_address);
|
||||
}
|
||||
|
@ -824,15 +827,20 @@ msm_set_image_version(struct device *dev,
|
|||
{
|
||||
char *store_address;
|
||||
|
||||
if (current_image != SMEM_IMAGE_VERSION_PARTITION_APPS)
|
||||
down_read(¤t_image_rwsem);
|
||||
if (current_image != SMEM_IMAGE_VERSION_PARTITION_APPS) {
|
||||
up_read(¤t_image_rwsem);
|
||||
return count;
|
||||
}
|
||||
store_address = socinfo_get_image_version_base_address();
|
||||
if (IS_ERR_OR_NULL(store_address)) {
|
||||
pr_err("%s : Failed to get image version base address",
|
||||
__func__);
|
||||
up_read(¤t_image_rwsem);
|
||||
return count;
|
||||
}
|
||||
store_address += current_image * SMEM_IMAGE_VERSION_SINGLE_BLOCK_SIZE;
|
||||
up_read(¤t_image_rwsem);
|
||||
snprintf(store_address, SMEM_IMAGE_VERSION_NAME_SIZE, "%-.75s", buf);
|
||||
return count;
|
||||
}
|
||||
|
@ -851,7 +859,9 @@ msm_get_image_variant(struct device *dev,
|
|||
return snprintf(buf, SMEM_IMAGE_VERSION_VARIANT_SIZE,
|
||||
"Unknown");
|
||||
}
|
||||
down_read(¤t_image_rwsem);
|
||||
string_address += current_image * SMEM_IMAGE_VERSION_SINGLE_BLOCK_SIZE;
|
||||
up_read(¤t_image_rwsem);
|
||||
string_address += SMEM_IMAGE_VERSION_VARIANT_OFFSET;
|
||||
return snprintf(buf, SMEM_IMAGE_VERSION_VARIANT_SIZE, "%-.20s\n",
|
||||
string_address);
|
||||
|
@ -865,15 +875,20 @@ msm_set_image_variant(struct device *dev,
|
|||
{
|
||||
char *store_address;
|
||||
|
||||
if (current_image != SMEM_IMAGE_VERSION_PARTITION_APPS)
|
||||
down_read(¤t_image_rwsem);
|
||||
if (current_image != SMEM_IMAGE_VERSION_PARTITION_APPS) {
|
||||
up_read(¤t_image_rwsem);
|
||||
return count;
|
||||
}
|
||||
store_address = socinfo_get_image_version_base_address();
|
||||
if (IS_ERR_OR_NULL(store_address)) {
|
||||
pr_err("%s : Failed to get image version base address",
|
||||
__func__);
|
||||
up_read(¤t_image_rwsem);
|
||||
return count;
|
||||
}
|
||||
store_address += current_image * SMEM_IMAGE_VERSION_SINGLE_BLOCK_SIZE;
|
||||
up_read(¤t_image_rwsem);
|
||||
store_address += SMEM_IMAGE_VERSION_VARIANT_OFFSET;
|
||||
snprintf(store_address, SMEM_IMAGE_VERSION_VARIANT_SIZE, "%-.20s", buf);
|
||||
return count;
|
||||
|
@ -892,7 +907,9 @@ msm_get_image_crm_version(struct device *dev,
|
|||
__func__);
|
||||
return snprintf(buf, SMEM_IMAGE_VERSION_OEM_SIZE, "Unknown");
|
||||
}
|
||||
down_read(¤t_image_rwsem);
|
||||
string_address += current_image * SMEM_IMAGE_VERSION_SINGLE_BLOCK_SIZE;
|
||||
up_read(¤t_image_rwsem);
|
||||
string_address += SMEM_IMAGE_VERSION_OEM_OFFSET;
|
||||
return snprintf(buf, SMEM_IMAGE_VERSION_OEM_SIZE, "%-.32s\n",
|
||||
string_address);
|
||||
|
@ -906,15 +923,20 @@ msm_set_image_crm_version(struct device *dev,
|
|||
{
|
||||
char *store_address;
|
||||
|
||||
if (current_image != SMEM_IMAGE_VERSION_PARTITION_APPS)
|
||||
down_read(¤t_image_rwsem);
|
||||
if (current_image != SMEM_IMAGE_VERSION_PARTITION_APPS) {
|
||||
up_read(¤t_image_rwsem);
|
||||
return count;
|
||||
}
|
||||
store_address = socinfo_get_image_version_base_address();
|
||||
if (IS_ERR_OR_NULL(store_address)) {
|
||||
pr_err("%s : Failed to get image version base address",
|
||||
__func__);
|
||||
up_read(¤t_image_rwsem);
|
||||
return count;
|
||||
}
|
||||
store_address += current_image * SMEM_IMAGE_VERSION_SINGLE_BLOCK_SIZE;
|
||||
up_read(¤t_image_rwsem);
|
||||
store_address += SMEM_IMAGE_VERSION_OEM_OFFSET;
|
||||
snprintf(store_address, SMEM_IMAGE_VERSION_OEM_SIZE, "%-.32s", buf);
|
||||
return count;
|
||||
|
@ -925,8 +947,14 @@ msm_get_image_number(struct device *dev,
|
|||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||
int ret;
|
||||
|
||||
down_read(¤t_image_rwsem);
|
||||
ret = snprintf(buf, PAGE_SIZE, "%d\n",
|
||||
current_image);
|
||||
up_read(¤t_image_rwsem);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
|
@ -938,10 +966,12 @@ msm_select_image(struct device *dev, struct device_attribute *attr,
|
|||
ret = kstrtoint(buf, 10, &digit);
|
||||
if (ret)
|
||||
return ret;
|
||||
down_write(¤t_image_rwsem);
|
||||
if (0 <= digit && digit < SMEM_IMAGE_VERSION_BLOCKS_COUNT)
|
||||
current_image = digit;
|
||||
else
|
||||
current_image = 0;
|
||||
up_write(¤t_image_rwsem);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2014-2015,2017, 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
|
||||
|
@ -917,6 +917,7 @@ static int pil_tz_driver_probe(struct platform_device *pdev)
|
|||
d->desc.ops = &pil_ops_trusted;
|
||||
|
||||
d->desc.proxy_timeout = PROXY_TIMEOUT_MS;
|
||||
d->desc.clear_fw_region = true;
|
||||
|
||||
rc = of_property_read_u32(pdev->dev.of_node, "qcom,proxy-timeout-ms",
|
||||
&proxy_timeout);
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <linux/spinlock.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/cdev.h>
|
||||
|
@ -152,7 +151,6 @@ struct restart_log {
|
|||
* @restart_level: restart level (0 - panic, 1 - related, 2 - independent, etc.)
|
||||
* @restart_order: order of other devices this devices restarts with
|
||||
* @crash_count: number of times the device has crashed
|
||||
* @dentry: debugfs directory for this device
|
||||
* @do_ramdump_on_put: ramdump on subsystem_put() if true
|
||||
* @err_ready: completion variable to record error ready from subsystem
|
||||
* @crashed: indicates if subsystem has crashed
|
||||
|
@ -178,9 +176,6 @@ struct subsys_device {
|
|||
int restart_level;
|
||||
int crash_count;
|
||||
struct subsys_soc_restart_order *restart_order;
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *dentry;
|
||||
#endif
|
||||
bool do_ramdump_on_put;
|
||||
struct cdev char_dev;
|
||||
dev_t dev_no;
|
||||
|
@ -354,10 +349,11 @@ static struct device_attribute subsys_attrs[] = {
|
|||
__ATTR_NULL,
|
||||
};
|
||||
|
||||
static struct bus_type subsys_bus_type = {
|
||||
struct bus_type subsys_bus_type = {
|
||||
.name = "msm_subsys",
|
||||
.dev_attrs = subsys_attrs,
|
||||
};
|
||||
EXPORT_SYMBOL(subsys_bus_type);
|
||||
|
||||
static DEFINE_IDA(subsys_ida);
|
||||
|
||||
|
@ -1217,87 +1213,6 @@ void notify_proxy_unvote(struct device *device)
|
|||
notify_each_subsys_device(&dev, 1, SUBSYS_PROXY_UNVOTE, NULL);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static ssize_t subsys_debugfs_read(struct file *filp, char __user *ubuf,
|
||||
size_t cnt, loff_t *ppos)
|
||||
{
|
||||
int r;
|
||||
char buf[40];
|
||||
struct subsys_device *subsys = filp->private_data;
|
||||
|
||||
r = snprintf(buf, sizeof(buf), "%d\n", subsys->count);
|
||||
return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
|
||||
}
|
||||
|
||||
static ssize_t subsys_debugfs_write(struct file *filp,
|
||||
const char __user *ubuf, size_t cnt, loff_t *ppos)
|
||||
{
|
||||
struct subsys_device *subsys = filp->private_data;
|
||||
char buf[10];
|
||||
char *cmp;
|
||||
|
||||
cnt = min(cnt, sizeof(buf) - 1);
|
||||
if (copy_from_user(&buf, ubuf, cnt))
|
||||
return -EFAULT;
|
||||
buf[cnt] = '\0';
|
||||
cmp = strstrip(buf);
|
||||
|
||||
if (!strcmp(cmp, "restart")) {
|
||||
if (subsystem_restart_dev(subsys))
|
||||
return -EIO;
|
||||
} else if (!strcmp(cmp, "get")) {
|
||||
if (subsystem_get(subsys->desc->name))
|
||||
return -EIO;
|
||||
} else if (!strcmp(cmp, "put")) {
|
||||
subsystem_put(subsys);
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static const struct file_operations subsys_debugfs_fops = {
|
||||
.open = simple_open,
|
||||
.read = subsys_debugfs_read,
|
||||
.write = subsys_debugfs_write,
|
||||
};
|
||||
|
||||
static struct dentry *subsys_base_dir;
|
||||
|
||||
static int __init subsys_debugfs_init(void)
|
||||
{
|
||||
subsys_base_dir = debugfs_create_dir("msm_subsys", NULL);
|
||||
return !subsys_base_dir ? -ENOMEM : 0;
|
||||
}
|
||||
|
||||
static void subsys_debugfs_exit(void)
|
||||
{
|
||||
debugfs_remove_recursive(subsys_base_dir);
|
||||
}
|
||||
|
||||
static int subsys_debugfs_add(struct subsys_device *subsys)
|
||||
{
|
||||
if (!subsys_base_dir)
|
||||
return -ENOMEM;
|
||||
|
||||
subsys->dentry = debugfs_create_file(subsys->desc->name,
|
||||
S_IRUGO | S_IWUSR, subsys_base_dir,
|
||||
subsys, &subsys_debugfs_fops);
|
||||
return !subsys->dentry ? -ENOMEM : 0;
|
||||
}
|
||||
|
||||
static void subsys_debugfs_remove(struct subsys_device *subsys)
|
||||
{
|
||||
debugfs_remove(subsys->dentry);
|
||||
}
|
||||
#else
|
||||
static int __init subsys_debugfs_init(void) { return 0; };
|
||||
static void subsys_debugfs_exit(void) { }
|
||||
static int subsys_debugfs_add(struct subsys_device *subsys) { return 0; }
|
||||
static void subsys_debugfs_remove(struct subsys_device *subsys) { }
|
||||
#endif
|
||||
|
||||
static int subsys_device_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct subsys_device *device, *subsys_dev = 0;
|
||||
|
@ -1717,10 +1632,6 @@ struct subsys_device *subsys_register(struct subsys_desc *desc)
|
|||
|
||||
mutex_init(&subsys->track.lock);
|
||||
|
||||
ret = subsys_debugfs_add(subsys);
|
||||
if (ret)
|
||||
goto err_debugfs;
|
||||
|
||||
ret = device_register(&subsys->dev);
|
||||
if (ret) {
|
||||
device_unregister(&subsys->dev);
|
||||
|
@ -1772,8 +1683,6 @@ err_setup_irqs:
|
|||
if (ofnode)
|
||||
subsys_remove_restart_order(ofnode);
|
||||
err_register:
|
||||
subsys_debugfs_remove(subsys);
|
||||
err_debugfs:
|
||||
mutex_destroy(&subsys->track.lock);
|
||||
ida_simple_remove(&subsys_ida, subsys->id);
|
||||
err_ida:
|
||||
|
@ -1806,7 +1715,6 @@ void subsys_unregister(struct subsys_device *subsys)
|
|||
WARN_ON(subsys->count);
|
||||
device_unregister(&subsys->dev);
|
||||
mutex_unlock(&subsys->track.lock);
|
||||
subsys_debugfs_remove(subsys);
|
||||
subsys_char_device_remove(subsys);
|
||||
sysmon_notifier_unregister(subsys->desc);
|
||||
put_device(&subsys->dev);
|
||||
|
@ -1844,9 +1752,6 @@ static int __init subsys_restart_init(void)
|
|||
ret = bus_register(&subsys_bus_type);
|
||||
if (ret)
|
||||
goto err_bus;
|
||||
ret = subsys_debugfs_init();
|
||||
if (ret)
|
||||
goto err_debugfs;
|
||||
|
||||
char_class = class_create(THIS_MODULE, "subsys");
|
||||
if (IS_ERR(char_class)) {
|
||||
|
@ -1865,8 +1770,6 @@ static int __init subsys_restart_init(void)
|
|||
err_soc:
|
||||
class_destroy(char_class);
|
||||
err_class:
|
||||
subsys_debugfs_exit();
|
||||
err_debugfs:
|
||||
bus_unregister(&subsys_bus_type);
|
||||
err_bus:
|
||||
destroy_workqueue(ssr_wq);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/shmem_fs.h>
|
||||
#include <linux/ashmem.h>
|
||||
#include <asm/cacheflush.h>
|
||||
|
||||
#include "ashmem.h"
|
||||
|
||||
|
@ -659,37 +658,6 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ashmem_cache_op(struct ashmem_area *asma,
|
||||
void (*cache_func)(const void *vstart, const void *vend))
|
||||
{
|
||||
int ret = 0;
|
||||
struct vm_area_struct *vma;
|
||||
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;
|
||||
}
|
||||
cache_func((void *)asma->vm_start,
|
||||
(void *)(asma->vm_start + asma->size));
|
||||
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;
|
||||
|
@ -735,15 +703,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, &dmac_flush_range);
|
||||
break;
|
||||
case ASHMEM_CACHE_CLEAN_RANGE:
|
||||
ret = ashmem_cache_op(asma, &dmac_clean_range);
|
||||
break;
|
||||
case ASHMEM_CACHE_INV_RANGE:
|
||||
ret = ashmem_cache_op(asma, &dmac_inv_range);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -442,13 +442,13 @@ int ion_handle_put(struct ion_handle *handle)
|
|||
/* Must hold the client lock */
|
||||
static void user_ion_handle_get(struct ion_handle *handle)
|
||||
{
|
||||
if (handle->user_ref_count++ == 0) {
|
||||
if (handle->user_ref_count++ == 0)
|
||||
kref_get(&handle->ref);
|
||||
}
|
||||
}
|
||||
|
||||
/* Must hold the client lock */
|
||||
static struct ion_handle* user_ion_handle_get_check_overflow(struct ion_handle *handle)
|
||||
static struct ion_handle *user_ion_handle_get_check_overflow(
|
||||
struct ion_handle *handle)
|
||||
{
|
||||
if (handle->user_ref_count + 1 == 0)
|
||||
return ERR_PTR(-EOVERFLOW);
|
||||
|
@ -459,7 +459,7 @@ static struct ion_handle* user_ion_handle_get_check_overflow(struct ion_handle *
|
|||
/* passes a kref to the user ref count.
|
||||
* We know we're holding a kref to the object before and
|
||||
* after this call, so no need to reverify handle. */
|
||||
static struct ion_handle* pass_to_user(struct ion_handle *handle)
|
||||
static struct ion_handle *pass_to_user(struct ion_handle *handle)
|
||||
{
|
||||
struct ion_client *client = handle->client;
|
||||
struct ion_handle *ret;
|
||||
|
@ -474,11 +474,10 @@ static struct ion_handle* pass_to_user(struct ion_handle *handle)
|
|||
/* Must hold the client lock */
|
||||
static int user_ion_handle_put_nolock(struct ion_handle *handle)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (--handle->user_ref_count == 0) {
|
||||
if (--handle->user_ref_count == 0)
|
||||
ret = ion_handle_put_nolock(handle);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -694,7 +693,8 @@ static void ion_free_nolock(struct ion_client *client, struct ion_handle *handle
|
|||
ion_handle_put_nolock(handle);
|
||||
}
|
||||
|
||||
static void user_ion_free_nolock(struct ion_client *client, struct ion_handle *handle)
|
||||
static void user_ion_free_nolock(struct ion_client *client,
|
||||
struct ion_handle *handle)
|
||||
{
|
||||
bool valid_handle;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ static int compat_get_ion_flush_data(
|
|||
err |= put_user(i, &data->fd);
|
||||
err |= get_user(u, &data32->vaddr);
|
||||
/* upper bits won't get set, zero them */
|
||||
data->vaddr = NULL;
|
||||
err |= put_user(NULL, &data->vaddr);
|
||||
err |= put_user(u, (compat_uptr_t *)&data->vaddr);
|
||||
err |= get_user(l, &data32->offset);
|
||||
err |= put_user(l, &data->offset);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2017, 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
|
||||
|
@ -35,6 +35,7 @@ static unsigned int freq_table_len[NR_CPUS], freq_table_set[NR_CPUS];
|
|||
static unsigned int voltage_table_set[NR_CPUS];
|
||||
static unsigned int *freq_table_ptr[NR_CPUS];
|
||||
static uint32_t *voltage_table_ptr[NR_CPUS];
|
||||
static DEFINE_MUTEX(ioctl_access_mutex);
|
||||
|
||||
static int msm_thermal_ioctl_open(struct inode *node, struct file *filep)
|
||||
{
|
||||
|
@ -293,8 +294,9 @@ static long msm_thermal_ioctl_process(struct file *filep, unsigned int cmd,
|
|||
|
||||
ret = validate_and_copy(&cmd, &arg, &query);
|
||||
if (ret)
|
||||
goto process_exit;
|
||||
return ret;
|
||||
|
||||
mutex_lock(&ioctl_access_mutex);
|
||||
switch (cmd) {
|
||||
case MSM_THERMAL_SET_CPU_MAX_FREQUENCY:
|
||||
ret = msm_thermal_set_frequency(query.cpu_freq.cpu_num,
|
||||
|
@ -323,6 +325,7 @@ static long msm_thermal_ioctl_process(struct file *filep, unsigned int cmd,
|
|||
goto process_exit;
|
||||
}
|
||||
process_exit:
|
||||
mutex_unlock(&ioctl_access_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1000,22 +1000,30 @@ void dbg_print_reg(const char *name, int reg)
|
|||
static ssize_t dwc3_store_events(struct file *file,
|
||||
const char __user *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
unsigned tty;
|
||||
int ret;
|
||||
u8 tty;
|
||||
|
||||
if (buf == NULL) {
|
||||
pr_err("[%s] EINVAL\n", __func__);
|
||||
goto done;
|
||||
ret = -EINVAL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (sscanf(buf, "%u", &tty) != 1 || tty > 1) {
|
||||
ret = kstrtou8_from_user(buf, count, 0, &tty);
|
||||
if (ret < 0) {
|
||||
pr_err("can't get enter value.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tty > 1) {
|
||||
pr_err("<1|0>: enable|disable console log\n");
|
||||
goto done;
|
||||
ret = -EINVAL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
dbg_dwc3_data.tty = tty;
|
||||
pr_info("tty = %u", dbg_dwc3_data.tty);
|
||||
|
||||
done:
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -1056,21 +1064,30 @@ const struct file_operations dwc3_gadget_dbg_data_fops = {
|
|||
static ssize_t dwc3_store_int_events(struct file *file,
|
||||
const char __user *ubuf, size_t count, loff_t *ppos)
|
||||
{
|
||||
int clear_stats, i;
|
||||
int i, ret;
|
||||
unsigned long flags;
|
||||
struct seq_file *s = file->private_data;
|
||||
struct dwc3 *dwc = s->private;
|
||||
struct dwc3_ep *dep;
|
||||
struct timespec ts;
|
||||
u8 clear_stats;
|
||||
|
||||
if (ubuf == NULL) {
|
||||
pr_err("[%s] EINVAL\n", __func__);
|
||||
goto done;
|
||||
ret = -EINVAL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (sscanf(ubuf, "%u", &clear_stats) != 1 || clear_stats != 0) {
|
||||
ret = kstrtou8_from_user(ubuf, count, 0, &clear_stats);
|
||||
if (ret < 0) {
|
||||
pr_err("can't get enter value.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (clear_stats != 0) {
|
||||
pr_err("Wrong value. To clear stats, enter value as 0.\n");
|
||||
goto done;
|
||||
ret = -EINVAL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
|
@ -1087,7 +1104,6 @@ static ssize_t dwc3_store_int_events(struct file *file,
|
|||
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
|
||||
done:
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,11 +57,13 @@ static int panel_debug_base_open(struct inode *inode, struct file *file)
|
|||
static int panel_debug_base_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct mdss_debug_base *dbg = file->private_data;
|
||||
mutex_lock(&mdss_debug_lock);
|
||||
if (dbg && dbg->buf) {
|
||||
kfree(dbg->buf);
|
||||
dbg->buf_len = 0;
|
||||
dbg->buf = NULL;
|
||||
}
|
||||
mutex_unlock(&mdss_debug_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -379,11 +381,13 @@ static int mdss_debug_base_open(struct inode *inode, struct file *file)
|
|||
static int mdss_debug_base_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct mdss_debug_base *dbg = file->private_data;
|
||||
mutex_lock(&mdss_debug_lock);
|
||||
if (dbg && dbg->buf) {
|
||||
kfree(dbg->buf);
|
||||
dbg->buf_len = 0;
|
||||
dbg->buf = NULL;
|
||||
}
|
||||
mutex_unlock(&mdss_debug_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3128,6 +3128,7 @@ static void mdss_fb_var_to_panelinfo(struct fb_var_screeninfo *var,
|
|||
static void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
|
||||
struct fb_var_screeninfo *var)
|
||||
{
|
||||
u32 frame_rate;
|
||||
struct mdss_panel_data *pdata = container_of(pinfo,
|
||||
struct mdss_panel_data, panel_info);
|
||||
|
||||
|
@ -3139,7 +3140,21 @@ static void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
|
|||
var->right_margin = pinfo->lcdc.h_front_porch;
|
||||
var->left_margin = pinfo->lcdc.h_back_porch;
|
||||
var->hsync_len = pinfo->lcdc.h_pulse_width;
|
||||
var->pixclock = pinfo->clk_rate;
|
||||
|
||||
frame_rate = mdss_panel_get_framerate(pinfo);
|
||||
if (frame_rate) {
|
||||
unsigned long clk_rate, h_total, v_total;
|
||||
|
||||
h_total = var->xres + var->left_margin
|
||||
+ var->right_margin + var->hsync_len;
|
||||
v_total = var->yres + var->lower_margin
|
||||
+ var->upper_margin + var->vsync_len;
|
||||
clk_rate = h_total * v_total * frame_rate;
|
||||
var->pixclock = KHZ2PICOS(clk_rate / 1000);
|
||||
} else if (pinfo->clk_rate) {
|
||||
var->pixclock = KHZ2PICOS(
|
||||
(unsigned long int) pinfo->clk_rate / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, 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
|
||||
|
@ -3749,6 +3749,11 @@ static int mdss_mdp_hw_cursor_update(struct msm_fb_data_type *mfd,
|
|||
|
||||
if (cursor->set & FB_CUR_SETIMAGE) {
|
||||
u32 cursor_addr;
|
||||
if (img->width * img->height * 4 > cursor_frame_size) {
|
||||
pr_err("cursor image size is too large\n");
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
ret = copy_from_user(mfd->cursor_buf, img->data,
|
||||
img->width * img->height * 4);
|
||||
if (ret) {
|
||||
|
|
43
fs/9p/acl.c
43
fs/9p/acl.c
|
@ -320,32 +320,29 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
|
|||
case ACL_TYPE_ACCESS:
|
||||
name = POSIX_ACL_XATTR_ACCESS;
|
||||
if (acl) {
|
||||
umode_t mode = inode->i_mode;
|
||||
retval = posix_acl_equiv_mode(acl, &mode);
|
||||
if (retval < 0)
|
||||
struct iattr iattr;
|
||||
struct posix_acl *old_acl = acl;
|
||||
|
||||
retval = posix_acl_update_mode(inode,
|
||||
&iattr.ia_mode, &acl);
|
||||
if (retval)
|
||||
goto err_out;
|
||||
else {
|
||||
struct iattr iattr;
|
||||
if (retval == 0) {
|
||||
/*
|
||||
* ACL can be represented
|
||||
* by the mode bits. So don't
|
||||
* update ACL.
|
||||
*/
|
||||
acl = NULL;
|
||||
value = NULL;
|
||||
size = 0;
|
||||
}
|
||||
/* Updte the mode bits */
|
||||
iattr.ia_mode = ((mode & S_IALLUGO) |
|
||||
(inode->i_mode & ~S_IALLUGO));
|
||||
iattr.ia_valid = ATTR_MODE;
|
||||
/* FIXME should we update ctime ?
|
||||
* What is the following setxattr update the
|
||||
* mode ?
|
||||
if (!acl) {
|
||||
/*
|
||||
* ACL can be represented
|
||||
* by the mode bits. So don't
|
||||
* update ACL.
|
||||
*/
|
||||
v9fs_vfs_setattr_dotl(dentry, &iattr);
|
||||
posix_acl_release(old_acl);
|
||||
value = NULL;
|
||||
size = 0;
|
||||
}
|
||||
iattr.ia_valid = ATTR_MODE;
|
||||
/* FIXME should we update ctime ?
|
||||
* What is the following setxattr update the
|
||||
* mode ?
|
||||
*/
|
||||
v9fs_vfs_setattr_dotl(dentry, &iattr);
|
||||
}
|
||||
break;
|
||||
case ACL_TYPE_DEFAULT:
|
||||
|
|
|
@ -118,11 +118,10 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans,
|
|||
case ACL_TYPE_ACCESS:
|
||||
name = POSIX_ACL_XATTR_ACCESS;
|
||||
if (acl) {
|
||||
ret = posix_acl_equiv_mode(acl, &inode->i_mode);
|
||||
if (ret < 0)
|
||||
ret = posix_acl_update_mode(inode,
|
||||
&inode->i_mode, &acl);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (ret == 0)
|
||||
acl = NULL;
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
|
|
|
@ -206,15 +206,12 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
|
|||
case ACL_TYPE_ACCESS:
|
||||
name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
|
||||
if (acl) {
|
||||
error = posix_acl_equiv_mode(acl, &inode->i_mode);
|
||||
if (error < 0)
|
||||
error = posix_acl_update_mode(inode,
|
||||
&inode->i_mode, &acl);
|
||||
if (error)
|
||||
return error;
|
||||
else {
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
mark_inode_dirty(inode);
|
||||
if (error == 0)
|
||||
acl = NULL;
|
||||
}
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
mark_inode_dirty(inode);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -211,15 +211,12 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
|
|||
case ACL_TYPE_ACCESS:
|
||||
name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
|
||||
if (acl) {
|
||||
error = posix_acl_equiv_mode(acl, &inode->i_mode);
|
||||
if (error < 0)
|
||||
error = posix_acl_update_mode(inode,
|
||||
&inode->i_mode, &acl);
|
||||
if (error)
|
||||
return error;
|
||||
else {
|
||||
inode->i_ctime = ext4_current_time(inode);
|
||||
ext4_mark_inode_dirty(handle, inode);
|
||||
if (error == 0)
|
||||
acl = NULL;
|
||||
}
|
||||
inode->i_ctime = ext4_current_time(inode);
|
||||
ext4_mark_inode_dirty(handle, inode);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -229,7 +229,8 @@ static int f2fs_set_acl(struct inode *inode, int type,
|
|||
case ACL_TYPE_ACCESS:
|
||||
name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
|
||||
if (acl) {
|
||||
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
|
||||
error = posix_acl_update_mode(inode,
|
||||
&inode->i_mode, &acl);
|
||||
if (error)
|
||||
return error;
|
||||
set_acl_inode(inode, inode->i_mode);
|
||||
|
|
|
@ -267,16 +267,14 @@ static int gfs2_xattr_system_set(struct dentry *dentry, const char *name,
|
|||
goto out_release;
|
||||
|
||||
if (type == ACL_TYPE_ACCESS) {
|
||||
umode_t mode = inode->i_mode;
|
||||
error = posix_acl_equiv_mode(acl, &mode);
|
||||
umode_t mode;
|
||||
struct posix_acl *old_acl = acl;
|
||||
|
||||
if (error <= 0) {
|
||||
posix_acl_release(acl);
|
||||
acl = NULL;
|
||||
|
||||
if (error < 0)
|
||||
return error;
|
||||
}
|
||||
error = posix_acl_update_mode(inode, &mode, &acl);
|
||||
if (!acl)
|
||||
posix_acl_release(old_acl);
|
||||
if (error)
|
||||
goto out_release;
|
||||
|
||||
error = gfs2_set_mode(inode, mode);
|
||||
if (error)
|
||||
|
|
|
@ -243,9 +243,10 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
|
|||
case ACL_TYPE_ACCESS:
|
||||
xprefix = JFFS2_XPREFIX_ACL_ACCESS;
|
||||
if (acl) {
|
||||
umode_t mode = inode->i_mode;
|
||||
rc = posix_acl_equiv_mode(acl, &mode);
|
||||
if (rc < 0)
|
||||
umode_t mode;
|
||||
|
||||
rc = posix_acl_update_mode(inode, &mode, &acl);
|
||||
if (rc)
|
||||
return rc;
|
||||
if (inode->i_mode != mode) {
|
||||
struct iattr attr;
|
||||
|
@ -257,8 +258,6 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
|
|||
if (rc < 0)
|
||||
return rc;
|
||||
}
|
||||
if (rc == 0)
|
||||
acl = NULL;
|
||||
}
|
||||
break;
|
||||
case ACL_TYPE_DEFAULT:
|
||||
|
|
|
@ -693,11 +693,13 @@ static int can_set_system_xattr(struct inode *inode, const char *name,
|
|||
return rc;
|
||||
}
|
||||
if (acl) {
|
||||
rc = posix_acl_equiv_mode(acl, &inode->i_mode);
|
||||
posix_acl_release(acl);
|
||||
struct posix_acl *old_acl = acl;
|
||||
|
||||
rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
|
||||
posix_acl_release(old_acl);
|
||||
if (rc < 0) {
|
||||
printk(KERN_ERR
|
||||
"posix_acl_equiv_mode returned %d\n",
|
||||
"posix_acl_update_mode returned %d\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -274,9 +274,10 @@ static int ocfs2_set_acl(handle_t *handle,
|
|||
case ACL_TYPE_ACCESS:
|
||||
name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS;
|
||||
if (acl) {
|
||||
umode_t mode = inode->i_mode;
|
||||
ret = posix_acl_equiv_mode(acl, &mode);
|
||||
if (ret < 0)
|
||||
umode_t mode;
|
||||
|
||||
ret = posix_acl_update_mode(inode, &mode, &acl);
|
||||
if (ret)
|
||||
return ret;
|
||||
else {
|
||||
if (ret == 0)
|
||||
|
@ -286,7 +287,6 @@ static int ocfs2_set_acl(handle_t *handle,
|
|||
handle, mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -407,6 +407,24 @@ posix_acl_create(struct posix_acl **acl, gfp_t gfp, umode_t *mode_p)
|
|||
}
|
||||
EXPORT_SYMBOL(posix_acl_create);
|
||||
|
||||
int
|
||||
posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, umode_t mode)
|
||||
{
|
||||
struct posix_acl *clone = posix_acl_clone(*acl, gfp);
|
||||
int err = -ENOMEM;
|
||||
if (clone) {
|
||||
err = posix_acl_chmod_masq(clone, mode);
|
||||
if (err) {
|
||||
posix_acl_release(clone);
|
||||
clone = NULL;
|
||||
}
|
||||
}
|
||||
posix_acl_release(*acl);
|
||||
*acl = clone;
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(posix_acl_chmod);
|
||||
|
||||
/**
|
||||
* posix_acl_update_mode - update mode in set_acl
|
||||
*
|
||||
|
@ -437,21 +455,3 @@ int posix_acl_update_mode(struct inode *inode, umode_t *mode_p,
|
|||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(posix_acl_update_mode);
|
||||
|
||||
int
|
||||
posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, umode_t mode)
|
||||
{
|
||||
struct posix_acl *clone = posix_acl_clone(*acl, gfp);
|
||||
int err = -ENOMEM;
|
||||
if (clone) {
|
||||
err = posix_acl_chmod_masq(clone, mode);
|
||||
if (err) {
|
||||
posix_acl_release(clone);
|
||||
clone = NULL;
|
||||
}
|
||||
}
|
||||
posix_acl_release(*acl);
|
||||
*acl = clone;
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(posix_acl_chmod);
|
||||
|
|
|
@ -286,13 +286,10 @@ reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
|
|||
case ACL_TYPE_ACCESS:
|
||||
name = POSIX_ACL_XATTR_ACCESS;
|
||||
if (acl) {
|
||||
error = posix_acl_equiv_mode(acl, &inode->i_mode);
|
||||
if (error < 0)
|
||||
error = posix_acl_update_mode(inode,
|
||||
&inode->i_mode, &acl);
|
||||
if (error)
|
||||
return error;
|
||||
else {
|
||||
if (error == 0)
|
||||
acl = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACL_TYPE_DEFAULT:
|
||||
|
|
|
@ -388,16 +388,14 @@ xfs_xattr_acl_set(struct dentry *dentry, const char *name,
|
|||
goto out_release;
|
||||
|
||||
if (type == ACL_TYPE_ACCESS) {
|
||||
umode_t mode = inode->i_mode;
|
||||
error = posix_acl_equiv_mode(acl, &mode);
|
||||
umode_t mode;
|
||||
struct posix_acl *old_acl = acl;
|
||||
|
||||
if (error <= 0) {
|
||||
posix_acl_release(acl);
|
||||
acl = NULL;
|
||||
|
||||
if (error < 0)
|
||||
return error;
|
||||
}
|
||||
error = posix_acl_update_mode(inode, &mode, &acl);
|
||||
if (!acl)
|
||||
posix_acl_release(old_acl);
|
||||
if (error)
|
||||
goto out_release;
|
||||
|
||||
error = xfs_set_mode(inode, mode);
|
||||
if (error)
|
||||
|
|
|
@ -96,6 +96,9 @@ extern struct posix_acl *get_posix_acl(struct inode *, int);
|
|||
extern int set_posix_acl(struct inode *, int, struct posix_acl *);
|
||||
|
||||
#ifdef CONFIG_FS_POSIX_ACL
|
||||
extern int posix_acl_update_mode(struct inode *, umode_t *,
|
||||
struct posix_acl **);
|
||||
|
||||
static inline struct posix_acl **acl_by_type(struct inode *inode, int type)
|
||||
{
|
||||
switch (type) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2014-2015, 2017, 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
|
||||
|
@ -18,6 +18,7 @@
|
|||
#include <linux/interrupt.h>
|
||||
|
||||
struct subsys_device;
|
||||
extern struct bus_type subsys_bus_type;
|
||||
|
||||
enum {
|
||||
RESET_SOC = 0,
|
||||
|
|
|
@ -1,148 +0,0 @@
|
|||
/* Copyright (c) 2014, 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_DTS_EAGLE_H__
|
||||
#define __MSM_DTS_EAGLE_H__
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/devdep_params.h>
|
||||
#include <sound/q6asm-v2.h>
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
enum {
|
||||
DTS_EAGLE_IOCTL_GET_CACHE_SIZE32 = _IOR(0xF2, 0, __s32),
|
||||
DTS_EAGLE_IOCTL_SET_CACHE_SIZE32 = _IOW(0xF2, 1, __s32),
|
||||
DTS_EAGLE_IOCTL_GET_PARAM32 = _IOR(0xF2, 2, compat_uptr_t),
|
||||
DTS_EAGLE_IOCTL_SET_PARAM32 = _IOW(0xF2, 3, compat_uptr_t),
|
||||
DTS_EAGLE_IOCTL_SET_CACHE_BLOCK32 =
|
||||
_IOW(0xF2, 4, compat_uptr_t),
|
||||
DTS_EAGLE_IOCTL_SET_ACTIVE_DEVICE32 =
|
||||
_IOW(0xF2, 5, compat_uptr_t),
|
||||
DTS_EAGLE_IOCTL_GET_LICENSE32 =
|
||||
_IOR(0xF2, 6, compat_uptr_t),
|
||||
DTS_EAGLE_IOCTL_SET_LICENSE32 =
|
||||
_IOW(0xF2, 7, compat_uptr_t),
|
||||
DTS_EAGLE_IOCTL_SEND_LICENSE32 = _IOW(0xF2, 8, __s32),
|
||||
DTS_EAGLE_IOCTL_SET_VOLUME_COMMANDS32 = _IOW(0xF2, 9,
|
||||
compat_uptr_t),
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DTS_EAGLE
|
||||
void msm_dts_ion_memmap(struct param_outband *po_);
|
||||
int msm_dts_eagle_enable_asm(struct audio_client *ac, u32 enable, int module);
|
||||
int msm_dts_eagle_enable_adm(int port_id, int copp_idx, u32 enable);
|
||||
void msm_dts_eagle_add_controls(struct snd_soc_platform *platform);
|
||||
int msm_dts_eagle_set_stream_gain(struct audio_client *ac,
|
||||
int lgain, int rgain);
|
||||
int msm_dts_eagle_handle_asm(struct dts_eagle_param_desc *depd, char *buf,
|
||||
bool for_pre, bool get, struct audio_client *ac,
|
||||
struct param_outband *po);
|
||||
int msm_dts_eagle_handle_adm(struct dts_eagle_param_desc *depd, char *buf,
|
||||
bool for_pre, bool get);
|
||||
int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg);
|
||||
int msm_dts_eagle_is_hpx_on(void);
|
||||
int msm_dts_eagle_init_pre(struct audio_client *ac);
|
||||
int msm_dts_eagle_deinit_pre(struct audio_client *ac);
|
||||
int msm_dts_eagle_init_post(int port_id, int copp_id);
|
||||
int msm_dts_eagle_deinit_post(int port_id, int topology);
|
||||
int msm_dts_eagle_init_master_module(struct audio_client *ac);
|
||||
int msm_dts_eagle_deinit_master_module(struct audio_client *ac);
|
||||
int msm_dts_eagle_pcm_new(struct snd_soc_pcm_runtime *runtime);
|
||||
void msm_dts_eagle_pcm_free(struct snd_pcm *pcm);
|
||||
int msm_dts_eagle_compat_ioctl(unsigned int cmd, unsigned long arg);
|
||||
#else
|
||||
static inline void msm_dts_ion_memmap(struct param_outband *po_)
|
||||
{
|
||||
pr_debug("%s\n", __func__);
|
||||
}
|
||||
static inline int msm_dts_eagle_enable_asm(struct audio_client *ac,
|
||||
u32 enable, int module)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_enable_adm(int port_id, int copp_idx,
|
||||
u32 enable)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void msm_dts_eagle_add_controls(struct snd_soc_platform *platform)
|
||||
{
|
||||
}
|
||||
static inline int msm_dts_eagle_set_stream_gain(struct audio_client *ac,
|
||||
int lgain, int rgain)
|
||||
{
|
||||
pr_debug("%s\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_handle_asm(struct dts_eagle_param_desc *depd,
|
||||
char *buf, bool for_pre, bool get,
|
||||
struct audio_client *ac,
|
||||
struct param_outband *po)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_handle_adm(struct dts_eagle_param_desc *depd,
|
||||
char *buf, bool for_pre, bool get)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
return -EPERM;
|
||||
}
|
||||
static inline int msm_dts_eagle_is_hpx_on(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_init_pre(struct audio_client *ac)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_deinit_pre(struct audio_client *ac)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_init_post(int port_id, int coppid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_deinit_post(int port_id, int topology)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_init_master_module(struct audio_client *ac)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_deinit_master_module(struct audio_client *ac)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int msm_dts_eagle_pcm_new(struct snd_soc_pcm_runtime *runtime)
|
||||
{
|
||||
pr_debug("%s\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
static inline void msm_dts_eagle_pcm_free(struct snd_pcm *pcm)
|
||||
{
|
||||
pr_debug("%s\n", __func__);
|
||||
}
|
||||
static inline int msm_dts_eagle_compat_ioctl(unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2016, 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
|
||||
|
@ -34,7 +34,6 @@ enum {
|
|||
ADM_AUDVOL_CAL,
|
||||
ADM_RTAC_INFO_CAL,
|
||||
ADM_RTAC_APR_CAL,
|
||||
ADM_DTS_EAGLE,
|
||||
ADM_SRS_TRUMEDIA,
|
||||
ADM_MAX_CAL_TYPES
|
||||
};
|
||||
|
|
|
@ -34,8 +34,5 @@ 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)
|
||||
|
||||
#endif /* _UAPI_LINUX_ASHMEM_H */
|
||||
|
|
|
@ -9,7 +9,6 @@ snd-soc-qdsp6v2-objs += msm-dai-q6-v2.o msm-pcm-q6-v2.o msm-pcm-routing-v2.o \
|
|||
obj-$(CONFIG_SND_SOC_QDSP6V2) += snd-soc-qdsp6v2.o msm-pcm-dtmf-v2.o \
|
||||
msm-dai-stub-v2.o
|
||||
obj-$(CONFIG_SND_HWDEP) += msm-pcm-routing-devdep.o
|
||||
obj-$(CONFIG_DTS_EAGLE) += msm-dts-eagle.o
|
||||
obj-$(CONFIG_DOLBY_DAP) += msm-dolby-dap-config.o
|
||||
obj-$(CONFIG_DOLBY_DS2) += msm-ds2-dap-config.o
|
||||
obj-$(CONFIG_DTS_SRS_TM) += msm-dts-srs-tm-config.o
|
||||
|
|
|
@ -136,8 +136,6 @@ size_t get_cal_info_size(int32_t cal_type)
|
|||
case ULP_LSM_CAL_TYPE:
|
||||
size = sizeof(struct audio_cal_info_lsm);
|
||||
break;
|
||||
case DTS_EAGLE_CAL_TYPE:
|
||||
size = 0;
|
||||
case AUDIO_CORE_METAINFO_CAL_TYPE:
|
||||
size = sizeof(struct audio_cal_info_metainfo);
|
||||
break;
|
||||
|
@ -263,8 +261,6 @@ size_t get_user_cal_type_size(int32_t cal_type)
|
|||
case ULP_LSM_CAL_TYPE:
|
||||
size = sizeof(struct audio_cal_type_lsm);
|
||||
break;
|
||||
case DTS_EAGLE_CAL_TYPE:
|
||||
size = 0;
|
||||
case AUDIO_CORE_METAINFO_CAL_TYPE:
|
||||
size = sizeof(struct audio_cal_type_metainfo);
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2017, 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
|
||||
|
@ -15,7 +15,6 @@
|
|||
#include <sound/q6asm-v2.h>
|
||||
#include <sound/compress_params.h>
|
||||
#include <sound/msm-audio-effects-q6-v2.h>
|
||||
#include <sound/msm-dts-eagle.h>
|
||||
#include <sound/devdep_params.h>
|
||||
|
||||
#define MAX_ENABLE_CMD_SIZE 32
|
||||
|
@ -49,26 +48,6 @@ bool msm_audio_effects_is_effmodule_supp_in_top(int effect_module,
|
|||
case EQ_MODULE:
|
||||
switch (topology) {
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_SA_PLUS:
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS:
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case DTS_EAGLE_MODULE:
|
||||
switch (topology) {
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX:
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS:
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case SOFT_VOLUME2_MODULE:
|
||||
case DTS_EAGLE_MODULE_ENABLE:
|
||||
switch (topology) {
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS:
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -276,7 +255,7 @@ int msm_audio_effects_virtualizer_handler(struct audio_client *ac,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (params_length && !msm_dts_eagle_is_hpx_on() && (rc == 0))
|
||||
if (params_length && (rc == 0))
|
||||
q6asm_send_audio_effects_params(ac, params,
|
||||
params_length);
|
||||
else
|
||||
|
@ -747,7 +726,7 @@ int msm_audio_effects_reverb_handler(struct audio_client *ac,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (params_length && !msm_dts_eagle_is_hpx_on() && (rc == 0))
|
||||
if (params_length && (rc == 0))
|
||||
q6asm_send_audio_effects_params(ac, params,
|
||||
params_length);
|
||||
else
|
||||
|
@ -883,7 +862,7 @@ int msm_audio_effects_bass_boost_handler(struct audio_client *ac,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (params_length && !msm_dts_eagle_is_hpx_on() && (rc == 0))
|
||||
if (params_length && (rc == 0))
|
||||
q6asm_send_audio_effects_params(ac, params,
|
||||
params_length);
|
||||
else
|
||||
|
@ -1223,7 +1202,7 @@ int msm_audio_effects_popless_eq_handler(struct audio_client *ac,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (params_length && !msm_dts_eagle_is_hpx_on() && (rc == 0))
|
||||
if (params_length && (rc == 0))
|
||||
q6asm_send_audio_effects_params(ac, params,
|
||||
params_length);
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, 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
|
||||
|
@ -43,8 +43,6 @@
|
|||
#include <sound/compress_offload.h>
|
||||
#include <sound/compress_driver.h>
|
||||
#include <sound/msm-audio-effects-q6-v2.h>
|
||||
#include <sound/msm-dts-eagle.h>
|
||||
|
||||
#include "msm-pcm-routing-v2.h"
|
||||
#include "audio_ocmem.h"
|
||||
|
||||
|
@ -83,15 +81,6 @@ const DECLARE_TLV_DB_LINEAR(msm_compr_vol_gain, 0,
|
|||
|
||||
#define MAX_NUMBER_OF_STREAMS 2
|
||||
|
||||
/*
|
||||
* Max size for getting DTS EAGLE Param through kcontrol
|
||||
* Safe for both 32 and 64 bit platforms
|
||||
* 64 = size of kcontrol value array on 64 bit platform
|
||||
* 4 = size of parameters Eagle expects before cast to 64 bits
|
||||
* 40 = size of dts_eagle_param_desc + module_id cast to 64 bits
|
||||
*/
|
||||
#define DTS_EAGLE_MAX_PARAM_SIZE_FOR_ALSA ((64 * 4) - 40)
|
||||
|
||||
struct msm_compr_gapless_state {
|
||||
bool set_next_stream_id;
|
||||
int32_t stream_opened[MAX_NUMBER_OF_STREAMS];
|
||||
|
@ -311,11 +300,6 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream,
|
|||
if (rc < 0)
|
||||
pr_err("%s: Send vol gain command failed rc=%d\n",
|
||||
__func__, rc);
|
||||
else
|
||||
if (msm_dts_eagle_set_stream_gain(prtd->audio_client,
|
||||
volume_l, volume_r))
|
||||
pr_debug("%s: DTS_EAGLE send stream gain failed\n",
|
||||
__func__);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -927,26 +911,6 @@ static int msm_compr_init_pp_params(struct snd_compr_stream *cstream,
|
|||
};
|
||||
|
||||
switch (ac->topology) {
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS: /* HPX + SA+ topology */
|
||||
|
||||
ret = q6asm_set_softvolume_v2(ac, &softvol,
|
||||
SOFT_VOLUME_INSTANCE_1);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Send SoftVolume Param failed ret=%d\n",
|
||||
__func__, ret);
|
||||
|
||||
ret = q6asm_set_softvolume_v2(ac, &softvol,
|
||||
SOFT_VOLUME_INSTANCE_2);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Send SoftVolume2 Param failed ret=%d\n",
|
||||
__func__, ret);
|
||||
/*
|
||||
* HPX module init is trigerred from HAL using ioctl
|
||||
* DTS_EAGLE_MODULE_ENABLE when stream starts
|
||||
*/
|
||||
break;
|
||||
case ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX: /* HPX topology */
|
||||
break;
|
||||
default:
|
||||
ret = q6asm_set_softvolume_v2(ac, &softvol,
|
||||
SOFT_VOLUME_INSTANCE_1);
|
||||
|
@ -1286,6 +1250,7 @@ static int msm_compr_free(struct snd_compr_stream *cstream)
|
|||
kfree(pdata->dec_params[soc_prtd->dai_link->be_id]);
|
||||
pdata->dec_params[soc_prtd->dai_link->be_id] = NULL;
|
||||
kfree(prtd);
|
||||
runtime->private_data = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2449,23 +2414,6 @@ static int msm_compr_audio_effects_config_put(struct snd_kcontrol *kcontrol,
|
|||
&(audio_effects->equalizer),
|
||||
values);
|
||||
break;
|
||||
case DTS_EAGLE_MODULE:
|
||||
pr_debug("%s: DTS_EAGLE_MODULE\n", __func__);
|
||||
if (!msm_audio_effects_is_effmodule_supp_in_top(effects_module,
|
||||
prtd->audio_client->topology))
|
||||
return 0;
|
||||
msm_dts_eagle_handle_asm(NULL, (void *)values, true,
|
||||
false, prtd->audio_client, NULL);
|
||||
break;
|
||||
case DTS_EAGLE_MODULE_ENABLE:
|
||||
pr_debug("%s: DTS_EAGLE_MODULE_ENABLE\n", __func__);
|
||||
if (msm_audio_effects_is_effmodule_supp_in_top(effects_module,
|
||||
prtd->audio_client->topology))
|
||||
msm_dts_eagle_enable_asm(prtd->audio_client,
|
||||
(bool)values[0],
|
||||
AUDPROC_MODULE_ID_DTS_HPX_PREMIX);
|
||||
|
||||
break;
|
||||
case SOFT_VOLUME_MODULE:
|
||||
pr_debug("%s: SOFT_VOLUME_MODULE\n", __func__);
|
||||
break;
|
||||
|
@ -2494,7 +2442,6 @@ static int msm_compr_audio_effects_config_get(struct snd_kcontrol *kcontrol,
|
|||
struct msm_compr_audio_effects *audio_effects = NULL;
|
||||
struct snd_compr_stream *cstream = NULL;
|
||||
struct msm_compr_audio *prtd = NULL;
|
||||
long *values = &(ucontrol->value.integer.value[0]);
|
||||
|
||||
pr_debug("%s\n", __func__);
|
||||
if (fe_id >= MSM_FRONTEND_DAI_MAX) {
|
||||
|
@ -2514,28 +2461,6 @@ static int msm_compr_audio_effects_config_get(struct snd_kcontrol *kcontrol,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (audio_effects->query.mod_id) {
|
||||
case DTS_EAGLE_MODULE:
|
||||
pr_debug("%s: DTS_EAGLE_MODULE handling queued get\n",
|
||||
__func__);
|
||||
values[0] = (long)audio_effects->query.mod_id;
|
||||
values[1] = (long)audio_effects->query.parm_id;
|
||||
values[2] = (long)audio_effects->query.size;
|
||||
values[3] = (long)audio_effects->query.offset;
|
||||
values[4] = (long)audio_effects->query.device;
|
||||
if (values[2] > DTS_EAGLE_MAX_PARAM_SIZE_FOR_ALSA) {
|
||||
pr_err("%s: DTS_EAGLE_MODULE parameter's requested size (%li) too large (max size is %i)\n",
|
||||
__func__, values[2],
|
||||
DTS_EAGLE_MAX_PARAM_SIZE_FOR_ALSA);
|
||||
return -EINVAL;
|
||||
}
|
||||
msm_dts_eagle_handle_asm(NULL, (void *)&values[1],
|
||||
true, true, prtd->audio_client, NULL);
|
||||
break;
|
||||
default:
|
||||
pr_err("%s: Invalid effects config module\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2012-2014, 2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2014, 2016-2017, 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
|
||||
|
@ -19,7 +20,6 @@
|
|||
#include <sound/control.h>
|
||||
#include <sound/q6adm-v2.h>
|
||||
#include <sound/asound.h>
|
||||
#include <sound/msm-dts-eagle.h>
|
||||
#include "msm-dts-srs-tm-config.h"
|
||||
#include "msm-pcm-routing-v2.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, 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
|
||||
|
@ -499,6 +499,7 @@ done:
|
|||
mutex_unlock(&prtd->lock);
|
||||
prtd->prepared--;
|
||||
kfree(prtd);
|
||||
runtime->private_data = NULL;
|
||||
return 0;
|
||||
}
|
||||
static int msm_afe_prepare(struct snd_pcm_substream *substream)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2014, 2017 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
|
||||
|
@ -497,6 +497,7 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
|
|||
|
||||
pr_debug("%s\n", __func__);
|
||||
kfree(prtd);
|
||||
runtime->private_data = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2016-2017, 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
|
||||
|
@ -517,6 +517,8 @@ static int msm_pcm_close(struct snd_pcm_substream *substream)
|
|||
SNDRV_PCM_STREAM_PLAYBACK :
|
||||
SNDRV_PCM_STREAM_CAPTURE);
|
||||
kfree(prtd);
|
||||
runtime->private_data = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, 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
|
||||
|
@ -724,6 +724,8 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
|
|||
msm_pcm_routing_dereg_phy_stream(soc_prtd->dai_link->be_id,
|
||||
SNDRV_PCM_STREAM_PLAYBACK);
|
||||
kfree(prtd);
|
||||
runtime->private_data = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -827,6 +829,7 @@ static int msm_pcm_capture_close(struct snd_pcm_substream *substream)
|
|||
msm_pcm_routing_dereg_phy_stream(soc_prtd->dai_link->be_id,
|
||||
SNDRV_PCM_STREAM_CAPTURE);
|
||||
kfree(prtd);
|
||||
runtime->private_data = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2014, 2017 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
|
||||
|
@ -14,8 +14,6 @@
|
|||
#include <linux/module.h>
|
||||
#include <sound/hwdep.h>
|
||||
#include <sound/devdep_params.h>
|
||||
#include <sound/msm-dts-eagle.h>
|
||||
|
||||
#include "msm-pcm-routing-devdep.h"
|
||||
#include "msm-ds2-dap-config.h"
|
||||
|
||||
|
@ -53,23 +51,6 @@ static int msm_pcm_routing_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
|
|||
case SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER:
|
||||
ret = msm_ds2_dap_ioctl(hw, file, cmd, argp);
|
||||
break;
|
||||
case DTS_EAGLE_IOCTL_GET_CACHE_SIZE:
|
||||
case DTS_EAGLE_IOCTL_SET_CACHE_SIZE:
|
||||
case DTS_EAGLE_IOCTL_GET_PARAM:
|
||||
case DTS_EAGLE_IOCTL_SET_PARAM:
|
||||
case DTS_EAGLE_IOCTL_SET_CACHE_BLOCK:
|
||||
case DTS_EAGLE_IOCTL_SET_ACTIVE_DEVICE:
|
||||
case DTS_EAGLE_IOCTL_GET_LICENSE:
|
||||
case DTS_EAGLE_IOCTL_SET_LICENSE:
|
||||
case DTS_EAGLE_IOCTL_SEND_LICENSE:
|
||||
case DTS_EAGLE_IOCTL_SET_VOLUME_COMMANDS:
|
||||
ret = msm_dts_eagle_ioctl(cmd, arg);
|
||||
if (ret == -EPERM) {
|
||||
pr_err("%s called with invalid control 0x%X\n",
|
||||
__func__, cmd);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pr_err("%s called with invalid control 0x%X\n", __func__, cmd);
|
||||
ret = -EINVAL;
|
||||
|
@ -81,7 +62,6 @@ static int msm_pcm_routing_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
|
|||
void msm_pcm_routing_hwdep_free(struct snd_pcm *pcm)
|
||||
{
|
||||
pr_debug("%s\n", __func__);
|
||||
msm_dts_eagle_pcm_free(pcm);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
|
@ -105,23 +85,6 @@ static int msm_pcm_routing_hwdep_compat_ioctl(struct snd_hwdep *hw,
|
|||
case SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER32:
|
||||
ret = msm_ds2_dap_compat_ioctl(hw, file, cmd, argp);
|
||||
break;
|
||||
case DTS_EAGLE_IOCTL_GET_CACHE_SIZE32:
|
||||
case DTS_EAGLE_IOCTL_SET_CACHE_SIZE32:
|
||||
case DTS_EAGLE_IOCTL_GET_PARAM32:
|
||||
case DTS_EAGLE_IOCTL_SET_PARAM32:
|
||||
case DTS_EAGLE_IOCTL_SET_CACHE_BLOCK32:
|
||||
case DTS_EAGLE_IOCTL_SET_ACTIVE_DEVICE32:
|
||||
case DTS_EAGLE_IOCTL_GET_LICENSE32:
|
||||
case DTS_EAGLE_IOCTL_SET_LICENSE32:
|
||||
case DTS_EAGLE_IOCTL_SEND_LICENSE32:
|
||||
case DTS_EAGLE_IOCTL_SET_VOLUME_COMMANDS32:
|
||||
ret = msm_dts_eagle_compat_ioctl(cmd, arg);
|
||||
if (ret == -EPERM) {
|
||||
pr_err("%s called with invalid control 0x%X\n",
|
||||
__func__, cmd);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pr_err("%s called with invalid control 0x%X\n", __func__, cmd);
|
||||
ret = -EINVAL;
|
||||
|
@ -167,7 +130,7 @@ int msm_pcm_routing_hwdep_new(struct snd_soc_pcm_runtime *runtime,
|
|||
#ifdef CONFIG_COMPAT
|
||||
hwdep->ops.ioctl_compat = msm_pcm_routing_hwdep_compat_ioctl;
|
||||
#endif
|
||||
return msm_dts_eagle_pcm_new(runtime);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <sound/pcm_params.h>
|
||||
#include <sound/q6core.h>
|
||||
#include <sound/audio_cal_utils.h>
|
||||
#include <sound/msm-dts-eagle.h>
|
||||
#include <sound/audio_effects.h>
|
||||
#include <sound/hwdep.h>
|
||||
|
||||
|
@ -156,10 +155,6 @@ static void msm_pcm_routing_cfg_pp(int port_id, int copp_idx, int topology,
|
|||
__func__, topology, port_id, rc);
|
||||
}
|
||||
break;
|
||||
case ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX:
|
||||
pr_debug("%s: DTS_EAGLE_COPP_TOPOLOGY_ID\n", __func__);
|
||||
msm_dts_eagle_init_post(port_id, copp_idx);
|
||||
break;
|
||||
case ADM_CMD_COPP_OPEN_TOPOLOGY_ID_AUDIOSPHERE:
|
||||
pr_debug("%s: TOPOLOGY_ID_AUDIOSPHERE\n", __func__);
|
||||
msm_qti_pp_asphere_init(port_id, copp_idx);
|
||||
|
@ -191,10 +186,6 @@ static void msm_pcm_routing_deinit_pp(int port_id, int topology)
|
|||
msm_dolby_dap_deinit(port_id);
|
||||
}
|
||||
break;
|
||||
case ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX:
|
||||
pr_debug("%s: DTS_EAGLE_COPP_TOPOLOGY_ID\n", __func__);
|
||||
msm_dts_eagle_deinit_post(port_id, topology);
|
||||
break;
|
||||
case ADM_CMD_COPP_OPEN_TOPOLOGY_ID_AUDIOSPHERE:
|
||||
pr_debug("%s: TOPOLOGY_ID_AUDIOSPHERE\n", __func__);
|
||||
msm_qti_pp_asphere_deinit(port_id);
|
||||
|
@ -7065,8 +7056,6 @@ static int msm_routing_probe(struct snd_soc_platform *platform)
|
|||
device_pp_params_mixer_controls,
|
||||
ARRAY_SIZE(device_pp_params_mixer_controls));
|
||||
|
||||
msm_dts_eagle_add_controls(platform);
|
||||
|
||||
snd_soc_add_platform_controls(platform, msm_source_tracking_controls,
|
||||
ARRAY_SIZE(msm_source_tracking_controls));
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <sound/q6afe-v2.h>
|
||||
#include <sound/audio_cal_utils.h>
|
||||
#include <sound/asound.h>
|
||||
#include <sound/msm-dts-eagle.h>
|
||||
#include "msm-dts-srs-tm-config.h"
|
||||
#include <sound/adsp_err.h>
|
||||
|
||||
|
@ -253,222 +252,6 @@ static int adm_get_next_available_copp(int port_idx)
|
|||
return idx;
|
||||
}
|
||||
|
||||
int adm_dts_eagle_set(int port_id, int copp_idx, int param_id,
|
||||
void *data, uint32_t size)
|
||||
{
|
||||
struct adm_cmd_set_pp_params_v5 admp;
|
||||
int p_idx, ret = 0, *ob_params;
|
||||
|
||||
pr_debug("DTS_EAGLE_ADM: %s - port id %i, copp idx %i, param id 0x%X size %u\n",
|
||||
__func__, port_id, copp_idx, param_id, size);
|
||||
|
||||
port_id = afe_convert_virtual_to_portid(port_id);
|
||||
p_idx = adm_validate_and_get_port_index(port_id);
|
||||
pr_debug("DTS_EAGLE_ADM: %s - after lookup, port id %i, port idx %i\n",
|
||||
__func__, port_id, p_idx);
|
||||
|
||||
if (p_idx < 0) {
|
||||
pr_err("DTS_EAGLE_ADM: %s: invalid port index 0x%x, port id 0x%x\n",
|
||||
__func__, p_idx, port_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (copp_idx < 0 || copp_idx >= MAX_COPPS_PER_PORT) {
|
||||
pr_err("DTS_EAGLE_ADM: %s: Invalid copp_idx: %d\n", __func__,
|
||||
copp_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ob_params = (int *)this_adm.outband_memmap.kvaddr;
|
||||
if (ob_params == NULL) {
|
||||
pr_err("DTS_EAGLE_ADM: %s - NULL memmap. Non Eagle topology selected?\n",
|
||||
__func__);
|
||||
ret = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
/* check for integer overflow */
|
||||
if (size > (UINT_MAX - APR_CMD_OB_HDR_SZ))
|
||||
ret = -EINVAL;
|
||||
if ((ret < 0) ||
|
||||
(size + APR_CMD_OB_HDR_SZ > this_adm.outband_memmap.size)) {
|
||||
pr_err("DTS_EAGLE_ADM - %s: ion alloc of size %zu too small for size requested %u\n",
|
||||
__func__, this_adm.outband_memmap.size,
|
||||
size + APR_CMD_OB_HDR_SZ);
|
||||
ret = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
*ob_params++ = AUDPROC_MODULE_ID_DTS_HPX_POSTMIX;
|
||||
*ob_params++ = param_id;
|
||||
*ob_params++ = size;
|
||||
memcpy(ob_params, data, size);
|
||||
|
||||
admp.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
|
||||
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
|
||||
admp.hdr.pkt_size = sizeof(admp);
|
||||
admp.hdr.src_svc = APR_SVC_ADM;
|
||||
admp.hdr.src_domain = APR_DOMAIN_APPS;
|
||||
admp.hdr.src_port = port_id;
|
||||
admp.hdr.dest_svc = APR_SVC_ADM;
|
||||
admp.hdr.dest_domain = APR_DOMAIN_ADSP;
|
||||
admp.hdr.dest_port = atomic_read(&this_adm.copp.id[p_idx][copp_idx]);
|
||||
admp.hdr.token = p_idx << 16 | copp_idx;
|
||||
admp.hdr.opcode = ADM_CMD_SET_PP_PARAMS_V5;
|
||||
admp.payload_addr_lsw = lower_32_bits(this_adm.outband_memmap.paddr);
|
||||
admp.payload_addr_msw = populate_upper_32_bits(
|
||||
this_adm.outband_memmap.paddr);
|
||||
admp.mem_map_handle = atomic_read(&this_adm.mem_map_handles[
|
||||
ADM_DTS_EAGLE]);
|
||||
admp.payload_size = size + sizeof(struct adm_param_data_v5);
|
||||
|
||||
pr_debug("DTS_EAGLE_ADM: %s - Command was sent now check Q6 - port id = %d, size %d, module id %x, param id %x.\n",
|
||||
__func__, admp.hdr.dest_port,
|
||||
admp.payload_size, AUDPROC_MODULE_ID_DTS_HPX_POSTMIX,
|
||||
param_id);
|
||||
atomic_set(&this_adm.copp.stat[p_idx][copp_idx], 0);
|
||||
atomic_set(&this_adm.copp.cmd_err_code[p_idx][copp_idx], 0);
|
||||
ret = apr_send_pkt(this_adm.apr, (uint32_t *)&admp);
|
||||
if (ret < 0) {
|
||||
pr_err("DTS_EAGLE_ADM: %s - ADM enable for port %d failed\n",
|
||||
__func__, port_id);
|
||||
ret = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
ret = wait_event_timeout(this_adm.copp.wait[p_idx][copp_idx],
|
||||
atomic_read(&this_adm.copp.stat[p_idx][copp_idx]),
|
||||
msecs_to_jiffies(TIMEOUT_MS));
|
||||
if (!ret) {
|
||||
pr_err("DTS_EAGLE_ADM: %s - set params timed out port = %d\n",
|
||||
__func__, port_id);
|
||||
ret = -EINVAL;
|
||||
} else if (atomic_read(&this_adm.copp.cmd_err_code
|
||||
[p_idx][copp_idx]) > 0) {
|
||||
pr_err("%s: DSP returned error[%s]\n",
|
||||
__func__, adsp_err_get_err_str(
|
||||
atomic_read(&this_adm.copp.cmd_err_code
|
||||
[p_idx][copp_idx])));
|
||||
ret = adsp_err_get_lnx_err_code(
|
||||
atomic_read(&this_adm.copp.cmd_err_code
|
||||
[p_idx][copp_idx]));
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
fail_cmd:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
|
||||
void *data, uint32_t size)
|
||||
{
|
||||
struct adm_cmd_get_pp_params_v5 admp;
|
||||
int p_idx, ret = 0, *ob_params;
|
||||
uint32_t orig_size = size;
|
||||
pr_debug("DTS_EAGLE_ADM: %s - port id %i, copp idx %i, param id 0x%X\n",
|
||||
__func__, port_id, copp_idx, param_id);
|
||||
|
||||
port_id = afe_convert_virtual_to_portid(port_id);
|
||||
p_idx = adm_validate_and_get_port_index(port_id);
|
||||
if (p_idx < 0) {
|
||||
pr_err("DTS_EAGLE_ADM: %s - invalid port index %i, port id %i, copp idx %i\n",
|
||||
__func__, p_idx, port_id, copp_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (copp_idx < 0 || copp_idx >= MAX_COPPS_PER_PORT) {
|
||||
pr_err("DTS_EAGLE_ADM: %s: Invalid copp_idx: %d\n", __func__,
|
||||
copp_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((size == 0) || !data) {
|
||||
pr_err("DTS_EAGLE_ADM: %s - invalid size %u or pointer %pK.\n",
|
||||
__func__, size, data);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
size = (size+3) & 0xFFFFFFFC;
|
||||
|
||||
ob_params = (int *)(this_adm.outband_memmap.kvaddr);
|
||||
if (ob_params == NULL) {
|
||||
pr_err("DTS_EAGLE_ADM: %s - NULL memmap. Non Eagle topology selected?",
|
||||
__func__);
|
||||
ret = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
/* check for integer overflow */
|
||||
if (size > (UINT_MAX - APR_CMD_OB_HDR_SZ))
|
||||
ret = -EINVAL;
|
||||
if ((ret < 0) ||
|
||||
(size + APR_CMD_OB_HDR_SZ > this_adm.outband_memmap.size)) {
|
||||
pr_err("DTS_EAGLE_ADM - %s: ion alloc of size %zu too small for size requested %u\n",
|
||||
__func__, this_adm.outband_memmap.size,
|
||||
size + APR_CMD_OB_HDR_SZ);
|
||||
ret = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
*ob_params++ = AUDPROC_MODULE_ID_DTS_HPX_POSTMIX;
|
||||
*ob_params++ = param_id;
|
||||
*ob_params++ = size;
|
||||
|
||||
admp.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
|
||||
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
|
||||
admp.hdr.pkt_size = sizeof(admp);
|
||||
admp.hdr.src_svc = APR_SVC_ADM;
|
||||
admp.hdr.src_domain = APR_DOMAIN_APPS;
|
||||
admp.hdr.src_port = port_id;
|
||||
admp.hdr.dest_svc = APR_SVC_ADM;
|
||||
admp.hdr.dest_domain = APR_DOMAIN_ADSP;
|
||||
admp.hdr.dest_port = atomic_read(&this_adm.copp.id[p_idx][copp_idx]);
|
||||
admp.hdr.token = p_idx << 16 | copp_idx;
|
||||
admp.hdr.opcode = ADM_CMD_GET_PP_PARAMS_V5;
|
||||
admp.data_payload_addr_lsw =
|
||||
lower_32_bits(this_adm.outband_memmap.paddr);
|
||||
admp.data_payload_addr_msw =
|
||||
populate_upper_32_bits(
|
||||
this_adm.outband_memmap.paddr);
|
||||
admp.mem_map_handle = atomic_read(&this_adm.mem_map_handles[
|
||||
ADM_DTS_EAGLE]);
|
||||
admp.module_id = AUDPROC_MODULE_ID_DTS_HPX_POSTMIX;
|
||||
admp.param_id = param_id;
|
||||
admp.param_max_size = size + sizeof(struct adm_param_data_v5);
|
||||
admp.reserved = 0;
|
||||
|
||||
atomic_set(&this_adm.copp.stat[p_idx][copp_idx], 0);
|
||||
atomic_set(&this_adm.copp.cmd_err_code[p_idx][copp_idx], 0);
|
||||
|
||||
ret = apr_send_pkt(this_adm.apr, (uint32_t *)&admp);
|
||||
if (ret < 0) {
|
||||
pr_err("DTS_EAGLE_ADM: %s - Failed to get EAGLE Params on port %d\n",
|
||||
__func__, port_id);
|
||||
ret = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
ret = wait_event_timeout(this_adm.copp.wait[p_idx][copp_idx],
|
||||
atomic_read(&this_adm.copp.stat[p_idx][copp_idx]),
|
||||
msecs_to_jiffies(TIMEOUT_MS));
|
||||
if (!ret) {
|
||||
pr_err("DTS_EAGLE_ADM: %s - EAGLE get params timed out port = %d\n",
|
||||
__func__, port_id);
|
||||
ret = -EINVAL;
|
||||
goto fail_cmd;
|
||||
} else if (atomic_read(&this_adm.copp.cmd_err_code
|
||||
[p_idx][copp_idx]) > 0) {
|
||||
pr_err("%s: DSP returned error[%s]\n",
|
||||
__func__, adsp_err_get_err_str(
|
||||
atomic_read(&this_adm.copp.cmd_err_code
|
||||
[p_idx][copp_idx])));
|
||||
ret = adsp_err_get_lnx_err_code(
|
||||
atomic_read(&this_adm.copp.cmd_err_code
|
||||
[p_idx][copp_idx]));
|
||||
goto fail_cmd;
|
||||
}
|
||||
|
||||
memcpy(data, ob_params, orig_size);
|
||||
ret = 0;
|
||||
fail_cmd:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int srs_trumedia_open(int port_id, int copp_idx, __s32 srs_tech_id,
|
||||
void *srs_params)
|
||||
{
|
||||
|
@ -2268,13 +2051,6 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
|
|||
__func__, port_id, path, rate, channel_mode, perf_mode,
|
||||
topology);
|
||||
|
||||
/* For DTS EAGLE only, force 24 bit */
|
||||
if ((topology == ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX) &&
|
||||
(perf_mode == LEGACY_PCM_MODE)) {
|
||||
bit_width = 24;
|
||||
pr_debug("%s: Force open adm in 24-bit for DTS HPX topology 0x%x\n",
|
||||
__func__, topology);
|
||||
}
|
||||
port_id = q6audio_convert_virtual_to_portid(port_id);
|
||||
port_idx = adm_validate_and_get_port_index(port_id);
|
||||
if (port_idx < 0) {
|
||||
|
@ -2301,8 +2077,7 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
|
|||
flags = ADM_LOW_LATENCY_DEVICE_SESSION;
|
||||
if ((topology == DOLBY_ADM_COPP_TOPOLOGY_ID) ||
|
||||
(topology == DS2_ADM_COPP_TOPOLOGY_ID) ||
|
||||
(topology == SRS_TRUMEDIA_TOPOLOGY_ID) ||
|
||||
(topology == ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX))
|
||||
(topology == SRS_TRUMEDIA_TOPOLOGY_ID))
|
||||
topology = DEFAULT_COPP_TOPOLOGY;
|
||||
} else {
|
||||
if (path == ADM_PATH_COMPRESSED_RX)
|
||||
|
@ -2387,20 +2162,6 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
|
|||
(uint32_t)this_adm.outband_memmap.size);
|
||||
}
|
||||
}
|
||||
if ((topology == ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX) &&
|
||||
(perf_mode == LEGACY_PCM_MODE)) {
|
||||
int res = 0;
|
||||
atomic_set(&this_adm.mem_map_index, ADM_DTS_EAGLE);
|
||||
msm_dts_ion_memmap(&this_adm.outband_memmap);
|
||||
res = adm_memory_map_regions(
|
||||
&this_adm.outband_memmap.paddr,
|
||||
0,
|
||||
(uint32_t *)&this_adm.outband_memmap.size,
|
||||
1);
|
||||
if (res < 0)
|
||||
pr_err("%s: DTS_EAGLE mmap did not work!",
|
||||
__func__);
|
||||
}
|
||||
open.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
|
||||
APR_HDR_LEN(APR_HDR_SIZE),
|
||||
APR_PKT_VER);
|
||||
|
@ -2686,21 +2447,6 @@ int adm_close(int port_id, int perf_mode, int copp_idx)
|
|||
}
|
||||
}
|
||||
|
||||
if ((perf_mode == LEGACY_PCM_MODE) &&
|
||||
(this_adm.outband_memmap.paddr != 0) &&
|
||||
(atomic_read(
|
||||
&this_adm.copp.topology[port_idx][copp_idx]) ==
|
||||
ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX)) {
|
||||
atomic_set(&this_adm.mem_map_index, ADM_DTS_EAGLE);
|
||||
ret = adm_memory_unmap_regions();
|
||||
if (ret < 0) {
|
||||
pr_err("%s: adm mem unmmap err %d",
|
||||
__func__, ret);
|
||||
} else {
|
||||
atomic_set(&this_adm.mem_map_handles
|
||||
[ADM_DTS_EAGLE], 0);
|
||||
}
|
||||
}
|
||||
|
||||
if ((afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_TX) &&
|
||||
(this_adm.sourceTrackingData.memmap.paddr != 0)) {
|
||||
|
@ -3087,10 +2833,6 @@ static int adm_init_cal_data(void)
|
|||
{NULL, NULL, NULL, NULL, NULL, NULL} },
|
||||
{NULL, NULL, cal_utils_match_buf_num} },
|
||||
|
||||
{{DTS_EAGLE_CAL_TYPE,
|
||||
{NULL, NULL, NULL, NULL, NULL, NULL} },
|
||||
{NULL, NULL, cal_utils_match_buf_num} },
|
||||
|
||||
{{SRS_TRUMEDIA_CAL_TYPE,
|
||||
{NULL, NULL, NULL, NULL, NULL, NULL} },
|
||||
{NULL, NULL, cal_utils_match_buf_num} }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
|
||||
* Author: Brian Swetland <swetland@google.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
|
@ -41,8 +41,8 @@
|
|||
#include <sound/q6core.h>
|
||||
#include <sound/q6audio-v2.h>
|
||||
#include <sound/audio_cal_utils.h>
|
||||
#include <sound/msm-dts-eagle.h>
|
||||
#include <sound/adsp_err.h>
|
||||
#include <sound/compress_params.h>
|
||||
|
||||
#define TRUE 0x01
|
||||
#define FALSE 0x00
|
||||
|
@ -2147,9 +2147,6 @@ static int __q6asm_open_read(struct audio_client *ac,
|
|||
open.src_endpointype = ASM_END_POINT_DEVICE_MATRIX;
|
||||
|
||||
open.preprocopo_id = q6asm_get_asm_topology();
|
||||
if ((open.preprocopo_id == ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX) ||
|
||||
(open.preprocopo_id == ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS))
|
||||
open.preprocopo_id = ASM_STREAM_POSTPROCOPO_ID_NONE;
|
||||
open.bits_per_sample = bits_per_sample;
|
||||
open.mode_flags = 0x0;
|
||||
|
||||
|
@ -2387,16 +2384,9 @@ static int __q6asm_open_write(struct audio_client *ac, uint32_t format,
|
|||
open.bits_per_sample = bits_per_sample;
|
||||
|
||||
open.postprocopo_id = q6asm_get_asm_topology();
|
||||
if ((ac->perf_mode != LEGACY_PCM_MODE) &&
|
||||
((open.postprocopo_id == ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX) ||
|
||||
(open.postprocopo_id == ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS)))
|
||||
if (ac->perf_mode != LEGACY_PCM_MODE)
|
||||
open.postprocopo_id = ASM_STREAM_POSTPROCOPO_ID_NONE;
|
||||
|
||||
/* For DTS EAGLE only, force 24 bit */
|
||||
if ((open.postprocopo_id == ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX) ||
|
||||
(open.postprocopo_id == ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS))
|
||||
open.bits_per_sample = 24;
|
||||
|
||||
pr_debug("%s: perf_mode %d asm_topology 0x%x bps %d\n", __func__,
|
||||
ac->perf_mode, open.postprocopo_id, open.bits_per_sample);
|
||||
|
||||
|
@ -2596,10 +2586,6 @@ static int __q6asm_open_read_write(struct audio_client *ac, uint32_t rd_format,
|
|||
topology : open.postprocopo_id;
|
||||
ac->topology = open.postprocopo_id;
|
||||
|
||||
/* For DTS EAGLE only, force 24 bit */
|
||||
if ((open.postprocopo_id == ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX) ||
|
||||
(open.postprocopo_id == ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER))
|
||||
open.bits_per_sample = 24;
|
||||
|
||||
switch (wr_format) {
|
||||
case FORMAT_LINEAR_PCM:
|
||||
|
@ -5499,215 +5485,6 @@ fail_cmd:
|
|||
return rc;
|
||||
}
|
||||
|
||||
int q6asm_dts_eagle_set(struct audio_client *ac, int param_id, uint32_t size,
|
||||
void *data, struct param_outband *po, int m_id)
|
||||
{
|
||||
int rc = 0, *ob_params = NULL;
|
||||
uint32_t sz = sizeof(struct asm_dts_eagle_param) + (po ? 0 : size);
|
||||
struct asm_dts_eagle_param *ad;
|
||||
|
||||
if (!ac || ac->apr == NULL || (size == 0) || !data) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: APR handle NULL, invalid size %u or pointer %pK.\n",
|
||||
__func__, size, data);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ad = kzalloc(sz, GFP_KERNEL);
|
||||
if (!ad) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: error allocating mem of size %u\n",
|
||||
__func__, sz);
|
||||
return -ENOMEM;
|
||||
}
|
||||
pr_debug("DTS_EAGLE_ASM - %s: ac %pK param_id 0x%x size %u data %pK m_id 0x%x\n",
|
||||
__func__, ac, param_id, size, data, m_id);
|
||||
q6asm_add_hdr_async(ac, &ad->hdr, sz, 1);
|
||||
ad->hdr.opcode = ASM_STREAM_CMD_SET_PP_PARAMS_V2;
|
||||
ad->param.data_payload_addr_lsw = 0;
|
||||
ad->param.data_payload_addr_msw = 0;
|
||||
|
||||
ad->param.mem_map_handle = 0;
|
||||
ad->param.data_payload_size = size +
|
||||
sizeof(struct asm_stream_param_data_v2);
|
||||
ad->data.module_id = m_id;
|
||||
ad->data.param_id = param_id;
|
||||
ad->data.param_size = size;
|
||||
ad->data.reserved = 0;
|
||||
atomic_set(&ac->cmd_state, 1);
|
||||
|
||||
if (po) {
|
||||
struct list_head *ptr, *next;
|
||||
struct asm_buffer_node *node;
|
||||
pr_debug("DTS_EAGLE_ASM - %s: using out of band memory (virtual %pK, physical %pK)\n",
|
||||
__func__, po->kvaddr, &po->paddr);
|
||||
ad->param.data_payload_addr_lsw = lower_32_bits(po->paddr);
|
||||
ad->param.data_payload_addr_msw = populate_upper_32_bits(
|
||||
po->paddr);
|
||||
list_for_each_safe(ptr, next, &ac->port[IN].mem_map_handle) {
|
||||
node = list_entry(ptr, struct asm_buffer_node, list);
|
||||
if (node->buf_phys_addr == po->paddr) {
|
||||
ad->param.mem_map_handle = node->mmap_hdl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ad->param.mem_map_handle == 0) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: mem map handle not found\n",
|
||||
__func__);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
/* check for integer overflow */
|
||||
if (size > (UINT_MAX - APR_CMD_OB_HDR_SZ))
|
||||
rc = -EINVAL;
|
||||
if ((rc < 0) || (size + APR_CMD_OB_HDR_SZ > po->size)) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: ion alloc of size %zu too small for size requested %u\n",
|
||||
__func__, po->size, size + APR_CMD_OB_HDR_SZ);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
ob_params = (int *)po->kvaddr;
|
||||
*ob_params++ = m_id;
|
||||
*ob_params++ = param_id;
|
||||
*ob_params++ = size;
|
||||
memcpy(ob_params, data, size);
|
||||
} else {
|
||||
pr_debug("DTS_EAGLE_ASM - %s: using in band\n", __func__);
|
||||
memcpy(((char *)ad) + sizeof(struct asm_dts_eagle_param),
|
||||
data, size);
|
||||
}
|
||||
rc = apr_send_pkt(ac->apr, (uint32_t *)ad);
|
||||
if (rc < 0) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: set-params send failed paramid[0x%x]\n",
|
||||
__func__, ad->data.param_id);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
|
||||
rc = wait_event_timeout(ac->cmd_wait,
|
||||
(atomic_read(&ac->cmd_state) <= 0), 1*HZ);
|
||||
if (!rc) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: timeout, set-params paramid[0x%x]\n",
|
||||
__func__, ad->data.param_id);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
rc = 0;
|
||||
fail_cmd:
|
||||
kfree(ad);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int q6asm_dts_eagle_get(struct audio_client *ac, int param_id, uint32_t size,
|
||||
void *data, struct param_outband *po, int m_id)
|
||||
{
|
||||
struct asm_dts_eagle_param_get *ad;
|
||||
int rc = 0, *ob_params = NULL;
|
||||
uint32_t sz = sizeof(struct asm_dts_eagle_param) + APR_CMD_GET_HDR_SZ +
|
||||
(po ? 0 : size);
|
||||
|
||||
if (!ac || ac->apr == NULL || (size == 0) || !data) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: APR handle NULL, invalid size %u or pointer %pK\n",
|
||||
__func__, size, data);
|
||||
return -EINVAL;
|
||||
}
|
||||
ad = kzalloc(sz, GFP_KERNEL);
|
||||
if (!ad) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: error allocating memory of size %u\n",
|
||||
__func__, sz);
|
||||
return -ENOMEM;
|
||||
}
|
||||
pr_debug("DTS_EAGLE_ASM - %s: ac %pK param_id 0x%x size %u data %pK m_id 0x%x\n",
|
||||
__func__, ac, param_id, size, data, m_id);
|
||||
q6asm_add_hdr(ac, &ad->hdr, sz, TRUE);
|
||||
ad->hdr.opcode = ASM_STREAM_CMD_GET_PP_PARAMS_V2;
|
||||
ad->param.data_payload_addr_lsw = 0;
|
||||
ad->param.data_payload_addr_msw = 0;
|
||||
ad->param.mem_map_handle = 0;
|
||||
ad->param.module_id = m_id;
|
||||
ad->param.param_id = param_id;
|
||||
ad->param.param_max_size = size + APR_CMD_GET_HDR_SZ;
|
||||
ad->param.reserved = 0;
|
||||
atomic_set(&ac->cmd_state, 1);
|
||||
|
||||
generic_get_data = kzalloc(size + sizeof(struct generic_get_data_),
|
||||
GFP_KERNEL);
|
||||
if (!generic_get_data) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: error allocating mem of size %u\n",
|
||||
__func__, size);
|
||||
rc = -ENOMEM;
|
||||
goto fail_cmd;
|
||||
}
|
||||
|
||||
if (po) {
|
||||
struct list_head *ptr, *next;
|
||||
struct asm_buffer_node *node;
|
||||
pr_debug("DTS_EAGLE_ASM - %s: using out of band memory (virtual %pK, physical %pK)\n",
|
||||
__func__, po->kvaddr, &po->paddr);
|
||||
ad->param.data_payload_addr_lsw = lower_32_bits(po->paddr);
|
||||
ad->param.data_payload_addr_msw = populate_upper_32_bits(
|
||||
po->paddr);
|
||||
list_for_each_safe(ptr, next, &ac->port[IN].mem_map_handle) {
|
||||
node = list_entry(ptr, struct asm_buffer_node, list);
|
||||
if (node->buf_phys_addr == po->paddr) {
|
||||
ad->param.mem_map_handle = node->mmap_hdl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ad->param.mem_map_handle == 0) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: mem map handle not found\n",
|
||||
__func__);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
/* check for integer overflow */
|
||||
if (size > (UINT_MAX - APR_CMD_OB_HDR_SZ))
|
||||
rc = -EINVAL;
|
||||
if ((rc < 0) || (size + APR_CMD_OB_HDR_SZ > po->size)) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: ion alloc of size %zu too small for size requested %u\n",
|
||||
__func__, po->size, size + APR_CMD_OB_HDR_SZ);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
ob_params = (int *)po->kvaddr;
|
||||
*ob_params++ = m_id;
|
||||
*ob_params++ = param_id;
|
||||
*ob_params++ = size;
|
||||
generic_get_data->is_inband = 0;
|
||||
} else {
|
||||
pr_debug("DTS_EAGLE_ASM - %s: using in band\n", __func__);
|
||||
generic_get_data->is_inband = 1;
|
||||
}
|
||||
|
||||
rc = apr_send_pkt(ac->apr, (uint32_t *)ad);
|
||||
if (rc < 0) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: Commmand 0x%x failed\n", __func__,
|
||||
ad->hdr.opcode);
|
||||
goto fail_cmd;
|
||||
}
|
||||
|
||||
rc = wait_event_timeout(ac->cmd_wait,
|
||||
(atomic_read(&ac->cmd_state) <= 0), 1*HZ);
|
||||
if (!rc) {
|
||||
pr_err("DTS_EAGLE_ASM - %s: timeout in get\n",
|
||||
__func__);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
|
||||
if (generic_get_data->valid) {
|
||||
rc = 0;
|
||||
memcpy(data, po ? ob_params : generic_get_data->ints, size);
|
||||
} else {
|
||||
rc = -EINVAL;
|
||||
pr_err("DTS_EAGLE_ASM - %s: EAGLE get params problem getting data - check callback error value\n",
|
||||
__func__);
|
||||
}
|
||||
fail_cmd:
|
||||
kfree(ad);
|
||||
kfree(generic_get_data);
|
||||
generic_get_data = NULL;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __q6asm_set_volume(struct audio_client *ac, int volume, int instance)
|
||||
{
|
||||
struct asm_volume_ctrl_master_gain vol;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, 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
|
||||
|
@ -187,7 +187,7 @@ static int32_t aprv2_core_fn_q(struct apr_client_data *data, void *priv)
|
|||
generic_get_data->valid = 1;
|
||||
generic_get_data->size_in_ints =
|
||||
data->payload_size/sizeof(int);
|
||||
pr_debug("DTS_EAGLE_CORE callback size = %i\n",
|
||||
pr_debug("callback size = %i\n",
|
||||
data->payload_size);
|
||||
memcpy(generic_get_data->ints, data->payload,
|
||||
data->payload_size);
|
||||
|
@ -420,115 +420,6 @@ fail_cmd:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int core_dts_eagle_set(int size, char *data)
|
||||
{
|
||||
struct adsp_dts_eagle *payload = NULL;
|
||||
int rc = 0, size_aligned4byte;
|
||||
|
||||
pr_debug("DTS_EAGLE_CORE - %s\n", __func__);
|
||||
if (size <= 0 || !data) {
|
||||
pr_err("DTS_EAGLE_CORE - %s: invalid size %i or pointer %pK.\n",
|
||||
__func__, size, data);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
size_aligned4byte = (size+3) & 0xFFFFFFFC;
|
||||
ocm_core_open();
|
||||
if (q6core_lcl.core_handle_q) {
|
||||
payload = kzalloc(sizeof(struct adsp_dts_eagle) +
|
||||
size_aligned4byte, GFP_KERNEL);
|
||||
if (!payload) {
|
||||
pr_err("DTS_EAGLE_CORE - %s: out of memory (aligned size %i).\n",
|
||||
__func__, size_aligned4byte);
|
||||
return -ENOMEM;
|
||||
}
|
||||
payload->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_EVENT,
|
||||
APR_HDR_LEN(APR_HDR_SIZE),
|
||||
APR_PKT_VER);
|
||||
payload->hdr.pkt_size = sizeof(struct adsp_dts_eagle) +
|
||||
size_aligned4byte;
|
||||
payload->hdr.src_port = 0;
|
||||
payload->hdr.dest_port = 0;
|
||||
payload->hdr.token = 0;
|
||||
payload->hdr.opcode = ADSP_CMD_SET_DTS_EAGLE_DATA_ID;
|
||||
payload->id = DTS_EAGLE_LICENSE_ID;
|
||||
payload->overwrite = 1;
|
||||
payload->size = size;
|
||||
memcpy(payload->data, data, size);
|
||||
rc = apr_send_pkt(q6core_lcl.core_handle_q,
|
||||
(uint32_t *)payload);
|
||||
if (rc < 0) {
|
||||
pr_err("DTS_EAGLE_CORE - %s: failed op[0x%x]rc[%d]\n",
|
||||
__func__, payload->hdr.opcode, rc);
|
||||
}
|
||||
kfree(payload);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int core_dts_eagle_get(int id, int size, char *data)
|
||||
{
|
||||
struct apr_hdr ah;
|
||||
int rc = 0;
|
||||
|
||||
pr_debug("DTS_EAGLE_CORE - %s\n", __func__);
|
||||
if (size <= 0 || !data) {
|
||||
pr_err("DTS_EAGLE_CORE - %s: invalid size %i or pointer %pK.\n",
|
||||
__func__, size, data);
|
||||
return -EINVAL;
|
||||
}
|
||||
ocm_core_open();
|
||||
if (q6core_lcl.core_handle_q) {
|
||||
ah.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_EVENT,
|
||||
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
|
||||
ah.pkt_size = sizeof(struct apr_hdr);
|
||||
ah.src_port = 0;
|
||||
ah.dest_port = 0;
|
||||
ah.token = 0;
|
||||
ah.opcode = id;
|
||||
|
||||
q6core_lcl.bus_bw_resp_received = 0;
|
||||
generic_get_data = kzalloc(sizeof(struct generic_get_data_)
|
||||
+ size, GFP_KERNEL);
|
||||
if (!generic_get_data) {
|
||||
pr_err("DTS_EAGLE_CORE - %s: error allocating memory of size %i\n",
|
||||
__func__, size);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
rc = apr_send_pkt(q6core_lcl.core_handle_q,
|
||||
(uint32_t *)&ah);
|
||||
if (rc < 0) {
|
||||
pr_err("DTS_EAGLE_CORE - %s: failed op[0x%x]rc[%d]\n",
|
||||
__func__, ah.opcode, rc);
|
||||
goto fail_cmd_2;
|
||||
}
|
||||
|
||||
rc = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
|
||||
(q6core_lcl.bus_bw_resp_received == 1),
|
||||
msecs_to_jiffies(TIMEOUT_MS));
|
||||
if (!rc) {
|
||||
pr_err("DTS_EAGLE_CORE - %s: EAGLE get params timed out\n",
|
||||
__func__);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd_2;
|
||||
}
|
||||
if (generic_get_data->valid) {
|
||||
rc = 0;
|
||||
memcpy(data, generic_get_data->ints, size);
|
||||
} else {
|
||||
rc = -EINVAL;
|
||||
pr_err("DTS_EAGLE_CORE - %s: EAGLE get params problem getting data - check callback error value\n",
|
||||
__func__);
|
||||
}
|
||||
}
|
||||
|
||||
fail_cmd_2:
|
||||
kfree(generic_get_data);
|
||||
generic_get_data = NULL;
|
||||
return rc;
|
||||
}
|
||||
|
||||
uint32_t core_set_dolby_manufacturer_id(int manufacturer_id)
|
||||
{
|
||||
struct adsp_dolby_manufacturer_id payload;
|
||||
|
|
Loading…
Reference in New Issue