mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: "Opensource [James Seong-Won Ban]" <james.ban.opensource@diasemi.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Support Opensource <support.opensource@diasemi.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	David Dajun Chen <david.chen@diasemi.com>
Subject: Re: [PATCH V2] regulator: DA9211 : new regulator driver
Date: Sun, 1 Jun 2014 20:01:41 +0100	[thread overview]
Message-ID: <20140601190141.GM5099@sirena.org.uk> (raw)
In-Reply-To: <201405190656.s4J6uMCD015467@swsrvapps-01.diasemi.com>

[-- Attachment #1: Type: text/plain, Size: 3091 bytes --]

On Mon, May 19, 2014 at 02:45:51AM +0100, Opensource [James Seong-Won Ban] wrote:

> This is the driver for the Dialog DA9211 Multi-phase 12A DC-DC Buck
> Converter regulator. It communicates via an I2C bus to the device.

I'm still really not convinced that the whole handling of the A and B
settings is doing what it's supposed to be doing.  Like I said before I
know another one of your drivers is doing something similar (and not
sharing the code!) but still...

It looks like the driver is basically written so that register set A
must be used when Linux is running and set B must be used in suspend
mode but not everything seems joined up and consistent.

> Signed-off-by: Opensource [James Seong-Won Ban] <james.ban.opensource@diasemi.com>

Please just use your name in signoffs, the "Opensource []" garbage that
your mail system inserts isn't helping.

> +static int da9211_regulator_get_voltage_sel(struct regulator_dev *rdev)
> +{

> +	/*
> +	 * There are two voltage register set A & B for voltage ramping but
> +	 * either one of then can be active therefore we first determine
> +	 * the active register set.
> +	 */
> +	ret = regmap_read(chip->regmap, info->conf.reg, &data);
> +	if (ret < 0)
> +		return ret;

This appears to be picking the active register set...

> +	/*
> +	 * Regulator register set A/B is not selected through GPIO therefore
> +	 * we use default register set A for voltage ramping.
> +	 */
> +	if (regulator->reg_rselect == DA9211_RSEL_NO_GPIO) {
> +		/* Select register set A */
> +		ret = regmap_update_bits(chip->regmap, info->conf.reg,
> +					info->conf.sel_mask,
> +					DA9211_VBUCKA_SEL_A);
> +		if (ret < 0)
> +			return ret;
> +
> +		/* Set the voltage */
> +		return regmap_update_bits(chip->regmap, info->volt.reg_a,
> +					 info->volt.v_mask, selector);
> +	}

This forces to register set A.

> +	/*
> +	 * Here regulator register set A/B is selected through GPIO.
> +	 * Therefore we first determine the selected register set A/B and
> +	 * then set the desired voltage for that register set A/B.
> +	 */
> +	ret = regmap_read(chip->regmap, info->conf.reg, &data);
> +	if (ret < 0)
> +		return ret;

We don't appear to be controlling this GPIO - this then assumes that the
GPIO can only be used for selecting suspend mode but doesn't impose any
restrictions on this.

> +static int da9211_regulator_set_suspend_voltage(struct regulator_dev *rdev,
> +						int uV)
> +{
> +	struct da9211_regulator *regulator = rdev_get_drvdata(rdev);
> +	struct da9211_regulator_info *info = regulator->info;
> +	struct da9211 *chip = regulator->da9211;
> +	int ret;
> +
> +	/* Select register set B for suspend voltage ramping. */
> +	if (regulator->reg_rselect == DA9211_RSEL_NO_GPIO) {
> +		ret = regmap_update_bits(chip->regmap, info->conf.reg,
> +					info->conf.sel_mask,
> +					DA9211_VBUCKA_SEL_B);
> +		if (ret < 0)
> +			return ret;
> +	}

This appears to immediately change the active register set to set B
which as I said previously is broken; we may not be suspended yet and
clearly we haven't actually applied the desired setting yet either.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-06-01 19:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19  1:45 Opensource [James Seong-Won Ban]
2014-06-01 19:01 ` Mark Brown [this message]
2014-06-02  2:43   ` Opensource [James Seong-Won Ban]

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=20140601190141.GM5099@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=david.chen@diasemi.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=james.ban.opensource@diasemi.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=support.opensource@diasemi.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®