# T420 and tp_smapi

## kaffeesurogat

Hi all,

finally i got my T420 and gentoo is something like up and running. One thing is still missing.

The tp_smapi module doesn't seem to work. According to the following link  

http://thinkpad-forum.de/threads/116122-tp_smapi-Ladeschwellen-auf-T420%28s%29-X220-...-Tester-gesucht

mr. specialist was able to add a patch to the tp_smapi module which isn't included in the unstable  tc_smapi-0.40-r3 version. 

Can somebody give me some hints how to install this patch with gentoo ?

Thanks,

Nico

----------

## DirtyHairy

I did the same trick using a modified ebuild in a local overlay; basically, you have to add the T420 to the list of supported machines. I wanted to submit the change to the bug tracker, but didn't when I realized that not all functions work as expected (in particular, changing the charge thresholds). However, my main reason for installing it was the enhanced hdaps module which works fine.

Anyway, the patch you need is

```
--- a/thinkpad_ec.c     2011-06-25 18:38:10.149829023 +0200

+++ b/thinkpad_ec.c     2011-06-25 18:38:51.157829163 +0200

@@ -456,6 +456,7 @@

                TP_DMI_MATCH("IBM", "ThinkPad A30"),

                TP_DMI_MATCH("IBM", "ThinkPad T23"),

                TP_DMI_MATCH("IBM", "ThinkPad X24"),

+               TP_DMI_MATCH("LENOVO", "ThinkPad T420"),

                { .ident = NULL }

        };

        return dmi_find_substring(DMI_DEV_TYPE_OEM_STRING,
```

 Clone the existing tp_smapi ebuild into your local overlay, add the patch to the files directory and then add it to the epatch command in src_prepare. If you did everything correctly (and don't forget ebuild digest  :Wink:  ), the modified ebuild will install the patched driver.

----------

## Clad in Sky

Hi.

I've also got some problems with my T420.

I followed the power saving guides on www.thinkpad-wiki.org so far and installed the tlp package. 

For some reason, tlp-stat is saying thinkpad_acpi wasn't available

```

/proc/acpi/ibm/thermal = (thinkpad_acpi not available)

```

So I can't get a reading of my temperatures. However, in the kernel (3.0.6-gentoo), thinkpad acpi is set.

Can anyone help me there?

The other thing is tp_smapi. Emerging tp_smapi-0.40-r3 works, but upon modprobing thinkpad_ec, tp_smapi, I get

```

FATAL: Error inserting tp_smapi (/lib/modules/3.0.6-gentoo/extra/tp_smapi.ko): No such device

```

Is this the error you are getting as well and what the patch is for?

----------

## DirtyHairy

/proc/acpi/ibm/thermal doesn't exist for me either, but as I don't need it, I didn't try to find out why. Could be that the T420 does not support it anymore, or that the thinkpad_acpi driver needs to be upated for the newer models. tp_smapi won't work out of the box as it doesn't recognize the T420 as a supported device. The patch adds the T420 to the whitelist, enabling support. With the patch, you get limited tp_smapi support, but not everything works as it should (e.g. setting charge thresholds). However, the hdaps in the tp_smapi actually works with this patch and can be used to enable active disk protection using hdapsd.

----------

## Clad in Sky

Thanks.

I think I'll wait for an updated version.

The laptop works so far and that's the most important thing.

----------

## sDoky

I have found (do not know where) a patch for tp_smapi to work on my t420 (i5 sandy bridge). I cannot remember where have I gotten this ... I usually compile it by typing:

```
# make clean install HDAPS=1
```

 The version from portage does not load for my machine (this does). If anyone could get this into portage (like an USE flag for tp_smapi for example), it would be sooo great. Cause I have to recompile this module every time I upgrade kernel, and then I have to overwrite those files with this ...

http://www.stud.fit.vutbr.cz/~xdokou10/tp_smapi-0.40_t420.tar.gz

EDIT: I have posted a reply to found bug on this matter

https://bugs.gentoo.org/show_bug.cgi?id=375697&list_id=523099

----------

## Garg0yl3

Hi All,

I am about to purchase the T420 i5 with the intention of running Gentoo on it.

Do any of you have problems with heat/continuous fan with this laptop?

And also, what is the battery life like on Gentoo? Lastly, which kernel version

are you running?

Thanks heaps.

James

----------

## sDoky

Hi, I am running 

```
sdoky-t420 ~ # uname -a

Linux sdoky-t420 3.0.7-gentoo #6 SMP PREEMPT Fri Nov 4 09:15:31 CET 2011 x86_64 Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz GenuineIntel GNU/Linux
```

I have the 6-cell battery, it does not last as much as on windows (concerning all power consuming tunings), but not much. This kernel about 4h, with powersave cpu governor and LCD set to 30% brightness.

Everything works, including fingerprint reader, webcam, stereo microphone, just everything ...

Great machine, go ahead and buy  :Wink: 

EDIT: the CPU goes up to 80°C (compiling for quite a while), but the laptop has great cooling system and it is neither loud, nor hot (on the surface).

The Lenovo dock, they sell separately does help cooling a little bit, though it is not needed (imho). I definetely recommend the dock as it turns your laptop into powerful desktop.

----------

## CkoTuHa

btw, all thinkpad ownwers perhaps should update their bioses to the most recent one.

they had issues with fan stalling/speeding and cpu temps escalating:

http://forum.lenovo.com/t5/T400-T500-and-newer-T-series/T420s-Fan-noise-Issue/td-p/443569

so go and update your bios, yeah

----------

## Garg0yl3

Thanks for the info sDoky.. If you want to try improve your battery life under linux,

have a look here: http://www.fewt.com/2011/09/about-kernel-30-power-regression-myth.html

CkoTuHa, I checked out the thread on the lenovo forum you provided, but it seems that the BIOS

fix is not out yet.. the Lenovo staff said it should be released mid-Nov, that's for the T420s, not

sure when the fix for the T420 is coming out.

----------

## Mr. M

Setting the battery thresholds doesn't work using tp_smapi on T420/T420s, see this discussion:

https://github.com/evgeni/tp_smapi/issues/3

Reportedly, setting the thresholds using "tpacpi-bat" works (see link above). But I haven't tried it myself (I set the thresholds in Windows). Also, the BIOS update may fix this problem.

----------

## Helmering

Hi forum,

Battery threshold start/stop using tpacpi-bat https://github.com/teleshoes/tpbattstat-applet/blob/master/tpacpi-bat now works flawlessly and persistant on my:

Thinkpad W520

BIOS 1.34

- As it is a single Perl-Script I copied it in /usr/bin/local and created some alias in /etc/bash/bashrc for faster controll.

- script requires (masked) acpi-call.

Cheers

----------

