1818#include "quicki2c-hid.h"
1919#include "quicki2c-protocol.h"
2020
21+ struct quicki2c_ddata ptl_ddata = {
22+ .max_detect_size = MAX_RX_DETECT_SIZE_PTL ,
23+ };
24+
2125/* THC QuickI2C ACPI method to get device properties */
2226/* HIDI2C device method */
2327static guid_t i2c_hid_guid =
@@ -408,6 +412,50 @@ static void quicki2c_dev_deinit(struct quicki2c_device *qcdev)
408412 qcdev -> state = QUICKI2C_DISABLED ;
409413}
410414
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+
411459/**
412460 * quicki2c_dma_init - Configure THC DMA for QuickI2C device
413461 * @qcdev: Pointer to the quicki2c_device structure
@@ -447,6 +495,9 @@ static int quicki2c_dma_init(struct quicki2c_device *qcdev)
447495 return ret ;
448496 }
449497
498+ if (qcdev -> ddata )
499+ quicki2c_dma_adv_enable (qcdev );
500+
450501 return 0 ;
451502}
452503
@@ -461,6 +512,9 @@ static void quicki2c_dma_deinit(struct quicki2c_device *qcdev)
461512{
462513 thc_dma_unconfigure (qcdev -> thc_hw );
463514 thc_dma_release (qcdev -> thc_hw );
515+
516+ if (qcdev -> ddata )
517+ quicki2c_dma_adv_disable (qcdev );
464518}
465519
466520/**
@@ -924,10 +978,10 @@ static const struct dev_pm_ops quicki2c_pm_ops = {
924978static const struct pci_device_id quicki2c_pci_tbl [] = {
925979 { PCI_DEVICE_DATA (INTEL , THC_LNL_DEVICE_ID_I2C_PORT1 , NULL ) },
926980 { 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 ) },
931985 { }
932986};
933987MODULE_DEVICE_TABLE (pci , quicki2c_pci_tbl );
0 commit comments