2 * skl-i2s.h - i2s blob mapping
4 * Copyright (C) 2017 Intel Corp
5 * Author: Subhransu S. Prusty < subhransu.s.prusty@intel.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 #ifndef __SOUND_SOC_SKL_I2S_H
21 #define __SOUND_SOC_SKL_I2S_H
23 #define SKL_I2S_MAX_TIME_SLOTS 8
24 #define SKL_MCLK_DIV_CLK_SRC_MASK GENMASK(17, 16)
26 #define SKL_MNDSS_DIV_CLK_SRC_MASK GENMASK(21, 20)
27 #define SKL_SHIFT(x) (ffs(x) - 1)
28 #define SKL_MCLK_DIV_RATIO_MASK GENMASK(11, 0)
30 #define is_legacy_blob(x) (x.signature != 0xEE)
31 #define ext_to_legacy_blob(i2s_config_blob_ext) \
32 ((struct skl_i2s_config_blob_legacy *) i2s_config_blob_ext)
34 #define get_clk_src(mclk, mask) \
35 ((mclk.mdivctrl & mask) >> SKL_SHIFT(mask))
36 struct skl_i2s_config {
49 struct skl_i2s_config_mclk {
54 struct skl_i2s_config_mclk_ext {
60 struct skl_i2s_config_blob_signature {
67 struct skl_i2s_config_blob_header {
68 struct skl_i2s_config_blob_signature sig;
73 * struct skl_i2s_config_blob_legacy - Structure defines I2S Gateway
74 * configuration legacy blob
76 * @gtw_attr: Gateway attribute for the I2S Gateway
77 * @tdm_ts_group: TDM slot mapping against channels in the Gateway.
78 * @i2s_cfg: I2S HW registers
79 * @mclk: MCLK clock source and divider values
81 struct skl_i2s_config_blob_legacy {
83 u32 tdm_ts_group[SKL_I2S_MAX_TIME_SLOTS];
84 struct skl_i2s_config i2s_cfg;
85 struct skl_i2s_config_mclk mclk;
88 struct skl_i2s_config_blob_ext {
90 struct skl_i2s_config_blob_header hdr;
91 u32 tdm_ts_group[SKL_I2S_MAX_TIME_SLOTS];
92 struct skl_i2s_config i2s_cfg;
93 struct skl_i2s_config_mclk_ext mclk;
95 #endif /* __SOUND_SOC_SKL_I2S_H */