177 Commits

Author SHA1 Message Date
Matt Sealey
ec41138398 sbs: fix for battery status active low change 2011-02-23 21:22:15 -06:00
Matt Sealey
2b25c869c4 sbs: small fixes
* add health property and remove the state in the structure that kept the values previously
* reduce cache time to 2.5 seconds to make it quicker to respond to AC events
* add supplicants to the mains supply so that when AC detection hits, battery gets poked too
2011-02-20 03:05:28 -06:00
Matt Sealey
218e736adc power_supply: add health properties as per SBS 1.10a 2011-02-20 02:17:56 -06:00
Matt Sealey
e4cba1b35d sbs: move away from resources and weird irq structures and use the input subsystem to provide us with notification of battery status events 2011-02-20 01:37:03 -06:00
Saleem Abdulrasool
92c97de2a4 sbs: dont send i2c messages if the battery is not present 2011-02-19 11:16:44 -08:00
Saleem Abdulrasool
0b908afc5b sbs: refactor power source presence detection
Add two utility functions:
   - bool battery_present(const struct sbs_battery *)
   - bool mains_present(const struct sbs_battery *)
2011-02-19 11:16:43 -08:00
Saleem Abdulrasool
301355f70f sbs: BUG_ON -> WARN_ON 2011-02-19 10:32:13 -08:00
Saleem Abdulrasool
01ff0a3ebb sbs: add read/write locking around battery accesses 2011-02-19 09:58:14 -08:00
Saleem Abdulrasool
8338937bb9 sbs: follow the pattern from sbs_init 2011-02-19 09:58:14 -08:00
Saleem Abdulrasool
9e94b56cb9 sbs: constantly read battery info until we succeed 2011-02-19 09:58:13 -08:00
Saleem Abdulrasool
25fb1967fb sbs: ensure that we have an IRQ resource 2011-02-19 09:58:13 -08:00
Saleem Abdulrasool
cfe8c4b11d sbs: request IRQs first to simplify error handling 2011-02-19 09:58:12 -08:00
Saleem Abdulrasool
2e40d0ec32 sbs: ensure that i2c_client does not have an invalid pointer 2011-02-19 09:58:11 -08:00
Saleem Abdulrasool
c375f68069 sbs: wrap mx51 hack in CONFIG_MACH_MX51_EFIKASB 2011-02-19 09:58:11 -08:00
Steev Klimaszewski
cb3659f02e sbs: Hack for LGC0
The battery for the EfikaMX Smartbook reports itself as LGC0 however the battery states that it is Li-Ion.
2011-02-16 00:21:48 -06:00
Steev Klimaszewski
95ed57b9f9 Merge branch 'efikasb-10.08.00' of gitorious.org:efikamx/linux-kernel into efika 2011-02-13 20:14:24 -06:00
Steev Klimaszewski
bbfb3eb220 sbs: Change license from BSD-3 to Dual BSD/GPL
Since we use a GPL only symbol, the kernel won't let us make SBS a module.
Change license to Dual BSD/GPL to make it happy.
2011-02-13 20:12:04 -06:00
Saleem Abdulrasool
6f73458004 sbs: get battery info on first request
It seems that performing the battery info query too early can potentially cause
a race with the i2c layer.  batt->platform ends up being NULL for some reason,
and a kernel oops ensues.  Instead, just track the state of the info fields, and
if it is not valid on the first data access, just fetch the data then.
2011-02-13 18:11:03 -08:00
Matt Sealey
83c22e8872 battery: remove support for the old battery driver, and make it tristatable. 2011-02-13 19:40:02 -06:00
Saleem Abdulrasool
fc88ab894a sbs: better macro names 2011-02-01 23:05:25 -08:00
Saleem Abdulrasool
b31ad5bebf sbs: log information for relearn cycle requests and !initialised states 2011-02-01 22:45:57 -08:00
Saleem Abdulrasool
d6bc5bf05f sbs: add delayed work to refresh the data 2011-02-01 21:15:31 -08:00
Saleem Abdulrasool
ba4bddc525 sbs: change timeout to 10s 2011-02-01 21:08:28 -08:00
Saleem Abdulrasool
47f43e08a4 sbs: define additional chemistries 2011-01-29 20:58:09 -08:00
Saleem Abdulrasool
4655f71d0f sbs: add support for presence/alert IRQs 2011-01-29 20:58:08 -08:00
Saleem Abdulrasool
bbd965e08c sbs: initialise the returned value for mains 2011-01-29 15:52:26 -08:00
Saleem Abdulrasool
848faa6023 sbs: check function pointer before actually using it 2011-01-29 15:52:26 -08:00
Saleem Abdulrasool
d0e894df9e sbs: fix off-by-1 in string reading 2011-01-29 15:52:26 -08:00
Saleem Abdulrasool
59992d3a3d sbs: handle signed integer values correctly 2011-01-26 21:40:15 -08:00
Saleem Abdulrasool
dd755017f9 sbs: always report a value, 0 if the value is unavailable 2011-01-26 20:46:49 -08:00
Saleem Abdulrasool
5070e11542 sbs: rename platform insertion status functions 2011-01-26 20:42:18 -08:00
Saleem Abdulrasool
2b688d086c sbs: uniform names
current is a macro for the current process.  Use _current instead of current_now
as all the other cached fields are named the same as the register they
correspond to.  Also, add in a comment about the special relationship between
_serial_number and serial_number.
2011-01-26 19:34:30 -08:00
Saleem Abdulrasool
7dc6e014d1 sbs: reorganise function layout 2011-01-26 19:31:23 -08:00
Saleem Abdulrasool
1c11307698 sbs: clearer names for the battery/mains 2011-01-26 19:28:56 -08:00
Saleem Abdulrasool
7953c7ad6b sbs: dont leak memory
The power supply system does not actually expect allocated strings that it will
manage.  We were allocating the strings, expecting the power supply class driver
to clean them up, and as a result had a massive leak.  Fix this by storing the
string in the cache and returning a reference to that string.

This effectively overhauls the sbs_battery_field.  It is renamed
sbs_battery_register which is more accurate.  There is now string handling logic
for the string reading case.  The int/uint types are handled the same, so there
is a single read type for those two value types.
2011-01-26 19:08:34 -08:00
Saleem Abdulrasool
d07ef9f5f7 sbs: make mWh reporting correct 2011-01-26 19:08:34 -08:00
Saleem Abdulrasool
7c7076df28 sbs: x^0 = 1, not 0 2011-01-25 19:48:45 -08:00
Saleem Abdulrasool
f75f50eefe sbs: current_now is a signed value 2011-01-25 19:48:45 -08:00
Saleem Abdulrasool
c1cb15151c sbs: slightly clearer return path 2011-01-25 19:48:45 -08:00
Saleem Abdulrasool
955db47146 power: fix manufacturer and serial number reporting in sysfs 2011-01-25 19:48:44 -08:00
Saleem Abdulrasool
53eca9c65d sbs: support mains/battery availability checks 2011-01-25 19:48:44 -08:00
Saleem Abdulrasool
fffe14628f sbs: handle strings correctly 2011-01-25 00:04:48 -08:00
Saleem Abdulrasool
5e231689ba add new SBS driver 2011-01-24 11:37:35 -06:00
Matt Sealey
db772e6a6d battery: SBS gives times in minutes, power_supply class specifies seconds. Multiple values by 60. 2010-12-23 11:42:34 -06:00
Saleem Abdulrasool
4fcc3a542f add efikasb_batt_write 2010-11-29 18:51:51 -06:00
Saleem Abdulrasool
7379fcc430 report energy and charge full design 2010-11-29 18:50:33 -06:00
Saleem Abdulrasool
3124207d02 report energy and charge full 2010-11-29 18:50:30 -06:00
Saleem Abdulrasool
67090153be report energy and charge now 2010-11-29 18:50:27 -06:00
Saleem Abdulrasool
6b0cc6cd94 remove unnecessary goto usage in efikasb_batt_read 2010-11-29 18:50:25 -06:00
Saleem Abdulrasool
ce2529c70a fix whitespace 2010-11-29 18:50:21 -06:00