#include <linux/devm-helpers.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/mfd/palmas.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/gpio/consumer.h>
#include <linux/workqueue.h>
#define USB_GPIO_DEBOUNCE_MS …
static const unsigned int palmas_extcon_cable[] = …;
static void palmas_usb_wakeup(struct palmas *palmas, int enable)
{ … }
static irqreturn_t palmas_vbus_irq_handler(int irq, void *_palmas_usb)
{ … }
static irqreturn_t palmas_id_irq_handler(int irq, void *_palmas_usb)
{ … }
static void palmas_gpio_id_detect(struct work_struct *work)
{ … }
static irqreturn_t palmas_gpio_id_irq_handler(int irq, void *_palmas_usb)
{ … }
static void palmas_enable_irq(struct palmas_usb *palmas_usb)
{ … }
static int palmas_usb_probe(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int palmas_usb_suspend(struct device *dev)
{ … }
static int palmas_usb_resume(struct device *dev)
{
struct palmas_usb *palmas_usb = dev_get_drvdata(dev);
if (device_may_wakeup(dev)) {
if (palmas_usb->enable_vbus_detection)
disable_irq_wake(palmas_usb->vbus_irq);
if (palmas_usb->enable_gpio_vbus_detection)
disable_irq_wake(palmas_usb->gpio_vbus_irq);
if (palmas_usb->enable_id_detection)
disable_irq_wake(palmas_usb->id_irq);
if (palmas_usb->enable_gpio_id_detection)
disable_irq_wake(palmas_usb->gpio_id_irq);
}
if (palmas_usb->enable_gpio_vbus_detection)
palmas_vbus_irq_handler(palmas_usb->gpio_vbus_irq, palmas_usb);
palmas_gpio_id_detect(&palmas_usb->wq_detectid.work);
return 0;
};
#endif
static SIMPLE_DEV_PM_OPS(palmas_pm_ops, palmas_usb_suspend, palmas_usb_resume);
static const struct of_device_id of_palmas_match_tbl[] = …;
static struct platform_driver palmas_usb_driver = …;
module_platform_driver(…) …;
MODULE_ALIAS(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);