Difference between revisions of "Tp smapi"

From ThinkWiki
Jump to: navigation, search
(Installation from source)
(clean up debian and ubuntu documentation, only mention dkms now)
 
(354 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
 
{| width="100%"
 
{| width="100%"
 
|style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__
 
|style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__
|style="vertical-align:top" |The <tt>tp_smapi</tt> kernel module exposes some features of the ThinkPad's [[SMAPI support for Linux|SMAPI]] functionality via a <tt>sysfs</tt> interface. Currently, the implemented functionality is control of battery charging, extended battery status and control of CD/DVD speed (disabled by default).
+
|style="vertical-align:top" |
 +
The <tt>tp_smapi</tt> kernel module exposes some features of the ThinkPad hardware/firmware via a <tt>sysfs</tt> interface. Currently, the main implemented functionality is control of battery charging and extended battery status. The tp_smapi software package also includes an improved version of the [[HDAPS]] driver. The underlying hardware interfaces are [[SMAPI support for Linux|SMAPI]] and direct access to the embedded controller.
  
For older ThinkPad models, see also [[tpctl]].
+
This driver uses undocumented features and direct hardware access, so it may work unreliably or even damage your hardware; but so far no such damage has been reported.
 
 
{{WARN|This driver uses undocumented features and direct hardware access. It thus cannot be guaranteed to work and could conceivably damage your computer (though so far no incidents have been reported).}}
 
  
 +
If you are installing on a recent Thinkpad that has an [[Ivy Bridge]] or newer processor ({{X230}}, {{T430}}, {{T530}}, etc.), tp_smapi will not work. You will be mostly limited to [[thinkpad-acpi]] capabilities. You can however set battery charge thresholds with [[tpacpi-bat]].
 
|}
 
|}
  
 
===Features===
 
===Features===
*Battery charge/discharge control
+
*<tt>tp_smapi</tt> driver
*Battery status information
+
**Battery charge/discharge control
*Optical drive speed control (disabled by default)
+
**Battery status information
 +
*<tt>hdaps</tt> driver (compared with the standard <tt>hdaps</tt> driver)
 +
**Improved stability
 +
**Improved model support
 +
**Improved functionality
  
 
===Project Homepage / Availability===
 
===Project Homepage / Availability===
 
* Project page: http://tpctl.sourceforge.net/
 
* Project page: http://tpctl.sourceforge.net/
* You need to [http://sourceforge.net/project/showfiles.php?group_id=1212&package_id=171579 download] only the <tt>tp_smapi</tt> package. Versions containing <tt>-test</tt> are experimental, others are stable.
+
* Download page: http://sourceforge.net/projects/tpctl/files/tp_smapi, a newer version 0.41 is available in a fork at https://github.com/evgeni/tp_smapi which is also available in Debian
 +
* You need to download only the <i>tp_smapi</i> package.
  
 
===Installation===
 
===Installation===
Line 22: Line 27:
 
You will need the kernel headers and makefiles corresponding to your current kernel version. On {{Fedora}}, this means {{cmdroot|yum install kernel-devel-$(uname -r)}} .
 
You will need the kernel headers and makefiles corresponding to your current kernel version. On {{Fedora}}, this means {{cmdroot|yum install kernel-devel-$(uname -r)}} .
  
For testing, you can simply compile and load the driver within the current
+
:{{cmdroot|tar xzvf tp_smapi-0.40.tgz}}
working directory:
+
:{{cmdroot|cd tp_smapi-0.40}}
:{{cmdroot|tar xzvf tp_smapi-0.28.tgz}}
+
 
:{{cmdroot|cd tp_smapi-0.28}}
+
Then, either compile and load the driver within the current working directory (for testing):
 
:{{cmdroot|make load}}
 
:{{cmdroot|make load}}
 
+
OR compile and install into the kernel's module path:
To compile and install into the kernel's module path:
 
 
:{{cmdroot|make install}}
 
:{{cmdroot|make install}}
  
If you use the [[HDAPS]] driver, add <tt>HDAPS=1</tt> to also patch the <tt>hdaps</tt> for compatibility with <tt>tp_smapi</tt> (this requires a kernel source tree matching the current kernel):
+
If you use the [[HDAPS]] driver, add <tt>HDAPS=1</tt> to also patch the <tt>hdaps</tt> for compatibility with <tt>tp_smapi</tt> (this requires a kernel source tree matching the current kernel).
 +
Again, either load the driver within the current working directory:
 
:{{cmdroot|1=make load HDAPS=1}}
 
:{{cmdroot|1=make load HDAPS=1}}
or, to compile and install into the kernel's module path:
+
OR install into the kernel's module path:
 
:{{cmdroot|1=make install HDAPS=1}}
 
:{{cmdroot|1=make install HDAPS=1}}
 
  
 
To prepare a stand-alone patch against the current kernel tree (including
 
To prepare a stand-alone patch against the current kernel tree (including
Line 48: Line 52:
  
 
====Installation in Gentoo====
 
====Installation in Gentoo====
The {{Gentoo}} portage system carries a [http://packages.gentoo.org/packages/?category=app-laptop;name=tp_smapi tp_smapi package], which follows the latest version pretty closely. On a Gentoo system, you can install and load as follows.
+
The {{Gentoo}} portage system carries a [http://packages.gentoo.org/package/app-laptop/tp_smapi tp_smapi package], which follows the latest version pretty closely. On a Gentoo system, you can install and load as follows.
  
 
If you use the [[HDAPS]] driver, do this first:
 
If you use the [[HDAPS]] driver, do this first:
  
* Configure <tt>hdaps</tt> as module in your kernel
+
* Disable the <tt>hdaps</tt> module in your kernel configuration (Device Drivers &rarr; Hardware Monitoring Support &rarr; IBM Hard Drive Active Protection System)
* Add the <tt>HDAPS</tt> use flag in {{path|/etc/make.conf}}
+
* Rebuild and install the kernel
 +
* Add the <tt>hdaps</tt> use flag in {{path|/etc/make.conf}}
 
* {{cmdroot|rmmod hdaps}}
 
* {{cmdroot|rmmod hdaps}}
  
 
Then:
 
Then:
 
 
* {{cmdroot|emerge tp_smapi}} (or install tp_smapi with hdaps support manually, as above)
 
* {{cmdroot|emerge tp_smapi}} (or install tp_smapi with hdaps support manually, as above)
 
* {{cmdroot|echo "tp_smapi" >> /etc/modules.autoload.d/kernel-2.6}}
 
* {{cmdroot|echo "tp_smapi" >> /etc/modules.autoload.d/kernel-2.6}}
Line 66: Line 70:
 
* {{cmdroot|modprobe hdaps}}
 
* {{cmdroot|modprobe hdaps}}
  
====Installation on Debian/Ubuntu====
+
'''NOTE:''' If {{cmdroot|modprobe}} fails and dmesg says something about <tt>__stack_chk_fail()</tt>, you probably just compiled your modules with <tt>-fstack-protector</tt> and/or <tt>-fstack-protector-all</tt> without having a kernel that supports it. You can either configure your kernel to have <tt>CC_STACKPROTECTOR</tt> enabled (in ''Processor type and features'' if you use {{cmdroot|make menuconfig}}) or edit your <tt>make.conf</tt> (or, if you're using paludis, your <tt>/etc/paludis/bashrc</tt>) and remove <tt>-fstack-protector</tt> and <tt>-fstack-protector-all</tt> from your <tt>CFLAGS</tt>. If you choose to enable it in the kernel, be aware that you need a patched GCC for it (and I do not know if the gcc in stage3 is patched).
 +
 
 +
 
 +
====Installation on Debian and Ubuntu====
 +
Since Debian 7 Wheezy and Ubuntu 12.04 Precise you can use 'dkms'. (Note: If installation seems ineffective, confirm you have the linux-headers of your kernel installed, purge tp-smapi-dkms and reinstall.)
 +
* {{cmdroot|apt-get install linux-headers tp-smapi-dkms}}
 +
* {{cmdroot|modprobe tp_smapi}}
  
<pre>
+
{{HINT|This appears to be the ideal solution. A description of DKMS, from [http://linux.dell.com/projects.shtml#dkms Dell]: "DKMS stands for Dynamic Kernel Module Support. It is designed to create a framework where kernel dependent module source can reside so that it is very easy to rebuild modules as you upgrade kernels."}}
deb http://www.oakcourt.dyndns.org/debian/ ./
+
 
deb-src http://www.oakcourt.dyndns.org/debian/ ./
+
====Installation on openSUSE====
</pre>
+
openSUSE provides rpm packages. Look for them at the package search: [http://software.opensuse.org/search/], search for the package named "tp_smapi".
 +
 
 +
A step-by-step guide on how a relative linux newbie installed tp_smapi on a Thinkpad W500 running openSuse 11.1 using YAST Software Manager is available [http://forums.opensuse.org/hardware/laptop/417254-tp_smapi-lenovo-thinkpad-t400-t500-w500-step-step.html#post2005932 here]
  
This repository has kernel-patch packages for tp_smapi. This will not only integrate tp_smapi into your kernel build but will patch the hdaps driver for you. It is available for kernel 2.6.15 and later. Also available is an init script to automatically set SMAPI paramaters at boot--this is in package tpsmapi-utils. Please report any bugs to [[User:Ajbarr]]
+
In case you are taking the hard way around, while compiling on 11.0, make complained about not being able to locate the kernel sources. It worked for me after I did this:
 +
<pre><nowiki>cp /usr/include/linux/aio_abi.h /lib/modules/`uname -r`/build/include/linux/</nowiki></pre>
  
 
===Battery charge control features===
 
===Battery charge control features===
 +
{{NOTE|Not all Thinkpad ECs support these charge control features. If you get the message "Operation not supported" when trying to cat for the status of a given parameter, it means your controller does not support that feature.}}
 +
 
To set the thresholds for starting and stopping battery charging (in percent of current full charge capacity):
 
To set the thresholds for starting and stopping battery charging (in percent of current full charge capacity):
 
:{{cmdroot|echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh}}
 
:{{cmdroot|echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh}}
 
:{{cmdroot|echo 70 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh}}
 
:{{cmdroot|echo 70 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh}}
 
:{{cmdroot|cat /sys/devices/platform/smapi/BAT0/*_charge_thresh}}
 
:{{cmdroot|cat /sys/devices/platform/smapi/BAT0/*_charge_thresh}}
{{HINT|Battery charging thresholds can be used to keep Li-Ion ad Li-Polymer batteries partially charged, in order to [[Maintenance#Battery_treatment|increase their lifetime]].}}
+
{{HINT|Battery charging thresholds can be used to keep Li-Ion and Li-Polymer batteries partially charged, in order to [[Maintenance#Battery_treatment|increase their lifetime]].}}
To unconditionally inhibit charging for 17 minutes:
+
To prevent charging for 17 minutes (regardless of thresholds):
 
:{{cmdroot|echo 17 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}
 
:{{cmdroot|echo 17 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}
{{HINT|Charge inhibiting can be used to reduce the power draw of the laptop, in order to use a an under-spec power supply that can't handle the combined power draw of running and charging. It can also be used to control which battery is charged when [[How to use UltraBay batteries|using an Ultrabay battery]].}}
+
{{HINT|Charge inhibiting can be used to reduce the power draw of the laptop, in order to use an under-spec power supply that can't handle the combined power draw of running and charging. It can also be used to control which battery is charged when [[How to use UltraBay batteries|using an Ultrabay battery]].}}
  
To cancel charge inhibiting:
+
To cancel charging preventation:
 
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}
 
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}
  
To force battery discharging even if connected to AC, use one of these:
+
To force battery discharging (even if connected to AC):
 
:{{cmdroot|echo 1 > /sys/devices/platform/smapi/BAT0/force_discharge}}
 
:{{cmdroot|echo 1 > /sys/devices/platform/smapi/BAT0/force_discharge}}
{{HINT|This can be used to choose which battery is discharged when [[How to use UltraBay batteries|using an UltraBay battery]].}}
+
{{HINT|This can be used to choose which battery is discharged when [[How to use UltraBay batteries|using an UltraBay battery]]. For example, see the {{CodeRef|tp-bat-balance}} script.}}
  
 
To cancel forced discharge:
 
To cancel forced discharge:
 
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge}}
 
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge}}
 +
 +
{{HINT|TPBattStat-Applet is a gnome applet for integrating battery balancing with a graphics and/or text display of both batteries in a panel. Battery balancing improves battery life by not leaving one battery empty while the other discharges. For the latest alpha release, see https://github.com/teleshoes/tpbattstat-applet}}
 +
 +
====Making the settings permanent on reboot====
 +
 +
If you always use the same type of battery, then you may want the same settings to be configured each time you boot the machine.
 +
 +
If you use various types of battery, then you may want to consider writing some scripts to detect the battery type and apply the appropriate settings.
 +
 +
=====Debian=====
 +
 +
It is not necessary to create your own init.d script or modify /etc/rc.local - you just need the package sysfsutils:
 +
:{{cmdroot|apt-get install sysfsutils}}
 +
 +
Now, put your desired settings in /etc/sysfs.conf:
 +
 +
<pre><nowiki># cat >> /etc/sysfs.conf << EOF
 +
# For a LiIon battery in a Thinkpad
 +
devices/platform/smapi/BAT0/start_charge_thresh = 50
 +
devices/platform/smapi/BAT0/stop_charge_thresh = 80
 +
EOF</nowiki></pre>
 +
 +
The init script supplied by sysfsutils will load these settings on each boot.
  
 
===Battery status features===
 
===Battery status features===
Line 101: Line 139:
 
# cat /sys/devices/platform/smapi/BAT0/installed
 
# cat /sys/devices/platform/smapi/BAT0/installed
 
# cat /sys/devices/platform/smapi/BAT0/state      # idle/charging/discharging
 
# cat /sys/devices/platform/smapi/BAT0/state      # idle/charging/discharging
# cat /sys/devices/platform/smapi/BAT0/cycle_count  
+
# cat /sys/devices/platform/smapi/BAT0/cycle_count
 
# cat /sys/devices/platform/smapi/BAT0/current_now # instantaneous current
 
# cat /sys/devices/platform/smapi/BAT0/current_now # instantaneous current
 
# cat /sys/devices/platform/smapi/BAT0/current_avg # last minute average
 
# cat /sys/devices/platform/smapi/BAT0/current_avg # last minute average
Line 107: Line 145:
 
# cat /sys/devices/platform/smapi/BAT0/power_avg  # last minute average
 
# cat /sys/devices/platform/smapi/BAT0/power_avg  # last minute average
 
# cat /sys/devices/platform/smapi/BAT0/last_full_capacity
 
# cat /sys/devices/platform/smapi/BAT0/last_full_capacity
 +
# cat /sys/devices/platform/smapi/BAT0/remaining_percent
 +
# cat /sys/devices/platform/smapi/BAT0/remaining_running_time
 +
# cat /sys/devices/platform/smapi/BAT0/remaining_charging_time
 
# cat /sys/devices/platform/smapi/BAT0/remaining_capacity
 
# cat /sys/devices/platform/smapi/BAT0/remaining_capacity
 
# cat /sys/devices/platform/smapi/BAT0/design_capacity
 
# cat /sys/devices/platform/smapi/BAT0/design_capacity
Line 118: Line 159:
 
# cat /sys/devices/platform/smapi/BAT0/manufacture_date
 
# cat /sys/devices/platform/smapi/BAT0/manufacture_date
 
# cat /sys/devices/platform/smapi/BAT0/first_use_date
 
# cat /sys/devices/platform/smapi/BAT0/first_use_date
 +
# cat /sys/devices/platform/smapi/BAT0/temperature # in milli-Celsius
 
# cat /sys/devices/platform/smapi/ac_connected
 
# cat /sys/devices/platform/smapi/ac_connected
 
</pre>
 
</pre>
Line 127: Line 169:
 
In all of the above, replace <tt>BAT0</tt> with <tt>BAT1</tt> to address the 2nd battery.
 
In all of the above, replace <tt>BAT0</tt> with <tt>BAT1</tt> to address the 2nd battery.
  
Note that the battery status readout conflicts with the stock [[HDAPS|hdaps]] driver, so if you use <tt>hdaps</tt> you will need to load <tt>tp_smapi</tt> using {{cmdroot|1=make load HDAPS=1}} (see [[#Conflict_with_hdaps|Conflict with hdaps]] below).
+
Note that the battery status readout conflicts with the stock [[HDAPS|hdaps]] driver, so if you use <tt>hdaps</tt> you will need to load <tt>tp_smapi</tt> using {{cmdroot|1=make load HDAPS=1}} (see [[#Bundled hdaps driver|Bundled hdaps driver]] below).
  
 
On [[ACPI]]-enabled systems, most of above information is also available through the files under {{path|/proc/acpi/battery}}. However, the ACPI interface does not include the instantaneous power and cycle count readouts, and does not work well when [[How to use UltraBay batteries|hotswapping UltraBay batteries]].
 
On [[ACPI]]-enabled systems, most of above information is also available through the files under {{path|/proc/acpi/battery}}. However, the ACPI interface does not include the instantaneous power and cycle count readouts, and does not work well when [[How to use UltraBay batteries|hotswapping UltraBay batteries]].
  
===Optical drive control features===
+
====Scripts====
 +
Some scripts can make it easier to grep the information you need from tp_smapi
 +
* [[battery.rb]]
 +
 
 +
===Other features===
 +
 
 +
There is also [[sysfs]] attribute for making direct SMAPI requests to the SM BIOS firmware. Don't touch it unless you really know what you're doing. Example:
 +
# echo '211a 100 0 0' > /sys/devices/platform/smapi/smapi_request; cat /sys/devices/platform/smapi/smapi_request
 +
211a 34b b2 0 0 0 'OK'
 +
The "4b" in the 2nd value, converted to decimal, is 75: the current charging stop threshold (stop_charge_thresh).
 +
 
 +
===Bundled <tt>hdaps</tt> driver===
 +
 
 +
The tp_smapi package includes a modified version of the <tt>hdaps</tt> Linux kernel driver used by the [[HDAPS]] system. It has remained outside the mainline kernel for a few years for several reasons, [https://lists.ubuntu.com/archives/kernel-team/2009-April/005565.html] including the upstream maintainer's assertion that the new code's anonymous author was under a NDA. (Although this would not normally expose the kernel team to litigation.) [http://lkml.org/lkml/2008/9/15/126] [http://lkml.org/lkml/2008/10/7/403] [http://lkml.org/lkml/2008/10/7/428]
 +
 
 +
To use <tt>tp_smapi</tt> and <tt>hdaps</tt> concurrently, you '''must''' use the modified version.
 +
 
 +
To build the modified version, simply append the <tt>HDAPS=1</tt> parameter to the <tt>make</tt> command (see [[#Installation|Installation]] above):
 +
:{{cmdroot|1=make load HDAPS=1}}
 +
or
 +
:{{cmdroot|1=make install HDAPS=1}}
 +
 
 +
If you don't do that, you will not be able to load <tt>tp_smapi</tt> (and its support module <tt>thinkpad_ec</tt>) when <tt>hdaps</tt> is loaded, and vice versa. You can use <tt>rmmod</tt> to switch between these modules.
 +
 
 +
Note that some of the battery status is also visible through ACPI ({{path|/proc/acpi/battery/*}}), independently of <tt>tp_smapi</tt>.
 +
 
 +
The modified <tt>hdaps</tt> has several changes:
 +
* The <tt>hdaps</tt> driver in mainline kernels conflicts with the extended battery status (they use the same IO ports). The modified <tt>hdaps</tt> coordinates this access through the bundled <tt>thinkpad_ec</tt> driver.
 +
* The modified <tt>hdaps</tt> driver fixes reliability and improves support for recent ThinkPad models (*60 and newer), since unlike the mainline driver, it correctly follows the Embedded Controller communication protocol.
 +
* Several other improvements, such as the ability to control the polling rate.
 +
 
 +
===Troubleshooting===
 +
==== <tt>thinkpad_ec: cannot claim io ports 0x1600-0x161f</tt> ====
 +
The "<tt>thinkpad_ec: cannot claim io ports 0x1600-0x161f!</tt>" error message is printed when loading the <tt>thinkpad_ec</tt> module on some recent ThinkPad models.  This occurs because the ACPI BIOS DSDT is reserving ports used by tp_smapi.
  
To control the speed of the optical drive:
+
As a workaround, add the <tt>force_io=1</tt> module parameter to <tt>thinkpad_ec</tt> in {{path|/etc/modprobe.conf}} (or your distribution's equivalent). Add the line:
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/cd_speed # slow}}
+
: options thinkpad_ec force_io=1
:{{cmdroot|echo 1 > /sys/devices/platform/smapi/cd_speed # medium}}
 
:{{cmdroot|echo 2 > /sys/devices/platform/smapi/cd_speed # fast}}
 
:{{cmdroot|cat /sys/devices/platform/smapi/cd_speed}}
 
  
=====Enabling this feature=====
+
For transient testing, load the modules as follows:
Changing the drive speed when a disc is being accessed will hang your computer. This feature is thus '''disabled by default''', but can be enabled using by adding <tt>#define PROVIDE_CD_SPEED</tt> at the top of <tt>tp_smapi.c</tt>. The safe way to set the drive speed is using <tt>hdparm -E num</tt> or <tt>eject -x num</tt> for CD-ROM, and <tt>speedcontrol -x num</tt> (sourcecode [http://safari.iki.fi/speedcontrol.c here]) for DVD. For kernels older than 2.6.15, this may require the [[Problems_with_SATA_and_Linux#No_SMART_support libata pass-through|libata pass-through patch]].
 
  
===Other features===
+
: {{cmdroot|1=make load HDAPS=1 FORCE_IO=1}}
  
This controls the "PCI bus power saving" option in the BIOS, and takes effect at the next boot. On a ThinkPad {{T43}} turning this off increases idle power consumption by about 350mW. Out-of-the-box default is 1.
+
Note: force_io option was added in tp_smapi v0.40 (released 2008-12-16).
# cat /sys/devices/platform/smapi/enable_pci_power_saving_on_boot
 
# echo 1 > /sys/devices/platform/smapi/enable_pci_power_saving_on_boot # on
 
# echo 0 > /sys/devices/platform/smapi/enable_pci_power_saving_on_boot # off
 
  
There is also [[sysfs]] attribute for making direct SMAPI requests to the SM BIOS firmware. Don't touch it unless you really know what you're doing.
+
Models which need this option include: {{T400}}, {{T500}}, {{X60s}}, {{X61}}, {{X301}}
echo 'BX=2116 CX=100 DI=0 SI=0' > /sys/devices/platform/smapi/smapi_request; cat /sys/devices/platform/smapi/smapi_request
 
BX=2116 CX=327 DX=b2 DI=0 SI=0 ret=0 msg=OK
 
  
===Conflict with <tt>hdaps</tt>===
+
More information:
The extended battery status function conflicts with the [[HDAPS|hdaps]] kernel module (they use the same IO ports). The <tt>tp_smapi</tt> package includes a patch against <tt>hdaps</tt> to make it compatible with <tt>tp_smapi</tt>, and also to fix many problems in the original driver.
+
* http://bugzilla.kernel.org/show_bug.cgi?id=12221
 +
* http://www.nabble.com/thinkpad_ec-fails-to-load-on-Thinkpad-T500-td19932985.html
  
To build the patched version, simply append the <tt>HDAPS=1</tt> parameter to the <tt>make</tt> command, for example: {{cmdroot|1=make load HDAPS=1}} (see [[#Installation|Installation]] above).
+
==== <tt>thinkpad_ec: no ThinkPad embedded controller!</tt> ====
 +
If you get "<tt>thinkpad_ec: no ThinkPad embedded controller!</tt>" when trying to load the module on a supported model listed below, you should [[BIOS_Upgrade|upgrade your BIOS]]. Some early BIOS (like 1.x on the X31) don't handle the embedded controller.
  
If you don't do that, you will not be able tp load <tt>tp_smapi</tt> (and its support module <tt>tp_base</tt>) when <tt>hdaps</tt> is loaded, and vice versa. You can use <tt>rmmod</tt> to switch between these modules.
+
==== <tt>T60p writing to start_charge_thresh/stop_charge_thresh does not work!</tt> ====
 +
Writing to /sys/devices/platform/smapi/BAT0/start_charge_thresh succeeds, but the older value does not change. Solution: unknown. If you know a solution please update here.
  
Note that some of the battery status is also visible through ACPI ({{path|/proc/acpi/battery/*}}), independently of <tt>tp_smapi</tt>.
+
UPDATE:  Failure to effectively change sysfs values sometimes happens at boot time (through sysfs.conf OR etc/local.start for instance) when the values have never previously been changed manually (ie using echo from a shell).  Try initializing the values manually before including them in boot-time scripting.
  
 
===Model-specific status===
 
===Model-specific status===
 +
 +
Tip: The <tt>thinkpad-acpi</tt> module reports both the BIOS and EC firmware versions when it loads.
  
 
<div style="font-size: 92%">
 
<div style="font-size: 92%">
Line 168: Line 239:
 
|+<tt>tp_smapi</tt> feature support matrix
 
|+<tt>tp_smapi</tt> feature support matrix
 
|-
 
|-
! &times;
+
! colspan=12 style="text-align:center;background:#efefef;" |
! <tt>start_charge_<br />thresh</tt>
+
 
!          <tt>stop_charge_<br />thresh</tt>
+
=====A series=====
!                      <tt>inhbit_charge_<br />minutes</tt>
 
!                                  <tt>force_discharge</tt>
 
!                                                battery status files
 
!                                                            <tt>cd_speed</tt><br \><span style="font-size: 90%">(see [[#Enabling_this_feature|note]] above)</span>
 
!                                                                      Notes
 
 
|-
 
|-
! colspan=8 style="text-align:center;background:#efefef;" |
+
{{tp_smapi/model_status_table_header}}
=====A series=====
 
 
|-
 
|-
 
! {{A22p}} 2629-USG
 
! {{A22p}} 2629-USG
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || {{Cunk}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || N/A || N/A ||      ||  || ||
 
|-
 
|-
 
! {{A30}}
 
! {{A30}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cunk}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || N/A || N/A ||      ||  || ||
 
|-
 
|-
! colspan=8 style="text-align:center;background:#efefef;" |
+
! colspan=12 style="text-align:center;background:#efefef;" |
 +
 
 
=====G series=====
 
=====G series=====
 +
|-
 +
{{tp_smapi/model_status_table_header}}
 
|-
 
|-
 
! {{G41}}
 
! {{G41}}
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||
+
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cunk}} || N/A || N/A ||      ||  || ||
 
|-
 
|-
! colspan=8 style="text-align:center;background:#efefef;" |
+
! colspan=12 style="text-align:center;background:#efefef;" |
 +
 
 
=====R series=====
 
=====R series=====
 
|-
 
|-
! [[:Category:R31|R31]]
+
{{tp_smapi/model_status_table_header}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || No SMAPI BIOS
+
|-
 +
! {{R31}}
 +
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || N/A || N/A ||      || || || No SMAPI BIOS
 
|-
 
|-
 
! {{R40}}
 
! {{R40}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cyes}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || N/A || N/A ||      ||  || ||
 
|-
 
|-
 
! {{R50}}
 
! {{R50}}
| {{Cunk}} || {{Cno}}  || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cunk}} || {{Cno}}  || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} ||      ||  || ||
 +
|-
 +
! {{R50e}} 1834-JAG
 +
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cyes}} || {{Cyes}} || N/A || N/A ||      ||  || ||
 +
|-
 +
! {{R50e}} 1834-5US
 +
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cyes}} || {{Cyes}} || N/A || N/A ||      ||  || ||
 
|-
 
|-
 
! {{R50p}}
 
! {{R50p}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cyes}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cunk}} ||      ||  || ||
 
|-
 
|-
! {{R51}}
+
! {{R51}} 18*
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.32 || 3.22 || || Machine types 1829, 1830, 1831 and 1836
 +
|-
 +
! {{R51}} 28*
 +
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} ||      || 1.29 || || Machine types 2883, 2887, 2888, 2889, 2894 and 2495
 
|-
 
|-
 
! {{R52}}
 
! {{R52}}
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||
+
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.33 || 1.29 || 1.06 ||
 +
|-
 +
! {{R60}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||{{Cyes}}  || {{Cno|text=}} 1 || 0.33 || || ||
 +
|-
 +
! {{R61}}
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||{{Cyes}}  || {{Cyes|text=}} 1 || 0.35-test1 || 7KETA7WW 2.07 || 7KHT24WW 1.08 || Machine type 8918
 +
|-
 +
! {{R61i}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||{{Cyes}}  || {{Cyes|text=}} 1  || 0.41 ||  ||  || Machine types 7732, 8250
 +
|-
 +
! {{R400}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||{{Cyes}}  || {{Cyes|text=}} 1 || 0.40-1  ||  ||  || Machine type 7443
 +
|-
 +
! {{R500}}
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||{{Cunk}}  || {{Cyes|text=}} 1 || 0.40-1  ||  ||  ||
 
|-
 
|-
! colspan=8 style="text-align:center;background:#efefef;" |
+
! colspan=12 style="text-align:center;background:#efefef;" |
 +
 
 
=====T series=====
 
=====T series=====
 +
|-
 +
{{tp_smapi/model_status_table_header}}
 
|-
 
|-
 
! {{T20}}
 
! {{T20}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || N/A || N/A ||      ||  || || Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.
 
|-
 
|-
 
! {{T22}}
 
! {{T22}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || N/A || N/A ||      ||  || || Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.
 
|-
 
|-
 
! {{T23}}
 
! {{T23}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cunk}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || N/A || N/A ||      ||  || ||
 
|-
 
|-
 
! {{T30}}
 
! {{T30}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cunk}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || N/A || N/A ||      ||  || ||
 
|-
 
|-
 
! {{T40}}
 
! {{T40}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cyes}} || {{Cyes}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || {{Cyes}} || N/A || N/A ||      ||  || ||
 +
|-
 +
! {{T40}} 2373-72U
 +
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || N/A || N/A ||  0.40  || 3.23  || 1RHT71WW-3.04  ||
 
|-
 
|-
 
! {{T40p}}
 
! {{T40p}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cyes}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || N/A || N/A ||      ||  || ||
 
|-
 
|-
 
! {{T41}}
 
! {{T41}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cyes}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.37 || 3.23 || 3.04 ||
 
|-
 
|-
! {{T41p}}
+
! {{T41}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || {{Cyes}} || {{Cyes}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 3.20 || 3.04 ||
 
|-
 
|-
! {{T42}}  
+
! {{T41}}
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 3.23 || 3.04 ||
 +
|-
 +
! {{T41p}} 2373-AM9
 +
| {{Cno}} || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.32 || 3.20 || v3.04 ||
 +
|-
 +
! {{T42}}
 +
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} ||      ||  || ||
 +
|-
 +
! {{T42p}} 2373-KXU
 +
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.32 || 3.21 || || Stop charge threshold works in Windows, but dmesg says "__get_real_thresh: cannot get stop_thresh of bat=0: Function is not supported by SMAPI BIOS".
 
|-
 
|-
 
! {{T42p}} 2373-KUU
 
! {{T42p}} 2373-KUU
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cyes}} || {{Cno}}  || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} ||      ||  || ||
 
|-
 
|-
! {{T43}} 2686-DGU
+
! {{T43}} 2686
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||
+
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.33 || 1.27 || ||
 
|-
 
|-
 
! {{T43p}}
 
! {{T43p}}
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||
+
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes|text=}} 0 ||      ||  || ||
 +
|-
 +
! {{T60}}
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.32 ||  || ||
 
|-
 
|-
 
! {{T60}}
 
! {{T60}}
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 1 || 0.34 ||  || ||
 +
|-
 +
! {{T60}} 1951-24G
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || 0.36 || 1.09a || ||
 
|-
 
|-
! colspan=8 style="text-align:center;background:#efefef;" |
+
! {{T60}} 2007-FSG
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.39 || 1.10 || 1.05b ||
 +
|-
 +
! {{T60}} 1951-CZ1
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.40 || 2.23 || 1.07 ||
 +
|-
 +
! {{T60p}} 8743-CTO
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.32 ||  || ||
 +
|-
 +
! {{T61}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 1 || 0.32 ||  || || [http://ubuntuforums.org/showthread.php?p=3146719 ref]
 +
|-
 +
! {{T61p}} 6457-7XG
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 1 || 0.32 ||  || || [http://ubuntuforums.org/showthread.php?p=3146719 ref]
 +
|-
 +
! {{T400}}
 +
| {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes|text=}}  1 || 0.40 || 1.19 || || Requires <tt>force_io=1</tt> parameter to <tt>thinkpad_ec</tt>
 +
|-
 +
! {{T400s}}
 +
| {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes|text=}} 2 || 0.40 || 1.06 || || Requires <tt>invert=2</tt> paramteter to <tt>hdaps</tt>
 +
|-
 +
! {{T410s}}
 +
| {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cunk}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes|text=}} 4 || 0.40 || 1.14 || || Requires <tt>invert=4</tt> accoding to <tt>hdaps-gl</tt>
 +
|-
 +
! {{T410}}
 +
| {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes|text=}}  1 || 0.40 || 1.25 || ||
 +
|-
 +
! {{T500}}
 +
| {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes|text=}}  1 || 0.40 || 2.07 || || Requires <tt>force_io=1</tt> parameter to <tt>thinkpad_ec</tt>
 +
|-
 +
! {{T510}}
 +
| {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cno|text=}}  7 || 0.40 || 1.12 || 1.08 || ||
 +
|-
 +
! {{T510}}
 +
| {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cno|text=}}  7 || 0.40 || 1.35 || 1.17 || ||
 +
|-
 +
! colspan=12 style="text-align:center;background:#efefef;" |
 +
 
 +
=====W series=====
 +
|-
 +
{{tp_smapi/model_status_table_header}}
 +
|-
 +
! {{W700}} 2757-CTO
 +
| {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cyes}}  || {{Cunk}} || {{Cunk}} ||  0.40 || 2.08 || 1.05 ||
 +
|-
 +
! {{W500}} 4062-4EG
 +
| {{Cyes}}  || {{Cyes}}  || {{Cunk}}  || {{Cunk}}  || {{Cunk}}  || {{Cunk}} || {{Cunk}} ||  0.40 || {{Cunk}} || {{Cunk}} ||
 +
|-
 +
 
 +
! colspan=12 style="text-align:center;background:#efefef;" |
  
 
=====X series=====
 
=====X series=====
 
|-
 
|-
! {{X20}} 2662-31G
+
{{tp_smapi/model_status_table_header}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || tp_smapi 0.20
+
|-
 +
! {{X22}}
 +
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}}  || N/A || N/A ||      ||  || || no EC controller found
 
|-
 
|-
 
! {{X24}}
 
! {{X24}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cyes}} || N/A || N/A ||      ||  || ||
 +
|-
 +
! {{X30}}
 +
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || {{Cyes}} || N/A || N/A || 0.34  || 1.09 || ||
 
|-
 
|-
 
! {{X31}}
 
! {{X31}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cunk}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || {{Cyes}} || N/A || N/A || 0.40 || 3.02 || ||
 
|-
 
|-
 
! {{X32}}
 
! {{X32}}
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cno}}  || {{Cno}}  || {{Cno}}  || {{Cno}} || {{Cyes}} || N/A || N/A ||      ||  || ||
 
|-
 
|-
 
! {{X40}}
 
! {{X40}}
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || BIOS v2.03, EC v1.60
+
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.32 || 2.08 || 1.62 ||
 
|-
 
|-
 
! {{X41}}
 
! {{X41}}
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.32 ||  || ||
 +
|-
 +
! {{X41_Tablet}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.40  || 75ET60WW (2.06 ) || 75HT20WW (1.02) ||
 
|-
 
|-
 
! {{X60}}
 
! {{X60}}
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 ||      || 2.07 || 1.10 || 2.6.20 issue (see discussion)
 
|-
 
|-
! colspan=8 style="text-align:center;background:#efefef;" |
+
! {{X60_Tablet}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.34  || 7JET25WW (1.10 )  || 7JHT13WW 1.04 || [http://luke.no-ip.org/x60tablet/ ref] [http://rad.bioinfo.ulaval.ca/hardware/x60tablet ref]
 +
|-
 +
! {{X60s}} 1704-5UG
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cno|text=}} 3 || 0.34 || 7BETD2WW 2.13 || 7BHT40WW 1.13 ||
 +
|-
 +
! {{X60s}} 1704-56G
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cno|text=}} 3 || 0.40 || 7BETD5WW 2.16 || 7BHT40WW 1.13 ||
 +
|-
 +
! {{X61}} 7673-CTO
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 6 || 0.40 || 7NETB9WW (2.19) || 7MHT25WW-1.03 ||
 +
|-
 +
! {{X61}} 7675-4KU
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 || 0.34 || 7NET30WW (1.11 ) || 7MHT24WW 1.02 ||
 +
|-
 +
! {{X61_Tablet}}
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 || 0.32  ||  || ||
 +
|-
 +
! {{X61s}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 / 3 || 0.32 ||  || || [http://www.slackwiki.org/ThinkPad_X61s ref] says 3 but conflicting report received
 +
|-
 +
! {{X100e}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 6XET36WW (1.20a) || 6XHT36WW (1.176000) || x100e NTS4UTX, dual-core L625 also works (NTT27MH)
 +
|-
 +
! {{X120e}}
 +
| {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.41 || 8FET32WW (1.16 ) || {{Cunk}} || model 0596CTO
 +
|-
 +
! {{X200}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.40 || 6DET40WW (2.04 ) || 7XHT22WW 1.04 ||
 +
|-
 +
! {{X200s}} 7470-X01
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 5 || 0.40 || 6DET63WW (3.13) || 7XHT24WW 1.06 ||
 +
|-
 +
! {{X201}}
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 / 5 || 0.40 ||  || ECP:  || It said 6 here, but see [http://www.thinkwiki.org/wiki/Talk:Tp_smapi#Wrong_HDAPS_axis_orientation_for_x201 discussion page]
 +
|-
 +
! {{X201s}}
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 5 || 0.40 || 6QET44WW (1.14 ) || ECP: 1.09/1.09 ||
 +
|-
 +
! {{X220}} 4290-2GW
 +
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || 0.40 || 8DET46WW (1.16 ) || "unknown" ||
 +
|-
 +
! {{X220}} 4286-CTO
 +
| {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || 0.41 || 8DET54WW (1.24 ) ||  {{Cunk}} || HDAPS works fine, don't know wich axis orientation thougth ||
 +
|-
 +
! {{X300}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || 0.37 || 7TET25WW (1.02 ) || 7THT15WW 1.00c ||
 +
|-
 +
! colspan=12 style="text-align:center;background:#efefef;" |
  
 
=====Z series=====
 
=====Z series=====
 +
|-
 +
{{tp_smapi/model_status_table_header}}
 +
|-
 +
! {{Z60m}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} ||      ||  || ||
 
|-
 
|-
 
! {{Z60t}}
 
! {{Z60t}}
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} ||
+
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} ||      ||  || ||
 
|-
 
|-
 
! {{Z61m}}
 
! {{Z61m}}
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||
+
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.32 ||  || ||
 +
|-
 +
! {{Z61t}}
 +
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} ||      ||  || || [https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/45014 ref]
 +
|-
 +
! {{Z61p}}
 +
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} ||      ||  || ||
 +
|-
 +
! colspan=12 style="text-align:center;background:#efefef;" |
 +
 
 +
=====SL series and IdeaPad=====
 +
|-
 +
! colspan=12 style="text-align:left" |
 +
The ThinkPad SL series and IdeaPad series have firmware that is completely different from other ThinkPad models. Neither [[tp_smapi]] nor [[thinkpad-acpi]] support these models.
 
|}
 
|}
 
</div>
 
</div>
  
  
Please update the above and report your experience on the [[Talk:tp_smapi|discussion]] page. If the module loads but gives a "<tt>not supported</tt>" or "<tt>not implementeded</tt>" when you try to use some specific file in {{path|/sys/devices/platform/smapi/}}, please report the <tt>dmesg</tt> output and whether the corresponding functionality is available under Windows - maybe your ThinkPad just can't do that.  
+
SMAPI capabilities may depend on the BIOS version as well, so upgrading to the latest version of the BIOS might provide more SMAPI functions (especially true for long-lived BIOS with lots of releases, like the TP-1R).
 +
 
 +
Please update the above and report your experience on the [[Talk:tp_smapi|discussion]] page. If the module loads but gives a "<tt>not supported</tt>" or "<tt>not implementeded</tt>" error when you try to use some specific file in {{path|/sys/devices/platform/smapi/}}, please report the <tt>dmesg</tt> output and whether the corresponding functionality is available under Windows - maybe your ThinkPad just can't do that.  
  
 
While at it, you may also want to add your laptop to the [[list of DMI IDs]].
 
While at it, you may also want to add your laptop to the [[list of DMI IDs]].
 +
 +
=====HDAPS axis orientation=====
 +
<sup>1</sup> The HDAPS axis orientation is set using the <tt>invert</tt> module parameter (at load time) or sysfs attribute (at runtime). The <tt>hdaps</tt> driver of tp_smapi supports all 8 possible sensor orientations (inversion and swapping). You can use [[HDAPS#Visualisation_of_ThinkPad_orientation|hdaps visualisation]] to check if the settings is correct.
 +
 +
The <tt>invert</tt> parameter is an integer between 0 and 7, whose meaning is defined below. (This is confusing. Most people will find it easier to just try all 8 possibilities.)
 +
 +
Let <tt>X</tt> and <tt>Y</tt> denote the hardware readouts. Let <tt>R</tt> denote the laptop's roll (tilt left/right), and let <tt>P</tt> denote the laptop's pitch (tilt forward/backward). The possible values are as follows:
 +
    invert=0:  R= X  P= Y  (same as mainline)
 +
    invert=1:  R=-X  P=-Y  (same as mainline)
 +
    invert=2:  R=-X  P= Y  (new)
 +
    invert=3:  R= X  P=-Y  (new)
 +
    invert=4:  R= Y  P= X  (new)
 +
    invert=5:  R=-Y  P=-X  (new)
 +
    invert=6:  R=-Y  P= X  (new)
 +
    invert=7:  R= Y  P=-X  (new)
  
 
[[Category:Drivers]] [[Category:Patches]]
 
[[Category:Drivers]] [[Category:Patches]]
Line 304: Line 560:
 
* [[KThinkBat]] - display battery status on the KDE <tt>kicker</tt> panel.
 
* [[KThinkBat]] - display battery status on the KDE <tt>kicker</tt> panel.
 
* [[gkrellm-ThinkBat]] - battery status plugin for Gkrellm2
 
* [[gkrellm-ThinkBat]] - battery status plugin for Gkrellm2
 +
* {{CodeRef|thinkpad-smapi.sh}} - script to display various SMAPI information using tp_smapi module.
 +
 +
===See also===
 +
* https://wiki.archlinux.org/index.php/Tp_smapi#Workaround_for_Partially_Supported_Laptops
 +
 +
== Headline text ==

Latest revision as of 09:29, 1 May 2016

The tp_smapi kernel module exposes some features of the ThinkPad hardware/firmware via a sysfs interface. Currently, the main implemented functionality is control of battery charging and extended battery status. The tp_smapi software package also includes an improved version of the HDAPS driver. The underlying hardware interfaces are SMAPI and direct access to the embedded controller.

This driver uses undocumented features and direct hardware access, so it may work unreliably or even damage your hardware; but so far no such damage has been reported.

If you are installing on a recent Thinkpad that has an Ivy Bridge or newer processor (X230, T430, T530, etc.), tp_smapi will not work. You will be mostly limited to thinkpad-acpi capabilities. You can however set battery charge thresholds with tpacpi-bat.

Features

  • tp_smapi driver
    • Battery charge/discharge control
    • Battery status information
  • hdaps driver (compared with the standard hdaps driver)
    • Improved stability
    • Improved model support
    • Improved functionality

Project Homepage / Availability

Installation

Installation from source

You will need the kernel headers and makefiles corresponding to your current kernel version. On Fedora, this means # yum install kernel-devel-$(uname -r) .

# tar xzvf tp_smapi-0.40.tgz
# cd tp_smapi-0.40

Then, either compile and load the driver within the current working directory (for testing):

# make load

OR compile and install into the kernel's module path:

# make install

If you use the HDAPS driver, add HDAPS=1 to also patch the hdaps for compatibility with tp_smapi (this requires a kernel source tree matching the current kernel). Again, either load the driver within the current working directory:

# make load HDAPS=1

OR install into the kernel's module path:

# make install HDAPS=1

To prepare a stand-alone patch against the current kernel tree (including a patch against hdaps and new Kconfig entries):

# make patch

To delete all autogenerated files:

# make clean

The original kernel tree is never modified by any these commands. The /lib/modules directory is modified only by # make install.

Installation in Gentoo

The Gentoo portage system carries a tp_smapi package, which follows the latest version pretty closely. On a Gentoo system, you can install and load as follows.

If you use the HDAPS driver, do this first:

  • Disable the hdaps module in your kernel configuration (Device Drivers → Hardware Monitoring Support → IBM Hard Drive Active Protection System)
  • Rebuild and install the kernel
  • Add the hdaps use flag in /etc/make.conf
  • # rmmod hdaps

Then:

  • # emerge tp_smapi (or install tp_smapi with hdaps support manually, as above)
  • # echo "tp_smapi" >> /etc/modules.autoload.d/kernel-2.6
  • # echo "hdaps" >> /etc/modules.autoload.d/kernel-2.6

Then reboot, or run:

  • # modprobe tp_smapi
  • # modprobe hdaps

NOTE: If # modprobe fails and dmesg says something about __stack_chk_fail(), you probably just compiled your modules with -fstack-protector and/or -fstack-protector-all without having a kernel that supports it. You can either configure your kernel to have CC_STACKPROTECTOR enabled (in Processor type and features if you use # make menuconfig) or edit your make.conf (or, if you're using paludis, your /etc/paludis/bashrc) and remove -fstack-protector and -fstack-protector-all from your CFLAGS. If you choose to enable it in the kernel, be aware that you need a patched GCC for it (and I do not know if the gcc in stage3 is patched).


Installation on Debian and Ubuntu

Since Debian 7 Wheezy and Ubuntu 12.04 Precise you can use 'dkms'. (Note: If installation seems ineffective, confirm you have the linux-headers of your kernel installed, purge tp-smapi-dkms and reinstall.)

  • # apt-get install linux-headers tp-smapi-dkms
  • # modprobe tp_smapi
Hint:
This appears to be the ideal solution. A description of DKMS, from Dell: "DKMS stands for Dynamic Kernel Module Support. It is designed to create a framework where kernel dependent module source can reside so that it is very easy to rebuild modules as you upgrade kernels."

Installation on openSUSE

openSUSE provides rpm packages. Look for them at the package search: [1], search for the package named "tp_smapi".

A step-by-step guide on how a relative linux newbie installed tp_smapi on a Thinkpad W500 running openSuse 11.1 using YAST Software Manager is available here

In case you are taking the hard way around, while compiling on 11.0, make complained about not being able to locate the kernel sources. It worked for me after I did this:

cp /usr/include/linux/aio_abi.h /lib/modules/`uname -r`/build/include/linux/

Battery charge control features

NOTE!
Not all Thinkpad ECs support these charge control features. If you get the message "Operation not supported" when trying to cat for the status of a given parameter, it means your controller does not support that feature.

To set the thresholds for starting and stopping battery charging (in percent of current full charge capacity):

# echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
# echo 70 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
# cat /sys/devices/platform/smapi/BAT0/*_charge_thresh
Hint:
Battery charging thresholds can be used to keep Li-Ion and Li-Polymer batteries partially charged, in order to increase their lifetime.

To prevent charging for 17 minutes (regardless of thresholds):

# echo 17 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes
Hint:
Charge inhibiting can be used to reduce the power draw of the laptop, in order to use an under-spec power supply that can't handle the combined power draw of running and charging. It can also be used to control which battery is charged when using an Ultrabay battery.

To cancel charging preventation:

# echo 0 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes

To force battery discharging (even if connected to AC):

# echo 1 > /sys/devices/platform/smapi/BAT0/force_discharge
Hint:
This can be used to choose which battery is discharged when using an UltraBay battery. For example, see the tp-bat-balance (download) script.

To cancel forced discharge:

# echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge
Hint:
TPBattStat-Applet is a gnome applet for integrating battery balancing with a graphics and/or text display of both batteries in a panel. Battery balancing improves battery life by not leaving one battery empty while the other discharges. For the latest alpha release, see https://github.com/teleshoes/tpbattstat-applet

Making the settings permanent on reboot

If you always use the same type of battery, then you may want the same settings to be configured each time you boot the machine.

If you use various types of battery, then you may want to consider writing some scripts to detect the battery type and apply the appropriate settings.

Debian

It is not necessary to create your own init.d script or modify /etc/rc.local - you just need the package sysfsutils:

# apt-get install sysfsutils

Now, put your desired settings in /etc/sysfs.conf:

# cat >> /etc/sysfs.conf << EOF
# For a LiIon battery in a Thinkpad
devices/platform/smapi/BAT0/start_charge_thresh = 50
devices/platform/smapi/BAT0/stop_charge_thresh = 80
EOF

The init script supplied by sysfsutils will load these settings on each boot.

Battery status features

To view extended battery status such as charging state, voltage, current, capacity, cycle count and model information:

# cat /sys/devices/platform/smapi/BAT0/installed
# cat /sys/devices/platform/smapi/BAT0/state       # idle/charging/discharging
# cat /sys/devices/platform/smapi/BAT0/cycle_count
# cat /sys/devices/platform/smapi/BAT0/current_now # instantaneous current
# cat /sys/devices/platform/smapi/BAT0/current_avg # last minute average
# cat /sys/devices/platform/smapi/BAT0/power_now   # instantaneous power
# cat /sys/devices/platform/smapi/BAT0/power_avg   # last minute average
# cat /sys/devices/platform/smapi/BAT0/last_full_capacity
# cat /sys/devices/platform/smapi/BAT0/remaining_percent
# cat /sys/devices/platform/smapi/BAT0/remaining_running_time
# cat /sys/devices/platform/smapi/BAT0/remaining_charging_time
# cat /sys/devices/platform/smapi/BAT0/remaining_capacity
# cat /sys/devices/platform/smapi/BAT0/design_capacity
# cat /sys/devices/platform/smapi/BAT0/voltage
# cat /sys/devices/platform/smapi/BAT0/design_voltage
# cat /sys/devices/platform/smapi/BAT0/manufacturer
# cat /sys/devices/platform/smapi/BAT0/model
# cat /sys/devices/platform/smapi/BAT0/barcoding
# cat /sys/devices/platform/smapi/BAT0/chemistry
# cat /sys/devices/platform/smapi/BAT0/serial
# cat /sys/devices/platform/smapi/BAT0/manufacture_date
# cat /sys/devices/platform/smapi/BAT0/first_use_date
# cat /sys/devices/platform/smapi/BAT0/temperature # in milli-Celsius
# cat /sys/devices/platform/smapi/ac_connected

The raw status data is also available, including some fields not listed above (in case you can figure them out):

# cat /sys/devices/platform/smapi/BAT0/dump

In all of the above, replace BAT0 with BAT1 to address the 2nd battery.

Note that the battery status readout conflicts with the stock hdaps driver, so if you use hdaps you will need to load tp_smapi using # make load HDAPS=1 (see Bundled hdaps driver below).

On ACPI-enabled systems, most of above information is also available through the files under /proc/acpi/battery. However, the ACPI interface does not include the instantaneous power and cycle count readouts, and does not work well when hotswapping UltraBay batteries.

Scripts

Some scripts can make it easier to grep the information you need from tp_smapi

Other features

There is also sysfs attribute for making direct SMAPI requests to the SM BIOS firmware. Don't touch it unless you really know what you're doing. Example:

# echo '211a 100 0 0' > /sys/devices/platform/smapi/smapi_request; cat /sys/devices/platform/smapi/smapi_request
211a 34b b2 0 0 0 'OK'

The "4b" in the 2nd value, converted to decimal, is 75: the current charging stop threshold (stop_charge_thresh).

Bundled hdaps driver

The tp_smapi package includes a modified version of the hdaps Linux kernel driver used by the HDAPS system. It has remained outside the mainline kernel for a few years for several reasons, [2] including the upstream maintainer's assertion that the new code's anonymous author was under a NDA. (Although this would not normally expose the kernel team to litigation.) [3] [4] [5]

To use tp_smapi and hdaps concurrently, you must use the modified version.

To build the modified version, simply append the HDAPS=1 parameter to the make command (see Installation above):

# make load HDAPS=1

or

# make install HDAPS=1

If you don't do that, you will not be able to load tp_smapi (and its support module thinkpad_ec) when hdaps is loaded, and vice versa. You can use rmmod to switch between these modules.

Note that some of the battery status is also visible through ACPI (/proc/acpi/battery/*), independently of tp_smapi.

The modified hdaps has several changes:

  • The hdaps driver in mainline kernels conflicts with the extended battery status (they use the same IO ports). The modified hdaps coordinates this access through the bundled thinkpad_ec driver.
  • The modified hdaps driver fixes reliability and improves support for recent ThinkPad models (*60 and newer), since unlike the mainline driver, it correctly follows the Embedded Controller communication protocol.
  • Several other improvements, such as the ability to control the polling rate.

Troubleshooting

thinkpad_ec: cannot claim io ports 0x1600-0x161f

The "thinkpad_ec: cannot claim io ports 0x1600-0x161f!" error message is printed when loading the thinkpad_ec module on some recent ThinkPad models. This occurs because the ACPI BIOS DSDT is reserving ports used by tp_smapi.

As a workaround, add the force_io=1 module parameter to thinkpad_ec in /etc/modprobe.conf (or your distribution's equivalent). Add the line:

options thinkpad_ec force_io=1

For transient testing, load the modules as follows:

# make load HDAPS=1 FORCE_IO=1

Note: force_io option was added in tp_smapi v0.40 (released 2008-12-16).

Models which need this option include: T400, T500, X60s, X61, X301

More information:

thinkpad_ec: no ThinkPad embedded controller!

If you get "thinkpad_ec: no ThinkPad embedded controller!" when trying to load the module on a supported model listed below, you should upgrade your BIOS. Some early BIOS (like 1.x on the X31) don't handle the embedded controller.

T60p writing to start_charge_thresh/stop_charge_thresh does not work!

Writing to /sys/devices/platform/smapi/BAT0/start_charge_thresh succeeds, but the older value does not change. Solution: unknown. If you know a solution please update here.

UPDATE: Failure to effectively change sysfs values sometimes happens at boot time (through sysfs.conf OR etc/local.start for instance) when the values have never previously been changed manually (ie using echo from a shell). Try initializing the values manually before including them in boot-time scripting.

Model-specific status

Tip: The thinkpad-acpi module reports both the BIOS and EC firmware versions when it loads.

tp_smapi feature support matrix
A series
Model and machine type start_
charge_
thresh
stop_
charge_
thresh
inhbit_
charge_
minutes
force_
discharge
battery status files Bundled HDAPS HDAPS axis orientation1 tp_smapi version BIOS version EC
firmware
version
Notes
A22p 2629-USG no no no no no N/A N/A
A30 no no no no yes N/A N/A
G series
Model and machine type start_
charge_
thresh
stop_
charge_
thresh
inhbit_
charge_
minutes
force_
discharge
battery status files Bundled HDAPS HDAPS axis orientation1 tp_smapi version BIOS version EC
firmware
version
Notes
G41 yes no yes unknown unknown N/A N/A
R series
Model and machine type start_
charge_
thresh
stop_
charge_
thresh
inhbit_
charge_
minutes
force_
discharge
battery status files Bundled HDAPS HDAPS axis orientation1 tp_smapi version BIOS version EC
firmware
version
Notes
R31 no no no no no N/A N/A No SMAPI BIOS
R40 no no no no unknown N/A N/A
R50 unknown no unknown unknown yes unknown unknown
R50e 1834-JAG yes no yes yes yes N/A N/A
R50e 1834-5US yes no yes yes yes N/A N/A
R50p no no no no yes unknown unknown
R51 18* yes no yes yes yes yes 0 0.32 3.22 Machine types 1829, 1830, 1831 and 1836
R51 28* yes no yes unknown yes unknown unknown 1.29 Machine types 2883, 2887, 2888, 2889, 2894 and 2495
R52 yes yes yes yes yes yes 0 0.33 1.29 1.06
R60 yes yes yes yes yes yes 1 0.33
R61 yes yes unknown unknown yes yes 1 0.35-test1 7KETA7WW 2.07 7KHT24WW 1.08 Machine type 8918
R61i yes yes yes yes yes yes 1 0.41 Machine types 7732, 8250
R400 yes yes yes yes yes yes 1 0.40-1 Machine type 7443
R500 yes yes unknown unknown yes unknown 1 0.40-1
T series
Model and machine type start_
charge_
thresh
stop_
charge_
thresh
inhbit_
charge_
minutes
force_
discharge
battery status files Bundled HDAPS HDAPS axis orientation1 tp_smapi version BIOS version EC
firmware
version
Notes
T20 no no no no no N/A N/A Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.
T22 no no no no no N/A N/A Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.
T23 no no no no yes N/A N/A
T30 no no no no yes N/A N/A
T40 no no no no yes N/A N/A
T40 2373-72U no no no no yes N/A N/A 0.40 3.23 1RHT71WW-3.04
T40p no no no no yes N/A N/A
T41 no no no no yes unknown unknown 0.37 3.23 3.04
T41 no no no no yes unknown unknown 0.40 3.20 3.04
T41 no no no no yes unknown unknown 0.40 3.23 3.04
T41p 2373-AM9 no no no no yes yes 1 0.32 3.20 v3.04
T42 yes no yes yes yes unknown unknown
T42p 2373-KXU yes no yes yes yes yes 1 0.32 3.21 Stop charge threshold works in Windows, but dmesg says "__get_real_thresh: cannot get stop_thresh of bat=0: Function is not supported by SMAPI BIOS".
T42p 2373-KUU yes no yes unknown yes unknown unknown
T43 2686 yes yes yes yes yes yes 0 0.33 1.27
T43p yes yes yes yes yes unknown 0
T60 yes yes unknown yes yes yes 7 0.32
T60 yes yes unknown yes yes yes 1 0.34
T60 1951-24G yes yes unknown yes yes yes unknown 0.36 1.09a
T60 2007-FSG yes yes yes yes yes unknown unknown 0.39 1.10 1.05b
T60 1951-CZ1 yes yes yes yes yes yes 1 0.40 2.23 1.07
T60p 8743-CTO yes yes yes yes yes yes 1 0.32
T61 yes yes yes yes yes yes 1 0.32 ref
T61p 6457-7XG yes yes yes yes yes yes 1 0.32 ref
T400 yes yes yes yes yes yes 1 0.40 1.19 Requires force_io=1 parameter to thinkpad_ec
T400s yes yes yes yes yes yes 2 0.40 1.06 Requires invert=2 paramteter to hdaps
T410s yes yes yes unknown yes yes 4 0.40 1.14 Requires invert=4 accoding to hdaps-gl
T410 yes yes yes yes yes yes 1 0.40 1.25
T500 yes yes yes yes yes yes 1 0.40 2.07 Requires force_io=1 parameter to thinkpad_ec
T510 yes yes yes yes yes yes 7 0.40 1.12 1.08
T510 yes yes yes yes yes yes 7 0.40 1.35 1.17
W series
Model and machine type start_
charge_
thresh
stop_
charge_
thresh
inhbit_
charge_
minutes
force_
discharge
battery status files Bundled HDAPS HDAPS axis orientation1 tp_smapi version BIOS version EC
firmware
version
Notes
W700 2757-CTO yes yes yes yes yes unknown unknown 0.40 2.08 1.05
W500 4062-4EG yes yes unknown unknown unknown unknown unknown 0.40 unknown unknown
X series
Model and machine type start_
charge_
thresh
stop_
charge_
thresh
inhbit_
charge_
minutes
force_
discharge
battery status files Bundled HDAPS HDAPS axis orientation1 tp_smapi version BIOS version EC
firmware
version
Notes
X22 no no no no no N/A N/A no EC controller found
X24 no no no unknown yes N/A N/A
X30 no no no no yes N/A N/A 0.34 1.09
X31 no no no no yes N/A N/A 0.40 3.02
X32 no no no no yes N/A N/A
X40 yes yes yes yes yes yes 3 0.32 2.08 1.62
X41 yes yes yes yes yes yes 3 0.32
X41 Tablet yes yes yes yes yes yes 3 0.40 75ET60WW (2.06 ) 75HT20WW (1.02)
X60 yes yes yes yes yes yes 6 2.07 1.10 2.6.20 issue (see discussion)
X60 Tablet yes yes yes yes yes yes 3 0.34 7JET25WW (1.10 ) 7JHT13WW 1.04 ref ref
X60s 1704-5UG yes yes unknown unknown unknown unknown 3 0.34 7BETD2WW 2.13 7BHT40WW 1.13
X60s 1704-56G yes yes yes unknown yes unknown 3 0.40 7BETD5WW 2.16 7BHT40WW 1.13
X61 7673-CTO yes yes yes yes yes yes 6 0.40 7NETB9WW (2.19) 7MHT25WW-1.03
X61 7675-4KU yes yes yes yes yes yes 6 0.34 7NET30WW (1.11 ) 7MHT24WW 1.02
X61 Tablet yes yes unknown unknown yes yes 6 0.32
X61s yes yes yes yes yes yes 6 / 3 0.32 ref says 3 but conflicting report received
X100e yes yes yes yes yes unknown unknown 0.40 6XET36WW (1.20a) 6XHT36WW (1.176000) x100e NTS4UTX, dual-core L625 also works (NTT27MH)
X120e no yes yes no yes unknown unknown 0.41 8FET32WW (1.16 ) unknown model 0596CTO
X200 yes yes yes yes yes yes 7 0.40 6DET40WW (2.04 ) 7XHT22WW 1.04
X200s 7470-X01 yes yes unknown unknown yes yes 5 0.40 6DET63WW (3.13) 7XHT24WW 1.06
X201 yes yes unknown unknown yes yes 6 / 5 0.40 ECP: It said 6 here, but see discussion page
X201s yes yes unknown unknown yes yes 5 0.40 6QET44WW (1.14 ) ECP: 1.09/1.09
X220 4290-2GW no no no no no no no 0.40 8DET46WW (1.16 ) "unknown"
X220 4286-CTO no yes yes no yes yes unknown 0.41 8DET54WW (1.24 ) unknown HDAPS works fine, don't know wich axis orientation thougth
X300 yes yes yes unknown yes yes unknown 0.37 7TET25WW (1.02 ) 7THT15WW 1.00c
Z series
Model and machine type start_
charge_
thresh
stop_
charge_
thresh
inhbit_
charge_
minutes
force_
discharge
battery status files Bundled HDAPS HDAPS axis orientation1 tp_smapi version BIOS version EC
firmware
version
Notes
Z60m yes yes yes yes yes unknown unknown
Z60t yes yes unknown unknown yes unknown unknown
Z61m yes yes yes yes yes yes 0 0.32
Z61t yes yes yes yes yes yes unknown ref
Z61p yes yes unknown yes yes yes unknown
SL series and IdeaPad

The ThinkPad SL series and IdeaPad series have firmware that is completely different from other ThinkPad models. Neither tp_smapi nor thinkpad-acpi support these models.


SMAPI capabilities may depend on the BIOS version as well, so upgrading to the latest version of the BIOS might provide more SMAPI functions (especially true for long-lived BIOS with lots of releases, like the TP-1R).

Please update the above and report your experience on the discussion page. If the module loads but gives a "not supported" or "not implementeded" error when you try to use some specific file in /sys/devices/platform/smapi/, please report the dmesg output and whether the corresponding functionality is available under Windows - maybe your ThinkPad just can't do that.

While at it, you may also want to add your laptop to the list of DMI IDs.

HDAPS axis orientation

1 The HDAPS axis orientation is set using the invert module parameter (at load time) or sysfs attribute (at runtime). The hdaps driver of tp_smapi supports all 8 possible sensor orientations (inversion and swapping). You can use hdaps visualisation to check if the settings is correct.

The invert parameter is an integer between 0 and 7, whose meaning is defined below. (This is confusing. Most people will find it easier to just try all 8 possibilities.)

Let X and Y denote the hardware readouts. Let R denote the laptop's roll (tilt left/right), and let P denote the laptop's pitch (tilt forward/backward). The possible values are as follows:

   invert=0:   R= X  P= Y   (same as mainline)
   invert=1:   R=-X  P=-Y   (same as mainline)
   invert=2:   R=-X  P= Y   (new)
   invert=3:   R= X  P=-Y   (new)
   invert=4:   R= Y  P= X   (new)
   invert=5:   R=-Y  P=-X   (new)
   invert=6:   R=-Y  P= X   (new)
   invert=7:   R= Y  P=-X   (new)

Tools using this driver

The driver's interface can be accessed directly through the files under /sys/devices/platform/smapi, or via the following tools:

See also

Headline text