Angel Pons | d32b6de | 2020-04-03 01:23:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 2 | |
| 3 | #include <types.h> |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 4 | #include <device/device.h> |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 5 | #include <drivers/intel/gma/int15.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 6 | #include <acpi/acpi.h> |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 7 | #include <ec/smsc/mec1308/ec.h> |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 8 | #include "ec.h" |
| 9 | #include "onboard.h" |
| 10 | #include <southbridge/intel/bd82x6x/pch.h> |
| 11 | #include <smbios.h> |
| 12 | |
| 13 | void mainboard_suspend_resume(void) |
| 14 | { |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 15 | /* Enable EC ACPI mode for the OS before resume */ |
| 16 | send_ec_command(EC_SMI_DISABLE); |
| 17 | send_ec_command(EC_ACPI_ENABLE); |
| 18 | } |
| 19 | |
Elyes HAOUAS | 5cb876c | 2018-06-08 18:31:43 +0200 | [diff] [blame] | 20 | static void mainboard_init(struct device *dev) |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 21 | { |
| 22 | /* Initialize the Embedded Controller */ |
| 23 | lumpy_ec_init(); |
| 24 | } |
| 25 | |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 26 | static int lumpy_smbios_type41_irq(int *handle, unsigned long *current, |
| 27 | const char *name, u8 irq, u8 addr) |
| 28 | { |
Angel Pons | d62a501 | 2021-06-28 17:18:06 +0200 | [diff] [blame] | 29 | struct smbios_type41 *t = smbios_carve_table(*current, |
| 30 | SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION, |
| 31 | sizeof(*t), *handle); |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 32 | |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 33 | t->reference_designation = smbios_add_string(t->eos, name); |
| 34 | t->device_type = SMBIOS_DEVICE_TYPE_OTHER; |
| 35 | t->device_status = 1; |
| 36 | t->device_type_instance = irq; |
| 37 | t->segment_group_number = 0; |
| 38 | t->bus_number = addr; |
| 39 | t->function_number = 0; |
| 40 | t->device_number = 0; |
| 41 | |
Angel Pons | a37701a | 2021-06-28 17:36:53 +0200 | [diff] [blame] | 42 | const int len = smbios_full_table_len(&t->header, t->eos); |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 43 | *current += len; |
| 44 | *handle += 1; |
| 45 | return len; |
| 46 | } |
| 47 | |
| 48 | |
Elyes HAOUAS | 5cb876c | 2018-06-08 18:31:43 +0200 | [diff] [blame] | 49 | static int lumpy_onboard_smbios_data(struct device *dev, int *handle, |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 50 | unsigned long *current) |
| 51 | { |
| 52 | int len = 0; |
| 53 | |
| 54 | len += lumpy_smbios_type41_irq(handle, current, |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 55 | BOARD_LIGHTSENSOR_NAME, |
| 56 | BOARD_LIGHTSENSOR_IRQ, |
| 57 | BOARD_LIGHTSENSOR_I2C_ADDR); |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 58 | |
| 59 | len += lumpy_smbios_type41_irq(handle, current, |
Kyösti Mälkki | b9cd5ec | 2015-04-24 16:05:58 +0300 | [diff] [blame] | 60 | BOARD_TRACKPAD_NAME, |
| 61 | BOARD_TRACKPAD_IRQ, |
| 62 | BOARD_TRACKPAD_I2C_ADDR); |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 63 | |
| 64 | return len; |
| 65 | } |
| 66 | |
Kyösti Mälkki | 9ead80f | 2012-08-28 07:49:49 +0300 | [diff] [blame] | 67 | // mainboard_enable is executed as first thing after |
| 68 | // enumerate_buses(). |
| 69 | |
Elyes HAOUAS | 5cb876c | 2018-06-08 18:31:43 +0200 | [diff] [blame] | 70 | static void mainboard_enable(struct device *dev) |
Kyösti Mälkki | 9ead80f | 2012-08-28 07:49:49 +0300 | [diff] [blame] | 71 | { |
| 72 | dev->ops->init = mainboard_init; |
| 73 | dev->ops->get_smbios_data = lumpy_onboard_smbios_data; |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 74 | install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); |
Kyösti Mälkki | 9ead80f | 2012-08-28 07:49:49 +0300 | [diff] [blame] | 75 | } |
| 76 | |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 77 | struct chip_operations mainboard_ops = { |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 78 | .enable_dev = mainboard_enable, |
Stefan Reinauer | 155e9b5 | 2012-04-27 23:19:58 +0200 | [diff] [blame] | 79 | }; |