Pierre-Louis Bossart | e149ca2 | 2020-05-01 09:58:50 -0500 | [diff] [blame] | 1 | /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 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> |
Daniel Baluta | b4be427 | 2019-10-08 11:44:39 -0500 | [diff] [blame] | 14 | #include <sound/sof/dai-imx.h> |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 15 | |
| 16 | /* |
| 17 | * DAI Configuration. |
| 18 | * |
| 19 | * Each different DAI type will have it's own structure and IPC cmd. |
| 20 | */ |
| 21 | |
| 22 | #define SOF_DAI_FMT_I2S 1 /**< I2S mode */ |
| 23 | #define SOF_DAI_FMT_RIGHT_J 2 /**< Right Justified mode */ |
| 24 | #define SOF_DAI_FMT_LEFT_J 3 /**< Left Justified mode */ |
| 25 | #define SOF_DAI_FMT_DSP_A 4 /**< L data MSB after FRM LRC */ |
| 26 | #define SOF_DAI_FMT_DSP_B 5 /**< L data MSB during FRM LRC */ |
| 27 | #define SOF_DAI_FMT_PDM 6 /**< Pulse density modulation */ |
| 28 | |
| 29 | #define SOF_DAI_FMT_CONT (1 << 4) /**< continuous clock */ |
| 30 | #define SOF_DAI_FMT_GATED (0 << 4) /**< clock is gated */ |
| 31 | |
| 32 | #define SOF_DAI_FMT_NB_NF (0 << 8) /**< normal bit clock + frame */ |
| 33 | #define SOF_DAI_FMT_NB_IF (2 << 8) /**< normal BCLK + inv FRM */ |
| 34 | #define SOF_DAI_FMT_IB_NF (3 << 8) /**< invert BCLK + nor FRM */ |
| 35 | #define SOF_DAI_FMT_IB_IF (4 << 8) /**< invert BCLK + FRM */ |
| 36 | |
Pierre-Louis Bossart | df132fa | 2020-11-12 10:30:58 -0600 | [diff] [blame] | 37 | #define SOF_DAI_FMT_CBP_CFP (0 << 12) /**< codec bclk provider & frame provider */ |
| 38 | #define SOF_DAI_FMT_CBC_CFP (2 << 12) /**< codec bclk consumer & frame provider */ |
| 39 | #define SOF_DAI_FMT_CBP_CFC (3 << 12) /**< codec bclk provider & frame consumer */ |
| 40 | #define SOF_DAI_FMT_CBC_CFC (4 << 12) /**< codec bclk consumer & frame consumer */ |
| 41 | |
| 42 | /* keep old definitions for backwards compatibility */ |
| 43 | #define SOF_DAI_FMT_CBM_CFM SOF_DAI_FMT_CBP_CFP |
| 44 | #define SOF_DAI_FMT_CBS_CFM SOF_DAI_FMT_CBC_CFP |
| 45 | #define SOF_DAI_FMT_CBM_CFS SOF_DAI_FMT_CBP_CFC |
| 46 | #define SOF_DAI_FMT_CBS_CFS SOF_DAI_FMT_CBC_CFC |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 47 | |
| 48 | #define SOF_DAI_FMT_FORMAT_MASK 0x000f |
| 49 | #define SOF_DAI_FMT_CLOCK_MASK 0x00f0 |
| 50 | #define SOF_DAI_FMT_INV_MASK 0x0f00 |
Pierre-Louis Bossart | df132fa | 2020-11-12 10:30:58 -0600 | [diff] [blame] | 51 | #define SOF_DAI_FMT_CLOCK_PROVIDER_MASK 0xf000 |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 52 | |
Pierre-Louis Bossart | 21c5169 | 2021-10-04 12:14:27 -0500 | [diff] [blame] | 53 | /* DAI_CONFIG flags */ |
| 54 | #define SOF_DAI_CONFIG_FLAGS_MASK 0x3 |
| 55 | #define SOF_DAI_CONFIG_FLAGS_NONE (0 << 0) /**< DAI_CONFIG sent without stage information */ |
| 56 | #define SOF_DAI_CONFIG_FLAGS_HW_PARAMS (1 << 0) /**< DAI_CONFIG sent during hw_params stage */ |
| 57 | #define SOF_DAI_CONFIG_FLAGS_HW_FREE (2 << 0) /**< DAI_CONFIG sent during hw_free stage */ |
| 58 | #define SOF_DAI_CONFIG_FLAGS_RFU (3 << 0) /**< not used, reserved for future use */ |
| 59 | |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 60 | /** \brief Types of DAI */ |
| 61 | enum sof_ipc_dai_type { |
| 62 | SOF_DAI_INTEL_NONE = 0, /**< None */ |
| 63 | SOF_DAI_INTEL_SSP, /**< Intel SSP */ |
| 64 | SOF_DAI_INTEL_DMIC, /**< Intel DMIC */ |
| 65 | SOF_DAI_INTEL_HDA, /**< Intel HD/A */ |
Bard liao | 8207a1c | 2019-08-15 14:20:16 -0500 | [diff] [blame] | 66 | SOF_DAI_INTEL_ALH, /**< Intel ALH */ |
Daniel Baluta | f59b16e | 2019-08-15 14:20:15 -0500 | [diff] [blame] | 67 | SOF_DAI_IMX_SAI, /**< i.MX SAI */ |
| 68 | SOF_DAI_IMX_ESAI, /**< i.MX ESAI */ |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | /* general purpose DAI configuration */ |
| 72 | struct sof_ipc_dai_config { |
| 73 | struct sof_ipc_cmd_hdr hdr; |
| 74 | uint32_t type; /**< DAI type - enum sof_ipc_dai_type */ |
| 75 | uint32_t dai_index; /**< index of this type dai */ |
| 76 | |
| 77 | /* physical protocol and clocking */ |
| 78 | uint16_t format; /**< SOF_DAI_FMT_ */ |
Pierre-Louis Bossart | 6637423 | 2021-10-04 12:14:26 -0500 | [diff] [blame] | 79 | uint8_t group_id; /**< group ID, 0 means no group (ABI 3.17) */ |
Pierre-Louis Bossart | 21c5169 | 2021-10-04 12:14:27 -0500 | [diff] [blame] | 80 | uint8_t flags; /**< SOF_DAI_CONFIG_FLAGS_ (ABI 3.19) */ |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 81 | |
| 82 | /* reserved for future use */ |
| 83 | uint32_t reserved[8]; |
| 84 | |
| 85 | /* HW specific data */ |
| 86 | union { |
| 87 | struct sof_ipc_dai_ssp_params ssp; |
| 88 | struct sof_ipc_dai_dmic_params dmic; |
| 89 | struct sof_ipc_dai_hda_params hda; |
Pierre-Louis Bossart | 3a9477a | 2019-08-15 10:50:30 -0500 | [diff] [blame] | 90 | struct sof_ipc_dai_alh_params alh; |
Daniel Baluta | b4be427 | 2019-10-08 11:44:39 -0500 | [diff] [blame] | 91 | struct sof_ipc_dai_esai_params esai; |
Guido Roncarolo | 9c1d4cf | 2019-12-17 18:26:15 -0600 | [diff] [blame] | 92 | struct sof_ipc_dai_sai_params sai; |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 93 | }; |
| 94 | } __packed; |
| 95 | |
| 96 | #endif |