电源管理 芯片axp20x linux 驱动程序

/*

  • axp20x power button driver.
  • This file is subject to the terms and conditions of the GNU General
  • Public License. See the file “COPYING” in the main directory of this
  • archive for more details.
  • 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/acpi.h>
#include <linux/errno.h>
#include <linux/irq.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/axp20x.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>

#define AXP20X_PEK_STARTUP_MASK (0xc0)
#define AXP20X_PEK_SHUTDOWN_MASK (0x03)

struct axp20x_info {
const struct axp20x_time *startup_time;
unsigned int startup_mask;
const struct axp20x_time *shutdown_time;
unsigned int shutdown_mask;
};

struct axp20x_pek {
struct axp20x_dev *axp20x;
struct input_dev *input;
struct axp20x_info *info;
int irq_dbr;
int irq_dbf;
};

struct axp20x_time {
unsigned int time;
unsigned int idx;
};

static const struct axp20x_time startup_time[] = {
{ .time = 128, .idx = 0 },
{ .time = 1000, .idx = 2 },
{ .time = 3000, .idx = 1 },
{ .time = 2000, .idx = 3 },
};

static const struct axp20x_time axp221_startup_time[] = {
{ .time = 128, .idx = 0 },
{ .time = 1000, .idx = 1 },
{ .time = 2000, .idx = 2 },
{ .time = 3000, .idx = 3 },
};

static const struct axp20x_time shutdown_time[] = {
{ .time = 4000, .idx = 0 },
{ .time = 6000, .idx = 1 },
{ .time = 8000, .idx = 2 },
{ .time = 10000, .idx = 3 },
};

static const struct axp20x_info axp20x_info = {
.startup_time = startup_time,
.startup_mask = AXP20X_PEK_STARTUP_MASK,
.shutdown_time = shutdown_time,
.shutdown_mask = AXP20X_PEK_SHUTDOWN_MASK,
};

static c

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

baidu_37552881

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

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

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

打赏作者

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

抵扣说明:

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

余额充值