449d9d2286ae24c3b45be96ffcc2a6493725e870
[sfrench/cifs-2.6.git] / sound / soc / intel / common / soc-acpi-intel-tgl-match.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * soc-apci-intel-tgl-match.c - tables and support for ICL ACPI enumeration.
4  *
5  * Copyright (c) 2019, Intel Corporation.
6  *
7  */
8
9 #include <sound/soc-acpi.h>
10 #include <sound/soc-acpi-intel-match.h>
11
12 static struct snd_soc_acpi_codecs tgl_codecs = {
13         .num_codecs = 1,
14         .codecs = {"MX98357A"}
15 };
16
17 static const struct snd_soc_acpi_endpoint single_endpoint = {
18         .num = 0,
19         .aggregated = 0,
20         .group_position = 0,
21         .group_id = 0,
22 };
23
24 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
25         .num = 0,
26         .aggregated = 1,
27         .group_position = 0,
28         .group_id = 1,
29 };
30
31 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
32         .num = 0,
33         .aggregated = 1,
34         .group_position = 1,
35         .group_id = 1,
36 };
37
38 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
39         {
40                 .adr = 0x000010025D071100,
41                 .num_endpoints = 1,
42                 .endpoints = &single_endpoint,
43         }
44 };
45
46 static const struct snd_soc_acpi_adr_device rt1308_1_adr[] = {
47         {
48                 .adr = 0x000120025D130800,
49                 .num_endpoints = 1,
50                 .endpoints = &spk_l_endpoint,
51         },
52         {
53                 .adr = 0x000122025D130800,
54                 .num_endpoints = 1,
55                 .endpoints = &spk_r_endpoint,
56         }
57 };
58
59 static const struct snd_soc_acpi_adr_device rt5682_0_adr[] = {
60         {
61                 .adr = 0x000021025D568200,
62                 .num_endpoints = 1,
63                 .endpoints = &single_endpoint,
64         }
65 };
66
67 static const struct snd_soc_acpi_link_adr tgl_i2s_rt1308[] = {
68         {
69                 .mask = BIT(0),
70                 .num_adr = ARRAY_SIZE(rt711_0_adr),
71                 .adr_d = rt711_0_adr,
72         },
73         {}
74 };
75
76 static const struct snd_soc_acpi_link_adr tgl_rvp[] = {
77         {
78                 .mask = BIT(0),
79                 .num_adr = ARRAY_SIZE(rt711_0_adr),
80                 .adr_d = rt711_0_adr,
81         },
82         {
83                 .mask = BIT(1),
84                 .num_adr = ARRAY_SIZE(rt1308_1_adr),
85                 .adr_d = rt1308_1_adr,
86         },
87         {}
88 };
89
90 static const struct snd_soc_acpi_link_adr tgl_chromebook_base[] = {
91         {
92                 .mask = BIT(0),
93                 .num_adr = ARRAY_SIZE(rt5682_0_adr),
94                 .adr_d = rt5682_0_adr,
95         },
96         {}
97 };
98
99 static struct snd_soc_acpi_codecs tgl_max98373_amp = {
100         .num_codecs = 1,
101         .codecs = {"MX98373"}
102 };
103
104 struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_machines[] = {
105         {
106                 .id = "10EC1308",
107                 .drv_name = "sof_sdw",
108                 .link_mask = 0x1, /* RT711 on SoundWire link0 */
109                 .links = tgl_i2s_rt1308,
110                 .sof_fw_filename = "sof-tgl.ri",
111                 .sof_tplg_filename = "sof-tgl-rt711-i2s-rt1308.tplg",
112         },
113         {
114                 .id = "10EC5682",
115                 .drv_name = "tgl_max98357a_rt5682",
116                 .machine_quirk = snd_soc_acpi_codec_list,
117                 .quirk_data = &tgl_codecs,
118                 .sof_fw_filename = "sof-tgl.ri",
119                 .sof_tplg_filename = "sof-tgl-max98357a-rt5682.tplg",
120         },
121         {
122                 .id = "10EC5682",
123                 .drv_name = "tgl_max98373_rt5682",
124                 .machine_quirk = snd_soc_acpi_codec_list,
125                 .quirk_data = &tgl_max98373_amp,
126                 .sof_fw_filename = "sof-tgl.ri",
127                 .sof_tplg_filename = "sof-tgl-max98373-rt5682.tplg",
128         },
129         {},
130 };
131 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_machines);
132
133 /* this table is used when there is no I2S codec present */
134 struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = {
135         {
136                 .link_mask = 0x3, /* rt711 on link 0 and 2 rt1308s on link 1 */
137                 .links = tgl_rvp,
138                 .drv_name = "sof_sdw",
139                 .sof_fw_filename = "sof-tgl.ri",
140                 .sof_tplg_filename = "sof-tgl-rt711-rt1308.tplg",
141         },
142         {
143                 .link_mask = 0x1, /* this will only enable rt5682 for now */
144                 .links = tgl_chromebook_base,
145                 .drv_name = "sof_sdw",
146                 .sof_fw_filename = "sof-tgl.ri",
147                 .sof_tplg_filename = "sof-tgl-rt5682.tplg",
148         },
149         {},
150 };
151 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_sdw_machines);
152
153 MODULE_LICENSE("GPL v2");
154 MODULE_DESCRIPTION("Intel Common ACPI Match module");