Message ID | 20240502185819.788716-1-andreas@kemnade.info |
---|---|
Headers | show |
Series | Input: Add ektf2232 support | expand |
On Thu, May 2, 2024 at 9:58 PM Andreas Kemnade <andreas@kemnade.info> wrote: > > The chip is similar, but has status bits at different positions, > so use the correct bits. ... > + if (ts->shifted_status) { > + ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 1)); > + ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 2)); BIT(0) BIT(1) > + } else { > + ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 2)); > + ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 4)); BIT(1) BIT(2) > + } ... > + if (dev->of_node && > + of_device_is_compatible(dev->of_node, "elan,ektf2232")) if (device_is_compatible(...)) > + ts->shifted_status = true;
On Thu, May 02, 2024 at 10:16:01PM +0300, Andy Shevchenko wrote: > On Thu, May 2, 2024 at 9:58 PM Andreas Kemnade <andreas@kemnade.info> wrote: > > > > The chip is similar, but has status bits at different positions, > > so use the correct bits. > > ... > > > + if (ts->shifted_status) { Instead of the flag I think it would be better if you had ts->status_shift and did status = buf[7] >> ts->status_shift; ektf2127_report2_contact(ts, 0, &buf[1], status & BIT(0)); ektf2127_report2_contact(ts, 1, &buf[4], status & BIT(1)); > > + ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 1)); > > + ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 2)); > > BIT(0) > BIT(1) > > > + } else { > > + ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 2)); > > + ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 4)); > > BIT(1) > BIT(2) > > > + } > > ... > > > + if (dev->of_node && > > + of_device_is_compatible(dev->of_node, "elan,ektf2232")) > > if (device_is_compatible(...)) Actually I think this better come from data obtained via device_get_match_data(). > > > + ts->shifted_status = true; > Thanks.
On Fri, May 3, 2024 at 2:10 AM Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > On Thu, May 02, 2024 at 10:16:01PM +0300, Andy Shevchenko wrote: > > On Thu, May 2, 2024 at 9:58 PM Andreas Kemnade <andreas@kemnade.info> wrote: ... > > > + if (ts->shifted_status) { > > Instead of the flag I think it would be better if you had > ts->status_shift and did > > status = buf[7] >> ts->status_shift; > ektf2127_report2_contact(ts, 0, &buf[1], status & BIT(0)); > ektf2127_report2_contact(ts, 1, &buf[4], status & BIT(1)); > > > > + ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 1)); > > > + ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 2)); > > > > BIT(0) > > BIT(1) > > > > > + } else { > > > + ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 2)); > > > + ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 4)); > > > > BIT(1) > > BIT(2) > > > > > + } ... > > > + if (dev->of_node && > > > + of_device_is_compatible(dev->of_node, "elan,ektf2232")) > > > > if (device_is_compatible(...)) > > Actually I think this better come from data obtained via > device_get_match_data(). > > > > + ts->shifted_status = true; I agree with your comments. Hopefully the author as well.