• Marcin Niestroj's avatar
    Input: goodix - use generic touchscreen_properties · fafef982
    Marcin Niestroj authored
    Use touchscreen_properties structure instead of implementing all
    properties by our own. It allows us to reuse generic code for parsing
    device-tree properties (which was implemented manually in the driver for
    now). Additionally, it allows us to report events using generic
    touchscreen_report_pos(), which automatically handles inverted and
    swapped axes.
    
    This fixes the issue with the custom code incorrectly handling case where
    ts->inverted_x and ts->swapped_x_y were true, but ts->inverted_y was
    false. Assuming we have 720x1280 touch panel, ts->abs_x_max == 1279 and
    ts->abs_y_max == 719 (because we inverted that in goodix_read_config()).
    Now let's assume that we received event from (0:0) position (in touch
    panel original coordinates). In function goodix_ts_report_touch() we
    calculate input_x as 1279, but after swapping input_y takes that value
    (which is more that maximum 719 value reported during initialization).
    
    Note that since touchscreen coordinates are 0-indexed, we now report
    touchscreen range as (0:size-1).
    
    Developed and tested on custom DT-based device with gt1151 touch
    panel.
    Signed-off-by: default avatarMarcin Niestroj <m.niestroj@grinn-global.com>
    [dtor: fix endianness annotation reported by sparse, handle errors when
     initializing MT slots]
    Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    fafef982
goodix.c 22.9 KB