| 1 |
|
| 2 | |
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or
|
| 4 | * redistributing this file, you may do so under either license.
|
| 5 | *
|
| 6 | * Copyright(c) 2018 Intel Corporation
|
| 7 |
|
| 8 |
|
| 9 | #ifndef __INCLUDE_SOUND_SOF_DAI_INTEL_H__
|
| 10 | #define __INCLUDE_SOUND_SOF_DAI_INTEL_H__
|
| 11 |
|
| 12 | #include <sound/sof/header.h>
|
| 13 |
|
| 14 |
|
| 15 | #define SOF_DAI_INTEL_SSP_QUIRK_TINTE (1 << 0)
|
| 16 |
|
| 17 | #define SOF_DAI_INTEL_SSP_QUIRK_PINTE (1 << 1)
|
| 18 |
|
| 19 | #define SOF_DAI_INTEL_SSP_QUIRK_SMTATF (1 << 2)
|
| 20 |
|
| 21 | #define SOF_DAI_INTEL_SSP_QUIRK_MMRATF (1 << 3)
|
| 22 |
|
| 23 | #define SOF_DAI_INTEL_SSP_QUIRK_PSPSTWFDFD (1 << 4)
|
| 24 |
|
| 25 | #define SOF_DAI_INTEL_SSP_QUIRK_PSPSRWFDFD (1 << 5)
|
| 26 |
|
| 27 | #define SOF_DAI_INTEL_SSP_QUIRK_LBM (1 << 6)
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 | #define SOF_DAI_INTEL_SSP_FRAME_PULSE_WIDTH_MAX 38
|
| 32 | #define SOF_DAI_INTEL_SSP_SLOT_PADDING_MAX 31
|
| 33 |
|
| 34 | |
| 35 | *
|
| 36 | * Macros for clks_control field in sof_ipc_dai_ssp_params struct.
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 | #define SOF_DAI_INTEL_SSP_MCLK_0_DISABLE BIT(0)
|
| 41 |
|
| 42 | #define SOF_DAI_INTEL_SSP_MCLK_1_DISABLE BIT(1)
|
| 43 |
|
| 44 | #define SOF_DAI_INTEL_SSP_CLKCTRL_MCLK_KA BIT(2)
|
| 45 |
|
| 46 | #define SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_KA BIT(3)
|
| 47 |
|
| 48 | #define SOF_DAI_INTEL_SSP_CLKCTRL_FS_KA BIT(4)
|
| 49 |
|
| 50 | #define SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_IDLE_HIGH BIT(5)
|
| 51 |
|
| 52 | #define SOF_DAI_INTEL_SSP_CLKCTRL_MCLK_ES BIT(6)
|
| 53 |
|
| 54 | #define SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_ES BIT(7)
|
| 55 |
|
| 56 | #define SOF_DAI_INTEL_SSP_CLKCTRL_MCLK_AON BIT(8)
|
| 57 |
|
| 58 |
|
| 59 | #define SOF_DAI_INTEL_DMIC_NUM_CTRL 4
|
| 60 |
|
| 61 |
|
| 62 | struct sof_ipc_dai_ssp_params {
|
| 63 | struct sof_ipc_hdr hdr;
|
| 64 | uint16_t reserved1;
|
| 65 | uint16_t mclk_id;
|
| 66 |
|
| 67 | uint32_t mclk_rate;
|
| 68 | uint32_t fsync_rate;
|
| 69 | uint32_t bclk_rate;
|
| 70 |
|
| 71 |
|
| 72 | uint32_t tdm_slots;
|
| 73 | uint32_t rx_slots;
|
| 74 | uint32_t tx_slots;
|
| 75 |
|
| 76 |
|
| 77 | uint32_t sample_valid_bits;
|
| 78 | uint16_t tdm_slot_width;
|
| 79 | uint16_t reserved2;
|
| 80 |
|
| 81 |
|
| 82 | uint32_t mclk_direction;
|
| 83 |
|
| 84 | uint16_t frame_pulse_width;
|
| 85 | uint16_t tdm_per_slot_padding_flag;
|
| 86 | uint32_t clks_control;
|
| 87 | uint32_t quirks;
|
| 88 | uint32_t bclk_delay; |
| 89 | * will be driven, before sending data
|
| 90 |
|
| 91 | } __packed;
|
| 92 |
|
| 93 |
|
| 94 | struct sof_ipc_dai_hda_params {
|
| 95 | struct sof_ipc_hdr hdr;
|
| 96 | uint32_t link_dma_ch;
|
| 97 | uint32_t rate;
|
| 98 | uint32_t channels;
|
| 99 | } __packed;
|
| 100 |
|
| 101 |
|
| 102 | struct sof_ipc_dai_alh_params {
|
| 103 | struct sof_ipc_hdr hdr;
|
| 104 | uint32_t stream_id;
|
| 105 | uint32_t rate;
|
| 106 | uint32_t channels;
|
| 107 |
|
| 108 |
|
| 109 | uint32_t reserved[13];
|
| 110 | } __packed;
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 | |
| 115 | * Normally it is sufficient to set the used microphone specific enables to 1
|
| 116 | * and keep other parameters as zero. The customizations are:
|
| 117 | *
|
| 118 | * 1. If a device mixes different microphones types with different polarity
|
| 119 | * and/or the absolute polarity matters the PCM signal from a microphone
|
| 120 | * can be inverted with the controls.
|
| 121 | *
|
| 122 | * 2. If the microphones in a stereo pair do not appear in captured stream
|
| 123 | * in desired order due to board schematics choises they can be swapped with
|
| 124 | * the clk_edge parameter.
|
| 125 | *
|
| 126 | * 3. If PDM bit errors are seen in capture (poor quality) the skew parameter
|
| 127 | * that delays the sampling time of data by half cycles of DMIC source clock
|
| 128 | * can be tried for improvement. However there is no guarantee for this to fix
|
| 129 | * data integrity problems.
|
| 130 |
|
| 131 | struct sof_ipc_dai_dmic_pdm_ctrl {
|
| 132 | struct sof_ipc_hdr hdr;
|
| 133 | uint16_t id;
|
| 134 |
|
| 135 | uint16_t enable_mic_a;
|
| 136 | uint16_t enable_mic_b;
|
| 137 |
|
| 138 | uint16_t polarity_mic_a;
|
| 139 | uint16_t polarity_mic_b;
|
| 140 |
|
| 141 | uint16_t clk_edge;
|
| 142 | uint16_t skew;
|
| 143 |
|
| 144 | uint16_t reserved[3];
|
| 145 | } __packed;
|
| 146 |
|
| 147 | |
| 148 | * version number used in configuration data is checked vs. version used by
|
| 149 | * device driver src/drivers/dmic.c need to match. It is incremented from
|
| 150 | * initial value 1 if updates done for the to driver would alter the operation
|
| 151 | * of the microphone.
|
| 152 | *
|
| 153 | * Note: The microphone clock (pdmclk_min, pdmclk_max, duty_min, duty_max)
|
| 154 | * parameters need to be set as defined in microphone data sheet. E.g. clock
|
| 155 | * range 1.0 - 3.2 MHz is usually supported microphones. Some microphones are
|
| 156 | * multi-mode capable and there may be denied mic clock frequencies between
|
| 157 | * the modes. In such case set the clock range limits of the desired mode to
|
| 158 | * avoid the driver to set clock to an illegal rate.
|
| 159 | *
|
| 160 | * The duty cycle could be set to 48-52% if not known. Generally these
|
| 161 | * parameters can be altered within data sheet specified limits to match
|
| 162 | * required audio application performance power.
|
| 163 | *
|
| 164 | * The microphone clock needs to be usually about 50-80 times the used audio
|
| 165 | * sample rate. With highest sample rates above 48 kHz this can relaxed
|
| 166 | * somewhat.
|
| 167 | *
|
| 168 | * The parameter wake_up_time describes how long time the microphone needs
|
| 169 | * for the data line to produce valid output from mic clock start. The driver
|
| 170 | * will mute the captured audio for the given time. The min_clock_on_time
|
| 171 | * parameter is used to prevent too short clock bursts to happen. The driver
|
| 172 | * will keep the clock active after capture stop if this time is not yet
|
| 173 | * met. The unit for both is microseconds (us). Exceed of 100 ms will be
|
| 174 | * treated as an error.
|
| 175 |
|
| 176 | struct sof_ipc_dai_dmic_params {
|
| 177 | struct sof_ipc_hdr hdr;
|
| 178 | uint32_t driver_ipc_version;
|
| 179 |
|
| 180 | uint32_t pdmclk_min;
|
| 181 | uint32_t pdmclk_max;
|
| 182 |
|
| 183 | uint32_t fifo_fs;
|
| 184 | uint32_t reserved_1;
|
| 185 | uint16_t fifo_bits;
|
| 186 | uint16_t fifo_bits_b;
|
| 187 |
|
| 188 | uint16_t duty_min;
|
| 189 | uint16_t duty_max;
|
| 190 |
|
| 191 | uint32_t num_pdm_active;
|
| 192 |
|
| 193 |
|
| 194 | uint32_t wake_up_time;
|
| 195 | uint32_t min_clock_on_time;
|
| 196 | uint32_t unmute_ramp_time;
|
| 197 |
|
| 198 |
|
| 199 | uint32_t reserved[5];
|
| 200 |
|
| 201 |
|
| 202 | struct sof_ipc_dai_dmic_pdm_ctrl pdm[SOF_DAI_INTEL_DMIC_NUM_CTRL];
|
| 203 | } __packed;
|
| 204 |
|
| 205 | #endif
|