aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/stmpe.h
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2011-11-17 00:32:20 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-01-08 18:37:42 -0500
commit1a6e4b7415339e3b11a87cff0d701b8a2e55f062 (patch)
treefbd5151ac34bf908826f4bbf8b298404660a8de1 /drivers/mfd/stmpe.h
parent71e58782d2e054798f91473f5452ffe65e2a5ff8 (diff)
mfd: Separate out STMPE controller and interface specific code
Few STMPE controller can have register interface over SPI or I2C. Current implementation only supports I2C and all code is present in a single file stmpe.c. It would be better to separate out I2C interface specific code from controller specific code. Later SPI specific code can be added in a separate file. This patch separates out I2C and controller specific code into separate files, making stmpe.c independent of I2C. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/stmpe.h')
-rw-r--r--drivers/mfd/stmpe.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
index e4ee38956583..18d89a68ce40 100644
--- a/drivers/mfd/stmpe.h
+++ b/drivers/mfd/stmpe.h
@@ -8,6 +8,14 @@
8#ifndef __STMPE_H 8#ifndef __STMPE_H
9#define __STMPE_H 9#define __STMPE_H
10 10
11#include <linux/device.h>
12#include <linux/mfd/core.h>
13#include <linux/mfd/stmpe.h>
14#include <linux/printk.h>
15#include <linux/types.h>
16
17extern const struct dev_pm_ops stmpe_dev_pm_ops;
18
11#ifdef STMPE_DUMP_BYTES 19#ifdef STMPE_DUMP_BYTES
12static inline void stmpe_dump_bytes(const char *str, const void *buf, 20static inline void stmpe_dump_bytes(const char *str, const void *buf,
13 size_t len) 21 size_t len)
@@ -67,6 +75,31 @@ struct stmpe_variant_info {
67 int (*enable_autosleep)(struct stmpe *stmpe, int autosleep_timeout); 75 int (*enable_autosleep)(struct stmpe *stmpe, int autosleep_timeout);
68}; 76};
69 77
78/**
79 * struct stmpe_client_info - i2c or spi specific routines/info
80 * @data: client specific data
81 * @read_byte: read single byte
82 * @write_byte: write single byte
83 * @read_block: read block or multiple bytes
84 * @write_block: write block or multiple bytes
85 * @init: client init routine, called during probe
86 */
87struct stmpe_client_info {
88 void *data;
89 int irq;
90 void *client;
91 struct device *dev;
92 int (*read_byte)(struct stmpe *stmpe, u8 reg);
93 int (*write_byte)(struct stmpe *stmpe, u8 reg, u8 val);
94 int (*read_block)(struct stmpe *stmpe, u8 reg, u8 len, u8 *values);
95 int (*write_block)(struct stmpe *stmpe, u8 reg, u8 len,
96 const u8 *values);
97 void (*init)(struct stmpe *stmpe);
98};
99
100int stmpe_probe(struct stmpe_client_info *ci, int partnum);
101int stmpe_remove(struct stmpe *stmpe);
102
70#define STMPE_ICR_LSB_HIGH (1 << 2) 103#define STMPE_ICR_LSB_HIGH (1 << 2)
71#define STMPE_ICR_LSB_EDGE (1 << 1) 104#define STMPE_ICR_LSB_EDGE (1 << 1)
72#define STMPE_ICR_LSB_GIM (1 << 0) 105#define STMPE_ICR_LSB_GIM (1 << 0)