diff options
Diffstat (limited to 'sound/soc/intel/atom/sst/sst_acpi.c')
-rw-r--r-- | sound/soc/intel/atom/sst/sst_acpi.c | 312 |
1 files changed, 23 insertions, 289 deletions
diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c index 0e928d54305d..32d6e02e2104 100644 --- a/sound/soc/intel/atom/sst/sst_acpi.c +++ b/sound/soc/intel/atom/sst/sst_acpi.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/miscdevice.h> | ||
27 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
28 | #include <linux/firmware.h> | 27 | #include <linux/firmware.h> |
29 | #include <linux/pm_runtime.h> | 28 | #include <linux/pm_runtime.h> |
@@ -41,9 +40,10 @@ | |||
41 | #include <acpi/acpi_bus.h> | 40 | #include <acpi/acpi_bus.h> |
42 | #include <asm/cpu_device_id.h> | 41 | #include <asm/cpu_device_id.h> |
43 | #include <asm/iosf_mbi.h> | 42 | #include <asm/iosf_mbi.h> |
43 | #include <sound/soc-acpi.h> | ||
44 | #include <sound/soc-acpi-intel-match.h> | ||
44 | #include "../sst-mfld-platform.h" | 45 | #include "../sst-mfld-platform.h" |
45 | #include "../../common/sst-dsp.h" | 46 | #include "../../common/sst-dsp.h" |
46 | #include "../../common/sst-acpi.h" | ||
47 | #include "sst.h" | 47 | #include "sst.h" |
48 | 48 | ||
49 | /* LPE viewpoint addresses */ | 49 | /* LPE viewpoint addresses */ |
@@ -239,19 +239,26 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx) | |||
239 | return 0; | 239 | return 0; |
240 | } | 240 | } |
241 | 241 | ||
242 | static int is_byt(void) | ||
243 | { | ||
244 | bool status = false; | ||
245 | static const struct x86_cpu_id cpu_ids[] = { | ||
246 | { X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */ | ||
247 | {} | ||
248 | }; | ||
249 | if (x86_match_cpu(cpu_ids)) | ||
250 | status = true; | ||
251 | return status; | ||
252 | } | ||
242 | 253 | ||
243 | static int is_byt_cr(struct device *dev, bool *bytcr) | 254 | static int is_byt_cr(struct device *dev, bool *bytcr) |
244 | { | 255 | { |
245 | int status = 0; | 256 | int status = 0; |
246 | 257 | ||
247 | if (IS_ENABLED(CONFIG_IOSF_MBI)) { | 258 | if (IS_ENABLED(CONFIG_IOSF_MBI)) { |
248 | static const struct x86_cpu_id cpu_ids[] = { | ||
249 | { X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */ | ||
250 | {} | ||
251 | }; | ||
252 | u32 bios_status; | 259 | u32 bios_status; |
253 | 260 | ||
254 | if (!x86_match_cpu(cpu_ids) || !iosf_mbi_available()) { | 261 | if (!is_byt() || !iosf_mbi_available()) { |
255 | /* bail silently */ | 262 | /* bail silently */ |
256 | return status; | 263 | return status; |
257 | } | 264 | } |
@@ -285,7 +292,7 @@ static int sst_acpi_probe(struct platform_device *pdev) | |||
285 | int ret = 0; | 292 | int ret = 0; |
286 | struct intel_sst_drv *ctx; | 293 | struct intel_sst_drv *ctx; |
287 | const struct acpi_device_id *id; | 294 | const struct acpi_device_id *id; |
288 | struct sst_acpi_mach *mach; | 295 | struct snd_soc_acpi_mach *mach; |
289 | struct platform_device *mdev; | 296 | struct platform_device *mdev; |
290 | struct platform_device *plat_dev; | 297 | struct platform_device *plat_dev; |
291 | struct sst_platform_info *pdata; | 298 | struct sst_platform_info *pdata; |
@@ -297,13 +304,17 @@ static int sst_acpi_probe(struct platform_device *pdev) | |||
297 | return -ENODEV; | 304 | return -ENODEV; |
298 | dev_dbg(dev, "for %s\n", id->id); | 305 | dev_dbg(dev, "for %s\n", id->id); |
299 | 306 | ||
300 | mach = (struct sst_acpi_mach *)id->driver_data; | 307 | mach = (struct snd_soc_acpi_mach *)id->driver_data; |
301 | mach = sst_acpi_find_machine(mach); | 308 | mach = snd_soc_acpi_find_machine(mach); |
302 | if (mach == NULL) { | 309 | if (mach == NULL) { |
303 | dev_err(dev, "No matching machine driver found\n"); | 310 | dev_err(dev, "No matching machine driver found\n"); |
304 | return -ENODEV; | 311 | return -ENODEV; |
305 | } | 312 | } |
306 | 313 | ||
314 | if (is_byt()) | ||
315 | mach->pdata = &byt_rvp_platform_data; | ||
316 | else | ||
317 | mach->pdata = &chv_platform_data; | ||
307 | pdata = mach->pdata; | 318 | pdata = mach->pdata; |
308 | 319 | ||
309 | ret = kstrtouint(id->id, 16, &dev_id); | 320 | ret = kstrtouint(id->id, 16, &dev_id); |
@@ -381,286 +392,9 @@ static int sst_acpi_remove(struct platform_device *pdev) | |||
381 | return 0; | 392 | return 0; |
382 | } | 393 | } |
383 | 394 | ||
384 | static unsigned long cht_machine_id; | ||
385 | |||
386 | #define CHT_SURFACE_MACH 1 | ||
387 | #define BYT_THINKPAD_10 2 | ||
388 | |||
389 | static int cht_surface_quirk_cb(const struct dmi_system_id *id) | ||
390 | { | ||
391 | cht_machine_id = CHT_SURFACE_MACH; | ||
392 | return 1; | ||
393 | } | ||
394 | |||
395 | static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id) | ||
396 | { | ||
397 | cht_machine_id = BYT_THINKPAD_10; | ||
398 | return 1; | ||
399 | } | ||
400 | |||
401 | |||
402 | static const struct dmi_system_id byt_table[] = { | ||
403 | { | ||
404 | .callback = byt_thinkpad10_quirk_cb, | ||
405 | .matches = { | ||
406 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
407 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 10"), | ||
408 | }, | ||
409 | }, | ||
410 | { | ||
411 | .callback = byt_thinkpad10_quirk_cb, | ||
412 | .matches = { | ||
413 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
414 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Tablet B"), | ||
415 | }, | ||
416 | }, | ||
417 | { | ||
418 | .callback = byt_thinkpad10_quirk_cb, | ||
419 | .matches = { | ||
420 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
421 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Miix 2 10"), | ||
422 | }, | ||
423 | }, | ||
424 | { } | ||
425 | }; | ||
426 | |||
427 | static const struct dmi_system_id cht_table[] = { | ||
428 | { | ||
429 | .callback = cht_surface_quirk_cb, | ||
430 | .matches = { | ||
431 | DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), | ||
432 | DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), | ||
433 | }, | ||
434 | }, | ||
435 | { } | ||
436 | }; | ||
437 | |||
438 | |||
439 | static struct sst_acpi_mach cht_surface_mach = { | ||
440 | .id = "10EC5640", | ||
441 | .drv_name = "cht-bsw-rt5645", | ||
442 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
443 | .board = "cht-bsw", | ||
444 | .pdata = &chv_platform_data, | ||
445 | }; | ||
446 | |||
447 | static struct sst_acpi_mach byt_thinkpad_10 = { | ||
448 | .id = "10EC5640", | ||
449 | .drv_name = "cht-bsw-rt5672", | ||
450 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
451 | .board = "cht-bsw", | ||
452 | .pdata = &byt_rvp_platform_data, | ||
453 | }; | ||
454 | |||
455 | static struct sst_acpi_mach *cht_quirk(void *arg) | ||
456 | { | ||
457 | struct sst_acpi_mach *mach = arg; | ||
458 | |||
459 | dmi_check_system(cht_table); | ||
460 | |||
461 | if (cht_machine_id == CHT_SURFACE_MACH) | ||
462 | return &cht_surface_mach; | ||
463 | else | ||
464 | return mach; | ||
465 | } | ||
466 | |||
467 | static struct sst_acpi_mach *byt_quirk(void *arg) | ||
468 | { | ||
469 | struct sst_acpi_mach *mach = arg; | ||
470 | |||
471 | dmi_check_system(byt_table); | ||
472 | |||
473 | if (cht_machine_id == BYT_THINKPAD_10) | ||
474 | return &byt_thinkpad_10; | ||
475 | else | ||
476 | return mach; | ||
477 | } | ||
478 | |||
479 | |||
480 | static struct sst_acpi_mach sst_acpi_bytcr[] = { | ||
481 | { | ||
482 | .id = "10EC5640", | ||
483 | .drv_name = "bytcr_rt5640", | ||
484 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
485 | .board = "bytcr_rt5640", | ||
486 | .machine_quirk = byt_quirk, | ||
487 | .pdata = &byt_rvp_platform_data, | ||
488 | }, | ||
489 | { | ||
490 | .id = "10EC5642", | ||
491 | .drv_name = "bytcr_rt5640", | ||
492 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
493 | .board = "bytcr_rt5640", | ||
494 | .pdata = &byt_rvp_platform_data | ||
495 | }, | ||
496 | { | ||
497 | .id = "INTCCFFD", | ||
498 | .drv_name = "bytcr_rt5640", | ||
499 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
500 | .board = "bytcr_rt5640", | ||
501 | .pdata = &byt_rvp_platform_data | ||
502 | }, | ||
503 | { | ||
504 | .id = "10EC5651", | ||
505 | .drv_name = "bytcr_rt5651", | ||
506 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
507 | .board = "bytcr_rt5651", | ||
508 | .pdata = &byt_rvp_platform_data | ||
509 | }, | ||
510 | { | ||
511 | .id = "DLGS7212", | ||
512 | .drv_name = "bytcht_da7213", | ||
513 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
514 | .board = "bytcht_da7213", | ||
515 | .pdata = &byt_rvp_platform_data | ||
516 | }, | ||
517 | { | ||
518 | .id = "DLGS7213", | ||
519 | .drv_name = "bytcht_da7213", | ||
520 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
521 | .board = "bytcht_da7213", | ||
522 | .pdata = &byt_rvp_platform_data | ||
523 | }, | ||
524 | /* some Baytrail platforms rely on RT5645, use CHT machine driver */ | ||
525 | { | ||
526 | .id = "10EC5645", | ||
527 | .drv_name = "cht-bsw-rt5645", | ||
528 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
529 | .board = "cht-bsw", | ||
530 | .pdata = &byt_rvp_platform_data | ||
531 | }, | ||
532 | { | ||
533 | .id = "10EC5648", | ||
534 | .drv_name = "cht-bsw-rt5645", | ||
535 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
536 | .board = "cht-bsw", | ||
537 | .pdata = &byt_rvp_platform_data | ||
538 | }, | ||
539 | #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) | ||
540 | /* | ||
541 | * This is always last in the table so that it is selected only when | ||
542 | * enabled explicitly and there is no codec-related information in SSDT | ||
543 | */ | ||
544 | { | ||
545 | .id = "80860F28", | ||
546 | .drv_name = "bytcht_nocodec", | ||
547 | .fw_filename = "intel/fw_sst_0f28.bin", | ||
548 | .board = "bytcht_nocodec", | ||
549 | .pdata = &byt_rvp_platform_data | ||
550 | }, | ||
551 | #endif | ||
552 | {}, | ||
553 | }; | ||
554 | |||
555 | /* Cherryview-based platforms: CherryTrail and Braswell */ | ||
556 | static struct sst_acpi_mach sst_acpi_chv[] = { | ||
557 | { | ||
558 | .id = "10EC5670", | ||
559 | .drv_name = "cht-bsw-rt5672", | ||
560 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
561 | .board = "cht-bsw", | ||
562 | .pdata = &chv_platform_data | ||
563 | }, | ||
564 | { | ||
565 | .id = "10EC5672", | ||
566 | .drv_name = "cht-bsw-rt5672", | ||
567 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
568 | .board = "cht-bsw", | ||
569 | .pdata = &chv_platform_data | ||
570 | }, | ||
571 | { | ||
572 | .id = "10EC5645", | ||
573 | .drv_name = "cht-bsw-rt5645", | ||
574 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
575 | .board = "cht-bsw", | ||
576 | .pdata = &chv_platform_data | ||
577 | }, | ||
578 | { | ||
579 | .id = "10EC5650", | ||
580 | .drv_name = "cht-bsw-rt5645", | ||
581 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
582 | .board = "cht-bsw", | ||
583 | .pdata = &chv_platform_data | ||
584 | }, | ||
585 | { | ||
586 | .id = "10EC3270", | ||
587 | .drv_name = "cht-bsw-rt5645", | ||
588 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
589 | .board = "cht-bsw", | ||
590 | .pdata = &chv_platform_data | ||
591 | }, | ||
592 | |||
593 | { | ||
594 | .id = "193C9890", | ||
595 | .drv_name = "cht-bsw-max98090", | ||
596 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
597 | .board = "cht-bsw", | ||
598 | .pdata = &chv_platform_data | ||
599 | }, | ||
600 | { | ||
601 | .id = "DLGS7212", | ||
602 | .drv_name = "bytcht_da7213", | ||
603 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
604 | .board = "bytcht_da7213", | ||
605 | .pdata = &chv_platform_data | ||
606 | }, | ||
607 | { | ||
608 | .id = "DLGS7213", | ||
609 | .drv_name = "bytcht_da7213", | ||
610 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
611 | .board = "bytcht_da7213", | ||
612 | .pdata = &chv_platform_data | ||
613 | }, | ||
614 | { | ||
615 | .id = "ESSX8316", | ||
616 | .drv_name = "bytcht_es8316", | ||
617 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
618 | .board = "bytcht_es8316", | ||
619 | .pdata = &chv_platform_data | ||
620 | }, | ||
621 | /* some CHT-T platforms rely on RT5640, use Baytrail machine driver */ | ||
622 | { | ||
623 | .id = "10EC5640", | ||
624 | .drv_name = "bytcr_rt5640", | ||
625 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
626 | .board = "bytcr_rt5640", | ||
627 | .machine_quirk = cht_quirk, | ||
628 | .pdata = &chv_platform_data | ||
629 | }, | ||
630 | { | ||
631 | .id = "10EC3276", | ||
632 | .drv_name = "bytcr_rt5640", | ||
633 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
634 | .board = "bytcr_rt5640", | ||
635 | .pdata = &chv_platform_data | ||
636 | }, | ||
637 | /* some CHT-T platforms rely on RT5651, use Baytrail machine driver */ | ||
638 | { | ||
639 | .id = "10EC5651", | ||
640 | .drv_name = "bytcr_rt5651", | ||
641 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
642 | .board = "bytcr_rt5651", | ||
643 | .pdata = &chv_platform_data | ||
644 | }, | ||
645 | #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) | ||
646 | /* | ||
647 | * This is always last in the table so that it is selected only when | ||
648 | * enabled explicitly and there is no codec-related information in SSDT | ||
649 | */ | ||
650 | { | ||
651 | .id = "808622A8", | ||
652 | .drv_name = "bytcht_nocodec", | ||
653 | .fw_filename = "intel/fw_sst_22a8.bin", | ||
654 | .board = "bytcht_nocodec", | ||
655 | .pdata = &chv_platform_data | ||
656 | }, | ||
657 | #endif | ||
658 | {}, | ||
659 | }; | ||
660 | |||
661 | static const struct acpi_device_id sst_acpi_ids[] = { | 395 | static const struct acpi_device_id sst_acpi_ids[] = { |
662 | { "80860F28", (unsigned long)&sst_acpi_bytcr}, | 396 | { "80860F28", (unsigned long)&snd_soc_acpi_intel_baytrail_machines}, |
663 | { "808622A8", (unsigned long) &sst_acpi_chv}, | 397 | { "808622A8", (unsigned long)&snd_soc_acpi_intel_cherrytrail_machines}, |
664 | { }, | 398 | { }, |
665 | }; | 399 | }; |
666 | 400 | ||