Commit 35d136c8dab034ee14aa00d6082229b4b74607da

Authored by Jarod Wilson
Committed by Mauro Carvalho Chehab
1 parent 258c05637d

[media] ite-cir: 8709 needs to use pnp resource 2

Thanks to the intrepid testing and debugging of Matthijs van Drunen, it
was uncovered that at least some variants of the ITE8709 need to use pnp
resource 2, rather than 0, for things to function properly. Resource 0
has a length of only 1, and if you try to bypass the pnp_port_len check
and use it anyway (with either a length of 1 or 2), the system in
question's trackpad ceased to function.

The circa lirc 0.8.7 lirc_ite8709 driver used resource 2, but the value
was (amusingly) changed to 0 by way of a patch from ITE themselves, so I
don't know if there may be variants where 0 actually *is* correct, but
at least in this case and in the original lirc_ite8709 driver author's
case, it sure looks like 2 is the right value.

This fix should probably be applied to all stable kernels with the
ite-cir driver, lest we nuke more people's trackpads.

Tested-by: Matthijs van Drunen
CC: Juan Jesús García de Soria <skandalfo@gmail.com>
CC: stable@kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Showing 2 changed files with 12 additions and 3 deletions Side-by-side Diff

drivers/media/rc/ite-cir.c
... ... @@ -1347,6 +1347,7 @@
1347 1347 { /* 0: ITE8704 */
1348 1348 .model = "ITE8704 CIR transceiver",
1349 1349 .io_region_size = IT87_IOREG_LENGTH,
  1350 + .io_rsrc_no = 0,
1350 1351 .hw_tx_capable = true,
1351 1352 .sample_period = (u32) (1000000000ULL / 115200),
1352 1353 .tx_carrier_freq = 38000,
... ... @@ -1371,6 +1372,7 @@
1371 1372 { /* 1: ITE8713 */
1372 1373 .model = "ITE8713 CIR transceiver",
1373 1374 .io_region_size = IT87_IOREG_LENGTH,
  1375 + .io_rsrc_no = 0,
1374 1376 .hw_tx_capable = true,
1375 1377 .sample_period = (u32) (1000000000ULL / 115200),
1376 1378 .tx_carrier_freq = 38000,
... ... @@ -1395,6 +1397,7 @@
1395 1397 { /* 2: ITE8708 */
1396 1398 .model = "ITE8708 CIR transceiver",
1397 1399 .io_region_size = IT8708_IOREG_LENGTH,
  1400 + .io_rsrc_no = 0,
1398 1401 .hw_tx_capable = true,
1399 1402 .sample_period = (u32) (1000000000ULL / 115200),
1400 1403 .tx_carrier_freq = 38000,
... ... @@ -1420,6 +1423,7 @@
1420 1423 { /* 3: ITE8709 */
1421 1424 .model = "ITE8709 CIR transceiver",
1422 1425 .io_region_size = IT8709_IOREG_LENGTH,
  1426 + .io_rsrc_no = 2,
1423 1427 .hw_tx_capable = true,
1424 1428 .sample_period = (u32) (1000000000ULL / 115200),
1425 1429 .tx_carrier_freq = 38000,
... ... @@ -1461,6 +1465,7 @@
1461 1465 struct rc_dev *rdev = NULL;
1462 1466 int ret = -ENOMEM;
1463 1467 int model_no;
  1468 + int io_rsrc_no;
1464 1469  
1465 1470 ite_dbg("%s called", __func__);
1466 1471  
1467 1472  
... ... @@ -1490,10 +1495,11 @@
1490 1495  
1491 1496 /* get the description for the device */
1492 1497 dev_desc = &ite_dev_descs[model_no];
  1498 + io_rsrc_no = dev_desc->io_rsrc_no;
1493 1499  
1494 1500 /* validate pnp resources */
1495   - if (!pnp_port_valid(pdev, 0) ||
1496   - pnp_port_len(pdev, 0) != dev_desc->io_region_size) {
  1501 + if (!pnp_port_valid(pdev, io_rsrc_no) ||
  1502 + pnp_port_len(pdev, io_rsrc_no) != dev_desc->io_region_size) {
1497 1503 dev_err(&pdev->dev, "IR PNP Port not valid!\n");
1498 1504 goto failure;
1499 1505 }
... ... @@ -1504,7 +1510,7 @@
1504 1510 }
1505 1511  
1506 1512 /* store resource values */
1507   - itdev->cir_addr = pnp_port_start(pdev, 0);
  1513 + itdev->cir_addr = pnp_port_start(pdev, io_rsrc_no);
1508 1514 itdev->cir_irq = pnp_irq(pdev, 0);
1509 1515  
1510 1516 /* initialize spinlocks */
drivers/media/rc/ite-cir.h
... ... @@ -57,6 +57,9 @@
57 57 /* size of the I/O region */
58 58 int io_region_size;
59 59  
  60 + /* IR pnp I/O resource number */
  61 + int io_rsrc_no;
  62 +
60 63 /* true if the hardware supports transmission */
61 64 bool hw_tx_capable;
62 65