i2c: allow specifying separate wakeup interrupt in device tree
Subsystems (3)
PATCH v2 1/1 i2c: allow specifying separate wakeup interrupt in device tree
Instead of having each i2c driver individually parse device tree data in case it or platform supports separate wakeup interrupt, and handle enabling and disabling wakeup interrupts in their power management routines, let's have i2c core do that for us.
Platforms wishing to specify separate wakeup interrupt for the device should use named interrupt syntax in their DTSes:
interrupt-parent = <&intc1>; interrupts = <5 0>, <6 0>; interrupt-names = "irq", "wakeup";
This patch is inspired by work done by Vignesh R <[email protected]> for pixcir_i2c_ts driver.
---
v1 -> v2:
- added binding documentation for interrupts property;
- simplified initializing device as wakeup source - now just doing based on client's flags.
Documentation/devicetree/bindings/i2c/i2c.txt | 16 +++++++-- drivers/i2c/i2c-core.c | 51 ++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/i2c/i2c.txt +14 -2
@@ -12,7 +12,7 @@ Required properties - compatible - name of I2C bus controller following generic names recommended practice. -For other required properties e.g. to describe register sets, interrupts, +For other required properties e.g. to describe register sets, clocks, etc. check the binding documentation of the specific driver. The cells properties above define that an address of children of an I2C bus
@@ -29,5 +29,17 @@ Optional properties These properties may not be supported by all drivers. However, if a driver wants to support one of the below features, it should adapt the bindings below. -- clock-frequency - frequency of bus clock in Hz +- clock-frequency - frequency of bus clock in Hz. - wakeup-source - device can be used as a wakeup source. + +- interrupts - interrupts used by the device. +- interrupt-names - "irq" and "wakeup" names are recognized by I2C core, + other names are left to individual drivers. + +Binding may contain optional "interrupts" property, describing interrupts +used by the device. I2C core will assign "irq" interrupt (or the very first +interrupt if not using interrupt names) as primary interrupt for the slave. + +Also, if device is marked as a wakeup source, I2C core will set up "wakeup" +interrupt for the device. If "wakeup" interrupt name is not present in the +binding, then primary interrupt will be used as wakeup interrupt.
drivers/i2c/i2c-core.c +42 -9
88 lines not on this page · raw message
Signature · 5 lines
2.5.0.276.gf5e568e -- Dmitry
Wolfram Sang
AppliedQuoted 8 lines · Dmitry Torokhov
Instead of having each i2c driver individually parse device tree data in case it or platform supports separate wakeup interrupt, and handle enabling and disabling wakeup interrupts in their power management routines, let's have i2c core do that for us.
Platforms wishing to specify separate wakeup interrupt for the device should use named interrupt syntax in their DTSes:
Quoted 8 lines
interrupt-parent = <&intc1>; interrupts = <5 0>, <6 0>; interrupt-names = "irq", "wakeup";This patch is inspired by work done by Vignesh R <[email protected]> for
pixcir_i2c_tsdriver.Signed-off-by Dmitry Torokhov <[email protected]>
Applied to for-next, thanks!