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