Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
bma150.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/input-polldev.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/bma150.h>

Go to the source code of this file.

Data Structures

struct  bma150_data
 

Macros

#define ABSMAX_ACC_VAL   0x01FF
 
#define ABSMIN_ACC_VAL   -(ABSMAX_ACC_VAL)
 
#define BMA150_XYZ_DATA_SIZE   6
 
#define BMA150_POLL_INTERVAL   10
 
#define BMA150_POLL_MAX   200
 
#define BMA150_POLL_MIN   0
 
#define BMA150_BW_25HZ   0
 
#define BMA150_BW_50HZ   1
 
#define BMA150_BW_100HZ   2
 
#define BMA150_BW_190HZ   3
 
#define BMA150_BW_375HZ   4
 
#define BMA150_BW_750HZ   5
 
#define BMA150_BW_1500HZ   6
 
#define BMA150_RANGE_2G   0
 
#define BMA150_RANGE_4G   1
 
#define BMA150_RANGE_8G   2
 
#define BMA150_MODE_NORMAL   0
 
#define BMA150_MODE_SLEEP   2
 
#define BMA150_MODE_WAKE_UP   3
 
#define BMA150_DATA_0_REG   0x00
 
#define BMA150_DATA_1_REG   0x01
 
#define BMA150_DATA_2_REG   0x02
 
#define BMA150_CTRL_0_REG   0x0A
 
#define BMA150_CTRL_1_REG   0x0B
 
#define BMA150_CTRL_2_REG   0x14
 
#define BMA150_CTRL_3_REG   0x15
 
#define BMA150_CFG_0_REG   0x0C
 
#define BMA150_CFG_1_REG   0x0D
 
#define BMA150_CFG_2_REG   0x0E
 
#define BMA150_CFG_3_REG   0x0F
 
#define BMA150_CFG_4_REG   0x10
 
#define BMA150_CFG_5_REG   0x11
 
#define BMA150_CHIP_ID   2
 
#define BMA150_CHIP_ID_REG   BMA150_DATA_0_REG
 
#define BMA150_ACC_X_LSB_REG   BMA150_DATA_2_REG
 
#define BMA150_SLEEP_POS   0
 
#define BMA150_SLEEP_MSK   0x01
 
#define BMA150_SLEEP_REG   BMA150_CTRL_0_REG
 
#define BMA150_BANDWIDTH_POS   0
 
#define BMA150_BANDWIDTH_MSK   0x07
 
#define BMA150_BANDWIDTH_REG   BMA150_CTRL_2_REG
 
#define BMA150_RANGE_POS   3
 
#define BMA150_RANGE_MSK   0x18
 
#define BMA150_RANGE_REG   BMA150_CTRL_2_REG
 
#define BMA150_WAKE_UP_POS   0
 
#define BMA150_WAKE_UP_MSK   0x01
 
#define BMA150_WAKE_UP_REG   BMA150_CTRL_3_REG
 
#define BMA150_SW_RES_POS   1
 
#define BMA150_SW_RES_MSK   0x02
 
#define BMA150_SW_RES_REG   BMA150_CTRL_0_REG
 
#define BMA150_ANY_MOTION_EN_POS   6
 
#define BMA150_ANY_MOTION_EN_MSK   0x40
 
#define BMA150_ANY_MOTION_EN_REG   BMA150_CTRL_1_REG
 
#define BMA150_ANY_MOTION_DUR_POS   6
 
#define BMA150_ANY_MOTION_DUR_MSK   0xC0
 
#define BMA150_ANY_MOTION_DUR_REG   BMA150_CFG_5_REG
 
#define BMA150_ANY_MOTION_THRES_REG   BMA150_CFG_4_REG
 
#define BMA150_ADV_INT_EN_POS   6
 
#define BMA150_ADV_INT_EN_MSK   0x40
 
#define BMA150_ADV_INT_EN_REG   BMA150_CTRL_3_REG
 
#define BMA150_HIGH_G_EN_POS   1
 
#define BMA150_HIGH_G_EN_MSK   0x02
 
#define BMA150_HIGH_G_EN_REG   BMA150_CTRL_1_REG
 
#define BMA150_HIGH_G_HYST_POS   3
 
#define BMA150_HIGH_G_HYST_MSK   0x38
 
#define BMA150_HIGH_G_HYST_REG   BMA150_CFG_5_REG
 
#define BMA150_HIGH_G_DUR_REG   BMA150_CFG_3_REG
 
#define BMA150_HIGH_G_THRES_REG   BMA150_CFG_2_REG
 
#define BMA150_LOW_G_EN_POS   0
 
#define BMA150_LOW_G_EN_MSK   0x01
 
#define BMA150_LOW_G_EN_REG   BMA150_CTRL_1_REG
 
#define BMA150_LOW_G_HYST_POS   0
 
#define BMA150_LOW_G_HYST_MSK   0x07
 
#define BMA150_LOW_G_HYST_REG   BMA150_CFG_5_REG
 
#define BMA150_LOW_G_DUR_REG   BMA150_CFG_1_REG
 
#define BMA150_LOW_G_THRES_REG   BMA150_CFG_0_REG
 

Functions

 MODULE_DEVICE_TABLE (i2c, bma150_id)
 
 module_i2c_driver (bma150_driver)
 
 MODULE_AUTHOR ("Albert Zhang <[email protected]>")
 
 MODULE_DESCRIPTION ("BMA150 driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define ABSMAX_ACC_VAL   0x01FF

Definition at line 38 of file bma150.c.

#define ABSMIN_ACC_VAL   -(ABSMAX_ACC_VAL)

Definition at line 39 of file bma150.c.

#define BMA150_ACC_X_LSB_REG   BMA150_DATA_2_REG

Definition at line 87 of file bma150.c.

#define BMA150_ADV_INT_EN_MSK   0x40

Definition at line 122 of file bma150.c.

#define BMA150_ADV_INT_EN_POS   6

Definition at line 121 of file bma150.c.

#define BMA150_ADV_INT_EN_REG   BMA150_CTRL_3_REG

Definition at line 123 of file bma150.c.

#define BMA150_ANY_MOTION_DUR_MSK   0xC0

Definition at line 115 of file bma150.c.

#define BMA150_ANY_MOTION_DUR_POS   6

Definition at line 114 of file bma150.c.

#define BMA150_ANY_MOTION_DUR_REG   BMA150_CFG_5_REG

Definition at line 116 of file bma150.c.

#define BMA150_ANY_MOTION_EN_MSK   0x40

Definition at line 111 of file bma150.c.

#define BMA150_ANY_MOTION_EN_POS   6

Definition at line 110 of file bma150.c.

#define BMA150_ANY_MOTION_EN_REG   BMA150_CTRL_1_REG

Definition at line 112 of file bma150.c.

#define BMA150_ANY_MOTION_THRES_REG   BMA150_CFG_4_REG

Definition at line 118 of file bma150.c.

#define BMA150_BANDWIDTH_MSK   0x07

Definition at line 94 of file bma150.c.

#define BMA150_BANDWIDTH_POS   0

Definition at line 93 of file bma150.c.

#define BMA150_BANDWIDTH_REG   BMA150_CTRL_2_REG

Definition at line 95 of file bma150.c.

#define BMA150_BW_100HZ   2

Definition at line 51 of file bma150.c.

#define BMA150_BW_1500HZ   6

Definition at line 55 of file bma150.c.

#define BMA150_BW_190HZ   3

Definition at line 52 of file bma150.c.

#define BMA150_BW_25HZ   0

Definition at line 49 of file bma150.c.

#define BMA150_BW_375HZ   4

Definition at line 53 of file bma150.c.

#define BMA150_BW_50HZ   1

Definition at line 50 of file bma150.c.

#define BMA150_BW_750HZ   5

Definition at line 54 of file bma150.c.

#define BMA150_CFG_0_REG   0x0C

Definition at line 77 of file bma150.c.

#define BMA150_CFG_1_REG   0x0D

Definition at line 78 of file bma150.c.

#define BMA150_CFG_2_REG   0x0E

Definition at line 79 of file bma150.c.

#define BMA150_CFG_3_REG   0x0F

Definition at line 80 of file bma150.c.

#define BMA150_CFG_4_REG   0x10

Definition at line 81 of file bma150.c.

#define BMA150_CFG_5_REG   0x11

Definition at line 82 of file bma150.c.

#define BMA150_CHIP_ID   2

Definition at line 84 of file bma150.c.

#define BMA150_CHIP_ID_REG   BMA150_DATA_0_REG

Definition at line 85 of file bma150.c.

#define BMA150_CTRL_0_REG   0x0A

Definition at line 71 of file bma150.c.

#define BMA150_CTRL_1_REG   0x0B

Definition at line 72 of file bma150.c.

#define BMA150_CTRL_2_REG   0x14

Definition at line 73 of file bma150.c.

#define BMA150_CTRL_3_REG   0x15

Definition at line 74 of file bma150.c.

#define BMA150_DATA_0_REG   0x00

Definition at line 66 of file bma150.c.

#define BMA150_DATA_1_REG   0x01

Definition at line 67 of file bma150.c.

#define BMA150_DATA_2_REG   0x02

Definition at line 68 of file bma150.c.

#define BMA150_HIGH_G_DUR_REG   BMA150_CFG_3_REG

Definition at line 134 of file bma150.c.

#define BMA150_HIGH_G_EN_MSK   0x02

Definition at line 127 of file bma150.c.

#define BMA150_HIGH_G_EN_POS   1

Definition at line 126 of file bma150.c.

#define BMA150_HIGH_G_EN_REG   BMA150_CTRL_1_REG

Definition at line 128 of file bma150.c.

#define BMA150_HIGH_G_HYST_MSK   0x38

Definition at line 131 of file bma150.c.

#define BMA150_HIGH_G_HYST_POS   3

Definition at line 130 of file bma150.c.

#define BMA150_HIGH_G_HYST_REG   BMA150_CFG_5_REG

Definition at line 132 of file bma150.c.

#define BMA150_HIGH_G_THRES_REG   BMA150_CFG_2_REG

Definition at line 135 of file bma150.c.

#define BMA150_LOW_G_DUR_REG   BMA150_CFG_1_REG

Definition at line 146 of file bma150.c.

#define BMA150_LOW_G_EN_MSK   0x01

Definition at line 139 of file bma150.c.

#define BMA150_LOW_G_EN_POS   0

Definition at line 138 of file bma150.c.

#define BMA150_LOW_G_EN_REG   BMA150_CTRL_1_REG

Definition at line 140 of file bma150.c.

#define BMA150_LOW_G_HYST_MSK   0x07

Definition at line 143 of file bma150.c.

#define BMA150_LOW_G_HYST_POS   0

Definition at line 142 of file bma150.c.

#define BMA150_LOW_G_HYST_REG   BMA150_CFG_5_REG

Definition at line 144 of file bma150.c.

#define BMA150_LOW_G_THRES_REG   BMA150_CFG_0_REG

Definition at line 147 of file bma150.c.

#define BMA150_MODE_NORMAL   0

Definition at line 61 of file bma150.c.

#define BMA150_MODE_SLEEP   2

Definition at line 62 of file bma150.c.

#define BMA150_MODE_WAKE_UP   3

Definition at line 63 of file bma150.c.

#define BMA150_POLL_INTERVAL   10

Definition at line 45 of file bma150.c.

#define BMA150_POLL_MAX   200

Definition at line 46 of file bma150.c.

#define BMA150_POLL_MIN   0

Definition at line 47 of file bma150.c.

#define BMA150_RANGE_2G   0

Definition at line 57 of file bma150.c.

#define BMA150_RANGE_4G   1

Definition at line 58 of file bma150.c.

#define BMA150_RANGE_8G   2

Definition at line 59 of file bma150.c.

#define BMA150_RANGE_MSK   0x18

Definition at line 98 of file bma150.c.

#define BMA150_RANGE_POS   3

Definition at line 97 of file bma150.c.

#define BMA150_RANGE_REG   BMA150_CTRL_2_REG

Definition at line 99 of file bma150.c.

#define BMA150_SLEEP_MSK   0x01

Definition at line 90 of file bma150.c.

#define BMA150_SLEEP_POS   0

Definition at line 89 of file bma150.c.

#define BMA150_SLEEP_REG   BMA150_CTRL_0_REG

Definition at line 91 of file bma150.c.

#define BMA150_SW_RES_MSK   0x02

Definition at line 106 of file bma150.c.

#define BMA150_SW_RES_POS   1

Definition at line 105 of file bma150.c.

#define BMA150_SW_RES_REG   BMA150_CTRL_0_REG

Definition at line 107 of file bma150.c.

#define BMA150_WAKE_UP_MSK   0x01

Definition at line 102 of file bma150.c.

#define BMA150_WAKE_UP_POS   0

Definition at line 101 of file bma150.c.

#define BMA150_WAKE_UP_REG   BMA150_CTRL_3_REG

Definition at line 103 of file bma150.c.

#define BMA150_XYZ_DATA_SIZE   6

Definition at line 42 of file bma150.c.

Function Documentation

MODULE_AUTHOR ( "Albert Zhang <[email protected]>"  )
MODULE_DESCRIPTION ( "BMA150 driver )
MODULE_DEVICE_TABLE ( i2c  ,
bma150_id   
)
module_i2c_driver ( bma150_driver  )
MODULE_LICENSE ( "GPL"  )