summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_rpmsg_i2s.h
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2018-03-06 12:45:22 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:52:57 +0800
commitc98b293c40824f4de4430ed40ee42ceb79e11f4d (patch)
tree5e2959afac609525ea6a52aef189b1716ad440fe /sound/soc/fsl/fsl_rpmsg_i2s.h
parent53039092deebd9a22686c1ae5a02e0290652a677 (diff)
MLK-17156-3: ASoC: fs_rpmsg_i2s: update the protocol for i2c message
rpmsg provide command for A7 side to set the codec value and get codec value by i2c. In this case, the A7 can control the codec. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Diffstat (limited to 'sound/soc/fsl/fsl_rpmsg_i2s.h')
-rw-r--r--sound/soc/fsl/fsl_rpmsg_i2s.h129
1 files changed, 109 insertions, 20 deletions
diff --git a/sound/soc/fsl/fsl_rpmsg_i2s.h b/sound/soc/fsl/fsl_rpmsg_i2s.h
index be951e91df29..cbb984e07999 100644
--- a/sound/soc/fsl/fsl_rpmsg_i2s.h
+++ b/sound/soc/fsl/fsl_rpmsg_i2s.h
@@ -88,24 +88,75 @@
* | 0x03 | 0x0100 | 0x00 | 0x05 | Data[0]: Audio Device Index | Close an Audio TX Instance. |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
* | 0x03 | 0x0100 | 0x00 | 0x06 | Data[0]: Audio Device Index | Set Parameters for an Audio TX Instance. |
+ * | | | | | Data[1]: format | |
+ * | | | | | Data[2]: channels | |
+ * | | | | | Data[3-6]: samplerate | |
+ * | | | | | Data[7-22]: reserved | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
* | 0x03 | 0x0100 | 0x00 | 0x07 | Data[0]: Audio Device Index | Set Audio TX Buffer. |
+ * | | | | | Data[1-6]: reserved | |
+ * | | | | | Data[7-10]: buffer_addr | |
+ * | | | | | Data[11-14]: buffer_size | |
+ * | | | | | Data[15-18]: period_size | |
+ * | | | | | Data[19-22]: buffer_tail | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x00 | 0x08 | Data[0]: Audio Device Index | Open an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x00 | 0x08 | Data[0]: Audio Device Index | Suspend an Audio TX Instance. |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x00 | 0x09 | Data[0]: Audio Device Index | Start an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x00 | 0x09 | Data[0]: Audio Device Index | Resume an Audio TX Instance. |
+ * | | | | | Data[1]: format | |
+ * | | | | | Data[2]: channels | |
+ * | | | | | Data[3-6]: samplerate | |
+ * | | | | | Data[7-10]: buffer_addr | |
+ * | | | | | Data[11-14]: buffer_size | |
+ * | | | | | Data[15-18]: period_size | |
+ * | | | | | Data[19-22]: buffer_tail | |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x00 | 0x0A | Data[0]: Audio Device Index | Open an Audio RX Instance. |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x00 | 0x0B | Data[0]: Audio Device Index | Start an Audio RX Instance. |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x00 | 0x0A | Data[0]: Audio Device Index | Pause an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x00 | 0x0C | Data[0]: Audio Device Index | Pause an Audio RX Instance. |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x00 | 0x0B | Data[0]: Audio Device Index | Resume an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x00 | 0x0D | Data[0]: Audio Device Index | Resume an Audio RX Instance. |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x00 | 0x0C | Data[0]: Audio Device Index | Terminate an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x00 | 0x0E | Data[0]: Audio Device Index | Terminate an Audio RX Instance. |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x00 | 0x0D | Data[0]: Audio Device Index | Close an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x00 | 0x0F | Data[0]: Audio Device Index | Close an Audio RX Instance. |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x00 | 0x10 | Data[0]: Audio Device Index | Set Parameters for an Audio RX Instance. |
+ * | | | | | Data[1]: format | |
+ * | | | | | Data[2]: channels | |
+ * | | | | | Data[3-6]: samplerate | |
+ * | | | | | Data[7-22]: reserved | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x00 | 0x0E | Data[0]: Audio Device Index | Set Parameters for an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x00 | 0x11 | Data[0]: Audio Device Index | Set Audio RX Buffer. |
+ * | | | | | Data[1-6]: reserved | |
+ * | | | | | Data[7-10]: buffer_addr | |
+ * | | | | | Data[11-14]: buffer_size | |
+ * | | | | | Data[15-18]: period_size | |
+ * | | | | | Data[19-22]: buffer_tail | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x00 | 0x0F | Data[0]: Audio Device Index | Set Audio RX Buffer. |
+ * | 0x03 | 0x0100 | 0x00 | 0x12 | Data[0]: Audio Device Index | Suspend an Audio RX Instance. |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x00 | 0x13 | Data[0]: Audio Device Index | Resume an Audio RX Instance. |
+ * | | | | | Data[1]: format | |
+ * | | | | | Data[2]: channels | |
+ * | | | | | Data[3-6]: samplerate | |
+ * | | | | | Data[7-10]: buffer_addr | |
+ * | | | | | Data[11-14]: buffer_size | |
+ * | | | | | Data[15-18]: period_size | |
+ * | | | | | Data[19-22]: buffer_tail | |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x00 | 0x14 | Data[0]: Audio Device Index | Set register value to codec. |
+ * | | | | | Data[1-6]: reserved | |
+ * | | | | | Data[7-10]: register | |
+ * | | | | | Data[11-14]: value | |
+ * | | | | | Data[15-22]: reserved | |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x00 | 0x15 | Data[0]: Audio Device Index | Get register value from codec. |
+ * | | | | | Data[1-6]: reserved | |
+ * | | | | | Data[7-10]: register | |
+ * | | | | | Data[11-22]: reserved | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
* Note 1: See <List of Sample Format> for available value of
* Sample Format;
@@ -142,29 +193,51 @@
* | 0x03 | 0x0100 | 0x01 | 0x07 | Data[0]: Audio Device Index | Reply for Set Audio TX Buffer. |
* | | | | | Data[1]: Return code | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x01 | 0x08 | Data[0]: Audio Device Index | Reply for Open an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x01 | 0x08 | Data[0]: Audio Device Index | Reply for Suspend an Audio TX Instance. |
+ * | | | | | Data[1]: Return code | |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x01 | 0x09 | Data[0]: Audio Device Index | Reply for Resume an Audio TX Instance. |
+ * | | | | | Data[1]: Return code | |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x01 | 0x0A | Data[0]: Audio Device Index | Reply for Open an Audio RX Instance. |
* | | | | | Data[1]: Return code | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x01 | 0x09 | Data[0]: Audio Device Index | Reply for Start an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x01 | 0x0B | Data[0]: Audio Device Index | Reply for Start an Audio RX Instance. |
* | | | | | Data[1]: Return code | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x01 | 0x0A | Data[0]: Audio Device Index | Reply for Pause an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x01 | 0x0C | Data[0]: Audio Device Index | Reply for Pause an Audio RX Instance. |
* | | | | | Data[1]: Return code | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x01 | 0x0B | Data[0]: Audio Device Index | Reply for Resume an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x01 | 0x0D | Data[0]: Audio Device Index | Reply for Resume an Audio RX Instance. |
* | | | | | Data[1]: Return code | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x01 | 0x0C | Data[0]: Audio Device Index | Reply for Terminate an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x01 | 0x0E | Data[0]: Audio Device Index | Reply for Terminate an Audio RX Instance. |
* | | | | | Data[1]: Return code | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x01 | 0x0D | Data[0]: Audio Device Index | Reply for Close an Audio RX Instance. |
+ * | 0x03 | 0x0100 | 0x01 | 0x0F | Data[0]: Audio Device Index | Reply for Close an Audio RX Instance. |
* | | | | | Data[1]: Return code | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x01 | 0x0E | Data[0]: Audio Device Index | Reply for Set Parameters for an Audio |
+ * | 0x03 | 0x0100 | 0x01 | 0x10 | Data[0]: Audio Device Index | Reply for Set Parameters for an Audio |
* | | | | | Data[1]: Return code | RX Instance. |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
- * | 0x03 | 0x0100 | 0x01 | 0x0F | Data[0]: Audio Device Index | Reply for Set Audio RX Buffer. |
+ * | 0x03 | 0x0100 | 0x01 | 0x11 | Data[0]: Audio Device Index | Reply for Set Audio RX Buffer. |
+ * | | | | | Data[1]: Return code | |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x01 | 0x12 | Data[0]: Audio Device Index | Reply for Supend an Audio RX Instance. |
+ * | | | | | Data[1]: Return code | |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x01 | 0x13 | Data[0]: Audio Device Index | Reply for Resume an Audio RX Instance. |
+ * | | | | | Data[1]: Return code | |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x01 | 0x14 | Data[0]: Audio Device Index | Reply for Set codec register value. |
+ * | | | | | Data[1]: Return code | |
+ * +------------+---------+------+---------+-------------------------------+------------------------------------------------+
+ * | 0x03 | 0x0100 | 0x01 | 0x15 | Data[0]: Audio Device Index | Reply for Get codec register value. |
* | | | | | Data[1]: Return code | |
+ * | | | | | Data[2-6]: reserved | |
+ * | | | | | Data[7-10]: register | |
+ * | | | | | Data[11-14]: value | |
+ * | | | | | Data[15-22]: reserved | |
* +------------+---------+------+---------+-------------------------------+------------------------------------------------+
*
* SRTM Audio Control Category Notification Command Table:
@@ -229,7 +302,9 @@
#define I2S_RX_BUFFER 0x11
#define I2S_RX_SUSPEND 0x12
#define I2S_RX_RESUME 0x13
-#define WORK_MAX_NUM 0x14
+#define SET_CODEC_VALUE 0x14
+#define GET_CODEC_VALUE 0x15
+#define WORK_MAX_NUM 0x16
#define I2S_TX_PERIOD_DONE 0x0
#define I2S_RX_PERIOD_DONE 0x1
@@ -255,8 +330,8 @@ struct i2s_param_s {
unsigned char format;
unsigned char channels;
unsigned int rate;
- unsigned int buffer_addr;
- unsigned int buffer_size;
+ unsigned int buffer_addr; /* Register for SET_CODEC_VALUE*/
+ unsigned int buffer_size; /* register value for SET_CODEC_VALUE*/
unsigned int period_size;
unsigned int buffer_tail;
} __packed;
@@ -264,6 +339,10 @@ struct i2s_param_s {
struct i2s_param_r {
unsigned char audioindex;
unsigned char resp;
+ unsigned char reserved1[5];
+ unsigned int reg_addr;
+ unsigned int reg_data;
+ unsigned char reserved2[8];
} __packed;
/* struct of send message */
@@ -285,6 +364,13 @@ struct work_of_rpmsg {
struct work_struct work;
};
+enum {
+ RPMSG_AUDIO_TX = 0,
+ RPMSG_AUDIO_RX = 1,
+ RPMSG_AUDIO_I2C = 2,
+ RPMSG_AUDIO_NUM = 3,
+};
+
typedef void (*dma_callback)(void *arg);
struct i2s_info {
struct rpmsg_device *rpdev;
@@ -293,7 +379,7 @@ struct i2s_info {
/* received msg */
struct i2s_rpmsg_r recv_msg;
/* backup sent msg */
- struct i2s_rpmsg_s send_msg[2];
+ struct i2s_rpmsg_s send_msg[RPMSG_AUDIO_NUM];
struct workqueue_struct *rpmsg_wq;
struct work_of_rpmsg work_list[WORK_MAX_NUM];
@@ -304,6 +390,7 @@ struct i2s_info {
dma_callback callback[2];
spinlock_t lock[2];
struct mutex tx_lock;
+ struct mutex i2c_lock;
};
struct fsl_rpmsg_i2s {
@@ -312,4 +399,6 @@ struct fsl_rpmsg_i2s {
struct pm_qos_request pm_qos_req;
};
+#define RPMSG_CODEC_DRV_NAME "rpmsg-audio-codec"
+
#endif /* __FSL_RPMSG_I2S_H */