From: Hans de Goede Date: Tue, 21 Sep 2021 04:08:44 +0000 (-0700) Subject: Input: goodix - allow specifying the config filename X-Git-Tag: microblaze-v5.18~63^2~13^2~39 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=20e317222eeabd74e9ff76cf4daf85f961f608dc;p=linux-2.6-microblaze.git Input: goodix - allow specifying the config filename The config which needs to be send to the controller on some device-models is model-specific. Allow specifying a model-specific filename through a device-property, rather then always using a fixed filename. Note the "goodix,config-name" device-property used by this is *not* documented in the Documentation/devicetree/bindings/input/touchscreen/goodix.yaml device-tree bindings for now. Not documenting these is intentional. This is done because this code has only been tested on x86/ACPI so far, where devicetree is not used. Instead these properties are set through a software-fwnode attached to the device by the drivers/platform/x86/touchscreen_dmi.c code. This means that the use of this property for now is purely a kernel-internal thing and the name/working of the property may still be changed for now. Reviewed-by: Bastien Nocera Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20210920150643.155872-6-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index f91a92c998a2..75c53786516f 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -1165,6 +1165,7 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct goodix_ts_data *ts; + const char *cfg_name; int error; dev_dbg(&client->dev, "I2C Address: 0x%02x\n", client->addr); @@ -1238,10 +1239,15 @@ reset: if (ts->load_cfg_from_disk) { /* update device config */ - ts->cfg_name = devm_kasprintf(&client->dev, GFP_KERNEL, - "goodix_%s_cfg.bin", ts->id); - if (!ts->cfg_name) - return -ENOMEM; + error = device_property_read_string(&client->dev, + "goodix,config-name", + &cfg_name); + if (!error) + snprintf(ts->cfg_name, sizeof(ts->cfg_name), + "goodix/%s", cfg_name); + else + snprintf(ts->cfg_name, sizeof(ts->cfg_name), + "goodix_%s_cfg.bin", ts->id); error = request_firmware_nowait(THIS_MODULE, true, ts->cfg_name, &client->dev, GFP_KERNEL, ts, diff --git a/drivers/input/touchscreen/goodix.h b/drivers/input/touchscreen/goodix.h index 0b88554ba2ae..b1d1bc004091 100644 --- a/drivers/input/touchscreen/goodix.h +++ b/drivers/input/touchscreen/goodix.h @@ -52,8 +52,8 @@ struct goodix_ts_data { int gpio_count; int gpio_int_idx; char id[GOODIX_ID_MAX_LEN + 1]; + char cfg_name[64]; u16 version; - const char *cfg_name; bool reset_controller_at_probe; bool load_cfg_from_disk; struct completion firmware_loading_complete;