Lines Matching refs:bbnsm
48 struct bbnsm_pwrkey *bbnsm = from_timer(bbnsm, t, check_timer); in bbnsm_pwrkey_check_for_events() local
49 struct input_dev *input = bbnsm->input; in bbnsm_pwrkey_check_for_events()
52 regmap_read(bbnsm->regmap, BBNSM_EVENTS, &state); in bbnsm_pwrkey_check_for_events()
57 if (state ^ bbnsm->keystate) { in bbnsm_pwrkey_check_for_events()
58 bbnsm->keystate = state; in bbnsm_pwrkey_check_for_events()
59 input_event(input, EV_KEY, bbnsm->keycode, state); in bbnsm_pwrkey_check_for_events()
61 pm_relax(bbnsm->input->dev.parent); in bbnsm_pwrkey_check_for_events()
66 mod_timer(&bbnsm->check_timer, in bbnsm_pwrkey_check_for_events()
73 struct bbnsm_pwrkey *bbnsm = platform_get_drvdata(pdev); in bbnsm_pwrkey_interrupt() local
74 struct input_dev *input = bbnsm->input; in bbnsm_pwrkey_interrupt()
77 regmap_read(bbnsm->regmap, BBNSM_EVENTS, &event); in bbnsm_pwrkey_interrupt()
81 pm_wakeup_event(bbnsm->input->dev.parent, 0); in bbnsm_pwrkey_interrupt()
87 if (bbnsm->suspended) { in bbnsm_pwrkey_interrupt()
88 bbnsm->keystate = 1; in bbnsm_pwrkey_interrupt()
89 input_event(input, EV_KEY, bbnsm->keycode, 1); in bbnsm_pwrkey_interrupt()
92 bbnsm->suspended = false; in bbnsm_pwrkey_interrupt()
95 mod_timer(&bbnsm->check_timer, in bbnsm_pwrkey_interrupt()
99 regmap_write(bbnsm->regmap, BBNSM_EVENTS, BBNSM_BTN_OFF); in bbnsm_pwrkey_interrupt()
106 struct bbnsm_pwrkey *bbnsm = pdata; in bbnsm_pwrkey_act() local
108 timer_shutdown_sync(&bbnsm->check_timer); in bbnsm_pwrkey_act()
113 struct bbnsm_pwrkey *bbnsm; in bbnsm_pwrkey_probe() local
118 bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL); in bbnsm_pwrkey_probe()
119 if (!bbnsm) in bbnsm_pwrkey_probe()
122 bbnsm->regmap = syscon_node_to_regmap(np->parent); in bbnsm_pwrkey_probe()
123 if (IS_ERR(bbnsm->regmap)) { in bbnsm_pwrkey_probe()
125 return PTR_ERR(bbnsm->regmap); in bbnsm_pwrkey_probe()
129 &bbnsm->keycode)) { in bbnsm_pwrkey_probe()
130 bbnsm->keycode = KEY_POWER; in bbnsm_pwrkey_probe()
134 bbnsm->irq = platform_get_irq(pdev, 0); in bbnsm_pwrkey_probe()
135 if (bbnsm->irq < 0) in bbnsm_pwrkey_probe()
139 regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, BBNSM_DP_EN, BBNSM_DP_EN); in bbnsm_pwrkey_probe()
142 regmap_write_bits(bbnsm->regmap, BBNSM_EVENTS, BBNSM_PWRKEY_EVENTS, in bbnsm_pwrkey_probe()
145 timer_setup(&bbnsm->check_timer, bbnsm_pwrkey_check_for_events, 0); in bbnsm_pwrkey_probe()
157 input_set_capability(input, EV_KEY, bbnsm->keycode); in bbnsm_pwrkey_probe()
160 error = devm_add_action(&pdev->dev, bbnsm_pwrkey_act, bbnsm); in bbnsm_pwrkey_probe()
166 bbnsm->input = input; in bbnsm_pwrkey_probe()
167 platform_set_drvdata(pdev, bbnsm); in bbnsm_pwrkey_probe()
169 error = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_pwrkey_interrupt, in bbnsm_pwrkey_probe()
183 error = dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq); in bbnsm_pwrkey_probe()
193 struct bbnsm_pwrkey *bbnsm = platform_get_drvdata(pdev); in bbnsm_pwrkey_suspend() local
195 bbnsm->suspended = true; in bbnsm_pwrkey_suspend()
203 struct bbnsm_pwrkey *bbnsm = platform_get_drvdata(pdev); in bbnsm_pwrkey_resume() local
205 bbnsm->suspended = false; in bbnsm_pwrkey_resume()