1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <console/console.h>
5 #include <device/device.h>
11 static const char *oem_id_maxim
= "INTEL";
12 static const char *oem_table_id_maxim
= "SCRDMAX";
14 static void mainboard_init(struct device
*dev
)
19 static uint8_t select_audio_codec(void)
21 int audio_db_sel
= gpio_get(AUDIO_DB_ID
);
26 static unsigned long mainboard_write_acpi_tables(
27 const struct device
*device
, unsigned long current
, acpi_rsdp_t
*rsdp
)
32 const char *oem_id
= NULL
;
33 const char *oem_table_id
= NULL
;
42 /* 2 Channel DMIC array. */
43 if (nhlt_soc_add_dmic_array(nhlt
, 2))
44 printk(BIOS_ERR
, "Couldn't add 2CH DMIC array.\n");
46 /* 4 Channel DMIC array. */
47 if (nhlt_soc_add_dmic_array(nhlt
, 4))
48 printk(BIOS_ERR
, "Couldn't add 4CH DMIC arrays.\n");
50 if (select_audio_codec()) {
51 /* ADI Smart Amps for left and right. */
52 if (nhlt_soc_add_ssm4567(nhlt
, AUDIO_LINK_SSP0
))
53 printk(BIOS_ERR
, "Couldn't add ssm4567.\n");
55 /* MAXIM Smart Amps for left and right. */
56 if (nhlt_soc_add_max98357(nhlt
, AUDIO_LINK_SSP0
))
57 printk(BIOS_ERR
, "Couldn't add max98357.\n");
59 oem_id
= oem_id_maxim
;
60 oem_table_id
= oem_table_id_maxim
;
63 /* NAU88l25 Headset codec. */
64 if (nhlt_soc_add_nau88l25(nhlt
, AUDIO_LINK_SSP1
))
65 printk(BIOS_ERR
, "Couldn't add headset codec.\n");
67 end_addr
= nhlt_soc_serialize_oem_overrides(nhlt
, start_addr
,
68 oem_id
, oem_table_id
, 0);
70 if (end_addr
!= start_addr
)
71 acpi_add_table(rsdp
, (void *)start_addr
);
76 static void mainboard_enable(struct device
*dev
)
78 dev
->ops
->init
= mainboard_init
;
79 dev
->ops
->write_acpi_tables
= mainboard_write_acpi_tables
;
82 struct chip_operations mainboard_ops
= {
83 .enable_dev
= mainboard_enable
,