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

From: Wang, Jiada
Date: Thu Apr 09 2020 - 05:11:44 EST


Hi Dmitrij

On 2020/04/07 23:56, Dmitry Osipenko wrote:
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.
yes, this part of change
squash fix from ndyer/linux/for-upstream commit c909ada856861f305653b127db3ea0fa60264331
- Input: atmel_mxt_ts - check data->input_dev is not null in mxt_input_sync()
seems due to some mistake, commit description about the squash,
start to be missing from v6 patch-set

I will separate it back into a single commit

...
+ 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.

I agree with you, in next version,
I will update this patch to also be compatible with legacy cfg name "maxtouch.cfg"

Thanks,
Jiada