Lines Matching full:bbnsm
32 struct scmi_imx_bbm *bbnsm = container_of(to_delayed_work(work), in scmi_imx_bbm_pwrkey_check_for_events() local
34 struct scmi_protocol_handle *ph = bbnsm->ph; in scmi_imx_bbm_pwrkey_check_for_events()
35 struct input_dev *input = bbnsm->input; in scmi_imx_bbm_pwrkey_check_for_events()
39 ret = bbnsm->ops->button_get(ph, &state); in scmi_imx_bbm_pwrkey_check_for_events()
45 pr_debug("%s: state: %d, keystate %d\n", __func__, state, bbnsm->keystate); in scmi_imx_bbm_pwrkey_check_for_events()
48 if (state ^ bbnsm->keystate) { in scmi_imx_bbm_pwrkey_check_for_events()
49 bbnsm->keystate = state; in scmi_imx_bbm_pwrkey_check_for_events()
50 input_event(input, EV_KEY, bbnsm->keycode, state); in scmi_imx_bbm_pwrkey_check_for_events()
52 pm_relax(bbnsm->input->dev.parent); in scmi_imx_bbm_pwrkey_check_for_events()
53 pr_debug("EV_KEY: %x\n", bbnsm->keycode); in scmi_imx_bbm_pwrkey_check_for_events()
58 schedule_delayed_work(&bbnsm->check_work, msecs_to_jiffies(REPEAT_INTERVAL)); in scmi_imx_bbm_pwrkey_check_for_events()
61 static int scmi_imx_bbm_pwrkey_event(struct scmi_imx_bbm *bbnsm) in scmi_imx_bbm_pwrkey_event() argument
63 struct input_dev *input = bbnsm->input; in scmi_imx_bbm_pwrkey_event()
71 if (READ_ONCE(bbnsm->suspended)) { in scmi_imx_bbm_pwrkey_event()
72 bbnsm->keystate = 1; in scmi_imx_bbm_pwrkey_event()
73 input_event(input, EV_KEY, bbnsm->keycode, 1); in scmi_imx_bbm_pwrkey_event()
75 WRITE_ONCE(bbnsm->suspended, false); in scmi_imx_bbm_pwrkey_event()
78 schedule_delayed_work(&bbnsm->check_work, msecs_to_jiffies(DEBOUNCE_TIME)); in scmi_imx_bbm_pwrkey_event()
85 struct scmi_imx_bbm *bbnsm = pdata; in scmi_imx_bbm_pwrkey_act() local
87 cancel_delayed_work_sync(&bbnsm->check_work); in scmi_imx_bbm_pwrkey_act()
92 struct scmi_imx_bbm *bbnsm = container_of(nb, struct scmi_imx_bbm, nb); in scmi_imx_bbm_key_notifier() local
97 scmi_imx_bbm_pwrkey_event(bbnsm); in scmi_imx_bbm_key_notifier()
110 struct scmi_imx_bbm *bbnsm = dev_get_drvdata(dev); in scmi_imx_bbm_pwrkey_init() local
114 if (device_property_read_u32(dev, "linux,code", &bbnsm->keycode)) { in scmi_imx_bbm_pwrkey_init()
115 bbnsm->keycode = KEY_POWER; in scmi_imx_bbm_pwrkey_init()
119 INIT_DELAYED_WORK(&bbnsm->check_work, scmi_imx_bbm_pwrkey_check_for_events); in scmi_imx_bbm_pwrkey_init()
128 input->phys = "bbnsm-pwrkey/input0"; in scmi_imx_bbm_pwrkey_init()
131 input_set_capability(input, EV_KEY, bbnsm->keycode); in scmi_imx_bbm_pwrkey_init()
133 ret = devm_add_action_or_reset(dev, scmi_imx_bbm_pwrkey_act, bbnsm); in scmi_imx_bbm_pwrkey_init()
139 bbnsm->input = input; in scmi_imx_bbm_pwrkey_init()
141 bbnsm->nb.notifier_call = &scmi_imx_bbm_key_notifier; in scmi_imx_bbm_pwrkey_init()
144 NULL, &bbnsm->nb); in scmi_imx_bbm_pwrkey_init()
163 struct scmi_imx_bbm *bbnsm; in scmi_imx_bbm_key_probe() local
169 bbnsm = devm_kzalloc(dev, sizeof(*bbnsm), GFP_KERNEL); in scmi_imx_bbm_key_probe()
170 if (!bbnsm) in scmi_imx_bbm_key_probe()
173 bbnsm->ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_IMX_BBM, &ph); in scmi_imx_bbm_key_probe()
174 if (IS_ERR(bbnsm->ops)) in scmi_imx_bbm_key_probe()
175 return PTR_ERR(bbnsm->ops); in scmi_imx_bbm_key_probe()
177 bbnsm->ph = ph; in scmi_imx_bbm_key_probe()
181 dev_set_drvdata(dev, bbnsm); in scmi_imx_bbm_key_probe()
192 struct scmi_imx_bbm *bbnsm = dev_get_drvdata(dev); in scmi_imx_bbm_key_suspend() local
194 WRITE_ONCE(bbnsm->suspended, true); in scmi_imx_bbm_key_suspend()