Skip to content

Commit e070a97

Browse files
jwrdegoededtor
authored andcommitted
Input: goodix - make loading the config from disk independent from the GPIO setup
At least on X86 ACPI platforms it is not necessary to load the touchscreen controller config from disk, if it needs to be loaded this has already been done by the BIOS / UEFI firmware. Even on other (e.g. devicetree) platforms the config-loading as currently done has the issue that the loaded cfg file is based on the controller model, but the actual cfg is device specific, so the cfg files are not part of linux-firmware and this can only work with a device specific OS image which includes the cfg file. And we do not need access to the GPIOs at all to load the config, if we do not have access we can still load the config. So all in all tying the decision to try to load the config from disk to being able to access the GPIOs is not desirable. This commit adds a new load_cfg_from_disk boolean to control the firmware loading instead. This commits sets the new bool to true when we set irq_pin_access_method to IRQ_PIN_ACCESS_GPIO, so there are no functional changes. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1786317 BugLink: nexus511/gpd-ubuntu-packages#10 BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199207 Reviewed-by: Bastien Nocera <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 49db399 commit e070a97

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/input/touchscreen/goodix.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct goodix_ts_data {
5656
u16 id;
5757
u16 version;
5858
const char *cfg_name;
59+
bool load_cfg_from_disk;
5960
struct completion firmware_loading_complete;
6061
unsigned long irq_flags;
6162
enum goodix_irq_pin_access_method irq_pin_access_method;
@@ -670,8 +671,10 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
670671

671672
ts->gpiod_rst = gpiod;
672673

673-
if (ts->gpiod_int && ts->gpiod_rst)
674+
if (ts->gpiod_int && ts->gpiod_rst) {
675+
ts->load_cfg_from_disk = true;
674676
ts->irq_pin_access_method = IRQ_PIN_ACCESS_GPIO;
677+
}
675678

676679
return 0;
677680
}
@@ -974,7 +977,7 @@ static int goodix_ts_probe(struct i2c_client *client,
974977

975978
ts->chip = goodix_get_chip_data(ts->id);
976979

977-
if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_GPIO) {
980+
if (ts->load_cfg_from_disk) {
978981
/* update device config */
979982
ts->cfg_name = devm_kasprintf(&client->dev, GFP_KERNEL,
980983
"goodix_%d_cfg.bin", ts->id);
@@ -1005,7 +1008,7 @@ static int goodix_ts_remove(struct i2c_client *client)
10051008
{
10061009
struct goodix_ts_data *ts = i2c_get_clientdata(client);
10071010

1008-
if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_GPIO)
1011+
if (ts->load_cfg_from_disk)
10091012
wait_for_completion(&ts->firmware_loading_complete);
10101013

10111014
return 0;
@@ -1017,14 +1020,15 @@ static int __maybe_unused goodix_suspend(struct device *dev)
10171020
struct goodix_ts_data *ts = i2c_get_clientdata(client);
10181021
int error;
10191022

1023+
if (ts->load_cfg_from_disk)
1024+
wait_for_completion(&ts->firmware_loading_complete);
1025+
10201026
/* We need gpio pins to suspend/resume */
10211027
if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_NONE) {
10221028
disable_irq(client->irq);
10231029
return 0;
10241030
}
10251031

1026-
wait_for_completion(&ts->firmware_loading_complete);
1027-
10281032
/* Free IRQ as IRQ pin is used as output in the suspend sequence */
10291033
goodix_free_irq(ts);
10301034

0 commit comments

Comments
 (0)