From patchwork Thu Sep 1 22:04:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 1120792 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p81MU89Q003334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 1 Sep 2011 22:30:31 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QzFlv-0002PQ-Ir; Thu, 01 Sep 2011 22:30:07 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QzFlv-0002PK-15 for spi-devel-general@lists.sourceforge.net; Thu, 01 Sep 2011 22:30:07 +0000 Received-SPF: fail (sog-mx-2.v43.ch3.sourceforge.com: domain of nvidia.com does not designate 70.85.31.133 as permitted sender) client-ip=70.85.31.133; envelope-from=swarren@nvidia.com; helo=avon.wwwdotorg.org; Received: from avon.wwwdotorg.org ([70.85.31.133]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1QzFlu-0007U1-EA for spi-devel-general@lists.sourceforge.net; Thu, 01 Sep 2011 22:30:07 +0000 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 58D086414; Thu, 1 Sep 2011 16:07:03 -0600 (MDT) Received: from localhost.localdomain (searspoint.nvidia.com [216.228.112.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 2342BE4780; Thu, 1 Sep 2011 16:04:55 -0600 (MDT) From: Stephen Warren To: Greg Kroah-Hartman , Jean Delvare , Ben Dooks , Jonathan Cameron , Grant Likely , Arnd Bergmann Subject: [PATCH V3 1/5] i2c: Add irq_gpio field to struct i2c_client, i2c_board_info. Date: Thu, 1 Sep 2011 16:04:32 -0600 Message-Id: <1314914676-28397-6-git-send-email-swarren@nvidia.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1314914676-28397-1-git-send-email-swarren@nvidia.com> References: <1314914676-28397-1-git-send-email-swarren@nvidia.com> X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean X-Spam-Score: 3.9 (+++) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 4.0 SPF_CHECK_FAIL SPF reports sender host as NOT permitted to send mails from 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) -1.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1QzFlu-0007U1-EA Cc: devel@driverdev.osuosl.org, Andrew Chew , Stephen Warren , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Cameron , spi-devel-general@lists.sourceforge.net, linux-tegra@vger.kernel.org, Russell King , linux-i2c@vger.kernel.org X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 01 Sep 2011 22:30:31 +0000 (UTC) Some devices use a single pin as both an IRQ and a GPIO. In that case, irq_gpio is the GPIO ID for that pin. Not all drivers use this feature. Where they do, and the use of this feature is optional, and the system wishes to disable this feature, this field must be explicitly set to a defined invalid GPIO ID, such as -1. Signed-off-by: Stephen Warren --- v3: Also add the field to i2c_board_info, and copy the field from i2c_board_info to i2c_client upon instantiation drivers/i2c/i2c-core.c | 1 + include/linux/i2c.h | 9 +++++++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 131079a..da12540 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -518,6 +518,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) client->flags = info->flags; client->addr = info->addr; client->irq = info->irq; + client->irq_gpio = info->irq_gpio; strlcpy(client->name, info->type, sizeof(client->name)); diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 3fad485..49e2e36 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -192,6 +192,12 @@ struct i2c_driver { * @driver: device's driver, hence pointer to access routines * @dev: Driver model device node for the slave. * @irq: indicates the IRQ generated by this device (if any) + * @irq_gpio: some devices use a single pin as both an IRQ and a GPIO. In + * that case, irq_gpio is the GPIO ID for that pin. Not all drivers + * use this feature. Where they do, and the use of this feature is + * optional, and the system wishes to disable this feature, this + * field must be explicitly set to a defined invalid GPIO ID, such + * as -1. * @detected: member of an i2c_driver.clients list or i2c-core's * userspace_devices list * @@ -209,6 +215,7 @@ struct i2c_client { struct i2c_driver *driver; /* and our access routines */ struct device dev; /* the device structure */ int irq; /* irq issued by device */ + int irq_gpio; /* gpio corresponding to irq */ struct list_head detected; }; #define to_i2c_client(d) container_of(d, struct i2c_client, dev) @@ -240,6 +247,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) * @archdata: copied into i2c_client.dev.archdata * @of_node: pointer to OpenFirmware device node * @irq: stored in i2c_client.irq + * @irq_gpio: stored in i2c_client.irq_gpio * * I2C doesn't actually support hardware probing, although controllers and * devices may be able to use I2C_SMBUS_QUICK to tell whether or not there's @@ -260,6 +268,7 @@ struct i2c_board_info { struct dev_archdata *archdata; struct device_node *of_node; int irq; + int irq_gpio; }; /**