mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Anton Vorontsov <anton@enomsg.org>,
	Olof Johansson <olof@lixom.net>,
	Sachin Kamat <sachin.kamat@linaro.org>,
	ajaykumar.rs@samsung.com, linux-samsung-soc@vger.kernel.org,
	Simon Glass <sjg@chromium.org>,
	Michael Spang <spang@chromium.org>,
	Sean Paul <seanpaul@chromium.org>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] regulator: tps65090: Make FETs more reliable
Date: Tue, 15 Apr 2014 23:52:10 +0100	[thread overview]
Message-ID: <20140415225210.GK12304@sirena.org.uk> (raw)
In-Reply-To: <1397592876-5741-4-git-send-email-dianders@chromium.org>

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

On Tue, Apr 15, 2014 at 01:14:36PM -0700, Doug Anderson wrote:

> Mitigate the problem by:
> * Allow setting the overcurrent wait time so devices with this problem
>   can set it to the max.
> * Add retry logic on enables of FETs.

This is two changes, should really be two patches.

> +- ti,overcurrent-wait: This is applicable to FET registers, which have a
> +  poorly defined "overcurrent wait" field.  If this property is present it
> +  should be between 0 - 3.  If this property isn't present we won't touch the
> +  "overcurrent wait" field and we'll leave it to the BIOS/EC to deal with.

I take it this is the raw value to write to the register?

> +static int tps65090_fet_is_enabled(struct regulator_dev *rdev)
> +{
> +	unsigned int control;
> +	unsigned int expected = rdev->desc->enable_mask | BIT(CTRL_PG_BIT);
> +	int ret;
> +
> +	ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &control);
> +	if (ret != 0)
> +		return ret;
> +
> +	return (control & expected) == expected;
> +}

No need to open code this, regulator_is_enabled_regmap() can check for
any value in a bitfield.

> +static int tps6090_try_enable_fet(struct regulator_dev *rdev)

Why is this called tps6090_try_enable_fet(), looks like a missing 5?

> +	/*
> +	 * Try enabling multiple times until we succeed since sometimes the
> +	 * first try times out.
> +	 */
> +	for (tries = 0; ; tries++) {
> +		ret = tps6090_try_enable_fet(rdev);
> +		if (!ret)
> +			break;
> +		if (ret != -ENOTRECOVERABLE || tries == MAX_FET_ENABLE_TRIES)
> +			goto err;

Make this a do { } while so we don't have the exit condition missing in
the for loop please, it's doing the right thing but it's not as obvious
as it could be.

> +	if (tries) {
> +		dev_warn(&rdev->dev, "reg %#x enable ok after %d tries\n",
> +			 rdev->desc->enable_reg, tries);
> +	}

No need for braces here, and I guess that ought to be retries rather
than tries (though that is pedantry).

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

  reply	other threads:[~2014-04-15 22:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 20:14 [PATCH 0/3] Fixes for tps65090 for Samsung ARM Chromebook Doug Anderson
2014-04-15 20:14 ` [PATCH 1/3] mfd: tps65090: Allow charger module to be used when no irq Doug Anderson
2014-04-16  9:52   ` Lee Jones
2014-04-16 15:42     ` Doug Anderson
2014-04-16 16:26       ` Lee Jones
2014-04-16 17:45         ` Doug Anderson
2014-04-16 19:03           ` Lee Jones
2014-04-15 20:14 ` [PATCH 2/3] mfd: tps65090: Stop caching registers Doug Anderson
2014-04-16  9:59   ` Lee Jones
2014-04-16 10:13     ` Mark Brown
2014-04-16 18:27       ` Doug Anderson
2014-04-15 20:14 ` [PATCH 3/3] regulator: tps65090: Make FETs more reliable Doug Anderson
2014-04-15 22:52   ` Mark Brown [this message]
2014-04-16 18:28     ` Doug Anderson
2014-04-16 18:25 ` [PATCH v2 0/5] Fixes for tps65090 for Samsung ARM Chromebook Doug Anderson
2014-04-16 18:25   ` [PATCH v2 1/5] mfd: tps65090: Don't tell child devices we have an IRQ if we don't Doug Anderson
2014-04-16 18:25   ` [PATCH v2 2/5] charger: tps65090: Allow charger module to be used when no irq Doug Anderson
2014-04-16 18:25   ` [PATCH v2 3/5] mfd: tps65090: Stop caching most registers Doug Anderson
2014-04-16 18:25   ` [PATCH v2 4/5] regulator: tps65090: Allow setting the overcurrent wait time Doug Anderson
2014-04-16 20:33     ` Randy Dunlap
2014-04-16 23:12       ` Doug Anderson
2014-04-16 18:25   ` [PATCH v2 5/5] regulator: tps65090: Make FETs more reliable by adding retries Doug Anderson
2014-04-16 20:50     ` Simon Glass
2014-04-16 21:25       ` Doug Anderson
2014-04-16 23:24         ` Simon Glass
2014-04-16 20:51     ` Mark Brown
2014-04-16 21:34       ` Doug Anderson
2014-04-16 21:54         ` Mark Brown
2014-04-16 22:59           ` Doug Anderson

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=20140415225210.GK12304@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=ajaykumar.rs@samsung.com \
    --cc=anton@enomsg.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=olof@lixom.net \
    --cc=pawel.moll@arm.com \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=sachin.kamat@linaro.org \
    --cc=sameo@linux.intel.com \
    --cc=seanpaul@chromium.org \
    --cc=sjg@chromium.org \
    --cc=spang@chromium.org \
    /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

Powered by JetHome