All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: linux-kernel@vger.kernel.org,
	Samuel Ortiz <sameo@linux.intel.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Joonyoung Shim <jy0922.shim@samsung.com>,
	Anton Vorontsov <cbou@mail.ru>,
	Lukasz Majewski <l.majewski@samsung.com>,
	myungjoo.ham@gmail.com
Subject: Re: [PATCH v4 3/3] MFD MAX8998/LP3974: Support Charger
Date: Tue, 4 Jan 2011 13:56:51 +0000	[thread overview]
Message-ID: <20110104135651.GD24774@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1294118261-18906-4-git-send-email-myungjoo.ham@samsung.com>

On Tue, Jan 04, 2011 at 02:17:41PM +0900, MyungJoo Ham wrote:
> With the new regulator, "CHARGER", users can control charging
> current and turn on and off the charger. Note that the charger
> specification of LP3974 is different from that of MAX8998.
> 
> driver/power/max8998.c supports power supply APIs for

It's probably better to split the power supply driver into a separate
patch as there should be no build time dependency between the two.  I've
added Anton to the CCs as he is the drivers/power maintainer.

One thing that jumps out here is that there's no regulator API usage at
all in the power driver - the power driver just jumps straight in
and updates registers when it needs to do anything.  Are you sure that
the regulator API driver is needed at all, if it is I'd expect to see
use of it in the power API.

> +static const char * const manufacturers[] = {
> +	[TYPE_MAX8998] = "Maxim",
> +	[TYPE_LP3974] = "National Semiconductor",
> +	[TYPE_UNKNOWN] = "Unknown",

Normally this refers to the battery rather than the chip.

> +static void _max8998_update_eoc(struct platform_device *pdev)
> +{
> +	struct max8998_battery_data *max8998 = platform_get_drvdata(pdev);
> +	struct i2c_client *i2c = max8998->iodev->i2c;
> +	int charge_current = 0;
> +	int target_eoc_ratio;
> +	u8 val;
> +
> +	/* Nothing to do. User set EOC with % */
> +	if (max8998->eoc_in_mA == 0)
> +		return;
> +
> +	/* Not initialized. */
> +	if (!charger_current_map_desc)
> +		return;

This should be be driver data rather than a global for neatness (though
in reality the chances of more than one of these chargers in a system
are pretty low).

> --- a/drivers/regulator/max8998.c
> +++ b/drivers/regulator/max8998.c
> @@ -86,6 +86,13 @@ static const struct voltage_map_desc buck3_voltage_map_desc = {
>  static const struct voltage_map_desc buck4_voltage_map_desc = {
>  	.min = 800,	.step = 100,	.max = 2300,
>  };
> +static const int charger_current_map_desc_max8998[] = {
> +	90, 380, 475, 550, 570, 600, 700, 800
> +};
> +static const int charger_current_map_desc_lp3974[] = {
> +	100, 400, 450, 500, 550, 600, 700, 800
> +};
> +const int *charger_current_map_desc;

Ah, this is exported from the regulator driver...  That's slightly odd.
For voltages we've an enumeration API for the supported settings, we
probably ought to add that for current regulators too.

> +	dev_info(&rdev->dev, "charger current limit = %dmA (%xh)\n",
> +			chosen_current, chosen);

dev_dbg() or remove it entirely please, otherwise it might get a bit
noisy.

> +static struct regulator_ops max8998_charger_ops = {
> +	.is_enabled		= max8998_ldo_is_enabled_negated,
> +	/* enable and disable are intentionally negated */
> +	.enable			= max8998_ldo_disable,
> +	.disable		= max8998_ldo_enable,

That's really confusing...  why?

  reply	other threads:[~2011-01-04 13:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-23  8:53 [PATCH v3 0/4] MFD MAX8998/LP3974 Driver Update MyungJoo Ham
2010-12-23  8:53 ` [PATCH v3 1/4] MFD MAX8998/LP3974: Support Hibernation MyungJoo Ham
2010-12-24 11:38   ` Samuel Ortiz
2010-12-23  8:53 ` [PATCH v3 2/4] MFD MAX8998/LP3974: Support LP3974 RTC MyungJoo Ham
2010-12-24 11:38   ` Samuel Ortiz
2011-01-04  5:17     ` [PATCH v4 0/3] MFD MAX8998/LP3974 Driver Update MyungJoo Ham
2011-01-04  5:17     ` [PATCH v4 1/3] MFD MAX8998/LP3974: Support LP3974 RTC MyungJoo Ham
2011-01-04 13:40       ` Mark Brown
2011-01-11 11:22       ` Samuel Ortiz
2011-01-04  5:17     ` [PATCH v4 2/3] regulator MAX8998/LP3974: Support DVS-GPIO MyungJoo Ham
2011-01-04  7:49       ` Lukasz Majewski
2011-01-04  8:16         ` MyungJoo Ham
2011-01-04 13:44           ` Mark Brown
2011-01-11 11:22       ` Samuel Ortiz
2011-01-04  5:17     ` [PATCH v4 3/3] MFD MAX8998/LP3974: Support Charger MyungJoo Ham
2011-01-04 13:56       ` Mark Brown [this message]
2011-01-05  0:43         ` MyungJoo Ham
2011-01-14  5:22         ` [PATCH v5] " MyungJoo Ham
2011-01-18 11:37           ` Mark Brown
2010-12-23  8:53 ` [PATCH v3 3/4] regulator MAX8998/LP3974: Support DVS-GPIO MyungJoo Ham
2010-12-24 11:36   ` Samuel Ortiz
2011-01-02 13:56   ` Mark Brown
2010-12-23  8:53 ` [PATCH v3 4/4] MFD MAX8998/LP3974: Support Charger MyungJoo Ham
2010-12-24 11:37   ` Samuel Ortiz

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=20110104135651.GD24774@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=a.zummo@towertech.it \
    --cc=cbou@mail.ru \
    --cc=jy0922.shim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=l.majewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=myungjoo.ham@gmail.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=sameo@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.