diff options
Diffstat (limited to 'sound/soc/intel/atom/sst/sst_acpi.c')
-rw-r--r-- | sound/soc/intel/atom/sst/sst_acpi.c | 67 |
1 files changed, 19 insertions, 48 deletions
diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c index bb19b5801466..f424460b917e 100644 --- a/sound/soc/intel/atom/sst/sst_acpi.c +++ b/sound/soc/intel/atom/sst/sst_acpi.c | |||
@@ -40,18 +40,9 @@ | |||
40 | #include <acpi/acpi_bus.h> | 40 | #include <acpi/acpi_bus.h> |
41 | #include "../sst-mfld-platform.h" | 41 | #include "../sst-mfld-platform.h" |
42 | #include "../../common/sst-dsp.h" | 42 | #include "../../common/sst-dsp.h" |
43 | #include "../../common/sst-acpi.h" | ||
43 | #include "sst.h" | 44 | #include "sst.h" |
44 | 45 | ||
45 | struct sst_machines { | ||
46 | char *codec_id; | ||
47 | char board[32]; | ||
48 | char machine[32]; | ||
49 | void (*machine_quirk)(void); | ||
50 | char firmware[FW_NAME_SIZE]; | ||
51 | struct sst_platform_info *pdata; | ||
52 | |||
53 | }; | ||
54 | |||
55 | /* LPE viewpoint addresses */ | 46 | /* LPE viewpoint addresses */ |
56 | #define SST_BYT_IRAM_PHY_START 0xff2c0000 | 47 | #define SST_BYT_IRAM_PHY_START 0xff2c0000 |
57 | #define SST_BYT_IRAM_PHY_END 0xff2d4000 | 48 | #define SST_BYT_IRAM_PHY_END 0xff2d4000 |
@@ -223,37 +214,16 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx) | |||
223 | return 0; | 214 | return 0; |
224 | } | 215 | } |
225 | 216 | ||
226 | static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level, | ||
227 | void *context, void **ret) | ||
228 | { | ||
229 | *(bool *)context = true; | ||
230 | return AE_OK; | ||
231 | } | ||
232 | |||
233 | static struct sst_machines *sst_acpi_find_machine( | ||
234 | struct sst_machines *machines) | ||
235 | { | ||
236 | struct sst_machines *mach; | ||
237 | bool found = false; | ||
238 | |||
239 | for (mach = machines; mach->codec_id; mach++) | ||
240 | if (ACPI_SUCCESS(acpi_get_devices(mach->codec_id, | ||
241 | sst_acpi_mach_match, | ||
242 | &found, NULL)) && found) | ||
243 | return mach; | ||
244 | |||
245 | return NULL; | ||
246 | } | ||
247 | |||
248 | static int sst_acpi_probe(struct platform_device *pdev) | 217 | static int sst_acpi_probe(struct platform_device *pdev) |
249 | { | 218 | { |
250 | struct device *dev = &pdev->dev; | 219 | struct device *dev = &pdev->dev; |
251 | int ret = 0; | 220 | int ret = 0; |
252 | struct intel_sst_drv *ctx; | 221 | struct intel_sst_drv *ctx; |
253 | const struct acpi_device_id *id; | 222 | const struct acpi_device_id *id; |
254 | struct sst_machines *mach; | 223 | struct sst_acpi_mach *mach; |
255 | struct platform_device *mdev; | 224 | struct platform_device *mdev; |
256 | struct platform_device *plat_dev; | 225 | struct platform_device *plat_dev; |
226 | struct sst_platform_info *pdata; | ||
257 | unsigned int dev_id; | 227 | unsigned int dev_id; |
258 | 228 | ||
259 | id = acpi_match_device(dev->driver->acpi_match_table, dev); | 229 | id = acpi_match_device(dev->driver->acpi_match_table, dev); |
@@ -261,12 +231,13 @@ static int sst_acpi_probe(struct platform_device *pdev) | |||
261 | return -ENODEV; | 231 | return -ENODEV; |
262 | dev_dbg(dev, "for %s", id->id); | 232 | dev_dbg(dev, "for %s", id->id); |
263 | 233 | ||
264 | mach = (struct sst_machines *)id->driver_data; | 234 | mach = (struct sst_acpi_mach *)id->driver_data; |
265 | mach = sst_acpi_find_machine(mach); | 235 | mach = sst_acpi_find_machine(mach); |
266 | if (mach == NULL) { | 236 | if (mach == NULL) { |
267 | dev_err(dev, "No matching machine driver found\n"); | 237 | dev_err(dev, "No matching machine driver found\n"); |
268 | return -ENODEV; | 238 | return -ENODEV; |
269 | } | 239 | } |
240 | pdata = mach->pdata; | ||
270 | 241 | ||
271 | ret = kstrtouint(id->id, 16, &dev_id); | 242 | ret = kstrtouint(id->id, 16, &dev_id); |
272 | if (ret < 0) { | 243 | if (ret < 0) { |
@@ -276,16 +247,16 @@ static int sst_acpi_probe(struct platform_device *pdev) | |||
276 | 247 | ||
277 | dev_dbg(dev, "ACPI device id: %x\n", dev_id); | 248 | dev_dbg(dev, "ACPI device id: %x\n", dev_id); |
278 | 249 | ||
279 | plat_dev = platform_device_register_data(dev, mach->pdata->platform, -1, NULL, 0); | 250 | plat_dev = platform_device_register_data(dev, pdata->platform, -1, NULL, 0); |
280 | if (IS_ERR(plat_dev)) { | 251 | if (IS_ERR(plat_dev)) { |
281 | dev_err(dev, "Failed to create machine device: %s\n", mach->pdata->platform); | 252 | dev_err(dev, "Failed to create machine device: %s\n", pdata->platform); |
282 | return PTR_ERR(plat_dev); | 253 | return PTR_ERR(plat_dev); |
283 | } | 254 | } |
284 | 255 | ||
285 | /* Create platform device for sst machine driver */ | 256 | /* Create platform device for sst machine driver */ |
286 | mdev = platform_device_register_data(dev, mach->machine, -1, NULL, 0); | 257 | mdev = platform_device_register_data(dev, mach->drv_name, -1, NULL, 0); |
287 | if (IS_ERR(mdev)) { | 258 | if (IS_ERR(mdev)) { |
288 | dev_err(dev, "Failed to create machine device: %s\n", mach->machine); | 259 | dev_err(dev, "Failed to create machine device: %s\n", mach->drv_name); |
289 | return PTR_ERR(mdev); | 260 | return PTR_ERR(mdev); |
290 | } | 261 | } |
291 | 262 | ||
@@ -294,8 +265,8 @@ static int sst_acpi_probe(struct platform_device *pdev) | |||
294 | return ret; | 265 | return ret; |
295 | 266 | ||
296 | /* Fill sst platform data */ | 267 | /* Fill sst platform data */ |
297 | ctx->pdata = mach->pdata; | 268 | ctx->pdata = pdata; |
298 | strcpy(ctx->firmware_name, mach->firmware); | 269 | strcpy(ctx->firmware_name, mach->fw_filename); |
299 | 270 | ||
300 | ret = sst_platform_get_resources(ctx); | 271 | ret = sst_platform_get_resources(ctx); |
301 | if (ret) | 272 | if (ret) |
@@ -342,22 +313,22 @@ static int sst_acpi_remove(struct platform_device *pdev) | |||
342 | return 0; | 313 | return 0; |
343 | } | 314 | } |
344 | 315 | ||
345 | static struct sst_machines sst_acpi_bytcr[] = { | 316 | static struct sst_acpi_mach sst_acpi_bytcr[] = { |
346 | {"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin", | 317 | {"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL, |
347 | &byt_rvp_platform_data }, | 318 | &byt_rvp_platform_data }, |
348 | {}, | 319 | {}, |
349 | }; | 320 | }; |
350 | 321 | ||
351 | /* Cherryview-based platforms: CherryTrail and Braswell */ | 322 | /* Cherryview-based platforms: CherryTrail and Braswell */ |
352 | static struct sst_machines sst_acpi_chv[] = { | 323 | static struct sst_acpi_mach sst_acpi_chv[] = { |
353 | {"10EC5670", "cht-bsw", "cht-bsw-rt5672", NULL, "intel/fw_sst_22a8.bin", | 324 | {"10EC5670", "cht-bsw-rt5672", "intel/fw_sst_22a8.bin", "cht-bsw", NULL, |
325 | &chv_platform_data }, | ||
326 | {"10EC5645", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL, | ||
354 | &chv_platform_data }, | 327 | &chv_platform_data }, |
355 | {"10EC5645", "cht-bsw", "cht-bsw-rt5645", NULL, "intel/fw_sst_22a8.bin", | 328 | {"10EC5650", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL, |
356 | &chv_platform_data }, | 329 | &chv_platform_data }, |
357 | {"10EC5650", "cht-bsw", "cht-bsw-rt5645", NULL, "intel/fw_sst_22a8.bin", | 330 | {"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8.bin", "cht-bsw", NULL, |
358 | &chv_platform_data }, | 331 | &chv_platform_data }, |
359 | {"193C9890", "cht-bsw", "cht-bsw-max98090", NULL, | ||
360 | "intel/fw_sst_22a8.bin", &chv_platform_data }, | ||
361 | {}, | 332 | {}, |
362 | }; | 333 | }; |
363 | 334 | ||