@@ -35,6 +35,7 @@ enum goodix_irq_pin_access_method {
35
35
IRQ_PIN_ACCESS_NONE ,
36
36
IRQ_PIN_ACCESS_GPIO ,
37
37
IRQ_PIN_ACCESS_ACPI_GPIO ,
38
+ IRQ_PIN_ACCESS_ACPI_METHOD ,
38
39
};
39
40
40
41
struct goodix_chip_data {
@@ -532,6 +533,9 @@ static int goodix_send_cfg(struct goodix_ts_data *ts,
532
533
static int goodix_irq_direction_output (struct goodix_ts_data * ts ,
533
534
int value )
534
535
{
536
+ struct device * dev = & ts -> client -> dev ;
537
+ acpi_status status ;
538
+
535
539
switch (ts -> irq_pin_access_method ) {
536
540
case IRQ_PIN_ACCESS_NONE :
537
541
dev_err (& ts -> client -> dev ,
@@ -546,13 +550,20 @@ static int goodix_irq_direction_output(struct goodix_ts_data *ts,
546
550
* as active-low, use output_raw to avoid the value inversion.
547
551
*/
548
552
return gpiod_direction_output_raw (ts -> gpiod_int , value );
553
+ case IRQ_PIN_ACCESS_ACPI_METHOD :
554
+ status = acpi_execute_simple_method (ACPI_HANDLE (dev ),
555
+ "INTO" , value );
556
+ return ACPI_SUCCESS (status ) ? 0 : - EIO ;
549
557
}
550
558
551
559
return - EINVAL ; /* Never reached */
552
560
}
553
561
554
562
static int goodix_irq_direction_input (struct goodix_ts_data * ts )
555
563
{
564
+ struct device * dev = & ts -> client -> dev ;
565
+ acpi_status status ;
566
+
556
567
switch (ts -> irq_pin_access_method ) {
557
568
case IRQ_PIN_ACCESS_NONE :
558
569
dev_err (& ts -> client -> dev ,
@@ -562,6 +573,10 @@ static int goodix_irq_direction_input(struct goodix_ts_data *ts)
562
573
case IRQ_PIN_ACCESS_GPIO :
563
574
case IRQ_PIN_ACCESS_ACPI_GPIO :
564
575
return gpiod_direction_input (ts -> gpiod_int );
576
+ case IRQ_PIN_ACCESS_ACPI_METHOD :
577
+ status = acpi_evaluate_object (ACPI_HANDLE (dev ), "INTI" ,
578
+ NULL , NULL );
579
+ return ACPI_SUCCESS (status ) ? 0 : - EIO ;
565
580
}
566
581
567
582
return - EINVAL ; /* Never reached */
@@ -656,6 +671,11 @@ static const struct acpi_gpio_mapping acpi_goodix_int_last_gpios[] = {
656
671
{ },
657
672
};
658
673
674
+ static const struct acpi_gpio_mapping acpi_goodix_reset_only_gpios [] = {
675
+ { GOODIX_GPIO_RST_NAME "-gpios" , & first_gpio , 1 },
676
+ { },
677
+ };
678
+
659
679
static int goodix_resource (struct acpi_resource * ares , void * data )
660
680
{
661
681
struct goodix_ts_data * ts = data ;
@@ -713,6 +733,12 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)
713
733
} else if (ts -> gpio_count == 2 && ts -> gpio_int_idx == 1 ) {
714
734
ts -> irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO ;
715
735
gpio_mapping = acpi_goodix_int_last_gpios ;
736
+ } else if (ts -> gpio_count == 1 && ts -> gpio_int_idx == -1 &&
737
+ acpi_has_method (ACPI_HANDLE (dev ), "INTI" ) &&
738
+ acpi_has_method (ACPI_HANDLE (dev ), "INTO" )) {
739
+ dev_info (dev , "Using ACPI INTI and INTO methods for IRQ pin access\n" );
740
+ ts -> irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_METHOD ;
741
+ gpio_mapping = acpi_goodix_reset_only_gpios ;
716
742
} else if (is_byt () && ts -> gpio_count == 2 && ts -> gpio_int_idx == -1 ) {
717
743
dev_info (dev , "No ACPI GpioInt resource, assuming that the GPIO order is reset, int\n" );
718
744
ts -> irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO ;
@@ -809,6 +835,10 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
809
835
if (!ts -> gpiod_int || !ts -> gpiod_rst )
810
836
ts -> irq_pin_access_method = IRQ_PIN_ACCESS_NONE ;
811
837
break ;
838
+ case IRQ_PIN_ACCESS_ACPI_METHOD :
839
+ if (!ts -> gpiod_rst )
840
+ ts -> irq_pin_access_method = IRQ_PIN_ACCESS_NONE ;
841
+ break ;
812
842
default :
813
843
if (ts -> gpiod_int && ts -> gpiod_rst ) {
814
844
ts -> reset_controller_at_probe = true;
0 commit comments