![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0+ */ 0002 /* 0003 * Copyright 2017-2021 NXP 0004 * 0005 ****************************************************************************** 0006 * Communication stack of audio with rpmsg 0007 ****************************************************************************** 0008 * Packet structure: 0009 * A SRTM message consists of a 10 bytes header followed by 0~N bytes of data 0010 * 0011 * +---------------+-------------------------------+ 0012 * | | Content | 0013 * +---------------+-------------------------------+ 0014 * | Byte Offset | 7 6 5 4 3 2 1 0 | 0015 * +---------------+---+---+---+---+---+---+---+---+ 0016 * | 0 | Category | 0017 * +---------------+---+---+---+---+---+---+---+---+ 0018 * | 1 ~ 2 | Version | 0019 * +---------------+---+---+---+---+---+---+---+---+ 0020 * | 3 | Type | 0021 * +---------------+---+---+---+---+---+---+---+---+ 0022 * | 4 | Command | 0023 * +---------------+---+---+---+---+---+---+---+---+ 0024 * | 5 | Reserved0 | 0025 * +---------------+---+---+---+---+---+---+---+---+ 0026 * | 6 | Reserved1 | 0027 * +---------------+---+---+---+---+---+---+---+---+ 0028 * | 7 | Reserved2 | 0029 * +---------------+---+---+---+---+---+---+---+---+ 0030 * | 8 | Reserved3 | 0031 * +---------------+---+---+---+---+---+---+---+---+ 0032 * | 9 | Reserved4 | 0033 * +---------------+---+---+---+---+---+---+---+---+ 0034 * | 10 | DATA 0 | 0035 * +---------------+---+---+---+---+---+---+---+---+ 0036 * : : : : : : : : : : : : : 0037 * +---------------+---+---+---+---+---+---+---+---+ 0038 * | N + 10 - 1 | DATA N-1 | 0039 * +---------------+---+---+---+---+---+---+---+---+ 0040 * 0041 * +----------+------------+------------------------------------------------+ 0042 * | Field | Byte | | 0043 * +----------+------------+------------------------------------------------+ 0044 * | Category | 0 | The destination category. | 0045 * +----------+------------+------------------------------------------------+ 0046 * | Version | 1 ~ 2 | The category version of the sender of the | 0047 * | | | packet. | 0048 * | | | The first byte represent the major version of | 0049 * | | | the packet.The second byte represent the minor | 0050 * | | | version of the packet. | 0051 * +----------+------------+------------------------------------------------+ 0052 * | Type | 3 | The message type of current message packet. | 0053 * +----------+------------+------------------------------------------------+ 0054 * | Command | 4 | The command byte sent to remote processor/SoC. | 0055 * +----------+------------+------------------------------------------------+ 0056 * | Reserved | 5 ~ 9 | Reserved field for future extension. | 0057 * +----------+------------+------------------------------------------------+ 0058 * | Data | N | The data payload of the message packet. | 0059 * +----------+------------+------------------------------------------------+ 0060 * 0061 * Audio control: 0062 * SRTM Audio Control Category Request Command Table: 0063 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0064 * | Category | Version | Type | Command | Data | Function | 0065 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0066 * | 0x03 | 0x0100 | 0x00 | 0x00 | Data[0]: Audio Device Index | Open a TX Instance. | 0067 * | | | | | Data[1]: format | | 0068 * | | | | | Data[2]: channels | | 0069 * | | | | | Data[3-6]: samplerate | | 0070 * | | | | | Data[7-10]: buffer_addr | | 0071 * | | | | | Data[11-14]: buffer_size | | 0072 * | | | | | Data[15-18]: period_size | | 0073 * | | | | | Data[19-22]: buffer_tail | | 0074 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0075 * | 0x03 | 0x0100 | 0x00 | 0x01 | Data[0]: Audio Device Index | Start a TX Instance. | 0076 * | | | | | Same as above command | | 0077 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0078 * | 0x03 | 0x0100 | 0x00 | 0x02 | Data[0]: Audio Device Index | Pause a TX Instance. | 0079 * | | | | | Same as above command | | 0080 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0081 * | 0x03 | 0x0100 | 0x00 | 0x03 | Data[0]: Audio Device Index | Resume a TX Instance. | 0082 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0083 * | 0x03 | 0x0100 | 0x00 | 0x04 | Data[0]: Audio Device Index | Stop a TX Instance. | 0084 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0085 * | 0x03 | 0x0100 | 0x00 | 0x05 | Data[0]: Audio Device Index | Close a TX Instance. | 0086 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0087 * | 0x03 | 0x0100 | 0x00 | 0x06 | Data[0]: Audio Device Index | Set Parameters for | 0088 * | | | | | Data[1]: format | a TX Instance. | 0089 * | | | | | Data[2]: channels | | 0090 * | | | | | Data[3-6]: samplerate | | 0091 * | | | | | Data[7-22]: reserved | | 0092 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0093 * | 0x03 | 0x0100 | 0x00 | 0x07 | Data[0]: Audio Device Index | Set TX Buffer. | 0094 * | | | | | Data[1-6]: reserved | | 0095 * | | | | | Data[7-10]: buffer_addr | | 0096 * | | | | | Data[11-14]: buffer_size | | 0097 * | | | | | Data[15-18]: period_size | | 0098 * | | | | | Data[19-22]: buffer_tail | | 0099 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0100 * | 0x03 | 0x0100 | 0x00 | 0x08 | Data[0]: Audio Device Index | Suspend a TX Instance | 0101 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0102 * | 0x03 | 0x0100 | 0x00 | 0x09 | Data[0]: Audio Device Index | Resume a TX Instance. | 0103 * | | | | | Data[1]: format | | 0104 * | | | | | Data[2]: channels | | 0105 * | | | | | Data[3-6]: samplerate | | 0106 * | | | | | Data[7-10]: buffer_addr | | 0107 * | | | | | Data[11-14]: buffer_size | | 0108 * | | | | | Data[15-18]: period_size | | 0109 * | | | | | Data[19-22]: buffer_tail | | 0110 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0111 * | 0x03 | 0x0100 | 0x00 | 0x0A | Data[0]: Audio Device Index | Open a RX Instance. | 0112 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0113 * | 0x03 | 0x0100 | 0x00 | 0x0B | Data[0]: Audio Device Index | Start a RX Instance. | 0114 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0115 * | 0x03 | 0x0100 | 0x00 | 0x0C | Data[0]: Audio Device Index | Pause a RX Instance. | 0116 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0117 * | 0x03 | 0x0100 | 0x00 | 0x0D | Data[0]: Audio Device Index | Resume a RX Instance. | 0118 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0119 * | 0x03 | 0x0100 | 0x00 | 0x0E | Data[0]: Audio Device Index | Stop a RX Instance. | 0120 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0121 * | 0x03 | 0x0100 | 0x00 | 0x0F | Data[0]: Audio Device Index | Close a RX Instance. | 0122 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0123 * | 0x03 | 0x0100 | 0x00 | 0x10 | Data[0]: Audio Device Index | Set Parameters for | 0124 * | | | | | Data[1]: format | a RX Instance. | 0125 * | | | | | Data[2]: channels | | 0126 * | | | | | Data[3-6]: samplerate | | 0127 * | | | | | Data[7-22]: reserved | | 0128 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0129 * | 0x03 | 0x0100 | 0x00 | 0x11 | Data[0]: Audio Device Index | Set RX Buffer. | 0130 * | | | | | Data[1-6]: reserved | | 0131 * | | | | | Data[7-10]: buffer_addr | | 0132 * | | | | | Data[11-14]: buffer_size | | 0133 * | | | | | Data[15-18]: period_size | | 0134 * | | | | | Data[19-22]: buffer_tail | | 0135 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0136 * | 0x03 | 0x0100 | 0x00 | 0x12 | Data[0]: Audio Device Index | Suspend a RX Instance.| 0137 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0138 * | 0x03 | 0x0100 | 0x00 | 0x13 | Data[0]: Audio Device Index | Resume a RX Instance. | 0139 * | | | | | Data[1]: format | | 0140 * | | | | | Data[2]: channels | | 0141 * | | | | | Data[3-6]: samplerate | | 0142 * | | | | | Data[7-10]: buffer_addr | | 0143 * | | | | | Data[11-14]: buffer_size | | 0144 * | | | | | Data[15-18]: period_size | | 0145 * | | | | | Data[19-22]: buffer_tail | | 0146 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0147 * | 0x03 | 0x0100 | 0x00 | 0x14 | Data[0]: Audio Device Index | Set register value | 0148 * | | | | | Data[1-6]: reserved | to codec | 0149 * | | | | | Data[7-10]: register | | 0150 * | | | | | Data[11-14]: value | | 0151 * | | | | | Data[15-22]: reserved | | 0152 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0153 * | 0x03 | 0x0100 | 0x00 | 0x15 | Data[0]: Audio Device Index | Get register value | 0154 * | | | | | Data[1-6]: reserved | from codec | 0155 * | | | | | Data[7-10]: register | | 0156 * | | | | | Data[11-22]: reserved | | 0157 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0158 * Note 1: See <List of Sample Format> for available value of 0159 * Sample Format; 0160 * Note 2: See <List of Audio Channels> for available value of Channels; 0161 * Note 3: Sample Rate of Set Parameters for an Audio TX Instance 0162 * Command and Set Parameters for an Audio RX Instance Command is 0163 * in little-endian format. 0164 * 0165 * SRTM Audio Control Category Response Command Table: 0166 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0167 * | Category | Version | Type | Command | Data | Function | 0168 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0169 * | 0x03 | 0x0100 | 0x01 | 0x00 | Data[0]: Audio Device Index | Reply for Open | 0170 * | | | | | Data[1]: Return code | a TX Instance | 0171 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0172 * | 0x03 | 0x0100 | 0x01 | 0x01 | Data[0]: Audio Device Index | Reply for Start | 0173 * | | | | | Data[1]: Return code | a TX Instance | 0174 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0175 * | 0x03 | 0x0100 | 0x01 | 0x02 | Data[0]: Audio Device Index | Reply for Pause | 0176 * | | | | | Data[1]: Return code | a TX Instance | 0177 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0178 * | 0x03 | 0x0100 | 0x01 | 0x03 | Data[0]: Audio Device Index | Reply for Resume | 0179 * | | | | | Data[1]: Return code | a TX Instance | 0180 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0181 * | 0x03 | 0x0100 | 0x01 | 0x04 | Data[0]: Audio Device Index | Reply for Stop | 0182 * | | | | | Data[1]: Return code | a TX Instance | 0183 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0184 * | 0x03 | 0x0100 | 0x01 | 0x05 | Data[0]: Audio Device Index | Reply for Close | 0185 * | | | | | Data[1]: Return code | a TX Instance | 0186 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0187 * | 0x03 | 0x0100 | 0x01 | 0x06 | Data[0]: Audio Device Index | Reply for Set Param | 0188 * | | | | | Data[1]: Return code | for a TX Instance. | 0189 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0190 * | 0x03 | 0x0100 | 0x01 | 0x07 | Data[0]: Audio Device Index | Reply for Set | 0191 * | | | | | Data[1]: Return code | TX Buffer | 0192 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0193 * | 0x03 | 0x0100 | 0x01 | 0x08 | Data[0]: Audio Device Index | Reply for Suspend | 0194 * | | | | | Data[1]: Return code | a TX Instance | 0195 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0196 * | 0x03 | 0x0100 | 0x01 | 0x09 | Data[0]: Audio Device Index | Reply for Resume | 0197 * | | | | | Data[1]: Return code | a TX Instance | 0198 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0199 * | 0x03 | 0x0100 | 0x01 | 0x0A | Data[0]: Audio Device Index | Reply for Open | 0200 * | | | | | Data[1]: Return code | a TX Instance | 0201 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0202 * | 0x03 | 0x0100 | 0x01 | 0x0B | Data[0]: Audio Device Index | Reply for Start | 0203 * | | | | | Data[1]: Return code | a TX Instance | 0204 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0205 * | 0x03 | 0x0100 | 0x01 | 0x0C | Data[0]: Audio Device Index | Reply for Pause | 0206 * | | | | | Data[1]: Return code | a TX Instance | 0207 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0208 * | 0x03 | 0x0100 | 0x01 | 0x0D | Data[0]: Audio Device Index | Reply for Resume | 0209 * | | | | | Data[1]: Return code | a RX Instance | 0210 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0211 * | 0x03 | 0x0100 | 0x01 | 0x0E | Data[0]: Audio Device Index | Reply for Stop | 0212 * | | | | | Data[1]: Return code | a RX Instance | 0213 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0214 * | 0x03 | 0x0100 | 0x01 | 0x0F | Data[0]: Audio Device Index | Reply for Close | 0215 * | | | | | Data[1]: Return code | a RX Instance | 0216 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0217 * | 0x03 | 0x0100 | 0x01 | 0x10 | Data[0]: Audio Device Index | Reply for Set Param | 0218 * | | | | | Data[1]: Return code | for a RX Instance. | 0219 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0220 * | 0x03 | 0x0100 | 0x01 | 0x11 | Data[0]: Audio Device Index | Reply for Set | 0221 * | | | | | Data[1]: Return code | RX Buffer | 0222 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0223 * | 0x03 | 0x0100 | 0x01 | 0x12 | Data[0]: Audio Device Index | Reply for Suspend | 0224 * | | | | | Data[1]: Return code | a RX Instance | 0225 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0226 * | 0x03 | 0x0100 | 0x01 | 0x13 | Data[0]: Audio Device Index | Reply for Resume | 0227 * | | | | | Data[1]: Return code | a RX Instance | 0228 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0229 * | 0x03 | 0x0100 | 0x01 | 0x14 | Data[0]: Audio Device Index | Reply for Set codec | 0230 * | | | | | Data[1]: Return code | register value | 0231 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0232 * | 0x03 | 0x0100 | 0x01 | 0x15 | Data[0]: Audio Device Index | Reply for Get codec | 0233 * | | | | | Data[1]: Return code | register value | 0234 * | | | | | Data[2-6]: reserved | | 0235 * | | | | | Data[7-10]: register | | 0236 * | | | | | Data[11-14]: value | | 0237 * | | | | | Data[15-22]: reserved | | 0238 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0239 * 0240 * SRTM Audio Control Category Notification Command Table: 0241 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0242 * | Category | Version | Type | Command | Data | Function | 0243 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0244 * | 0x03 | 0x0100 | 0x02 | 0x00 | Data[0]: Audio Device Index | Notify one TX period | 0245 * | | | | | | is finished | 0246 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0247 * | 0x03 | 0x0100 | 0x02 | 0x01 | Data[0]: Audio Device Index | Notify one RX period | 0248 * | | | | | | is finished | 0249 * +----------+---------+------+---------+-------------------------------+-----------------------+ 0250 * 0251 * List of Sample Format: 0252 * +------------------+-----------------------+ 0253 * | Sample Format | Description | 0254 * +------------------+-----------------------+ 0255 * | 0x0 | S16_LE | 0256 * +------------------+-----------------------+ 0257 * | 0x1 | S24_LE | 0258 * +------------------+-----------------------+ 0259 * 0260 * List of Audio Channels 0261 * +------------------+-----------------------+ 0262 * | Audio Channel | Description | 0263 * +------------------+-----------------------+ 0264 * | 0x0 | Left Channel | 0265 * +------------------+-----------------------+ 0266 * | 0x1 | Right Channel | 0267 * +------------------+---------------- ------+ 0268 * | 0x2 | Left & Right Channel | 0269 * +------------------+-----------------------+ 0270 * 0271 */ 0272 0273 #ifndef _IMX_PCM_RPMSG_H 0274 #define _IMX_PCM_RPMSG_H 0275 0276 #include <linux/pm_qos.h> 0277 #include <linux/interrupt.h> 0278 #include <sound/dmaengine_pcm.h> 0279 0280 #define RPMSG_TIMEOUT 1000 0281 0282 /* RPMSG Command (TYPE A)*/ 0283 #define TX_OPEN 0x0 0284 #define TX_START 0x1 0285 #define TX_PAUSE 0x2 0286 #define TX_RESTART 0x3 0287 #define TX_TERMINATE 0x4 0288 #define TX_CLOSE 0x5 0289 #define TX_HW_PARAM 0x6 0290 #define TX_BUFFER 0x7 0291 #define TX_SUSPEND 0x8 0292 #define TX_RESUME 0x9 0293 0294 #define RX_OPEN 0xA 0295 #define RX_START 0xB 0296 #define RX_PAUSE 0xC 0297 #define RX_RESTART 0xD 0298 #define RX_TERMINATE 0xE 0299 #define RX_CLOSE 0xF 0300 #define RX_HW_PARAM 0x10 0301 #define RX_BUFFER 0x11 0302 #define RX_SUSPEND 0x12 0303 #define RX_RESUME 0x13 0304 #define SET_CODEC_VALUE 0x14 0305 #define GET_CODEC_VALUE 0x15 0306 #define TX_POINTER 0x16 0307 #define RX_POINTER 0x17 0308 /* Total msg numver for type A */ 0309 #define MSG_TYPE_A_NUM 0x18 0310 0311 /* RPMSG Command (TYPE C)*/ 0312 #define TX_PERIOD_DONE 0x0 0313 #define RX_PERIOD_DONE 0x1 0314 /* Total msg numver for type C */ 0315 #define MSG_TYPE_C_NUM 0x2 0316 0317 #define MSG_MAX_NUM (MSG_TYPE_A_NUM + MSG_TYPE_C_NUM) 0318 0319 #define MSG_TYPE_A 0x0 0320 #define MSG_TYPE_B 0x1 0321 #define MSG_TYPE_C 0x2 0322 0323 #define RESP_NONE 0x0 0324 #define RESP_NOT_ALLOWED 0x1 0325 #define RESP_SUCCESS 0x2 0326 #define RESP_FAILED 0x3 0327 0328 #define RPMSG_S16_LE 0x0 0329 #define RPMSG_S24_LE 0x1 0330 #define RPMSG_S32_LE 0x2 0331 #define RPMSG_DSD_U16_LE 49 /* SNDRV_PCM_FORMAT_DSD_U16_LE */ 0332 #define RPMSG_DSD_U24_LE 0x4 0333 #define RPMSG_DSD_U32_LE 50 /* SNDRV_PCM_FORMAT_DSD_U32_LE */ 0334 0335 #define RPMSG_CH_LEFT 0x0 0336 #define RPMSG_CH_RIGHT 0x1 0337 #define RPMSG_CH_STEREO 0x2 0338 0339 #define WORK_MAX_NUM 0x30 0340 0341 /* Category define */ 0342 #define IMX_RMPSG_LIFECYCLE 1 0343 #define IMX_RPMSG_PMIC 2 0344 #define IMX_RPMSG_AUDIO 3 0345 #define IMX_RPMSG_KEY 4 0346 #define IMX_RPMSG_GPIO 5 0347 #define IMX_RPMSG_RTC 6 0348 #define IMX_RPMSG_SENSOR 7 0349 0350 /* rpmsg version */ 0351 #define IMX_RMPSG_MAJOR 1 0352 #define IMX_RMPSG_MINOR 0 0353 0354 #define TX SNDRV_PCM_STREAM_PLAYBACK 0355 #define RX SNDRV_PCM_STREAM_CAPTURE 0356 0357 /** 0358 * struct rpmsg_head: rpmsg header structure 0359 * 0360 * @cate: category 0361 * @major: major version 0362 * @minor: minor version 0363 * @type: message type (A/B/C) 0364 * @cmd: message command 0365 * @reserved: reserved space 0366 */ 0367 struct rpmsg_head { 0368 u8 cate; 0369 u8 major; 0370 u8 minor; 0371 u8 type; 0372 u8 cmd; 0373 u8 reserved[5]; 0374 } __packed; 0375 0376 /** 0377 * struct param_s: sent rpmsg parameter 0378 * 0379 * @audioindex: audio instance index 0380 * @format: audio format 0381 * @channels: audio channel number 0382 * @rate: sample rate 0383 * @buffer_addr: dma buffer physical address or register for SET_CODEC_VALUE 0384 * @buffer_size: dma buffer size or register value for SET_CODEC_VALUE 0385 * @period_size: period size 0386 * @buffer_tail: current period index 0387 */ 0388 struct param_s { 0389 unsigned char audioindex; 0390 unsigned char format; 0391 unsigned char channels; 0392 unsigned int rate; 0393 unsigned int buffer_addr; 0394 unsigned int buffer_size; 0395 unsigned int period_size; 0396 unsigned int buffer_tail; 0397 } __packed; 0398 0399 /** 0400 * struct param_s: send rpmsg parameter 0401 * 0402 * @audioindex: audio instance index 0403 * @resp: response value 0404 * @reserved1: reserved space 0405 * @buffer_offset: the consumed offset of buffer 0406 * @reg_addr: register addr of codec 0407 * @reg_data: register value of codec 0408 * @reserved2: reserved space 0409 * @buffer_tail: current period index 0410 */ 0411 struct param_r { 0412 unsigned char audioindex; 0413 unsigned char resp; 0414 unsigned char reserved1[1]; 0415 unsigned int buffer_offset; 0416 unsigned int reg_addr; 0417 unsigned int reg_data; 0418 unsigned char reserved2[4]; 0419 unsigned int buffer_tail; 0420 } __packed; 0421 0422 /* Struct of sent message */ 0423 struct rpmsg_s_msg { 0424 struct rpmsg_head header; 0425 struct param_s param; 0426 }; 0427 0428 /* Struct of received message */ 0429 struct rpmsg_r_msg { 0430 struct rpmsg_head header; 0431 struct param_r param; 0432 }; 0433 0434 /* Struct of rpmsg */ 0435 struct rpmsg_msg { 0436 struct rpmsg_s_msg s_msg; 0437 struct rpmsg_r_msg r_msg; 0438 }; 0439 0440 /* Struct of rpmsg for workqueue */ 0441 struct work_of_rpmsg { 0442 struct rpmsg_info *info; 0443 /* Sent msg for each work */ 0444 struct rpmsg_msg msg; 0445 struct work_struct work; 0446 }; 0447 0448 /* Struct of timer */ 0449 struct stream_timer { 0450 struct timer_list timer; 0451 struct rpmsg_info *info; 0452 struct snd_pcm_substream *substream; 0453 }; 0454 0455 typedef void (*dma_callback)(void *arg); 0456 0457 /** 0458 * struct rpmsg_info: rpmsg audio information 0459 * 0460 * @rpdev: pointer of rpmsg_device 0461 * @dev: pointer for imx_pcm_rpmsg device 0462 * @cmd_complete: command is finished 0463 * @pm_qos_req: request of pm qos 0464 * @r_msg: received rpmsg 0465 * @msg: array of rpmsg 0466 * @notify: notification msg (type C) for TX & RX 0467 * @notify_updated: notification flag for TX & RX 0468 * @rpmsg_wq: rpmsg workqueue 0469 * @work_list: array of work list for workqueue 0470 * @work_write_index: write index of work list 0471 * @work_read_index: read index of work list 0472 * @msg_drop_count: counter of dropped msg for TX & RX 0473 * @num_period: period number for TX & RX 0474 * @callback_param: parameter for period elapse callback for TX & RX 0475 * @callback: period elapse callback for TX & RX 0476 * @send_message: function pointer for send message 0477 * @lock: spin lock for TX & RX 0478 * @wq_lock: lock for work queue 0479 * @msg_lock: lock for send message 0480 * @stream_timer: timer for tigger workqueue 0481 */ 0482 struct rpmsg_info { 0483 struct rpmsg_device *rpdev; 0484 struct device *dev; 0485 struct completion cmd_complete; 0486 struct pm_qos_request pm_qos_req; 0487 0488 /* Received msg (global) */ 0489 struct rpmsg_r_msg r_msg; 0490 struct rpmsg_msg msg[MSG_MAX_NUM]; 0491 /* period done */ 0492 struct rpmsg_msg notify[2]; 0493 bool notify_updated[2]; 0494 0495 struct workqueue_struct *rpmsg_wq; 0496 struct work_of_rpmsg work_list[WORK_MAX_NUM]; 0497 int work_write_index; 0498 int work_read_index; 0499 int msg_drop_count[2]; 0500 int num_period[2]; 0501 void *callback_param[2]; 0502 dma_callback callback[2]; 0503 int (*send_message)(struct rpmsg_msg *msg, struct rpmsg_info *info); 0504 spinlock_t lock[2]; /* spin lock for resource protection */ 0505 spinlock_t wq_lock; /* spin lock for resource protection */ 0506 struct mutex msg_lock; /* mutex for resource protection */ 0507 struct stream_timer stream_timer[2]; 0508 }; 0509 0510 #define IMX_PCM_DRV_NAME "imx_pcm_rpmsg" 0511 0512 #endif /* IMX_PCM_RPMSG_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |