Skip to content

Commit 23ea596

Browse files
committed
Merge branch 'next' into for-linus
Prepare first round of input updates for 4.7 merge window.
2 parents c52c545 + d96caf8 commit 23ea596

15 files changed

Lines changed: 170 additions & 182 deletions

File tree

‎Documentation/devicetree/bindings/input/gpio-keys.txt‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ Optional subnode-properties:
3232

3333
Example nodes:
3434

35-
gpio_keys {
35+
gpio-keys {
3636
compatible = "gpio-keys";
37-
#address-cells = <1>;
38-
#size-cells = <0>;
3937
autorepeat;
40-
button@21 {
38+
39+
up {
4140
label = "GPIO Key UP";
4241
linux,code = <103>;
4342
gpios = <&gpio1 0 1>;
4443
};
45-
button@22 {
44+
45+
down {
4646
label = "GPIO Key DOWN";
4747
linux,code = <108>;
4848
interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;

‎Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

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

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

56-
Example:
62+
Example: An example of touchscreen node
5763

58-
touchscreen: tsc@0x180A6000 {
64+
ts_adc_syscon: ts_adc_syscon@180a6000 {
65+
compatible = "brcm,iproc-ts-adc-syscon","syscon";
66+
reg = <0x180a6000 0xc30>;
67+
};
68+
69+
touchscreen: touchscreen@180A6000 {
5970
compatible = "brcm,iproc-touchscreen";
6071
#address-cells = <1>;
6172
#size-cells = <1>;
62-
reg = <0x180A6000 0x40>;
73+
ts_syscon = <&ts_adc_syscon>;
6374
clocks = <&adc_clk>;
6475
clock-names = "tsc_clk";
6576
interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;

‎arch/arm/boot/dts/bcm-cygnus.dtsi‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,16 @@
351351
<&pinctrl 142 10 1>;
352352
};
353353

354-
touchscreen: tsc@180a6000 {
354+
ts_adc_syscon: ts_adc_syscon@180a6000 {
355+
compatible = "brcm,iproc-ts-adc-syscon", "syscon";
356+
reg = <0x180a6000 0xc30>;
357+
};
358+
359+
touchscreen: touchscreen@180a6000 {
355360
compatible = "brcm,iproc-touchscreen";
356-
reg = <0x180a6000 0x40>;
361+
#address-cells = <1>;
362+
#size-cells = <1>;
363+
ts_syscon = <&ts_adc_syscon>;
357364
clocks = <&asiu_clks BCM_CYGNUS_ASIU_ADC_CLK>;
358365
clock-names = "tsc_clk";
359366
interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;

‎drivers/input/keyboard/omap-keypad.c‎

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -64,31 +64,6 @@ static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
6464
static unsigned int *row_gpios;
6565
static unsigned int *col_gpios;
6666

67-
#ifdef CONFIG_ARCH_OMAP2
68-
static void set_col_gpio_val(struct omap_kp *omap_kp, u8 value)
69-
{
70-
int col;
71-
72-
for (col = 0; col < omap_kp->cols; col++)
73-
gpio_set_value(col_gpios[col], value & (1 << col));
74-
}
75-
76-
static u8 get_row_gpio_val(struct omap_kp *omap_kp)
77-
{
78-
int row;
79-
u8 value = 0;
80-
81-
for (row = 0; row < omap_kp->rows; row++) {
82-
if (gpio_get_value(row_gpios[row]))
83-
value |= (1 << row);
84-
}
85-
return value;
86-
}
87-
#else
88-
#define set_col_gpio_val(x, y) do {} while (0)
89-
#define get_row_gpio_val(x) 0
90-
#endif
91-
9267
static irqreturn_t omap_kp_interrupt(int irq, void *dev_id)
9368
{
9469
/* disable keyboard interrupt and schedule for handling */
@@ -133,7 +108,6 @@ static void omap_kp_tasklet(unsigned long data)
133108
unsigned int row_shift = get_count_order(omap_kp_data->cols);
134109
unsigned char new_state[8], changed, key_down = 0;
135110
int col, row;
136-
int spurious = 0;
137111

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

172146
if (key_down) {
173-
int delay = HZ / 20;
174147
/* some key is pressed - keep irq disabled and use timer
175148
* to poll the keypad */
176-
if (spurious)
177-
delay = 2 * HZ;
178-
mod_timer(&omap_kp_data->timer, jiffies + delay);
149+
mod_timer(&omap_kp_data->timer, jiffies + HZ / 20);
179150
} else {
180151
/* enable interrupts */
181152
omap_writew(0, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
@@ -216,25 +187,6 @@ static ssize_t omap_kp_enable_store(struct device *dev, struct device_attribute
216187

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

219-
#ifdef CONFIG_PM
220-
static int omap_kp_suspend(struct platform_device *dev, pm_message_t state)
221-
{
222-
/* Nothing yet */
223-
224-
return 0;
225-
}
226-
227-
static int omap_kp_resume(struct platform_device *dev)
228-
{
229-
/* Nothing yet */
230-
231-
return 0;
232-
}
233-
#else
234-
#define omap_kp_suspend NULL
235-
#define omap_kp_resume NULL
236-
#endif
237-
238190
static int omap_kp_probe(struct platform_device *pdev)
239191
{
240192
struct omap_kp *omap_kp;
@@ -371,8 +323,6 @@ static int omap_kp_remove(struct platform_device *pdev)
371323
static struct platform_driver omap_kp_driver = {
372324
.probe = omap_kp_probe,
373325
.remove = omap_kp_remove,
374-
.suspend = omap_kp_suspend,
375-
.resume = omap_kp_resume,
376326
.driver = {
377327
.name = "omap-keypad",
378328
},

‎drivers/input/keyboard/twl4030_keypad.c‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ struct twl4030_keypad {
6161
unsigned short keymap[TWL4030_KEYMAP_SIZE];
6262
u16 kp_state[TWL4030_MAX_ROWS];
6363
bool autorepeat;
64-
unsigned n_rows;
65-
unsigned n_cols;
66-
unsigned irq;
64+
unsigned int n_rows;
65+
unsigned int n_cols;
66+
unsigned int irq;
6767

6868
struct device *dbg_dev;
6969
struct input_dev *input;
@@ -110,7 +110,7 @@ struct twl4030_keypad {
110110
#define KEYP_CTRL_KBD_ON BIT(6)
111111

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

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

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

212-
if (release_all)
213+
if (release_all) {
213214
memset(new_state, 0, sizeof(new_state));
214-
else {
215+
} else {
215216
/* check for any changes */
216217
int ret = twl4030_read_kp_matrix_state(kp, new_state);
217218

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

265-
/* Release all keys if I2C has gone bad or
266-
* the KEYP has gone to idle state */
266+
/*
267+
* Release all keys if I2C has gone bad or
268+
* the KEYP has gone to idle state.
269+
*/
267270
if (ret >= 0 && (reg & KEYP_IMR1_KP))
268271
twl4030_kp_scan(kp, false);
269272
else
@@ -283,7 +286,8 @@ static int twl4030_kp_program(struct twl4030_keypad *kp)
283286
if (twl4030_kpwrite_u8(kp, reg, KEYP_CTRL) < 0)
284287
return -EIO;
285288

286-
/* NOTE: we could use sih_setup() here to package keypad
289+
/*
290+
* NOTE: we could use sih_setup() here to package keypad
287291
* event sources as four different IRQs ... but we don't.
288292
*/
289293

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

313317
/*
314318
* Enable Clear-on-Read; disable remembering events that fire
315-
* after the IRQ but before our handler acks (reads) them,
319+
* after the IRQ but before our handler acks (reads) them.
316320
*/
317321
reg = TWL4030_SIH_CTRL_COR_MASK | TWL4030_SIH_CTRL_PENDDIS_MASK;
318322
if (twl4030_kpwrite_u8(kp, reg, KEYP_SIH_CTRL) < 0)

‎drivers/input/misc/cm109.c‎

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ enum {
7676

7777
BUZZER_ON = 1 << 5,
7878

79-
/* up to 256 normal keys, up to 16 special keys */
80-
KEYMAP_SIZE = 256 + 16,
79+
/* up to 256 normal keys, up to 15 special key combinations */
80+
KEYMAP_SIZE = 256 + 15,
8181
};
8282

8383
/* CM109 protocol packet */
@@ -139,7 +139,7 @@ static unsigned short special_keymap(int code)
139139
{
140140
if (code > 0xff) {
141141
switch (code - 0xff) {
142-
case RECORD_MUTE: return KEY_MUTE;
142+
case RECORD_MUTE: return KEY_MICMUTE;
143143
case PLAYBACK_MUTE: return KEY_MUTE;
144144
case VOLUME_DOWN: return KEY_VOLUMEDOWN;
145145
case VOLUME_UP: return KEY_VOLUMEUP;
@@ -312,6 +312,32 @@ static void report_key(struct cm109_dev *dev, int key)
312312
input_sync(idev);
313313
}
314314

315+
/*
316+
* Converts data of special key presses (volume, mute) into events
317+
* for the input subsystem, sends press-n-release for mute keys.
318+
*/
319+
static void cm109_report_special(struct cm109_dev *dev)
320+
{
321+
static const u8 autorelease = RECORD_MUTE | PLAYBACK_MUTE;
322+
struct input_dev *idev = dev->idev;
323+
u8 data = dev->irq_data->byte[HID_IR0];
324+
unsigned short keycode;
325+
int i;
326+
327+
for (i = 0; i < 4; i++) {
328+
keycode = dev->keymap[0xff + BIT(i)];
329+
if (keycode == KEY_RESERVED)
330+
continue;
331+
332+
input_report_key(idev, keycode, data & BIT(i));
333+
if (data & autorelease & BIT(i)) {
334+
input_sync(idev);
335+
input_report_key(idev, keycode, 0);
336+
}
337+
}
338+
input_sync(idev);
339+
}
340+
315341
/******************************************************************************
316342
* CM109 usb communication interface
317343
*****************************************************************************/
@@ -340,6 +366,7 @@ static void cm109_urb_irq_callback(struct urb *urb)
340366
struct cm109_dev *dev = urb->context;
341367
const int status = urb->status;
342368
int error;
369+
unsigned long flags;
343370

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

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

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

382406
out:
383407

384-
spin_lock(&dev->ctl_submit_lock);
408+
spin_lock_irqsave(&dev->ctl_submit_lock, flags);
385409

386410
dev->irq_urb_pending = 0;
387411

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

408-
spin_unlock(&dev->ctl_submit_lock);
432+
spin_unlock_irqrestore(&dev->ctl_submit_lock, flags);
409433
}
410434

411435
static void cm109_urb_ctl_callback(struct urb *urb)
412436
{
413437
struct cm109_dev *dev = urb->context;
414438
const int status = urb->status;
415439
int error;
440+
unsigned long flags;
416441

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

430-
spin_lock(&dev->ctl_submit_lock);
455+
spin_lock_irqsave(&dev->ctl_submit_lock, flags);
431456

432457
dev->ctl_urb_pending = 0;
433458

@@ -448,7 +473,7 @@ static void cm109_urb_ctl_callback(struct urb *urb)
448473
}
449474
}
450475

451-
spin_unlock(&dev->ctl_submit_lock);
476+
spin_unlock_irqrestore(&dev->ctl_submit_lock, flags);
452477
}
453478

454479
static void cm109_toggle_buzzer_async(struct cm109_dev *dev)

‎drivers/input/misc/rotary_encoder.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ struct rotary_encoder {
4747
bool armed;
4848
signed char dir; /* 1 - clockwise, -1 - CCW */
4949

50-
unsigned last_stable;
50+
unsigned int last_stable;
5151
};
5252

53-
static unsigned rotary_encoder_get_state(struct rotary_encoder *encoder)
53+
static unsigned int rotary_encoder_get_state(struct rotary_encoder *encoder)
5454
{
5555
int i;
56-
unsigned ret = 0;
56+
unsigned int ret = 0;
5757

5858
for (i = 0; i < encoder->gpios->ndescs; ++i) {
5959
int val = gpiod_get_value_cansleep(encoder->gpios->desc[i]);
@@ -100,7 +100,7 @@ static void rotary_encoder_report_event(struct rotary_encoder *encoder)
100100
static irqreturn_t rotary_encoder_irq(int irq, void *dev_id)
101101
{
102102
struct rotary_encoder *encoder = dev_id;
103-
unsigned state;
103+
unsigned int state;
104104

105105
mutex_lock(&encoder->access_mutex);
106106

0 commit comments

Comments
 (0)