From patchwork Tue Nov 10 23:11:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chudson@kionix.com X-Patchwork-Id: 59213 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAANHmko005789 for ; Tue, 10 Nov 2009 23:19:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758647AbZKJXTE (ORCPT ); Tue, 10 Nov 2009 18:19:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758655AbZKJXTE (ORCPT ); Tue, 10 Nov 2009 18:19:04 -0500 Received: from barracuda.kionix.com ([205.232.90.213]:34317 "EHLO mail.kionix.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758647AbZKJXTE (ORCPT ); Tue, 10 Nov 2009 18:19:04 -0500 Received: (qmail 9788 invoked from network); 10 Nov 2009 22:52:19 -0000 Received: from unknown (HELO localhost.localdomain) (10.0.1.131) by 10.0.0.125 with SMTP; 10 Nov 2009 22:52:19 -0000 From: chudson@kionix.com To: linux-omap@vger.kernel.org Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, Chris Hudson Subject: [RFC PATCH v2 2/3] mach-omap2:kxte9 accelerometer support for OMAP ZoomII Date: Tue, 10 Nov 2009 18:11:22 -0500 Message-Id: <1257894683-1213-2-git-send-email-chudson@kionix.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <1257894683-1213-1-git-send-email-chudson@kionix.com> References: <1257894683-1213-1-git-send-email-chudson@kionix.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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 +#include +#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();