Re: [PATCH 12/15] twl4030_charger: add software controlled linear charging mode.

From: NeilBrown
Date: Thu Mar 05 2015 - 01:34:09 EST


On Mon, 2 Mar 2015 22:09:26 +0100 Pavel Machek <pavel@xxxxxx> wrote:

> On Tue 2015-02-24 15:33:52, NeilBrown wrote:
> > Add a 'continuous' option for usb charging which enabled
> > the "linear" charging mode of the twl4030.
>
> Documentation/ :-).

!

>
> > Linear charging does a good job with not so reliable power sources, since
> > several voltage controlling is then often too intelligent.
>
> Parse error.

========
Linear charging does a good job with not-so-reliable power sources.
Auto mode does not work well as it switches off when voltage drops
momentarily. Care must be taken not to over-charge.

It was used with a bike hub dynamo since a year or so. In that case
there are automatically charging stops when the cyclist needs a break.
=========

>
> > It was used with a bike hub dynamo since a year or so. In that case there
> > are automatically charging stops when the cyclist needs a break.
> >
> > Orignal-by: Andreas Kemnade <andreas@xxxxxxxxxxxx>
> > Signed-off-by: NeilBrown <neilb@xxxxxxx>
>
>
> > + ret = twl_i2c_write_u8(TWL_MODULE_MAIN_CHARGE, 0x33,
> > + TWL4030_BCIWDKEY);
> > + /* 0x24 + EKEY6: off mode */
>
> " " -> " "
>
> > + ret = twl_i2c_write_u8(TWL_MODULE_MAIN_CHARGE, 0x2a,
> > + TWL4030_BCIMDKEY);
> > + /* EKEY2: Linear charge: usb path */
>
> USB
>
> > + ret = twl_i2c_write_u8(TWL_MODULE_MAIN_CHARGE, 0x26,
> > + TWL4030_BCIMDKEY);
> > + /* WDKEY5: stop watchdog count */
> > + ret = twl_i2c_write_u8(TWL_MODULE_MAIN_CHARGE, 0xf3,
> > + TWL4030_BCIWDKEY);
> > + /* enable MFEN3 access */
> > + ret = twl_i2c_write_u8(TWL_MODULE_MAIN_CHARGE, 0x9c,
> > + TWL4030_BCIMFKEY);
> > + /* ICHGEOCEN - end-of-charge monitor (current < 80mA)
> > + * (charging continues)
> > + * ICHGLOWEN - current level monitor (charge continues)
> > + * don't monitor over-current or heat save
>
> Heat save? Is ignoring over-current good idea?

The data sheet refers to a flag "HSEN" which is "Heat Save function enable".

your guess is as good as mine.

We don't currently have any code for responding to warnings. Maybe we should.

For now this feature is "use at your own risk" - and one person has found it
very useful.

>
> > @@ -650,6 +684,8 @@ twl4030_bci_mode_store(struct device *dev, struct device_attribute *attr,
> > mode = 0;
> > else if (sysfs_streq(buf, modes[1]))
> > mode = 1;
> > + else if (sysfs_streq(buf, modes[2]))
> > + mode = 2;
>
> Time for loop?

When we get one more mode it will be :-)

Thanks,
NeilBrown

Attachment: pgpgJMwlUa9sK.pgp
Description: OpenPGP digital signature