1/* arch/arm/mach-msm/qdsp5/adsp_6210.h 2 * 3 * Copyright (c) 2008 QUALCOMM Incorporated. 4 * 5 * This software is licensed under the terms of the GNU General Public 6 * License version 2, as published by the Free Software Foundation, and 7 * may be copied, distributed, and modified under those terms. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 */ 15 16#include "adsp.h" 17 18/* Firmware modules */ 19typedef enum { 20 QDSP_MODULE_KERNEL, 21 QDSP_MODULE_AFETASK, 22 QDSP_MODULE_AUDPLAY0TASK, 23 QDSP_MODULE_AUDPLAY1TASK, 24 QDSP_MODULE_AUDPPTASK, 25 QDSP_MODULE_VIDEOTASK, 26 QDSP_MODULE_VIDEO_AAC_VOC, 27 QDSP_MODULE_PCM_DEC, 28 QDSP_MODULE_AUDIO_DEC_MP3, 29 QDSP_MODULE_AUDIO_DEC_AAC, 30 QDSP_MODULE_AUDIO_DEC_WMA, 31 QDSP_MODULE_HOSTPCM, 32 QDSP_MODULE_DTMF, 33 QDSP_MODULE_AUDRECTASK, 34 QDSP_MODULE_AUDPREPROCTASK, 35 QDSP_MODULE_SBC_ENC, 36 QDSP_MODULE_VOC, 37 QDSP_MODULE_VOC_PCM, 38 QDSP_MODULE_VOCENCTASK, 39 QDSP_MODULE_VOCDECTASK, 40 QDSP_MODULE_VOICEPROCTASK, 41 QDSP_MODULE_VIDEOENCTASK, 42 QDSP_MODULE_VFETASK, 43 QDSP_MODULE_WAV_ENC, 44 QDSP_MODULE_AACLC_ENC, 45 QDSP_MODULE_VIDEO_AMR, 46 QDSP_MODULE_VOC_AMR, 47 QDSP_MODULE_VOC_EVRC, 48 QDSP_MODULE_VOC_13K, 49 QDSP_MODULE_VOC_FGV, 50 QDSP_MODULE_DIAGTASK, 51 QDSP_MODULE_JPEGTASK, 52 QDSP_MODULE_LPMTASK, 53 QDSP_MODULE_QCAMTASK, 54 QDSP_MODULE_MODMATHTASK, 55 QDSP_MODULE_AUDPLAY2TASK, 56 QDSP_MODULE_AUDPLAY3TASK, 57 QDSP_MODULE_AUDPLAY4TASK, 58 QDSP_MODULE_GRAPHICSTASK, 59 QDSP_MODULE_MIDI, 60 QDSP_MODULE_GAUDIO, 61 QDSP_MODULE_VDEC_LP_MODE, 62 QDSP_MODULE_MAX, 63} qdsp_module_type; 64 65#define QDSP_RTOS_MAX_TASK_ID 19U 66 67/* Table of modules indexed by task ID for the GAUDIO image */ 68static qdsp_module_type qdsp_gaudio_task_to_module_table[] = { 69 QDSP_MODULE_KERNEL, 70 QDSP_MODULE_AFETASK, 71 QDSP_MODULE_MAX, 72 QDSP_MODULE_MAX, 73 QDSP_MODULE_MAX, 74 QDSP_MODULE_MAX, 75 QDSP_MODULE_MAX, 76 QDSP_MODULE_MAX, 77 QDSP_MODULE_MAX, 78 QDSP_MODULE_AUDPPTASK, 79 QDSP_MODULE_AUDPLAY0TASK, 80 QDSP_MODULE_AUDPLAY1TASK, 81 QDSP_MODULE_AUDPLAY2TASK, 82 QDSP_MODULE_AUDPLAY3TASK, 83 QDSP_MODULE_AUDPLAY4TASK, 84 QDSP_MODULE_MAX, 85 QDSP_MODULE_AUDRECTASK, 86 QDSP_MODULE_AUDPREPROCTASK, 87 QDSP_MODULE_MAX, 88 QDSP_MODULE_GRAPHICSTASK, 89 QDSP_MODULE_MAX 90}; 91 92/* Queue offset table indexed by queue ID for the GAUDIO image */ 93static uint32_t qdsp_gaudio_queue_offset_table[] = { 94 QDSP_RTOS_NO_QUEUE, /* QDSP_lpmCommandQueue */ 95 0x3be, /* QDSP_mpuAfeQueue */ 96 0x3ee, /* QDSP_mpuGraphicsCmdQueue */ 97 QDSP_RTOS_NO_QUEUE, /* QDSP_mpuModmathCmdQueue */ 98 QDSP_RTOS_NO_QUEUE, /* QDSP_mpuVDecCmdQueue */ 99 QDSP_RTOS_NO_QUEUE, /* QDSP_mpuVDecPktQueue */ 100 QDSP_RTOS_NO_QUEUE, /* QDSP_mpuVEncCmdQueue */ 101 QDSP_RTOS_NO_QUEUE, /* QDSP_rxMpuDecCmdQueue */ 102 QDSP_RTOS_NO_QUEUE, /* QDSP_rxMpuDecPktQueue */ 103 QDSP_RTOS_NO_QUEUE, /* QDSP_txMpuEncQueue */ 104 0x3c2, /* QDSP_uPAudPPCmd1Queue */ 105 0x3c6, /* QDSP_uPAudPPCmd2Queue */ 106 0x3ca, /* QDSP_uPAudPPCmd3Queue */ 107 0x3da, /* QDSP_uPAudPlay0BitStreamCtrlQueue */ 108 0x3de, /* QDSP_uPAudPlay1BitStreamCtrlQueue */ 109 0x3e2, /* QDSP_uPAudPlay2BitStreamCtrlQueue */ 110 0x3e6, /* QDSP_uPAudPlay3BitStreamCtrlQueue */ 111 0x3ea, /* QDSP_uPAudPlay4BitStreamCtrlQueue */ 112 0x3ce, /* QDSP_uPAudPreProcCmdQueue */ 113 0x3d6, /* QDSP_uPAudRecBitStreamQueue */ 114 0x3d2, /* QDSP_uPAudRecCmdQueue */ 115 QDSP_RTOS_NO_QUEUE, /* QDSP_uPJpegActionCmdQueue */ 116 QDSP_RTOS_NO_QUEUE, /* QDSP_uPJpegCfgCmdQueue */ 117 QDSP_RTOS_NO_QUEUE, /* QDSP_uPVocProcQueue */ 118 QDSP_RTOS_NO_QUEUE, /* QDSP_vfeCommandQueue */ 119 QDSP_RTOS_NO_QUEUE, /* QDSP_vfeCommandScaleQueue */ 120 QDSP_RTOS_NO_QUEUE /* QDSP_vfeCommandTableQueue */ 121}; 122 123/* Table of modules indexed by task ID for the COMBO image */ 124static qdsp_module_type qdsp_combo_task_to_module_table[] = { 125 QDSP_MODULE_KERNEL, 126 QDSP_MODULE_AFETASK, 127 QDSP_MODULE_VOCDECTASK, 128 QDSP_MODULE_VOCENCTASK, 129 QDSP_MODULE_VIDEOTASK, 130 QDSP_MODULE_VIDEOENCTASK, 131 QDSP_MODULE_VOICEPROCTASK, 132 QDSP_MODULE_VFETASK, 133 QDSP_MODULE_JPEGTASK, 134 QDSP_MODULE_AUDPPTASK, 135 QDSP_MODULE_AUDPLAY0TASK, 136 QDSP_MODULE_AUDPLAY1TASK, 137 QDSP_MODULE_MAX, 138 QDSP_MODULE_MAX, 139 QDSP_MODULE_MAX, 140 QDSP_MODULE_LPMTASK, 141 QDSP_MODULE_AUDRECTASK, 142 QDSP_MODULE_AUDPREPROCTASK, 143 QDSP_MODULE_MODMATHTASK, 144 QDSP_MODULE_MAX, 145 QDSP_MODULE_MAX 146}; 147 148/* Queue offset table indexed by queue ID for the COMBO image */ 149static uint32_t qdsp_combo_queue_offset_table[] = { 150 0x585, /* QDSP_lpmCommandQueue */ 151 0x52d, /* QDSP_mpuAfeQueue */ 152 QDSP_RTOS_NO_QUEUE, /* QDSP_mpuGraphicsCmdQueue */ 153 0x541, /* QDSP_mpuModmathCmdQueue */ 154 0x555, /* QDSP_mpuVDecCmdQueue */ 155 0x559, /* QDSP_mpuVDecPktQueue */ 156 0x551, /* QDSP_mpuVEncCmdQueue */ 157 0x535, /* QDSP_rxMpuDecCmdQueue */ 158 0x539, /* QDSP_rxMpuDecPktQueue */ 159 0x53d, /* QDSP_txMpuEncQueue */ 160 0x55d, /* QDSP_uPAudPPCmd1Queue */ 161 0x561, /* QDSP_uPAudPPCmd2Queue */ 162 0x565, /* QDSP_uPAudPPCmd3Queue */ 163 0x575, /* QDSP_uPAudPlay0BitStreamCtrlQueue */ 164 0x579, /* QDSP_uPAudPlay1BitStreamCtrlQueue */ 165 QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay2BitStreamCtrlQueue */ 166 QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay3BitStreamCtrlQueue */ 167 QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay4BitStreamCtrlQueue */ 168 0x569, /* QDSP_uPAudPreProcCmdQueue */ 169 0x571, /* QDSP_uPAudRecBitStreamQueue */ 170 0x56d, /* QDSP_uPAudRecCmdQueue */ 171 0x581, /* QDSP_uPJpegActionCmdQueue */ 172 0x57d, /* QDSP_uPJpegCfgCmdQueue */ 173 0x531, /* QDSP_uPVocProcQueue */ 174 0x545, /* QDSP_vfeCommandQueue */ 175 0x54d, /* QDSP_vfeCommandScaleQueue */ 176 0x549 /* QDSP_vfeCommandTableQueue */ 177}; 178 179/* Table of modules indexed by task ID for the QTV_LP image */ 180static qdsp_module_type qdsp_qtv_lp_task_to_module_table[] = { 181 QDSP_MODULE_KERNEL, 182 QDSP_MODULE_AFETASK, 183 QDSP_MODULE_MAX, 184 QDSP_MODULE_MAX, 185 QDSP_MODULE_VIDEOTASK, 186 QDSP_MODULE_MAX, 187 QDSP_MODULE_MAX, 188 QDSP_MODULE_MAX, 189 QDSP_MODULE_MAX, 190 QDSP_MODULE_AUDPPTASK, 191 QDSP_MODULE_AUDPLAY0TASK, 192 QDSP_MODULE_MAX, 193 QDSP_MODULE_MAX, 194 QDSP_MODULE_MAX, 195 QDSP_MODULE_MAX, 196 QDSP_MODULE_MAX, 197 QDSP_MODULE_AUDRECTASK, 198 QDSP_MODULE_AUDPREPROCTASK, 199 QDSP_MODULE_MAX, 200 QDSP_MODULE_MAX, 201 QDSP_MODULE_MAX 202}; 203 204/* Queue offset table indexed by queue ID for the QTV_LP image */ 205static uint32_t qdsp_qtv_lp_queue_offset_table[] = { 206 QDSP_RTOS_NO_QUEUE, /* QDSP_lpmCommandQueue */ 207 0x40c, /* QDSP_mpuAfeQueue */ 208 QDSP_RTOS_NO_QUEUE, /* QDSP_mpuGraphicsCmdQueue */ 209 QDSP_RTOS_NO_QUEUE, /* QDSP_mpuModmathCmdQueue */ 210 0x410, /* QDSP_mpuVDecCmdQueue */ 211 0x414, /* QDSP_mpuVDecPktQueue */ 212 QDSP_RTOS_NO_QUEUE, /* QDSP_mpuVEncCmdQueue */ 213 QDSP_RTOS_NO_QUEUE, /* QDSP_rxMpuDecCmdQueue */ 214 QDSP_RTOS_NO_QUEUE, /* QDSP_rxMpuDecPktQueue */ 215 QDSP_RTOS_NO_QUEUE, /* QDSP_txMpuEncQueue */ 216 0x41c, /* QDSP_uPAudPPCmd1Queue */ 217 0x420, /* QDSP_uPAudPPCmd2Queue */ 218 0x424, /* QDSP_uPAudPPCmd3Queue */ 219 0x430, /* QDSP_uPAudPlay0BitStreamCtrlQueue */ 220 QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay1BitStreamCtrlQueue */ 221 QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay2BitStreamCtrlQueue */ 222 QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay3BitStreamCtrlQueue */ 223 QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay4BitStreamCtrlQueue */ 224 0x418, /* QDSP_uPAudPreProcCmdQueue */ 225 0x42c, /* QDSP_uPAudRecBitStreamQueue */ 226 0x428, /* QDSP_uPAudRecCmdQueue */ 227 QDSP_RTOS_NO_QUEUE, /* QDSP_uPJpegActionCmdQueue */ 228 QDSP_RTOS_NO_QUEUE, /* QDSP_uPJpegCfgCmdQueue */ 229 QDSP_RTOS_NO_QUEUE, /* QDSP_uPVocProcQueue */ 230 QDSP_RTOS_NO_QUEUE, /* QDSP_vfeCommandQueue */ 231 QDSP_RTOS_NO_QUEUE, /* QDSP_vfeCommandScaleQueue */ 232 QDSP_RTOS_NO_QUEUE /* QDSP_vfeCommandTableQueue */ 233}; 234 235/* Tables to convert tasks to modules */ 236static uint32_t *qdsp_task_to_module[] = { 237 qdsp_combo_task_to_module_table, 238 qdsp_gaudio_task_to_module_table, 239 qdsp_qtv_lp_task_to_module_table, 240}; 241 242/* Tables to retrieve queue offsets */ 243static uint32_t *qdsp_queue_offset_table[] = { 244 qdsp_combo_queue_offset_table, 245 qdsp_gaudio_queue_offset_table, 246 qdsp_qtv_lp_queue_offset_table, 247}; 248 249#define QDSP_MODULE(n) \ 250 { .name = #n, .pdev_name = "adsp_" #n, .id = QDSP_MODULE_##n } 251 252static struct adsp_module_info module_info[] = { 253 QDSP_MODULE(AUDPPTASK), 254 QDSP_MODULE(AUDRECTASK), 255 QDSP_MODULE(AUDPREPROCTASK), 256 QDSP_MODULE(VFETASK), 257 QDSP_MODULE(QCAMTASK), 258 QDSP_MODULE(LPMTASK), 259 QDSP_MODULE(JPEGTASK), 260 QDSP_MODULE(VIDEOTASK), 261 QDSP_MODULE(VDEC_LP_MODE), 262}; 263 264int adsp_init_info(struct adsp_info *info) 265{ 266 info->send_irq = 0x00c00200; 267 info->read_ctrl = 0x00400038; 268 info->write_ctrl = 0x00400034; 269 270 info->max_msg16_size = 193; 271 info->max_msg32_size = 8; 272 273 info->max_task_id = 16; 274 info->max_module_id = QDSP_MODULE_MAX - 1; 275 info->max_queue_id = QDSP_QUEUE_MAX; 276 info->max_image_id = 2; 277 info->queue_offset = qdsp_queue_offset_table; 278 info->task_to_module = qdsp_task_to_module; 279 280 info->module_count = ARRAY_SIZE(module_info); 281 info->module = module_info; 282 return 0; 283} 284