1 /* arch/arm/mach-msm/qdsp5/adsp_lpm_verify_cmd.c
3 * Verificion code for aDSP LPM packets from userspace.
5 * Copyright (c) 2008 QUALCOMM Incorporated
6 * Copyright (C) 2008 Google, Inc.
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
19 #include <mach/qdsp5/qdsp5lpmcmdi.h>
22 int adsp_lpm_verify_cmd(struct msm_adsp_module *module,
23 unsigned int queue_id, void *cmd_data,
26 uint32_t cmd_id, col_height, input_row_incr, output_row_incr,
27 input_size, output_size;
28 uint32_t size_mask = 0x0fff;
31 if (queue_id != QDSP_lpmCommandQueue) {
32 printk(KERN_ERR "adsp: module %s: wrong queue id %d\n",
33 module->name, queue_id);
37 cmd = (lpm_cmd_start *)cmd_data;
40 if (cmd_id == LPM_CMD_START) {
41 if (cmd_size != sizeof(lpm_cmd_start)) {
42 printk(KERN_ERR "adsp: module %s: wrong size %d, expect %d\n",
43 module->name, cmd_size, sizeof(lpm_cmd_start));
46 col_height = cmd->ip_data_cfg_part1 & size_mask;
47 input_row_incr = cmd->ip_data_cfg_part2 & size_mask;
48 output_row_incr = cmd->op_data_cfg_part1 & size_mask;
49 input_size = col_height * input_row_incr;
50 output_size = col_height * output_row_incr;
51 if ((cmd->ip_data_cfg_part4 && adsp_pmem_fixup(module,
52 (void **)(&cmd->ip_data_cfg_part4),
54 (cmd->op_data_cfg_part3 && adsp_pmem_fixup(module,
55 (void **)(&cmd->op_data_cfg_part3),
58 } else if (cmd_id > 1) {
59 printk(KERN_ERR "adsp: module %s: invalid cmd_id %d\n",
60 module->name, cmd_id);