2323
2424static struct quicki2c_ddata ptl_ddata = {
2525 .max_detect_size = MAX_RX_DETECT_SIZE_PTL ,
26+ .max_interrupt_delay = MAX_RX_INTERRUPT_DELAY ,
2627};
2728
2829/* THC QuickI2C ACPI method to get device properties */
@@ -200,6 +201,21 @@ static int quicki2c_get_acpi_resources(struct quicki2c_device *qcdev)
200201 return - EOPNOTSUPP ;
201202 }
202203
204+ if (qcdev -> ddata ) {
205+ qcdev -> i2c_max_frame_size_enable = i2c_config .FSEN ;
206+ qcdev -> i2c_int_delay_enable = i2c_config .INDE ;
207+
208+ if (i2c_config .FSVL <= qcdev -> ddata -> max_detect_size )
209+ qcdev -> i2c_max_frame_size = i2c_config .FSVL ;
210+ else
211+ qcdev -> i2c_max_frame_size = qcdev -> ddata -> max_detect_size ;
212+
213+ if (i2c_config .INDV <= qcdev -> ddata -> max_interrupt_delay )
214+ qcdev -> i2c_int_delay = i2c_config .INDV ;
215+ else
216+ qcdev -> i2c_int_delay = qcdev -> ddata -> max_interrupt_delay ;
217+ }
218+
203219 return 0 ;
204220}
205221
@@ -441,17 +457,24 @@ static void quicki2c_dma_adv_enable(struct quicki2c_device *qcdev)
441457 * max input length <= THC detect capability, enable the feature with device
442458 * max input length.
443459 */
444- if (qcdev -> ddata -> max_detect_size >=
445- le16_to_cpu (qcdev -> dev_desc .max_input_len )) {
446- thc_i2c_set_rx_max_size (qcdev -> thc_hw ,
447- le16_to_cpu (qcdev -> dev_desc .max_input_len ));
460+ if (qcdev -> i2c_max_frame_size_enable ) {
461+ if (qcdev -> i2c_max_frame_size >=
462+ le16_to_cpu (qcdev -> dev_desc .max_input_len )) {
463+ thc_i2c_set_rx_max_size (qcdev -> thc_hw ,
464+ le16_to_cpu (qcdev -> dev_desc .max_input_len ));
465+ } else {
466+ dev_warn (qcdev -> dev ,
467+ "Max frame size is smaller than hid max input length!" );
468+ thc_i2c_set_rx_max_size (qcdev -> thc_hw ,
469+ le16_to_cpu (qcdev -> i2c_max_frame_size ));
470+ }
448471 thc_i2c_rx_max_size_enable (qcdev -> thc_hw , true);
449472 }
450473
451474 /* If platform supports interrupt delay feature, enable it with given delay */
452- if (qcdev -> ddata -> interrupt_delay ) {
475+ if (qcdev -> i2c_int_delay_enable ) {
453476 thc_i2c_set_rx_int_delay (qcdev -> thc_hw ,
454- qcdev -> ddata -> interrupt_delay );
477+ qcdev -> i2c_int_delay * 10 );
455478 thc_i2c_rx_int_delay_enable (qcdev -> thc_hw , true);
456479 }
457480}
@@ -464,10 +487,10 @@ static void quicki2c_dma_adv_enable(struct quicki2c_device *qcdev)
464487 */
465488static void quicki2c_dma_adv_disable (struct quicki2c_device * qcdev )
466489{
467- if (qcdev -> ddata -> max_detect_size )
490+ if (qcdev -> i2c_max_frame_size_enable )
468491 thc_i2c_rx_max_size_enable (qcdev -> thc_hw , false);
469492
470- if (qcdev -> ddata -> interrupt_delay )
493+ if (qcdev -> i2c_int_delay_enable )
471494 thc_i2c_rx_int_delay_enable (qcdev -> thc_hw , false);
472495}
473496
0 commit comments