Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: BSD-3-Clause */
0002 /*
0003  * Copyright (c) 2015-2016 Google Inc.
0004  */
0005 /*
0006  * This is a special protocol for configuring communication over the
0007  * I2S bus between the DSP on the MSM8994 and APBridgeA.  Therefore,
0008  * we can predefine several low-level attributes of the communication
0009  * because we know that they are supported.  In particular, the following
0010  * assumptions are made:
0011  *  - there are two channels (i.e., stereo)
0012  *  - the low-level protocol is I2S as defined by Philips/NXP
0013  *  - the DSP on the MSM8994 is the clock master for MCLK, BCLK, and WCLK
0014  *  - WCLK changes on the falling edge of BCLK
0015  *  - WCLK low for left channel; high for right channel
0016  *  - TX data is sent on the falling edge of BCLK
0017  *  - RX data is received/latched on the rising edge of BCLK
0018  */
0019 
0020 #ifndef __AUDIO_APBRIDGEA_H
0021 #define __AUDIO_APBRIDGEA_H
0022 
0023 #define AUDIO_APBRIDGEA_TYPE_SET_CONFIG         0x01
0024 #define AUDIO_APBRIDGEA_TYPE_REGISTER_CPORT     0x02
0025 #define AUDIO_APBRIDGEA_TYPE_UNREGISTER_CPORT       0x03
0026 #define AUDIO_APBRIDGEA_TYPE_SET_TX_DATA_SIZE       0x04
0027                             /* 0x05 unused */
0028 #define AUDIO_APBRIDGEA_TYPE_PREPARE_TX         0x06
0029 #define AUDIO_APBRIDGEA_TYPE_START_TX           0x07
0030 #define AUDIO_APBRIDGEA_TYPE_STOP_TX            0x08
0031 #define AUDIO_APBRIDGEA_TYPE_SHUTDOWN_TX        0x09
0032 #define AUDIO_APBRIDGEA_TYPE_SET_RX_DATA_SIZE       0x0a
0033                             /* 0x0b unused */
0034 #define AUDIO_APBRIDGEA_TYPE_PREPARE_RX         0x0c
0035 #define AUDIO_APBRIDGEA_TYPE_START_RX           0x0d
0036 #define AUDIO_APBRIDGEA_TYPE_STOP_RX            0x0e
0037 #define AUDIO_APBRIDGEA_TYPE_SHUTDOWN_RX        0x0f
0038 
0039 #define AUDIO_APBRIDGEA_PCM_FMT_8           BIT(0)
0040 #define AUDIO_APBRIDGEA_PCM_FMT_16          BIT(1)
0041 #define AUDIO_APBRIDGEA_PCM_FMT_24          BIT(2)
0042 #define AUDIO_APBRIDGEA_PCM_FMT_32          BIT(3)
0043 #define AUDIO_APBRIDGEA_PCM_FMT_64          BIT(4)
0044 
0045 #define AUDIO_APBRIDGEA_PCM_RATE_5512           BIT(0)
0046 #define AUDIO_APBRIDGEA_PCM_RATE_8000           BIT(1)
0047 #define AUDIO_APBRIDGEA_PCM_RATE_11025          BIT(2)
0048 #define AUDIO_APBRIDGEA_PCM_RATE_16000          BIT(3)
0049 #define AUDIO_APBRIDGEA_PCM_RATE_22050          BIT(4)
0050 #define AUDIO_APBRIDGEA_PCM_RATE_32000          BIT(5)
0051 #define AUDIO_APBRIDGEA_PCM_RATE_44100          BIT(6)
0052 #define AUDIO_APBRIDGEA_PCM_RATE_48000          BIT(7)
0053 #define AUDIO_APBRIDGEA_PCM_RATE_64000          BIT(8)
0054 #define AUDIO_APBRIDGEA_PCM_RATE_88200          BIT(9)
0055 #define AUDIO_APBRIDGEA_PCM_RATE_96000          BIT(10)
0056 #define AUDIO_APBRIDGEA_PCM_RATE_176400         BIT(11)
0057 #define AUDIO_APBRIDGEA_PCM_RATE_192000         BIT(12)
0058 
0059 #define AUDIO_APBRIDGEA_DIRECTION_TX            BIT(0)
0060 #define AUDIO_APBRIDGEA_DIRECTION_RX            BIT(1)
0061 
0062 /* The I2S port is passed in the 'index' parameter of the USB request */
0063 /* The CPort is passed in the 'value' parameter of the USB request */
0064 
0065 struct audio_apbridgea_hdr {
0066     __u8    type;
0067     __le16  i2s_port;
0068     __u8    data[];
0069 } __packed;
0070 
0071 struct audio_apbridgea_set_config_request {
0072     struct audio_apbridgea_hdr  hdr;
0073     __le32              format; /* AUDIO_APBRIDGEA_PCM_FMT_* */
0074     __le32              rate;   /* AUDIO_APBRIDGEA_PCM_RATE_* */
0075     __le32              mclk_freq; /* XXX Remove? */
0076 } __packed;
0077 
0078 struct audio_apbridgea_register_cport_request {
0079     struct audio_apbridgea_hdr  hdr;
0080     __le16              cport;
0081     __u8                direction;
0082 } __packed;
0083 
0084 struct audio_apbridgea_unregister_cport_request {
0085     struct audio_apbridgea_hdr  hdr;
0086     __le16              cport;
0087     __u8                direction;
0088 } __packed;
0089 
0090 struct audio_apbridgea_set_tx_data_size_request {
0091     struct audio_apbridgea_hdr  hdr;
0092     __le16              size;
0093 } __packed;
0094 
0095 struct audio_apbridgea_prepare_tx_request {
0096     struct audio_apbridgea_hdr  hdr;
0097 } __packed;
0098 
0099 struct audio_apbridgea_start_tx_request {
0100     struct audio_apbridgea_hdr  hdr;
0101     __le64              timestamp;
0102 } __packed;
0103 
0104 struct audio_apbridgea_stop_tx_request {
0105     struct audio_apbridgea_hdr  hdr;
0106 } __packed;
0107 
0108 struct audio_apbridgea_shutdown_tx_request {
0109     struct audio_apbridgea_hdr  hdr;
0110 } __packed;
0111 
0112 struct audio_apbridgea_set_rx_data_size_request {
0113     struct audio_apbridgea_hdr  hdr;
0114     __le16              size;
0115 } __packed;
0116 
0117 struct audio_apbridgea_prepare_rx_request {
0118     struct audio_apbridgea_hdr  hdr;
0119 } __packed;
0120 
0121 struct audio_apbridgea_start_rx_request {
0122     struct audio_apbridgea_hdr  hdr;
0123 } __packed;
0124 
0125 struct audio_apbridgea_stop_rx_request {
0126     struct audio_apbridgea_hdr  hdr;
0127 } __packed;
0128 
0129 struct audio_apbridgea_shutdown_rx_request {
0130     struct audio_apbridgea_hdr  hdr;
0131 } __packed;
0132 
0133 #endif /*__AUDIO_APBRIDGEA_H */