blob: 0605b5ffa4b0daa91b9264a379949b34d3cc731c [file] [log] [blame]
Angel Ponsd32b6de2020-04-03 01:23:13 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauer155e9b52012-04-27 23:19:58 +02002
3#include <types.h>
Stefan Reinauer155e9b52012-04-27 23:19:58 +02004#include <device/device.h>
Vladimir Serbinenkoa2a906e2014-09-01 01:41:37 +02005#include <drivers/intel/gma/int15.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -07006#include <acpi/acpi.h>
Stefan Reinauer155e9b52012-04-27 23:19:58 +02007#include <ec/smsc/mec1308/ec.h>
Stefan Reinauer155e9b52012-04-27 23:19:58 +02008#include "ec.h"
9#include "onboard.h"
10#include <southbridge/intel/bd82x6x/pch.h>
11#include <smbios.h>
12
13void mainboard_suspend_resume(void)
14{
Stefan Reinauer155e9b52012-04-27 23:19:58 +020015 /* 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 HAOUAS5cb876c2018-06-08 18:31:43 +020020static void mainboard_init(struct device *dev)
Stefan Reinauer155e9b52012-04-27 23:19:58 +020021{
22 /* Initialize the Embedded Controller */
23 lumpy_ec_init();
24}
25
Stefan Reinauer155e9b52012-04-27 23:19:58 +020026static int lumpy_smbios_type41_irq(int *handle, unsigned long *current,
27 const char *name, u8 irq, u8 addr)
28{
Angel Ponsd62a5012021-06-28 17:18:06 +020029 struct smbios_type41 *t = smbios_carve_table(*current,
30 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION,
31 sizeof(*t), *handle);
Stefan Reinauer155e9b52012-04-27 23:19:58 +020032
Stefan Reinauer155e9b52012-04-27 23:19:58 +020033 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 Ponsa37701a2021-06-28 17:36:53 +020042 const int len = smbios_full_table_len(&t->header, t->eos);
Stefan Reinauer155e9b52012-04-27 23:19:58 +020043 *current += len;
44 *handle += 1;
45 return len;
46}
47
48
Elyes HAOUAS5cb876c2018-06-08 18:31:43 +020049static int lumpy_onboard_smbios_data(struct device *dev, int *handle,
Stefan Reinauer155e9b52012-04-27 23:19:58 +020050 unsigned long *current)
51{
52 int len = 0;
53
54 len += lumpy_smbios_type41_irq(handle, current,
Kyösti Mälkkib9cd5ec2015-04-24 16:05:58 +030055 BOARD_LIGHTSENSOR_NAME,
56 BOARD_LIGHTSENSOR_IRQ,
57 BOARD_LIGHTSENSOR_I2C_ADDR);
Stefan Reinauer155e9b52012-04-27 23:19:58 +020058
59 len += lumpy_smbios_type41_irq(handle, current,
Kyösti Mälkkib9cd5ec2015-04-24 16:05:58 +030060 BOARD_TRACKPAD_NAME,
61 BOARD_TRACKPAD_IRQ,
62 BOARD_TRACKPAD_I2C_ADDR);
Stefan Reinauer155e9b52012-04-27 23:19:58 +020063
64 return len;
65}
66
Kyösti Mälkki9ead80f2012-08-28 07:49:49 +030067// mainboard_enable is executed as first thing after
68// enumerate_buses().
69
Elyes HAOUAS5cb876c2018-06-08 18:31:43 +020070static void mainboard_enable(struct device *dev)
Kyösti Mälkki9ead80f2012-08-28 07:49:49 +030071{
72 dev->ops->init = mainboard_init;
73 dev->ops->get_smbios_data = lumpy_onboard_smbios_data;
Vladimir Serbinenkoa2a906e2014-09-01 01:41:37 +020074 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älkki9ead80f2012-08-28 07:49:49 +030075}
76
Stefan Reinauer155e9b52012-04-27 23:19:58 +020077struct chip_operations mainboard_ops = {
Stefan Reinauer155e9b52012-04-27 23:19:58 +020078 .enable_dev = mainboard_enable,
Stefan Reinauer155e9b52012-04-27 23:19:58 +020079};