diff options
Diffstat (limited to 'sound/soc/intel/common/sst-match-acpi.c')
-rw-r--r-- | sound/soc/intel/common/sst-match-acpi.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/sound/soc/intel/common/sst-match-acpi.c b/sound/soc/intel/common/sst-match-acpi.c index 1070f3ad23e5..56d26f36a3cb 100644 --- a/sound/soc/intel/common/sst-match-acpi.c +++ b/sound/soc/intel/common/sst-match-acpi.c | |||
@@ -63,16 +63,33 @@ static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level, | |||
63 | return AE_OK; | 63 | return AE_OK; |
64 | } | 64 | } |
65 | 65 | ||
66 | bool sst_acpi_check_hid(const u8 hid[ACPI_ID_LEN]) | ||
67 | { | ||
68 | acpi_status status; | ||
69 | bool found = false; | ||
70 | |||
71 | status = acpi_get_devices(hid, sst_acpi_mach_match, &found, NULL); | ||
72 | |||
73 | if (ACPI_FAILURE(status)) | ||
74 | return false; | ||
75 | |||
76 | return found; | ||
77 | } | ||
78 | EXPORT_SYMBOL_GPL(sst_acpi_check_hid); | ||
79 | |||
66 | struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines) | 80 | struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines) |
67 | { | 81 | { |
68 | struct sst_acpi_mach *mach; | 82 | struct sst_acpi_mach *mach; |
69 | bool found = false; | ||
70 | 83 | ||
71 | for (mach = machines; mach->id[0]; mach++) | 84 | for (mach = machines; mach->id[0]; mach++) { |
72 | if (ACPI_SUCCESS(acpi_get_devices(mach->id, | 85 | if (sst_acpi_check_hid(mach->id) == true) { |
73 | sst_acpi_mach_match, | 86 | if (mach->machine_quirk == NULL) |
74 | &found, NULL)) && found) | 87 | return mach; |
75 | return mach; | 88 | |
89 | if (mach->machine_quirk(mach) != NULL) | ||
90 | return mach; | ||
91 | } | ||
92 | } | ||
76 | return NULL; | 93 | return NULL; |
77 | } | 94 | } |
78 | EXPORT_SYMBOL_GPL(sst_acpi_find_machine); | 95 | EXPORT_SYMBOL_GPL(sst_acpi_find_machine); |
@@ -134,5 +151,23 @@ bool sst_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN], | |||
134 | } | 151 | } |
135 | EXPORT_SYMBOL_GPL(sst_acpi_find_package_from_hid); | 152 | EXPORT_SYMBOL_GPL(sst_acpi_find_package_from_hid); |
136 | 153 | ||
154 | struct sst_acpi_mach *sst_acpi_codec_list(void *arg) | ||
155 | { | ||
156 | struct sst_acpi_mach *mach = arg; | ||
157 | struct sst_codecs *codec_list = (struct sst_codecs *) mach->quirk_data; | ||
158 | int i; | ||
159 | |||
160 | if (mach->quirk_data == NULL) | ||
161 | return mach; | ||
162 | |||
163 | for (i = 0; i < codec_list->num_codecs; i++) { | ||
164 | if (sst_acpi_check_hid(codec_list->codecs[i]) != true) | ||
165 | return NULL; | ||
166 | } | ||
167 | |||
168 | return mach; | ||
169 | } | ||
170 | EXPORT_SYMBOL_GPL(sst_acpi_codec_list); | ||
171 | |||
137 | MODULE_LICENSE("GPL v2"); | 172 | MODULE_LICENSE("GPL v2"); |
138 | MODULE_DESCRIPTION("Intel Common ACPI Match module"); | 173 | MODULE_DESCRIPTION("Intel Common ACPI Match module"); |