一、头文件:
#ifndef _CW2217_BATTERY_H_
#define _CW2217_BATTERY_H_
#include <linux/i2c.h>
#include <linux/power_supply.h>
#include <linux/workqueue.h>
#include <linux/alarmtimer.h>
#include <linux/regulator/consumer.h>
#define CW2217_REG_VCELL 0x02
#define CW2217_REG_SOC 0x04
#define CW2217_REG_CONFIG 0x08
#define CW2217_REG_MODE 0x0A
#define CW2217_REG_BATINFO 0x10
#define CW2217_REG_VERSION 0x1C
#define CW2217_REG_IC_TEMP 0x1E
#define CW2217_REG_VCELL_H 0x22
#define CW2217_REG_CURRENT_H 0x24
#define CW2217_MODE_SLEEP 0x0000
#define C