0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _SND_SOC_INTEL_QUIRKS_H
0010 #define _SND_SOC_INTEL_QUIRKS_H
0011
0012 #include <linux/platform_data/x86/soc.h>
0013
0014 #if IS_ENABLED(CONFIG_X86)
0015
0016 #include <linux/dmi.h>
0017 #include <asm/iosf_mbi.h>
0018
0019 static inline bool soc_intel_is_byt_cr(struct platform_device *pdev)
0020 {
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 static const struct dmi_system_id force_bytcr_table[] = {
0034 {
0035 .matches = {
0036 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
0037 DMI_MATCH(DMI_PRODUCT_FAMILY, "YOGATablet2"),
0038 },
0039 },
0040 {}
0041 };
0042 struct device *dev = &pdev->dev;
0043 int status = 0;
0044
0045 if (!soc_intel_is_byt())
0046 return false;
0047
0048 if (dmi_check_system(force_bytcr_table))
0049 return true;
0050
0051 if (iosf_mbi_available()) {
0052 u32 bios_status;
0053
0054 status = iosf_mbi_read(BT_MBI_UNIT_PMC,
0055 MBI_REG_READ,
0056 0x006,
0057 &bios_status);
0058
0059 if (status) {
0060 dev_err(dev, "could not read PUNIT BIOS_CONFIG\n");
0061 } else {
0062
0063 bios_status = (bios_status >> 26) & 3;
0064
0065 if (bios_status == 1 || bios_status == 3) {
0066 dev_info(dev, "Detected Baytrail-CR platform\n");
0067 return true;
0068 }
0069
0070 dev_info(dev, "BYT-CR not detected\n");
0071 }
0072 } else {
0073 dev_info(dev, "IOSF_MBI not available, no BYT-CR detection\n");
0074 }
0075
0076 if (!platform_get_resource(pdev, IORESOURCE_IRQ, 5)) {
0077
0078
0079
0080
0081
0082 dev_info(dev, "Falling back to Baytrail-CR platform\n");
0083 return true;
0084 }
0085
0086 return false;
0087 }
0088
0089 #else
0090
0091 static inline bool soc_intel_is_byt_cr(struct platform_device *pdev)
0092 {
0093 return false;
0094 }
0095
0096 #endif
0097
0098 #endif