Tim Wawrzynczak | 103bd5e | 2020-05-29 13:11:00 -0600 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <acpi/acpigen.h> |
| 4 | #include <console/console.h> |
| 5 | #include <device/device.h> |
| 6 | #include "chip.h" |
| 7 | |
| 8 | static const char *dptf_acpi_name(const struct device *dev) |
| 9 | { |
| 10 | return "DPTF"; |
| 11 | } |
| 12 | |
| 13 | /* Add custom tables and methods to SSDT */ |
| 14 | static void dptf_fill_ssdt(const struct device *dev) |
| 15 | { |
| 16 | struct drivers_intel_dptf_config *config = dev->chip_info; |
| 17 | |
| 18 | printk(BIOS_INFO, "\\_SB.DPTF: %s at %s\n", dev->chip_ops->name, dev_path(dev)); |
| 19 | } |
| 20 | |
| 21 | /* Add static definitions of DPTF devices into the DSDT */ |
| 22 | static void dptf_inject_dsdt(const struct device *dev) |
| 23 | { |
| 24 | const struct drivers_intel_dptf_config *config; |
| 25 | |
| 26 | config = dev->chip_info; |
| 27 | acpigen_write_scope("\\_SB"); |
| 28 | |
| 29 | /* Toplevel DPTF device */ |
| 30 | acpigen_write_device(acpi_device_name(dev)); |
| 31 | acpigen_write_name("_HID"); |
| 32 | acpigen_emit_eisaid("INT3400"); |
| 33 | acpigen_write_name_integer("_UID", 0); |
| 34 | dptf_write_STA(); |
| 35 | |
| 36 | acpigen_pop_len(); /* DPTF Device */ |
| 37 | acpigen_pop_len(); /* Scope */ |
| 38 | } |
| 39 | |
| 40 | static struct device_operations dptf_ops = { |
| 41 | .read_resources = noop_read_resources, |
| 42 | .set_resources = noop_set_resources, |
| 43 | .acpi_name = dptf_acpi_name, |
| 44 | .acpi_fill_ssdt = dptf_fill_ssdt, |
| 45 | .acpi_inject_dsdt = dptf_inject_dsdt, |
| 46 | }; |
| 47 | |
| 48 | static void dptf_enable_dev(struct device *dev) |
| 49 | { |
| 50 | dev->ops = &dptf_ops; |
| 51 | } |
| 52 | |
| 53 | struct chip_operations drivers_intel_dptf_ops = { |
| 54 | CHIP_NAME("Intel DPTF") |
| 55 | .enable_dev = dptf_enable_dev, |
| 56 | }; |