From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from service87.mimecast.com ([91.220.42.44]:39343 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751722Ab3HUMhI convert rfc822-to-8bit (ORCPT ); Wed, 21 Aug 2013 08:37:08 -0400 Message-ID: <1377088624.10707.23.camel@hornet> Subject: Re: passing two interrupts two an I2C driver From: Pawel Moll Date: Wed, 21 Aug 2013 13:37:04 +0100 References: <520E3B8F.9010800@samsung.com> <520E7417.3090606@wwwdotorg.org> <20130819084227.GC3719@e106331-lin.cambridge.arm.com> <5214AA52.2060209@samsung.com> In-Reply-To: <5214AA52.2060209@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: devicetree-owner@vger.kernel.org To: Jacek Anaszewski Cc: Mark Rutland , "swarren@wwwdotorg.org" , "devicetree@vger.kernel.org" , "linux-iio@vger.kernel.org" , Jonathan Cameron , "maxime.ripard@free-electrons.com" , "lars@metafoo.de" , "l.czerwinski@samsung.com" , "rob.herring@calxeda.com" , "ian.campbell@citrix.com" , "s.nawrocki@samsung.com" , Wolfram Sang , linux-i2c@vger.kernel.org List-ID: [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