/* * 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_MICD_CLAMP_MODE_JDL 0x4#define ARIZONA_MICD_CLAMP_MODE_JDH 0x5#define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9#define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb#define ARIZONA_HPDET_MAX 10000#define HPDET_DEBOUNCE 500#define DEFAULT_MICD_TIMEOUT 2000#define MICD_LVL_1_TO_7 (ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 | \ ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 | \ ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 | \ ARIZONA_MICD_LVL_7)#define MICD_LVL_0_TO_7 (ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7)#define MICD_LVL_0_TO_8 (MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8)structarizona_extcon_info{structdevice*dev;structarizona*arizona;structmutexlock;structregulator*micvdd;structinput_dev*input;u16last_jackdet;intmicd_mode;conststructarizona_micd_config