Lines Matching +full:button +full:-

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Texas Instruments' Palmas Power Button Input Driver
5 * Copyright (C) 2012-2014 Texas Instruments Incorporated - http://www.ti.com/
26 * struct palmas_pwron - Palmas power on data
40 * struct palmas_pwron_config - configuration of palmas power on
42 * @pwron_debounce_val: value for debounce of power button
50 * palmas_power_button_work() - Detects the button release event
51 * @work: work item to detect button release
58 struct input_dev *input_dev = pwron->input_dev; in palmas_power_button_work()
62 error = palmas_read(pwron->palmas, PALMAS_INTERRUPT_BASE, in palmas_power_button_work()
65 dev_err(input_dev->dev.parent, in palmas_power_button_work()
68 /* The button is released, report event. */ in palmas_power_button_work()
72 /* The button is still depressed, keep checking. */ in palmas_power_button_work()
73 schedule_delayed_work(&pwron->input_work, in palmas_power_button_work()
79 * pwron_irq() - button press isr
88 struct input_dev *input_dev = pwron->input_dev; in pwron_irq()
91 pm_wakeup_event(input_dev->dev.parent, 0); in pwron_irq()
94 mod_delayed_work(system_wq, &pwron->input_work, in pwron_irq()
101 * palmas_pwron_params_ofinit() - device tree parameter parser
102 * @dev: palmas button device
117 config->long_press_time_val = ARRAY_SIZE(lpk_times) - 1; in palmas_pwron_params_ofinit()
119 np = dev->of_node; in palmas_pwron_params_ofinit()
123 error = of_property_read_u32(np, "ti,palmas-long-press-seconds", &val); in palmas_pwron_params_ofinit()
127 config->long_press_time_val = i; in palmas_pwron_params_ofinit()
134 "ti,palmas-pwron-debounce-milli-seconds", in palmas_pwron_params_ofinit()
139 config->pwron_debounce_val = i; in palmas_pwron_params_ofinit()
146 lpk_times[config->long_press_time_val]); in palmas_pwron_params_ofinit()
150 * palmas_pwron_probe() - probe
151 * @pdev: platform device for the button
157 struct palmas *palmas = dev_get_drvdata(pdev->dev.parent); in palmas_pwron_probe()
158 struct device *dev = &pdev->dev; in palmas_pwron_probe()
169 return -ENOMEM; in palmas_pwron_probe()
173 dev_err(dev, "Can't allocate power button\n"); in palmas_pwron_probe()
174 error = -ENOMEM; in palmas_pwron_probe()
178 input_dev->name = "palmas_pwron"; in palmas_pwron_probe()
179 input_dev->phys = "palmas_pwron/input0"; in palmas_pwron_probe()
180 input_dev->dev.parent = dev; in palmas_pwron_probe()
200 pwron->palmas = palmas; in palmas_pwron_probe()
201 pwron->input_dev = input_dev; in palmas_pwron_probe()
203 INIT_DELAYED_WORK(&pwron->input_work, palmas_power_button_work); in palmas_pwron_probe()
205 pwron->irq = platform_get_irq(pdev, 0); in palmas_pwron_probe()
206 if (pwron->irq < 0) { in palmas_pwron_probe()
207 error = pwron->irq; in palmas_pwron_probe()
211 error = request_threaded_irq(pwron->irq, NULL, pwron_irq, in palmas_pwron_probe()
223 dev_err(dev, "Can't register power button: %d\n", error); in palmas_pwron_probe()
233 cancel_delayed_work_sync(&pwron->input_work); in palmas_pwron_probe()
234 free_irq(pwron->irq, pwron); in palmas_pwron_probe()
243 * palmas_pwron_remove() - Cleanup on removal
244 * @pdev: platform device for the button
252 free_irq(pwron->irq, pwron); in palmas_pwron_remove()
253 cancel_delayed_work_sync(&pwron->input_work); in palmas_pwron_remove()
255 input_unregister_device(pwron->input_dev); in palmas_pwron_remove()
260 * palmas_pwron_suspend() - suspend handler
261 * @dev: power button device
263 * Cancel all pending work items for the power button, setup irq for wakeup
272 cancel_delayed_work_sync(&pwron->input_work); in palmas_pwron_suspend()
275 enable_irq_wake(pwron->irq); in palmas_pwron_suspend()
281 * palmas_pwron_resume() - resume handler
282 * @dev: power button device
294 disable_irq_wake(pwron->irq); in palmas_pwron_resume()
304 { .compatible = "ti,palmas-pwrbutton" },
322 MODULE_ALIAS("platform:palmas-pwrbutton");
323 MODULE_DESCRIPTION("Palmas Power Button");