Platform: ROCKCHIP
OS: Android 6.0
Kernel: 3.10.92
由于电池部分是用户空间Service从另外一颗MCU获取,而Android需要显示电量,
所以按照电池驱动框架做了一个伪电池驱动, 主要是使用它的充电状态和电池电量
这两个property, 代码如下:
/* drivers/power/rk3288_battery.c
*
* Power supply driver for the rk3288
*
* Copyright (C) 2008 Google, Inc.
* Author: kris.fei<kris_fei@126.com>
*
* 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/module.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/of_irq.h>
#include <linux/of_gpio.h>
#include <linux/of.h>
#include <linux/of_device.h>
//#define DEBUG
struct rk3288_battery_data {
int status;
int health;
int present;
int capacity;
struct power_supply battery;
OS: Android 6.0
Kernel: 3.10.92
由于电池部分是用户空间Service从另外一颗MCU获取,而Android需要显示电量,
所以按照电池驱动框架做了一个伪电池驱动, 主要是使用它的充电状态和电池电量
这两个property, 代码如下:
/* drivers/power/rk3288_battery.c
*
* Power supply driver for the rk3288
*
* Copyright (C) 2008 Google, Inc.
* Author: kris.fei<kris_fei@126.com>
*
* 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/module.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/of_irq.h>
#include <linux/of_gpio.h>
#include <linux/of.h>
#include <linux/of_device.h>
//#define DEBUG
struct rk3288_battery_data {
int status;
int health;
int present;
int capacity;
struct power_supply battery;