Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176421
b: refs/heads/master
c: e98c73a
h: refs/heads/master
i:
  176419: 0a6cf25
v: v3
  • Loading branch information
Paul Fertser authored and Anton Vorontsov committed Nov 16, 2009
1 parent a08b86f commit e25c59b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 31b4ff06e01a9a98a8e6ae6e8c42213648eec1d1
refs/heads/master: e98c73a24f33d6f54402f5cef2e7bf282d1d1fcc
46 changes: 0 additions & 46 deletions trunk/drivers/power/pcf50633-charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ struct pcf50633_mbc {
struct power_supply usb;
struct power_supply adapter;
struct power_supply ac;

struct delayed_work charging_restart_work;
};

int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma)
Expand Down Expand Up @@ -236,44 +234,10 @@ static struct attribute_group mbc_attr_group = {
.attrs = pcf50633_mbc_sysfs_entries,
};

/* MBC state machine switches into charging mode when the battery voltage
* falls below 96% of a battery float voltage. But the voltage drop in Li-ion
* batteries is marginal(1~2 %) till about 80% of its capacity - which means,
* after a BATFULL, charging won't be restarted until 80%.
*
* This work_struct function restarts charging at regular intervals to make
* sure we don't discharge too much
*/

static void pcf50633_mbc_charging_restart(struct work_struct *work)
{
struct pcf50633_mbc *mbc;
u8 mbcs2, chgmod;

mbc = container_of(work, struct pcf50633_mbc,
charging_restart_work.work);

mbcs2 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS2);
chgmod = (mbcs2 & PCF50633_MBCS2_MBC_MASK);

if (chgmod != PCF50633_MBCS2_MBC_BAT_FULL)
return;

/* Restart charging */
pcf50633_reg_set_bit_mask(mbc->pcf, PCF50633_REG_MBCC1,
PCF50633_MBCC1_RESUME, PCF50633_MBCC1_RESUME);
mbc->usb_active = 1;
power_supply_changed(&mbc->usb);

dev_info(mbc->pcf->dev, "Charging restarted\n");
}

static void
pcf50633_mbc_irq_handler(int irq, void *data)
{
struct pcf50633_mbc *mbc = data;
int chg_restart_interval =
mbc->pcf->pdata->charging_restart_interval;

/* USB */
if (irq == PCF50633_IRQ_USBINS) {
Expand All @@ -282,7 +246,6 @@ pcf50633_mbc_irq_handler(int irq, void *data)
mbc->usb_online = 0;
mbc->usb_active = 0;
pcf50633_mbc_usb_curlim_set(mbc->pcf, 0);
cancel_delayed_work_sync(&mbc->charging_restart_work);
}

/* Adapter */
Expand All @@ -297,10 +260,6 @@ pcf50633_mbc_irq_handler(int irq, void *data)
if (irq == PCF50633_IRQ_BATFULL) {
mbc->usb_active = 0;
mbc->adapter_active = 0;

if (chg_restart_interval > 0)
schedule_delayed_work(&mbc->charging_restart_work,
chg_restart_interval);
} else if (irq == PCF50633_IRQ_USBLIMON)
mbc->usb_active = 0;
else if (irq == PCF50633_IRQ_USBLIMOFF)
Expand Down Expand Up @@ -463,9 +422,6 @@ static int __devinit pcf50633_mbc_probe(struct platform_device *pdev)
return ret;
}

INIT_DELAYED_WORK(&mbc->charging_restart_work,
pcf50633_mbc_charging_restart);

ret = sysfs_create_group(&pdev->dev.kobj, &mbc_attr_group);
if (ret)
dev_err(mbc->pcf->dev, "failed to create sysfs entries\n");
Expand All @@ -492,8 +448,6 @@ static int __devexit pcf50633_mbc_remove(struct platform_device *pdev)
power_supply_unregister(&mbc->adapter);
power_supply_unregister(&mbc->ac);

cancel_delayed_work_sync(&mbc->charging_restart_work);

kfree(mbc);

return 0;
Expand Down
2 changes: 0 additions & 2 deletions trunk/include/linux/mfd/pcf50633/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ struct pcf50633_platform_data {
char **batteries;
int num_batteries;

int charging_restart_interval;

/*
* Should be set accordingly to the reference resistor used, see
* I_{ch(ref)} charger reference current in the pcf50633 User
Expand Down

0 comments on commit e25c59b

Please sign in to comment.