Skip to content

Commit 39fada5

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull more input updates from Dmitry Torokhov: "Two new drivers for touchscreen controllers: - Silead touchscreen controllers - SiS 9200 family touchscreen controllers and a few driver fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: silead - remove some dead code Input: sis-i2c - select CONFIG_CRC_ITU_T Input: add driver for SiS 9200 family I2C touchscreen controllers Input: ili210x - fix permissions on "calibrate" attribute Input: elan_i2c - properly wake up touchpad on ASUS laptops Input: add driver for Silead touchscreens Input: elantech - fix debug dump of the current packet Input: rotary_encoder - support binary encoding of states Input: xpad - power off wireless 360 controllers on suspend Input: i8042 - break load dependency between atkbd/psmouse and i8042 Input: synaptics-rmi4 - do not check for NULL when calling of_node_put() Input: cros_ec_keyb - cleanup use of dev
2 parents f72035f + 22fe874 commit 39fada5

File tree

19 files changed

+1244
-70
lines changed

19 files changed

+1244
-70
lines changed

Documentation/devicetree/bindings/input/rotary-encoder.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Optional properties:
2020
2: Half-period mode
2121
4: Quarter-period mode
2222
- wakeup-source: Boolean, rotary encoder can wake up the system.
23+
- rotary-encoder,encoding: String, the method used to encode steps.
24+
Supported are "gray" (the default and more common) and "binary".
2325

2426
Deprecated properties:
2527
- rotary-encoder,half-period: Makes the driver work on half-period mode.
@@ -34,6 +36,7 @@ Example:
3436
compatible = "rotary-encoder";
3537
gpios = <&gpio 19 1>, <&gpio 20 0>; /* GPIO19 is inverted */
3638
linux,axis = <0>; /* REL_X */
39+
rotary-encoder,encoding = "gray";
3740
rotary-encoder,relative-axis;
3841
};
3942

@@ -42,5 +45,6 @@ Example:
4245
gpios = <&gpio 21 0>, <&gpio 22 0>;
4346
linux,axis = <1>; /* ABS_Y */
4447
rotary-encoder,steps = <24>;
48+
rotary-encoder,encoding = "binary";
4549
rotary-encoder,rollover;
4650
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
* GSL 1680 touchscreen controller
2+
3+
Required properties:
4+
- compatible : "silead,gsl1680"
5+
- reg : I2C slave address of the chip (0x40)
6+
- interrupt-parent : a phandle pointing to the interrupt controller
7+
serving the interrupt for this chip
8+
- interrupts : interrupt specification for the gsl1680 interrupt
9+
- power-gpios : Specification for the pin connected to the gsl1680's
10+
shutdown input. This needs to be driven high to take the
11+
gsl1680 out of its low power state
12+
- touchscreen-size-x : See touchscreen.txt
13+
- touchscreen-size-y : See touchscreen.txt
14+
15+
Optional properties:
16+
- touchscreen-inverted-x : See touchscreen.txt
17+
- touchscreen-inverted-y : See touchscreen.txt
18+
- touchscreen-swapped-x-y : See touchscreen.txt
19+
- silead,max-fingers : maximum number of fingers the touchscreen can detect
20+
21+
Example:
22+
23+
i2c@00000000 {
24+
gsl1680: touchscreen@40 {
25+
compatible = "silead,gsl1680";
26+
reg = <0x40>;
27+
interrupt-parent = <&pio>;
28+
interrupts = <6 11 IRQ_TYPE_EDGE_FALLING>;
29+
power-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>;
30+
touchscreen-size-x = <480>;
31+
touchscreen-size-y = <800>;
32+
touchscreen-inverted-x;
33+
touchscreen-swapped-x-y;
34+
silead,max-fingers = <5>;
35+
};
36+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
* SiS I2C Multiple Touch Controller
2+
3+
Required properties:
4+
- compatible: must be "sis,9200-ts"
5+
- reg: i2c slave address
6+
- interrupt-parent: the phandle for the interrupt controller
7+
(see interrupt binding [0])
8+
- interrupts: touch controller interrupt (see interrupt
9+
binding [0])
10+
11+
Optional properties:
12+
- pinctrl-names: should be "default" (see pinctrl binding [1]).
13+
- pinctrl-0: a phandle pointing to the pin settings for the
14+
device (see pinctrl binding [1]).
15+
- attn-gpios: the gpio pin used as attention line
16+
- reset-gpios: the gpio pin used to reset the controller
17+
- wakeup-source: touchscreen can be used as a wakeup source
18+
19+
[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
20+
[1]: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
21+
22+
Example:
23+
24+
sis9255@5c {
25+
compatible = "sis,9200-ts";
26+
reg = <0x5c>;
27+
pinctrl-names = "default";
28+
pinctrl-0 = <&pinctrl_sis>;
29+
interrupt-parent = <&gpio3>;
30+
interrupts = <19 IRQ_TYPE_EDGE_FALLING>;
31+
irq-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
32+
reset-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>;
33+
};

Documentation/devicetree/bindings/vendor-prefixes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ simtek
238238
sii Seiko Instruments, Inc.
239239
silergy Silergy Corp.
240240
sirf SiRF Technology, Inc.
241+
sis Silicon Integrated Systems Corp.
241242
sitronix Sitronix Technology Corporation
242243
skyworks Skyworks Solutions, Inc.
243244
smsc Standard Microsystems Corporation

drivers/input/joystick/xpad.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ static bool sticks_to_null;
115115
module_param(sticks_to_null, bool, S_IRUGO);
116116
MODULE_PARM_DESC(sticks_to_null, "Do not map sticks at all for unknown pads");
117117

118+
static bool auto_poweroff = true;
119+
module_param(auto_poweroff, bool, S_IWUSR | S_IRUGO);
120+
MODULE_PARM_DESC(auto_poweroff, "Power off wireless controllers on suspend");
121+
118122
static const struct xpad_device {
119123
u16 idVendor;
120124
u16 idProduct;
@@ -1248,6 +1252,36 @@ static void xpad_stop_input(struct usb_xpad *xpad)
12481252
usb_kill_urb(xpad->irq_in);
12491253
}
12501254

1255+
static void xpad360w_poweroff_controller(struct usb_xpad *xpad)
1256+
{
1257+
unsigned long flags;
1258+
struct xpad_output_packet *packet =
1259+
&xpad->out_packets[XPAD_OUT_CMD_IDX];
1260+
1261+
spin_lock_irqsave(&xpad->odata_lock, flags);
1262+
1263+
packet->data[0] = 0x00;
1264+
packet->data[1] = 0x00;
1265+
packet->data[2] = 0x08;
1266+
packet->data[3] = 0xC0;
1267+
packet->data[4] = 0x00;
1268+
packet->data[5] = 0x00;
1269+
packet->data[6] = 0x00;
1270+
packet->data[7] = 0x00;
1271+
packet->data[8] = 0x00;
1272+
packet->data[9] = 0x00;
1273+
packet->data[10] = 0x00;
1274+
packet->data[11] = 0x00;
1275+
packet->len = 12;
1276+
packet->pending = true;
1277+
1278+
/* Reset the sequence so we send out poweroff now */
1279+
xpad->last_out_packet = -1;
1280+
xpad_try_sending_next_out_packet(xpad);
1281+
1282+
spin_unlock_irqrestore(&xpad->odata_lock, flags);
1283+
}
1284+
12511285
static int xpad360w_start_input(struct usb_xpad *xpad)
12521286
{
12531287
int error;
@@ -1590,6 +1624,15 @@ static int xpad_suspend(struct usb_interface *intf, pm_message_t message)
15901624
* or goes away.
15911625
*/
15921626
xpad360w_stop_input(xpad);
1627+
1628+
/*
1629+
* The wireless adapter is going off now, so the
1630+
* gamepads are going to become disconnected.
1631+
* Unless explicitly disabled, power them down
1632+
* so they don't just sit there flashing.
1633+
*/
1634+
if (auto_poweroff && xpad->pad_present)
1635+
xpad360w_poweroff_controller(xpad);
15931636
} else {
15941637
mutex_lock(&input->mutex);
15951638
if (input->users)

drivers/input/keyboard/cros_ec_keyb.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static irqreturn_t cros_ec_keyb_irq(int irq, void *data)
186186
if (ret >= 0)
187187
cros_ec_keyb_process(ckdev, kb_state, ret);
188188
else
189-
dev_err(ec->dev, "failed to get keyboard state: %d\n", ret);
189+
dev_err(ckdev->dev, "failed to get keyboard state: %d\n", ret);
190190

191191
return IRQ_HANDLED;
192192
}
@@ -236,7 +236,7 @@ static void cros_ec_keyb_compute_valid_keys(struct cros_ec_keyb *ckdev)
236236
static int cros_ec_keyb_probe(struct platform_device *pdev)
237237
{
238238
struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
239-
struct device *dev = ec->dev;
239+
struct device *dev = &pdev->dev;
240240
struct cros_ec_keyb *ckdev;
241241
struct input_dev *idev;
242242
struct device_node *np;
@@ -246,23 +246,22 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
246246
if (!np)
247247
return -ENODEV;
248248

249-
ckdev = devm_kzalloc(&pdev->dev, sizeof(*ckdev), GFP_KERNEL);
249+
ckdev = devm_kzalloc(dev, sizeof(*ckdev), GFP_KERNEL);
250250
if (!ckdev)
251251
return -ENOMEM;
252-
err = matrix_keypad_parse_of_params(&pdev->dev, &ckdev->rows,
253-
&ckdev->cols);
252+
err = matrix_keypad_parse_of_params(dev, &ckdev->rows, &ckdev->cols);
254253
if (err)
255254
return err;
256255

257-
ckdev->valid_keys = devm_kzalloc(&pdev->dev, ckdev->cols, GFP_KERNEL);
256+
ckdev->valid_keys = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL);
258257
if (!ckdev->valid_keys)
259258
return -ENOMEM;
260259

261-
ckdev->old_kb_state = devm_kzalloc(&pdev->dev, ckdev->cols, GFP_KERNEL);
260+
ckdev->old_kb_state = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL);
262261
if (!ckdev->old_kb_state)
263262
return -ENOMEM;
264263

265-
idev = devm_input_allocate_device(&pdev->dev);
264+
idev = devm_input_allocate_device(dev);
266265
if (!idev)
267266
return -ENOMEM;
268267

@@ -273,7 +272,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
273272

274273
ckdev->ec = ec;
275274
ckdev->dev = dev;
276-
dev_set_drvdata(&pdev->dev, ckdev);
275+
dev_set_drvdata(dev, ckdev);
277276

278277
idev->name = CROS_EC_DEV_NAME;
279278
idev->phys = ec->phys_name;
@@ -282,7 +281,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
282281
idev->id.bustype = BUS_VIRTUAL;
283282
idev->id.version = 1;
284283
idev->id.product = 0;
285-
idev->dev.parent = &pdev->dev;
284+
idev->dev.parent = dev;
286285
idev->open = cros_ec_keyb_open;
287286
idev->close = cros_ec_keyb_close;
288287

drivers/input/misc/rotary_encoder.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828

2929
#define DRV_NAME "rotary-encoder"
3030

31+
enum rotary_encoder_encoding {
32+
ROTENC_GRAY,
33+
ROTENC_BINARY,
34+
};
35+
3136
struct rotary_encoder {
3237
struct input_dev *input;
3338

@@ -37,6 +42,7 @@ struct rotary_encoder {
3742
u32 axis;
3843
bool relative_axis;
3944
bool rollover;
45+
enum rotary_encoder_encoding encoding;
4046

4147
unsigned int pos;
4248

@@ -57,8 +63,9 @@ static unsigned int rotary_encoder_get_state(struct rotary_encoder *encoder)
5763

5864
for (i = 0; i < encoder->gpios->ndescs; ++i) {
5965
int val = gpiod_get_value_cansleep(encoder->gpios->desc[i]);
66+
6067
/* convert from gray encoding to normal */
61-
if (ret & 1)
68+
if (encoder->encoding == ROTENC_GRAY && ret & 1)
6269
val = !val;
6370

6471
ret = ret << 1 | val;
@@ -213,6 +220,20 @@ static int rotary_encoder_probe(struct platform_device *pdev)
213220
encoder->rollover =
214221
device_property_read_bool(dev, "rotary-encoder,rollover");
215222

223+
if (!device_property_present(dev, "rotary-encoder,encoding") ||
224+
!device_property_match_string(dev, "rotary-encoder,encoding",
225+
"gray")) {
226+
dev_info(dev, "gray");
227+
encoder->encoding = ROTENC_GRAY;
228+
} else if (!device_property_match_string(dev, "rotary-encoder,encoding",
229+
"binary")) {
230+
dev_info(dev, "binary");
231+
encoder->encoding = ROTENC_BINARY;
232+
} else {
233+
dev_err(dev, "unknown encoding setting\n");
234+
return -EINVAL;
235+
}
236+
216237
device_property_read_u32(dev, "linux,axis", &encoder->axis);
217238
encoder->relative_axis =
218239
device_property_read_bool(dev, "rotary-encoder,relative-axis");

0 commit comments

Comments
 (0)