Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / sound / soc / intel / common / soc-acpi-intel-byt-match.c
1 /*
2  * soc-apci-intel-byt-match.c - tables and support for BYT 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 byt_machine_id;
22
23 #define BYT_THINKPAD_10  1
24 #define BYT_POV_P1006W   2
25
26 static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id)
27 {
28         byt_machine_id = BYT_THINKPAD_10;
29         return 1;
30 }
31
32 static int byt_pov_p1006w_quirk_cb(const struct dmi_system_id *id)
33 {
34         byt_machine_id = BYT_POV_P1006W;
35         return 1;
36 }
37
38 static const struct dmi_system_id byt_table[] = {
39         {
40                 .callback = byt_thinkpad10_quirk_cb,
41                 .matches = {
42                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
43                         DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 8"),
44                 },
45         },
46         {
47                 .callback = byt_thinkpad10_quirk_cb,
48                 .matches = {
49                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
50                         DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 10"),
51                 },
52         },
53         {
54                 .callback = byt_thinkpad10_quirk_cb,
55                 .matches = {
56                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
57                         DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Tablet B"),
58                 },
59         },
60         {
61                 .callback = byt_thinkpad10_quirk_cb,
62                 .matches = {
63                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
64                         DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Miix 2 10"),
65                 },
66         },
67         {
68                 /* Point of View mobii wintab p1006w (v1.0) */
69                 .callback = byt_pov_p1006w_quirk_cb,
70                 .matches = {
71                         DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),
72                         DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
73                         /* Note 105b is Foxcon's USB/PCI vendor id */
74                         DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"),
75                         DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),
76                 },
77         },
78         { }
79 };
80
81 static struct snd_soc_acpi_mach byt_thinkpad_10 = {
82         .id = "10EC5640",
83         .drv_name = "cht-bsw-rt5672",
84         .fw_filename = "intel/fw_sst_0f28.bin",
85         .board = "cht-bsw",
86         .sof_fw_filename = "sof-byt.ri",
87         .sof_tplg_filename = "sof-byt-rt5670.tplg",
88 };
89
90 static struct snd_soc_acpi_mach byt_pov_p1006w = {
91         .id = "10EC5640",
92         .drv_name = "bytcr_rt5651",
93         .fw_filename = "intel/fw_sst_0f28.bin",
94         .board = "bytcr_rt5651",
95         .sof_fw_filename = "sof-byt.ri",
96         .sof_tplg_filename = "sof-byt-rt5651.tplg",
97 };
98
99 static struct snd_soc_acpi_mach *byt_quirk(void *arg)
100 {
101         struct snd_soc_acpi_mach *mach = arg;
102
103         dmi_check_system(byt_table);
104
105         switch (byt_machine_id) {
106         case BYT_THINKPAD_10:
107                 return &byt_thinkpad_10;
108         case BYT_POV_P1006W:
109                 return &byt_pov_p1006w;
110         default:
111                 return mach;
112         }
113 }
114
115 struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[] = {
116         {
117                 .id = "10EC5640",
118                 .drv_name = "byt-rt5640",
119                 .fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
120         },
121         {
122                 .id = "193C9890",
123                 .drv_name = "byt-max98090",
124                 .fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
125         },
126         {}
127 };
128 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_baytrail_legacy_machines);
129
130 struct snd_soc_acpi_mach  snd_soc_acpi_intel_baytrail_machines[] = {
131         {
132                 .id = "10EC5640",
133                 .drv_name = "bytcr_rt5640",
134                 .fw_filename = "intel/fw_sst_0f28.bin",
135                 .board = "bytcr_rt5640",
136                 .machine_quirk = byt_quirk,
137                 .sof_fw_filename = "sof-byt.ri",
138                 .sof_tplg_filename = "sof-byt-rt5640.tplg",
139         },
140         {
141                 .id = "10EC5642",
142                 .drv_name = "bytcr_rt5640",
143                 .fw_filename = "intel/fw_sst_0f28.bin",
144                 .board = "bytcr_rt5640",
145                 .sof_fw_filename = "sof-byt.ri",
146                 .sof_tplg_filename = "sof-byt-rt5640.tplg",
147         },
148         {
149                 .id = "INTCCFFD",
150                 .drv_name = "bytcr_rt5640",
151                 .fw_filename = "intel/fw_sst_0f28.bin",
152                 .board = "bytcr_rt5640",
153                 .sof_fw_filename = "sof-byt.ri",
154                 .sof_tplg_filename = "sof-byt-rt5640.tplg",
155         },
156         {
157                 .id = "10EC5651",
158                 .drv_name = "bytcr_rt5651",
159                 .fw_filename = "intel/fw_sst_0f28.bin",
160                 .board = "bytcr_rt5651",
161                 .sof_fw_filename = "sof-byt.ri",
162                 .sof_tplg_filename = "sof-byt-rt5651.tplg",
163         },
164         {
165                 .id = "DLGS7212",
166                 .drv_name = "bytcht_da7213",
167                 .fw_filename = "intel/fw_sst_0f28.bin",
168                 .board = "bytcht_da7213",
169                 .sof_fw_filename = "sof-byt.ri",
170                 .sof_tplg_filename = "sof-byt-da7213.tplg",
171         },
172         {
173                 .id = "DLGS7213",
174                 .drv_name = "bytcht_da7213",
175                 .fw_filename = "intel/fw_sst_0f28.bin",
176                 .board = "bytcht_da7213",
177                 .sof_fw_filename = "sof-byt.ri",
178                 .sof_tplg_filename = "sof-byt-da7213.tplg",
179         },
180         {
181                 .id = "ESSX8316",
182                 .drv_name = "bytcht_es8316",
183                 .fw_filename = "intel/fw_sst_0f28.bin",
184                 .board = "bytcht_es8316",
185                 .sof_fw_filename = "sof-byt.ri",
186                 .sof_tplg_filename = "sof-byt-es8316.tplg",
187         },
188         {
189                 .id = "10EC5682",
190                 .drv_name = "sof_rt5682",
191                 .sof_fw_filename = "sof-byt.ri",
192                 .sof_tplg_filename = "sof-byt-rt5682.tplg",
193         },
194         /* some Baytrail platforms rely on RT5645, use CHT machine driver */
195         {
196                 .id = "10EC5645",
197                 .drv_name = "cht-bsw-rt5645",
198                 .fw_filename = "intel/fw_sst_0f28.bin",
199                 .board = "cht-bsw",
200                 .sof_fw_filename = "sof-byt.ri",
201                 .sof_tplg_filename = "sof-byt-rt5645.tplg",
202         },
203         {
204                 .id = "10EC5648",
205                 .drv_name = "cht-bsw-rt5645",
206                 .fw_filename = "intel/fw_sst_0f28.bin",
207                 .board = "cht-bsw",
208                 .sof_fw_filename = "sof-byt.ri",
209                 .sof_tplg_filename = "sof-byt-rt5645.tplg",
210         },
211         /* use CHT driver to Baytrail Chromebooks */
212         {
213                 .id = "193C9890",
214                 .drv_name = "cht-bsw-max98090",
215                 .fw_filename = "intel/fw_sst_0f28.bin",
216                 .board = "cht-bsw",
217                 .sof_fw_filename = "sof-byt.ri",
218                 .sof_tplg_filename = "sof-byt-max98090.tplg",
219         },
220 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
221         /*
222          * This is always last in the table so that it is selected only when
223          * enabled explicitly and there is no codec-related information in SSDT
224          */
225         {
226                 .id = "80860F28",
227                 .drv_name = "bytcht_nocodec",
228                 .fw_filename = "intel/fw_sst_0f28.bin",
229                 .board = "bytcht_nocodec",
230         },
231 #endif
232         {},
233 };
234 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_baytrail_machines);
235
236 MODULE_LICENSE("GPL v2");
237 MODULE_DESCRIPTION("Intel Common ACPI Match module");