2 * This file is part of the coreboot project.
4 * Copyright (C) 2014 Vladimir Serbinenko
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2, or (at your
9 * option) any later version, of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #include <console/console.h>
19 #include <arch/acpi.h>
20 #include <arch/acpigen.h>
21 #include <device/device.h>
22 #include <device/pnp.h>
25 #include "drivers/i2c/at24rf08c/lenovo.h"
27 static const char tablet_numbers
[][5] = {
29 "6363", "6364", "6365", "6366",
30 "6367", "6368", "7762", "7763",
31 "7764", "7767", "7768", "7769",
33 "7448", "7449", "7450", "7453",
35 "0053", "0831", "2985", "3093",
36 "3113", "3144", "3239", "4184",
41 drivers_lenovo_is_wacom_present(void)
45 static int result
= -1;
52 if (IS_ENABLED(CONFIG_DIGITIZER_PRESENT
)) {
53 printk (BIOS_INFO
, "Digitizer state forced as present\n");
57 if (IS_ENABLED(CONFIG_DIGITIZER_ABSENT
)) {
58 printk (BIOS_INFO
, "Digitizer state forced as absent\n");
62 superio
= dev_find_slot_pnp (0x164e, 3);
64 printk (BIOS_INFO
, "No Super I/O, skipping wacom\n");
69 sioid
= pnp_read_config(superio
, 0x20);
71 printk (BIOS_INFO
, "Super I/O probe failed, skipping wacom\n");
75 pn
= lenovo_mainboard_partnumber();
78 printk (BIOS_DEBUG
, "Lenovo P/N is %s\n", pn
);
79 for (i
= 0; i
< ARRAY_SIZE (tablet_numbers
); i
++)
80 if (memcmp (tablet_numbers
[i
], pn
, 4) == 0) {
81 printk (BIOS_DEBUG
, "Lenovo P/N %s is a tablet\n", pn
);
84 printk (BIOS_DEBUG
, "Lenovo P/N %s is not a tablet\n", pn
);
89 drivers_lenovo_serial_ports_ssdt_generate(const char *scope
,
92 acpigen_write_scope(scope
);
94 if (drivers_lenovo_is_wacom_present()) {
95 acpigen_write_device("DTR");
97 acpigen_write_name("_HID");
98 acpigen_emit_eisaid("WACF004");
100 acpigen_write_name("_CRS");
102 acpigen_write_resourcetemplate_header();
103 acpigen_write_io16(0x200, 0x200, 1, 8, 1);
104 acpigen_write_irq((1 << 5));
106 acpigen_write_resourcetemplate_footer();
108 acpigen_write_method("_STA", 0);
110 acpigen_emit_byte(0xa4);
111 acpigen_write_byte(0xf);
117 if (have_dock_serial
) {
118 acpigen_write_device("COMA");
120 acpigen_write_name("_HID");
121 acpigen_emit_eisaid("PNP0501");
122 acpigen_write_name("_UID");
124 acpigen_write_byte(0x2);
126 acpigen_write_name("_CRS");
128 acpigen_write_resourcetemplate_header();
129 acpigen_write_io16(0x3f8, 0x3f8, 1, 8, 1);
130 acpigen_write_irq(1 << 4);
132 acpigen_write_resourcetemplate_footer();
135 acpigen_write_method("_STA", 0);
137 acpigen_emit_byte(0xa4);
138 acpigen_write_byte(0xf);