summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2013-10-02 15:36:25 +0200
committerStefan Agner <stefan.agner@toradex.com>2013-10-02 15:36:25 +0200
commit821308d4f18d849f2666c66acd9e7c09dc7d4b19 (patch)
treee6bd4670e96fe8e8206344ccec650a6fdeba4c32 /arch
parent1000a638ba153fd88146742d2f4702c028251329 (diff)
mvf_adc: Add touch detection support
In order to be more energy efficient sample the ADC channels only if touch is detected. Do the pinmux in the platform specific code, extended the platform data with those helper functions.
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mvf/board-colibri_vf50.c37
-rw-r--r--arch/arm/mach-mvf/devices-mvf.h4
-rw-r--r--arch/arm/plat-mxc/devices/platform-mvf-adc.c12
-rw-r--r--arch/arm/plat-mxc/include/mach/colibri-ts.h30
-rwxr-xr-xarch/arm/plat-mxc/include/mach/devices-common.h5
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mvf.h7
6 files changed, 73 insertions, 22 deletions
diff --git a/arch/arm/mach-mvf/board-colibri_vf50.c b/arch/arm/mach-mvf/board-colibri_vf50.c
index de76b3612ce1..0928cd9ce9ab 100644
--- a/arch/arm/mach-mvf/board-colibri_vf50.c
+++ b/arch/arm/mach-mvf/board-colibri_vf50.c
@@ -73,6 +73,7 @@
#include <mach/mipi_csi2.h>
#include <mach/fsl_l2_switch.h>
#include <mach/mxc.h>
+#include <mach/colibri-ts.h>
#include <asm/irq.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
@@ -254,6 +255,40 @@ static inline void mvf_vf700_init_uart(void)
mvf_add_imx_uart(2, &mvf_uart2_pdata);
}
+static int colibri_ts_mux_pen_interrupt(struct platform_device *pdev)
+{
+ mxc_iomux_v3_setup_pad(MVF600_PAD8_PTA18);
+ mxc_iomux_v3_setup_pad(MVF600_PAD9_PTA19);
+
+ dev_dbg(&pdev->dev, "Muxed XP/XM as GPIO\n");
+
+ return 0;
+}
+
+static int colibri_ts_mux_adc(struct platform_device *pdev)
+{
+ mxc_iomux_v3_setup_pad(MVF600_PAD8_PTA18_ADC0_SE0);
+ mxc_iomux_v3_setup_pad(MVF600_PAD9_PTA19_ADC0_SE1);
+
+ dev_dbg(&pdev->dev, "Muxed XP/XM for ADC mode\n");
+
+ return 0;
+}
+
+
+static struct colibri_ts_platform_data colibri_ts_pdata = {
+ .mux_pen_interrupt = &colibri_ts_mux_pen_interrupt,
+ .mux_adc = &colibri_ts_mux_adc,
+ .gpio_pen = 8, /* PAD8 */
+};
+
+struct platform_device *__init colibri_add_touchdev(
+ const struct colibri_ts_platform_data *pdata)
+{
+ return imx_add_platform_device("mvf-adc-ts", 0, NULL, 0,
+ pdata, sizeof(*pdata));
+}
+
static struct fec_platform_data fec_data __initdata = {
.phy = PHY_INTERFACE_MODE_RMII,
};
@@ -392,7 +427,6 @@ static void __init mvf_init_adc(void)
{
mvf_add_adc(0);
mvf_add_adc(1);
- mvf_add_adc_touch(0);
}
/*!
@@ -411,6 +445,7 @@ static void __init mvf_board_init(void)
mvf_add_snvs_rtc();
mvf_init_adc();
+ colibri_add_touchdev(&colibri_ts_pdata);
mvf_add_pm_imx(0, &mvf_vf600_pm_data);
diff --git a/arch/arm/mach-mvf/devices-mvf.h b/arch/arm/mach-mvf/devices-mvf.h
index 29949074cf44..c434834ba0b2 100644
--- a/arch/arm/mach-mvf/devices-mvf.h
+++ b/arch/arm/mach-mvf/devices-mvf.h
@@ -148,10 +148,6 @@ extern const struct mvf_adc_data mvfa5_adc_data[] __initconst;
#define mvf_add_adc(id) \
mvf_add_adcdev(&mvfa5_adc_data[id])
-extern const struct mvf_adc_touch mvfa5_adc_touch[] __initconst;
-#define mvf_add_adc_touch(id) \
- mvf_add_adc_touchdev(&mvfa5_adc_touch[id])
-
extern const struct imx_imx2_wdt_data fsl_imx2_wdt_data[] __initconst;
#define mvf_add_wdt(id) \
imx_add_imx2_wdt(&fsl_imx2_wdt_data[id])
diff --git a/arch/arm/plat-mxc/devices/platform-mvf-adc.c b/arch/arm/plat-mxc/devices/platform-mvf-adc.c
index 259251c91fb8..085bc4508a31 100644
--- a/arch/arm/plat-mxc/devices/platform-mvf-adc.c
+++ b/arch/arm/plat-mxc/devices/platform-mvf-adc.c
@@ -28,12 +28,6 @@ const struct mvf_adc_data mvfa5_adc_data[] __initconst = {
mvf_adc_data_entry(MVF, 0, SZ_4K),
mvf_adc_data_entry(MVF, 1, SZ_4K),
};
-
-const struct mvf_adc_touch mvfa5_adc_touch[] __initconst = {
- [0] = {
- .id = 0
- }
-};
#endif
struct platform_device *__init mvf_add_adcdev(
@@ -56,9 +50,3 @@ struct platform_device *__init mvf_add_adcdev(
ARRAY_SIZE(res), NULL, 0);
}
-struct platform_device *__init mvf_add_adc_touchdev(
- const struct mvf_adc_touch *data)
-{
- return imx_add_platform_device("mvf-adc-ts", data->id, NULL, 0,
- NULL, 0);
-}
diff --git a/arch/arm/plat-mxc/include/mach/colibri-ts.h b/arch/arm/plat-mxc/include/mach/colibri-ts.h
new file mode 100644
index 000000000000..dde7c3ce8687
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/colibri-ts.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2013 by Stefan Agner <stefan.agner@toradex.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#ifndef ASMARM_ARCH_COLIBRI_TS_H
+#define ASMARM_ARCH_COLIBRI_TS_H
+
+struct colibri_ts_platform_data {
+ int (*init)(struct platform_device *pdev);
+ void (*exit)(struct platform_device *pdev);
+ unsigned int gpio_pen;
+ int (*mux_pen_interrupt)(struct platform_device *pdev);
+ int (*mux_adc)(struct platform_device *pdev);
+};
+
+#endif
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 0de55332cff6..0e2a2a1d13e9 100755
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -97,11 +97,6 @@ struct mvf_adc_data {
};
struct platform_device *__init mvf_add_adcdev(
const struct mvf_adc_data *data);
-struct mvf_adc_touch {
- int id;
-};
-struct platform_device *__init mvf_add_adc_touchdev(
- const struct mvf_adc_touch *data);
struct imx_imxdi_rtc_data {
resource_size_t iobase;
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mvf.h b/arch/arm/plat-mxc/include/mach/iomux-mvf.h
index 3d69c7c7ef7b..0d1ff6abb048 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mvf.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mvf.h
@@ -280,6 +280,13 @@ typedef enum iomux_config {
IOMUX_PAD(0x0034, 0x0034, 0, 0x0370, 0, \
MVF600_TS_PAD_CTRL | PAD_CTL_OBE_ENABLE)
+/*Touchscreen touch detection*/
+#define MVF600_PAD8_PTA18 \
+ IOMUX_PAD(0x0020, 0x0020, 0, 0x0370, 0, \
+ MVF600_TS_PAD_CTRL | PAD_CTL_IBE_ENABLE)
+#define MVF600_PAD9_PTA19 \
+ IOMUX_PAD(0x0024, 0x0024, 0, 0x0370, 0, \
+ MVF600_GPIO_GENERAL_CTRL | PAD_CTL_IBE_ENABLE)
/*DCU0*/