Lines Matching refs:key

162 	struct gpiokeys_key *key;  in gpiokeys_attach()  local
184 key = kmem_zalloc(sizeof(*key), KM_SLEEP); in gpiokeys_attach()
185 key->key_sc = sc; in gpiokeys_attach()
186 key->key_phandle = child; in gpiokeys_attach()
187 key->key_code = code; in gpiokeys_attach()
188 key->key_label = kmem_zalloc(len, KM_SLEEP); in gpiokeys_attach()
189 if (OF_getprop(child, "label", key->key_label, len) != len) { in gpiokeys_attach()
190 kmem_free(key->key_label, len); in gpiokeys_attach()
191 kmem_free(key, sizeof(*key)); in gpiokeys_attach()
194 key->key_debounce = debounce; in gpiokeys_attach()
195 key->key_pin = fdtbus_gpio_acquire(child, "gpios", in gpiokeys_attach()
197 if (key->key_pin) in gpiokeys_attach()
198 key->key_state = fdtbus_gpio_read(key->key_pin); in gpiokeys_attach()
204 key->key_pswitch.smpsw_name = key->key_label; in gpiokeys_attach()
205 key->key_pswitch.smpsw_type = PSWITCH_TYPE_POWER; in gpiokeys_attach()
208 key->key_pswitch.smpsw_name = key->key_label; in gpiokeys_attach()
209 key->key_pswitch.smpsw_type = PSWITCH_TYPE_SLEEP; in gpiokeys_attach()
212 key->key_usbcode = linux_key_to_usb(code); in gpiokeys_attach()
213 if (key->key_usbcode != 0) { in gpiokeys_attach()
216 key->key_pswitch.smpsw_name = key->key_label; in gpiokeys_attach()
217 key->key_pswitch.smpsw_type = PSWITCH_TYPE_HOTKEY; in gpiokeys_attach()
223 key->key_pswitch.smpsw_name = key->key_label; in gpiokeys_attach()
226 key->key_state = -1; /* Send notification on attach */ in gpiokeys_attach()
227 key->key_pswitch.smpsw_type = PSWITCH_TYPE_LID; in gpiokeys_attach()
230 key->key_pswitch.smpsw_type = PSWITCH_TYPE_HOTKEY; in gpiokeys_attach()
236 if (key->key_pswitch.smpsw_name != NULL && in gpiokeys_attach()
237 sysmon_pswitch_register(&key->key_pswitch) != 0) { in gpiokeys_attach()
238 aprint_error(" %s:ERROR", key->key_label); in gpiokeys_attach()
239 kmem_free(key->key_label, len); in gpiokeys_attach()
240 kmem_free(key, sizeof(*key)); in gpiokeys_attach()
245 aprint_normal(", %s", key->key_label); in gpiokeys_attach()
247 aprint_normal(" %s", key->key_label); in gpiokeys_attach()
250 key->key_next = sc->sc_keys; in gpiokeys_attach()
251 sc->sc_keys = key; in gpiokeys_attach()
282 struct gpiokeys_key *key; in gpiokeys_tick() local
284 for (key = sc->sc_keys; key; key = key->key_next) { in gpiokeys_tick()
285 if (key->key_pin == NULL) { in gpiokeys_tick()
288 const int new_state = fdtbus_gpio_read(key->key_pin); in gpiokeys_tick()
289 if (new_state != key->key_state) { in gpiokeys_tick()
290 key->key_state = new_state; in gpiokeys_tick()
291 sysmon_task_queue_sched(0, gpiokeys_task, key); in gpiokeys_tick()
300 struct gpiokeys_key *key = priv; in gpiokeys_task() local
301 struct gpiokeys_softc *sc = key->key_sc; in gpiokeys_task()
303 if (key->key_pswitch.smpsw_name) { in gpiokeys_task()
304 sysmon_pswitch_event(&key->key_pswitch, in gpiokeys_task()
305 key->key_state ? PSWITCH_EVENT_PRESSED : PSWITCH_EVENT_RELEASED); in gpiokeys_task()
306 } else if (sc->sc_enabled && sc->sc_wskbddev != NULL && key->key_usbcode != 0) { in gpiokeys_task()
308 key->key_state ? WSCONS_EVENT_KEY_DOWN : WSCONS_EVENT_KEY_UP, in gpiokeys_task()
309 key->key_usbcode); in gpiokeys_task()