From: Martin Fuzzey <mfuzzey@parkeon.com>
To: Mark Brown <broonie@kernel.org>,
Javier Martinez Canillas <javier@osg.samsung.com>
Cc: linux-kernel@vger.kernel.org
Subject: Regulator: drivers that need to know their supply
Date: Thu, 7 Apr 2016 15:25:09 +0200 [thread overview]
Message-ID: <57065FB5.6040707@parkeon.com> (raw)
Hi,
I am working on a driver for the tps22993 load switch.
This chip has configurable slew rates but no voltage setting
(as it's just a switch).
To implement the .enable_time() method I need the voltage (which is
the supply's voltage).
The problem is that, when my regulator is configured as always-on the
supply is not known when .enable_time() is called from regulator_register()
(it does work if the regulator is not always-on)
This is similar to the problem fixed by
5e3ca2b349b1 regulator: Try to resolve regulators supplies on
registration
and the follow up deadlock fix.
I tried adding a new function:
struct regulator *rdev_get_supply(struct regulator_dev *rdev)
{
int rc;
rc = regulator_resolve_supply(rdev);
if (rc)
return ERR_PTR(rc);
return rdev->supply;
}
EXPORT_SYMBOL_GPL(rdev_get_supply);
Unfortunately that doesn't work.
First of all supply_name is not set at that point
(since it is set in regulator_register() AFTER set_machine_constraints())
Even after swapping the call order in regulator_register() it still doesn't
work for my configuration since the parent supply is probed later
so rdev_get_supply() returns -EDEFER which just results in
a warning message from _regulator_do_enable() when it propagates
back from .enable_time()
3V3_LCD: enable_time() failed: -517
And even without that problem there is a risk of another
deadlock since the driver callbacks are called from
regulator_register() with the regulator_list mutex held
in the always_on case.
Any ideas how to do this?
Regards,
Martin
next reply other threads:[~2016-04-07 13:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-07 13:25 Martin Fuzzey [this message]
2016-04-07 17:02 ` Regulator: drivers that need to know their supply Mark Brown
2016-04-07 18:17 ` Martin Fuzzey
2016-04-10 23:18 ` 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=57065FB5.6040707@parkeon.com \
--to=mfuzzey@parkeon.com \
--cc=broonie@kernel.org \
--cc=javier@osg.samsung.com \
--cc=linux-kernel@vger.kernel.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