linux/drivers/extcon/extcon-arizona.c
<<
ion>3.1/spalue 3.1/formue 3.1a ion>3. href="../linux+v33.12/drivers/extcon/extcon-arizona.c">ion>3.1img src="../.static/gfx/right.png" alt=">>">io1/spalueio1spal class="lxr_search">ion>ion>3.1input typ vhidden" nam vnavtarget" > v">ion>3.1input typ vtext" nam vsearch" id vsearch">ion>3.1butt" typ vsubmit">Search3. onclick="return ajax_prefs();">ion>3.Prefse 3.1/a>io1/spaluen>3. .1/divuen>3. .1form ac val="ajax+*" method="post" onsubmit="return false;">io1input typ vhidden" nam vajax_lookup" id vajax_lookup" > v">in>3. .1/formuein>3. .1div class="headingbott"m">3.3. 3. .1div id vsearch_results" class="search_results"e 3uen>3. .1/divue 1div id vcontent">e 1div id vfile_contents"u
. .11/a>1spal class="comment">/*1/spalue. .21/a>1spal class="comment"> * extcon-arizona.c - Extcon driver Wolfson Arizona devices1/spalue. .31/a>1spal class="comment"> *1/spalue. .41/a>1spal class="comment"> *  Copyright (C) 2012 Wolfson Microelectronics plc1/spalue. .51/a>1spal class="comment"> *1/spalue. .61/a>1spal class="comment"> * This program is free software; you cal redistribute it and/or modify1/spalue. .71/a>1spal class="comment"> * it under the terms of the GNU General Public License as published by1/spalue. .81/a>1spal class="comment"> * the Free Software Founda val; either vers2"
	2 of the License, or1/spalue. .91/a>1spal class="comment"> * (at your on val) any later vers2"
.1/spalue. optia>1spal class="comment"> *1/spalue. 111/a>1spal class="comment"> * This program is distributed in the hope that it will be useful,1/spalue. 121/a>1spal class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of1/spalue. 131/a>1spal class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1/spalue. 141/a>1spal class="comment"> * GNU General Public License for more details.1/spalue. 151/a>1spal class="comment"> */1/spalue. 161/a>e. 171/a>#include <linux/kernel.h1/a>>e. 181/a>#include <linux/module.h1/a>>e. 191/a>#include <linux/i2c.h1/a>>e. 201/a>#include <linux/slab.h1/a>>e. 211/a>#include <linux/interrupt.h1/a>>e. 221/a>#include <linux/err.h1/a>>e. 231/a>#include <linux/gpio.h1/a>>e. 241/a>#include <linux/platform_device.h1/a>>e. 251/a>#include <linux/pm_runtime.h1/a>>e. 261/a>#include <linux/regulator/consumer.h1/a>>e. 271/a>#include <linux/extcon.h1/a>>e. 281/a>e. 291/a>#include <linux/mfd/arizona/core.h1/a>>e. 301/a>#include <linux/mfd/arizona/pda a.h1/a>>e. 311/a>#include <linux/mfd/arizona/registers.h1/a>>e. 321/a>e. 331/a>struct.1a href="+code=arizona_extcon_info" class="sref">arizona_extcon_info1/a> {e. 341/a>        struct.1a href="+code=device" class="sref">device1/a> *1a href="+code=dev" class="sref">dev1/a>;e. 351/a>        struct.1a href="+code=arizona" class="sref">arizona1/a> *1a href="+code=arizona" class="sref">arizona1/a>;e. 361/a>        struct.1a href="+code=mutex" class="sref">mutex1/a> 1a href="+code=lock" class="sref">lock1/a>;e. 371/a>        struct.1a href="+code=regulator" class="sref">regulator1/a> *1a href="+code=micvdd" class="sref">micvdd1/a>;e. 381/a>e. 391/a>        int.1a href="+code=micd_mode" class="sref">micd_mode1/a>;e. 401/a>        const struct.1a href="+code=arizona_micd_config" class="sref">arizona_micd_config1/a> *1a href="+code=micd_modes" class="sref">micd_modes1/a>;e. 411/a>        int.1a href="+code=micd_num_modes" class="sref">micd_num_modes1/a>;e. 421/a>e. 431/a>        1a href="+code=bool" class="sref">bool1/a> 1a href="+code=micd_reva" class="sref">micd_reva1/a>;e. 441/a>e. 451/a>        1a href="+code=bool" class="sref">bool1/a> 1a href="+code=mic" class="sref">mic1/a>;e. 461/a>        1a href="+code=bool" class="sref">bool1/a> 1a href="+code=detecting" class="sref">detecting1/a>;e. 471/a>        int.1a href="+code=jack_flips" class="sref">jack_flips1/a>;e. 481/a>e. 491/a>        struct.1a href="+code=extcon_dev" class="sref">extcon_dev1/a> 1a href="+code=edev" class="sref">edev1/a>;e. 501/a>};e. 511/a>e. 521/a>static const struct.1a href="+code=arizona_micd_config" class="sref">arizona_micd_config1/a> 1a href="+code=micd_default_modes" class="sref">micd_default_modes1/a>[] = {e. 531/a>        { 1a href="+code=ARIZONA_ACCDET_SRC" class="sref">ARIZONA_ACCDET_SRC1/a>, 1 << 1a href="+code=ARIZONA_MICD_BIAS_SRC_SHIFT" class="sref">ARIZONA_MICD_BIAS_SRC_SHIFT1/a>, 0 },e. 541/a>        { 0,                  2 << 1a href="+code=ARIZONA_MICD_BIAS_SRC_SHIFT" class="sref">ARIZONA_MICD_BIAS_SRC_SHIFT1/a>, 1 },e. 551/a>};e. 561/a>e. 571/a>#define 1a href="+code=ARIZONA_CABLE_MECHANICAL" class="sref">ARIZONA_CABLE_MECHANICAL1/a> 0e. 581/a>#define 1a href="+code=ARIZONA_CABLE_MICROPHONE" class="sref">ARIZONA_CABLE_MICROPHONE1/a> 1e. 591/a>#define 1a href="+code=ARIZONA_CABLE_HEADPHONE" class="sref">ARIZONA_CABLE_HEADPHONE1/a>  2e. 601/a>e. 611/a>static const char *1a href="+code=arizona_cable" class="sref">arizona_cable1/a>[] = {e. 621/a>        1spal class="string">"Mechanical"1/spalu,e. 631/a>        1spal class="string">"Microphone"1/spalu,e. 641/a>        1spal class="string">"Headphone"1/spalu,e. 651/a>        1a href="+code=NULL" class="sref">NULL1/a>,e. 661/a>};e. 671/a>e. 681/a>static void.1a href="+code=arizona_extcon_set_mode" class="sref">arizona_extcon_set_mode1/a>(struct.1a href="+code=arizona_extcon_info" class="sref">arizona_extcon_info1/a> *1a href="+code=info" class="sref">info1/a>, int.1a href="+code=mode" class="sref">mode1/a>)e. 691/a>{e. 701/a>        struct.1a href="+code=arizona" class="sref">arizona1/a> *1a href="+code=arizona" class="sref">arizona1/a> = 1a href="+code=info" class="sref">info1/a>->1a href="+code=arizona" class="sref">arizona1/a>;e. 711/a>e. 721/a>        1a href="+code=gpio_set_  >
 _cansleep" class="sref">gpio_set_  >
 _cansleep1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=pda a" class="sref">pda a1/a>.1a href="+code=micd_pol_gpio" class="sref">micd_pol_gpio1/a>,e. 731/a>                                1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_modes" class="sref">micd_modes1/a>[1a href="+code=mode" class="sref">mode1/a>].1a href="+code=gpio" class="sref">gpio1/a>);e. 741/a>        1a href="+code=regmap_upda e_bits" class="sref">regmap_upda e_bits1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_MIC_DETECT_1" class="sref">ARIZONA_MIC_DETECT_11/a>,e. 751/a>                           1a href="+code=ARIZONA_MICD_BIAS_SRC_MASK" class="sref">ARIZONA_MICD_BIAS_SRC_MASK1/a>,e. 761/a>                           1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_modes" class="sref">micd_modes1/a>[1a href="+code=mode" class="sref">mode1/a>].1a href="+code=bias" class="sref">bias1/a>);e. 771/a>        1a href="+code=regmap_upda e_bits" class="sref">regmap_upda e_bits1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_ACCESSORY_DETECT_MODE_1" class="sref">ARIZONA_ACCESSORY_DETECT_MODE_11/a>,e. 781/a>                           1a href="+code=ARIZONA_ACCDET_SRC" class="sref">ARIZONA_ACCDET_SRC1/a>, 1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_modes" class="sref">micd_modes1/a>[1a href="+code=mode" class="sref">mode1/a>].1a href="+code=src" class="sref">src1/a>);e. 791/a>e. 801/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_mode" class="sref">micd_mode1/a> = 1a href="+code=mode" class="sref">mode1/a>;e. 811/a>e. 821/a>        1a href="+code=dev_dbg" class="sref">dev_dbg1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Set jack polarity to %d\n"1/spalu,.1a href="+code=mode" class="sref">mode1/a>);e. 831/a>}e. 841/a>e. 851/a>static void.1a href="+code=arizona_start_mic" class="sref">arizona_start_mic1/a>(struct.1a href="+code=arizona_extcon_info" class="sref">arizona_extcon_info1/a> *1a href="+code=info" class="sref">info1/a>)e. 861/a>{e. 871/a>        struct.1a href="+code=arizona" class="sref">arizona1/a> *1a href="+code=arizona" class="sref">arizona1/a> = 1a href="+code=info" class="sref">info1/a>->1a href="+code=arizona" class="sref">arizona1/a>;e. 881/a>        1a href="+code=bool" class="sref">bool1/a> 1a href="+code=change" class="sref">change1/a>;e. 891/a>        int.1a href="+code=ret" class="sref">ret1/a>;e. 901/a>e. 911/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=detecting" class="sref">detecting1/a> = 1a href="+code=true" class="sref">true1/a>;e. 921/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=mic" class="sref">mic1/a> = 1a href="+code=false" class="sref">false1/a>;e. 931/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=jack_flips" class="sref">jack_flips1/a> = 0;e. 941/a>e. 951/a>        1spal class="comment">/* Microphone detection cal't use idle mode */1/spalue. 961/a>        1a href="+code=pm_runtime_get" class="sref">pm_runtime_get1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=dev" class="sref">dev1/a>);e. 971/a>e. 981/a>        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=regulator_enable" class="sref">regulator_enable1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=micvdd" class="sref">micvdd1/a>);e. 991/a>        if (1a href="+code=ret" class="sref">ret1/a> != 0) {e.1001/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to enable MICVDD: %d\n"1/spalu,e.1011/a>                        1a href="+code=ret" class="sref">ret1/a>);e.1021/a>        }e.1031/a>e.1041/a>        if (1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_reva" class="sref">micd_reva1/a>) {e.1051/a>                1a href="+code=regmap_write" class="sref">regmap_write1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 0x80, 0x3);e.1061/a>                1a href="+code=regmap_write" class="sref">regmap_write1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 0x294, 0);e.1071/a>                1a href="+code=regmap_write" class="sref">regmap_write1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 0x80, 0x0);e.1081/a>        }e.1091/a>e.1101/a>        1a href="+code=regmap_upda e_bits_check" class="sref">regmap_upda e_bits_check1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_MIC_DETECT_1" class="sref">ARIZONA_MIC_DETECT_11/a>,e.1111/a>                                 1a href="+code=ARIZONA_MICD_ENA" class="sref">ARIZONA_MICD_ENA1/a>, 1a href="+code=ARIZONA_MICD_ENA" class="sref">ARIZONA_MICD_ENA1/a>,e.1121/a>                                 &1a href="+code=change" class="sref">change1/a>);e.1131/a>        if (!1a href="+code=change" class="sref">change1/a>) {e.1141/a>                1a href="+code=regulator_disable" class="sref">regulator_disable1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=micvdd" class="sref">micvdd1/a>);e.1151/a>                1a href="+code=pm_runtime_put_autosuspend" class="sref">pm_runtime_put_autosuspend1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=dev" class="sref">dev1/a>);e.1161/a>        }e.1171/a>}e.1181/a>e.1191/a>static void.1a href="+code=arizona_stop_mic" class="sref">arizona_stop_mic1/a>(struct.1a href="+code=arizona_extcon_info" class="sref">arizona_extcon_info1/a> *1a href="+code=info" class="sref">info1/a>)e.1201/a>{e.1211/a>        struct.1a href="+code=arizona" class="sref">arizona1/a> *1a href="+code=arizona" class="sref">arizona1/a> = 1a href="+code=info" class="sref">info1/a>->1a href="+code=arizona" class="sref">arizona1/a>;e.1221/a>        1a href="+code=bool" class="sref">bool1/a> 1a href="+code=change" class="sref">change1/a>;e.1231/a>e.1241/a>        1a href="+code=regmap_upda e_bits_check" class="sref">regmap_upda e_bits_check1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_MIC_DETECT_1" class="sref">ARIZONA_MIC_DETECT_11/a>,e.1251/a>                                 1a href="+code=ARIZONA_MICD_ENA" class="sref">ARIZONA_MICD_ENA1/a>, 0,e.1261/a>                                 &1a href="+code=change" class="sref">change1/a>);e.1271/a>e.1281/a>        if (1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_reva" class="sref">micd_reva1/a>) {e.1291/a>                1a href="+code=regmap_write" class="sref">regmap_write1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 0x80, 0x3);e.1301/a>                1a href="+code=regmap_write" class="sref">regmap_write1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 0x294, 2);e.1311/a>                1a href="+code=regmap_write" class="sref">regmap_write1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 0x80, 0x0);e.1321/a>        }e.1331/a>e.1341/a>        if (1a href="+code=change" class="sref">change1/a>) {e.1351/a>                1a href="+code=regulator_disable" class="sref">regulator_disable1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=micvdd" class="sref">micvdd1/a>);e.1361/a>                1a href="+code=pm_runtime_put_autosuspend" class="sref">pm_runtime_put_autosuspend1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=dev" class="sref">dev1/a>);e.1371/a>        }e.1381/a>}e.1391/a>e.1401/a>static 1a href="+code=irqreturn_t" class="sref">irqreturn_t1/a> 1a href="+code=arizona_micdet" class="sref">arizona_micdet1/a>(int.1a href="+code=irq" class="sref">irq1/a>, void.*1a href="+code=da a" class="sref">da a1/a>)e.1411/a>{e.1421/a>        struct.1a href="+code=arizona_extcon_info" class="sref">arizona_extcon_info1/a> *1a href="+code=info" class="sref">info1/a> = 1a href="+code=da a" class="sref">da a1/a>;e.1431/a>        struct.1a href="+code=arizona" class="sref">arizona1/a> *1a href="+code=arizona" class="sref">arizona1/a> = 1a href="+code=info" class="sref">info1/a>->1a href="+code=arizona" class="sref">arizona1/a>;e.1441/a>        unsigned int.1a href="+code=val" class="sref">val1/a>;e.1451/a>        int.1a href="+code=ret" class="sref">ret1/a>;e.1461/a>e.1471/a>        1a href="+code=mutex_lock" class="sref">mutex_lock1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=lock" class="sref">lock1/a>);e.1481/a>e.1491/a>        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=regmap_read" class="sref">regmap_read1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_MIC_DETECT_3" class="sref">ARIZONA_MIC_DETECT_31/a>, &1a href="+code=val" class="sref">val1/a>);e.1501/a>        if (1a href="+code=ret" class="sref">ret1/a> != 0) {e.1511/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to read MICDET: %d\n"1/spalu, 1a href="+code=ret" class="sref">ret1/a>);e.1521/a>                return 1a href="+code=IRQ_NONE" class="sref">IRQ_NONE1/a>;e.1531/a>        }e.1541/a>e.1551/a>        1a href="+code=dev_dbg" class="sref">dev_dbg1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"MICDET: %x\n"1/spalu, 1a href="+code=val" class="sref">val1/a>);e.1561/a>e.1571/a>        if (!(1a href="+code=val" class="sref">val1/a> & 1a href="+code=ARIZONA_MICD_VALID" class="sref">ARIZONA_MICD_VALID1/a>)) {e.1581/a>                1a href="+code=dev_warn" class="sref">dev_warn1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Microphone detection state invalid\n"1/spalu);e.1591/a>                1a href="+code=mutex_unlock" class="sref">mutex_unlock1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=lock" class="sref">lock1/a>);e.1601/a>                return 1a href="+code=IRQ_NONE" class="sref">IRQ_NONE1/a>;e.1611/a>        }e.1621/a>e.1631/a>        1spal class="comment">/* Due to jack detect this should never happen */1/spalue.1641/a>        if (!(1a href="+code=val" class="sref">val1/a> & 1a href="+code=ARIZONA_MICD_STS" class="sref">ARIZONA_MICD_STS1/a>)) {e.1651/a>                1a href="+code=dev_warn" class="sref">dev_warn1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Detected open circuit\n"1/spalu);e.1661/a>                1a href="+code=info" class="sref">info1/a>->1a href="+code=detecting" class="sref">detecting1/a> = 1a href="+code=false" class="sref">false1/a>;e.1671/a>                goto 1a href="+code=handled" class="sref">handled1/a>;e.1681/a>        }e.1691/a>e.1701/a>        1spal class="comment">/* If we got a high impedence we should have a headset, report it. */1/spalue.1711/a>        if (1a href="+code=info" class="sref">info1/a>->1a href="+code=detecting" class="sref">detecting1/a> && (1a href="+code=val" class="sref">val1/a> & 0x400)) {e.1721/a>                1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=extcon_upda e_state" class="sref">extcon_upda e_state1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>,e.1731/a>                                          1 << 1a href="+code=ARIZONA_CABLE_MICROPHONE" class="sref">ARIZONA_CABLE_MICROPHONE1/a> |e.1741/a>                                          1 << 1a href="+code=ARIZONA_CABLE_HEADPHONE" class="sref">ARIZONA_CABLE_HEADPHONE1/a>,e.1751/a>                                          1 << 1a href="+code=ARIZONA_CABLE_MICROPHONE" class="sref">ARIZONA_CABLE_MICROPHONE1/a> |e.1761/a>                                          1 << 1a href="+code=ARIZONA_CABLE_HEADPHONE" class="sref">ARIZONA_CABLE_HEADPHONE1/a>);e.1771/a>e.1781/a>                if (1a href="+code=ret" class="sref">ret1/a> != 0)e.1791/a>                        1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Headset report failed: %d\n"1/spalu,e.1801/a>                                1a href="+code=ret" class="sref">ret1/a>);e.1811/a>e.1821/a>                1a href="+code=info" class="sref">info1/a>->1a href="+code=mic" class="sref">mic1/a> = 1a href="+code=true" class="sref">true1/a>;e.1831/a>                1a href="+code=info" class="sref">info1/a>->1a href="+code=detecting" class="sref">detecting1/a> = 1a href="+code=false" class="sref">false1/a>;e.1841/a>                goto 1a href="+code=handled" class="sref">handled1/a>;e.1851/a>        }e.1861/a>e.1871/a>        1spal class="comment">/* If we detected a lower impedence during initial startup1/spalue.1881/a>1spal class="comment">         * then we probably have the wrong polarity, flip it.  Dol't1/spalue.1891/a>1spal class="comment">         * do this for the lowest impedences to speed up detection of1/spalue.1901/a>1spal class="comment">         * plain headphones.  If both polarities report a low1/spalue.1911/a>1spal class="comment">         * impedence then give up and report headphones.1/spalue.1921/a>1spal class="comment">         */1/spalue.1931/a>        if (1a href="+code=info" class="sref">info1/a>->1a href="+code=detecting" class="sref">detecting1/a> && (1a href="+code=val" class="sref">val1/a> & 0x3f8)) {e.1941/a>                1a href="+code=info" class="sref">info1/a>->1a href="+code=jack_flips" class="sref">jack_flips1/a>++;e.1951/a>e.1961/a>                if (1a href="+code=info" class="sref">info1/a>->1a href="+code=jack_flips" class="sref">jack_flips1/a> >= 1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_num_modes" class="sref">micd_num_modes1/a>) {e.1971/a>                        1a href="+code=dev_dbg" class="sref">dev_dbg1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Detected headphone\n"1/spalu);e.1981/a>                        1a href="+code=info" class="sref">info1/a>->1a href="+code=detecting" class="sref">detecting1/a> = 1a href="+code=false" class="sref">false1/a>;e.1991/a>                        1a href="+code=arizona_stop_mic" class="sref">arizona_stop_mic1/a>(1a href="+code=info" class="sref">info1/a>);e.2001/a>e.2011/a>                        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=extcon_set_cable_state_" class="sref">extcon_set_cable_state_1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>,e.2021/a>                                                      1a href="+code=ARIZONA_CABLE_HEADPHONE" class="sref">ARIZONA_CABLE_HEADPHONE1/a>,e.2031/a>                                                      1a href="+code=true" class="sref">true1/a>);e.2041/a>                        if (1a href="+code=ret" class="sref">ret1/a> != 0)e.2051/a>                                1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>,e.2061/a>                                        1spal class="string">"Headphone report failed: %d\n"1/spalu,e.2071/a>                                1a href="+code=ret" class="sref">ret1/a>);e.2081/a>                } else {e.2091/a>                        1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_mode" class="sref">micd_mode1/a>++;e.2101/a>                        if (1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_mode" class="sref">micd_mode1/a> == 1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_num_modes" class="sref">micd_num_modes1/a>)e.2111/a>                                1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_mode" class="sref">micd_mode1/a> = 0;e.2121/a>                        1a href="+code=arizona_extcon_set_mode" class="sref">arizona_extcon_set_mode1/a>(1a href="+code=info" class="sref">info1/a>, 1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_mode" class="sref">micd_mode1/a>);e.2131/a>e.2141/a>                        1a href="+code=info" class="sref">info1/a>->1a href="+code=jack_flips" class="sref">jack_flips1/a>++;e.2151/a>                }e.2161/a>e.2171/a>                goto 1a href="+code=handled" class="sref">handled1/a>;e.2181/a>        }e.2191/a>e.2201/a>        1spal class="comment">/*1/spalue.2211/a>1spal class="comment">         * If we're still detecting and we detect a short then we've1/spalue.2221/a>1spal class="comment">         * got a headphone.  Otherwise it's a button press, the1/spalue.2231/a>1spal class="comment">         * button reporting is stubbed out for now.1/spalue.2241/a>1spal class="comment">         */1/spalue.2251/a>        if (1a href="+code=val" class="sref">val1/a> & 0x3fc) {e.2261/a>                if (1a href="+code=info" class="sref">info1/a>->1a href="+code=mic" class="sref">mic1/a>) {e.2271/a>                        1a href="+code=dev_dbg" class="sref">dev_dbg1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Mic button detected\n"1/spalu);e.2281/a>e.2291/a>                } else if (1a href="+code=info" class="sref">info1/a>->1a href="+code=detecting" class="sref">detecting1/a>) {e.2301/a>                        1a href="+code=dev_dbg" class="sref">dev_dbg1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Headphone detected\n"1/spalu);e.2311/a>                        1a href="+code=info" class="sref">info1/a>->1a href="+code=detecting" class="sref">detecting1/a> = 1a href="+code=false" class="sref">false1/a>;e.2321/a>                        1a href="+code=arizona_stop_mic" class="sref">arizona_stop_mic1/a>(1a href="+code=info" class="sref">info1/a>);e.2331/a>e.2341/a>                        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=extcon_set_cable_state_" class="sref">extcon_set_cable_state_1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>,e.2351/a>                                                      1a href="+code=ARIZONA_CABLE_HEADPHONE" class="sref">ARIZONA_CABLE_HEADPHONE1/a>,e.2361/a>                                                      1a href="+code=true" class="sref">true1/a>);e.2371/a>                        if (1a href="+code=ret" class="sref">ret1/a> != 0)e.2381/a>                                1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>,e.2391/a>                                        1spal class="string">"Headphone report failed: %d\n"1/spalu,e.2401/a>                                1a href="+code=ret" class="sref">ret1/a>);e.2411/a>                } else {e.2421/a>                        1a href="+code=dev_warn" class="sref">dev_warn1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Button with no mic: %x\n"1/spalu,e.2431/a>                                 1a href="+code=val" class="sref">val1/a>);e.2441/a>                }e.2451/a>        } else {e.2461/a>                1a href="+code=dev_dbg" class="sref">dev_dbg1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Mic button released\n"1/spalu);e.2471/a>        }e.2481/a>e.2491/a>1a href="+code=handled" class="sref">handled1/a>:e.2501/a>        1a href="+code=pm_runtime_mark_last_busy" class="sref">pm_runtime_mark_last_busy1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=dev" class="sref">dev1/a>);e.2511/a>        1a href="+code=mutex_unlock" class="sref">mutex_unlock1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=lock" class="sref">lock1/a>);e.2521/a>e.2531/a>        return 1a href="+code=IRQ_HANDLED" class="sref">IRQ_HANDLED1/a>;e.2541/a>}e.2551/a>e.2561/a>static 1a href="+code=irqreturn_t" class="sref">irqreturn_t1/a> 1a href="+code=arizona_jackdet" class="sref">arizona_jackdet1/a>(int.1a href="+code=irq" class="sref">irq1/a>, void.*1a href="+code=da a" class="sref">da a1/a>)e.2571/a>{e.2581/a>        struct.1a href="+code=arizona_extcon_info" class="sref">arizona_extcon_info1/a> *1a href="+code=info" class="sref">info1/a> = 1a href="+code=da a" class="sref">da a1/a>;e.2591/a>        struct.1a href="+code=arizona" class="sref">arizona1/a> *1a href="+code=arizona" class="sref">arizona1/a> = 1a href="+code=info" class="sref">info1/a>->1a href="+code=arizona" class="sref">arizona1/a>;e.2601/a>        unsigned int.1a href="+code=val" class="sref">val1/a>;e.2611/a>        int.1a href="+code=ret" class="sref">ret1/a>;e.2621/a>e.2631/a>        1a href="+code=pm_runtime_get_sync" class="sref">pm_runtime_get_sync1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=dev" class="sref">dev1/a>);e.2641/a>e.2651/a>        1a href="+code=mutex_lock" class="sref">mutex_lock1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=lock" class="sref">lock1/a>);e.2661/a>e.2671/a>        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=regmap_read" class="sref">regmap_read1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_AOD_IRQ_RAW_STATUS" class="sref">ARIZONA_AOD_IRQ_RAW_STATUS1/a>, &1a href="+code=val" class="sref">val1/a>);e.2681/a>        if (1a href="+code=ret" class="sref">ret1/a> != 0) {e.2691/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to read jackdet status: %d\n"1/spalu,e.2701/a>                        1a href="+code=ret" class="sref">ret1/a>);e.2711/a>                1a href="+code=mutex_unlock" class="sref">mutex_unlock1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=lock" class="sref">lock1/a>);e.2721/a>                1a href="+code=pm_runtime_put_autosuspend" class="sref">pm_runtime_put_autosuspend1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=dev" class="sref">dev1/a>);e.2731/a>                return 1a href="+code=IRQ_NONE" class="sref">IRQ_NONE1/a>;e.2741/a>        }e.2751/a>e.2761/a>        if (1a href="+code=val" class="sref">val1/a> & 1a href="+code=ARIZONA_JD1_STS" class="sref">ARIZONA_JD1_STS1/a>) {e.2771/a>                1a href="+code=dev_dbg" class="sref">dev_dbg1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Detected jack\n"1/spalu);e.2781/a>                1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=extcon_set_cable_state_" class="sref">extcon_set_cable_state_1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>,e.2791/a>                                              1a href="+code=ARIZONA_CABLE_MECHANICAL" class="sref">ARIZONA_CABLE_MECHANICAL1/a>, 1a href="+code=true" class="sref">true1/a>);e.2801/a>e.2811/a>                if (1a href="+code=ret" class="sref">ret1/a> != 0)e.2821/a>                        1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Mechanical report failed: %d\n"1/spalu,e.2831/a>                                1a href="+code=ret" class="sref">ret1/a>);e.2841/a>e.2851/a>                1a href="+code=arizona_start_mic" class="sref">arizona_start_mic1/a>(1a href="+code=info" class="sref">info1/a>);e.2861/a>        } else {e.2871/a>                1a href="+code=dev_dbg" class="sref">dev_dbg1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Detected jack removal\n"1/spalu);e.2881/a>e.2891/a>                1a href="+code=arizona_stop_mic" class="sref">arizona_stop_mic1/a>(1a href="+code=info" class="sref">info1/a>);e.2901/a>e.2911/a>                1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=extcon_upda e_state" class="sref">extcon_upda e_state1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>, 0xffffffff, 0);e.2921/a>                if (1a href="+code=ret" class="sref">ret1/a> != 0)e.2931/a>                        1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Removal report failed: %d\n"1/spalu,e.2941/a>                                1a href="+code=ret" class="sref">ret1/a>);e.2951/a>        }e.2961/a>e.2971/a>        1a href="+code=mutex_unlock" class="sref">mutex_unlock1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=lock" class="sref">lock1/a>);e.2981/a>e.2991/a>        1a href="+code=pm_runtime_mark_last_busy" class="sref">pm_runtime_mark_last_busy1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=dev" class="sref">dev1/a>);e.3001/a>        1a href="+code=pm_runtime_put_autosuspend" class="sref">pm_runtime_put_autosuspend1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=dev" class="sref">dev1/a>);e.3011/a>e.3021/a>        return 1a href="+code=IRQ_HANDLED" class="sref">IRQ_HANDLED1/a>;e.3031/a>}e.3041/a>e.3051/a>static int.1a href="+code=__devinit" class="sref">__devinit1/a> 1a href="+code=arizona_extcon_probe" class="sref">arizona_extcon_probe1/a>(struct.1a href="+code=platform_device" class="sref">platform_device1/a> *1a href="+code=pdev" class="sref">pdev1/a>)e.3061/a>{e.3071/a>        struct.1a href="+code=arizona" class="sref">arizona1/a> *1a href="+code=arizona" class="sref">arizona1/a> = 1a href="+code=dev_get_drvda a" class="sref">dev_get_drvda a1/a>(1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>.1a href="+code=parent" class="sref">parent1/a>);e.3081/a>        struct.1a href="+code=arizona_pda a" class="sref">arizona_pda a1/a> *1a href="+code=pda a" class="sref">pda a1/a>;e.3091/a>        struct.1a href="+code=arizona_extcon_info" class="sref">arizona_extcon_info1/a> *1a href="+code=info" class="sref">info1/a>;e.3101/a>        int.1a href="+code=ret" class="sref">ret1/a>, 1a href="+code=mode" class="sref">mode1/a>;e.3111/a>e.3121/a>        1a href="+code=pda a" class="sref">pda a1/a> = 1a href="+code=dev_get_platda a" class="sref">dev_get_platda a1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>);e.3131/a>e.3141/a>        1a href="+code=info" class="sref">info1/a> = 1a href="+code=devm_kzalloc" class="sref">devm_kzalloc1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>, sizeof(*1a href="+code=info" class="sref">info1/a>), 1a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL1/a>);e.3151/a>        if (!1a href="+code=info" class="sref">info1/a>) {e.3161/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"failed to allocate memory\n"1/spalu);e.3171/a>                1a href="+code=ret" class="sref">ret1/a> = -1a href="+code=ENOMEM" class="sref">ENOMEM1/a>;e.3181/a>                goto 1a href="+code=err" class="sref">err1/a>;e.3191/a>        }e.3201/a>e.3211/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=micvdd" class="sref">micvdd1/a> = 1a href="+code=devm_regulator_get" class="sref">devm_regulator_get1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"MICVDD"1/spalu);e.3221/a>        if (1a href="+code=IS_ERR" class="sref">IS_ERR1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=micvdd" class="sref">micvdd1/a>)) {e.3231/a>                1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=PTR_ERR" class="sref">PTR_ERR1/a>(1a href="+code=info" class="sref">info1/a>->1a href="+code=micvdd" class="sref">micvdd1/a>);e.3241/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to get MICVDD: %d\n"1/spalu, 1a href="+code=ret" class="sref">ret1/a>);e.3251/a>                goto 1a href="+code=err" class="sref">err1/a>;e.3261/a>        }e.3271/a>e.3281/a>        1a href="+code=mutex_init" class="sref">mutex_init1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=lock" class="sref">lock1/a>);e.3291/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=arizona" class="sref">arizona1/a> = 1a href="+code=arizona" class="sref">arizona1/a>;e.3301/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=dev" class="sref">dev1/a> = &1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>;e.3311/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=detecting" class="sref">detecting1/a> = 1a href="+code=true" class="sref">true1/a>;e.3321/a>        1a href="+code=platform_set_drvda a" class="sref">platform_set_drvda a1/a>(1a href="+code=pdev" class="sref">pdev1/a>, 1a href="+code=info" class="sref">info1/a>);e.3331/a>e.3341/a>        switch (1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=type" class="sref">type1/a>) {e.3351/a>        case 1a href="+code=WM5102" class="sref">WM51021/a>:e.3361/a>                switch (1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=rev" class="sref">rev1/a>) {e.3371/a>                case 0:e.3381/a>                        1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_reva" class="sref">micd_reva1/a> = 1a href="+code=true" class="sref">true1/a>;e.3391/a>                        break;e.3401/a>                default:e.3411/a>                        break;e.3421/a>                }e.3431/a>                break;e.3441/a>        default:e.3451/a>                break;e.3461/a>        }e.3471/a>e.3481/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>.1a href="+code=nam " class="sref">nam 1/a> = 1spal class="string">"Headset Jack"1/spalu;e.3491/a>        1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>.1a href="+code=supported_cable" class="sref">supported_cable1/a> = 1a href="+code=arizona_cable" class="sref">arizona_cable1/a>;e.3501/a>e.3511/a>        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=extcon_dev_register" class="sref">extcon_dev_register1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>, 1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>);e.3521/a>        if (1a href="+code=ret" class="sref">ret1/a> < 0) {e.3531/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"extcon_dev_regster() failed: %d\n"1/spalu,e.3541/a>                        1a href="+code=ret" class="sref">ret1/a>);e.3551/a>                goto 1a href="+code=err" class="sref">err1/a>;e.3561/a>        }e.3571/a>e.3581/a>        if (1a href="+code=pda a" class="sref">pda a1/a>->1a href="+code=num_micd_configs" class="sref">num_micd_configs1/a>) {e.3591/a>                1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_modes" class="sref">micd_modes1/a> = 1a href="+code=pda a" class="sref">pda a1/a>->1a href="+code=micd_configs" class="sref">micd_configs1/a>;e.3601/a>                1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_num_modes" class="sref">micd_num_modes1/a> = 1a href="+code=pda a" class="sref">pda a1/a>->1a href="+code=num_micd_configs" class="sref">num_micd_configs1/a>;e.3611/a>        } else {e.3621/a>                1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_modes" class="sref">micd_modes1/a> = 1a href="+code=micd_default_modes" class="sref">micd_default_modes1/a>;e.3631/a>                1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_num_modes" class="sref">micd_num_modes1/a> = 1a href="+code=ARRAY_SIZE" class="sref">ARRAY_SIZE1/a>(1a href="+code=micd_default_modes" class="sref">micd_default_modes1/a>);e.3641/a>        }e.3651/a>e.3661/a>        if (1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=pda a" class="sref">pda a1/a>.1a href="+code=micd_pol_gpio" class="sref">micd_pol_gpio1/a> > 0) {e.3671/a>                if (1a href="+code=info" class="sref">info1/a>->1a href="+code=micd_modes" class="sref">micd_modes1/a>[0].1a href="+code=gpio" class="sref">gpio1/a>)e.3681/a>                        1a href="+code=mode" class="sref">mode1/a> = 1a href="+code=GPIOF_OUT_INIT_HIGH" class="sref">GPIOF_OUT_INIT_HIGH1/a>;e.3691/a>                elsee.3701/a>                        1a href="+code=mode" class="sref">mode1/a> = 1a href="+code=GPIOF_OUT_INIT_LOW" class="sref">GPIOF_OUT_INIT_LOW1/a>;e.3711/a>e.3721/a>                1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=devm_gpio_request_one" class="sref">devm_gpio_request_one1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>,e.3731/a>                                            1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=pda a" class="sref">pda a1/a>.1a href="+code=micd_pol_gpio" class="sref">micd_pol_gpio1/a>,e.3741/a>                                            1a href="+code=mode" class="sref">mode1/a>,e.3751/a>                                            1spal class="string">"MICD polarity"1/spalu);e.3761/a>                if (1a href="+code=ret" class="sref">ret1/a> != 0) {e.3771/a>                        1a href="+code=dev_err" class="sref">dev_err1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to request GPIO%d: %d\n"1/spalu,e.3781/a>                                1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=pda a" class="sref">pda a1/a>.1a href="+code=micd_pol_gpio" class="sref">micd_pol_gpio1/a>, 1a href="+code=ret" class="sref">ret1/a>);e.3791/a>                        goto 1a href="+code=err_register" class="sref">err_register1/a>;e.3801/a>                }e.3811/a>        }e.3821/a>e.3831/a>        1a href="+code=arizona_extcon_set_mode" class="sref">arizona_extcon_set_mode1/a>(1a href="+code=info" class="sref">info1/a>, 0);e.3841/a>e.3851/a>        1a href="+code=pm_runtime_enable" class="sref">pm_runtime_enable1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>);e.3861/a>        1a href="+code=pm_runtime_idle" class="sref">pm_runtime_idle1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>);e.3871/a>        1a href="+code=pm_runtime_get_sync" class="sref">pm_runtime_get_sync1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>);e.3881/a>e.3891/a>        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=arizona_request_irq" class="sref">arizona_request_irq1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_RISE" class="sref">ARIZONA_IRQ_JD_RISE1/a>,e.3901/a>                                  1spal class="string">"JACKDET rise"1/spalu, 1a href="+code=arizona_jackdet" class="sref">arizona_jackdet1/a>, 1a href="+code=info" class="sref">info1/a>);e.3911/a>        if (1a href="+code=ret" class="sref">ret1/a> != 0) {e.3921/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to get JACKDET rise IRQ: %d\n"1/spalu,e.3931/a>                        1a href="+code=ret" class="sref">ret1/a>);e.3941/a>                goto 1a href="+code=err_register" class="sref">err_register1/a>;e.3951/a>        }e.3961/a>e.3971/a>        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=arizona_set_irq_wake" class="sref">arizona_set_irq_wake1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_RISE" class="sref">ARIZONA_IRQ_JD_RISE1/a>, 1);e.3981/a>        if (1a href="+code=ret" class="sref">ret1/a> != 0) {e.3991/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to set JD rise IRQ wake: %d\n"1/spalu,e.4001/a>                        1a href="+code=ret" class="sref">ret1/a>);e.4011/a>                goto 1a href="+code=err_rise" class="sref">err_rise1/a>;e.4021/a>        }e.4031/a>e.4041/a>        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=arizona_request_irq" class="sref">arizona_request_irq1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_FALL" class="sref">ARIZONA_IRQ_JD_FALL1/a>,e.4051/a>                                  1spal class="string">"JACKDET fall"1/spalu, 1a href="+code=arizona_jackdet" class="sref">arizona_jackdet1/a>, 1a href="+code=info" class="sref">info1/a>);e.4061/a>        if (1a href="+code=ret" class="sref">ret1/a> != 0) {e.4071/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to get JD fall IRQ: %d\n"1/spalu, 1a href="+code=ret" class="sref">ret1/a>);e.4081/a>                goto 1a href="+code=err_rise_wake" class="sref">err_rise_wake1/a>;e.4091/a>        }e.4101/a>e.4111/a>        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=arizona_set_irq_wake" class="sref">arizona_set_irq_wake1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_FALL" class="sref">ARIZONA_IRQ_JD_FALL1/a>, 1);e.4121/a>        if (1a href="+code=ret" class="sref">ret1/a> != 0) {e.4131/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to set JD fall IRQ wake: %d\n"1/spalu,e.4141/a>                        1a href="+code=ret" class="sref">ret1/a>);e.4151/a>                goto 1a href="+code=err_fall" class="sref">err_fall1/a>;e.4161/a>        }e.4171/a>e.4181/a>        1a href="+code=ret" class="sref">ret1/a> = 1a href="+code=arizona_request_irq" class="sref">arizona_request_irq1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_MICDET" class="sref">ARIZONA_IRQ_MICDET1/a>,e.4191/a>                                  1spal class="string">"MICDET"1/spalu, 1a href="+code=arizona_micdet" class="sref">arizona_micdet1/a>, 1a href="+code=info" class="sref">info1/a>);e.4201/a>        if (1a href="+code=ret" class="sref">ret1/a> != 0) {e.4211/a>                1a href="+code=dev_err" class="sref">dev_err1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spal class="string">"Failed to get MICDET IRQ: %d\n"1/spalu, 1a href="+code=ret" class="sref">ret1/a>);e.4221/a>                goto 1a href="+code=err_fall_wake" class="sref">err_fall_wake1/a>;e.4231/a>        }e.4241/a>e.4251/a>        1a href="+code=regmap_upda e_bits" class="sref">regmap_upda e_bits1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_MIC_DETECT_1" class="sref">ARIZONA_MIC_DETECT_11/a>,e.4261/a>                           1a href="+code=ARIZONA_MICD_BIAS_STARTTIME_MASK" class="sref">ARIZONA_MICD_BIAS_STARTTIME_MASK1/a> |e.4271/a>                           1a href="+code=ARIZONA_MICD_RATE_MASK" class="sref">ARIZONA_MICD_RATE_MASK1/a>,e.4281/a>                           7 << 1a href="+code=ARIZONA_MICD_BIAS_STARTTIME_SHIFT" class="sref">ARIZONA_MICD_BIAS_STARTTIME_SHIFT1/a> |e.4291/a>                           8 << 1a href="+code=ARIZONA_MICD_RATE_SHIFT" class="sref">ARIZONA_MICD_RATE_SHIFT1/a>);e.4301/a>e.4311/a>        1a href="+code=arizona_clk32k_enable" class="sref">arizona_clk32k_enable1/a>(1a href="+code=arizona" class="sref">arizona1/a>);e.4321/a>        1a href="+code=regmap_upda e_bits" class="sref">regmap_upda e_bits1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_JACK_DETECT_DEBOUNCE" class="sref">ARIZONA_JACK_DETECT_DEBOUNCE1/a>,e.4331/a>                           1a href="+code=ARIZONA_JD1_DB" class="sref">ARIZONA_JD1_DB1/a>, 1a href="+code=ARIZONA_JD1_DB" class="sref">ARIZONA_JD1_DB1/a>);e.4341/a>        1a href="+code=regmap_upda e_bits" class="sref">regmap_upda e_bits1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_JACK_DETECT_ANALOGUE" class="sref">ARIZONA_JACK_DETECT_ANALOGUE1/a>,e.4351/a>                           1a href="+code=ARIZONA_JD1_ENA" class="sref">ARIZONA_JD1_ENA1/a>, 1a href="+code=ARIZONA_JD1_ENA" class="sref">ARIZONA_JD1_ENA1/a>);e.4361/a>e.4371/a>        1a href="+code=pm_runtime_put" class="sref">pm_runtime_put1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>);e.4381/a>e.4391/a>        return 0;e.4401/a>e.4411/a>1a href="+code=err_fall_wake" class="sref">err_fall_wake1/a>:e.4421/a>        1a href="+code=arizona_set_irq_wake" class="sref">arizona_set_irq_wake1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_FALL" class="sref">ARIZONA_IRQ_JD_FALL1/a>, 0);e.4431/a>1a href="+code=err_fall" class="sref">err_fall1/a>:e.4441/a>        1a href="+code=arizona_free_irq" class="sref">arizona_free_irq1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_FALL" class="sref">ARIZONA_IRQ_JD_FALL1/a>, 1a href="+code=info" class="sref">info1/a>);e.4451/a>1a href="+code=err_rise_wake" class="sref">err_rise_wake1/a>:e.4461/a>        1a href="+code=arizona_set_irq_wake" class="sref">arizona_set_irq_wake1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_RISE" class="sref">ARIZONA_IRQ_JD_RISE1/a>, 0);e.4471/a>1a href="+code=err_rise" class="sref">err_rise1/a>:e.4481/a>        1a href="+code=arizona_free_irq" class="sref">arizona_free_irq1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_RISE" class="sref">ARIZONA_IRQ_JD_RISE1/a>, 1a href="+code=info" class="sref">info1/a>);e.4491/a>1a href="+code=err_register" class="sref">err_register1/a>:e.4501/a>        1a href="+code=pm_runtime_disable" class="sref">pm_runtime_disable1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>);e.4511/a>        1a href="+code=extcon_dev_unregister" class="sref">extcon_dev_unregister1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>);e.4521/a>1a href="+code=err" class="sref">err1/a>:e.4531/a>        return 1a href="+code=ret" class="sref">ret1/a>;e.4541/a>}e.4551/a>e.4561/a>static int.1a href="+code=__devexit" class="sref">__devexit1/a> 1a href="+code=arizona_extcon_remove" class="sref">arizona_extcon_remove1/a>(struct.1a href="+code=platform_device" class="sref">platform_device1/a> *1a href="+code=pdev" class="sref">pdev1/a>)e.4571/a>{e.4581/a>        struct.1a href="+code=arizona_extcon_info" class="sref">arizona_extcon_info1/a> *1a href="+code=info" class="sref">info1/a> = 1a href="+code=platform_get_drvda a" class="sref">platform_get_drvda a1/a>(1a href="+code=pdev" class="sref">pdev1/a>);e.4591/a>        struct.1a href="+code=arizona" class="sref">arizona1/a> *1a href="+code=arizona" class="sref">arizona1/a> = 1a href="+code=info" class="sref">info1/a>->1a href="+code=arizona" class="sref">arizona1/a>;e.4601/a>e.4611/a>        1a href="+code=pm_runtime_disable" class="sref">pm_runtime_disable1/a>(&1a href="+code=pdev" class="sref">pdev1/a>->1a href="+code=dev" class="sref">dev1/a>);e.4621/a>e.4631/a>        1a href="+code=arizona_set_irq_wake" class="sref">arizona_set_irq_wake1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_RISE" class="sref">ARIZONA_IRQ_JD_RISE1/a>, 0);e.4641/a>        1a href="+code=arizona_set_irq_wake" class="sref">arizona_set_irq_wake1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_FALL" class="sref">ARIZONA_IRQ_JD_FALL1/a>, 0);e.4651/a>        1a href="+code=arizona_free_irq" class="sref">arizona_free_irq1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_MICDET" class="sref">ARIZONA_IRQ_MICDET1/a>, 1a href="+code=info" class="sref">info1/a>);e.4661/a>        1a href="+code=arizona_free_irq" class="sref">arizona_free_irq1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_RISE" class="sref">ARIZONA_IRQ_JD_RISE1/a>, 1a href="+code=info" class="sref">info1/a>);e.4671/a>        1a href="+code=arizona_free_irq" class="sref">arizona_free_irq1/a>(1a href="+code=arizona" class="sref">arizona1/a>, 1a href="+code=ARIZONA_IRQ_JD_FALL" class="sref">ARIZONA_IRQ_JD_FALL1/a>, 1a href="+code=info" class="sref">info1/a>);e.4681/a>        1a href="+code=regmap_upda e_bits" class="sref">regmap_upda e_bits1/a>(1a href="+code=arizona" class="sref">arizona1/a>->1a href="+code=regmap" class="sref">regmap1/a>, 1a href="+code=ARIZONA_JACK_DETECT_ANALOGUE" class="sref">ARIZONA_JACK_DETECT_ANALOGUE1/a>,e.4691/a>                           1a href="+code=ARIZONA_JD1_ENA" class="sref">ARIZONA_JD1_ENA1/a>, 0);e.4701/a>        1a href="+code=arizona_clk32k_disable" class="sref">arizona_clk32k_disable1/a>(1a href="+code=arizona" class="sref">arizona1/a>);e.4711/a>        1a href="+code=extcon_dev_unregister" class="sref">extcon_dev_unregister1/a>(&1a href="+code=info" class="sref">info1/a>->1a href="+code=edev" class="sref">edev1/a>);e.4721/a>e.4731/a>        return 0;e.4741/a>}e.4751/a>e.4761/a>static struct.1a href="+code=platform_driver" class="sref">platform_driver1/a> 1a href="+code=arizona_extcon_driver" class="sref">arizona_extcon_driver1/a> = {e.4771/a>        .1a href="+code=driver" class="sref">driver1/a>         = {e.4781/a>                .1a href="+code=nam " class="sref">nam 1/a>   = 1spal class="string">"arizona-extcon"1/spalu,e.4791/a>                .1a href="+code=owner" class="sref">owner1/a>  = 1a href="+code=THIS_MODULE" class="sref">THIS_MODULE1/a>,e.4801/a>        },e.4811/a>        .1a href="+code=probe" class="sref">probe1/a>          = 1a href="+code=arizona_extcon_probe" class="sref">arizona_extcon_probe1/a>,e.4821/a>        .1a href="+code=remove" class="sref">remove1/a>         = 1a href="+code=__devexit_p" class="sref">__devexit_p1/a>(1a href="+code=arizona_extcon_remove" class="sref">arizona_extcon_remove1/a>),e.4831/a>};e.4841/a>e.4851/a>1a href="+code=module_platform_driver" class="sref">module_platform_driver1/a>(1a href="+code=arizona_extcon_driver" class="sref">arizona_extcon_driver1/a>);e.4861/a>e.4871/a>1a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION1/a>(1spal class="string">"Arizona Extcon driver"1/spalu);e.4881/a>1a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR1/a>(1spal class="string">"Mark Brown <broonie@opensource.wolfsonmicro.com>"1/spalu);e.4891/a>1a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE1/a>(1spal class="string">"GPL"1/spalu);e.4901/a>1a href="+code=MODULE_ALIAS" class="sref">MODULE_ALIAS1/a>(1spal class="string">"platform:extcon-arizona"1/spalu);e.4911/a>