光感传感器 芯片cm3218 linux 驱动

/* 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</

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

baidu_37552881

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值