#include <linux/devm-helpers.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/kobject.h>
#include <linux/mfd/max8997.h>
#include <linux/mfd/max8997-private.h>
#include <linux/extcon-provider.h>
#include <linux/irqdomain.h>
#define DEV_NAME …
#define DELAY_MS_DEFAULT …
enum max8997_muic_adc_debounce_time { … };
struct max8997_muic_irq { … };
static struct max8997_muic_irq muic_irqs[] = …;
enum max8997_muic_acc_type { … };
enum max8997_muic_cable_group { … };
enum max8997_muic_usb_type { … };
enum max8997_muic_charger_type { … };
struct max8997_muic_info { … };
static const unsigned int max8997_extcon_cable[] = …;
static int max8997_muic_set_debounce_time(struct max8997_muic_info *info,
enum max8997_muic_adc_debounce_time time)
{
int ret;
switch (time) {
case ADC_DEBOUNCE_TIME_0_5MS:
case ADC_DEBOUNCE_TIME_10MS:
case ADC_DEBOUNCE_TIME_25MS:
case ADC_DEBOUNCE_TIME_38_62MS:
ret = max8997_update_reg(info->muic,
MAX8997_MUIC_REG_CONTROL3,
time << CONTROL3_ADCDBSET_SHIFT,
CONTROL3_ADCDBSET_MASK);
if (ret) {
dev_err(info->dev, "failed to set ADC debounce time\n");
return ret;
}
break;
default:
dev_err(info->dev, "invalid ADC debounce time\n");
return -EINVAL;
}
return 0;
};
static int max8997_muic_set_path(struct max8997_muic_info *info,
u8 val, bool attached)
{ … }
static int max8997_muic_get_cable_type(struct max8997_muic_info *info,
enum max8997_muic_cable_group group, bool *attached)
{ … }
static int max8997_muic_handle_usb(struct max8997_muic_info *info,
enum max8997_muic_usb_type usb_type, bool attached)
{ … }
static int max8997_muic_handle_dock(struct max8997_muic_info *info,
int cable_type, bool attached)
{ … }
static int max8997_muic_handle_jig_uart(struct max8997_muic_info *info,
bool attached)
{ … }
static int max8997_muic_adc_handler(struct max8997_muic_info *info)
{ … }
static int max8997_muic_chg_handler(struct max8997_muic_info *info)
{ … }
static void max8997_muic_irq_work(struct work_struct *work)
{ … }
static irqreturn_t max8997_muic_irq_handler(int irq, void *data)
{ … }
static int max8997_muic_detect_dev(struct max8997_muic_info *info)
{ … }
static void max8997_muic_detect_cable_wq(struct work_struct *work)
{ … }
static int max8997_muic_probe(struct platform_device *pdev)
{ … }
static struct platform_driver max8997_muic_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;