ASoC: Intel: Skylake: Parse nhlt and register clock device
[sfrench/cifs-2.6.git] / sound / soc / intel / skylake / skl-i2s.h
1 /*
2  *  skl-i2s.h - i2s blob mapping
3  *
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.
10  *
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.
15  *
16  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17  *
18  */
19
20 #ifndef __SOUND_SOC_SKL_I2S_H
21 #define __SOUND_SOC_SKL_I2S_H
22
23 #define SKL_I2S_MAX_TIME_SLOTS          8
24 #define SKL_MCLK_DIV_CLK_SRC_MASK       GENMASK(17, 16)
25
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)
29
30 struct skl_i2s_config {
31         u32 ssc0;
32         u32 ssc1;
33         u32 sscto;
34         u32 sspsp;
35         u32 sstsa;
36         u32 ssrsa;
37         u32 ssc2;
38         u32 sspsp2;
39         u32 ssc3;
40         u32 ssioc;
41 } __packed;
42
43 struct skl_i2s_config_mclk {
44         u32 mdivctrl;
45         u32 mdivr;
46 };
47
48 /**
49  * struct skl_i2s_config_blob_legacy - Structure defines I2S Gateway
50  * configuration legacy blob
51  *
52  * @gtw_attr:           Gateway attribute for the I2S Gateway
53  * @tdm_ts_group:       TDM slot mapping against channels in the Gateway.
54  * @i2s_cfg:            I2S HW registers
55  * @mclk:               MCLK clock source and divider values
56  */
57 struct skl_i2s_config_blob_legacy {
58         u32 gtw_attr;
59         u32 tdm_ts_group[SKL_I2S_MAX_TIME_SLOTS];
60         struct skl_i2s_config i2s_cfg;
61         struct skl_i2s_config_mclk mclk;
62 };
63
64 #endif /* __SOUND_SOC_SKL_I2S_H */