Skip to content

Instantly share code, notes, and snippets.

@Embedded-linux
Created November 18, 2013 14:20
Show Gist options
  • Select an option

  • Save Embedded-linux/7528523 to your computer and use it in GitHub Desktop.

Select an option

Save Embedded-linux/7528523 to your computer and use it in GitHub Desktop.
Touch Screen Support
Files to change: arch/arm/board-am335xevm.c
-------------------------------------------------------------------------
+#include <linux/input/ti_tsc.h>
+#include <linux/mfd/ti_tscadc.h>
-------------------------------------------------------------------------
Header files incluing for structure ti_tsc variables and
register offset values of the device "TFC_S9700RTWV35TR_01B"
-------------------------------------------------------------------------
mfd_tscadc_init();
-------------------------------------------------------------------------
Initlization of Touch screen controller declaration
-------------------------------------------------------------------------
+/* Initialize and register tsc device */
+static void mfd_tscadc_init(void)
+{
+ int err;
+
+ setup_pin_mux(tsc_pin_mux);
+ err = am33xx_register_mfd_tscadc(&tscadc);
+ if (err)
+ pr_err("failed to register touchscreen device\n");
+}
+
-------------------------------------------------------------------------
Initlization of Touch screen controller with its capabilities
-------------------------------------------------------------------------
+/* Module pin mux for touchscreen controller */
+static struct pinmux_config tsc_pin_mux[] = {
+ {"ain0.ain0", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {"ain1.ain1", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {"ain2.ain2", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {"ain3.ain3", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {"vrefp.vrefp", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {"vrefn.vrefn", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
+ {NULL, 0},
+};
-------------------------------------------------------------------------
Pin muxing for Touch controller
--------------------------------------------------------------------------
+static struct mfd_tscadc_board tscadc = {
+ .tsc_init = &am335x_touchscreen_data,
+};
+
-------------------------------------------------------------------------
tscadc data structure
-------------------------------------------------------------------------
+/* TSc controller */
+static struct tsc_data am335x_touchscreen_data = {
+ .wires = 4,
+ .x_plate_resistance = 200,
+ .steps_to_configure = 5,
+};
+
-------------------------------------------------------------------------
Touch screen Controller data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment