Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: iqs7222 - add support for IQS7222A v1.13+

IQS7222A revisions 1.13 and later widen the gesture multiplier from
x4 ms to x16 ms. Add a means to scale the gesture timings specified
in the device tree based on the revision of the device.

Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C")
Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/Y1SRdbK1Dp2q7O8o@nixie71
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Jeff LaBundy and committed by
Dmitry Torokhov
8d4c313c 97384a65

+111
+111
drivers/input/misc/iqs7222.c
··· 86 86 IQS7222_REG_KEY_TOUCH, 87 87 IQS7222_REG_KEY_DEBOUNCE, 88 88 IQS7222_REG_KEY_TAP, 89 + IQS7222_REG_KEY_TAP_LEGACY, 89 90 IQS7222_REG_KEY_AXIAL, 91 + IQS7222_REG_KEY_AXIAL_LEGACY, 90 92 IQS7222_REG_KEY_WHEEL, 91 93 IQS7222_REG_KEY_NO_WHEEL, 92 94 IQS7222_REG_KEY_RESERVED ··· 204 202 int allow_offset; 205 203 int event_offset; 206 204 int comms_offset; 205 + bool legacy_gesture; 207 206 struct iqs7222_reg_grp_desc reg_grps[IQS7222_NUM_REG_GRPS]; 208 207 }; 209 208 210 209 static const struct iqs7222_dev_desc iqs7222_devs[] = { 210 + { 211 + .prod_num = IQS7222_PROD_NUM_A, 212 + .fw_major = 1, 213 + .fw_minor = 13, 214 + .sldr_res = U8_MAX * 16, 215 + .touch_link = 1768, 216 + .allow_offset = 9, 217 + .event_offset = 10, 218 + .comms_offset = 12, 219 + .reg_grps = { 220 + [IQS7222_REG_GRP_STAT] = { 221 + .base = IQS7222_SYS_STATUS, 222 + .num_row = 1, 223 + .num_col = 8, 224 + }, 225 + [IQS7222_REG_GRP_CYCLE] = { 226 + .base = 0x8000, 227 + .num_row = 7, 228 + .num_col = 3, 229 + }, 230 + [IQS7222_REG_GRP_GLBL] = { 231 + .base = 0x8700, 232 + .num_row = 1, 233 + .num_col = 3, 234 + }, 235 + [IQS7222_REG_GRP_BTN] = { 236 + .base = 0x9000, 237 + .num_row = 12, 238 + .num_col = 3, 239 + }, 240 + [IQS7222_REG_GRP_CHAN] = { 241 + .base = 0xA000, 242 + .num_row = 12, 243 + .num_col = 6, 244 + }, 245 + [IQS7222_REG_GRP_FILT] = { 246 + .base = 0xAC00, 247 + .num_row = 1, 248 + .num_col = 2, 249 + }, 250 + [IQS7222_REG_GRP_SLDR] = { 251 + .base = 0xB000, 252 + .num_row = 2, 253 + .num_col = 11, 254 + }, 255 + [IQS7222_REG_GRP_GPIO] = { 256 + .base = 0xC000, 257 + .num_row = 1, 258 + .num_col = 3, 259 + }, 260 + [IQS7222_REG_GRP_SYS] = { 261 + .base = IQS7222_SYS_SETUP, 262 + .num_row = 1, 263 + .num_col = 13, 264 + }, 265 + }, 266 + }, 211 267 { 212 268 .prod_num = IQS7222_PROD_NUM_A, 213 269 .fw_major = 1, ··· 275 215 .allow_offset = 9, 276 216 .event_offset = 10, 277 217 .comms_offset = 12, 218 + .legacy_gesture = true, 278 219 .reg_grps = { 279 220 [IQS7222_REG_GRP_STAT] = { 280 221 .base = IQS7222_SYS_STATUS, ··· 935 874 .reg_offset = 9, 936 875 .reg_shift = 8, 937 876 .reg_width = 8, 877 + .val_pitch = 16, 878 + .label = "maximum gesture time", 879 + }, 880 + { 881 + .name = "azoteq,gesture-max-ms", 882 + .reg_grp = IQS7222_REG_GRP_SLDR, 883 + .reg_key = IQS7222_REG_KEY_TAP_LEGACY, 884 + .reg_offset = 9, 885 + .reg_shift = 8, 886 + .reg_width = 8, 938 887 .val_pitch = 4, 939 888 .label = "maximum gesture time", 940 889 }, ··· 952 881 .name = "azoteq,gesture-min-ms", 953 882 .reg_grp = IQS7222_REG_GRP_SLDR, 954 883 .reg_key = IQS7222_REG_KEY_TAP, 884 + .reg_offset = 9, 885 + .reg_shift = 3, 886 + .reg_width = 5, 887 + .val_pitch = 16, 888 + .label = "minimum gesture time", 889 + }, 890 + { 891 + .name = "azoteq,gesture-min-ms", 892 + .reg_grp = IQS7222_REG_GRP_SLDR, 893 + .reg_key = IQS7222_REG_KEY_TAP_LEGACY, 955 894 .reg_offset = 9, 956 895 .reg_shift = 3, 957 896 .reg_width = 5, ··· 979 898 .label = "gesture distance", 980 899 }, 981 900 { 901 + .name = "azoteq,gesture-dist", 902 + .reg_grp = IQS7222_REG_GRP_SLDR, 903 + .reg_key = IQS7222_REG_KEY_AXIAL_LEGACY, 904 + .reg_offset = 10, 905 + .reg_shift = 8, 906 + .reg_width = 8, 907 + .val_pitch = 16, 908 + .label = "gesture distance", 909 + }, 910 + { 982 911 .name = "azoteq,gesture-max-ms", 983 912 .reg_grp = IQS7222_REG_GRP_SLDR, 984 913 .reg_key = IQS7222_REG_KEY_AXIAL, 914 + .reg_offset = 10, 915 + .reg_shift = 0, 916 + .reg_width = 8, 917 + .val_pitch = 16, 918 + .label = "maximum gesture time", 919 + }, 920 + { 921 + .name = "azoteq,gesture-max-ms", 922 + .reg_grp = IQS7222_REG_GRP_SLDR, 923 + .reg_key = IQS7222_REG_KEY_AXIAL_LEGACY, 985 924 .reg_offset = 10, 986 925 .reg_shift = 0, 987 926 .reg_width = 8, ··· 2216 2115 if (!event_node) 2217 2116 continue; 2218 2117 2118 + /* 2119 + * Depending on the device, gestures are either offered using 2120 + * one of two timing resolutions, or are not supported at all. 2121 + */ 2219 2122 if (reg_offset) 2220 2123 reg_key = IQS7222_REG_KEY_RESERVED; 2124 + else if (dev_desc->legacy_gesture && 2125 + iqs7222_sl_events[i].reg_key == IQS7222_REG_KEY_TAP) 2126 + reg_key = IQS7222_REG_KEY_TAP_LEGACY; 2127 + else if (dev_desc->legacy_gesture && 2128 + iqs7222_sl_events[i].reg_key == IQS7222_REG_KEY_AXIAL) 2129 + reg_key = IQS7222_REG_KEY_AXIAL_LEGACY; 2221 2130 else 2222 2131 reg_key = iqs7222_sl_events[i].reg_key; 2223 2132