Commit c9c20ee3 authored by Hans de Goede's avatar Hans de Goede Committed by Dmitry Torokhov

Input: goodix - fix compilation when ACPI support is disabled

acpi_evaluate_object() and acpi_execute_simple_method() are not part of
the group of ACPI related functions which get stubbed by
include/linux/acpi.h when ACPI support is disabled, so the
IRQ_PIN_ACCESS_ACPI_METHOD handling code must be stubbed out.

For consistency use the same #if condition as which is used to replace
goodix_add_acpi_gpio_mappings with a stub.

Fixes: c5fca485 ("Input: goodix - add support for controlling the IRQ pin through ACPI methods")
Reported-by: default avatarkbuild test robot <lkp@intel.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200401014529.GL75430@dtor-ws
[dtor: stubbed out the ACPI method accessors]
Reviewed-by: default avatarBastien Nocera <hadess@hadess.net>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 10ad4845
...@@ -63,6 +63,11 @@ ...@@ -63,6 +63,11 @@
#define MAX_CONTACTS_LOC 5 #define MAX_CONTACTS_LOC 5
#define TRIGGER_LOC 6 #define TRIGGER_LOC 6
/* Our special handling for GPIO accesses through ACPI is x86 specific */
#if defined CONFIG_X86 && defined CONFIG_ACPI
#define ACPI_GPIO_SUPPORT
#endif
struct goodix_ts_data; struct goodix_ts_data;
enum goodix_irq_pin_access_method { enum goodix_irq_pin_access_method {
...@@ -600,12 +605,42 @@ static int goodix_send_cfg(struct goodix_ts_data *ts, const u8 *cfg, int len) ...@@ -600,12 +605,42 @@ static int goodix_send_cfg(struct goodix_ts_data *ts, const u8 *cfg, int len)
return 0; return 0;
} }
static int goodix_irq_direction_output(struct goodix_ts_data *ts, #ifdef ACPI_GPIO_SUPPORT
int value) static int goodix_pin_acpi_direction_input(struct goodix_ts_data *ts)
{ {
struct device *dev = &ts->client->dev; acpi_handle handle = ACPI_HANDLE(&ts->client->dev);
acpi_status status; acpi_status status;
status = acpi_evaluate_object(handle, "INTI", NULL, NULL);
return ACPI_SUCCESS(status) ? 0 : -EIO;
}
static int goodix_pin_acpi_output_method(struct goodix_ts_data *ts, int value)
{
acpi_handle handle = ACPI_HANDLE(&ts->client->dev);
acpi_status status;
status = acpi_execute_simple_method(handle, "INTO", value);
return ACPI_SUCCESS(status) ? 0 : -EIO;
}
#else
static int goodix_pin_acpi_direction_input(struct goodix_ts_data *ts)
{
dev_err(&ts->client->dev,
"%s called on device without ACPI support\n", __func__);
return -EINVAL;
}
static int goodix_pin_acpi_output_method(struct goodix_ts_data *ts, int value)
{
dev_err(&ts->client->dev,
"%s called on device without ACPI support\n", __func__);
return -EINVAL;
}
#endif
static int goodix_irq_direction_output(struct goodix_ts_data *ts, int value)
{
switch (ts->irq_pin_access_method) { switch (ts->irq_pin_access_method) {
case IRQ_PIN_ACCESS_NONE: case IRQ_PIN_ACCESS_NONE:
dev_err(&ts->client->dev, dev_err(&ts->client->dev,
...@@ -621,9 +656,7 @@ static int goodix_irq_direction_output(struct goodix_ts_data *ts, ...@@ -621,9 +656,7 @@ static int goodix_irq_direction_output(struct goodix_ts_data *ts,
*/ */
return gpiod_direction_output_raw(ts->gpiod_int, value); return gpiod_direction_output_raw(ts->gpiod_int, value);
case IRQ_PIN_ACCESS_ACPI_METHOD: case IRQ_PIN_ACCESS_ACPI_METHOD:
status = acpi_execute_simple_method(ACPI_HANDLE(dev), return goodix_pin_acpi_output_method(ts, value);
"INTO", value);
return ACPI_SUCCESS(status) ? 0 : -EIO;
} }
return -EINVAL; /* Never reached */ return -EINVAL; /* Never reached */
...@@ -631,9 +664,6 @@ static int goodix_irq_direction_output(struct goodix_ts_data *ts, ...@@ -631,9 +664,6 @@ static int goodix_irq_direction_output(struct goodix_ts_data *ts,
static int goodix_irq_direction_input(struct goodix_ts_data *ts) static int goodix_irq_direction_input(struct goodix_ts_data *ts)
{ {
struct device *dev = &ts->client->dev;
acpi_status status;
switch (ts->irq_pin_access_method) { switch (ts->irq_pin_access_method) {
case IRQ_PIN_ACCESS_NONE: case IRQ_PIN_ACCESS_NONE:
dev_err(&ts->client->dev, dev_err(&ts->client->dev,
...@@ -641,12 +671,11 @@ static int goodix_irq_direction_input(struct goodix_ts_data *ts) ...@@ -641,12 +671,11 @@ static int goodix_irq_direction_input(struct goodix_ts_data *ts)
__func__); __func__);
return -EINVAL; return -EINVAL;
case IRQ_PIN_ACCESS_GPIO: case IRQ_PIN_ACCESS_GPIO:
return gpiod_direction_input(ts->gpiod_int);
case IRQ_PIN_ACCESS_ACPI_GPIO: case IRQ_PIN_ACCESS_ACPI_GPIO:
return gpiod_direction_input(ts->gpiod_int); return gpiod_direction_input(ts->gpiod_int);
case IRQ_PIN_ACCESS_ACPI_METHOD: case IRQ_PIN_ACCESS_ACPI_METHOD:
status = acpi_evaluate_object(ACPI_HANDLE(dev), "INTI", return goodix_pin_acpi_direction_input(ts);
NULL, NULL);
return ACPI_SUCCESS(status) ? 0 : -EIO;
} }
return -EINVAL; /* Never reached */ return -EINVAL; /* Never reached */
...@@ -710,7 +739,7 @@ static int goodix_reset(struct goodix_ts_data *ts) ...@@ -710,7 +739,7 @@ static int goodix_reset(struct goodix_ts_data *ts)
return 0; return 0;
} }
#if defined CONFIG_X86 && defined CONFIG_ACPI #ifdef ACPI_GPIO_SUPPORT
#include <asm/cpu_device_id.h> #include <asm/cpu_device_id.h>
#include <asm/intel-family.h> #include <asm/intel-family.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment