Skip to content

Commit a406a42

Browse files
committed
ASoC: SOF: ABI: Split ABI headers and update to latest FW ABI.
Copy FW IPC headers to include/sound/sof/. Copy FW userspace ABI headers to include/uapi/sound/sof/. Fix various include guards and comments for kernel. Signed-off-by: Liam Girdwood <[email protected]>
1 parent 57a2bf7 commit a406a42

39 files changed

+1599
-1096
lines changed

include/sound/sof.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <linux/pci.h>
2020
#include <sound/soc.h>
2121
#include <sound/soc-acpi.h>
22-
#include <uapi/sound/sof-ipc.h>
2322

2423
struct snd_sof_dsp_ops;
2524

include/sound/sof/control.h

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note)) OR BSD-3-Clause) */
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. All rights reserved.
7+
*/
8+
9+
#ifndef __INCLUDE_SOUND_SOF_CONTROL_H__
10+
#define __INCLUDE_SOUND_SOF_CONTROL_H__
11+
12+
#include <uapi/sound/sof/header.h>
13+
#include <sound/sof/header.h>
14+
15+
/*
16+
* Component Mixers and Controls
17+
*/
18+
19+
/* channel positions - uses same values as ALSA */
20+
enum sof_ipc_chmap {
21+
SOF_CHMAP_UNKNOWN = 0,
22+
SOF_CHMAP_NA, /**< N/A, silent */
23+
SOF_CHMAP_MONO, /**< mono stream */
24+
SOF_CHMAP_FL, /**< front left */
25+
SOF_CHMAP_FR, /**< front right */
26+
SOF_CHMAP_RL, /**< rear left */
27+
SOF_CHMAP_RR, /**< rear right */
28+
SOF_CHMAP_FC, /**< front centre */
29+
SOF_CHMAP_LFE, /**< LFE */
30+
SOF_CHMAP_SL, /**< side left */
31+
SOF_CHMAP_SR, /**< side right */
32+
SOF_CHMAP_RC, /**< rear centre */
33+
SOF_CHMAP_FLC, /**< front left centre */
34+
SOF_CHMAP_FRC, /**< front right centre */
35+
SOF_CHMAP_RLC, /**< rear left centre */
36+
SOF_CHMAP_RRC, /**< rear right centre */
37+
SOF_CHMAP_FLW, /**< front left wide */
38+
SOF_CHMAP_FRW, /**< front right wide */
39+
SOF_CHMAP_FLH, /**< front left high */
40+
SOF_CHMAP_FCH, /**< front centre high */
41+
SOF_CHMAP_FRH, /**< front right high */
42+
SOF_CHMAP_TC, /**< top centre */
43+
SOF_CHMAP_TFL, /**< top front left */
44+
SOF_CHMAP_TFR, /**< top front right */
45+
SOF_CHMAP_TFC, /**< top front centre */
46+
SOF_CHMAP_TRL, /**< top rear left */
47+
SOF_CHMAP_TRR, /**< top rear right */
48+
SOF_CHMAP_TRC, /**< top rear centre */
49+
SOF_CHMAP_TFLC, /**< top front left centre */
50+
SOF_CHMAP_TFRC, /**< top front right centre */
51+
SOF_CHMAP_TSL, /**< top side left */
52+
SOF_CHMAP_TSR, /**< top side right */
53+
SOF_CHMAP_LLFE, /**< left LFE */
54+
SOF_CHMAP_RLFE, /**< right LFE */
55+
SOF_CHMAP_BC, /**< bottom centre */
56+
SOF_CHMAP_BLC, /**< bottom left centre */
57+
SOF_CHMAP_BRC, /**< bottom right centre */
58+
SOF_CHMAP_LAST = SOF_CHMAP_BRC,
59+
};
60+
61+
/* control data type and direction */
62+
enum sof_ipc_ctrl_type {
63+
/* per channel data - uses struct sof_ipc_ctrl_value_chan */
64+
SOF_CTRL_TYPE_VALUE_CHAN_GET = 0,
65+
SOF_CTRL_TYPE_VALUE_CHAN_SET,
66+
/* component data - uses struct sof_ipc_ctrl_value_comp */
67+
SOF_CTRL_TYPE_VALUE_COMP_GET,
68+
SOF_CTRL_TYPE_VALUE_COMP_SET,
69+
/* bespoke data - struct struct sof_abi_hdr */
70+
SOF_CTRL_TYPE_DATA_GET,
71+
SOF_CTRL_TYPE_DATA_SET,
72+
};
73+
74+
/* control command type */
75+
enum sof_ipc_ctrl_cmd {
76+
SOF_CTRL_CMD_VOLUME = 0, /**< maps to ALSA volume style controls */
77+
SOF_CTRL_CMD_ENUM, /**< maps to ALSA enum style controls */
78+
SOF_CTRL_CMD_SWITCH, /**< maps to ALSA switch style controls */
79+
SOF_CTRL_CMD_BINARY, /**< maps to ALSA binary style controls */
80+
};
81+
82+
/* generic channel mapped value data */
83+
struct sof_ipc_ctrl_value_chan {
84+
uint32_t channel; /**< channel map - enum sof_ipc_chmap */
85+
uint32_t value;
86+
} __packed;
87+
88+
/* generic component mapped value data */
89+
struct sof_ipc_ctrl_value_comp {
90+
uint32_t index; /**< component source/sink/control index in control */
91+
union {
92+
uint32_t uvalue;
93+
int32_t svalue;
94+
};
95+
} __packed;
96+
97+
/* generic control data */
98+
struct sof_ipc_ctrl_data {
99+
struct sof_ipc_reply rhdr;
100+
uint32_t comp_id;
101+
102+
/* control access and data type */
103+
uint32_t type; /**< enum sof_ipc_ctrl_type */
104+
uint32_t cmd; /**< enum sof_ipc_ctrl_cmd */
105+
uint32_t index; /**< control index for comps > 1 control */
106+
107+
/* control data - can either be appended or DMAed from host */
108+
struct sof_ipc_host_buffer buffer;
109+
uint32_t num_elems; /**< in array elems or bytes */
110+
111+
/* reserved for future use */
112+
uint32_t reserved[8];
113+
114+
/* control data - add new types if needed */
115+
union {
116+
/* channel values can be used by volume type controls */
117+
struct sof_ipc_ctrl_value_chan chanv[0];
118+
/* component values used by routing controls like mux, mixer */
119+
struct sof_ipc_ctrl_value_comp compv[0];
120+
/* data can be used by binary controls */
121+
struct sof_abi_hdr data[0];
122+
};
123+
} __packed;
124+
125+
#endif

include/sound/sof/dai-intel.h

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note)) OR BSD-3-Clause) */
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. All rights reserved.
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+
/* ssc1: TINTE */
15+
#define SOF_DAI_INTEL_SSP_QUIRK_TINTE (1 << 0)
16+
/* ssc1: PINTE */
17+
#define SOF_DAI_INTEL_SSP_QUIRK_PINTE (1 << 1)
18+
/* ssc2: SMTATF */
19+
#define SOF_DAI_INTEL_SSP_QUIRK_SMTATF (1 << 2)
20+
/* ssc2: MMRATF */
21+
#define SOF_DAI_INTEL_SSP_QUIRK_MMRATF (1 << 3)
22+
/* ssc2: PSPSTWFDFD */
23+
#define SOF_DAI_INTEL_SSP_QUIRK_PSPSTWFDFD (1 << 4)
24+
/* ssc2: PSPSRWFDFD */
25+
#define SOF_DAI_INTEL_SSP_QUIRK_PSPSRWFDFD (1 << 5)
26+
/* here is the possibility to define others aux macros */
27+
28+
#define SOF_DAI_INTEL_SSP_FRAME_PULSE_WIDTH_MAX 38
29+
#define SOF_DAI_INTEL_SSP_SLOT_PADDING_MAX 31
30+
31+
/* SSP clocks control settings
32+
*
33+
* Macros for clks_control field in sof_ipc_dai_ssp_params struct.
34+
*/
35+
36+
/* mclk 0 disable */
37+
#define SOF_DAI_INTEL_SSP_MCLK_0_DISABLE BIT(0)
38+
/* mclk 1 disable */
39+
#define SOF_DAI_INTEL_SSP_MCLK_1_DISABLE BIT(1)
40+
/* mclk keep active */
41+
#define SOF_DAI_INTEL_SSP_CLKCTRL_MCLK_KA BIT(2)
42+
/* bclk keep active */
43+
#define SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_KA BIT(3)
44+
/* fs keep active */
45+
#define SOF_DAI_INTEL_SSP_CLKCTRL_FS_KA BIT(4)
46+
/* bclk idle */
47+
#define SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_IDLE_HIGH BIT(5)
48+
49+
/* SSP Configuration Request - SOF_IPC_DAI_SSP_CONFIG */
50+
struct sof_ipc_dai_ssp_params {
51+
uint16_t reserved1;
52+
uint16_t mclk_id;
53+
54+
uint32_t mclk_rate; /* mclk frequency in Hz */
55+
uint32_t fsync_rate; /* fsync frequency in Hz */
56+
uint32_t bclk_rate; /* bclk frequency in Hz */
57+
58+
/* TDM */
59+
uint32_t tdm_slots;
60+
uint32_t rx_slots;
61+
uint32_t tx_slots;
62+
63+
/* data */
64+
uint32_t sample_valid_bits;
65+
uint16_t tdm_slot_width;
66+
uint16_t reserved2; /* alignment */
67+
68+
/* MCLK */
69+
uint32_t mclk_direction;
70+
71+
uint16_t frame_pulse_width;
72+
uint16_t tdm_per_slot_padding_flag;
73+
uint32_t clks_control;
74+
uint32_t quirks;
75+
} __packed;
76+
77+
/* HDA Configuration Request - SOF_IPC_DAI_HDA_CONFIG */
78+
struct sof_ipc_dai_hda_params {
79+
struct sof_ipc_hdr hdr;
80+
/* TODO */
81+
} __packed;
82+
83+
/* DMIC Configuration Request - SOF_IPC_DAI_DMIC_CONFIG */
84+
85+
/* This struct is defined per 2ch PDM controller available in the platform.
86+
* Normally it is sufficient to set the used microphone specific enables to 1
87+
* and keep other parameters as zero. The customizations are:
88+
*
89+
* 1. If a device mixes different microphones types with different polarity
90+
* and/or the absolute polarity matters the PCM signal from a microphone
91+
* can be inverted with the controls.
92+
*
93+
* 2. If the microphones in a stereo pair do not appear in captured stream
94+
* in desired order due to board schematics choises they can be swapped with
95+
* the clk_edge parameter.
96+
*
97+
* 3. If PDM bit errors are seen in capture (poor quality) the skew parameter
98+
* that delays the sampling time of data by half cycles of DMIC source clock
99+
* can be tried for improvement. However there is no guarantee for this to fix
100+
* data integrity problems.
101+
*/
102+
struct sof_ipc_dai_dmic_pdm_ctrl {
103+
uint16_t id; /**< PDM controller ID */
104+
105+
uint16_t enable_mic_a; /**< Use A (left) channel mic (0 or 1)*/
106+
uint16_t enable_mic_b; /**< Use B (right) channel mic (0 or 1)*/
107+
108+
uint16_t polarity_mic_a; /**< Optionally invert mic A signal (0 or 1) */
109+
uint16_t polarity_mic_b; /**< Optionally invert mic B signal (0 or 1) */
110+
111+
uint16_t clk_edge; /**< Optionally swap data clock edge (0 or 1) */
112+
uint16_t skew; /**< Adjust PDM data sampling vs. clock (0..15) */
113+
114+
uint16_t reserved[3]; /**< Make sure the total size is 4 bytes aligned */
115+
} __packed;
116+
117+
/* This struct contains the global settings for all 2ch PDM controllers. The
118+
* version number used in configuration data is checked vs. version used by
119+
* device driver src/drivers/dmic.c need to match. It is incremented from
120+
* initial value 1 if updates done for the to driver would alter the operation
121+
* of the microhone.
122+
*
123+
* Note: The microphone clock (pdmclk_min, pdmclk_max, duty_min, duty_max)
124+
* parameters need to be set as defined in microphone data sheet. E.g. clock
125+
* range 1.0 - 3.2 MHz is usually supported microphones. Some microphones are
126+
* multi-mode capable and there may be denied mic clock frequencies between
127+
* the modes. In such case set the clock range limits of the desired mode to
128+
* avoid the driver to set clock to an illegal rate.
129+
*
130+
* The duty cycle could be set to 48-52% if not known. Generally these
131+
* parameters can be altered within data sheet specified limits to match
132+
* required audio application performance power.
133+
*
134+
* The microphone clock needs to be usually about 50-80 times the used audio
135+
* sample rate. With highest sample rates above 48 kHz this can relaxed
136+
* somewhat.
137+
*/
138+
struct sof_ipc_dai_dmic_params {
139+
uint32_t driver_ipc_version; /**< Version (1..N) */
140+
141+
uint32_t pdmclk_min; /**< Minimum microphone clock in Hz (100000..N) */
142+
uint32_t pdmclk_max; /**< Maximum microphone clock in Hz (min...N) */
143+
144+
uint32_t fifo_fs_a; /**< FIFO A sample rate in Hz (8000..96000) */
145+
uint32_t fifo_fs_b; /**< FIFO B sample rate in Hz (8000..96000) */
146+
uint16_t fifo_bits_a; /**< FIFO A word length (16 or 32) */
147+
uint16_t fifo_bits_b; /**< FIFO B word length (16 or 32) */
148+
149+
uint16_t duty_min; /**< Min. mic clock duty cycle in % (20..80) */
150+
uint16_t duty_max; /**< Max. mic clock duty cycle in % (min..80) */
151+
152+
uint32_t num_pdm_active; /**< Number of active pdm controllers */
153+
154+
/* reserved for future use */
155+
uint32_t reserved[8];
156+
157+
/**< variable number of pdm controller config */
158+
struct sof_ipc_dai_dmic_pdm_ctrl pdm[0];
159+
} __packed;
160+
161+
#endif

include/sound/sof/dai.h

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note)) OR BSD-3-Clause) */
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. All rights reserved.
7+
*/
8+
9+
#ifndef __INCLUDE_SOUND_SOF_DAI_H__
10+
#define __INCLUDE_SOUND_SOF_DAI_H__
11+
12+
#include <sound/sof/header.h>
13+
#include <sound/sof/dai-intel.h>
14+
15+
/*
16+
* DAI Configuration.
17+
*
18+
* Each different DAI type will have it's own structure and IPC cmd.
19+
*/
20+
21+
#define SOF_DAI_FMT_I2S 1 /**< I2S mode */
22+
#define SOF_DAI_FMT_RIGHT_J 2 /**< Right Justified mode */
23+
#define SOF_DAI_FMT_LEFT_J 3 /**< Left Justified mode */
24+
#define SOF_DAI_FMT_DSP_A 4 /**< L data MSB after FRM LRC */
25+
#define SOF_DAI_FMT_DSP_B 5 /**< L data MSB during FRM LRC */
26+
#define SOF_DAI_FMT_PDM 6 /**< Pulse density modulation */
27+
28+
#define SOF_DAI_FMT_CONT (1 << 4) /**< continuous clock */
29+
#define SOF_DAI_FMT_GATED (0 << 4) /**< clock is gated */
30+
31+
#define SOF_DAI_FMT_NB_NF (0 << 8) /**< normal bit clock + frame */
32+
#define SOF_DAI_FMT_NB_IF (2 << 8) /**< normal BCLK + inv FRM */
33+
#define SOF_DAI_FMT_IB_NF (3 << 8) /**< invert BCLK + nor FRM */
34+
#define SOF_DAI_FMT_IB_IF (4 << 8) /**< invert BCLK + FRM */
35+
36+
#define SOF_DAI_FMT_CBM_CFM (0 << 12) /**< codec clk & FRM master */
37+
#define SOF_DAI_FMT_CBS_CFM (2 << 12) /**< codec clk slave & FRM master */
38+
#define SOF_DAI_FMT_CBM_CFS (3 << 12) /**< codec clk master & frame slave */
39+
#define SOF_DAI_FMT_CBS_CFS (4 << 12) /**< codec clk & FRM slave */
40+
41+
#define SOF_DAI_FMT_FORMAT_MASK 0x000f
42+
#define SOF_DAI_FMT_CLOCK_MASK 0x00f0
43+
#define SOF_DAI_FMT_INV_MASK 0x0f00
44+
#define SOF_DAI_FMT_MASTER_MASK 0xf000
45+
46+
/** \brief Types of DAI */
47+
enum sof_ipc_dai_type {
48+
SOF_DAI_INTEL_NONE = 0, /**< None */
49+
SOF_DAI_INTEL_SSP, /**< Intel SSP */
50+
SOF_DAI_INTEL_DMIC, /**< Intel DMIC */
51+
SOF_DAI_INTEL_HDA, /**< Intel HD/A */
52+
};
53+
54+
/* general purpose DAI configuration */
55+
struct sof_ipc_dai_config {
56+
struct sof_ipc_hdr hdr;
57+
uint32_t type; /**< DAI type - enum sof_ipc_dai_type */
58+
uint32_t dai_index; /**< index of this type dai */
59+
60+
/* physical protocol and clocking */
61+
uint16_t format; /**< SOF_DAI_FMT_ */
62+
uint16_t reserved16; /**< alignment */
63+
64+
/* reserved for future use */
65+
uint32_t reserved[8];
66+
67+
/* HW specific data */
68+
union {
69+
struct sof_ipc_dai_ssp_params ssp;
70+
struct sof_ipc_dai_dmic_params dmic;
71+
struct sof_ipc_dai_hda_params hda;
72+
};
73+
} __packed;
74+
75+
#endif

0 commit comments

Comments
 (0)