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>
This commit is contained in:

committed by
Samuel Ortiz

parent
7e82d6ff5d
commit
112a80d29b
@@ -7,6 +7,7 @@
|
||||
#ifndef MFD_AB8500_H
|
||||
#define MFD_AB8500_H
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
struct device;
|
||||
@@ -224,6 +225,7 @@ enum ab8500_version {
|
||||
* @dev: parent device
|
||||
* @lock: read/write operations lock
|
||||
* @irq_lock: genirq bus lock
|
||||
* @transfer_ongoing: 0 if no transfer ongoing
|
||||
* @irq: irq line
|
||||
* @version: chip version id (e.g. ab8500 or ab9540)
|
||||
* @chip_id: chip revision id
|
||||
@@ -242,7 +244,7 @@ struct ab8500 {
|
||||
struct device *dev;
|
||||
struct mutex lock;
|
||||
struct mutex irq_lock;
|
||||
|
||||
atomic_t transfer_ongoing;
|
||||
int irq_base;
|
||||
int irq;
|
||||
enum ab8500_version version;
|
||||
@@ -288,6 +290,8 @@ extern int __devinit ab8500_init(struct ab8500 *ab8500,
|
||||
enum ab8500_version version);
|
||||
extern int __devexit ab8500_exit(struct ab8500 *ab8500);
|
||||
|
||||
extern int ab8500_suspend(struct ab8500 *ab8500);
|
||||
|
||||
static inline int is_ab8500(struct ab8500 *ab)
|
||||
{
|
||||
return ab->version == AB8500_VERSION_AB8500;
|
||||
|
Reference in New Issue
Block a user