Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
ak8975.c File Reference
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>

Go to the source code of this file.

Data Structures

struct  ak8975_data
 

Macros

#define AK8975_REG_WIA   0x00
 
#define AK8975_DEVICE_ID   0x48
 
#define AK8975_REG_INFO   0x01
 
#define AK8975_REG_ST1   0x02
 
#define AK8975_REG_ST1_DRDY_SHIFT   0
 
#define AK8975_REG_ST1_DRDY_MASK   (1 << AK8975_REG_ST1_DRDY_SHIFT)
 
#define AK8975_REG_HXL   0x03
 
#define AK8975_REG_HXH   0x04
 
#define AK8975_REG_HYL   0x05
 
#define AK8975_REG_HYH   0x06
 
#define AK8975_REG_HZL   0x07
 
#define AK8975_REG_HZH   0x08
 
#define AK8975_REG_ST2   0x09
 
#define AK8975_REG_ST2_DERR_SHIFT   2
 
#define AK8975_REG_ST2_DERR_MASK   (1 << AK8975_REG_ST2_DERR_SHIFT)
 
#define AK8975_REG_ST2_HOFL_SHIFT   3
 
#define AK8975_REG_ST2_HOFL_MASK   (1 << AK8975_REG_ST2_HOFL_SHIFT)
 
#define AK8975_REG_CNTL   0x0A
 
#define AK8975_REG_CNTL_MODE_SHIFT   0
 
#define AK8975_REG_CNTL_MODE_MASK   (0xF << AK8975_REG_CNTL_MODE_SHIFT)
 
#define AK8975_REG_CNTL_MODE_POWER_DOWN   0
 
#define AK8975_REG_CNTL_MODE_ONCE   1
 
#define AK8975_REG_CNTL_MODE_SELF_TEST   8
 
#define AK8975_REG_CNTL_MODE_FUSE_ROM   0xF
 
#define AK8975_REG_RSVC   0x0B
 
#define AK8975_REG_ASTC   0x0C
 
#define AK8975_REG_TS1   0x0D
 
#define AK8975_REG_TS2   0x0E
 
#define AK8975_REG_I2CDIS   0x0F
 
#define AK8975_REG_ASAX   0x10
 
#define AK8975_REG_ASAY   0x11
 
#define AK8975_REG_ASAZ   0x12
 
#define AK8975_MAX_REGS   AK8975_REG_ASAZ
 
#define AK8975_MAX_CONVERSION_TIMEOUT   500
 
#define AK8975_CONVERSION_DONE_POLL_TIME   10
 
#define AK8975_CHANNEL(axis, index)
 

Functions

 MODULE_DEVICE_TABLE (i2c, ak8975_id)
 
 MODULE_DEVICE_TABLE (of, ak8975_of_match)
 
 module_i2c_driver (ak8975_driver)
 
 MODULE_AUTHOR ("Laxman Dewangan <[email protected]>")
 
 MODULE_DESCRIPTION ("AK8975 magnetometer driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define AK8975_CHANNEL (   axis,
  index 
)
Value:
{ \
.type = IIO_MAGN, \
.modified = 1, \
.channel2 = IIO_MOD_##axis, \
IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
.address = index, \
}

Definition at line 393 of file ak8975.c.

#define AK8975_CONVERSION_DONE_POLL_TIME   10

Definition at line 84 of file ak8975.c.

#define AK8975_DEVICE_ID   0x48

Definition at line 40 of file ak8975.c.

#define AK8975_MAX_CONVERSION_TIMEOUT   500

Definition at line 83 of file ak8975.c.

#define AK8975_MAX_REGS   AK8975_REG_ASAZ

Definition at line 78 of file ak8975.c.

#define AK8975_REG_ASAX   0x10

Definition at line 74 of file ak8975.c.

#define AK8975_REG_ASAY   0x11

Definition at line 75 of file ak8975.c.

#define AK8975_REG_ASAZ   0x12

Definition at line 76 of file ak8975.c.

#define AK8975_REG_ASTC   0x0C

Definition at line 70 of file ak8975.c.

#define AK8975_REG_CNTL   0x0A

Definition at line 61 of file ak8975.c.

#define AK8975_REG_CNTL_MODE_FUSE_ROM   0xF

Definition at line 67 of file ak8975.c.

#define AK8975_REG_CNTL_MODE_MASK   (0xF << AK8975_REG_CNTL_MODE_SHIFT)

Definition at line 63 of file ak8975.c.

#define AK8975_REG_CNTL_MODE_ONCE   1

Definition at line 65 of file ak8975.c.

#define AK8975_REG_CNTL_MODE_POWER_DOWN   0

Definition at line 64 of file ak8975.c.

#define AK8975_REG_CNTL_MODE_SELF_TEST   8

Definition at line 66 of file ak8975.c.

#define AK8975_REG_CNTL_MODE_SHIFT   0

Definition at line 62 of file ak8975.c.

#define AK8975_REG_HXH   0x04

Definition at line 49 of file ak8975.c.

#define AK8975_REG_HXL   0x03

Definition at line 48 of file ak8975.c.

#define AK8975_REG_HYH   0x06

Definition at line 51 of file ak8975.c.

#define AK8975_REG_HYL   0x05

Definition at line 50 of file ak8975.c.

#define AK8975_REG_HZH   0x08

Definition at line 53 of file ak8975.c.

#define AK8975_REG_HZL   0x07

Definition at line 52 of file ak8975.c.

#define AK8975_REG_I2CDIS   0x0F

Definition at line 73 of file ak8975.c.

#define AK8975_REG_INFO   0x01

Definition at line 42 of file ak8975.c.

#define AK8975_REG_RSVC   0x0B

Definition at line 69 of file ak8975.c.

#define AK8975_REG_ST1   0x02

Definition at line 44 of file ak8975.c.

#define AK8975_REG_ST1_DRDY_MASK   (1 << AK8975_REG_ST1_DRDY_SHIFT)

Definition at line 46 of file ak8975.c.

#define AK8975_REG_ST1_DRDY_SHIFT   0

Definition at line 45 of file ak8975.c.

#define AK8975_REG_ST2   0x09

Definition at line 54 of file ak8975.c.

#define AK8975_REG_ST2_DERR_MASK   (1 << AK8975_REG_ST2_DERR_SHIFT)

Definition at line 56 of file ak8975.c.

#define AK8975_REG_ST2_DERR_SHIFT   2

Definition at line 55 of file ak8975.c.

#define AK8975_REG_ST2_HOFL_MASK   (1 << AK8975_REG_ST2_HOFL_SHIFT)

Definition at line 59 of file ak8975.c.

#define AK8975_REG_ST2_HOFL_SHIFT   3

Definition at line 58 of file ak8975.c.

#define AK8975_REG_TS1   0x0D

Definition at line 71 of file ak8975.c.

#define AK8975_REG_TS2   0x0E

Definition at line 72 of file ak8975.c.

#define AK8975_REG_WIA   0x00

Definition at line 39 of file ak8975.c.

Function Documentation

MODULE_AUTHOR ( "Laxman Dewangan <[email protected]>"  )
MODULE_DESCRIPTION ( "AK8975 magnetometer driver )
MODULE_DEVICE_TABLE ( i2c  ,
ak8975_id   
)
MODULE_DEVICE_TABLE ( of  ,
ak8975_of_match   
)
module_i2c_driver ( ak8975_driver  )
MODULE_LICENSE ( "GPL"  )