From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pawel Moll Subject: Re: passing two interrupts two an I2C driver Date: Wed, 21 Aug 2013 13:37:04 +0100 Message-ID: <1377088624.10707.23.camel@hornet> References: <520E3B8F.9010800@samsung.com> <520E7417.3090606@wwwdotorg.org> <20130819084227.GC3719@e106331-lin.cambridge.arm.com> <5214AA52.2060209@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Return-path: In-Reply-To: <5214AA52.2060209-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jacek Anaszewski Cc: Mark Rutland , "swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org" , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Jonathan Cameron , "maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org" , "lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org" , "l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org" , "rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org" , "ian.campbell-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org" , "s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org" , Wolfram Sang , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-i2c@vger.kernel.org [resending, this time really copying Wolfram and linux-i2c...] On Wed, 2013-08-21 at 12:53 +0100, Jacek Anaszewski wrote: > From what I've figured out in order to obtain the interrupt id > by name the function > > platform_get_irq_by_name(struct platform_device *dev, const char *name) > > has to be exploited. Unfortunately required platform_device structure > is not available in the struct i2c_client Well, platform devices belong to platform bus, nothing to do with I2C. Platform devices are associated with an array of named resources and the code creating such devices from the DT nodes (of_device_alloc()) do the necessary magic. > that is passed to the > probe function of an i2c driver. Is there some different way to parse > the interrupt-names property from the I2C driver? Interesting. Very interesting indeed. It seems (at least at the first sight) that I2C framework assumes that only one interrupt can be generated by a I2C device: struct i2c_client { [...] int irq; /* irq issued by device */ [...] }; So let me ask such question... If Device Tree didn't exist, how would you make drive such device? I guess it would require some custom code, as struct i2c_board_info has single int irq as well... If this is the case, you could parse the irq properties in a similar way as done in of_irq_to_resource() in drivers/of/irq.c. Doesn't like the optimal solution, though... I've copied Wolfram and the I2C mailing list in hope of them shedding some light at the matter. Pawel