Commit e2f95aab96370416429cb0ee84f1c98c7a310e25

Authored by Anil Kumar Ch
1 parent 4903a2ddb7
Exists in master

am335x: lis33ldlh: Add accelerometer support to AM335X

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: Anil Kumar Ch <anilkumar@ti.com>

Showing 2 changed files with 29 additions and 3 deletions Side-by-side Diff

arch/arm/configs/am335x_evm_defconfig
... ... @@ -853,7 +853,7 @@
853 853 # CONFIG_ATA_OVER_ETH is not set
854 854 # CONFIG_MG_DISK is not set
855 855 # CONFIG_BLK_DEV_RBD is not set
856   -# CONFIG_SENSORS_LIS3LV02D is not set
  856 +CONFIG_SENSORS_LIS3LV02D=y
857 857 CONFIG_MISC_DEVICES=y
858 858 # CONFIG_AD525X_DPOT is not set
859 859 # CONFIG_ICS932S401 is not set
... ... @@ -888,7 +888,7 @@
888 888 #
889 889 # CONFIG_TI_ST is not set
890 890 # CONFIG_SENSORS_LIS3_SPI is not set
891   -# CONFIG_SENSORS_LIS3_I2C is not set
  891 +CONFIG_SENSORS_LIS3_I2C=y
892 892 CONFIG_HAVE_IDE=y
893 893 # CONFIG_IDE is not set
894 894  
arch/arm/mach-omap2/board-am335xevm.c
... ... @@ -149,6 +149,7 @@
149 149  
150 150 /* TSc controller */
151 151 #include <linux/input/ti_tscadc.h>
  152 +#include <linux/lis3lv02d.h>
152 153  
153 154 static struct resource tsc_resources[] = {
154 155 [0] = {
155 156  
... ... @@ -1070,10 +1071,35 @@
1070 1071 ARRAY_SIZE(am335x_nand_partitions), 0, 0);
1071 1072 }
1072 1073  
  1074 +static struct lis3lv02d_platform_data lis331dlh_pdata = {
  1075 + .click_flags = LIS3_CLICK_SINGLE_X |
  1076 + LIS3_CLICK_SINGLE_Y |
  1077 + LIS3_CLICK_SINGLE_Z,
  1078 + .wakeup_flags = LIS3_WAKEUP_X_LO | LIS3_WAKEUP_X_HI |
  1079 + LIS3_WAKEUP_Y_LO | LIS3_WAKEUP_Y_HI |
  1080 + LIS3_WAKEUP_Z_LO | LIS3_WAKEUP_Z_HI,
  1081 + .irq_cfg = LIS3_IRQ1_CLICK | LIS3_IRQ2_CLICK,
  1082 + .wakeup_thresh = 10,
  1083 + .click_thresh_x = 10,
  1084 + .click_thresh_y = 10,
  1085 + .click_thresh_z = 10,
  1086 + .g_range = 2,
  1087 + .st_min_limits[0] = 120,
  1088 + .st_min_limits[1] = 120,
  1089 + .st_min_limits[2] = 140,
  1090 + .st_max_limits[0] = 550,
  1091 + .st_max_limits[1] = 550,
  1092 + .st_max_limits[2] = 750,
  1093 +};
  1094 +
1073 1095 static struct i2c_board_info am335x_i2c_boardinfo1[] = {
1074 1096 {
1075 1097 I2C_BOARD_INFO("tlv320aic3x", 0x1b),
1076 1098 },
  1099 + {
  1100 + I2C_BOARD_INFO("lis331dlh", 0x18),
  1101 + .platform_data = &lis331dlh_pdata,
  1102 + },
1077 1103 };
1078 1104  
1079 1105 static void i2c1_init(int evm_id, int profile)
... ... @@ -1356,7 +1382,7 @@
1356 1382 {usb1_init, DEV_ON_BASEBOARD, PROFILE_ALL},
1357 1383 {evm_nand_init, DEV_ON_DGHTR_BRD,
1358 1384 (PROFILE_ALL & ~PROFILE_2 & ~PROFILE_3)},
1359   - {i2c1_init, DEV_ON_DGHTR_BRD, (PROFILE_0 | PROFILE_3 | PROFILE_7)},
  1385 + {i2c1_init, DEV_ON_DGHTR_BRD, (PROFILE_ALL & ~PROFILE_2)},
1360 1386 {mcasp1_init, DEV_ON_DGHTR_BRD, (PROFILE_0 | PROFILE_3 | PROFILE_7) },
1361 1387 {mmc1_init, DEV_ON_DGHTR_BRD, PROFILE_2},
1362 1388 {mmc2_wl12xx_init, DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_3 |