Re: [PATCH v10 20/55] Input: atmel_mxt_ts - handle cfg filename via pdata/sysfs

From: Dmitry Osipenko
Date: Tue Apr 07 2020 - 10:56:29 EST


31.03.2020 13:50, Jiada Wang ÐÐÑÐÑ:
> From: Nick Dyer <nick.dyer@xxxxxxxxxxx>
>
> There may be multiple maXTouch chips on a single device which will require
> different configuration files. Add a platform data value for the
> configuration filename.
>
> Add sysfs entry to write configuration file if the platform data is not
> set.
>
> Split out the object initialisation code from mxt_initialize() into
> mxt_configure_objects() to allow this.
>
> Signed-off-by: Nick Dyer <nick.dyer@xxxxxxxxxxx>
> Acked-by: Yufeng Shen <miletus@xxxxxxxxxxxx>
> (cherry picked from ndyer/linux/for-upstream commit 71a2a4d1954460b949a16b607f72bafab294ca79)
> [gdavis: Resolve forward port conflicts due to applying upstream
> commit 96a938aa214e ("Input: atmel_mxt_ts - remove platform
> data support").]
> Signed-off-by: George G. Davis <george_davis@xxxxxxxxxx>
> [gdavis: Squash fix from Vladimir Zapolskiy:
> - Input: atmel_mxt_ts - fix error paths in mxt_configure_objects()]
> Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@xxxxxxxxxx>
> [jiada: Separate Documentation/ portion change to another commit
> Rename mxt_update_cfg_store to update_cfg_store
> Replace DEVICE_ATTR with DEVICE_ATTR_WO]
> Signed-off-by: Jiada Wang <jiada_wang@xxxxxxxxxx>
> ---
> drivers/input/touchscreen/atmel_mxt_ts.c | 109 +++++++++++++++++++----
> 1 file changed, 94 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 720574417219..d1865250f492 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -34,7 +34,6 @@
> #include <dt-bindings/input/atmel_mxt_ts.h>
>
> /* Configuration file */
> -#define MXT_CFG_NAME "maxtouch.cfg"
> #define MXT_CFG_MAGIC "OBP_RAW V1"
...

> static void mxt_input_sync(struct mxt_data *data)
> {
> - input_mt_report_pointer_emulation(data->input_dev,
> - data->t19_num_keys);
> - input_sync(data->input_dev);
> + if (data->input_dev) {
> + input_mt_report_pointer_emulation(data->input_dev,
> + data->t19_num_keys);
> + input_sync(data->input_dev);
> + }
> }

Looks like this hunk shouldn't belong to this patch.

...
> + if (data->pcfg_name)
> + mxt_update_file_name(&data->client->dev,
> + &data->cfg_name,
> + data->pcfg_name,
> + strlen(data->pcfg_name));

This looks wrong to me because I think the cfg_name should fall back to
"maxtouch.cfg" if atmel,cfg_name isn't specified in device-tree,
otherwise this commit may break devices that use an older device-tree.