[alsa-devel] [PATCH 4/8] regulator: da9055: Add DT support

Mark Brown broonie at kernel.org
Thu Feb 6 13:03:36 CET 2014


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20140206/aa407667/attachment.sig>


More information about the Alsa-devel mailing list