// SPDX-License-Identifier: GPL-2.0-only /* * drivers/extcon/extcon-adc-jack.c * * Analog Jack extcon driver with ADC-based detection capability. * * Copyright (C) 2016 Samsung Electronics * Chanwoo Choi <[email protected]> * * Copyright (C) 2012 Samsung Electronics * MyungJoo Ham <[email protected]> * * Modified for calling to IIO to get adc by <[email protected]> */ #include <linux/module.h> #include <linux/slab.h> #include <linux/device.h> #include <linux/platform_device.h> #include <linux/err.h> #include <linux/interrupt.h> #include <linux/workqueue.h> #include <linux/iio/consumer.h> #include <linux/extcon/extcon-adc-jack.h> #include <linux/extcon-provider.h> /** * struct adc_jack_data - internal data for adc_jack device driver * @dev: The device structure associated with the adc_jack. * @edev: extcon device. * @cable_names: list of supported cables. * @adc_conditions: list of adc value conditions. * @num_conditions: size of adc_conditions. * @irq: irq number of attach/detach event (0 if not exist). * @handling_delay: interrupt handler will schedule extcon event * handling at handling_delay jiffies. * @handler: extcon event handler called by interrupt handler. * @chan: iio channel being queried. * @wakeup_source: Indicates if the device can wake up the system. */ struct adc_jack_data { … }; static void adc_jack_handler(struct work_struct *work) { … } static irqreturn_t adc_jack_irq_thread(int irq, void *_data) { … } static int adc_jack_probe(struct platform_device *pdev) { … } static void adc_jack_remove(struct platform_device *pdev) { … } #ifdef CONFIG_PM_SLEEP static int adc_jack_suspend(struct device *dev) { … } static int adc_jack_resume(struct device *dev) { … } #endif /* CONFIG_PM_SLEEP */ static SIMPLE_DEV_PM_OPS(adc_jack_pm_ops, adc_jack_suspend, adc_jack_resume); static struct platform_driver adc_jack_driver = …; module_platform_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;