)]}'
{
  "commit": "b49dc13a7f10e003e176263215411ccea99380f1",
  "tree": "808208abb776310c3f66f3dea2b68b169fdc5aef",
  "parents": [
    "46c117c706ef4f4086cbe24d24fd0f19551e96bd"
  ],
  "author": {
    "name": "Kamil Iskra",
    "email": "kamil@iskra.name",
    "time": "Fri Nov 16 22:28:58 2012 +0100"
  },
  "committer": {
    "name": "Greg Kroah-Hartman",
    "email": "gregkh@linuxfoundation.org",
    "time": "Mon Dec 17 10:37:45 2012 -0800"
  },
  "message": "ACPI / battery: Correct battery capacity values on Thinkpads\n\ncommit 4000e626156935dfb626321ce09cae2c833eabbb upstream.\n\nAdd a quirk to correctly report battery capacity on 2010 and 2011\nLenovo Thinkpad models.\n\nThe affected models that I tested (x201, t410, t410s, and x220)\nexhibit a problem where, when battery capacity reporting unit is mAh,\nthe values being reported are wrong.  Pre-2010 and 2012 models appear\nto always report in mWh and are thus unaffected.  Also, in mid-2012\nLenovo issued a BIOS update for the 2011 models that fixes the issue\n(tested on x220 with a post-1.29 BIOS).  No such update is available\nfor the 2010 models, so those still need this patch.\n\nProblem description: for some reason, the affected Thinkpads switch\nthe reporting unit between mAh and mWh; generally, mAh is used when a\nlaptop is plugged in and mWh when it\u0027s unplugged, although a\nsuspend/resume or rmmod/modprobe is needed for the switch to take\neffect.  The values reported in mAh are *always* wrong.  This does\nnot appear to be a kernel regression; I believe that the values were\nnever reported correctly.  I tested back to kernel 2.6.34, with\nmultiple machines and BIOS versions.\n\nSimply plugging a laptop into mains before turning it on is enough to\nreproduce the problem.  Here\u0027s a sample /proc/acpi/battery/BAT0/info\nfrom Thinkpad x220 (before a BIOS update) with a 4-cell battery:\n\npresent:                 yes\ndesign capacity:         2886 mAh\nlast full capacity:      2909 mAh\nbattery technology:      rechargeable\ndesign voltage:          14800 mV\ndesign capacity warning: 145 mAh\ndesign capacity low:     13 mAh\ncycle count:              0\ncapacity granularity 1:  1 mAh\ncapacity granularity 2:  1 mAh\nmodel number:            42T4899\nserial number:           21064\nbattery type:            LION\nOEM info:                SANYO\n\nOnce the laptop switches the unit to mWh (unplug from mains, suspend,\nresume), the output changes to:\n\npresent:                 yes\ndesign capacity:         28860 mWh\nlast full capacity:      29090 mWh\nbattery technology:      rechargeable\ndesign voltage:          14800 mV\ndesign capacity warning: 1454 mWh\ndesign capacity low:     200 mWh\ncycle count:              0\ncapacity granularity 1:  1 mWh\ncapacity granularity 2:  1 mWh\nmodel number:            42T4899\nserial number:           21064\nbattery type:            LION\nOEM info:                SANYO\n\nCan you see how the values for \"design capacity\", etc., differ by a\nfactor of 10 instead of 14.8 (the design voltage of this battery)?\nOn the battery itself it says: 14.8V, 1.95Ah, 29Wh, so clearly the\nvalues reported in mWh are correct and the ones in mAh are not.\n\nMy guess is that this problem has been around ever since those\nmachines were released, but because the most common Thinkpad\nbatteries are rated at 10.8V, the error (8%) is small enough that it\nsimply hasn\u0027t been noticed or at least nobody could be bothered to\nlook into it.\n\nMy patch works around the problem by adjusting the incorrectly\nreported mAh values by \"10000 / design_voltage\".  The patch also has\ncode to figure out if it should be activated or not.  It only\nactivates on Lenovo Thinkpads, only when the unit is mAh, and, as an\nextra precaution, only when the battery capacity reported through\nACPI does not match what is reported through DMI (I\u0027ve never\nencountered a machine where the first two conditions would be true\nbut the last would not, but better safe than sorry).\n\nI\u0027ve been using this patch for close to a year on several systems\nwithout any problems.\n\nReferences: https://bugzilla.kernel.org/show_bug.cgi?id\u003d41062\nAcked-by: Henrique de Moraes Holschuh \u003chmh@hmh.eng.br\u003e\nSigned-off-by: Rafael J. Wysocki \u003crafael.j.wysocki@intel.com\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@linuxfoundation.org\u003e\n\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "7dd3f9fb9f3f21b808e30b8aa78f65fce7b2275a",
      "old_mode": 33188,
      "old_path": "drivers/acpi/battery.c",
      "new_id": "6ea287e2229657dbb644c940ba8944cc0e9385a6",
      "new_mode": 33188,
      "new_path": "drivers/acpi/battery.c"
    }
  ]
}
