[coreboot-gerrit] Change in coreboot[master]: mb/lenovo/x230: Implement ACPI methods to set battery thresholds for ...
Alexey Derlaft (Code Review)
gerrit at coreboot.org
Mon Jan 8 21:02:26 CET 2018
Alexey Derlaft has uploaded this change for review. ( https://review.coreboot.org/23175
Change subject: mb/lenovo/x230: Implement ACPI methods to set battery thresholds for x230
......................................................................
mb/lenovo/x230: Implement ACPI methods to set battery thresholds for x230
Change-Id: I6dd6fe112635cd4b6fc12a6bbbb4f15f17d1d7cc
Signed-off-by: Alexey Kharlamov <der at 2-47.ru>
---
M src/mainboard/lenovo/x230/Kconfig
A src/mainboard/lenovo/x230/acpi/bat_thresh.asl
M src/mainboard/lenovo/x230/dsdt.asl
3 files changed, 90 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/75/23175/1
diff --git a/src/mainboard/lenovo/x230/Kconfig b/src/mainboard/lenovo/x230/Kconfig
index 39af0e3..6c3b7eb 100644
--- a/src/mainboard/lenovo/x230/Kconfig
+++ b/src/mainboard/lenovo/x230/Kconfig
@@ -9,6 +9,7 @@
select SOUTHBRIDGE_INTEL_C216
select EC_LENOVO_PMH7
select EC_LENOVO_H8
+ select IMPLEMENTS_ACPI_H8_BAT_TRESHOLDS
select NO_UART_ON_SUPERIO
select BOARD_ROMSIZE_KB_12288
select HAVE_ACPI_TABLES
diff --git a/src/mainboard/lenovo/x230/acpi/bat_thresh.asl b/src/mainboard/lenovo/x230/acpi/bat_thresh.asl
new file mode 100644
index 0000000..2cd19c6
--- /dev/null
+++ b/src/mainboard/lenovo/x230/acpi/bat_thresh.asl
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (c) 2017 Arthur Heymans <arthur at aheymans.xyz>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+
+Scope(\_SB.PCI0.LPCB.EC)
+{
+ Field (ERAM, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0xb0),
+ TSL0, 8, /* Battery0 start threshold */
+ Offset (0xb1),
+ TSH0, 8 /* Battery0 stop threshold */
+ Offset (0xb2),
+ TSL1, 8, /* Battery1 start threshold */
+ Offset (0xb3),
+ TSH1, 8 /* Battery1 stop threshold */
+ }
+}
+
+Scope(\_SB.PCI0.LPCB.EC.BAT0)
+{
+ /*
+ * Set threshold on battery0,
+ * Arg0: threshold (0 start, 1 stop) charging, Arg1: Threshold
+ */
+ Method (SETT, 2, NotSerialized)
+ {
+ if (Arg0 == 0) {
+ TSL0 = Arg1
+ }
+ if (Arg0 == 1) {
+ TSH0 = Arg1
+ }
+ }
+ /* Get threshold on battery0, Arg0: (0 start, 1 stop) chargning */
+ Method (GETT, 1, NotSerialized)
+ {
+ if (Arg0 == 0) {
+ Return (TSL0)
+ }
+ if (Arg0 == 1) {
+ Return (TSH0)
+ }
+ Return (0)
+ }
+}
+
+Scope(\_SB.PCI0.LPCB.EC.BAT1)
+{
+ /*
+ * Set threshold on battery1,
+ * Arg0: threshold (0 start, 1 stop) charging, Arg1: Threshold
+ */
+ Method (SETT, 2, NotSerialized)
+ {
+ if (Arg0 == 0) {
+ TSL1 = Arg1
+ }
+ if (Arg0 == 1) {
+ TSH1 = Arg1
+ }
+ }
+ /* Get threshold on battery1, Arg0: (0 start, 1 stop) chargning */
+ Method (GETT, 1, NotSerialized)
+ {
+ if (Arg0 == 0) {
+ Return (TSL1)
+ }
+ if (Arg0 == 1) {
+ Return (TSH1)
+ }
+ Return (0)
+ }
+}
diff --git a/src/mainboard/lenovo/x230/dsdt.asl b/src/mainboard/lenovo/x230/dsdt.asl
index 7db8344..3939741 100644
--- a/src/mainboard/lenovo/x230/dsdt.asl
+++ b/src/mainboard/lenovo/x230/dsdt.asl
@@ -52,4 +52,6 @@
/* Chipset specific sleep states */
#include <southbridge/intel/bd82x6x/acpi/sleepstates.asl>
+
+ #include "acpi/bat_thresh.asl"
}
--
To view, visit https://review.coreboot.org/23175
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dd6fe112635cd4b6fc12a6bbbb4f15f17d1d7cc
Gerrit-Change-Number: 23175
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Derlaft <derlafff at ya.ru>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180108/347931d0/attachment-0001.html>
More information about the coreboot-gerrit
mailing list