aboutsummaryrefslogtreecommitdiff
path: root/include/linux/hwmsen_dev.h
blob: 0fb7e8e0cff0386110fd106e0e0294e1aa08d38a (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* alps
 *
 * (C) Copyright 2009
 * MediaTek <www.MediaTek.com>
 *
 * Sensor devices
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef __HWMSEN_DEV_H__
#define __HWMSEN_DEV_H__

#include <linux/types.h>
#include <linux/hwmsensor.h>


/*define sensor operator type---------------------------------------------------*/
#define SENSOR_DELAY	0X01
#define	SENSOR_ENABLE	0X02
#define	SENSOR_GET_DATA	0X04

/**
 * status of each sensor
 */

#define SENSOR_STATUS_UNRELIABLE        0
#define SENSOR_STATUS_ACCURACY_LOW      1
#define SENSOR_STATUS_ACCURACY_MEDIUM   2
#define SENSOR_STATUS_ACCURACY_HIGH     3

#define GRAVITY_EARTH_1000           9807	/* about (9.80665f)*1000 */


struct hwmsen_object {
	void *self;
	int polling;
	int (*sensor_operate) (void *self, uint32_t command, void *buff_in, int size_in,
			       void *buff_out, int size_out, int *actualout);
};

struct sensor_init_info {
	char *name;
	int (*init) (void);
	int (*uninit) (void);
	struct platform_driver *platform_diver_addr;
};


/*----------------------------------------------------------------------------*/
extern int hwmsen_attach(int sensor, struct hwmsen_object *obj);
extern int hwmsen_detach(int sensor);
extern int hwmsen_get_interrupt_data(int sensor, hwm_sensor_data *data);

//AAL functions
extern int hwmsen_aal_enable(int enable);
extern int hwmsen_aal_get_data(void);
extern int hwmsen_aal_get_status(void);

#if defined(CONFIG_MTK_AUTO_DETECT_ACCELEROMETER)	/*  */
extern int hwmsen_gsensor_add(struct sensor_init_info *obj);
#endif

#if defined(CONFIG_MTK_AUTO_DETECT_MAGNETOMETER)
extern int hwmsen_msensor_add(struct sensor_init_info *obj);
#endif

#if defined(CONFIG_MTK_AUTO_DETECT_ALSPS)
extern int hwmsen_alsps_sensor_add(struct sensor_init_info *obj);
#endif
/*----------------------------------------------------------------------------*/
#endif