xref: /linux/sound/soc/intel/boards/sof_sdw_common.h (revision 7a4ffec9fd54ea27395e24dff726dbf58e2fe06b)
1 /* SPDX-License-Identifier: GPL-2.0-only
2  *  Copyright (c) 2020 Intel Corporation
3  */
4 
5 /*
6  *  sof_sdw_common.h - prototypes for common helpers
7  */
8 
9 #ifndef SND_SOC_SOF_SDW_COMMON_H
10 #define SND_SOC_SOF_SDW_COMMON_H
11 
12 #include <linux/bits.h>
13 #include <linux/types.h>
14 #include <sound/soc.h>
15 #include <sound/soc_sdw_utils.h>
16 #include "sof_hdmi_common.h"
17 
18 #define MAX_HDMI_NUM 4
19 #define SOC_SDW_MAX_CPU_DAIS 16
20 #define SOC_SDW_INTEL_BIDIR_PDI_BASE 2
21 
22 /* 8 combinations with 4 links + unused group 0 */
23 #define SDW_MAX_GROUPS 9
24 
25 enum {
26 	SOF_PRE_TGL_HDMI_COUNT = 3,
27 	SOF_TGL_HDMI_COUNT = 4,
28 };
29 
30 enum {
31 	SOF_I2S_SSP0 = BIT(0),
32 	SOF_I2S_SSP1 = BIT(1),
33 	SOF_I2S_SSP2 = BIT(2),
34 	SOF_I2S_SSP3 = BIT(3),
35 	SOF_I2S_SSP4 = BIT(4),
36 	SOF_I2S_SSP5 = BIT(5),
37 };
38 
39 /* Deprecated and no longer supported by the code */
40 #define SOC_SDW_FOUR_SPK		BIT(4)
41 #define SOF_SDW_TGL_HDMI		BIT(5)
42 #define SOC_SDW_PCH_DMIC		BIT(6)
43 #define SOF_SSP_PORT(x)		(((x) & GENMASK(5, 0)) << 7)
44 #define SOF_SSP_GET_PORT(quirk)	(((quirk) >> 7) & GENMASK(5, 0))
45 /* Deprecated and no longer supported by the code */
46 #define SOC_SDW_NO_AGGREGATION		BIT(14)
47 
48 /* BT audio offload: reserve 3 bits for future */
49 #define SOF_BT_OFFLOAD_SSP_SHIFT	15
50 #define SOF_BT_OFFLOAD_SSP_MASK	(GENMASK(17, 15))
51 #define SOF_BT_OFFLOAD_SSP(quirk)	\
52 	(((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK)
53 #define SOF_SSP_BT_OFFLOAD_PRESENT	BIT(18)
54 
55 struct intel_mc_ctx {
56 	struct sof_hdmi_private hdmi;
57 	/* To store SDW Pin index for each SoundWire link */
58 	unsigned int sdw_pin_index[SDW_INTEL_MAX_LINKS];
59 };
60 
61 /* generic HDMI support */
62 int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd);
63 
64 int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card);
65 
66 #endif
67