1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi_device.h>
4 #include <acpi/acpigen.h>
5 #include <console/console.h>
6 #include <device/device.h>
7 #include <device/path.h>
10 #if CONFIG(HAVE_ACPI_TABLES)
12 #define ADAU7002_ACPI_NAME "ADAU"
13 #define ADAU7002_ACPI_HID "ADAU7002"
15 static void adau7002_fill_ssdt(const struct device
*dev
)
17 struct drivers_generic_adau7002_config
*config
;
23 const char *scope
= acpi_device_scope(dev
);
24 const char *name
= acpi_device_name(dev
);
29 acpigen_write_scope(scope
);
30 acpigen_write_device(name
);
31 acpigen_write_name_string("_HID", ADAU7002_ACPI_HID
);
32 acpigen_write_name_integer("_UID", 0);
33 acpigen_write_name_string("_DDN", dev
->chip_ops
->name
);
34 acpigen_write_STA(acpi_device_status(dev
));
36 /* _DSD for devicetree properties */
37 config
= dev
->chip_info
;
38 dp
= acpi_dp_new_table("_DSD");
39 acpi_dp_add_integer(dp
, "wakeup-delay-ms", config
->wakeup_delay
);
42 acpigen_pop_len(); /* Device */
43 acpigen_pop_len(); /* Scope */
45 printk(BIOS_INFO
, "%s: %s\n", acpi_device_path(dev
),
49 static const char *adau7002_acpi_name(const struct device
*dev
)
51 return ADAU7002_ACPI_NAME
;
55 static struct device_operations adau7002_ops
= {
56 .read_resources
= noop_read_resources
,
57 .set_resources
= noop_set_resources
,
58 #if CONFIG(HAVE_ACPI_TABLES)
59 .acpi_name
= adau7002_acpi_name
,
60 .acpi_fill_ssdt
= adau7002_fill_ssdt
,
64 static void adau7002_enable(struct device
*dev
)
66 dev
->ops
= &adau7002_ops
;
69 struct chip_operations drivers_generic_adau7002_ops
= {
70 CHIP_NAME("Analog Digital DMIC")
71 .enable_dev
= adau7002_enable