Skip to content

Commit

Permalink
Merge branch 'next' into for-linus
Browse files Browse the repository at this point in the history
Prepare first round of input updates for 4.7 merge window.
  • Loading branch information
dtor committed May 17, 2016
2 parents c52c545 + d96caf8 commit 23ea596
Show file tree
Hide file tree
Showing 15 changed files with 170 additions and 182 deletions.
10 changes: 5 additions & 5 deletions Documentation/devicetree/bindings/input/gpio-keys.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ Optional subnode-properties:

Example nodes:

gpio_keys {
gpio-keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
autorepeat;
button@21 {

up {
label = "GPIO Key UP";
linux,code = <103>;
gpios = <&gpio1 0 1>;
};
button@22 {

down {
label = "GPIO Key DOWN";
linux,code = <108>;
interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

Required properties:
- compatible: must be "brcm,iproc-touchscreen"
- reg: physical base address of the controller and length of memory mapped
region.
- ts_syscon: handler of syscon node defining physical base
address of the controller and length of memory mapped region.
If this property is selected please make sure MFD_SYSCON config
is enabled in the defconfig file.
- clocks: The clock provided by the SOC to driver the tsc
- clock-name: name for the clock
- clock-names: name for the clock
- interrupts: The touchscreen controller's interrupt
- address-cells: Specify the number of u32 entries needed in child nodes.
Should set to 1.
- size-cells: Specify number of u32 entries needed to specify child nodes size
in reg property. Should set to 1.

Optional properties:
- scanning_period: Time between scans. Each step is 1024 us. Valid 1-256.
Expand Down Expand Up @@ -53,13 +59,18 @@ Optional properties:
- touchscreen-inverted-x: X axis is inverted (boolean)
- touchscreen-inverted-y: Y axis is inverted (boolean)

Example:
Example: An example of touchscreen node

touchscreen: tsc@0x180A6000 {
ts_adc_syscon: ts_adc_syscon@180a6000 {
compatible = "brcm,iproc-ts-adc-syscon","syscon";
reg = <0x180a6000 0xc30>;
};

touchscreen: touchscreen@180A6000 {
compatible = "brcm,iproc-touchscreen";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x180A6000 0x40>;
ts_syscon = <&ts_adc_syscon>;
clocks = <&adc_clk>;
clock-names = "tsc_clk";
interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
Expand Down
11 changes: 9 additions & 2 deletions arch/arm/boot/dts/bcm-cygnus.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,16 @@
<&pinctrl 142 10 1>;
};

touchscreen: tsc@180a6000 {
ts_adc_syscon: ts_adc_syscon@180a6000 {
compatible = "brcm,iproc-ts-adc-syscon", "syscon";
reg = <0x180a6000 0xc30>;
};

touchscreen: touchscreen@180a6000 {
compatible = "brcm,iproc-touchscreen";
reg = <0x180a6000 0x40>;
#address-cells = <1>;
#size-cells = <1>;
ts_syscon = <&ts_adc_syscon>;
clocks = <&asiu_clks BCM_CYGNUS_ASIU_ADC_CLK>;
clock-names = "tsc_clk";
interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
Expand Down
52 changes: 1 addition & 51 deletions drivers/input/keyboard/omap-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,6 @@ static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
static unsigned int *row_gpios;
static unsigned int *col_gpios;

#ifdef CONFIG_ARCH_OMAP2
static void set_col_gpio_val(struct omap_kp *omap_kp, u8 value)
{
int col;

for (col = 0; col < omap_kp->cols; col++)
gpio_set_value(col_gpios[col], value & (1 << col));
}

static u8 get_row_gpio_val(struct omap_kp *omap_kp)
{
int row;
u8 value = 0;

for (row = 0; row < omap_kp->rows; row++) {
if (gpio_get_value(row_gpios[row]))
value |= (1 << row);
}
return value;
}
#else
#define set_col_gpio_val(x, y) do {} while (0)
#define get_row_gpio_val(x) 0
#endif

static irqreturn_t omap_kp_interrupt(int irq, void *dev_id)
{
/* disable keyboard interrupt and schedule for handling */
Expand Down Expand Up @@ -133,7 +108,6 @@ static void omap_kp_tasklet(unsigned long data)
unsigned int row_shift = get_count_order(omap_kp_data->cols);
unsigned char new_state[8], changed, key_down = 0;
int col, row;
int spurious = 0;

/* check for any changes */
omap_kp_scan_keypad(omap_kp_data, new_state);
Expand Down Expand Up @@ -170,12 +144,9 @@ static void omap_kp_tasklet(unsigned long data)
memcpy(keypad_state, new_state, sizeof(keypad_state));

if (key_down) {
int delay = HZ / 20;
/* some key is pressed - keep irq disabled and use timer
* to poll the keypad */
if (spurious)
delay = 2 * HZ;
mod_timer(&omap_kp_data->timer, jiffies + delay);
mod_timer(&omap_kp_data->timer, jiffies + HZ / 20);
} else {
/* enable interrupts */
omap_writew(0, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
Expand Down Expand Up @@ -216,25 +187,6 @@ static ssize_t omap_kp_enable_store(struct device *dev, struct device_attribute

static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, omap_kp_enable_show, omap_kp_enable_store);

#ifdef CONFIG_PM
static int omap_kp_suspend(struct platform_device *dev, pm_message_t state)
{
/* Nothing yet */

return 0;
}

static int omap_kp_resume(struct platform_device *dev)
{
/* Nothing yet */

return 0;
}
#else
#define omap_kp_suspend NULL
#define omap_kp_resume NULL
#endif

static int omap_kp_probe(struct platform_device *pdev)
{
struct omap_kp *omap_kp;
Expand Down Expand Up @@ -371,8 +323,6 @@ static int omap_kp_remove(struct platform_device *pdev)
static struct platform_driver omap_kp_driver = {
.probe = omap_kp_probe,
.remove = omap_kp_remove,
.suspend = omap_kp_suspend,
.resume = omap_kp_resume,
.driver = {
.name = "omap-keypad",
},
Expand Down
28 changes: 16 additions & 12 deletions drivers/input/keyboard/twl4030_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ struct twl4030_keypad {
unsigned short keymap[TWL4030_KEYMAP_SIZE];
u16 kp_state[TWL4030_MAX_ROWS];
bool autorepeat;
unsigned n_rows;
unsigned n_cols;
unsigned irq;
unsigned int n_rows;
unsigned int n_cols;
unsigned int irq;

struct device *dbg_dev;
struct input_dev *input;
Expand Down Expand Up @@ -110,7 +110,7 @@ struct twl4030_keypad {
#define KEYP_CTRL_KBD_ON BIT(6)

/* KEYP_DEB, KEYP_LONG_KEY, KEYP_TIMEOUT_x*/
#define KEYP_PERIOD_US(t, prescale) ((t) / (31 << (prescale + 1)) - 1)
#define KEYP_PERIOD_US(t, prescale) ((t) / (31 << ((prescale) + 1)) - 1)

/* KEYP_LK_PTV_REG Fields */
#define KEYP_LK_PTV_PTV_SHIFT 5
Expand Down Expand Up @@ -162,9 +162,10 @@ static int twl4030_kpwrite_u8(struct twl4030_keypad *kp, u8 data, u32 reg)

static inline u16 twl4030_col_xlate(struct twl4030_keypad *kp, u8 col)
{
/* If all bits in a row are active for all coloumns then
/*
* If all bits in a row are active for all columns then
* we have that row line connected to gnd. Mark this
* key on as if it was on matrix position n_cols (ie
* key on as if it was on matrix position n_cols (i.e.
* one higher than the size of the matrix).
*/
if (col == 0xFF)
Expand Down Expand Up @@ -209,9 +210,9 @@ static void twl4030_kp_scan(struct twl4030_keypad *kp, bool release_all)
u16 new_state[TWL4030_MAX_ROWS];
int col, row;

if (release_all)
if (release_all) {
memset(new_state, 0, sizeof(new_state));
else {
} else {
/* check for any changes */
int ret = twl4030_read_kp_matrix_state(kp, new_state);

Expand Down Expand Up @@ -262,8 +263,10 @@ static irqreturn_t do_kp_irq(int irq, void *_kp)
/* Read & Clear TWL4030 pending interrupt */
ret = twl4030_kpread(kp, &reg, KEYP_ISR1, 1);

/* Release all keys if I2C has gone bad or
* the KEYP has gone to idle state */
/*
* Release all keys if I2C has gone bad or
* the KEYP has gone to idle state.
*/
if (ret >= 0 && (reg & KEYP_IMR1_KP))
twl4030_kp_scan(kp, false);
else
Expand All @@ -283,7 +286,8 @@ static int twl4030_kp_program(struct twl4030_keypad *kp)
if (twl4030_kpwrite_u8(kp, reg, KEYP_CTRL) < 0)
return -EIO;

/* NOTE: we could use sih_setup() here to package keypad
/*
* NOTE: we could use sih_setup() here to package keypad
* event sources as four different IRQs ... but we don't.
*/

Expand Down Expand Up @@ -312,7 +316,7 @@ static int twl4030_kp_program(struct twl4030_keypad *kp)

/*
* Enable Clear-on-Read; disable remembering events that fire
* after the IRQ but before our handler acks (reads) them,
* after the IRQ but before our handler acks (reads) them.
*/
reg = TWL4030_SIH_CTRL_COR_MASK | TWL4030_SIH_CTRL_PENDDIS_MASK;
if (twl4030_kpwrite_u8(kp, reg, KEYP_SIH_CTRL) < 0)
Expand Down
47 changes: 36 additions & 11 deletions drivers/input/misc/cm109.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ enum {

BUZZER_ON = 1 << 5,

/* up to 256 normal keys, up to 16 special keys */
KEYMAP_SIZE = 256 + 16,
/* up to 256 normal keys, up to 15 special key combinations */
KEYMAP_SIZE = 256 + 15,
};

/* CM109 protocol packet */
Expand Down Expand Up @@ -139,7 +139,7 @@ static unsigned short special_keymap(int code)
{
if (code > 0xff) {
switch (code - 0xff) {
case RECORD_MUTE: return KEY_MUTE;
case RECORD_MUTE: return KEY_MICMUTE;
case PLAYBACK_MUTE: return KEY_MUTE;
case VOLUME_DOWN: return KEY_VOLUMEDOWN;
case VOLUME_UP: return KEY_VOLUMEUP;
Expand Down Expand Up @@ -312,6 +312,32 @@ static void report_key(struct cm109_dev *dev, int key)
input_sync(idev);
}

/*
* Converts data of special key presses (volume, mute) into events
* for the input subsystem, sends press-n-release for mute keys.
*/
static void cm109_report_special(struct cm109_dev *dev)
{
static const u8 autorelease = RECORD_MUTE | PLAYBACK_MUTE;
struct input_dev *idev = dev->idev;
u8 data = dev->irq_data->byte[HID_IR0];
unsigned short keycode;
int i;

for (i = 0; i < 4; i++) {
keycode = dev->keymap[0xff + BIT(i)];
if (keycode == KEY_RESERVED)
continue;

input_report_key(idev, keycode, data & BIT(i));
if (data & autorelease & BIT(i)) {
input_sync(idev);
input_report_key(idev, keycode, 0);
}
}
input_sync(idev);
}

/******************************************************************************
* CM109 usb communication interface
*****************************************************************************/
Expand Down Expand Up @@ -340,6 +366,7 @@ static void cm109_urb_irq_callback(struct urb *urb)
struct cm109_dev *dev = urb->context;
const int status = urb->status;
int error;
unsigned long flags;

dev_dbg(&dev->intf->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n",
dev->irq_data->byte[0],
Expand All @@ -357,10 +384,7 @@ static void cm109_urb_irq_callback(struct urb *urb)
}

/* Special keys */
if (dev->irq_data->byte[HID_IR0] & 0x0f) {
const int code = (dev->irq_data->byte[HID_IR0] & 0x0f);
report_key(dev, dev->keymap[0xff + code]);
}
cm109_report_special(dev);

/* Scan key column */
if (dev->keybit == 0xf) {
Expand All @@ -381,7 +405,7 @@ static void cm109_urb_irq_callback(struct urb *urb)

out:

spin_lock(&dev->ctl_submit_lock);
spin_lock_irqsave(&dev->ctl_submit_lock, flags);

dev->irq_urb_pending = 0;

Expand All @@ -405,14 +429,15 @@ static void cm109_urb_irq_callback(struct urb *urb)
__func__, error);
}

spin_unlock(&dev->ctl_submit_lock);
spin_unlock_irqrestore(&dev->ctl_submit_lock, flags);
}

static void cm109_urb_ctl_callback(struct urb *urb)
{
struct cm109_dev *dev = urb->context;
const int status = urb->status;
int error;
unsigned long flags;

dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n",
dev->ctl_data->byte[0],
Expand All @@ -427,7 +452,7 @@ static void cm109_urb_ctl_callback(struct urb *urb)
__func__, status);
}

spin_lock(&dev->ctl_submit_lock);
spin_lock_irqsave(&dev->ctl_submit_lock, flags);

dev->ctl_urb_pending = 0;

Expand All @@ -448,7 +473,7 @@ static void cm109_urb_ctl_callback(struct urb *urb)
}
}

spin_unlock(&dev->ctl_submit_lock);
spin_unlock_irqrestore(&dev->ctl_submit_lock, flags);
}

static void cm109_toggle_buzzer_async(struct cm109_dev *dev)
Expand Down
8 changes: 4 additions & 4 deletions drivers/input/misc/rotary_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ struct rotary_encoder {
bool armed;
signed char dir; /* 1 - clockwise, -1 - CCW */

unsigned last_stable;
unsigned int last_stable;
};

static unsigned rotary_encoder_get_state(struct rotary_encoder *encoder)
static unsigned int rotary_encoder_get_state(struct rotary_encoder *encoder)
{
int i;
unsigned ret = 0;
unsigned int ret = 0;

for (i = 0; i < encoder->gpios->ndescs; ++i) {
int val = gpiod_get_value_cansleep(encoder->gpios->desc[i]);
Expand Down Expand Up @@ -100,7 +100,7 @@ static void rotary_encoder_report_event(struct rotary_encoder *encoder)
static irqreturn_t rotary_encoder_irq(int irq, void *dev_id)
{
struct rotary_encoder *encoder = dev_id;
unsigned state;
unsigned int state;

mutex_lock(&encoder->access_mutex);

Expand Down
Loading

0 comments on commit 23ea596

Please sign in to comment.