18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license. When using or 48c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright(c) 2018 Intel Corporation. All rights reserved. 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef __INCLUDE_SOUND_SOF_DAI_H__ 108c2ecf20Sopenharmony_ci#define __INCLUDE_SOUND_SOF_DAI_H__ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <sound/sof/header.h> 138c2ecf20Sopenharmony_ci#include <sound/sof/dai-intel.h> 148c2ecf20Sopenharmony_ci#include <sound/sof/dai-imx.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* 178c2ecf20Sopenharmony_ci * DAI Configuration. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * Each different DAI type will have it's own structure and IPC cmd. 208c2ecf20Sopenharmony_ci */ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_I2S 1 /**< I2S mode */ 238c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_RIGHT_J 2 /**< Right Justified mode */ 248c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_LEFT_J 3 /**< Left Justified mode */ 258c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_DSP_A 4 /**< L data MSB after FRM LRC */ 268c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_DSP_B 5 /**< L data MSB during FRM LRC */ 278c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_PDM 6 /**< Pulse density modulation */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_CONT (1 << 4) /**< continuous clock */ 308c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_GATED (0 << 4) /**< clock is gated */ 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_NB_NF (0 << 8) /**< normal bit clock + frame */ 338c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_NB_IF (2 << 8) /**< normal BCLK + inv FRM */ 348c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_IB_NF (3 << 8) /**< invert BCLK + nor FRM */ 358c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_IB_IF (4 << 8) /**< invert BCLK + FRM */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_CBM_CFM (0 << 12) /**< codec clk & FRM master */ 388c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_CBS_CFM (2 << 12) /**< codec clk slave & FRM master */ 398c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_CBM_CFS (3 << 12) /**< codec clk master & frame slave */ 408c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_CBS_CFS (4 << 12) /**< codec clk & FRM slave */ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_FORMAT_MASK 0x000f 438c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_CLOCK_MASK 0x00f0 448c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_INV_MASK 0x0f00 458c2ecf20Sopenharmony_ci#define SOF_DAI_FMT_MASTER_MASK 0xf000 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/** \brief Types of DAI */ 488c2ecf20Sopenharmony_cienum sof_ipc_dai_type { 498c2ecf20Sopenharmony_ci SOF_DAI_INTEL_NONE = 0, /**< None */ 508c2ecf20Sopenharmony_ci SOF_DAI_INTEL_SSP, /**< Intel SSP */ 518c2ecf20Sopenharmony_ci SOF_DAI_INTEL_DMIC, /**< Intel DMIC */ 528c2ecf20Sopenharmony_ci SOF_DAI_INTEL_HDA, /**< Intel HD/A */ 538c2ecf20Sopenharmony_ci SOF_DAI_INTEL_ALH, /**< Intel ALH */ 548c2ecf20Sopenharmony_ci SOF_DAI_IMX_SAI, /**< i.MX SAI */ 558c2ecf20Sopenharmony_ci SOF_DAI_IMX_ESAI, /**< i.MX ESAI */ 568c2ecf20Sopenharmony_ci}; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* general purpose DAI configuration */ 598c2ecf20Sopenharmony_cistruct sof_ipc_dai_config { 608c2ecf20Sopenharmony_ci struct sof_ipc_cmd_hdr hdr; 618c2ecf20Sopenharmony_ci uint32_t type; /**< DAI type - enum sof_ipc_dai_type */ 628c2ecf20Sopenharmony_ci uint32_t dai_index; /**< index of this type dai */ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci /* physical protocol and clocking */ 658c2ecf20Sopenharmony_ci uint16_t format; /**< SOF_DAI_FMT_ */ 668c2ecf20Sopenharmony_ci uint16_t reserved16; /**< alignment */ 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci /* reserved for future use */ 698c2ecf20Sopenharmony_ci uint32_t reserved[8]; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci /* HW specific data */ 728c2ecf20Sopenharmony_ci union { 738c2ecf20Sopenharmony_ci struct sof_ipc_dai_ssp_params ssp; 748c2ecf20Sopenharmony_ci struct sof_ipc_dai_dmic_params dmic; 758c2ecf20Sopenharmony_ci struct sof_ipc_dai_hda_params hda; 768c2ecf20Sopenharmony_ci struct sof_ipc_dai_alh_params alh; 778c2ecf20Sopenharmony_ci struct sof_ipc_dai_esai_params esai; 788c2ecf20Sopenharmony_ci struct sof_ipc_dai_sai_params sai; 798c2ecf20Sopenharmony_ci }; 808c2ecf20Sopenharmony_ci} __packed; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#endif 83