am335x: lis33ldlh: Add accelerometer support to AM335X
authorAnilKumar Ch <anilkumar@ti.com>
Fri, 25 Nov 2011 11:47:38 +0000 (17:17 +0530)
committerVaibhav Hiremath <hvaibhav@ti.com>
Mon, 23 Jan 2012 19:14:39 +0000 (00:44 +0530)
This patch adds lis33ldlh support to AM335X. lis33ldlh is connected
via I2C to am335x and I2C address is 0x18.

Also adds lis33ldlh, accelerometer to default kernel configuration
am335x_evm_defconfig

Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
arch/arm/configs/am335x_evm_defconfig
arch/arm/mach-omap2/board-am335xevm.c

index 3cd671860a8120e12c26f58533ba3bf6a06b7018..41dce55cb6101e641791fc4069315e338371345d 100644 (file)
@@ -853,7 +853,7 @@ CONFIG_BLK_DEV_RAM_SIZE=16384
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_MG_DISK is not set
 # CONFIG_BLK_DEV_RBD is not set
-# CONFIG_SENSORS_LIS3LV02D is not set
+CONFIG_SENSORS_LIS3LV02D=y
 CONFIG_MISC_DEVICES=y
 # CONFIG_AD525X_DPOT is not set
 # CONFIG_ICS932S401 is not set
@@ -888,7 +888,7 @@ CONFIG_EEPROM_AT24=y
 #
 # CONFIG_TI_ST is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
-# CONFIG_SENSORS_LIS3_I2C is not set
+CONFIG_SENSORS_LIS3_I2C=y
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
index f08e7d911ca6947ca659a5d4576f2d92be156305..d19d0bd3ca99352508f7ca940c83df20d42c95f8 100644 (file)
@@ -148,6 +148,7 @@ struct da8xx_lcdc_platform_data TFC_S9700RTWV35TR_01B_pdata = {
 
 /* TSc controller */
 #include <linux/input/ti_tscadc.h>
+#include <linux/lis3lv02d.h>
 
 static struct resource tsc_resources[]  = {
        [0] = {
@@ -1057,10 +1058,35 @@ static void evm_nand_init(int evm_id, int profile)
                ARRAY_SIZE(am335x_nand_partitions), 0, 0);
 }
 
+static struct lis3lv02d_platform_data lis331dlh_pdata = {
+       .click_flags = LIS3_CLICK_SINGLE_X |
+                       LIS3_CLICK_SINGLE_Y |
+                       LIS3_CLICK_SINGLE_Z,
+       .wakeup_flags = LIS3_WAKEUP_X_LO | LIS3_WAKEUP_X_HI |
+                       LIS3_WAKEUP_Y_LO | LIS3_WAKEUP_Y_HI |
+                       LIS3_WAKEUP_Z_LO | LIS3_WAKEUP_Z_HI,
+       .irq_cfg = LIS3_IRQ1_CLICK | LIS3_IRQ2_CLICK,
+       .wakeup_thresh  = 10,
+       .click_thresh_x = 10,
+       .click_thresh_y = 10,
+       .click_thresh_z = 10,
+       .g_range        = 2,
+       .st_min_limits[0] = 120,
+       .st_min_limits[1] = 120,
+       .st_min_limits[2] = 140,
+       .st_max_limits[0] = 550,
+       .st_max_limits[1] = 550,
+       .st_max_limits[2] = 750,
+};
+
 static struct i2c_board_info am335x_i2c_boardinfo1[] = {
        {
                I2C_BOARD_INFO("tlv320aic3x", 0x1b),
        },
+       {
+               I2C_BOARD_INFO("lis331dlh", 0x18),
+               .platform_data = &lis331dlh_pdata,
+       },
 };
 
 static void i2c1_init(int evm_id, int profile)
@@ -1343,7 +1369,7 @@ static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
        {usb1_init,     DEV_ON_BASEBOARD, PROFILE_ALL},
        {evm_nand_init, DEV_ON_DGHTR_BRD,
                (PROFILE_ALL & ~PROFILE_2 & ~PROFILE_3)},
-       {i2c1_init,     DEV_ON_DGHTR_BRD, (PROFILE_0 | PROFILE_3 | PROFILE_7)},
+       {i2c1_init,     DEV_ON_DGHTR_BRD, (PROFILE_ALL & ~PROFILE_2)},
        {mcasp1_init,   DEV_ON_DGHTR_BRD, (PROFILE_0 | PROFILE_3 | PROFILE_7)},
        {mmc1_init,     DEV_ON_DGHTR_BRD, PROFILE_2},
        {mmc2_wl12xx_init,      DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_3 |