Re: [PATCH 3/6] input: elants: support common touchscreen DT properties
From: Michał Mirosław
Date: Mon Dec 09 2019 - 21:38:23 EST
On Tue, Dec 10, 2019 at 04:03:18AM +0300, Dmitry Osipenko wrote:
> 10.12.2019 03:19, MichaÅ MirosÅaw ÐÐÑÐÑ:
> > Support common DT properties like axis inversions to complement
> > information obtained from device's firmware.a
[...]
> > @@ -498,10 +498,10 @@ static int elants_i2c_query_ts_info(struct elants_data *ts)
> > rows, cols, osr);
> > } else {
> > /* translate trace number to TS resolution */
> > - ts->x_max = ELAN_TS_RESOLUTION(rows, osr);
> > - ts->x_res = DIV_ROUND_CLOSEST(ts->x_max, phy_x);
> > - ts->y_max = ELAN_TS_RESOLUTION(cols, osr);
> > - ts->y_res = DIV_ROUND_CLOSEST(ts->y_max, phy_y);
> > + ts->prop.max_x = ELAN_TS_RESOLUTION(rows, osr);
> > + ts->x_res = DIV_ROUND_CLOSEST(ts->prop.max_x, phy_x);
> > + ts->prop.max_y = ELAN_TS_RESOLUTION(cols, osr);
> > + ts->y_res = DIV_ROUND_CLOSEST(ts->prop.max_y, phy_y);
> > }
> >
> > return 0;
> > @@ -833,8 +833,7 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf,
> >
> > input_mt_slot(input, i);
> > input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
> > - input_event(input, EV_ABS, ABS_MT_POSITION_X, x);
> > - input_event(input, EV_ABS, ABS_MT_POSITION_Y, y);
> > + touchscreen_report_pos(input, &ts->prop, x, y, true);
> > input_event(input, EV_ABS, ABS_MT_PRESSURE, p);
> > input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, w);
> >
> > @@ -1251,13 +1250,15 @@ static int elants_i2c_probe(struct i2c_client *client,
> > ts->input->name = "Elan Touchscreen";
> > ts->input->id.bustype = BUS_I2C;
> >
> > + touchscreen_parse_properties(ts->input, true, &ts->prop);
>
> Shouldn't this function be invoked after setting the max x/y sizes with
> the hardware values? That's what all other drivers do and then you won't
> need to set the ts->prop.max_x/y above in the code.
This is done later in the series - this patch only adds axis inversion
support and ignores DT-provided sizes.
Best Regards,
MichaÅ MirosÅaw