/* * extcon-arizona.c - Extcon driver Wolfson Arizona devices * * Copyright (C) 2012 Wolfson Microelectronics plc * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */#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/gpio.h>#include<linux/input.h>#include<linux/platform_device.h>#include<linux/pm_runtime.h>#include<linux/regulator/consumer.h>#include<linux/extcon.h>#include<sound/soc.h>#include<linux/mfd/arizona/core.h>#include<linux/mfd/arizona/pdata.h>#include<linux/mfd/arizona/registers.h>#define ARIZONA_MAX_MICD_RANGE 8#define ARIZONA_ACCDET_MODE_MIC 0#define ARIZONA_ACCDET_MODE_HPL 1#define ARIZONA_ACCDET_MODE_HPR 2#define ARIZONA_HPDET_MAX 10000#define HPDET_DEBOUNCE 500#define MICD_TIMEOUT 2000structarizona_extcon_info{structdevice*dev;structarizona*arizona;structmutexlock;structregulator*micvdd;structinput_dev*input;u16last_jackdet;intmicd_mode;conststructarizona_micd_config*micd_modes;intmicd_num_modes;conststructarizona_micd_range*micd_ranges;intnum_micd_ranges;boolmicd_reva;boolmicd_clamp;structdelayed_workhpdet_work;structdelayed_workmicd_detect_work;structdelayed_workmicd_timeout_work;boolhpdet_active;boolhpdet_done;boolhpdet_retried;intnum_hpdet_res;unsignedinthpdet_res[3];boolmic;bool