mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Chen-Yu Tsai <wens@csie.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] regulator: axp20x: Fix axp22x ldo_io registration error on cold boot
Date: Wed, 27 Apr 2016 17:35:31 +0200	[thread overview]
Message-ID: <e80f4af9-e333-1c6e-7b3a-849186435ab0@redhat.com> (raw)
In-Reply-To: <20160427151219.GV3217@sirena.org.uk>

Hi,

On 27-04-16 17:12, Mark Brown wrote:
> On Wed, Apr 27, 2016 at 03:59:28PM +0200, Hans de Goede wrote:
>> The maximum supported voltage for ldo_io# is 3.3V, but on cold
>> boot the selector comes up at 0x1f, which maps to 3.8V.
>
> Why not just implement that?

I guess I was not clear in my commit msg, when I wrote:
"which maps to 3.8V", what I mean is that:

Given the formula in the datasheet to calculate the ldo_io
regulator voltage 0x1f maps to 3.8V, but according to the
datasheet the maximum voltage supported is 3.3V, iow the
power-on-reset value of this register is out of spec
according to the datasheet.

Note the datasheet does not explicitly mention this being
out of spec. But a reset value of 0x1f has been observed,
and putting that in the formula for getting the voltage
leads to an out of spec value of 3.8V

> We know what it does and it preserves the
> expected behaviour where we don't touch the regualtor unless explicitly
> told it's OK.  We'll only ever try to set that value if the machine
> explicitly gives permission for it.

The problem is that if we do not fix the out of spec
register value then _regulator_get_voltage returns
-EINVAL because the register value exceeds n_voltages

This causes things to fail when we do actually want to use the
regulator and on registering it try to apply constraints when
registering:

     [    1.467788] vcc-touchscreen: failed to get the current voltage(-22)
     [    1.474209] axp20x-regulator axp20x-regulator: Failed to register ldo_io1
     [    1.483363] axp20x-regulator: probe of axp20x-regulator failed with error -22

Are you suggesting that we simply make n_voltages 0x1f / 31 and rely
on dts constraints to never use the out of spec 3.4 - 3.8 volt
settings ? That will fix things, but it feels wrong.

Thinking more about this, doing this will result in the exact same behavior
(program the ldo to 3.3V when it is still at its power-on-reset value when
  registering) but only when the regulator is used, which means not touching
it unless explicitly told it's ok.

So I guess that this is how you want us to fix this ?

Regards,

Hans

  reply	other threads:[~2016-04-27 15:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 13:59 [PATCH v2 resend 0/3] regulator: axp20x: 3 bugfixes Hans de Goede
2016-04-27 13:59 ` [PATCH v2 1/3] regulator: axp20x: Fix axp209 ldo4 ranges Hans de Goede
2016-04-27 13:59 ` [PATCH v2 2/3] regulator: axp20x: Fix axp22x ldo_io voltage ranges Hans de Goede
2016-04-27 16:35   ` Applied "regulator: axp20x: Fix axp22x ldo_io voltage ranges" to the regulator tree Mark Brown
2016-04-27 16:35   ` Mark Brown
2016-04-27 13:59 ` [PATCH v2 3/3] regulator: axp20x: Fix axp22x ldo_io registration error on cold boot Hans de Goede
2016-04-27 15:12   ` Mark Brown
2016-04-27 15:35     ` Hans de Goede [this message]
2016-04-27 15:48       ` Mark Brown
2016-04-27 16:04         ` Hans de Goede
2016-04-27 16:30           ` Mark Brown
2016-04-27 18:35             ` Hans de Goede

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=e80f4af9-e333-1c6e-7b3a-849186435ab0@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=wens@csie.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

all inboxes | Powered by JetHome®