aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/mediatek/magnetometer/mmc328x/mmc328x.h
blob: 215b22039d2bcf6184d844ee8f1ea911813d9821 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Definitions for mmc328x magnetic sensor chip.
 */
#ifndef __MMC328x_H__
#define __MMC328x_H__

#include <linux/ioctl.h>

#define MMC328x_I2C_NAME		"mmc328x"
#define CALIBRATION_DATA_SIZE	12


#define MMC328x_I2C_ADDR		0x60

/* MMC328x register address */
#define MMC328x_REG_CTRL		0x07
#define MMC328x_REG_DATA		0x00
#define MMC328x_REG_DS			0x06

/* MMC328x control bit */
#define MMC328x_CTRL_TM			0x01
#define MMC328x_CTRL_RM			0x20



// conversion of magnetic data (for mmc328x) to uT units
// conversion of magnetic data to uT units
// 32768 = 1Guass = 100 uT
// 100 / 32768 = 25 / 8096
// 65536 = 360Degree
// 360 / 65536 = 45 / 8192


#define CONVERT_M			25
#define CONVERT_M_DIV		8096			
#define CONVERT_O			45
#define CONVERT_O_DIV		8192

// sensitivity 512 count = 1 Guass = 100uT

#define MMC328X_OFFSET_X		4096
#define MMC328X_OFFSET_Y		4096
#define MMC328X_OFFSET_Z		4096
#define MMC328X_SENSITIVITY_X		512
#define MMC328X_SENSITIVITY_Y		512
#define MMC328X_SENSITIVITY_Z		512



#endif /* __MMC328x_H__ */