diff options
author | Steffen Trumtrar <s.trumtrar@pengutronix.de> | 2012-09-05 10:23:52 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-09-05 11:48:16 +0200 |
commit | 054cef284ea98de65f0d858df3d54fcb3e99a28a (patch) | |
tree | ea3bb194c7425bae1150b07294555d29652d9aad /include | |
parent | b395e8bfb08444a5dbc391e64e0b8e2358906093 (diff) | |
download | barebox-054cef284ea98de65f0d858df3d54fcb3e99a28a.tar.gz barebox-054cef284ea98de65f0d858df3d54fcb3e99a28a.tar.xz |
mfd: add stmpe-i2c driver
The stmpe mfds can be connected via i2c and spi. This driver provides the basic
infrastructure for the i2c kind. It can be added as a normal i2c-device in the
board code. To enable functions a platform_data struct has to be provided, that
describes what parts of the chip are to be used.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/mfd/stmpe-i2c.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/include/mfd/stmpe-i2c.h b/include/mfd/stmpe-i2c.h new file mode 100644 index 0000000000..5f073d22d2 --- /dev/null +++ b/include/mfd/stmpe-i2c.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2012 Pengutronix + * Steffen Trumtrar <s.trumtrar@pengutronix.de> + * + * This file is released under the GPLv2 + * + */ + +#ifndef __ASM_ARCH_STMPE_H +#define __ASM_ARCH_STMPE_H + +enum stmpe_revision { + STMPE610, + STMPE801, + STMPE811, + STMPE1601, + STMPE2401, + STMPE2403, + STMPE_NBR_PARTS +}; + +enum stmpe_blocks { + STMPE_BLOCK_GPIO = 1 << 0, + STMPE_BLOCK_KEYPAD = 1 << 1, + STMPE_BLOCK_TOUCHSCREEN = 1 << 2, + STMPE_BLOCK_ADC = 1 << 3, + STMPE_BLOCK_PWM = 1 << 4, + STMPE_BLOCK_ROTATOR = 1 << 5, +}; + +struct stmpe_platform_data { + enum stmpe_revision revision; + enum stmpe_blocks blocks; + int gpio_base; +}; + +struct stmpe { + struct cdev cdev; + struct i2c_client *client; + struct stmpe_platform_data *pdata; +}; + +struct stmpe_client_info { + struct stmpe *stmpe; + int (*read_reg)(struct stmpe *stmpe, u32 reg, u8 *val); + int (*write_reg)(struct stmpe *stmpe, u32 reg, u8 val); +}; + +int stmpe_reg_read(struct stmpe *priv, u32 reg, u8 *val); +int stmpe_reg_write(struct stmpe *priv, u32 reg, u8 val); +int stmpe_set_bits(struct stmpe *priv, u32 reg, u8 mask, u8 val); + +#endif /* __ASM_ARCH_STMPE_H */ |