mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: ramakrishna.pallala@intel.com, cbou@mail.ru, dwmw2@infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] intel_mid: Intel MSIC battery driver
Date: Mon, 13 Dec 2010 16:20:34 +0000	[thread overview]
Message-ID: <20101213162033.GA18736@sirena.org.uk> (raw)
In-Reply-To: <20101213153005.19966.16356.stgit@bob.linux.org.uk>

On Mon, Dec 13, 2010 at 03:30:54PM +0000, Alan Cox wrote:

> +/*
> + * msic usb properties
> + */
> +static enum power_supply_property msic_usb_props[] = {
> +	POWER_SUPPLY_PROP_TYPE,
> +	POWER_SUPPLY_PROP_CHARGE_TYPE,
> +	POWER_SUPPLY_PROP_PRESENT,
> +	POWER_SUPPLY_PROP_HEALTH,
> +	POWER_SUPPLY_PROP_VOLTAGE_NOW,
> +	POWER_SUPPLY_PROP_MODEL_NAME,
> +	POWER_SUPPLY_PROP_MANUFACTURER,

It seems a bit odd that the USB interface has a charge related property
- while it may be the current supply for the charger the thing that's
actually being charged is the battery which doesn't have a charge type.
See also below...

> +static int mdf_read_adc_regs(int sensor,
> +			struct msic_power_module_info *mbi)

Might it be useful to push these into the core code for whatever you're
talking to so that you can expose both power supply and hwmon interface
versions of the supply monitoring?

> +static void msic_handle_exception(struct msic_power_module_info *mbi,
> +		uint8_t CHRINT_reg_value, uint8_t CHRINT1_reg_value)
> +{
> +	enum msic_event exception;

I'd expect this to generate a power_supply_changed() too - it's possible
I'm just missing the code for that somewhere else, though.

> +       if (mbi->ch_params.vinilmt == CHRG_CURR_SDP_LOW)
> +               mbi->usb_chrg_props.charger_type = POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
> +       else
> +               mbi->usb_chrg_props.charger_type =
> +                                       POWER_SUPPLY_CHARGE_TYPE_FAST;

This isn't what fast and trickle charge are, they're not static
properties but rather reflect the kind of charging that's being done.
Broadly speaking trickle charge means that charge is being fed slowly
into the battery (usually at either extreme of the charge curve when the
battery is either near full or near discharge) while fast charge means
that charge is being pushed into the battery much more rapidly.  This
will vary throughout the charge cycle.

It's likely that if the supply is constrained (eg, 100mA USB) then there
won't be enough current to ever do a fast charge but the availability of
more supply doesn't mean that we're in fast charge.

  reply	other threads:[~2010-12-13 16:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-13 15:30 Alan Cox
2010-12-13 16:20 ` Mark Brown [this message]
2010-12-14  8:21   ` Pallala, Ramakrishna
2010-12-14 11:08     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101213162033.GA18736@sirena.org.uk \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cbou@mail.ru \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ramakrishna.pallala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®