From: Fabio Estevam Date: Wed, 24 Aug 2011 20:31:35 +0000 (-0300) Subject: ARM: mx53_loco: Add support for the accelerometer X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2f81b4d977b06fd54e797f04e05091d8da8ddfee;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git ARM: mx53_loco: Add support for the accelerometer mx53_loco has a MMA8450 accelerometer connected to i2c0. Add support for it. Signed-off-by: Fabio Estevam Signed-off-by: Sascha Hauer --- diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c index 4e1d51d252dc..1bb0b3c330fb 100644 --- a/arch/arm/mach-mx5/board-mx53_loco.c +++ b/arch/arm/mach-mx5/board-mx53_loco.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,7 @@ #define LOCO_SD3_CD IMX_GPIO_NR(3, 11) #define LOCO_SD3_WP IMX_GPIO_NR(3, 12) #define LOCO_SD1_CD IMX_GPIO_NR(3, 13) +#define LOCO_ACCEL_EN IMX_GPIO_NR(6, 14) static iomux_v3_cfg_t mx53_loco_pads[] = { /* FEC */ @@ -64,6 +66,10 @@ static iomux_v3_cfg_t mx53_loco_pads[] = { MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD, MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS, MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD, + /* I2C1 */ + MX53_PAD_CSI0_DAT8__I2C1_SDA, + MX53_PAD_CSI0_DAT9__I2C1_SCL, + MX53_PAD_NANDF_CS1__GPIO6_14, /* Accelerometer Enable */ /* I2C2 */ MX53_PAD_KEY_COL3__I2C2_SCL, MX53_PAD_KEY_ROW3__I2C2_SDA, @@ -257,8 +263,15 @@ static const struct gpio_led_platform_data mx53loco_leds_data __initconst = { .num_leds = ARRAY_SIZE(mx53loco_leds), }; +static struct i2c_board_info mx53loco_i2c_devices[] = { + { + I2C_BOARD_INFO("mma8450", 0x1C), + }, +}; + static void __init mx53_loco_board_init(void) { + int ret; imx53_soc_init(); mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads, @@ -267,6 +280,13 @@ static void __init mx53_loco_board_init(void) mx53_loco_fec_reset(); imx53_add_fec(&mx53_loco_fec_data); imx53_add_imx2_wdt(0, NULL); + + ret = gpio_request_one(LOCO_ACCEL_EN, GPIOF_OUT_INIT_HIGH, "accel_en"); + if (ret) + pr_err("Cannot request ACCEL_EN pin: %d\n", ret); + + i2c_register_board_info(0, mx53loco_i2c_devices, + ARRAY_SIZE(mx53loco_i2c_devices)); imx53_add_imx_i2c(0, &mx53_loco_i2c_data); imx53_add_imx_i2c(1, &mx53_loco_i2c_data); imx53_add_sdhci_esdhc_imx(0, &mx53_loco_sd1_data);