Files
kernel-tenderloin-3.0/include/linux/gpio_event.h
Bryan Huntsman d074fa2796 Merge remote-tracking branch 'common/android-3.0' into msm-3.0
* common/android-3.0: (570 commits)
  misc: remove kernel debugger core
  ARM: common: fiq_debugger: dump sysrq directly to console if enabled
  ARM: common: fiq_debugger: add irq context debug functions
  net: wireless: bcmdhd: Call init_ioctl() only if was started properly for WEXT
  net: wireless: bcmdhd: Call init_ioctl() only if was started properly
  net: wireless: bcmdhd: Fix possible memory leak in escan/iscan
  cpufreq: interactive governor: default 20ms timer
  cpufreq: interactive governor: go to intermediate hi speed before max
  cpufreq: interactive governor: scale to max only if at min speed
  cpufreq: interactive governor: apply intermediate load on current speed
  ARM: idle: update idle ticks before call idle end notifier
  input: gpio_input: don't print debounce message unless flag is set
  net: wireless: bcm4329: Skip dhd_bus_stop() if bus is already down
  net: wireless: bcmdhd: Skip dhd_bus_stop() if bus is already down
  net: wireless: bcmdhd: Improve suspend/resume processing
  net: wireless: bcmdhd: Check if FW is Ok for internal FW call
  tcp: Don't nuke connections for the wrong protocol
  ARM: common: fiq_debugger: make uart irq be no_suspend
  net: wireless: Skip connect warning for CONFIG_CFG80211_ALLOW_RECONNECT
  mm: avoid livelock on !__GFP_FS allocations
  ...

Conflicts:
	arch/arm/mm/cache-l2x0.c
	arch/arm/vfp/vfpmodule.c
	drivers/mmc/core/host.c
	kernel/power/wakelock.c
	net/bluetooth/hci_event.c

Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
2011-11-16 13:52:50 -08:00

171 lines
5.3 KiB
C

/* include/linux/gpio_event.h
*
* Copyright (C) 2007 Google, Inc.
*
* 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.
*
*/
#ifndef _LINUX_GPIO_EVENT_H
#define _LINUX_GPIO_EVENT_H
#include <linux/input.h>
struct gpio_event_input_devs {
int count;
struct input_dev *dev[];
};
enum {
GPIO_EVENT_FUNC_UNINIT = 0x0,
GPIO_EVENT_FUNC_INIT = 0x1,
GPIO_EVENT_FUNC_SUSPEND = 0x2,
GPIO_EVENT_FUNC_RESUME = 0x3,
};
struct gpio_event_info {
int (*func)(struct gpio_event_input_devs *input_devs,
struct gpio_event_info *info,
void **data, int func);
int (*event)(struct gpio_event_input_devs *input_devs,
struct gpio_event_info *info,
void **data, unsigned int dev, unsigned int type,
unsigned int code, int value); /* out events */
bool no_suspend;
};
struct gpio_event_platform_data {
const char *name;
struct gpio_event_info **info;
size_t info_count;
int (*power)(const struct gpio_event_platform_data *pdata, bool on);
const char *names[]; /* If name is NULL, names contain a NULL */
/* terminated list of input devices to create */
};
#define GPIO_EVENT_DEV_NAME "gpio-event"
/* Key matrix */
enum gpio_event_matrix_flags {
/* unset: drive active output low, set: drive active output high */
GPIOKPF_ACTIVE_HIGH = 1U << 0,
GPIOKPF_DEBOUNCE = 1U << 1,
GPIOKPF_REMOVE_SOME_PHANTOM_KEYS = 1U << 2,
GPIOKPF_REMOVE_PHANTOM_KEYS = GPIOKPF_REMOVE_SOME_PHANTOM_KEYS |
GPIOKPF_DEBOUNCE,
GPIOKPF_DRIVE_INACTIVE = 1U << 3,
GPIOKPF_LEVEL_TRIGGERED_IRQ = 1U << 4,
GPIOKPF_PRINT_UNMAPPED_KEYS = 1U << 16,
GPIOKPF_PRINT_MAPPED_KEYS = 1U << 17,
GPIOKPF_PRINT_PHANTOM_KEYS = 1U << 18,
};
#define MATRIX_CODE_BITS (10)
#define MATRIX_KEY_MASK ((1U << MATRIX_CODE_BITS) - 1)
#define MATRIX_KEY(dev, code) \
(((dev) << MATRIX_CODE_BITS) | (code & MATRIX_KEY_MASK))
extern int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs,
struct gpio_event_info *info, void **data, int func);
struct gpio_event_matrix_info {
/* initialize to gpio_event_matrix_func */
struct gpio_event_info info;
/* size must be ninputs * noutputs */
const unsigned short *keymap;
unsigned int *input_gpios;
unsigned int *output_gpios;
unsigned int ninputs;
unsigned int noutputs;
/* time to wait before reading inputs after driving each output */
struct timespec settle_time;
/* time to wait before scanning the keypad a second time */
struct timespec debounce_delay;
struct timespec poll_time;
unsigned flags;
};
/* Directly connected inputs and outputs */
enum gpio_event_direct_flags {
GPIOEDF_ACTIVE_HIGH = 1U << 0,
/* GPIOEDF_USE_DOWN_IRQ = 1U << 1, */
/* GPIOEDF_USE_IRQ = (1U << 2) | GPIOIDF_USE_DOWN_IRQ, */
GPIOEDF_PRINT_KEYS = 1U << 8,
GPIOEDF_PRINT_KEY_DEBOUNCE = 1U << 9,
GPIOEDF_PRINT_KEY_UNSTABLE = 1U << 10,
};
struct gpio_event_direct_entry {
uint32_t gpio:16;
uint32_t code:10;
uint32_t dev:6;
};
/* inputs */
extern int gpio_event_input_func(struct gpio_event_input_devs *input_devs,
struct gpio_event_info *info, void **data, int func);
struct gpio_event_input_info {
/* initialize to gpio_event_input_func */
struct gpio_event_info info;
ktime_t debounce_time;
ktime_t poll_time;
uint16_t flags;
uint16_t type;
const struct gpio_event_direct_entry *keymap;
size_t keymap_size;
};
/* outputs */
extern int gpio_event_output_func(struct gpio_event_input_devs *input_devs,
struct gpio_event_info *info, void **data, int func);
extern int gpio_event_output_event(struct gpio_event_input_devs *input_devs,
struct gpio_event_info *info, void **data,
unsigned int dev, unsigned int type,
unsigned int code, int value);
struct gpio_event_output_info {
/* initialize to gpio_event_output_func and gpio_event_output_event */
struct gpio_event_info info;
uint16_t flags;
uint16_t type;
const struct gpio_event_direct_entry *keymap;
size_t keymap_size;
};
/* axes */
enum gpio_event_axis_flags {
GPIOEAF_PRINT_UNKNOWN_DIRECTION = 1U << 16,
GPIOEAF_PRINT_RAW = 1U << 17,
GPIOEAF_PRINT_EVENT = 1U << 18,
};
extern int gpio_event_axis_func(struct gpio_event_input_devs *input_devs,
struct gpio_event_info *info, void **data, int func);
struct gpio_event_axis_info {
/* initialize to gpio_event_axis_func */
struct gpio_event_info info;
uint8_t count; /* number of gpios for this axis */
uint8_t dev; /* device index when using multiple input devices */
uint8_t type; /* EV_REL or EV_ABS */
uint16_t code;
uint16_t decoded_size;
uint16_t (*map)(struct gpio_event_axis_info *info, uint16_t in);
uint32_t *gpio;
uint32_t flags;
};
#define gpio_axis_2bit_gray_map gpio_axis_4bit_gray_map
#define gpio_axis_3bit_gray_map gpio_axis_4bit_gray_map
uint16_t gpio_axis_4bit_gray_map(
struct gpio_event_axis_info *info, uint16_t in);
uint16_t gpio_axis_5bit_singletrack_map(
struct gpio_event_axis_info *info, uint16_t in);
#endif