Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* arch/arm/mach-msm/qdsp5/adsp_6220.h |
| 2 | * |
| 3 | * Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. |
| 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 */ |
| 19 | typedef 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 */ |
| 68 | static 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 */ |
| 93 | static uint32_t qdsp_gaudio_queue_offset_table[] = { |
| 94 | QDSP_RTOS_NO_QUEUE, /* QDSP_lpmCommandQueue */ |
| 95 | 0x3f0, /* QDSP_mpuAfeQueue */ |
| 96 | 0x420, /* 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 | 0x3f4, /* QDSP_uPAudPPCmd1Queue */ |
| 105 | 0x3f8, /* QDSP_uPAudPPCmd2Queue */ |
| 106 | 0x3fc, /* QDSP_uPAudPPCmd3Queue */ |
| 107 | 0x40c, /* QDSP_uPAudPlay0BitStreamCtrlQueue */ |
| 108 | 0x410, /* QDSP_uPAudPlay1BitStreamCtrlQueue */ |
| 109 | 0x414, /* QDSP_uPAudPlay2BitStreamCtrlQueue */ |
| 110 | 0x418, /* QDSP_uPAudPlay3BitStreamCtrlQueue */ |
| 111 | 0x41c, /* QDSP_uPAudPlay4BitStreamCtrlQueue */ |
| 112 | 0x400, /* QDSP_uPAudPreProcCmdQueue */ |
| 113 | 0x408, /* QDSP_uPAudRecBitStreamQueue */ |
| 114 | 0x404, /* 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 */ |
| 124 | static 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 */ |
| 149 | static uint32_t qdsp_combo_queue_offset_table[] = { |
| 150 | 0x6f2, /* QDSP_lpmCommandQueue */ |
| 151 | 0x69e, /* QDSP_mpuAfeQueue */ |
| 152 | QDSP_RTOS_NO_QUEUE, /* QDSP_mpuGraphicsCmdQueue */ |
| 153 | 0x6b2, /* QDSP_mpuModmathCmdQueue */ |
| 154 | 0x6c6, /* QDSP_mpuVDecCmdQueue */ |
| 155 | 0x6ca, /* QDSP_mpuVDecPktQueue */ |
| 156 | 0x6c2, /* QDSP_mpuVEncCmdQueue */ |
| 157 | 0x6a6, /* QDSP_rxMpuDecCmdQueue */ |
| 158 | 0x6aa, /* QDSP_rxMpuDecPktQueue */ |
| 159 | 0x6ae, /* QDSP_txMpuEncQueue */ |
| 160 | 0x6ce, /* QDSP_uPAudPPCmd1Queue */ |
| 161 | 0x6d2, /* QDSP_uPAudPPCmd2Queue */ |
| 162 | 0x6d6, /* QDSP_uPAudPPCmd3Queue */ |
| 163 | 0x6e6, /* QDSP_uPAudPlay0BitStreamCtrlQueue */ |
| 164 | QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay1BitStreamCtrlQueue */ |
| 165 | QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay2BitStreamCtrlQueue */ |
| 166 | QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay3BitStreamCtrlQueue */ |
| 167 | QDSP_RTOS_NO_QUEUE, /* QDSP_uPAudPlay4BitStreamCtrlQueue */ |
| 168 | 0x6da, /* QDSP_uPAudPreProcCmdQueue */ |
| 169 | 0x6e2, /* QDSP_uPAudRecBitStreamQueue */ |
| 170 | 0x6de, /* QDSP_uPAudRecCmdQueue */ |
| 171 | 0x6ee, /* QDSP_uPJpegActionCmdQueue */ |
| 172 | 0x6ea, /* QDSP_uPJpegCfgCmdQueue */ |
| 173 | 0x6a2, /* QDSP_uPVocProcQueue */ |
| 174 | 0x6b6, /* QDSP_vfeCommandQueue */ |
| 175 | 0x6be, /* QDSP_vfeCommandScaleQueue */ |
| 176 | 0x6ba /* QDSP_vfeCommandTableQueue */ |
| 177 | }; |
| 178 | |
| 179 | /* Table of modules indexed by task ID for the QTV_LP image */ |
| 180 | static 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 */ |
| 205 | static uint32_t qdsp_qtv_lp_queue_offset_table[] = { |
| 206 | QDSP_RTOS_NO_QUEUE, /* QDSP_lpmCommandQueue */ |
| 207 | 0x430, /* QDSP_mpuAfeQueue */ |
| 208 | QDSP_RTOS_NO_QUEUE, /* QDSP_mpuGraphicsCmdQueue */ |
| 209 | QDSP_RTOS_NO_QUEUE, /* QDSP_mpuModmathCmdQueue */ |
| 210 | 0x434, /* QDSP_mpuVDecCmdQueue */ |
| 211 | 0x438, /* 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 | 0x440, /* QDSP_uPAudPPCmd1Queue */ |
| 217 | 0x444, /* QDSP_uPAudPPCmd2Queue */ |
| 218 | 0x448, /* QDSP_uPAudPPCmd3Queue */ |
| 219 | 0x454, /* 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 | 0x43c, /* QDSP_uPAudPreProcCmdQueue */ |
| 225 | 0x450, /* QDSP_uPAudRecBitStreamQueue */ |
| 226 | 0x44c, /* 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 */ |
| 236 | static qdsp_module_type *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 */ |
| 243 | static 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 | |
| 252 | static struct adsp_module_info module_info[] = { |
| 253 | QDSP_MODULE(AUDPLAY0TASK), |
| 254 | QDSP_MODULE(AUDPPTASK), |
| 255 | QDSP_MODULE(AUDPREPROCTASK), |
| 256 | QDSP_MODULE(AUDRECTASK), |
| 257 | QDSP_MODULE(VFETASK), |
| 258 | QDSP_MODULE(QCAMTASK), |
| 259 | QDSP_MODULE(LPMTASK), |
| 260 | QDSP_MODULE(JPEGTASK), |
| 261 | QDSP_MODULE(VIDEOTASK), |
| 262 | QDSP_MODULE(VDEC_LP_MODE), |
| 263 | }; |
| 264 | |
| 265 | int adsp_init_info(struct adsp_info *info) |
| 266 | { |
| 267 | info->send_irq = 0x00c00200; |
| 268 | info->read_ctrl = 0x00400038; |
| 269 | info->write_ctrl = 0x00400034; |
| 270 | |
| 271 | info->max_msg16_size = 193; |
| 272 | info->max_msg32_size = 8; |
| 273 | |
| 274 | info->max_task_id = 16; |
| 275 | info->max_module_id = QDSP_MODULE_MAX - 1; |
| 276 | info->max_queue_id = QDSP_QUEUE_MAX; |
| 277 | info->max_image_id = 2; |
| 278 | info->queue_offset = qdsp_queue_offset_table; |
| 279 | info->task_to_module = qdsp_task_to_module; |
| 280 | |
| 281 | info->module_count = ARRAY_SIZE(module_info); |
| 282 | info->module = module_info; |
| 283 | return 0; |
| 284 | } |