Watch
1
Fork
You've already forked kernel_a52xq
0
mirror of https://github.com/a52xq-dev/kernel.git synced 2026-10-18 21:58:11 +07:00

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input subsystem updates from Dmitry Torokhov:
 "You will get the following new drivers:

   - Qualcomm PM8941 power key drver
   - ChipOne icn8318 touchscreen controller driver
   - Broadcom iProc touchscreen and keypad drivers
   - Semtech SX8654 I2C touchscreen controller driver

  ALPS driver now supports newer SS4 devices; Elantech got a fix that
  should make it work on some ASUS laptops; and a slew of other
  enhancements and random fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (51 commits)
  Input: alps - non interleaved V2 dualpoint has separate stick button bits
  Input: alps - fix touchpad buttons getting stuck when used with trackpoint
  Input: atkbd - document "no new force-release quirks" policy
  Input: ALPS - make alps_get_pkt_id_ss4_v2() and others static
  Input: ALPS - V7 devices can report 5-finger taps
  Input: ALPS - add support for SS4 touchpad devices
  Input: ALPS - refactor alps_set_abs_params_mt()
  Input: elantech - fix absolute mode setting on some ASUS laptops
  Input: atmel_mxt_ts - split out touchpad initialisation logic
  Input: atmel_mxt_ts - implement support for T100 touch object
  Input: cros_ec_keyb - fix clearing keyboard state on wakeup
  Input: gscps2 - drop pci_ids dependency
  Input: synaptics - allocate 3 slots to keep stability in image sensors
  Input: Revert "Revert "synaptics - use dmax in input_mt_assign_slots""
  Input: MT - make slot assignment work for overcovered solutions
  mfd: tc3589x: enforce device-tree only mode
  Input: tc3589x - localize platform data
  Input: tsc2007 - Convert msecs to jiffies only once
  Input: edt-ft5x06 - remove EV_SYN event report
  Input: edt-ft5x06 - allow to setting the maximum axes value through the DT
  ...
This commit is contained in:
Linus Torvalds 2015-04-14 18:25:15 -07:00
commit 8691c130fa
59 changed files with 3965 additions and 239 deletions

View file

@ -0,0 +1,108 @@
* Broadcom Keypad Controller device tree bindings
Broadcom Keypad controller is used to interface a SoC with a matrix-type
keypad device. The keypad controller supports multiple row and column lines.
A key can be placed at each intersection of a unique row and a unique column.
The keypad controller can sense a key-press and key-release and report the
event using a interrupt to the cpu.
This binding is based on the matrix-keymap binding with the following
changes:
keypad,num-rows and keypad,num-columns are required.
Required SoC Specific Properties:
- compatible: should be "brcm,bcm-keypad"
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: The interrupt number to the cpu.
Board Specific Properties:
- keypad,num-rows: Number of row lines connected to the keypad
controller.
- keypad,num-columns: Number of column lines connected to the
keypad controller.
- col-debounce-filter-period: The debounce period for the Column filter.
KEYPAD_DEBOUNCE_1_ms = 0
KEYPAD_DEBOUNCE_2_ms = 1
KEYPAD_DEBOUNCE_4_ms = 2
KEYPAD_DEBOUNCE_8_ms = 3
KEYPAD_DEBOUNCE_16_ms = 4
KEYPAD_DEBOUNCE_32_ms = 5
KEYPAD_DEBOUNCE_64_ms = 6
KEYPAD_DEBOUNCE_128_ms = 7
- status-debounce-filter-period: The debounce period for the Status filter.
KEYPAD_DEBOUNCE_1_ms = 0
KEYPAD_DEBOUNCE_2_ms = 1
KEYPAD_DEBOUNCE_4_ms = 2
KEYPAD_DEBOUNCE_8_ms = 3
KEYPAD_DEBOUNCE_16_ms = 4
KEYPAD_DEBOUNCE_32_ms = 5
KEYPAD_DEBOUNCE_64_ms = 6
KEYPAD_DEBOUNCE_128_ms = 7
- row-output-enabled: An optional property indicating whether the row or
column is being used as output. If specified the row is being used
as the output. Else defaults to column.
- pull-up-enabled: An optional property indicating the Keypad scan mode.
If specified implies the keypad scan pull-up has been enabled.
- autorepeat: Boolean, Enable auto repeat feature of Linux input
subsystem (optional).
- linux,keymap: The keymap for keys as described in the binding document
devicetree/bindings/input/matrix-keymap.txt.
Example:
#include "dt-bindings/input/input.h"
/ {
keypad: keypad@180ac000 {
/* Required SoC specific properties */
compatible = "brcm,bcm-keypad";
/* Required Board specific properties */
keypad,num-rows = <5>;
keypad,num-columns = <5>;
status = "okay";
linux,keymap = <MATRIX_KEY(0x00, 0x02, KEY_F) /* key_forward */
MATRIX_KEY(0x00, 0x03, KEY_HOME) /* key_home */
MATRIX_KEY(0x00, 0x04, KEY_M) /* key_message */
MATRIX_KEY(0x01, 0x00, KEY_A) /* key_contacts */
MATRIX_KEY(0x01, 0x01, KEY_1) /* key_1 */
MATRIX_KEY(0x01, 0x02, KEY_2) /* key_2 */
MATRIX_KEY(0x01, 0x03, KEY_3) /* key_3 */
MATRIX_KEY(0x01, 0x04, KEY_S) /* key_speaker */
MATRIX_KEY(0x02, 0x00, KEY_P) /* key_phone */
MATRIX_KEY(0x02, 0x01, KEY_4) /* key_4 */
MATRIX_KEY(0x02, 0x02, KEY_5) /* key_5 */
MATRIX_KEY(0x02, 0x03, KEY_6) /* key_6 */
MATRIX_KEY(0x02, 0x04, KEY_VOLUMEUP) /* key_vol_up */
MATRIX_KEY(0x03, 0x00, KEY_C) /* key_call_log */
MATRIX_KEY(0x03, 0x01, KEY_7) /* key_7 */
MATRIX_KEY(0x03, 0x02, KEY_8) /* key_8 */
MATRIX_KEY(0x03, 0x03, KEY_9) /* key_9 */
MATRIX_KEY(0x03, 0x04, KEY_VOLUMEDOWN) /* key_vol_down */
MATRIX_KEY(0x04, 0x00, KEY_H) /* key_headset */
MATRIX_KEY(0x04, 0x01, KEY_KPASTERISK) /* key_* */
MATRIX_KEY(0x04, 0x02, KEY_0) /* key_0 */
MATRIX_KEY(0x04, 0x03, KEY_GRAVE) /* key_# */
MATRIX_KEY(0x04, 0x04, KEY_MUTE) /* key_mute */
>;
/* Optional board specific properties */
col-debounce-filter-period = <5>;
row-output-enabled;
pull-up-enabled;
};
};

View file

@ -0,0 +1,43 @@
Qualcomm PM8941 PMIC Power Key
PROPERTIES
- compatible:
Usage: required
Value type: <string>
Definition: must be one of:
"qcom,pm8941-pwrkey"
- reg:
Usage: required
Value type: <prop-encoded-array>
Definition: base address of registers for block
- interrupts:
Usage: required
Value type: <prop-encoded-array>
Definition: key change interrupt; The format of the specifier is
defined by the binding document describing the node's
interrupt parent.
- debounce:
Usage: optional
Value type: <u32>
Definition: time in microseconds that key must be pressed or released
for state change interrupt to trigger.
- bias-pull-up:
Usage: optional
Value type: <empty>
Definition: presence of this property indicates that the KPDPWR_N pin
should be configured for pull up.
EXAMPLE
pwrkey@800 {
compatible = "qcom,pm8941-pwrkey";
reg = <0x800>;
interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
debounce = <15625>;
bias-pull-up;
};

View file

@ -0,0 +1,76 @@
* Broadcom's IPROC Touchscreen Controller
Required properties:
- compatible: must be "brcm,iproc-touchscreen"
- reg: physical base address of the controller and length of memory mapped
region.
- clocks: The clock provided by the SOC to driver the tsc
- clock-name: name for the clock
- interrupts: The touchscreen controller's interrupt
Optional properties:
- scanning_period: Time between scans. Each step is 1024 us. Valid 1-256.
- debounce_timeout: Each step is 512 us. Valid 0-255
- settling_timeout: The settling duration (in ms) is the amount of time
the tsc waits to allow the voltage to settle after
turning on the drivers in detection mode.
Valid values: 0-11
0 = 0.008 ms
1 = 0.01 ms
2 = 0.02 ms
3 = 0.04 ms
4 = 0.08 ms
5 = 0.16 ms
6 = 0.32 ms
7 = 0.64 ms
8 = 1.28 ms
9 = 2.56 ms
10 = 5.12 ms
11 = 10.24 ms
- touch_timeout: The continuous number of scan periods in which touch is
not detected before the controller returns to idle state.
Valid values 0-255.
- average_data: Number of data samples which are averaged before a final
data point is placed into the FIFO
Valid values 0-7
0 = 1 sample
1 = 2 samples
2 = 4 samples
3 = 8 samples
4 = 16 samples
5 = 32 samples
6 = 64 samples
7 = 128 samples
- fifo_threshold: Interrupt is generated whenever the number of fifo
entries exceeds this value
Valid values 0-31
- touchscreen-size-x: horizontal resolution of touchscreen (in pixels)
- touchscreen-size-y: vertical resolution of touchscreen (in pixels)
- touchscreen-fuzz-x: horizontal noise value of the absolute input
device (in pixels)
- touchscreen-fuzz-y: vertical noise value of the absolute input
device (in pixels)
- touchscreen-inverted-x: X axis is inverted (boolean)
- touchscreen-inverted-y: Y axis is inverted (boolean)
Example:
touchscreen: tsc@0x180A6000 {
compatible = "brcm,iproc-touchscreen";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x180A6000 0x40>;
clocks = <&adc_clk>;
clock-names = "tsc_clk";
interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
scanning_period = <5>;
debounce_timeout = <40>;
settling_timeout = <7>;
touch_timeout = <10>;
average_data = <5>;
fifo_threshold = <1>;
/* Touchscreen is rotated 180 degrees. */
touchscreen-inverted-x;
touchscreen-inverted-y;
};

View file

@ -0,0 +1,46 @@
* ChipOne icn8318 I2C touchscreen controller
Required properties:
- compatible : "chipone,icn8318"
- reg : I2C slave address of the chip (0x40)
- interrupt-parent : a phandle pointing to the interrupt controller
serving the interrupt for this chip
- interrupts : interrupt specification for the icn8318 interrupt
- wake-gpios : GPIO specification for the WAKE input
- touchscreen-size-x : horizontal resolution of touchscreen (in pixels)
- touchscreen-size-y : vertical resolution of touchscreen (in pixels)
Optional properties:
- pinctrl-names : should be "default"
- pinctrl-0: : a phandle pointing to the pin settings for the
control gpios
- touchscreen-fuzz-x : horizontal noise value of the absolute input
device (in pixels)
- touchscreen-fuzz-y : vertical noise value of the absolute input
device (in pixels)
- touchscreen-inverted-x : X axis is inverted (boolean)
- touchscreen-inverted-y : Y axis is inverted (boolean)
- touchscreen-swapped-x-y : X and Y axis are swapped (boolean)
Swapping is done after inverting the axis
Example:
i2c@00000000 {
/* ... */
chipone_icn8318@40 {
compatible = "chipone,icn8318";
reg = <0x40>;
interrupt-parent = <&pio>;
interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* EINT9 (PG9) */
pinctrl-names = "default";
pinctrl-0 = <&ts_wake_pin_p66>;
wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */
touchscreen-size-x = <800>;
touchscreen-size-y = <480>;
touchscreen-inverted-x;
touchscreen-swapped-x-y;
};
/* ... */
};

View file

@ -0,0 +1,29 @@
Device tree bindings for Goodix GT9xx series touchscreen controller
Required properties:
- compatible : Should be "goodix,gt911"
or "goodix,gt9110"
or "goodix,gt912"
or "goodix,gt927"
or "goodix,gt9271"
or "goodix,gt928"
or "goodix,gt967"
- reg : I2C address of the chip. Should be 0x5d or 0x14
- interrupt-parent : Interrupt controller to which the chip is connected
- interrupts : Interrupt to which the chip is connected
Example:
i2c@00000000 {
/* ... */
gt928@5d {
compatible = "goodix,gt928";
reg = <0x5d>;
interrupt-parent = <&gpio>;
interrupts = <0 0>;
};
/* ... */
};

View file

@ -2,14 +2,27 @@ sun4i resistive touchscreen controller
--------------------------------------
Required properties:
- compatible: "allwinner,sun4i-a10-ts" or "allwinner,sun6i-a31-ts"
- compatible: "allwinner,sun4i-a10-ts", "allwinner,sun5i-a13-ts" or
"allwinner,sun6i-a31-ts"
- reg: mmio address range of the chip
- interrupts: interrupt to which the chip is connected
- #thermal-sensor-cells: shall be 0
Optional properties:
- allwinner,ts-attached: boolean indicating that an actual touchscreen is
attached to the controller
- allwinner,ts-attached : boolean indicating that an actual touchscreen
is attached to the controller
- allwinner,tp-sensitive-adjust : integer (4 bits)
adjust sensitivity of pen down detection
between 0 (least sensitive) and 15
(defaults to 15)
- allwinner,filter-type : integer (2 bits)
select median and averaging filter
samples used for median / averaging filter
0: 4/2
1: 5/3
2: 8/4
3: 16/8
(defaults to 1)
Example:
@ -19,4 +32,7 @@ Example:
interrupts = <29>;
allwinner,ts-attached;
#thermal-sensor-cells = <0>;
/* sensitive/noisy touch panel */
allwinner,tp-sensitive-adjust = <0>;
allwinner,filter-type = <3>;
};

View file

@ -0,0 +1,16 @@
* Semtech SX8654 I2C Touchscreen Controller
Required properties:
- compatible: must be "semtech,sx8654"
- reg: i2c slave address
- interrupt-parent: the phandle for the interrupt controller
- interrupts: touch controller interrupt
Example:
sx8654@48 {
compatible = "semtech,sx8654";
reg = <0x48>;
interrupt-parent = <&gpio6>;
interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
};

View file

@ -16,6 +16,8 @@ Optional properties for Touchscreens:
controller)
- touchscreen-inverted-x : X axis is inverted (boolean)
- touchscreen-inverted-y : Y axis is inverted (boolean)
- touchscreen-swapped-x-y : X and Y axis are swapped (boolean)
Swapping is done after inverting the axis
Deprecated properties for Touchscreens:
- x-size : deprecated name for touchscreen-size-x

View file

@ -37,6 +37,7 @@ capella Capella Microsystems, Inc
cavium Cavium, Inc.
cdns Cadence Design Systems Inc.
chipidea Chipidea, Inc
chipone ChipOne
chipspark ChipSPARK
chrp Common Hardware Reference Platform
chunghwa Chunghwa Picture Tubes Ltd.
@ -78,6 +79,7 @@ geniatech Geniatech, Inc.
giantplus Giantplus Technology Co., Ltd.
globalscale Globalscale Technologies, Inc.
gmt Global Mixed-mode Technology, Inc.
goodix Shenzhen Huiding Technology Co., Ltd.
google Google, Inc.
gumstix Gumstix, Inc.
gw Gateworks Corporation

View file

@ -2525,6 +2525,13 @@ L: linux-usb@vger.kernel.org
S: Maintained
F: drivers/usb/chipidea/
CHIPONE ICN8318 I2C TOUCHSCREEN DRIVER
M: Hans de Goede <hdegoede@redhat.com>
L: linux-input@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/input/touchscreen/chipone_icn8318.txt
F: drivers/input/touchscreen/chipone_icn8318.c
CHROME HARDWARE PLATFORM SUPPORT
M: Olof Johansson <olof@lixom.net>
S: Maintained

View file

@ -815,7 +815,7 @@ static const char *keys[KEY_MAX + 1] = {
[KEY_DELETEFILE] = "DeleteFile", [KEY_XFER] = "X-fer",
[KEY_PROG1] = "Prog1", [KEY_PROG2] = "Prog2",
[KEY_WWW] = "WWW", [KEY_MSDOS] = "MSDOS",
[KEY_COFFEE] = "Coffee", [KEY_DIRECTION] = "Direction",
[KEY_COFFEE] = "Coffee", [KEY_ROTATE_DISPLAY] = "RotateDisplay",
[KEY_CYCLEWINDOWS] = "CycleWindows", [KEY_MAIL] = "Mail",
[KEY_BOOKMARKS] = "Bookmarks", [KEY_COMPUTER] = "Computer",
[KEY_BACK] = "Back", [KEY_FORWARD] = "Forward",

View file

@ -368,27 +368,35 @@ static void input_mt_set_slots(struct input_mt *mt,
int *slots, int num_pos)
{
struct input_mt_slot *s;
int *w = mt->red, *p;
int *w = mt->red, j;
for (p = slots; p != slots + num_pos; p++)
*p = -1;
for (j = 0; j != num_pos; j++)
slots[j] = -1;
for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {
if (!input_mt_is_active(s))
continue;
for (p = slots; p != slots + num_pos; p++)
if (*w++ < 0)
*p = s - mt->slots;
for (j = 0; j != num_pos; j++) {
if (w[j] < 0) {
slots[j] = s - mt->slots;
break;
}
}
w += num_pos;
}
for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {
if (input_mt_is_active(s))
continue;
for (p = slots; p != slots + num_pos; p++)
if (*p < 0) {
*p = s - mt->slots;
for (j = 0; j != num_pos; j++) {
if (slots[j] < 0) {
slots[j] = s - mt->slots;
break;
}
}
}
}

View file

@ -588,6 +588,16 @@ config KEYBOARD_DAVINCI
To compile this driver as a module, choose M here: the
module will be called davinci_keyscan.
config KEYBOARD_IPAQ_MICRO
tristate "Buttons on Micro SoC (iPaq h3100,h3600,h3700)"
depends on MFD_IPAQ_MICRO
help
Say Y to enable support for the buttons attached to
Micro peripheral controller on iPAQ h3100/h3600/h3700
To compile this driver as a module, choose M here: the
module will be called ipaq-micro-keys.
config KEYBOARD_OMAP
tristate "TI OMAP keypad support"
depends on ARCH_OMAP1
@ -686,4 +696,15 @@ config KEYBOARD_CAP11XX
To compile this driver as a module, choose M here: the
module will be called cap11xx.
config KEYBOARD_BCM
tristate "Broadcom keypad driver"
depends on OF && HAVE_CLK
select INPUT_MATRIXKMAP
default ARCH_BCM_CYGNUS
help
Say Y here if you want to use Broadcom keypad.
To compile this driver as a module, choose M here: the
module will be called bcm-keypad.
endif

View file

@ -10,6 +10,7 @@ obj-$(CONFIG_KEYBOARD_ADP5589) += adp5589-keys.o
obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o
obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o
obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o
obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o
obj-$(CONFIG_KEYBOARD_CAP11XX) += cap11xx.o
obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o
@ -23,6 +24,7 @@ obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o
obj-$(CONFIG_KEYBOARD_TCA8418) += tca8418_keypad.o
obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
obj-$(CONFIG_KEYBOARD_IPAQ_MICRO) += ipaq-micro-keys.o
obj-$(CONFIG_KEYBOARD_IMX) += imx_keypad.o
obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o
obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o

View file

@ -1653,6 +1653,12 @@ static int __init atkbd_deactivate_fixup(const struct dmi_system_id *id)
return 1;
}
/*
* NOTE: do not add any more "force release" quirks to this table. The
* task of adjusting list of keys that should be "released" automatically
* by the driver is now delegated to userspace tools, such as udev, so
* submit such quirks there.
*/
static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = {
{
.matches = {

View file

@ -0,0 +1,458 @@
/*
* Copyright (C) 2014 Broadcom Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/gfp.h>
#include <linux/io.h>
#include <linux/input.h>
#include <linux/input/matrix_keypad.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/stddef.h>
#include <linux/types.h>
#define DEFAULT_CLK_HZ 31250
#define MAX_ROWS 8
#define MAX_COLS 8
/* Register/field definitions */
#define KPCR_OFFSET 0x00000080
#define KPCR_MODE 0x00000002
#define KPCR_MODE_SHIFT 1
#define KPCR_MODE_MASK 1
#define KPCR_ENABLE 0x00000001
#define KPCR_STATUSFILTERENABLE 0x00008000
#define KPCR_STATUSFILTERTYPE_SHIFT 12
#define KPCR_COLFILTERENABLE 0x00000800
#define KPCR_COLFILTERTYPE_SHIFT 8
#define KPCR_ROWWIDTH_SHIFT 20
#define KPCR_COLUMNWIDTH_SHIFT 16
#define KPIOR_OFFSET 0x00000084
#define KPIOR_ROWOCONTRL_SHIFT 24
#define KPIOR_ROWOCONTRL_MASK 0xFF000000
#define KPIOR_COLUMNOCONTRL_SHIFT 16
#define KPIOR_COLUMNOCONTRL_MASK 0x00FF0000
#define KPIOR_COLUMN_IO_DATA_SHIFT 0
#define KPEMR0_OFFSET 0x00000090
#define KPEMR1_OFFSET 0x00000094
#define KPEMR2_OFFSET 0x00000098
#define KPEMR3_OFFSET 0x0000009C
#define KPEMR_EDGETYPE_BOTH 3
#define KPSSR0_OFFSET 0x000000A0
#define KPSSR1_OFFSET 0x000000A4
#define KPSSRN_OFFSET(reg_n) (KPSSR0_OFFSET + 4 * (reg_n))
#define KPIMR0_OFFSET 0x000000B0
#define KPIMR1_OFFSET 0x000000B4
#define KPICR0_OFFSET 0x000000B8
#define KPICR1_OFFSET 0x000000BC
#define KPICRN_OFFSET(reg_n) (KPICR0_OFFSET + 4 * (reg_n))
#define KPISR0_OFFSET 0x000000C0
#define KPISR1_OFFSET 0x000000C4
#define KPCR_STATUSFILTERTYPE_MAX 7
#define KPCR_COLFILTERTYPE_MAX 7
/* Macros to determine the row/column from a bit that is set in SSR0/1. */
#define BIT_TO_ROW_SSRN(bit_nr, reg_n) (((bit_nr) >> 3) + 4 * (reg_n))
#define BIT_TO_COL(bit_nr) ((bit_nr) % 8)
/* Structure representing various run-time entities */
struct bcm_kp {
void __iomem *base;
int irq;
struct clk *clk;
struct input_dev *input_dev;
unsigned long last_state[2];
unsigned int n_rows;
unsigned int n_cols;
u32 kpcr;
u32 kpior;
u32 kpemr;
u32 imr0_val;
u32 imr1_val;
};
/*
* Returns the keycode from the input device keymap given the row and
* column.
*/
static int bcm_kp_get_keycode(struct bcm_kp *kp, int row, int col)
{
unsigned int row_shift = get_count_order(kp->n_cols);
unsigned short *keymap = kp->input_dev->keycode;
return keymap[MATRIX_SCAN_CODE(row, col, row_shift)];
}
static void bcm_kp_report_keys(struct bcm_kp *kp, int reg_num, int pull_mode)
{
unsigned long state, change;
int bit_nr;
int key_press;
int row, col;
unsigned int keycode;
/* Clear interrupts */
writel(0xFFFFFFFF, kp->base + KPICRN_OFFSET(reg_num));
state = readl(kp->base + KPSSRN_OFFSET(reg_num));
change = kp->last_state[reg_num] ^ state;
kp->last_state[reg_num] = state;
for_each_set_bit(bit_nr, &change, BITS_PER_LONG) {
key_press = state & BIT(bit_nr);
/* The meaning of SSR register depends on pull mode. */
key_press = pull_mode ? !key_press : key_press;
row = BIT_TO_ROW_SSRN(bit_nr, reg_num);
col = BIT_TO_COL(bit_nr);
keycode = bcm_kp_get_keycode(kp, row, col);
input_report_key(kp->input_dev, keycode, key_press);
}
}
static irqreturn_t bcm_kp_isr_thread(int irq, void *dev_id)
{
struct bcm_kp *kp = dev_id;
int pull_mode = (kp->kpcr >> KPCR_MODE_SHIFT) & KPCR_MODE_MASK;
int reg_num;
for (reg_num = 0; reg_num <= 1; reg_num++)
bcm_kp_report_keys(kp, reg_num, pull_mode);
input_sync(kp->input_dev);
return IRQ_HANDLED;
}
static int bcm_kp_start(struct bcm_kp *kp)
{
int error;
if (kp->clk) {
error = clk_prepare_enable(kp->clk);
if (error)
return error;
}
writel(kp->kpior, kp->base + KPIOR_OFFSET);
writel(kp->imr0_val, kp->base + KPIMR0_OFFSET);
writel(kp->imr1_val, kp->base + KPIMR1_OFFSET);
writel(kp->kpemr, kp->base + KPEMR0_OFFSET);
writel(kp->kpemr, kp->base + KPEMR1_OFFSET);
writel(kp->kpemr, kp->base + KPEMR2_OFFSET);
writel(kp->kpemr, kp->base + KPEMR3_OFFSET);
writel(0xFFFFFFFF, kp->base + KPICR0_OFFSET);
writel(0xFFFFFFFF, kp->base + KPICR1_OFFSET);
kp->last_state[0] = readl(kp->base + KPSSR0_OFFSET);
kp->last_state[0] = readl(kp->base + KPSSR1_OFFSET);
writel(kp->kpcr | KPCR_ENABLE, kp->base + KPCR_OFFSET);
return 0;
}
static void bcm_kp_stop(const struct bcm_kp *kp)
{
u32 val;
val = readl(kp->base + KPCR_OFFSET);
val &= ~KPCR_ENABLE;
writel(0, kp->base + KPCR_OFFSET);
writel(0, kp->base + KPIMR0_OFFSET);
writel(0, kp->base + KPIMR1_OFFSET);
writel(0xFFFFFFFF, kp->base + KPICR0_OFFSET);
writel(0xFFFFFFFF, kp->base + KPICR1_OFFSET);
if (kp->clk)
clk_disable_unprepare(kp->clk);
}
static int bcm_kp_open(struct input_dev *dev)
{
struct bcm_kp *kp = input_get_drvdata(dev);
return bcm_kp_start(kp);
}
static void bcm_kp_close(struct input_dev *dev)
{
struct bcm_kp *kp = input_get_drvdata(dev);
bcm_kp_stop(kp);
}
static int bcm_kp_matrix_key_parse_dt(struct bcm_kp *kp)
{
struct device *dev = kp->input_dev->dev.parent;
struct device_node *np = dev->of_node;
int error;
unsigned int dt_val;
unsigned int i;
unsigned int num_rows, col_mask, rows_set;
/* Initialize the KPCR Keypad Configuration Register */
kp->kpcr = KPCR_STATUSFILTERENABLE | KPCR_COLFILTERENABLE;
error = matrix_keypad_parse_of_params(dev, &kp->n_rows, &kp->n_cols);
if (error) {
dev_err(dev, "failed to parse kp params\n");
return error;
}
/* Set row width for the ASIC block. */
kp->kpcr |= (kp->n_rows - 1) << KPCR_ROWWIDTH_SHIFT;
/* Set column width for the ASIC block. */
kp->kpcr |= (kp->n_cols - 1) << KPCR_COLUMNWIDTH_SHIFT;
/* Configure the IMR registers */
/*
* IMR registers contain interrupt enable bits for 8x8 matrix
* IMR0 register format: <row3> <row2> <row1> <row0>
* IMR1 register format: <row7> <row6> <row5> <row4>
*/
col_mask = (1 << (kp->n_cols)) - 1;
num_rows = kp->n_rows;
/* Set column bits in rows 0 to 3 in IMR0 */
kp->imr0_val = col_mask;
rows_set = 1;
while (--num_rows && rows_set++ < 4)
kp->imr0_val |= kp->imr0_val << MAX_COLS;
/* Set column bits in rows 4 to 7 in IMR1 */
kp->imr1_val = 0;
if (num_rows) {
kp->imr1_val = col_mask;
while (--num_rows)
kp->imr1_val |= kp->imr1_val << MAX_COLS;
}
/* Initialize the KPEMR Keypress Edge Mode Registers */
/* Trigger on both edges */
kp->kpemr = 0;
for (i = 0; i <= 30; i += 2)
kp->kpemr |= (KPEMR_EDGETYPE_BOTH << i);
/*
* Obtain the Status filter debounce value and verify against the
* possible values specified in the DT binding.
*/
of_property_read_u32(np, "status-debounce-filter-period", &dt_val);
if (dt_val > KPCR_STATUSFILTERTYPE_MAX) {
dev_err(dev, "Invalid Status filter debounce value %d\n",
dt_val);
return -EINVAL;
}
kp->kpcr |= dt_val << KPCR_STATUSFILTERTYPE_SHIFT;
/*
* Obtain the Column filter debounce value and verify against the
* possible values specified in the DT binding.
*/
of_property_read_u32(np, "col-debounce-filter-period", &dt_val);
if (dt_val > KPCR_COLFILTERTYPE_MAX) {
dev_err(dev, "Invalid Column filter debounce value %d\n",
dt_val);
return -EINVAL;
}
kp->kpcr |= dt_val << KPCR_COLFILTERTYPE_SHIFT;
/*
* Determine between the row and column,
* which should be configured as output.
*/
if (of_property_read_bool(np, "row-output-enabled")) {
/*
* Set RowOContrl or ColumnOContrl in KPIOR
* to the number of pins to drive as outputs
*/
kp->kpior = ((1 << kp->n_rows) - 1) <<
KPIOR_ROWOCONTRL_SHIFT;
} else {
kp->kpior = ((1 << kp->n_cols) - 1) <<
KPIOR_COLUMNOCONTRL_SHIFT;
}
/*
* Determine if the scan pull up needs to be enabled
*/
if (of_property_read_bool(np, "pull-up-enabled"))
kp->kpcr |= KPCR_MODE;
dev_dbg(dev, "n_rows=%d n_col=%d kpcr=%x kpior=%x kpemr=%x\n",
kp->n_rows, kp->n_cols,
kp->kpcr, kp->kpior, kp->kpemr);
return 0;
}
static int bcm_kp_probe(struct platform_device *pdev)
{
struct bcm_kp *kp;
struct input_dev *input_dev;
struct resource *res;
int error;
kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL);
if (!kp)
return -ENOMEM;
input_dev = devm_input_allocate_device(&pdev->dev);
if (!input_dev) {
dev_err(&pdev->dev, "failed to allocate the input device\n");
return -ENOMEM;
}
__set_bit(EV_KEY, input_dev->evbit);
/* Enable auto repeat feature of Linux input subsystem */
if (of_property_read_bool(pdev->dev.of_node, "autorepeat"))
__set_bit(EV_REP, input_dev->evbit);
input_dev->name = pdev->name;
input_dev->phys = "keypad/input0";
input_dev->dev.parent = &pdev->dev;
input_dev->open = bcm_kp_open;
input_dev->close = bcm_kp_close;
input_dev->id.bustype = BUS_HOST;
input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_set_drvdata(input_dev, kp);
kp->input_dev = input_dev;
platform_set_drvdata(pdev, kp);
error = bcm_kp_matrix_key_parse_dt(kp);
if (error)
return error;
error = matrix_keypad_build_keymap(NULL, NULL,
kp->n_rows, kp->n_cols,
NULL, input_dev);
if (error) {
dev_err(&pdev->dev, "failed to build keymap\n");
return error;
}
/* Get the KEYPAD base address */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "Missing keypad base address resource\n");
return -ENODEV;
}
kp->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(kp->base))
return PTR_ERR(kp->base);
/* Enable clock */
kp->clk = devm_clk_get(&pdev->dev, "peri_clk");
if (IS_ERR(kp->clk)) {
error = PTR_ERR(kp->clk);
if (error != -ENOENT) {
if (error != -EPROBE_DEFER)
dev_err(&pdev->dev, "Failed to get clock\n");
return error;
}
dev_dbg(&pdev->dev,
"No clock specified. Assuming it's enabled\n");
kp->clk = NULL;
} else {
unsigned int desired_rate;
long actual_rate;
error = of_property_read_u32(pdev->dev.of_node,
"clock-frequency", &desired_rate);
if (error < 0)
desired_rate = DEFAULT_CLK_HZ;
actual_rate = clk_round_rate(kp->clk, desired_rate);
if (actual_rate <= 0)
return -EINVAL;
error = clk_set_rate(kp->clk, actual_rate);
if (error)
return error;
error = clk_prepare_enable(kp->clk);
if (error)
return error;
}
/* Put the kp into a known sane state */
bcm_kp_stop(kp);
kp->irq = platform_get_irq(pdev, 0);
if (kp->irq < 0) {
dev_err(&pdev->dev, "no IRQ specified\n");
return -EINVAL;
}
error = devm_request_threaded_irq(&pdev->dev, kp->irq,
NULL, bcm_kp_isr_thread,
IRQF_ONESHOT, pdev->name, kp);
if (error) {
dev_err(&pdev->dev, "failed to request IRQ\n");
return error;
}
error = input_register_device(input_dev);
if (error) {
dev_err(&pdev->dev, "failed to register input device\n");
return error;
}
return 0;
}
static const struct of_device_id bcm_kp_of_match[] = {
{ .compatible = "brcm,bcm-keypad" },
{ },
};
MODULE_DEVICE_TABLE(of, bcm_kp_of_match);
static struct platform_driver bcm_kp_device_driver = {
.probe = bcm_kp_probe,
.driver = {
.name = "bcm-keypad",
.of_match_table = of_match_ptr(bcm_kp_of_match),
}
};
module_platform_driver(bcm_kp_device_driver);
MODULE_AUTHOR("Broadcom Corporation");
MODULE_DESCRIPTION("BCM Keypad Driver");
MODULE_LICENSE("GPL v2");

View file

@ -338,7 +338,7 @@ static int cros_ec_keyb_resume(struct device *dev)
* wake source (e.g. the lid is open and the user might press a key to
* wake) then the key scan buffer should be preserved.
*/
if (ckdev->ec->was_wake_device)
if (!ckdev->ec->was_wake_device)
cros_ec_keyb_clear_keyboard(ckdev);
return 0;

View file

@ -0,0 +1,168 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* h3600 atmel micro companion support, key subdevice
* based on previous kernel 2.4 version
* Author : Alessandro Gardich <gremlin@gremlin.it>
* Author : Linus Walleij <linus.walleij@linaro.org>
*
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/pm.h>
#include <linux/sysctl.h>
#include <linux/proc_fs.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/mfd/ipaq-micro.h>
struct ipaq_micro_keys {
struct ipaq_micro *micro;
struct input_dev *input;
u16 *codes;
};
static const u16 micro_keycodes[] = {
KEY_RECORD, /* 1: Record button */
KEY_CALENDAR, /* 2: Calendar */
KEY_ADDRESSBOOK, /* 3: Contacts (looks like Outlook) */
KEY_MAIL, /* 4: Envelope (Q on older iPAQs) */
KEY_HOMEPAGE, /* 5: Start (looks like swoopy arrow) */
KEY_UP, /* 6: Up */
KEY_RIGHT, /* 7: Right */
KEY_LEFT, /* 8: Left */
KEY_DOWN, /* 9: Down */
};
static void micro_key_receive(void *data, int len, unsigned char *msg)
{
struct ipaq_micro_keys *keys = data;
int key, down;
down = 0x80 & msg[0];
key = 0x7f & msg[0];
if (key < ARRAY_SIZE(micro_keycodes)) {
input_report_key(keys->input, keys->codes[key], down);
input_sync(keys->input);
}
}
static void micro_key_start(struct ipaq_micro_keys *keys)
{
spin_lock(&keys->micro->lock);
keys->micro->key = micro_key_receive;
keys->micro->key_data = keys;
spin_unlock(&keys->micro->lock);
}
static void micro_key_stop(struct ipaq_micro_keys *keys)
{
spin_lock(&keys->micro->lock);
keys->micro->key = NULL;
keys->micro->key_data = NULL;
spin_unlock(&keys->micro->lock);
}
static int micro_key_open(struct input_dev *input)
{
struct ipaq_micro_keys *keys = input_get_drvdata(input);
micro_key_start(keys);
return 0;
}
static void micro_key_close(struct input_dev *input)
{
struct ipaq_micro_keys *keys = input_get_drvdata(input);
micro_key_stop(keys);
}
static int micro_key_probe(struct platform_device *pdev)
{
struct ipaq_micro_keys *keys;
int error;
int i;
keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
if (!keys)
return -ENOMEM;
keys->micro = dev_get_drvdata(pdev->dev.parent);
keys->input = devm_input_allocate_device(&pdev->dev);
if (!keys->input)
return -ENOMEM;
keys->input->keycodesize = sizeof(micro_keycodes[0]);
keys->input->keycodemax = ARRAY_SIZE(micro_keycodes);
keys->codes = devm_kmemdup(&pdev->dev, micro_keycodes,
keys->input->keycodesize * keys->input->keycodemax,
GFP_KERNEL);
keys->input->keycode = keys->codes;
__set_bit(EV_KEY, keys->input->evbit);
for (i = 0; i < ARRAY_SIZE(micro_keycodes); i++)
__set_bit(micro_keycodes[i], keys->input->keybit);
keys->input->name = "h3600 micro keys";
keys->input->open = micro_key_open;
keys->input->close = micro_key_close;
input_set_drvdata(keys->input, keys);
error = input_register_device(keys->input);
if (error)
return error;
platform_set_drvdata(pdev, keys);
return 0;
}
static int __maybe_unused micro_key_suspend(struct device *dev)
{
struct ipaq_micro_keys *keys = dev_get_drvdata(dev);
micro_key_stop(keys);
return 0;
}
static int __maybe_unused micro_key_resume(struct device *dev)
{
struct ipaq_micro_keys *keys = dev_get_drvdata(dev);
struct input_dev *input = keys->input;
mutex_lock(&input->mutex);
if (input->users)
micro_key_start(keys);
mutex_unlock(&input->mutex);
return 0;
}
static SIMPLE_DEV_PM_OPS(micro_key_dev_pm_ops,
micro_key_suspend, micro_key_resume);
static struct platform_driver micro_key_device_driver = {
.driver = {
.name = "ipaq-micro-keys",
.pm = &micro_key_dev_pm_ops,
},
.probe = micro_key_probe,
};
module_platform_driver(micro_key_device_driver);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("driver for iPAQ Atmel micro keys");
MODULE_ALIAS("platform:ipaq-micro-keys");

View file

@ -69,6 +69,28 @@
#define TC3589x_EVT_INT_CLR 0x2
#define TC3589x_KBD_INT_CLR 0x1
/**
* struct tc35893_keypad_platform_data - platform specific keypad data
* @keymap_data: matrix scan code table for keycodes
* @krow: mask for available rows, value is 0xFF
* @kcol: mask for available columns, value is 0xFF
* @debounce_period: platform specific debounce time
* @settle_time: platform specific settle down time
* @irqtype: type of interrupt, falling or rising edge
* @enable_wakeup: specifies if keypad event can wake up system from sleep
* @no_autorepeat: flag for auto repetition
*/
struct tc3589x_keypad_platform_data {
const struct matrix_keymap_data *keymap_data;
u8 krow;
u8 kcol;
u8 debounce_period;
u8 settle_time;
unsigned long irqtype;
bool enable_wakeup;
bool no_autorepeat;
};
/**
* struct tc_keypad - data structure used by keypad driver
* @tc3589x: pointer to tc35893
@ -354,13 +376,10 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
const struct tc3589x_keypad_platform_data *plat;
int error, irq;
plat = tc3589x->pdata->keypad;
if (!plat) {
plat = tc3589x_keypad_of_probe(&pdev->dev);
if (IS_ERR(plat)) {
dev_err(&pdev->dev, "invalid keypad platform data\n");
return PTR_ERR(plat);
}
plat = tc3589x_keypad_of_probe(&pdev->dev);
if (IS_ERR(plat)) {
dev_err(&pdev->dev, "invalid keypad platform data\n");
return PTR_ERR(plat);
}
irq = platform_get_irq(pdev, 0);

View file

@ -115,6 +115,18 @@ config INPUT_PCSPKR
To compile this driver as a module, choose M here: the
module will be called pcspkr.
config INPUT_PM8941_PWRKEY
tristate "Qualcomm PM8941 power key support"
depends on MFD_SPMI_PMIC
help
Say Y here if you want support for the power key usually found
on boards using a Qualcomm PM8941 compatible PMIC.
If unsure, say Y.
To compile this driver as a module, choose M here: the module
will be called pm8941-pwrkey.
config INPUT_PM8XXX_VIBRATOR
tristate "Qualcomm PM8XXX vibrator support"
depends on MFD_PM8XXX
@ -165,6 +177,18 @@ config INPUT_MAX77693_HAPTIC
To compile this driver as module, choose M here: the
module will be called max77693-haptic.
config INPUT_MAX77843_HAPTIC
tristate "MAXIM MAX77843 haptic controller support"
depends on MFD_MAX77843 && REGULATOR
select INPUT_FF_MEMLESS
help
This option enables support for the haptic controller on
MAXIM MAX77843 chip. The driver supports ff-memless interface
from input framework.
To compile this driver as module, choose M here: the
module will be called max77843-haptic.
config INPUT_MAX8925_ONKEY
tristate "MAX8925 ONKEY support"
depends on MFD_MAX8925

Some files were not shown because too many files have changed in this diff Show more