18
18
#include "quicki2c-hid.h"
19
19
#include "quicki2c-protocol.h"
20
20
21
+ struct quicki2c_ddata ptl_ddata = {
22
+ .max_detect_size = MAX_RX_DETECT_SIZE_PTL ,
23
+ };
24
+
21
25
/* THC QuickI2C ACPI method to get device properties */
22
26
/* HIDI2C device method */
23
27
static guid_t i2c_hid_guid =
@@ -408,6 +412,50 @@ static void quicki2c_dev_deinit(struct quicki2c_device *qcdev)
408
412
qcdev -> state = QUICKI2C_DISABLED ;
409
413
}
410
414
415
+ /**
416
+ * quicki2c_dma_adv_enable - Configure and enable DMA advanced features
417
+ * @qcdev: Pointer to the quicki2c_device structure
418
+ *
419
+ * If platform supports THC DMA advanced features, such as max input size
420
+ * control or interrupt delay, configures and enables them.
421
+ */
422
+ static void quicki2c_dma_adv_enable (struct quicki2c_device * qcdev )
423
+ {
424
+ /*
425
+ * If platform supports max input size control feature and touch device
426
+ * max input length <= THC detect capability, enable the feature with device
427
+ * max input length.
428
+ */
429
+ if (qcdev -> ddata -> max_detect_size >=
430
+ le16_to_cpu (qcdev -> dev_desc .max_input_len )) {
431
+ thc_i2c_set_rx_max_size (qcdev -> thc_hw ,
432
+ le16_to_cpu (qcdev -> dev_desc .max_input_len ));
433
+ thc_i2c_rx_max_size_enable (qcdev -> thc_hw , true);
434
+ }
435
+
436
+ /* If platform supports interrupt delay feature, enable it with given delay */
437
+ if (qcdev -> ddata -> interrupt_delay ) {
438
+ thc_i2c_set_rx_int_delay (qcdev -> thc_hw ,
439
+ qcdev -> ddata -> interrupt_delay );
440
+ thc_i2c_rx_int_delay_enable (qcdev -> thc_hw , true);
441
+ }
442
+ }
443
+
444
+ /**
445
+ * quicki2c_dma_adv_disable - Disable DMA advanced features
446
+ * @qcdev: Pointer to the quicki2c device structure
447
+ *
448
+ * Disable all DMA advanced features if platform supports.
449
+ */
450
+ static void quicki2c_dma_adv_disable (struct quicki2c_device * qcdev )
451
+ {
452
+ if (qcdev -> ddata -> max_detect_size )
453
+ thc_i2c_rx_max_size_enable (qcdev -> thc_hw , false);
454
+
455
+ if (qcdev -> ddata -> interrupt_delay )
456
+ thc_i2c_rx_int_delay_enable (qcdev -> thc_hw , false);
457
+ }
458
+
411
459
/**
412
460
* quicki2c_dma_init - Configure THC DMA for QuickI2C device
413
461
* @qcdev: Pointer to the quicki2c_device structure
@@ -447,6 +495,9 @@ static int quicki2c_dma_init(struct quicki2c_device *qcdev)
447
495
return ret ;
448
496
}
449
497
498
+ if (qcdev -> ddata )
499
+ quicki2c_dma_adv_enable (qcdev );
500
+
450
501
return 0 ;
451
502
}
452
503
@@ -461,6 +512,9 @@ static void quicki2c_dma_deinit(struct quicki2c_device *qcdev)
461
512
{
462
513
thc_dma_unconfigure (qcdev -> thc_hw );
463
514
thc_dma_release (qcdev -> thc_hw );
515
+
516
+ if (qcdev -> ddata )
517
+ quicki2c_dma_adv_disable (qcdev );
464
518
}
465
519
466
520
/**
@@ -924,10 +978,10 @@ static const struct dev_pm_ops quicki2c_pm_ops = {
924
978
static const struct pci_device_id quicki2c_pci_tbl [] = {
925
979
{ PCI_DEVICE_DATA (INTEL , THC_LNL_DEVICE_ID_I2C_PORT1 , NULL ) },
926
980
{ PCI_DEVICE_DATA (INTEL , THC_LNL_DEVICE_ID_I2C_PORT2 , NULL ) },
927
- { PCI_DEVICE_DATA (INTEL , THC_PTL_H_DEVICE_ID_I2C_PORT1 , NULL ) },
928
- { PCI_DEVICE_DATA (INTEL , THC_PTL_H_DEVICE_ID_I2C_PORT2 , NULL ) },
929
- { PCI_DEVICE_DATA (INTEL , THC_PTL_U_DEVICE_ID_I2C_PORT1 , NULL ) },
930
- { PCI_DEVICE_DATA (INTEL , THC_PTL_U_DEVICE_ID_I2C_PORT2 , NULL ) },
981
+ { PCI_DEVICE_DATA (INTEL , THC_PTL_H_DEVICE_ID_I2C_PORT1 , & ptl_ddata ) },
982
+ { PCI_DEVICE_DATA (INTEL , THC_PTL_H_DEVICE_ID_I2C_PORT2 , & ptl_ddata ) },
983
+ { PCI_DEVICE_DATA (INTEL , THC_PTL_U_DEVICE_ID_I2C_PORT1 , & ptl_ddata ) },
984
+ { PCI_DEVICE_DATA (INTEL , THC_PTL_U_DEVICE_ID_I2C_PORT2 , & ptl_ddata ) },
931
985
{ }
932
986
};
933
987
MODULE_DEVICE_TABLE (pci , quicki2c_pci_tbl );
0 commit comments