Merge remote-tracking branch 'asoc/topic/intel' into asoc-next
[sfrench/cifs-2.6.git] / sound / soc / intel / common / soc-acpi-intel-cht-match.c
1 /*
2  * soc-apci-intel-cht-match.c - tables and support for CHT ACPI enumeration.
3  *
4  * Copyright (c) 2017, Intel Corporation.
5  *
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms and conditions of the GNU General Public License,
9  * version 2, as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  */
16
17 #include <linux/dmi.h>
18 #include <sound/soc-acpi.h>
19 #include <sound/soc-acpi-intel-match.h>
20
21 static unsigned long cht_machine_id;
22
23 #define CHT_SURFACE_MACH 1
24
25 static int cht_surface_quirk_cb(const struct dmi_system_id *id)
26 {
27         cht_machine_id = CHT_SURFACE_MACH;
28         return 1;
29 }
30
31 static const struct dmi_system_id cht_table[] = {
32         {
33                 .callback = cht_surface_quirk_cb,
34                 .matches = {
35                         DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
36                         DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
37                 },
38         },
39         { }
40 };
41
42 static struct snd_soc_acpi_mach cht_surface_mach = {
43         .id = "10EC5640",
44         .drv_name = "cht-bsw-rt5645",
45         .fw_filename = "intel/fw_sst_22a8.bin",
46         .board = "cht-bsw",
47         .sof_fw_filename = "intel/reef-cht.ri",
48         .sof_tplg_filename = "intel/reef-cht-rt5645.tplg",
49         .asoc_plat_name = "sst-mfld-platform",
50 };
51
52 static struct snd_soc_acpi_mach *cht_quirk(void *arg)
53 {
54         struct snd_soc_acpi_mach *mach = arg;
55
56         dmi_check_system(cht_table);
57
58         if (cht_machine_id == CHT_SURFACE_MACH)
59                 return &cht_surface_mach;
60         else
61                 return mach;
62 }
63
64 /* Cherryview-based platforms: CherryTrail and Braswell */
65 struct snd_soc_acpi_mach  snd_soc_acpi_intel_cherrytrail_machines[] = {
66         {
67                 .id = "10EC5670",
68                 .drv_name = "cht-bsw-rt5672",
69                 .fw_filename = "intel/fw_sst_22a8.bin",
70                 .board = "cht-bsw",
71                 .sof_fw_filename = "intel/reef-cht.ri",
72                 .sof_tplg_filename = "intel/reef-cht-rt5670.tplg",
73                 .asoc_plat_name = "sst-mfld-platform",
74         },
75         {
76                 .id = "10EC5672",
77                 .drv_name = "cht-bsw-rt5672",
78                 .fw_filename = "intel/fw_sst_22a8.bin",
79                 .board = "cht-bsw",
80                 .sof_fw_filename = "intel/reef-cht.ri",
81                 .sof_tplg_filename = "intel/reef-cht-rt5670.tplg",
82                 .asoc_plat_name = "sst-mfld-platform",
83         },
84         {
85                 .id = "10EC5645",
86                 .drv_name = "cht-bsw-rt5645",
87                 .fw_filename = "intel/fw_sst_22a8.bin",
88                 .board = "cht-bsw",
89                 .sof_fw_filename = "intel/reef-cht.ri",
90                 .sof_tplg_filename = "intel/reef-cht-rt5645.tplg",
91                 .asoc_plat_name = "sst-mfld-platform",
92         },
93         {
94                 .id = "10EC5650",
95                 .drv_name = "cht-bsw-rt5645",
96                 .fw_filename = "intel/fw_sst_22a8.bin",
97                 .board = "cht-bsw",
98                 .sof_fw_filename = "intel/reef-cht.ri",
99                 .sof_tplg_filename = "intel/reef-cht-rt5645.tplg",
100                 .asoc_plat_name = "sst-mfld-platform",
101         },
102         {
103                 .id = "10EC3270",
104                 .drv_name = "cht-bsw-rt5645",
105                 .fw_filename = "intel/fw_sst_22a8.bin",
106                 .board = "cht-bsw",
107                 .sof_fw_filename = "intel/reef-cht.ri",
108                 .sof_tplg_filename = "intel/reef-cht-rt5645.tplg",
109                 .asoc_plat_name = "sst-mfld-platform",
110         },
111         {
112                 .id = "193C9890",
113                 .drv_name = "cht-bsw-max98090",
114                 .fw_filename = "intel/fw_sst_22a8.bin",
115                 .board = "cht-bsw",
116                 .sof_fw_filename = "intel/reef-cht.ri",
117                 .sof_tplg_filename = "intel/reef-cht-max98090.tplg",
118                 .asoc_plat_name = "sst-mfld-platform",
119         },
120         {
121                 .id = "DLGS7212",
122                 .drv_name = "bytcht_da7213",
123                 .fw_filename = "intel/fw_sst_22a8.bin",
124                 .board = "bytcht_da7213",
125                 .sof_fw_filename = "intel/reef-cht.ri",
126                 .sof_tplg_filename = "intel/reef-cht-da7213.tplg",
127                 .asoc_plat_name = "sst-mfld-platform",
128         },
129         {
130                 .id = "DLGS7213",
131                 .drv_name = "bytcht_da7213",
132                 .fw_filename = "intel/fw_sst_22a8.bin",
133                 .board = "bytcht_da7213",
134                 .sof_fw_filename = "intel/reef-cht.ri",
135                 .sof_tplg_filename = "intel/reef-cht-da7213.tplg",
136                 .asoc_plat_name = "sst-mfld-platform",
137         },
138         {
139                 .id = "ESSX8316",
140                 .drv_name = "bytcht_es8316",
141                 .fw_filename = "intel/fw_sst_22a8.bin",
142                 .board = "bytcht_es8316",
143                 .sof_fw_filename = "intel/reef-cht.ri",
144                 .sof_tplg_filename = "intel/reef-cht-es8316.tplg",
145                 .asoc_plat_name = "sst-mfld-platform",
146         },
147         /* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
148         {
149                 .id = "10EC5640",
150                 .drv_name = "bytcr_rt5640",
151                 .fw_filename = "intel/fw_sst_22a8.bin",
152                 .board = "bytcr_rt5640",
153                 .machine_quirk = cht_quirk,
154                 .sof_fw_filename = "intel/reef-cht.ri",
155                 .sof_tplg_filename = "intel/reef-cht-rt5640.tplg",
156                 .asoc_plat_name = "sst-mfld-platform",
157         },
158         {
159                 .id = "10EC3276",
160                 .drv_name = "bytcr_rt5640",
161                 .fw_filename = "intel/fw_sst_22a8.bin",
162                 .board = "bytcr_rt5640",
163                 .sof_fw_filename = "intel/reef-cht.ri",
164                 .sof_tplg_filename = "intel/reef-cht-rt5640.tplg",
165                 .asoc_plat_name = "sst-mfld-platform",
166         },
167         /* some CHT-T platforms rely on RT5651, use Baytrail machine driver */
168         {
169                 .id = "10EC5651",
170                 .drv_name = "bytcr_rt5651",
171                 .fw_filename = "intel/fw_sst_22a8.bin",
172                 .board = "bytcr_rt5651",
173                 .sof_fw_filename = "intel/reef-cht.ri",
174                 .sof_tplg_filename = "intel/reef-cht-rt5651.tplg",
175                 .asoc_plat_name = "sst-mfld-platform",
176         },
177 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
178         /*
179          * This is always last in the table so that it is selected only when
180          * enabled explicitly and there is no codec-related information in SSDT
181          */
182         {
183                 .id = "808622A8",
184                 .drv_name = "bytcht_nocodec",
185                 .fw_filename = "intel/fw_sst_22a8.bin",
186                 .board = "bytcht_nocodec",
187         },
188 #endif
189         {},
190 };
191 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cherrytrail_machines);
192
193 MODULE_LICENSE("GPL v2");
194 MODULE_DESCRIPTION("Intel Common ACPI Match module");