/* drivers/input/sensors/lsensor/cm3218.c
*
- Copyright © 2012-2016 ROCKCHIP.
- QQ:712288614 >
- This software is licensed under the terms of the GNU General Public
- License version 2, as published by the Free Software Foundation, and
- may be copied, distributed, and modified under those terms.
- 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.
*/
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/irq.h>
#include <linux/miscdevice.h>
#include <linux/gpio.h>
#include <linux/uaccess.h>
#include <linux/atomic.h>
#include <linux/delay.h>
#include <linux/input.h>
#include <linux/workqueue.h>
#include <linux/freezer.h>
#include <linux/of_gpio.h>
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
#include <linux/sensor-dev.h>
#define LENSFACTOR 1000
/* SMBus ARA Address */
#define CM3218_ADDR_ARA 0x0C
/* CM3218 CMD Registers */
#define CM3218_REG_ADDR_CMD 0x00
#define CM3218_CMD_ALS_SD 0x0001
#define CM3218_CMD_ALS_INT_EN 0x0002
#define CM3218_CMD_ALS_INT_DISABLE 0x0000
#define CM3218_CMD_ALS_IT_SHIFT 6
#define CM3218_CMD_ALS_IT_MASK (3 << CM3218_CMD_ALS_IT_SHIFT)
#define CM3218_CMD_ALS_IT_05T (0 << CM3218_CMD_ALS_IT_SHIFT)
#define CM3218_CMD_ALS_IT_1T (1 << CM3218_CMD_ALS_IT_SHIFT)
#define CM3218_CMD_ALS_IT_2T (2 << CM3218_CMD_ALS_IT_SHIFT)
#define CM3218_CMD_ALS_IT_4T (3 << CM3218_CMD_ALS_IT_SHIFT)
#define CM3218_DEFAULT_CMD (CM3218_CMD_ALS_IT_1T)
#define CM3218_ALS_PERS 0x0020
#define CM3218_REG_ADDR_ALS_WH 0x01
#define CM3218_DEFAULT_ALS_WH 0x000C
#define CM3218_REG_ADDR_ALS_WL 0x02
#define CM3218_DEFAULT_ALS_WL 0x000A
#define CM3218_REG_ADDR_ALS 0x04
#define CM3218_REG_ADDR_STATUS 0x06
#define CM3218_REG_ADDR_ID 0x07</

最低0.47元/天 解锁文章
3867

被折叠的 条评论
为什么被折叠?



