Lines Matching refs:iqs62x_keys
46 struct iqs62x_keys_private *iqs62x_keys) in iqs62x_keys_parse_prop() argument
60 iqs62x_keys->keycodemax = ret; in iqs62x_keys_parse_prop()
63 iqs62x_keys->keycode, in iqs62x_keys_parse_prop()
64 iqs62x_keys->keycodemax); in iqs62x_keys_parse_prop()
70 for (i = 0; i < ARRAY_SIZE(iqs62x_keys->switches); i++) { in iqs62x_keys_parse_prop()
83 iqs62x_keys->switches[i].code = val; in iqs62x_keys_parse_prop()
84 iqs62x_keys->switches[i].enabled = true; in iqs62x_keys_parse_prop()
87 iqs62x_keys->switches[i].flag = (i == IQS62X_SW_HALL_N ? in iqs62x_keys_parse_prop()
91 iqs62x_keys->switches[i].flag = (i == IQS62X_SW_HALL_N ? in iqs62x_keys_parse_prop()
101 static int iqs62x_keys_init(struct iqs62x_keys_private *iqs62x_keys) in iqs62x_keys_init() argument
103 struct iqs62x_core *iqs62x = iqs62x_keys->iqs62x; in iqs62x_keys_init()
119 for (i = 0; i < iqs62x_keys->keycodemax; i++) { in iqs62x_keys_init()
120 if (iqs62x_keys->keycode[i] == KEY_RESERVED) in iqs62x_keys_init()
139 for (i = 0; i < ARRAY_SIZE(iqs62x_keys->switches); i++) { in iqs62x_keys_init()
140 if (!(iqs62x_keys->switches[i].enabled)) in iqs62x_keys_init()
143 flag = iqs62x_keys->switches[i].flag; in iqs62x_keys_init()
150 input_report_switch(iqs62x_keys->input, in iqs62x_keys_init()
151 iqs62x_keys->switches[i].code, in iqs62x_keys_init()
156 input_sync(iqs62x_keys->input); in iqs62x_keys_init()
166 if (iqs62x_keys->keycode[IQS62X_EVENT_WHEEL_UP] != KEY_RESERVED) in iqs62x_keys_init()
169 if (iqs62x_keys->keycode[IQS62X_EVENT_WHEEL_DN] != KEY_RESERVED) in iqs62x_keys_init()
177 iqs62x_keys->interval = val; in iqs62x_keys_init()
191 struct iqs62x_keys_private *iqs62x_keys; in iqs62x_keys_notifier() local
194 iqs62x_keys = container_of(notifier, struct iqs62x_keys_private, in iqs62x_keys_notifier()
198 ret = iqs62x_keys_init(iqs62x_keys); in iqs62x_keys_notifier()
200 dev_err(iqs62x_keys->input->dev.parent, in iqs62x_keys_notifier()
208 for (i = 0; i < iqs62x_keys->keycodemax; i++) { in iqs62x_keys_notifier()
210 event_data->interval == iqs62x_keys->interval) in iqs62x_keys_notifier()
213 input_report_key(iqs62x_keys->input, iqs62x_keys->keycode[i], in iqs62x_keys_notifier()
217 for (i = 0; i < ARRAY_SIZE(iqs62x_keys->switches); i++) in iqs62x_keys_notifier()
218 if (iqs62x_keys->switches[i].enabled) in iqs62x_keys_notifier()
219 input_report_switch(iqs62x_keys->input, in iqs62x_keys_notifier()
220 iqs62x_keys->switches[i].code, in iqs62x_keys_notifier()
222 BIT(iqs62x_keys->switches[i].flag)); in iqs62x_keys_notifier()
224 input_sync(iqs62x_keys->input); in iqs62x_keys_notifier()
226 if (event_data->interval == iqs62x_keys->interval) in iqs62x_keys_notifier()
234 input_report_key(iqs62x_keys->input, in iqs62x_keys_notifier()
235 iqs62x_keys->keycode[IQS62X_EVENT_WHEEL_UP], in iqs62x_keys_notifier()
237 input_sync(iqs62x_keys->input); in iqs62x_keys_notifier()
239 input_report_key(iqs62x_keys->input, in iqs62x_keys_notifier()
240 iqs62x_keys->keycode[IQS62X_EVENT_WHEEL_DN], in iqs62x_keys_notifier()
242 input_sync(iqs62x_keys->input); in iqs62x_keys_notifier()
245 iqs62x_keys->interval = event_data->interval; in iqs62x_keys_notifier()
253 struct iqs62x_keys_private *iqs62x_keys; in iqs62x_keys_probe() local
257 iqs62x_keys = devm_kzalloc(&pdev->dev, sizeof(*iqs62x_keys), in iqs62x_keys_probe()
259 if (!iqs62x_keys) in iqs62x_keys_probe()
262 platform_set_drvdata(pdev, iqs62x_keys); in iqs62x_keys_probe()
264 ret = iqs62x_keys_parse_prop(pdev, iqs62x_keys); in iqs62x_keys_probe()
272 input->keycodemax = iqs62x_keys->keycodemax; in iqs62x_keys_probe()
273 input->keycode = iqs62x_keys->keycode; in iqs62x_keys_probe()
274 input->keycodesize = sizeof(*iqs62x_keys->keycode); in iqs62x_keys_probe()
279 for (i = 0; i < iqs62x_keys->keycodemax; i++) in iqs62x_keys_probe()
280 if (iqs62x_keys->keycode[i] != KEY_RESERVED) in iqs62x_keys_probe()
282 iqs62x_keys->keycode[i]); in iqs62x_keys_probe()
284 for (i = 0; i < ARRAY_SIZE(iqs62x_keys->switches); i++) in iqs62x_keys_probe()
285 if (iqs62x_keys->switches[i].enabled) in iqs62x_keys_probe()
287 iqs62x_keys->switches[i].code); in iqs62x_keys_probe()
289 iqs62x_keys->iqs62x = iqs62x; in iqs62x_keys_probe()
290 iqs62x_keys->input = input; in iqs62x_keys_probe()
292 ret = iqs62x_keys_init(iqs62x_keys); in iqs62x_keys_probe()
298 ret = input_register_device(iqs62x_keys->input); in iqs62x_keys_probe()
304 iqs62x_keys->notifier.notifier_call = iqs62x_keys_notifier; in iqs62x_keys_probe()
305 ret = blocking_notifier_chain_register(&iqs62x_keys->iqs62x->nh, in iqs62x_keys_probe()
306 &iqs62x_keys->notifier); in iqs62x_keys_probe()
315 struct iqs62x_keys_private *iqs62x_keys = platform_get_drvdata(pdev); in iqs62x_keys_remove() local
318 ret = blocking_notifier_chain_unregister(&iqs62x_keys->iqs62x->nh, in iqs62x_keys_remove()
319 &iqs62x_keys->notifier); in iqs62x_keys_remove()