diff options
Diffstat (limited to 'include/linux/sensor')
| -rw-r--r-- | include/linux/sensor/ak8975.h | 73 | ||||
| -rw-r--r-- | include/linux/sensor/bh1721.h | 28 | ||||
| -rw-r--r-- | include/linux/sensor/cm3663.h | 31 | ||||
| -rw-r--r-- | include/linux/sensor/cm36651.h | 11 | ||||
| -rw-r--r-- | include/linux/sensor/gp2a.h | 68 | ||||
| -rw-r--r-- | include/linux/sensor/gp2a_analog.h | 33 | ||||
| -rw-r--r-- | include/linux/sensor/k3dh.h | 41 | ||||
| -rw-r--r-- | include/linux/sensor/k3g.h | 40 | ||||
| -rw-r--r-- | include/linux/sensor/lps331ap.h | 84 | ||||
| -rw-r--r-- | include/linux/sensor/lsm330dlc_accel.h | 185 | ||||
| -rw-r--r-- | include/linux/sensor/lsm330dlc_gyro.h | 30 | ||||
| -rw-r--r-- | include/linux/sensor/pas2m110.h | 31 | ||||
| -rw-r--r-- | include/linux/sensor/sensors_core.h | 25 | ||||
| -rw-r--r-- | include/linux/sensor/taos.h | 146 |
14 files changed, 826 insertions, 0 deletions
diff --git a/include/linux/sensor/ak8975.h b/include/linux/sensor/ak8975.h new file mode 100644 index 00000000000..79a5de4ea6b --- /dev/null +++ b/include/linux/sensor/ak8975.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Samsung Electronics. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +#ifndef AKM8975_H +#define AKM8975_H + +#include <linux/ioctl.h> + +#define AKM8975_I2C_NAME "ak8975" + +/* Rx buffer size, i.e from ST1 to ST2 */ +#define SENSOR_DATA_SIZE 8 +#define AKMIO 0xA1 + +/* IOCTLs for AKM library */ +/* WRITE and READ sizes don't include data. On WRITE, the first value is data + * size plus one and the second value is the register address. On READ + * the first value is the data size and second value is the register + * address and the data is written back into the buffer starting at + * the second byte (the length is unchanged). + */ +#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char*) +#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char*) +#define ECS_IOCTL_RESET _IO(AKMIO, 0x03) +#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short) +#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, \ + char[SENSOR_DATA_SIZE]) +#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12]) +#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int) +#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int) +#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, int64_t) +#define ECS_IOCTL_GET_PROJECT_NAME _IOR(AKMIO, 0x0D, char[64]) +#define ECS_IOCTL_GET_MATRIX _IOR(AKMIO, 0x0E, short[4][3][3]) + +/* IOCTLs for APPs */ +#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short) +#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short) +#define ECS_IOCTL_APP_GET_MFLAG _IOR(AKMIO, 0x12, short) +#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short) +#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short) +#define ECS_IOCTL_APP_SET_TFLAG _IOW(AKMIO, 0x15, short) +#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short) +#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17) +#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, int64_t) +#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY + +/* Set raw magnetic vector flag */ +#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short) + +/* Get raw magnetic vector flag */ +#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short) + +#ifdef __KERNEL__ +struct akm8975_platform_data { + int gpio_data_ready_int; +}; +#endif + +#endif diff --git a/include/linux/sensor/bh1721.h b/include/linux/sensor/bh1721.h new file mode 100644 index 00000000000..d7a684ef35f --- /dev/null +++ b/include/linux/sensor/bh1721.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2010 Samsung Electronics. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +#ifndef _BH1721FVC_H_ +#define _BH1721FVC_H_ + +#include <linux/types.h> + +struct bh1721fvc_platform_data { + int (*reset)(void); + int (*output)(int); +}; + +#endif diff --git a/include/linux/sensor/cm3663.h b/include/linux/sensor/cm3663.h new file mode 100644 index 00000000000..07cf3c7edca --- /dev/null +++ b/include/linux/sensor/cm3663.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2010 Samsung Electronics. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + + +#ifndef __LINUX_CM3663_H +#define __LINUX_CM3663_H + +#include <linux/types.h> + +#ifdef __KERNEL__ +struct cm3663_platform_data { + int (*proximity_power)(bool); /* ldo power for the proximity */ +}; +#endif /* __KERNEL__ */ + +#endif diff --git a/include/linux/sensor/cm36651.h b/include/linux/sensor/cm36651.h new file mode 100644 index 00000000000..3dce9acc038 --- /dev/null +++ b/include/linux/sensor/cm36651.h @@ -0,0 +1,11 @@ +#ifndef __LINUX_CM36651_H +#define __CM36651_H__ + +#ifdef __KERNEL__ +struct cm36651_platform_data { + int (*cm36651_led_on) (bool); + u8 (*cm36651_get_threshold)(void); + int irq; /* proximity-sensor irq gpio */ +}; +#endif +#endif diff --git a/include/linux/sensor/gp2a.h b/include/linux/sensor/gp2a.h new file mode 100644 index 00000000000..79002030190 --- /dev/null +++ b/include/linux/sensor/gp2a.h @@ -0,0 +1,68 @@ +#ifndef __GP2A_H__ +#define __GP2A_H__ + +#define I2C_M_WR 0 /* for i2c Write */ +#define I2c_M_RD 1 /* for i2c Read */ + +#define I2C_DF_NOTIFY 0x01 /* for i2c */ + +/* Registers */ +#define COMMAND1 0x00 +#define COMMAND2 0x01 /* Read&Write */ +#define COMMAND3 0x02 /* Read&Write */ +#define COMMAND4 0x03 /* Read&Write */ +#define INT_LT_LSB 0x04 /* Read&Write */ +#define INT_LT_MSB 0x05 /* Read&Write */ +#define INT_HT_LSB 0x06 /* Read&Write */ +#define INT_HT_MSB 0x07 /* Read&Write */ +#define PS_LT_LSB 0x08 /* Read&Write */ +#define PS_LT_MSB 0x09 /* Read&Write */ +#define PS_HT_LSB 0x0A /* Read&Write */ +#define PS_HT_MSB 0x0B /* Read&Write */ +#define DATA0_LSB 0x0C /* Read Only */ +#define DATA0_MSB 0x0D /* Read Only */ +#define DATA1_LSB 0x0E /* Read Only */ +#define DATA1_MSB 0x0F /* Read Only */ +#define DATA2_LSB 0x10 /* Read Only */ +#define DATA2_MSB 0x11 /* Read Only */ + +#define ADC_BUFFER_NUM 6 + +/* 16 level for premium model*/ +enum { + LIGHT_DIM = 0, + LIGHT_LEVEL1 = 1, + LIGHT_LEVEL2 = 2, + LIGHT_LEVEL3 = 3, + LIGHT_LEVEL4 = 4, + LIGHT_LEVEL5 = 5, + LIGHT_LEVEL6 = 6, + LIGHT_LEVEL7 = 7, + LIGHT_LEVEL8 = 8, + LIGHT_LEVEL9 = 9, + LIGHT_LEVEL10 = 10, + LIGHT_LEVEL11 = 11, + LIGHT_LEVEL12 = 12, + LIGHT_LEVEL13 = 13, + LIGHT_LEVEL14 = 14, + LIGHT_LEVEL15 = 15, + LIGHT_LEVEL16 = 16, + LIGHT_INIT = 17, +}; + +/* extern variables */ +extern u8 lightsensor_mode; /* 0 = low, 1 = high */ +extern int proximity_enable; +extern char proximity_sensor_detection; + +/* prototype */ +int opt_i2c_read(u8 reg, unsigned char *rbuf, int len); +int opt_i2c_write(u8 reg, u8 *val); +int lightsensor_get_adcvalue(void); +int is_gp2a030a(void); + +struct gp2a_platform_data { + int (*gp2a_led_on) (bool); + int p_out; /* proximity-sensor-output gpio */ +}; +#endif diff --git a/include/linux/sensor/gp2a_analog.h b/include/linux/sensor/gp2a_analog.h new file mode 100644 index 00000000000..3d038bcbca1 --- /dev/null +++ b/include/linux/sensor/gp2a_analog.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2010 Samsung Electronics. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + + +#ifndef __LINUX_GP2A_H +#define __LINUX_GP2A_H + +#include <linux/types.h> + +#ifdef __KERNEL__ +#define GP2A_OPT "gp2a-opt" +struct gp2a_platform_data { + int p_out; /* proximity-sensor-output gpio */ + int (*power)(bool); /* power to the chip */ +}; +#endif /* __KERNEL__ */ + +#endif diff --git a/include/linux/sensor/k3dh.h b/include/linux/sensor/k3dh.h new file mode 100644 index 00000000000..2c2ad0ddc3c --- /dev/null +++ b/include/linux/sensor/k3dh.h @@ -0,0 +1,41 @@ +/* + * STMicroelectronics k3dh acceleration sensor driver + * + * Copyright (C) 2010 Samsung Electronics Co.Ltd + * + * 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. + */ + +#ifndef __K3DH_ACC_HEADER__ +#define __K3DH__ACC_HEADER__ + +#include <linux/types.h> +#include <linux/ioctl.h> + +extern struct class *sec_class; + +struct k3dh_acceldata { + __s16 x; + __s16 y; + __s16 z; +}; + +/* dev info */ +#define ACC_DEV_NAME "accelerometer" + +/* k3dh ioctl command label */ +#define K3DH_IOCTL_BASE 'a' +#define K3DH_IOCTL_SET_DELAY _IOW(K3DH_IOCTL_BASE, 0, int64_t) +#define K3DH_IOCTL_GET_DELAY _IOR(K3DH_IOCTL_BASE, 1, int64_t) +#define K3DH_IOCTL_READ_ACCEL_XYZ _IOR(K3DH_IOCTL_BASE, 8, \ + struct k3dh_acceldata) +#define K3DH_IOCTL_SET_ENABLE _IOW(K3DH_IOCTL_BASE, 9, int) +#endif diff --git a/include/linux/sensor/k3g.h b/include/linux/sensor/k3g.h new file mode 100644 index 00000000000..66eb2c94f69 --- /dev/null +++ b/include/linux/sensor/k3g.h @@ -0,0 +1,40 @@ +/* + * STMicroelectronics K3G gyro sensor header file + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * THE PRESENT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, FOR THE SOLE + * PURPOSE TO SUPPORT YOUR APPLICATION DEVELOPMENT. + * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, + * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE + * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING + * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. + * + * THIS SOFTWARE IS SPECIFICALLY DESIGNED FOR EXCLUSIVE USE WITH ST PARTS. + * + */ + +#ifndef __K3G_H__ +#define __K3G_H__ + +#ifdef __KERNEL__ +struct k3g_platform_data { + u8 fs_range; + u8 axis_map_x; + u8 axis_map_y; + u8 axis_map_z; + u8 negate_x; + u8 negate_y; + u8 negate_z; + int (*init)(void); + void (*exit)(void); + int (*power_on)(void); + int (*power_off)(void); +}; + +#endif /* __KERNEL__ */ + +#endif /* __K3G_H__ */ diff --git a/include/linux/sensor/lps331ap.h b/include/linux/sensor/lps331ap.h new file mode 100644 index 00000000000..6ecae615458 --- /dev/null +++ b/include/linux/sensor/lps331ap.h @@ -0,0 +1,84 @@ +/* +* linux/sensor/lps331ap.h +* +* STMicroelectronics LPS331AP Pressure / Temperature Sensor module driver +* +* Copyright (C) 2010 STMicroelectronics- MSH - Motion Mems BU - Application Team +* Matteo Dameno (matteo.dameno@st.com) +* Carmine Iascone (carmine.iascone@st.com) +* +* Both authors are willing to be considered the contact and update points for +* the driver. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +* 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., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +* +*/ +/****************************************************************************** + Revision 1.0.0 2011/Feb/14: + first release + moved to input/misc + Revision 1.0.1 2011/Apr/04: + xxx + Revision 1.0.2 2011/Sep/15: + corrects ord bug, forces BDU enable + Revision 1.0.3 2011/Sep/15: + introduces compansation params reading and sysfs file to get them + Revision 1.0.4 2011/Dec/12: + sets maximum allowable resolution modes dynamically with ODR; + Revision 1.0.5 2012/Feb/29: + introduces more compansation params and extends sysfs file content + format to get them; reduces minimum polling period define; + Revision 1.0.6 2012/Mar/30: + introduces one more compansation param and extends sysfs file content + format to get it. +******************************************************************************/ + +#ifndef __LPS331AP_H__ +#define __LPS331AP_H__ + +#define LPS331AP_PRS_MIN_POLL_PERIOD_MS 40 + +#define SAD0L 0x00 +#define SAD0H 0x01 +#define LPS331AP_PRS_I2C_SADROOT 0x2E +#define LPS331AP_PRS_I2C_SAD_L ((LPS331AP_PRS_I2C_SADROOT<<1)|SAD0L) +#define LPS331AP_PRS_I2C_SAD_H ((LPS331AP_PRS_I2C_SADROOT<<1)|SAD0H) +#define LPS331AP_PRS_DEV_NAME "lps331ap" + +/* Barometer and Termometer output data rate ODR */ +#define LPS331AP_PRS_ODR_ONESH 0x00 /* one shot both */ +#define LPS331AP_PRS_ODR_1_1 0x10 /* 1 Hz baro, 1 Hz term ODR */ +#define LPS331AP_PRS_ODR_7_7 0x50 /* 7 Hz baro, 7 Hz term ODR */ +#define LPS331AP_PRS_ODR_12_12 0x60 /* 12.5Hz baro, 12.5Hz term ODR */ +#define LPS331AP_PRS_ODR_25_25 0x70 /* 25 Hz baro, 25 Hz term ODR */ + +/* Pressure section defines */ +/* Pressure Sensor Operating Mode */ +#define LPS331AP_PRS_ENABLE 0x01 +#define LPS331AP_PRS_DISABLE 0x00 + +/* Output conversion factors */ +#define SENSITIVITY_T 480 /* = 480 LSB/degrC */ +#define SENSITIVITY_P 4096 /* = LSB/mbar */ +#define SENSITIVITY_P_SHIFT 12 /* = 4096 LSB/mbar */ +#define TEMPERATURE_OFFSET 42.5f /* = 42.5 degrC */ + +#ifdef __KERNEL__ +struct lps331ap_platform_data { + int irq; +}; +#endif /* __KERNEL__ */ + +#endif /* __LPS331AP_H__ */ diff --git a/include/linux/sensor/lsm330dlc_accel.h b/include/linux/sensor/lsm330dlc_accel.h new file mode 100644 index 00000000000..b011f84e51a --- /dev/null +++ b/include/linux/sensor/lsm330dlc_accel.h @@ -0,0 +1,185 @@ +/* + * Copyright (C) 2011, Samsung Electronics Co. Ltd. All Rights Reserved. + * + * 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. + * + */ + +#ifndef __LSM330DLC_ACCEL_HEADER__ +#define __LSM330DLC_ACCEL_HEADER__ + +#include <linux/types.h> +#include <linux/ioctl.h> + +/*lsm330dlc_accel registers */ +#define STATUS_AUX 0x07 +#define OUT_1_L 0x08 +#define OUT_1_H 0x09 +#define OUT_2_L 0x0A +#define OUT_2_H 0x0B +#define OUT_3_L 0x0C +#define OUT_3_H 0x0D +#define INT_COUNTER 0x0E +#define WHO_AM_I 0x0F +#define TEMP_CFG_REG 0x1F +#define CTRL_REG1 0x20 /* power control reg */ +#define CTRL_REG2 0x21 /* power control reg */ +#define CTRL_REG3 0x22 /* power control reg */ +#define CTRL_REG4 0x23 /* interrupt control reg */ +#define CTRL_REG5 0x24 /* interrupt control reg */ +#define CTRL_REG6 0x25 +#define REFERENCE 0x26 +#define STATUS_REG 0x27 +#define OUT_X_L 0x28 +#define OUT_X_H 0x29 +#define OUT_Y_L 0x2A +#define OUT_Y_H 0x2B +#define OUT_Z_L 0x2C +#define OUT_Z_H 0x2D +#define FIFO_CTRL_REG 0x2E +#define FIFO_SRC_REG 0x2F +#define INT1_CFG 0x30 +#define INT1_SRC 0x31 +#define INT1_THS 0x32 +#define INT1_DURATION 0x33 +#define INT2_CFG 0x34 +#define INT2_SRC 0x35 +#define INT2_THS 0x36 +#define INT2_DURATION 0x37 +#define CLICK_CFG 0x38 +#define CLICK_SRC 0x39 +#define CLICK_THS 0x3A +#define TIME_LIMIT 0x3B +#define TIME_LATENCY 0x3C +#define TIME_WINDOW 0x3D + +/* CTRL_REG1 */ +#define CTRL_REG1_ODR3 (1 << 7) +#define CTRL_REG1_ODR2 (1 << 6) +#define CTRL_REG1_ODR1 (1 << 5) +#define CTRL_REG1_ODR0 (1 << 4) +#define CTRL_REG1_LPEN (1 << 3) +#define CTRL_REG1_Zen (1 << 2) +#define CTRL_REG1_Yen (1 << 1) +#define CTRL_REG1_Xen (1 << 0) + +#define PM_OFF 0x00 +#define LOW_PWR_MODE 0x4F /* 50HZ */ +#define FASTEST_MODE 0x9F /* 1344Hz */ +#define ENABLE_ALL_AXES 0x07 + +#define ODR1 0x10 /* 1Hz output data rate */ +#define ODR10 0x20 /* 10Hz output data rate */ +#define ODR25 0x30 /* 25Hz output data rate */ +#define ODR50 0x40 /* 50Hz output data rate */ +#define ODR100 0x50 /* 100Hz output data rate */ +#define ODR200 0x60 /* 100Hz output data rate */ +#define ODR400 0x70 /* 400Hz output data rate */ +#define ODR1344 0x90 /* 1344Hz output data rate */ +#define ODR_MASK 0xf0 + +/* CTRL_REG2 */ +#define CTRL_REG2_HPM1 (1 << 7) +#define CTRL_REG2_HPM0 (1 << 6) +#define CTRL_REG2_HPCF2 (1 << 5) +#define CTRL_REG2_HPCF1 (1 << 4) +#define CTRL_REG2_FDS (1 << 3) +#define CTRL_REG2_HPPCLICK (1 << 2) +#define CTRL_REG2_HPIS2 (1 << 1) +#define CTRL_REG2_HPIS1 (1 << 0) + +#define HPM_Normal (CTRL_REG2_HPM1) +#define HPM_Filter (CTRL_REG2_HPM0) + +/* CTRL_REG3 */ +#define I1_CLICK (1 << 7) +#define I1_AOI1 (1 << 6) +#define I1_AOI2 (1 << 5) +#define I1_DRDY1 (1 << 4) +#define I1_DRDY2 (1 << 3) +#define I1_WTM (1 << 2) +#define I1_OVERRUN (1 << 1) + +/* CTRL_REG4 */ +#define CTRL_REG4_BLE (1 << 6) +#define CTRL_REG4_FS1 (1 << 5) +#define CTRL_REG4_FS0 (1 << 4) +#define CTRL_REG4_HR (1 << 3) +#define CTRL_REG4_ST1 (1 << 2) +#define CTRL_REG4_ST0 (1 << 1) +#define CTRL_REG4_SIM (1 << 0) + +#define FS2g 0x00 +#define FS4g (CTRL_REG4_FS0) +#define FS8g (CTRL_REG4_FS1) +#define FS16g (CTRL_REG4_FS1|CTRL_REG4_FS0) + +/* CTRL_REG5 */ +#define BOOT (1 << 7) +#define FIFO_EN (1 << 6) +#define LIR_INT1 (1 << 3) +#define D4D_INT1 (1 << 2) + +/* STATUS_REG */ +#define ZYXOR (1 << 7) +#define ZOR (1 << 6) +#define YOR (1 << 5) +#define XOR (1 << 4) +#define ZYXDA (1 << 3) +#define ZDA (1 << 2) +#define YDA (1 << 1) +#define XDA (1 << 0) + +/* INT1_CFG */ +#define INT_CFG_AOI (1 << 7) +#define INT_CFG_6D (1 << 6) +#define INT_CFG_ZHIE (1 << 5) +#define INT_CFG_ZLIE (1 << 4) +#define INT_CFG_YHIE (1 << 3) +#define INT_CFG_YLIE (1 << 2) +#define INT_CFG_XHIE (1 << 1) +#define INT_CFG_XLIE (1 << 0) + +/* INT1_SRC */ +#define IA (1 << 6) +#define ZH (1 << 5) +#define ZL (1 << 4) +#define YH (1 << 3) +#define YL (1 << 2) +#define XH (1 << 1) +#define XL (1 << 0) + +/* Register Auto-increase */ +#define AC (1 << 7) + +/* dev info */ +#define ACC_DEV_NAME "accelerometer" + +struct lsm330dlc_acc { + s16 x; + s16 y; + s16 z; +}; + +/* For movement recognition*/ +#define USES_MOVEMENT_RECOGNITION + +/* LSM330DLC_ACCEL ioctl command label */ +#define LSM330DLC_ACCEL_IOCTL_BASE 'a' +#define LSM330DLC_ACCEL_IOCTL_SET_DELAY \ + _IOW(LSM330DLC_ACCEL_IOCTL_BASE, 0, int64_t) +#define LSM330DLC_ACCEL_IOCTL_GET_DELAY \ + _IOR(LSM330DLC_ACCEL_IOCTL_BASE, 1, int64_t) +#define LSM330DLC_ACCEL_IOCTL_READ_XYZ\ + _IOR(LSM330DLC_ACCEL_IOCTL_BASE, 8, struct lsm330dlc_acc) +#define LSM330DLC_ACCEL_IOCTL_SET_ENABLE \ + _IOW(LSM330DLC_ACCEL_IOCTL_BASE, 9, int) +#endif diff --git a/include/linux/sensor/lsm330dlc_gyro.h b/include/linux/sensor/lsm330dlc_gyro.h new file mode 100644 index 00000000000..12a702c1695 --- /dev/null +++ b/include/linux/sensor/lsm330dlc_gyro.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2011, Samsung Electronics Co. Ltd. All Rights Reserved. + * + * 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. + * + */ + +#ifndef __L3GD20_H__ +#define __L3GD20_H__ + +#define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" +#define L3GD20_GYR_INPUT_NAME "gyro_sensor" +#define GYR_DEV_FILE_NAME "lsm330dlc_gyro_misc" + +#define LSM330DLC_GYRO_IOCTL_BASE 80 +#define LSM330DLC_GYRO_IOCTL_SET_DELAY\ + _IOW(LSM330DLC_GYRO_IOCTL_BASE, 0, int64_t) +#define LSM330DLC_GYRO_IOCTL_GET_DELAY\ + _IOR(LSM330DLC_GYRO_IOCTL_BASE, 1, int64_t) +#define LSM330DLC_GYRO_IOCTL_READ_DATA_XYZ\ + _IOR(LSM330DLC_GYRO_IOCTL_BASE, 2, int) +#endif /* __L3GD20_H__ */ diff --git a/include/linux/sensor/pas2m110.h b/include/linux/sensor/pas2m110.h new file mode 100644 index 00000000000..705d909c8cf --- /dev/null +++ b/include/linux/sensor/pas2m110.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2010 Samsung Electronics. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + + +#ifndef __LINUX_PAS2M110_H +#define __LINUX_PAS2M110_H + +#include <linux/types.h> + +#ifdef __KERNEL__ +struct pas2m110_platform_data { + int (*proximity_power)(bool); /* ldo power for the proximity */ +}; +#endif /* __KERNEL__ */ + +#endif diff --git a/include/linux/sensor/sensors_core.h b/include/linux/sensor/sensors_core.h new file mode 100644 index 00000000000..ef90dd98aed --- /dev/null +++ b/include/linux/sensor/sensors_core.h @@ -0,0 +1,25 @@ +/* + * Driver model for sensor + * + * Copyright (C) 2008 Samsung Electronics + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ +#ifndef __LINUX_SENSORS_CORE_H_INCLUDED +#define __LINUX_SENSORS_CORE_H_INCLUDED + +extern struct device *sensors_classdev_register(char *sensors_name); +extern void sensors_classdev_unregister(struct device *dev); + +struct accel_platform_data { + int (*accel_get_position) (void); + /* Change axis or not for user-level + * If it is true, driver reports adjusted axis-raw-data + * to user-space based on accel_get_position() value, + * or if it is false, driver reports original axis-raw-data */ + bool axis_adjust; +}; +#endif /* __LINUX_SENSORS_CORE_H_INCLUDED */ diff --git a/include/linux/sensor/taos.h b/include/linux/sensor/taos.h new file mode 100644 index 00000000000..a48876ea6a5 --- /dev/null +++ b/include/linux/sensor/taos.h @@ -0,0 +1,146 @@ +#ifndef __TAOS_H__ +#define __TAOS_H__ + + +/* i2c */ +#define I2C_M_WR 0 /* for i2c */ +#define I2c_M_RD 1 /* for i2c */ + +/* sensor gpio */ +#define GPIO_SENSE_OUT 27 + + +#define REGS_PROX 0x0 /* Read Only */ +#define REGS_GAIN 0x1 /* Write Only */ +#define REGS_HYS 0x2 /* Write Only */ +#define REGS_CYCLE 0x3 /* Write Only */ +#define REGS_OPMOD 0x4 /* Write Only */ +#define REGS_CON 0x6 /* Write Only */ + +/* sensor type */ +#define TAOS_LIGHT 0 +#define TAOS_PROXIMITY 1 +#define TAOS_ALL 2 + +/* power control */ +#define ON 1 +#define OFF 0 + +/* IOCTL for proximity sensor */ +#define SHARP_TAOSP_IOC_MAGIC 'C' +#define SHARP_TAOSP_OPEN _IO(SHARP_TAOSP_IOC_MAGIC, 1) +#define SHARP_TAOSP_CLOSE _IO(SHARP_TAOSP_IOC_MAGIC, 2) + +/* IOCTL for light sensor */ +#define SHARP_TAOSL_IOC_MAGIC 'L' +#define SHARP_TAOSL_OPEN _IO(SHARP_TAOSL_IOC_MAGIC, 1) +#define SHARP_TAOSL_CLOSE _IO(SHARP_TAOSL_IOC_MAGIC, 2) + +#define MAX_LUX 65535 +/* for proximity adc avg */ +#define PROX_READ_NUM 40 +#define TAOS_PROX_MAX 1023 +#define TAOS_PROX_MIN 0 + +/* input device for proximity sensor */ +#define USE_INPUT_DEVICE 1 /* 0 : No Use, 1: Use */ + +#define USE_INTERRUPT 1 +#define INT_CLEAR 1 /* 0 = by polling, 1 = by interrupt */ + +/* Register value for TMD2771x */ /* hm83.cho 100817 */ +#define ATIME 0xff /* 2.7ms - minimum ALS intergration time */ +#define WTIME 0xff /* 2.7ms - minimum Wait time */ +#define PTIME 0xff /* 2.7ms - minimum Prox integration time */ +#define PPCOUNT 1 +#define PIEN 0x20 /* Enable Prox interrupt */ +#define WEN 0x8 /* Enable Wait */ +#define PEN 0x4 /* Enable Prox */ +#define AEN 0x2 /* Enable ALS */ +#define PON 0x1 /* Enable Power on */ +#define PDRIVE 0 +#define PDIODE 0x20 +#define PGAIN 0 +#define AGAIN 0 + +/* TDM2771x*/ +enum taos_light_state { + LIGHT_DIM = 0, + LIGHT_LEVEL1 = 1, + LIGHT_LEVEL2 = 2, + LIGHT_LEVEL3 = 3, + LIGHT_LEVEL4 = 4, + LIGHT_LEVEL5 = 5, + LIGHT_LEVEL6 = 6, + LIGHT_LEVEL7 = 7, + LIGHT_LEVEL8 = 8, + LIGHT_LEVEL9 = 9, + LIGHT_LEVEL10 = 10, + LIGHT_LEVEL11 = 11, + LIGHT_LEVEL12 = 12, + LIGHT_LEVEL13 = 13, + LIGHT_LEVEL14 = 14, + LIGHT_LEVEL15 = 15, + LIGHT_LEVEL16 = 16, + LIGHT_INIT = 17, +}; + +enum taos_als_fops_status { + TAOS_ALS_CLOSED = 0, + TAOS_ALS_OPENED = 1, +}; + +enum taos_prx_fops_status { + TAOS_PRX_CLOSED = 0, + TAOS_PRX_OPENED = 1, +}; + +enum taos_chip_working_status { + TAOS_CHIP_UNKNOWN = 0, + TAOS_CHIP_WORKING = 1, + TAOS_CHIP_SLEEP = 2 +}; + +/* driver data */ +struct taos_data { + struct input_dev *proximity_input_dev; + struct input_dev *light_input_dev; + struct i2c_client *client; + struct input_dev *input_dev; + struct workqueue_struct *taos_wq; + struct workqueue_struct *taos_test_wq; + struct work_struct work_prox; /* for proximity sensor */ + struct work_struct work_light; /* for light_sensor */ + struct work_struct work_ptime; /* for proximity reset */ + struct class *lightsensor_class; + struct class *proximity_class; + struct device *proximity_dev; + struct device *switch_cmd_dev; + int irq; + struct wake_lock prx_wake_lock; + struct hrtimer timer; + struct hrtimer ptimer; + struct mutex power_lock; + int light_count; + int light_buffer; + int delay; + int avg[3]; + ktime_t light_polling_time; + ktime_t prox_polling_time; + bool light_enable; + bool proximity_enable; + short proximity_value; + + int irdata; /*Ch[1] */ + int cleardata; /*Ch[0] */ + u16 chipID; +/* struct timer_list light_init_timer; */ +/* struct timer_list prox_init_timer; */ +}; + +/* platform data */ +struct taos_platform_data { + int p_out; /* proximity-sensor-output gpio */ +}; + +#endif |
