All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Péter Ujfalusi" <peter.ujfalusi@ti.com>
To: "Balbi, Felipe" <balbi@ti.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Tony Lindgren <tony@atomide.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Lopez Cruz, Misael" <misael.lopez@ti.com>,
	"Girdwood, Liam" <lrg@ti.com>
Subject: Re: [PATCH 1/5] MFD: twl6040: Add irq variable for slave devices
Date: Tue, 5 Jul 2011 15:09:06 +0300	[thread overview]
Message-ID: <3328261.Ltcx4CEcHA@barack> (raw)
In-Reply-To: <20110705112245.GA2820@legolas.emea.dhcp.ti.com>

On Tuesday 05 July 2011 13:22:46 Balbi, Felipe wrote:
> Hi,
> 
> On Tue, Jul 05, 2011 at 12:14:22PM +0300, Peter Ujfalusi wrote:
> > Add new variable to pass the irq number for the slaves
> > devices of twl6040.
> > The irq number configuration is done in the twl6040-core
> > at probe time, so machine drivers do not need to be
> > modified.
> > 
> > Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> > ---
> > 
> >  drivers/mfd/twl6040-core.c |    2 ++
> >  include/linux/i2c/twl.h    |    2 ++
> >  2 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
> > index cfaedb5..8607793 100644
> > --- a/drivers/mfd/twl6040-core.c
> > +++ b/drivers/mfd/twl6040-core.c
> > @@ -501,6 +501,7 @@ static int __devinit twl6040_probe(struct
> > platform_device *pdev)
> > 
> >  	if (pdata->codec) {
> >  	
> >  		cell = &twl6040->cells[children];
> >  		cell->name = "twl6040-codec";
> > 
> > +		pdata->codec->plug_irq = twl6040->irq_base + TWL6040_IRQ_PLUG;
> 
> are the slave devices platform_devices ?? If so, you could use struct
> resource to pass IRQs as that's the "approved" way to do so. Then, on
> child driver, you could either rely on a particular order of the
> resources or assign them names and use platform_get_irq_byname() to
> fetch the correct one (if you have more than one, that is).

You mean something like this:

static struct resource twl6040_codec_rsrc[] = {
	{
		.flags = IORESOURCE_IRQ,
	},
};

...

@@ -501,6 +501,7 @@ static int __devinit twl6040_probe(struct platform_device 
*pdev)
		if (pdata->codec) {
			cell = &twl6040->cells[children];
			cell->name = "twl6040-codec";
+			twl6040_codec_rsrc[0].start = twl6040->irq_base + TWL6040_IRQ_PLUG;
+			twl6040_codec_rsrc[0].end = twl6040->irq_base + TWL6040_IRQ_PLUG;
+			cell->resource = twl6040_codec_rsrc;
+			cell->num_resources = ARRAY_SIZE(twl6040_codec_rsrc);
			cell->platform_data = pdata->codec;
			cell->pdata_size = sizeof(*pdata->codec);
			children++;


-- 
Péter

WARNING: multiple messages have this Message-ID (diff)
From: "Péter Ujfalusi" <peter.ujfalusi@ti.com>
To: "Balbi, Felipe" <balbi@ti.com>
Cc: "Girdwood, Liam" <lrg@ti.com>, Tony Lindgren <tony@atomide.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"Lopez Cruz, Misael" <misael.lopez@ti.com>
Subject: Re: Re: [PATCH 1/5] MFD: twl6040: Add irq variable for slave devices
Date: Tue, 5 Jul 2011 15:09:06 +0300	[thread overview]
Message-ID: <3328261.Ltcx4CEcHA@barack> (raw)
In-Reply-To: <20110705112245.GA2820@legolas.emea.dhcp.ti.com>

On Tuesday 05 July 2011 13:22:46 Balbi, Felipe wrote:
> Hi,
> 
> On Tue, Jul 05, 2011 at 12:14:22PM +0300, Peter Ujfalusi wrote:
> > Add new variable to pass the irq number for the slaves
> > devices of twl6040.
> > The irq number configuration is done in the twl6040-core
> > at probe time, so machine drivers do not need to be
> > modified.
> > 
> > Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> > ---
> > 
> >  drivers/mfd/twl6040-core.c |    2 ++
> >  include/linux/i2c/twl.h    |    2 ++
> >  2 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
> > index cfaedb5..8607793 100644
> > --- a/drivers/mfd/twl6040-core.c
> > +++ b/drivers/mfd/twl6040-core.c
> > @@ -501,6 +501,7 @@ static int __devinit twl6040_probe(struct
> > platform_device *pdev)
> > 
> >  	if (pdata->codec) {
> >  	
> >  		cell = &twl6040->cells[children];
> >  		cell->name = "twl6040-codec";
> > 
> > +		pdata->codec->plug_irq = twl6040->irq_base + TWL6040_IRQ_PLUG;
> 
> are the slave devices platform_devices ?? If so, you could use struct
> resource to pass IRQs as that's the "approved" way to do so. Then, on
> child driver, you could either rely on a particular order of the
> resources or assign them names and use platform_get_irq_byname() to
> fetch the correct one (if you have more than one, that is).

You mean something like this:

static struct resource twl6040_codec_rsrc[] = {
	{
		.flags = IORESOURCE_IRQ,
	},
};

...

@@ -501,6 +501,7 @@ static int __devinit twl6040_probe(struct platform_device 
*pdev)
		if (pdata->codec) {
			cell = &twl6040->cells[children];
			cell->name = "twl6040-codec";
+			twl6040_codec_rsrc[0].start = twl6040->irq_base + TWL6040_IRQ_PLUG;
+			twl6040_codec_rsrc[0].end = twl6040->irq_base + TWL6040_IRQ_PLUG;
+			cell->resource = twl6040_codec_rsrc;
+			cell->num_resources = ARRAY_SIZE(twl6040_codec_rsrc);
			cell->platform_data = pdata->codec;
			cell->pdata_size = sizeof(*pdata->codec);
			children++;


-- 
Péter

  reply	other threads:[~2011-07-05 12:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05  9:14 [PATCH 0/5] MFD/input/ASoC: twl6040: irq registration changes Peter Ujfalusi
2011-07-05  9:14 ` Peter Ujfalusi
2011-07-05  9:14 ` [PATCH 1/5] MFD: twl6040: Add irq variable for slave devices Peter Ujfalusi
2011-07-05  9:14   ` Peter Ujfalusi
2011-07-05 11:22   ` Felipe Balbi
2011-07-05 12:09     ` Péter Ujfalusi [this message]
2011-07-05 12:09       ` Péter Ujfalusi
2011-07-05 12:12       ` Felipe Balbi
2011-07-05  9:14 ` [PATCH 2/5] input: twl6040-vibra: Do not use wrapper for irq request Peter Ujfalusi
2011-07-05  9:14   ` Peter Ujfalusi
2011-07-05 11:24   ` Felipe Balbi
2011-07-05  9:14 ` [PATCH 3/5] ASoC: twl6040: " Peter Ujfalusi
2011-07-05  9:14   ` Peter Ujfalusi
2011-07-05  9:14 ` [PATCH 4/5] MFD: twl6040: Demand valid interrupt configuration Peter Ujfalusi
2011-07-05  9:14   ` Peter Ujfalusi
2011-07-05  9:14 ` [PATCH 5/5] MFD: twl6040: Remove wrapper for threaded irq request Peter Ujfalusi
2011-07-05  9:14   ` Peter Ujfalusi

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=3328261.Ltcx4CEcHA@barack \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=balbi@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=misael.lopez@ti.com \
    --cc=sameo@linux.intel.com \
    --cc=tony@atomide.com \
    /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.