From: chudson@kionix.com
To: linux-omap@vger.kernel.org
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
Chris Hudson <chudson@kionix.com>
Subject: [RFC PATCH v2 2/3] mach-omap2:kxte9 accelerometer support for OMAP ZoomII
Date: Tue, 10 Nov 2009 18:11:22 -0500 [thread overview]
Message-ID: <1257894683-1213-2-git-send-email-chudson@kionix.com> (raw)
In-Reply-To: <1257894683-1213-1-git-send-email-chudson@kionix.com>
From: Chris Hudson <chudson@kionix.com>
This patch alters board-zoom2.c to add platform data initialization, gpio
configuration, and i2c-2 bus initialization in support of the kxte9
accelerometer on the OMAP ZoomII platform.
Signed-off-by: Chris Hudson <chudson@kionix.com>
---
arch/arm/mach-omap2/board-zoom2.c | 58 +++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index 4ad9b94..6a42c18 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -27,6 +27,47 @@
#include "mmc-twl4030.h"
#include "sdram-micron-mt46h32m32lf-6.h"
+#ifdef CONFIG_INPUT_KXTE9
+/* KIONIX KXTE9 Digital Tri-axis Accelerometer */
+#include <plat/mux.h>
+#include <linux/kxte9.h>
+#define ZOOM2_KIONIX_INT_GPIO 156
+
+static void __init zoom2_kionix_init(void)
+{
+ omap_cfg_reg(Y21_34XX_GPIO156);
+ if (gpio_request(ZOOM2_KIONIX_INT_GPIO, "kionix_irq") < 0) {
+ printk(KERN_ERR "kionix error retrieving GPIO\n");
+ return;
+ }
+ gpio_direction_input(ZOOM2_KIONIX_INT_GPIO);
+}
+
+static struct kxte9_platform_data zoom2_kxte9_data = {
+ .min_interval = 25,
+ .poll_interval = 200,
+
+ .axis_map_x = 0,
+ .axis_map_y = 1,
+ .axis_map_z = 2,
+
+ .negate_x = 0,
+ .negate_y = 0,
+ .negate_z = 0,
+
+ .ctrl_reg1_init = TPE | WUFE | B2SE,
+ .engine_odr_init = OB2S10 | OWUF40,
+ .int_ctrl_init = KXTE9_IEN | KXTE9_IEA,
+ .tilt_timer_init = 0x03,
+ .wuf_timer_init = 0x01,
+ .b2s_timer_init = 0x01,
+ .wuf_thresh_init = 0x20,
+ .b2s_thresh_init = 0x60,
+
+ .gpio = ZOOM2_KIONIX_INT_GPIO,
+};
+#endif
+
/* Zoom2 has Qwerty keyboard*/
static int board_keymap[] = {
KEY(0, 0, KEY_E),
@@ -256,11 +297,25 @@ static struct i2c_board_info __initdata zoom2_i2c_boardinfo[] = {
},
};
+#ifdef CONFIG_INPUT_KXTE9
+static struct i2c_board_info __initdata zoom2_i2c_bus2info[] = {
+ {
+ I2C_BOARD_INFO("kxte9", KXTE9_I2C_ADDR),
+ .platform_data = &zoom2_kxte9_data,
+ },
+};
+#endif
+
static int __init omap_i2c_init(void)
{
omap_register_i2c_bus(1, 2600, zoom2_i2c_boardinfo,
ARRAY_SIZE(zoom2_i2c_boardinfo));
+#ifndef CONFIG_INPUT_KXTE9
omap_register_i2c_bus(2, 400, NULL, 0);
+#else
+ omap_register_i2c_bus(2, 400, zoom2_i2c_bus2info,
+ ARRAY_SIZE(zoom2_i2c_bus2info));
+#endif
omap_register_i2c_bus(3, 400, NULL, 0);
return 0;
}
@@ -269,6 +324,9 @@ extern int __init omap_zoom2_debugboard_init(void);
static void __init omap_zoom2_init(void)
{
+#ifdef CONFIG_INPUT_KXTE9
+ zoom2_kionix_init();
+#endif
omap_i2c_init();
omap_serial_init();
omap_zoom2_debugboard_init();
--
1.5.4.3
next prev parent reply other threads:[~2009-11-10 23:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 23:11 [RFC PATCH v2 1/3] input:misc:driver support for Kionix kxte9 accelerometer chudson
2009-11-10 23:11 ` chudson [this message]
2009-11-10 23:11 ` [RFC PATCH v2 3/3] mach-omap2:kxte9 accelerometer mux support for OMAP ZoomII chudson
2009-11-11 8:40 ` [RFC PATCH v2 1/3] input:misc:driver support for Kionix kxte9 accelerometer Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1257894683-1213-2-git-send-email-chudson@kionix.com \
--to=chudson@kionix.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).