<p>Alexey Derlaft has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/23175">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">mb/lenovo/x230: Implement ACPI methods to set battery thresholds for x230<br><br>Change-Id: I6dd6fe112635cd4b6fc12a6bbbb4f15f17d1d7cc<br>Signed-off-by: Alexey Kharlamov <der@2-47.ru><br>---<br>M src/mainboard/lenovo/x230/Kconfig<br>A src/mainboard/lenovo/x230/acpi/bat_thresh.asl<br>M src/mainboard/lenovo/x230/dsdt.asl<br>3 files changed, 90 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/75/23175/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/mainboard/lenovo/x230/Kconfig b/src/mainboard/lenovo/x230/Kconfig</span><br><span>index 39af0e3..6c3b7eb 100644</span><br><span>--- a/src/mainboard/lenovo/x230/Kconfig</span><br><span>+++ b/src/mainboard/lenovo/x230/Kconfig</span><br><span>@@ -9,6 +9,7 @@</span><br><span>         select SOUTHBRIDGE_INTEL_C216</span><br><span>        select EC_LENOVO_PMH7</span><br><span>        select EC_LENOVO_H8</span><br><span style="color: hsl(120, 100%, 40%);">+   select IMPLEMENTS_ACPI_H8_BAT_TRESHOLDS</span><br><span>      select NO_UART_ON_SUPERIO</span><br><span>    select BOARD_ROMSIZE_KB_12288</span><br><span>        select HAVE_ACPI_TABLES</span><br><span>diff --git a/src/mainboard/lenovo/x230/acpi/bat_thresh.asl b/src/mainboard/lenovo/x230/acpi/bat_thresh.asl</span><br><span>new file mode 100644</span><br><span>index 0000000..2cd19c6</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/lenovo/x230/acpi/bat_thresh.asl</span><br><span>@@ -0,0 +1,87 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (c) 2017 Arthur Heymans <arthur@aheymans.xyz></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or</span><br><span style="color: hsl(120, 100%, 40%);">+ * modify it under the terms of the GNU General Public License as</span><br><span style="color: hsl(120, 100%, 40%);">+ * published by the Free Software Foundation; version 2 of</span><br><span style="color: hsl(120, 100%, 40%);">+ * the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Scope(\_SB.PCI0.LPCB.EC)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      Field (ERAM, ByteAcc, NoLock, Preserve)</span><br><span style="color: hsl(120, 100%, 40%);">+       {</span><br><span style="color: hsl(120, 100%, 40%);">+             Offset (0xb0),</span><br><span style="color: hsl(120, 100%, 40%);">+                                TSL0, 8, /* Battery0 start threshold */</span><br><span style="color: hsl(120, 100%, 40%);">+               Offset (0xb1),</span><br><span style="color: hsl(120, 100%, 40%);">+                                TSH0, 8 /* Battery0 stop threshold */</span><br><span style="color: hsl(120, 100%, 40%);">+         Offset (0xb2),</span><br><span style="color: hsl(120, 100%, 40%);">+                                TSL1, 8, /* Battery1 start threshold */</span><br><span style="color: hsl(120, 100%, 40%);">+               Offset (0xb3),</span><br><span style="color: hsl(120, 100%, 40%);">+                                TSH1, 8 /* Battery1 stop threshold */</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Scope(\_SB.PCI0.LPCB.EC.BAT0)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      /*</span><br><span style="color: hsl(120, 100%, 40%);">+     * Set threshold on battery0,</span><br><span style="color: hsl(120, 100%, 40%);">+  * Arg0: threshold (0 start, 1 stop) charging, Arg1: Threshold</span><br><span style="color: hsl(120, 100%, 40%);">+         */</span><br><span style="color: hsl(120, 100%, 40%);">+   Method (SETT, 2, NotSerialized)</span><br><span style="color: hsl(120, 100%, 40%);">+       {</span><br><span style="color: hsl(120, 100%, 40%);">+             if (Arg0 == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      TSL0 = Arg1</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 100%, 40%);">+             if (Arg0 == 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      TSH0 = Arg1</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Get threshold on battery0, Arg0: (0 start, 1 stop) chargning */</span><br><span style="color: hsl(120, 100%, 40%);">+    Method (GETT, 1, NotSerialized)</span><br><span style="color: hsl(120, 100%, 40%);">+       {</span><br><span style="color: hsl(120, 100%, 40%);">+             if (Arg0 == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      Return (TSL0)</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+             if (Arg0 == 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      Return (TSH0)</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+             Return (0)</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Scope(\_SB.PCI0.LPCB.EC.BAT1)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      /*</span><br><span style="color: hsl(120, 100%, 40%);">+     * Set threshold on battery1,</span><br><span style="color: hsl(120, 100%, 40%);">+  * Arg0: threshold (0 start, 1 stop) charging, Arg1: Threshold</span><br><span style="color: hsl(120, 100%, 40%);">+         */</span><br><span style="color: hsl(120, 100%, 40%);">+   Method (SETT, 2, NotSerialized)</span><br><span style="color: hsl(120, 100%, 40%);">+       {</span><br><span style="color: hsl(120, 100%, 40%);">+             if (Arg0 == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      TSL1 = Arg1</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 100%, 40%);">+             if (Arg0 == 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      TSH1 = Arg1</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Get threshold on battery1, Arg0: (0 start, 1 stop) chargning */</span><br><span style="color: hsl(120, 100%, 40%);">+    Method (GETT, 1, NotSerialized)</span><br><span style="color: hsl(120, 100%, 40%);">+       {</span><br><span style="color: hsl(120, 100%, 40%);">+             if (Arg0 == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      Return (TSL1)</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+             if (Arg0 == 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      Return (TSH1)</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+             Return (0)</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/mainboard/lenovo/x230/dsdt.asl b/src/mainboard/lenovo/x230/dsdt.asl</span><br><span>index 7db8344..3939741 100644</span><br><span>--- a/src/mainboard/lenovo/x230/dsdt.asl</span><br><span>+++ b/src/mainboard/lenovo/x230/dsdt.asl</span><br><span>@@ -52,4 +52,6 @@</span><br><span> </span><br><span>    /* Chipset specific sleep states */</span><br><span>  #include <southbridge/intel/bd82x6x/acpi/sleepstates.asl></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     #include "acpi/bat_thresh.asl"</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/23175">change 23175</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/23175"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I6dd6fe112635cd4b6fc12a6bbbb4f15f17d1d7cc </div>
<div style="display:none"> Gerrit-Change-Number: 23175 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexey Derlaft <derlafff@ya.ru> </div>