2020-08-27 01:45:19

by Johnny Chuang

[permalink] [raw]
Subject: [PATCH v2] Input: elants_i2c - Report resolution of ABS_MT_TOUCH_MAJOR by FW information.

This patch adds a new behavior to report touch major resolution
based on information provided by firmware.

In initial process, driver acquires touch information from touch ic.
This information contains of one flag about reporting resolution of
ABS_MT_TOUCH_MAJOR is needed, or not.
Touch driver will report touch major resolution after geting this flag.

Signed-off-by: Johnny Chuang <[email protected]>
---
Changes in v2:
- register real resolution instead of true/false.
---
drivers/input/touchscreen/elants_i2c.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index b0bd5bb..dc7f4a5 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -151,6 +151,7 @@ struct elants_data {

bool wake_irq_enabled;
bool keep_power_in_suspend;
+ u8 report_major_resolution;

/* Must be last to be used for DMA operations */
u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned;
@@ -459,6 +460,9 @@ static int elants_i2c_query_ts_info(struct elants_data *ts)
rows = resp[2] + resp[6] + resp[10];
cols = resp[3] + resp[7] + resp[11];

+ /* Decide if report resolution of ABS_MT_TOUCH_MAJOR */
+ ts->report_major_resolution = resp[16];
+
/* Process mm_to_pixel information */
error = elants_i2c_execute_command(client,
get_osr_cmd, sizeof(get_osr_cmd),
@@ -1325,6 +1329,8 @@ static int elants_i2c_probe(struct i2c_client *client,
0, MT_TOOL_PALM, 0, 0);
input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
+ if (ts->report_major_resolution > 0)
+ input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, ts->report_major_resolution);

touchscreen_parse_properties(ts->input, true, &ts->prop);

--
2.7.4


2020-08-27 17:57:32

by Harry Cutts

[permalink] [raw]
Subject: Re: [PATCH v2] Input: elants_i2c - Report resolution of ABS_MT_TOUCH_MAJOR by FW information.

On Wed, 26 Aug 2020 at 18:44, Johnny Chuang <[email protected]> wrote:
>
> This patch adds a new behavior to report touch major resolution
> based on information provided by firmware.
>
> In initial process, driver acquires touch information from touch ic.
> This information contains of one flag about reporting resolution of
> ABS_MT_TOUCH_MAJOR is needed, or not.
> Touch driver will report touch major resolution after geting this flag.

I think this paragraph needs updating now that the firmware's
reporting the actual resolution instead of a flag.

>
> Signed-off-by: Johnny Chuang <[email protected]>
> ---
> Changes in v2:
> - register real resolution instead of true/false.
> ---
> drivers/input/touchscreen/elants_i2c.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index b0bd5bb..dc7f4a5 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -151,6 +151,7 @@ struct elants_data {
>
> bool wake_irq_enabled;
> bool keep_power_in_suspend;
> + u8 report_major_resolution;
>
> /* Must be last to be used for DMA operations */
> u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned;
> @@ -459,6 +460,9 @@ static int elants_i2c_query_ts_info(struct elants_data *ts)
> rows = resp[2] + resp[6] + resp[10];
> cols = resp[3] + resp[7] + resp[11];
>
> + /* Decide if report resolution of ABS_MT_TOUCH_MAJOR */
> + ts->report_major_resolution = resp[16];
> +
> /* Process mm_to_pixel information */
> error = elants_i2c_execute_command(client,
> get_osr_cmd, sizeof(get_osr_cmd),
> @@ -1325,6 +1329,8 @@ static int elants_i2c_probe(struct i2c_client *client,
> 0, MT_TOOL_PALM, 0, 0);
> input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
> input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
> + if (ts->report_major_resolution > 0)
> + input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, ts->report_major_resolution);
>
> touchscreen_parse_properties(ts->input, true, &ts->prop);
>
> --
> 2.7.4
>

Harry Cutts
Chrome OS Touch/Input team

2020-08-28 01:57:46

by Johnny.Chuang

[permalink] [raw]
Subject: RE: [PATCH v2] Input: elants_i2c - Report resolution of ABS_MT_TOUCH_MAJOR by FW information.

> On Wed, 26 Aug 2020 at 18:44, Johnny Chuang
> <[email protected]> wrote:
> >
> > This patch adds a new behavior to report touch major resolution based
> > on information provided by firmware.
> >
> > In initial process, driver acquires touch information from touch ic.
> > This information contains of one flag about reporting resolution of
> > ABS_MT_TOUCH_MAJOR is needed, or not.
> > Touch driver will report touch major resolution after geting this flag.
>
> I think this paragraph needs updating now that the firmware's reporting the
> actual resolution instead of a flag.

Thanks Harry, I will update patch v3 for this.

>
> >
> > Signed-off-by: Johnny Chuang <[email protected]>
> > ---
> > Changes in v2:
> > - register real resolution instead of true/false.
> > ---
> > drivers/input/touchscreen/elants_i2c.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/input/touchscreen/elants_i2c.c
> > b/drivers/input/touchscreen/elants_i2c.c
> > index b0bd5bb..dc7f4a5 100644
> > --- a/drivers/input/touchscreen/elants_i2c.c
> > +++ b/drivers/input/touchscreen/elants_i2c.c
> > @@ -151,6 +151,7 @@ struct elants_data {
> >
> > bool wake_irq_enabled;
> > bool keep_power_in_suspend;
> > + u8 report_major_resolution;
> >
> > /* Must be last to be used for DMA operations */
> > u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned; @@ -459,6
> > +460,9 @@ static int elants_i2c_query_ts_info(struct elants_data *ts)
> > rows = resp[2] + resp[6] + resp[10];
> > cols = resp[3] + resp[7] + resp[11];
> >
> > + /* Decide if report resolution of ABS_MT_TOUCH_MAJOR */
> > + ts->report_major_resolution = resp[16];
> > +
> > /* Process mm_to_pixel information */
> > error = elants_i2c_execute_command(client,
> > get_osr_cmd,
> > sizeof(get_osr_cmd), @@ -1325,6 +1329,8 @@ static int
> elants_i2c_probe(struct i2c_client *client,
> > 0, MT_TOOL_PALM, 0, 0);
> > input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
> > input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
> > + if (ts->report_major_resolution > 0)
> > + input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR,
> > + ts->report_major_resolution);
> >
> > touchscreen_parse_properties(ts->input, true, &ts->prop);
> >
> > --
> > 2.7.4
> >
>
> Harry Cutts
> Chrome OS Touch/Input team

--
Johnny