Angel Pons | c80e350 | 2020-04-03 01:21:49 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 2 | |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 3 | #include <device/device.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 4 | #include <device/pci_ops.h> |
Patrick Georgi | 33cfe9b | 2014-09-06 17:23:30 +0200 | [diff] [blame] | 5 | #include <drivers/intel/gma/int15.h> |
Vladimir Serbinenko | 6a3a8ce | 2014-08-17 23:48:42 +0200 | [diff] [blame] | 6 | |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 7 | |
Sven Schnelle | 7592e8b | 2011-01-27 11:43:03 +0000 | [diff] [blame] | 8 | #include "ec_oem.c" |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 9 | |
Vladimir Serbinenko | 0e64617 | 2014-08-31 00:27:05 +0200 | [diff] [blame] | 10 | #include "mainboard.h" |
| 11 | |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 12 | #define MAX_LCD_BRIGHTNESS 0xd8 |
| 13 | |
Stefan Reinauer | 5ff7c13 | 2011-10-31 12:56:45 -0700 | [diff] [blame] | 14 | static void ec_enable(void) |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 15 | { |
| 16 | u16 keymap; |
| 17 | /* Enable Hotkey SCI */ |
| 18 | |
| 19 | /* Fn key map; F1 = [0] ... F12 = [11] */ |
| 20 | keymap = 0x5f1; |
| 21 | send_ec_oem_command(0x45); |
| 22 | send_ec_oem_data(0x09); // SCI |
| 23 | // send_ec_oem_data(0x08); // SMI# |
| 24 | send_ec_oem_data(keymap >> 8); |
| 25 | send_ec_oem_data(keymap & 0xff); |
| 26 | |
| 27 | /* Enable Backlight */ |
| 28 | ec_write(0x17, MAX_LCD_BRIGHTNESS); |
| 29 | |
| 30 | /* Notify EC system is in ACPI mode */ |
| 31 | send_ec_oem_command(0x5e); |
| 32 | send_ec_oem_data(0xea); |
| 33 | send_ec_oem_data(0x0c); |
| 34 | send_ec_oem_data(0x01); |
| 35 | } |
| 36 | |
Elyes HAOUAS | 5bb159a | 2018-05-04 20:17:55 +0200 | [diff] [blame] | 37 | static void mainboard_init(struct device *dev) |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 38 | { |
| 39 | ec_enable(); |
Patrick Georgi | 33cfe9b | 2014-09-06 17:23:30 +0200 | [diff] [blame] | 40 | install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_TXT_STRETCH, 0, 3); |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 41 | } |
| 42 | |
Elyes HAOUAS | 5bb159a | 2018-05-04 20:17:55 +0200 | [diff] [blame] | 43 | static void mainboard_enable(struct device *dev) |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 44 | { |
| 45 | dev->ops->init = mainboard_init; |
Vladimir Serbinenko | 0e64617 | 2014-08-31 00:27:05 +0200 | [diff] [blame] | 46 | dev->ops->write_acpi_tables = mainboard_write_acpi_tables; |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 47 | } |
| 48 | |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 49 | struct chip_operations mainboard_ops = { |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 50 | .enable_dev = mainboard_enable, |
| 51 | }; |