From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: "Opensource [Adam Thomson]"
<Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
"alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org"
<alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Linus Walleij
<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Alessandro Zummo
<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>,
Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Subject: Re: [PATCH 4/8] regulator: da9055: Add DT support
Date: Thu, 6 Feb 2014 12:03:36 +0000 [thread overview]
Message-ID: <20140206120336.GL32298@sirena.org.uk> (raw)
In-Reply-To: <2E89032DDAA8B9408CB92943514A03376B7E1669-68WUHU125fLzLL1Oxlh9IgLouzNaz+3S@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2455 bytes --]
On Thu, Feb 06, 2014 at 11:31:13AM +0000, Opensource [Adam Thomson] wrote:
> On Wed, Feb 05, 2014 at 18:37:21PM +0000, Mark Brown wrote:
> > > + for_each_child_of_node(nproot, np) {
> > > + if (!of_node_cmp(np->name,
> > > + regulator->info->reg_desc.name)) {
> > > + config->init_data = of_get_regulator_init_data(
> > > + &pdev->dev, np);
> > > + config->of_node = np;
> > > + break;
> > > + }
> > > + }
> > I think you're looking for of_regulator_match() here.
> Used another driver as an example for this, but if there's a better method
> then I'm happy to use it. Will have a look.
That's probably an older driver - the code was factored out at some
point but lots of drivers don't get much love.
> > > /* Only LDO 5 and 6 has got the over current interrupt */
> > > if (pdev->id == DA9055_ID_LDO5 || pdev->id == DA9055_ID_LDO6) {
> > > - irq = platform_get_irq_byname(pdev, "REGULATOR");
> > > - irq = regmap_irq_get_virq(da9055->irq_data, irq);
> > > + irq = regmap_irq_get_virq(da9055->irq_data,
> > > + DA9055_IRQ_REGULATOR);
> > This seems like a bit of a step backwards - what happened in the MFD
> > (and why didn't it update the users to avoid breaking bisection)?
> I tested this on target, when doing tests for devicetree. What was happening was
> that platform_get_irq_byname() was returning the VIRQ number already (368 in one
> test case where onkey was being probed) rather than the local IRQ number for the
> device (the resource information seemed to have been updated with the VIRQ
> number instead of the local IRQ number). So when that was passed to
> regmap_irq_get_virq() it would then return an incorrect IRQ number (0 in the
> same scenario, when I enabled DEBUG in irqdomain.c, I would see the message
> "error: hwirq 0x170 is too large for da9055_irq"). That incorrect irq was then
> being passed to devm_request_threaded_irq() which subsequently failed. This is
> why I made the change. Is it preferrable to use platform_get_irq_byname()
> instead of regmap_irq_get_virq() as using them both doesn't seem to work, unless
> I'm missing something fundamental here.
What's happening here is that the MFD framework has done the lookup for
you when passing the interrupt resource through - you should just use
platform_get_irq_byname() and save a little code in the driver. If it's
behaving differently on DT and non-DT systems it seems better to figure
out why and then make it consistent.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: "Opensource [Adam Thomson]" <Adam.Thomson.Opensource@diasemi.com>
Cc: Lee Jones <lee.jones@linaro.org>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Alessandro Zummo <a.zummo@towertech.it>,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH 4/8] regulator: da9055: Add DT support
Date: Thu, 6 Feb 2014 12:03:36 +0000 [thread overview]
Message-ID: <20140206120336.GL32298@sirena.org.uk> (raw)
In-Reply-To: <2E89032DDAA8B9408CB92943514A03376B7E1669@SW-EX-MBX02.diasemi.com>
[-- Attachment #1: Type: text/plain, Size: 2455 bytes --]
On Thu, Feb 06, 2014 at 11:31:13AM +0000, Opensource [Adam Thomson] wrote:
> On Wed, Feb 05, 2014 at 18:37:21PM +0000, Mark Brown wrote:
> > > + for_each_child_of_node(nproot, np) {
> > > + if (!of_node_cmp(np->name,
> > > + regulator->info->reg_desc.name)) {
> > > + config->init_data = of_get_regulator_init_data(
> > > + &pdev->dev, np);
> > > + config->of_node = np;
> > > + break;
> > > + }
> > > + }
> > I think you're looking for of_regulator_match() here.
> Used another driver as an example for this, but if there's a better method
> then I'm happy to use it. Will have a look.
That's probably an older driver - the code was factored out at some
point but lots of drivers don't get much love.
> > > /* Only LDO 5 and 6 has got the over current interrupt */
> > > if (pdev->id == DA9055_ID_LDO5 || pdev->id == DA9055_ID_LDO6) {
> > > - irq = platform_get_irq_byname(pdev, "REGULATOR");
> > > - irq = regmap_irq_get_virq(da9055->irq_data, irq);
> > > + irq = regmap_irq_get_virq(da9055->irq_data,
> > > + DA9055_IRQ_REGULATOR);
> > This seems like a bit of a step backwards - what happened in the MFD
> > (and why didn't it update the users to avoid breaking bisection)?
> I tested this on target, when doing tests for devicetree. What was happening was
> that platform_get_irq_byname() was returning the VIRQ number already (368 in one
> test case where onkey was being probed) rather than the local IRQ number for the
> device (the resource information seemed to have been updated with the VIRQ
> number instead of the local IRQ number). So when that was passed to
> regmap_irq_get_virq() it would then return an incorrect IRQ number (0 in the
> same scenario, when I enabled DEBUG in irqdomain.c, I would see the message
> "error: hwirq 0x170 is too large for da9055_irq"). That incorrect irq was then
> being passed to devm_request_threaded_irq() which subsequently failed. This is
> why I made the change. Is it preferrable to use platform_get_irq_byname()
> instead of regmap_irq_get_virq() as using them both doesn't seem to work, unless
> I'm missing something fundamental here.
What's happening here is that the MFD framework has done the lookup for
you when passing the interrupt resource through - you should just use
platform_get_irq_byname() and save a little code in the driver. If it's
behaving differently on DT and non-DT systems it seems better to figure
out why and then make it consistent.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-02-06 12:03 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-05 17:48 [PATCH 0/8] da9055: Driver initialisation fixes, add DT support Adam Thomson
2014-02-05 17:48 ` Adam Thomson
2014-02-05 17:48 ` [PATCH 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices Adam Thomson
2014-02-05 17:48 ` Adam Thomson
[not found] ` <6a398d176b0b2bf8792d27bd5e2995fd96afb32d.1391614923.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-02-05 18:38 ` Mark Brown
2014-02-05 18:38 ` Mark Brown
2014-02-05 17:48 ` [PATCH 2/8] ASoC: da9055: Add DT support for CODEC Adam Thomson
2014-02-05 17:48 ` Adam Thomson
2014-02-05 17:48 ` [PATCH 3/8] mfd: da9055: Add DT support for PMIC Adam Thomson
2014-02-05 17:48 ` Adam Thomson
2014-02-05 17:48 ` [PATCH 4/8] regulator: da9055: Add DT support Adam Thomson
2014-02-05 17:48 ` Adam Thomson
[not found] ` <6d76ae40cd435eaae0323f3e806515130b06a376.1391614923.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-02-05 18:36 ` Mark Brown
2014-02-05 18:36 ` Mark Brown
2014-02-06 11:31 ` Opensource [Adam Thomson]
2014-02-06 11:31 ` Opensource [Adam Thomson]
[not found] ` <2E89032DDAA8B9408CB92943514A03376B7E1669-68WUHU125fLzLL1Oxlh9IgLouzNaz+3S@public.gmane.org>
2014-02-06 12:03 ` Mark Brown [this message]
2014-02-06 12:03 ` Mark Brown
[not found] ` <20140206120336.GL32298-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-02-06 12:22 ` Opensource [Adam Thomson]
2014-02-06 12:22 ` Opensource [Adam Thomson]
2014-02-06 14:30 ` Mark Brown
2014-02-05 17:48 ` [PATCH 6/8] hwmon: da9055: Remove use of platform_get_irq_byname() Adam Thomson
2014-02-05 17:48 ` Adam Thomson
2014-02-05 17:48 ` [PATCH 5/8] onkey: " Adam Thomson
2014-02-05 17:48 ` Adam Thomson
2014-02-05 17:48 ` [PATCH 7/8] rtc: " Adam Thomson
2014-02-05 17:48 ` Adam Thomson
2014-02-05 17:48 ` [PATCH 8/8] mfd: da9055: Remove unused resource structures for mfd cells Adam Thomson
2014-02-05 17:48 ` Adam Thomson
[not found] ` <cover.1391614923.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-02-06 0:54 ` [PATCH 0/8] da9055: Driver initialisation fixes, add DT support Guenter Roeck
2014-02-06 0:54 ` Guenter Roeck
[not found] ` <20140206005406.GC1308-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-02-06 11:46 ` Opensource [Adam Thomson]
2014-02-06 11:46 ` Opensource [Adam Thomson]
[not found] ` <2E89032DDAA8B9408CB92943514A03376B7E368A-68WUHU125fLzLL1Oxlh9IgLouzNaz+3S@public.gmane.org>
2014-02-06 13:22 ` Guenter Roeck
2014-02-06 13:22 ` Guenter Roeck
2014-02-06 13:31 ` Opensource [Adam Thomson]
2014-02-06 13:31 ` Opensource [Adam Thomson]
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=20140206120336.GL32298@sirena.org.uk \
--to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org \
--cc=a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 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.