summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-05 12:59:29 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-05 12:59:29 +0200
commit978b0739dc9289e663283b2f275a5c0eed9ce01f (patch)
tree2b8abbd353f0b4e7d45b03e826c8909cd2cd72ab /include
parent40126ad7f81a115accc3297daf8383d7722a9e70 (diff)
parent61caefcf2518457247fbe405df8e39e029b41938 (diff)
downloadbarebox-978b0739dc9289e663283b2f275a5c0eed9ce01f.tar.gz
barebox-978b0739dc9289e663283b2f275a5c0eed9ce01f.tar.xz
Merge branch 'for-next/gpiolib'
Diffstat (limited to 'include')
-rw-r--r--include/gpio.h27
-rw-r--r--include/mfd/stmpe-i2c.h53
2 files changed, 79 insertions, 1 deletions
diff --git a/include/gpio.h b/include/gpio.h
index b7d840211a..9fb11c3268 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -5,10 +5,35 @@
static inline int gpio_request(unsigned gpio, const char *label)
{
- return 0;
+ return 0;
}
static inline void gpio_free(unsigned gpio)
{
}
+
+struct gpio_chip;
+
+struct gpio_ops {
+ int (*direction_input)(struct gpio_chip *chip, unsigned offset);
+ int (*direction_output)(struct gpio_chip *chip, unsigned offset, int value);
+ int (*get)(struct gpio_chip *chip, unsigned offset);
+ void (*set)(struct gpio_chip *chip, unsigned offset, int value);
+};
+
+struct gpio_chip {
+ struct device_d *dev;
+
+ int base;
+ int ngpio;
+
+ struct gpio_ops *ops;
+
+ struct list_head list;
+};
+
+int gpiochip_add(struct gpio_chip *chip);
+
+int gpio_get_num(struct device_d *dev, int gpio);
+
#endif /* __GPIO_H */
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 */