[lkml]   [2011]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: [PATCH 0/3] power: Add LP8727 charger driver
Hello, Power Supply Class Maintainers

Would you review new LP8727 patches ?
I'd like to share your opinion.

Thanks & BR
Milo (Woogyom) Kim
( or

-----Original Message-----
From: Kim, Milo
Sent: Wednesday, September 07, 2011 5:54 PM
To: ''
Cc: ''; ''; ''
Subject: [PATCH 0/3] power: Add LP8727 charger driver

This patch supports the LP8727 charger driver.

* General features
National Semiconductor LP8727 is the battery charger with Micro/Mini USB interface.
This IC includes below functions
- I2C interface for accessing user registers
- Single input Li-Ion battery charger
- Charger input ID detection from Micro/Mini USB
- Multiplexing switches on USB, UART

* Driver Description
1) Interrupt
When the charger events occur(attached/detached), the LP8727 generates the interrupt.
Then the host will read 2 interrupt registers and do ID detection, multiplexing switches and updating power supplies.
It takes few debounce time (about 270ms) to get updated status.

2) ID detection
LP8727 detects the charger and the device ID is updated in register area.
Available device ID : TA(Travel Adaptor), Dedicated charger, USB charger and USB downstream

3) Power supplies
Three power supplies are registered when LP8727 driver is detected.
- AC : adapter
- USB : USB charger
- Battery : Li-On battery

AC and USB are supplied to the battery.
Charging parameters can be set as changed charger type.
For this function, 'external_power_changed()' and 'supplied_to' are used.

4) Platform data for lp8727
There are two reason for providing lp8727 platform data.

a) Supporting limited power supply properties
LP8727 doesn't support the fuel gauging and no way to check whether battery exists or not.
So below properties can't be read from the LP8727 registers

If the system has fuel gauging and battery detection,
then I would recommend mapping functions in the platform data when adding i2c device.

Ex) static struct lp8727_platform_data lp8727_chg_pdata = {
.get_batt_present = dummy_get_batt_present,
.get_batt_level = dummy_get_batt_level;
.get_batt_capacity = dummy_get_batt_capacity,
.get_batt_temp = dummy_get_batt_temp,

When user-space gets battery properties, the mapping function is called.

Ex) static int lp8727_battery_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent);


// dummy_get_batt_level() will be called
val->intval = pchg->pdata->get_batt_level();


b) Supporting platform specific charging parameters
The values of EOC(End of Charge) and charging current depend on the charger type.(ac or usb)
For example, during charging battery with ac adaptor, eoc level is 10% of Vterm and charging current is 400mA.
(Vterm : charging termination voltage)
But with USB charger, charging current is set to 500mA.
This value is platform specific data.

Ex) static struct lp8727_platform_data lp8727_chg_pdata = {

.ac = {
.eoc_level = EOC_10P,
.ichg = ICHG_400mA,
.usb = {
.eoc_level = EOC_10P,
.ichg = ICHG_500mA,

Then this value will be updated after power_supply_changed() is called.

Ex) static void lp8727_charger_changed(struct power_supply *psy)
eoc_level = pchg->chg_parm->eoc_level;
ichg = pchg->chg_parm->ichg;
val = (ichg << 4) | eoc_level;
(void)lp8727_i2c_write(pchg, CHGCTRL2, &val, 1);

* Tested on OMAP3530 board

Best Regards
Milo (Woo Gyom) KIM
National Semiconductor

 \ /
  Last update: 2011-10-12 04:01    [W:0.029 / U:3.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site