aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2012-04-17 03:30:33 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-05-01 07:33:18 -0400
commit112a80d29b529d4057777ac2cb4ec15ff5b6d210 (patch)
treea649f58551524d4f07c083623ea084b6ecaf5ca1 /include/linux
parent7e82d6ff5d2c5e35d1fcb8c673287f7d780a13bb (diff)
mfd: Deny ab8500 suspend if i2c transfer is ongoing
If we are in the middle of an I2C transfer we need to deny suspend of the AB8500 core. Implement an atomic reference counter for the I2C operations to make sure we don't do this. Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Reviewed-by: Mattias Wallin <mattias.wallin@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mfd/abx500/ab8500.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index d798f5b6a55f..91dd3ef63e99 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -7,6 +7,7 @@
7#ifndef MFD_AB8500_H 7#ifndef MFD_AB8500_H
8#define MFD_AB8500_H 8#define MFD_AB8500_H
9 9
10#include <linux/atomic.h>
10#include <linux/mutex.h> 11#include <linux/mutex.h>
11 12
12struct device; 13struct device;
@@ -224,6 +225,7 @@ enum ab8500_version {
224 * @dev: parent device 225 * @dev: parent device
225 * @lock: read/write operations lock 226 * @lock: read/write operations lock
226 * @irq_lock: genirq bus lock 227 * @irq_lock: genirq bus lock
228 * @transfer_ongoing: 0 if no transfer ongoing
227 * @irq: irq line 229 * @irq: irq line
228 * @version: chip version id (e.g. ab8500 or ab9540) 230 * @version: chip version id (e.g. ab8500 or ab9540)
229 * @chip_id: chip revision id 231 * @chip_id: chip revision id
@@ -242,7 +244,7 @@ struct ab8500 {
242 struct device *dev; 244 struct device *dev;
243 struct mutex lock; 245 struct mutex lock;
244 struct mutex irq_lock; 246 struct mutex irq_lock;
245 247 atomic_t transfer_ongoing;
246 int irq_base; 248 int irq_base;
247 int irq; 249 int irq;
248 enum ab8500_version version; 250 enum ab8500_version version;
@@ -288,6 +290,8 @@ extern int __devinit ab8500_init(struct ab8500 *ab8500,
288 enum ab8500_version version); 290 enum ab8500_version version);
289extern int __devexit ab8500_exit(struct ab8500 *ab8500); 291extern int __devexit ab8500_exit(struct ab8500 *ab8500);
290 292
293extern int ab8500_suspend(struct ab8500 *ab8500);
294
291static inline int is_ab8500(struct ab8500 *ab) 295static inline int is_ab8500(struct ab8500 *ab)
292{ 296{
293 return ab->version == AB8500_VERSION_AB8500; 297 return ab->version == AB8500_VERSION_AB8500;