// SPDX-License-Identifier: GPL-2.0-only /* * Texas Instruments' Palmas Power Button Input Driver * * Copyright (C) 2012-2014 Texas Instruments Incorporated - http://www.ti.com/ * Girish S Ghongdemath * Nishanth Menon */ #include <linux/bitfield.h> #include <linux/init.h> #include <linux/input.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/mfd/palmas.h> #include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/slab.h> #define PALMAS_LPK_TIME_MASK … #define PALMAS_PWRON_DEBOUNCE_MASK … #define PALMAS_PWR_KEY_Q_TIME_MS … /** * struct palmas_pwron - Palmas power on data * @palmas: pointer to palmas device * @input_dev: pointer to input device * @input_work: work for detecting release of key * @irq: irq that we are hooked on to */ struct palmas_pwron { … }; /** * struct palmas_pwron_config - configuration of palmas power on * @long_press_time_val: value for long press h/w shutdown event * @pwron_debounce_val: value for debounce of power button */ struct palmas_pwron_config { … }; /** * palmas_power_button_work() - Detects the button release event * @work: work item to detect button release */ static void palmas_power_button_work(struct work_struct *work) { … } /** * pwron_irq() - button press isr * @irq: irq * @palmas_pwron: pwron struct * * Return: IRQ_HANDLED */ static irqreturn_t pwron_irq(int irq, void *palmas_pwron) { … } /** * palmas_pwron_params_ofinit() - device tree parameter parser * @dev: palmas button device * @config: configuration params that this fills up */ static void palmas_pwron_params_ofinit(struct device *dev, struct palmas_pwron_config *config) { … } /** * palmas_pwron_probe() - probe * @pdev: platform device for the button * * Return: 0 for successful probe else appropriate error */ static int palmas_pwron_probe(struct platform_device *pdev) { … } /** * palmas_pwron_remove() - Cleanup on removal * @pdev: platform device for the button * * Return: 0 */ static void palmas_pwron_remove(struct platform_device *pdev) { … } /** * palmas_pwron_suspend() - suspend handler * @dev: power button device * * Cancel all pending work items for the power button, setup irq for wakeup * * Return: 0 */ static int palmas_pwron_suspend(struct device *dev) { … } /** * palmas_pwron_resume() - resume handler * @dev: power button device * * Just disable the wakeup capability of irq here. * * Return: 0 */ static int palmas_pwron_resume(struct device *dev) { … } static DEFINE_SIMPLE_DEV_PM_OPS(palmas_pwron_pm, palmas_pwron_suspend, palmas_pwron_resume); #ifdef CONFIG_OF static const struct of_device_id of_palmas_pwr_match[] = …; MODULE_DEVICE_TABLE(of, of_palmas_pwr_match); #endif static struct platform_driver palmas_pwron_driver = …; module_platform_driver(…) …; MODULE_ALIAS(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_AUTHOR(…) …;