1212#include <linux/dmi.h>
1313#include <linux/module.h>
1414#include <linux/pci.h>
15+ #include <linux/platform_data/x86/soc.h>
1516#include <linux/pm_runtime.h>
1617#include <sound/soc-acpi.h>
1718#include <sound/soc-acpi-intel-match.h>
@@ -39,7 +40,12 @@ static int sof_pci_debug;
3940module_param_named (sof_pci_debug , sof_pci_debug , int , 0444 );
4041MODULE_PARM_DESC (sof_pci_debug , "SOF PCI debug options (0x0 all off)" );
4142
43+ static int sof_pci_ipc_type = -1 ;
44+ module_param_named (ipc_type , sof_pci_ipc_type , int , 0444 );
45+ MODULE_PARM_DESC (ipc_type , "SOF IPC type (0): SOF, (1) Intel CAVS" );
46+
4247static const char * sof_dmi_override_tplg_name ;
48+ static bool sof_dmi_use_community_key ;
4349
4450#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)
4551
@@ -102,15 +108,35 @@ static const struct dmi_system_id sof_tplg_table[] = {
102108 {}
103109};
104110
111+ /* all Up boards use the community key */
112+ static int up_use_community_key (const struct dmi_system_id * id )
113+ {
114+ sof_dmi_use_community_key = true;
115+ return 1 ;
116+ }
117+
118+ /*
119+ * For ApolloLake Chromebooks we want to force the use of the Intel production key.
120+ * All newer platforms use the community key
121+ */
122+ static int chromebook_use_community_key (const struct dmi_system_id * id )
123+ {
124+ if (!soc_intel_is_apl ())
125+ sof_dmi_use_community_key = true;
126+ return 1 ;
127+ }
128+
105129static const struct dmi_system_id community_key_platforms [] = {
106130 {
107131 .ident = "Up boards" ,
132+ .callback = up_use_community_key ,
108133 .matches = {
109134 DMI_MATCH (DMI_SYS_VENDOR , "AAEON" ),
110135 }
111136 },
112137 {
113138 .ident = "Google Chromebooks" ,
139+ .callback = chromebook_use_community_key ,
114140 .matches = {
115141 DMI_MATCH (DMI_SYS_VENDOR , "Google" ),
116142 }
@@ -184,6 +210,23 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
184210
185211 sof_pdata -> ipc_type = desc -> ipc_default ;
186212
213+ if (sof_pci_ipc_type < 0 ) {
214+ sof_pdata -> ipc_type = desc -> ipc_default ;
215+ } else {
216+ dev_info (dev , "overriding default IPC %d to requested %d\n" ,
217+ desc -> ipc_default , sof_pci_ipc_type );
218+ if (sof_pci_ipc_type >= SOF_IPC_TYPE_COUNT ) {
219+ dev_err (dev , "invalid request value %d\n" , sof_pci_ipc_type );
220+ return - EINVAL ;
221+ }
222+ if (!(BIT (sof_pci_ipc_type ) & desc -> ipc_supported_mask )) {
223+ dev_err (dev , "invalid request value %d, supported mask is %#x\n" ,
224+ sof_pci_ipc_type , desc -> ipc_supported_mask );
225+ return - EINVAL ;
226+ }
227+ sof_pdata -> ipc_type = sof_pci_ipc_type ;
228+ }
229+
187230 if (fw_filename ) {
188231 sof_pdata -> fw_filename = fw_filename ;
189232
@@ -208,7 +251,7 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
208251 "Module parameter used, changed fw path to %s\n" ,
209252 sof_pdata -> fw_filename_prefix );
210253
211- } else if (dmi_check_system (community_key_platforms )) {
254+ } else if (dmi_check_system (community_key_platforms ) && sof_dmi_use_community_key ) {
212255 sof_pdata -> fw_filename_prefix =
213256 devm_kasprintf (dev , GFP_KERNEL , "%s/%s" ,
214257 sof_pdata -> desc -> default_fw_path [sof_pdata -> ipc_type ],
0 commit comments