payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / intel / kunimitsu / mainboard.c
blobb7c61f50584a24768bfee89179ddab6fd1d6d848
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi.h>
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <gpio.h>
7 #include <soc/nhlt.h>
8 #include "ec.h"
9 #include "gpio.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)
16 mainboard_ec_init();
19 static uint8_t select_audio_codec(void)
21 int audio_db_sel = gpio_get(AUDIO_DB_ID);
23 return audio_db_sel;
26 static unsigned long mainboard_write_acpi_tables(
27 const struct device *device, unsigned long current, acpi_rsdp_t *rsdp)
29 uintptr_t start_addr;
30 uintptr_t end_addr;
31 struct nhlt *nhlt;
32 const char *oem_id = NULL;
33 const char *oem_table_id = NULL;
35 start_addr = current;
37 nhlt = nhlt_init();
39 if (nhlt == NULL)
40 return start_addr;
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");
54 } else {
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);
73 return end_addr;
77 * mainboard_enable is executed as first thing after
78 * enumerate_buses().
80 static void mainboard_enable(struct device *dev)
82 dev->ops->init = mainboard_init;
83 dev->ops->write_acpi_tables = mainboard_write_acpi_tables;
86 struct chip_operations mainboard_ops = {
87 .enable_dev = mainboard_enable,