All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Santos <danielfsantos@att.net>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-gpio <linux-gpio@vger.kernel.org>,
	linux-usb <linux-usb@vger.kernel.org>,
	linux-spi <linux-spi@vger.kernel.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: "Virtual" Interrupts -- Need help please
Date: Sun, 08 Sep 2013 18:50:15 -0500	[thread overview]
Message-ID: <522D0D37.3050500@att.net> (raw)
In-Reply-To: <522BCA33.6000701@roeck-us.net>

On 09/07/2013 07:52 PM, Guenter Roeck wrote:
> On 09/07/2013 05:19 PM, Daniel Santos wrote:
>> I've posted a number of requests for aid on this and have gotten very 
>> little responses and none that were helpful. I have spent at least 24 
>> hours of research time on this and just a little direction from 
>> somebody who knows this subsystem can help me immensely as the IRQ 
>> subsystem is new to me.
>>
>> This is for the MCP2210 driver (a USB to SPI/GPIO bridge) and my 
>> driver is the first of its class for the Linux kernel, giving me less 
>> to look at as an example.  I intend to use standard drivers for 
>> whatever I have connected at the other end.  For this to work, I need 
>> to supply interrupts for some of these drivers to work correctly.  
>> How do I do this? Every thing else on this driver is ready to go and 
>> my handler functions for this are empty and waiting for some code.
>>
> Not really. Have a look at https://github.com/groeck/diolan even 
> though the SPI part there
> still isn't working and it is far from being acceptable upstream in 
> its current form.
> It also doesn't support interrupts.

Oh, this is wonderful to know!  While I like breaking new ground, I 
certainly don't enjoy doing it when I'm trying to write my first device 
driver and having to learn so many new things.

>
> It is modeled as mfd driver, which I think you might want to consider 
> as well.
>
>> So do i create an IRQ domain and then call generic_handle_irq() from 
>> my URB complete() function? If so, which type of IRQ Domain is 
>> appropriate for this? Unlike typical platform devices, these are 
>> dynamically added and removed throughout the life of the kernel, 
>> adding to the challenge. So, if I understand correctly, my base IRQ 
>> number needs to be dynamically generated.  How should I manage this?
>>
>> Finally, if you have any example drivers that are doing something 
>> similar, that would be SO very helpful as well!
>>
> There are several drivers in drivers/mfd solving the same problem, ie 
> using
> irq domains to pass interrupts to client drivers. Look for 
> irq_domain_add_simple().
> drivers/mfd/tc3589x.c seems to be a good example.

Ahh, wonderful! I was looking at a lot of the code in mfd, but it 
contains so many things that I don't understand yet, so it's been harder 
to be clear on what the driver is doing and why w/o extensive 
examination & study of the subsystems it's using.  This will help!

>
>> I have some secondary (and less important) questions about how to 
>> integrate this with device drivers that want a DT / open firmware 
>> config (which I know almost nothing about at this time), but that can 
>> wait.
>>
> If you look into the mfd subsystem, you may notice that it handles at 
> least some of the complexity
> of interrupt handling as well as devicetree integration. One more 
> reason to use it.
>
> Guenter

Even better, thank you very much!! If this thing had more EEPROM storage 
I would consider using the OF format for it's settings, but I only have 
256 bytes to play with so I'm using a custom compression/encoding.

I'm hoping to present this for an initial review in a month or so. I'm 
sure you guys will shred it, but I'm excited about it anyway! :)

Thanks again!
Daniel

  reply	other threads:[~2013-09-08 23:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-08  0:19 "Virtual" Interrupts -- Need help please Daniel Santos
2013-09-08  0:52 ` Guenter Roeck
2013-09-08 23:50   ` Daniel Santos [this message]
2013-09-09  0:35     ` Guenter Roeck
2013-09-09 11:02       ` Mark Brown
2013-09-09 11:18         ` Alexander Holler
2013-09-09 11:45           ` Guenter Roeck
2013-09-09 12:00             ` Alexander Holler
2013-09-09 13:45           ` Mark Brown
     [not found]             ` <20130909134558.GY29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-09 14:21               ` Alexander Holler
2013-09-09 14:21                 ` Alexander Holler
2013-09-09 11:06 ` Mark Brown
2013-09-09 21:12   ` Daniel Santos
2013-09-10 18:01     ` Mark Brown
2013-09-11 17:59       ` Daniel Santos

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=522D0D37.3050500@att.net \
    --to=danielfsantos@att.net \
    --cc=daniel.santos@pobox.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=sameo@linux.intel.com \
    --cc=tglx@linutronix.de \
    /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.