Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 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 */ |
Pan Xiuli | ca6c6f1 | 2019-06-03 11:18:14 -0500 | [diff] [blame] | 52 | SOF_DAI_INTEL_SOUNDWIRE, /**< Intel SoundWire */ |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | /* general purpose DAI configuration */ |
| 56 | struct sof_ipc_dai_config { |
| 57 | struct sof_ipc_cmd_hdr hdr; |
| 58 | uint32_t type; /**< DAI type - enum sof_ipc_dai_type */ |
| 59 | uint32_t dai_index; /**< index of this type dai */ |
| 60 | |
| 61 | /* physical protocol and clocking */ |
| 62 | uint16_t format; /**< SOF_DAI_FMT_ */ |
| 63 | uint16_t reserved16; /**< alignment */ |
| 64 | |
| 65 | /* reserved for future use */ |
| 66 | uint32_t reserved[8]; |
| 67 | |
| 68 | /* HW specific data */ |
| 69 | union { |
| 70 | struct sof_ipc_dai_ssp_params ssp; |
| 71 | struct sof_ipc_dai_dmic_params dmic; |
| 72 | struct sof_ipc_dai_hda_params hda; |
Pierre-Louis Bossart | 3a9477a | 2019-08-15 10:50:30 -0500 | [diff] [blame^] | 73 | struct sof_ipc_dai_alh_params alh; |
Liam Girdwood | 53e0c72 | 2019-04-12 11:05:09 -0500 | [diff] [blame] | 74 | }; |
| 75 | } __packed; |
| 76 | |
| 77 | #endif |