[U-Boot] [PATCH 4/8] input: Add support for FMA1125 touch controller

dietho at gmx.de dietho at gmx.de
Thu May 15 16:34:46 CEST 2014


From: Thomas Diener <dietho at gmx.de>

Signed-off-by: Thomas Diener <dietho at gmx.de>
---
 drivers/input/Makefile  |    3 +-
 drivers/input/fma1125.c |   47 ++++++++++++++++
 include/fma1125.h       |  140 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 189 insertions(+), 1 deletion(-)
 create mode 100644 drivers/input/fma1125.c
 create mode 100644 include/fma1125.h

diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index 65c40ba..203a311 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -14,4 +14,5 @@ obj-$(CONFIG_PS2MULT) += ps2mult.o ps2ser.o
 endif
 obj-y += input.o
 obj-$(CONFIG_OF_CONTROL) += key_matrix.o
-obj-$(CONFIG_POLYTOUCH) += polytouch.o
\ No newline at end of file
+obj-$(CONFIG_POLYTOUCH) += polytouch.o
+obj-$(CONFIG_FMA1125) += fma1125.o
\ No newline at end of file
diff --git a/drivers/input/fma1125.c b/drivers/input/fma1125.c
new file mode 100644
index 0000000..8241371
--- /dev/null
+++ b/drivers/input/fma1125.c
@@ -0,0 +1,47 @@
+/*
+ * (c) 2012 Graf-Syteco, Matthias Weisser
+ * <weisserm at arcor.de>
+ *
+ * fma1125.c - FUJITSU FMA1125 Touch Sensor Controller
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ */
+
+#include <common.h>
+#include <fma1125.h>
+#include <i2c.h>
+
+int fma1125_init(int id, const struct fma1125_register_tbl *lu, uint16_t num)
+{
+	const struct fma1125_register_tbl *p;
+	int res = 0;
+
+	if (NULL == lu)
+		return res;
+
+	if (!i2c_probe(FMA1125_SA)) {
+		int i;
+
+		p = lu;
+
+		for (i = 0; i < num; i++) {
+			i2c_reg_write(id, p->addr, p->value);
+			p++;
+		}
+
+		res = 1;
+	}
+	return res;
+}
+
+int fma1125_get_touch_bits(void)
+{
+	uint8_t res = i2c_reg_read(FMA1125_SA, FMA1125_PA_TOUCH_BYTE);
+	return res;
+}
+
+void fma1125_set_gpio_out(uint8_t value)
+{
+	i2c_reg_write(FMA1125_SA, FMA1125_GPIO_DATA_OUT, value);
+}
diff --git a/include/fma1125.h b/include/fma1125.h
new file mode 100644
index 0000000..322cff5
--- /dev/null
+++ b/include/fma1125.h
@@ -0,0 +1,140 @@
+/*
+ * (c) 2012 Graf-Syteco, Matthias Weisser
+ * <weisserm at arcor.de>
+ *
+ * fma1125.h - FUJITSU FMA1125 Touch Sensor Controller
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __FMA1125_H
+#define __FMA1125_H
+
+
+#define FMA1125_SA				0x68
+
+#define FMA1125_PA0_ALPHA			0x00
+#define FMA1125_PA1_ALPHA			0x01
+#define FMA1125_PA2_ALPHA			0x02
+#define FMA1125_PA3_ALPHA			0x03
+#define FMA1125_PA4_ALPHA			0x04
+#define FMA1125_PA5_ALPHA			0x05
+#define FMA1125_PA6_ALPHA			0x06
+#define FMA1125_PA7_ALPHA			0x07
+#define FMA1125_REFERENCE_DELAY			0x08
+#define FMA1125_BETA				0x09
+#define FMA1125_AIC_WAIT_TIME			0x0A
+#define FMA1125_PA0_STRENGTH_THRESHOLD		0x0B
+#define FMA1125_PA1_STRENGTH_THRESHOLD		0x0C
+#define FMA1125_PA2_STRENGTH_THRESHOLD		0x0D
+#define FMA1125_PA3_STRENGTH_THRESHOLD		0x0E
+#define FMA1125_PA4_STRENGTH_THRESHOLD		0x0F
+#define FMA1125_PA5_STRENGTH_THRESHOLD		0x10
+#define FMA1125_PA6_STRENGTH_THRESHOLD		0x11
+#define FMA1125_PA7_STRENGTH_THRESHOLD		0x12
+#define FMA1125_FEATURE_SELECT			0x13
+#define FMA1125_INTEGRATION_TIME		0x14
+#define FMA1125_IDLE_STATE_ENTER_TIME		0x15
+#define FMA1125_CONTROL_1			0x16
+#define FMA1125_CONTROL_2			0x17
+#define FMA1125_PA_DATA_OUT			0x18
+#define FMA1125_GPIO_DATA_OUT			0x19
+#define FMA1125_PA_DIRECTION			0x1A
+#define FMA1125_GPIO_DIRECTION			0x1B
+#define FMA1125_PA_CONFIGURATION		0x1C
+#define FMA1125_GPIO_CONFIGURATION		0x1D
+#define FMA1125_CALIBRATION_INTERVAL		0x1E
+#define FMA1125_GINT_INTERRUPT_MASK		0x1F
+#define FMA1125_GINT_INTERRUPT_CLEAR		0x20
+#define FMA1125_PA_EINT_ENABLE			0x21
+#define FMA1125_GPIO_EINT_ENABLE		0x22
+#define FMA1125_FILTER_PERIOD			0x23
+#define FMA1125_FILTER_THRESHOLD		0x24
+#define FMA1125_CONTROL_3			0x25
+#define FMA1125_GINT_INTERRUPT_EDGE_EN		0x26
+#define FMA1125_GPIO_INPUT_BOUNCE_PERIOD	0x27
+#define FMA1125_REGISTER_CHECK			0x28
+#define FMA1125_PA03_RESISTOR_SELECT		0x29
+#define FMA1125_PA47_RESISTOR_SELECT		0x2A
+#define FMA1125_REFERENCE_RESISTOR_SELECT	0x2B
+#define FMA1125_BETA_DISABLE			0x2C
+#define FMA1125_GPIO01_DIM_UNIT_PERIOD		0x2D
+#define FMA1125_GPIO23_DIM_UNIT_PERIOD		0x2E
+#define FMA1125_PA01_DIM_UNIT_PERIOD		0x2F
+#define FMA1125_PA23_DIM_UNIT_PERIOD		0x30
+#define FMA1125_GPIO0_DIMMING_CONTROL		0x31
+#define FMA1125_GPIO1_DIMMING_CONTROL		0x32
+#define FMA1125_GPIO2_DIMMING_CONTROL		0x33
+#define FMA1125_GPIO3_DIMMING_CONTROL		0x34
+#define FMA1125_PA0_DIMMING_CONTROL		0x35
+#define FMA1125_PA1_DIMMING_CONTROL		0x36
+#define FMA1125_PA2_DIMMING_CONTROL		0x37
+#define FMA1125_PA3_DIMMING_CONTROL		0x38
+#define FMA1125_GPIO03_DIMMING_MODE		0x39
+#define FMA1125_PA03_DIMMING_MODE		0x3A
+#define FMA1125_DIMMING_START			0x3B
+#define FMA1125_DIMMING_ENABLE			0x3C
+#define FMA1125_PA0_STRENGTH			0x50
+#define FMA1125_PA1_STRENGTH			0x51
+#define FMA1125_PA2_STRENGTH			0x52
+#define FMA1125_PA3_STRENGTH			0x53
+#define FMA1125_PA4_STRENGTH			0x54
+#define FMA1125_PA5_STRENGTH			0x55
+#define FMA1125_PA6_STRENGTH			0x56
+#define FMA1125_PA7_STRENGTH			0x57
+#define FMA1125_PA0_IMPEDANCE			0x58
+#define FMA1125_PA1_IMPEDANCE			0x59
+#define FMA1125_PA2_IMPEDANCE			0x5A
+#define FMA1125_PA3_IMPEDANCE			0x5B
+#define FMA1125_PA4_IMPEDANCE			0x5C
+#define FMA1125_PA5_IMPEDANCE			0x5D
+#define FMA1125_PA6_IMPEDANCE			0x5E
+#define FMA1125_PA7_IMPEDANCE			0x5F
+#define FMA1125_PA0_REF_IMPEDANCE		0x60
+#define FMA1125_PA1_REF_IMPEDANCE		0x61
+#define FMA1125_PA2_REF_IMPEDANCE		0x62
+#define FMA1125_PA3_REF_IMPEDANCE		0x63
+#define FMA1125_PA4_REF_IMPEDANCE		0x64
+#define FMA1125_PA5_REF_IMPEDANCE		0x65
+#define FMA1125_PA6_REF_IMPEDANCE		0x66
+#define FMA1125_PA7_REF_IMPEDANCE		0x67
+#define FMA1125_PA_TOUCH_BYTE			0x68
+#define FMA1125_GINT_INTERRUPT_PENDING		0x69
+#define FMA1125_PA_INPUT_DATA			0x6A
+#define FMA1125_GPIO_INPUT_DATA			0x6B
+#define FMA1125_PA_INPUT_BCU_DATA		0x6C
+#define FMA1125_GPIO_INPUT_BCU_DATA		0x6D
+#define FMA1125_PA_INPUT_FIFO_DATA		0x6E
+#define FMA1125_GPIO_INPUT_FIFO_DATA		0x6F
+#define FMA1125_CLK_EXTERNAL			0xF7
+#define FMA1125_CLK_INTERNAL			0xF8
+#define FMA1125_BIAS_OFF			0xF9
+#define FMA1125_BIAS_ON				0xFA
+#define FMA1125_LTB_ENABLE			0xFB
+#define FMA1125_WAKEUP_SLEEP			0xFC
+#define FMA1125_ENTER_SLEEP			0xFD
+#define FMA1125_COLD_RESET			0xFE
+#define FMA1125_WARM_RESET			0xFF
+
+
+#define FMA1125_PA7_R_SEL(x)			(((x) & 0x3) << 6)
+#define FMA1125_PA6_R_SEL(x)			(((x) & 0x3) << 4)
+#define FMA1125_PA5_R_SEL(x)			(((x) & 0x3) << 2)
+#define FMA1125_PA4_R_SEL(x)			(((x) & 0x3) << 0)
+
+#define FMA1125_PA3_R_SEL(x)			(((x) & 0x3) << 6)
+#define FMA1125_PA2_R_SEL(x)			(((x) & 0x3) << 4)
+#define FMA1125_PA1_R_SEL(x)			(((x) & 0x3) << 2)
+#define FMA1125_PA0_R_SEL(x)			(((x) & 0x3) << 0)
+
+
+struct fma1125_register_tbl {
+	uint8_t addr;
+	uint8_t value;
+};
+
+int fma1125_init(int id, const struct fma1125_register_tbl *lu, uint16_t num);
+int fma1125_get_touch_bits(void);
+void fma1125_set_gpio_out(uint8_t value);
+
+#endif
-- 
1.7.9.5



More information about the U-Boot mailing list