Angel Pons | 96d93d1 | 2020-04-05 13:22:23 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 2 | |
| 3 | #include <types.h> |
Kyösti Mälkki | 3fccec5 | 2020-06-18 13:46:31 +0300 | [diff] [blame] | 4 | #include <cpu/x86/smm.h> |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 5 | #include <device/device.h> |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 6 | #include <drivers/intel/gma/int15.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 7 | #include <acpi/acpi.h> |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 8 | #include "onboard.h" |
| 9 | #include "ec.h" |
| 10 | #include <southbridge/intel/bd82x6x/pch.h> |
| 11 | #include <smbios.h> |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 12 | #include <ec/compal/ene932/ec.h> |
| 13 | |
| 14 | void mainboard_suspend_resume(void) |
| 15 | { |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 16 | /* Enable ACPI mode before OS resume */ |
Kyösti Mälkki | 3fccec5 | 2020-06-18 13:46:31 +0300 | [diff] [blame] | 17 | apm_control(APM_CNT_ACPI_ENABLE); |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 18 | } |
| 19 | |
Elyes HAOUAS | d129d43 | 2018-05-04 20:23:33 +0200 | [diff] [blame] | 20 | static void mainboard_init(struct device *dev) |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 21 | { |
| 22 | /* Initialize the Embedded Controller */ |
| 23 | parrot_ec_init(); |
| 24 | } |
| 25 | |
Elyes HAOUAS | d129d43 | 2018-05-04 20:23:33 +0200 | [diff] [blame] | 26 | static int parrot_onboard_smbios_data(struct device *dev, int *handle, |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 27 | unsigned long *current) |
| 28 | { |
| 29 | int len = 0; |
| 30 | u8 hardware_version = parrot_rev(); |
| 31 | if (hardware_version < 0x2) { /* DVT vs PVT */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 32 | len += smbios_write_type41( |
| 33 | current, handle, |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 34 | BOARD_TRACKPAD_NAME, /* name */ |
| 35 | BOARD_TRACKPAD_IRQ_DVT, /* instance */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 36 | 0, /* segment */ |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 37 | BOARD_TRACKPAD_I2C_ADDR, /* bus */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 38 | 0, /* device */ |
Christian Walter | e6afab1 | 2019-05-21 17:22:49 +0200 | [diff] [blame] | 39 | 0, /* function */ |
| 40 | SMBIOS_DEVICE_TYPE_OTHER); /* device type */ |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 41 | } else { |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 42 | len += smbios_write_type41( |
| 43 | current, handle, |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 44 | BOARD_TRACKPAD_NAME, /* name */ |
| 45 | BOARD_TRACKPAD_IRQ_PVT, /* instance */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 46 | 0, /* segment */ |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 47 | BOARD_TRACKPAD_I2C_ADDR, /* bus */ |
Duncan Laurie | 21a7870 | 2013-05-23 14:17:05 -0700 | [diff] [blame] | 48 | 0, /* device */ |
Christian Walter | e6afab1 | 2019-05-21 17:22:49 +0200 | [diff] [blame] | 49 | 0, /* function */ |
| 50 | SMBIOS_DEVICE_TYPE_OTHER); /* device type */ |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 51 | } |
| 52 | |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 53 | return len; |
| 54 | } |
| 55 | |
Elyes HAOUAS | d129d43 | 2018-05-04 20:23:33 +0200 | [diff] [blame] | 56 | static void mainboard_enable(struct device *dev) |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 57 | { |
| 58 | dev->ops->init = mainboard_init; |
| 59 | dev->ops->get_smbios_data = parrot_onboard_smbios_data; |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 60 | install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | struct chip_operations mainboard_ops = { |
Stefan Reinauer | a7198b3 | 2012-12-11 16:00:47 -0800 | [diff] [blame] | 64 | .enable_dev = mainboard_enable, |
| 65 | }; |