diff options
author | Richard Fitzgerald <rf@opensource.wolfsonmicro.com> | 2014-05-23 07:54:57 -0400 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2014-06-16 00:33:18 -0400 |
commit | a288d648715bab6a1ab2b72cb1c1cc79cdc8cb43 (patch) | |
tree | 0882b812423b89b408f2d9a581fee87f6aefd255 /drivers/extcon | |
parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) |
extcon: arizona: support inverted jack detect switch
Add config option for inverted jack detect switch that
opens when jack is inserted.
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
[Acked by Lee Jones for MFD part]
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r-- | drivers/extcon/extcon-arizona.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 6c84e3d12043..cf907430a698 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -39,6 +39,11 @@ | |||
39 | #define ARIZONA_ACCDET_MODE_HPL 1 | 39 | #define ARIZONA_ACCDET_MODE_HPL 1 |
40 | #define ARIZONA_ACCDET_MODE_HPR 2 | 40 | #define ARIZONA_ACCDET_MODE_HPR 2 |
41 | 41 | ||
42 | #define ARIZONA_MICD_CLAMP_MODE_JDL 0x4 | ||
43 | #define ARIZONA_MICD_CLAMP_MODE_JDH 0x5 | ||
44 | #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 | ||
45 | #define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb | ||
46 | |||
42 | #define ARIZONA_HPDET_MAX 10000 | 47 | #define ARIZONA_HPDET_MAX 10000 |
43 | 48 | ||
44 | #define HPDET_DEBOUNCE 500 | 49 | #define HPDET_DEBOUNCE 500 |
@@ -962,10 +967,16 @@ static irqreturn_t arizona_jackdet(int irq, void *data) | |||
962 | 967 | ||
963 | if (arizona->pdata.jd_gpio5) { | 968 | if (arizona->pdata.jd_gpio5) { |
964 | mask = ARIZONA_MICD_CLAMP_STS; | 969 | mask = ARIZONA_MICD_CLAMP_STS; |
965 | present = 0; | 970 | if (arizona->pdata.jd_invert) |
971 | present = ARIZONA_MICD_CLAMP_STS; | ||
972 | else | ||
973 | present = 0; | ||
966 | } else { | 974 | } else { |
967 | mask = ARIZONA_JD1_STS; | 975 | mask = ARIZONA_JD1_STS; |
968 | present = ARIZONA_JD1_STS; | 976 | if (arizona->pdata.jd_invert) |
977 | present = 0; | ||
978 | else | ||
979 | present = ARIZONA_JD1_STS; | ||
969 | } | 980 | } |
970 | 981 | ||
971 | ret = regmap_read(arizona->regmap, ARIZONA_AOD_IRQ_RAW_STATUS, &val); | 982 | ret = regmap_read(arizona->regmap, ARIZONA_AOD_IRQ_RAW_STATUS, &val); |
@@ -1096,6 +1107,7 @@ static int arizona_extcon_probe(struct platform_device *pdev) | |||
1096 | struct arizona_pdata *pdata = &arizona->pdata; | 1107 | struct arizona_pdata *pdata = &arizona->pdata; |
1097 | struct arizona_extcon_info *info; | 1108 | struct arizona_extcon_info *info; |
1098 | unsigned int val; | 1109 | unsigned int val; |
1110 | unsigned int clamp_mode; | ||
1099 | int jack_irq_fall, jack_irq_rise; | 1111 | int jack_irq_fall, jack_irq_rise; |
1100 | int ret, mode, i, j; | 1112 | int ret, mode, i, j; |
1101 | 1113 | ||
@@ -1305,16 +1317,22 @@ static int arizona_extcon_probe(struct platform_device *pdev) | |||
1305 | regmap_write(arizona->regmap, ARIZONA_GPIO5_CTRL, | 1317 | regmap_write(arizona->regmap, ARIZONA_GPIO5_CTRL, |
1306 | val); | 1318 | val); |
1307 | 1319 | ||
1308 | regmap_update_bits(arizona->regmap, | 1320 | if (arizona->pdata.jd_invert) |
1309 | ARIZONA_MICD_CLAMP_CONTROL, | 1321 | clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDH_GP5H; |
1310 | ARIZONA_MICD_CLAMP_MODE_MASK, 0x9); | 1322 | else |
1323 | clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDL_GP5H; | ||
1311 | } else { | 1324 | } else { |
1312 | regmap_update_bits(arizona->regmap, | 1325 | if (arizona->pdata.jd_invert) |
1313 | ARIZONA_MICD_CLAMP_CONTROL, | 1326 | clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDH; |
1314 | ARIZONA_MICD_CLAMP_MODE_MASK, 0x4); | 1327 | else |
1328 | clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDL; | ||
1315 | } | 1329 | } |
1316 | 1330 | ||
1317 | regmap_update_bits(arizona->regmap, | 1331 | regmap_update_bits(arizona->regmap, |
1332 | ARIZONA_MICD_CLAMP_CONTROL, | ||
1333 | ARIZONA_MICD_CLAMP_MODE_MASK, clamp_mode); | ||
1334 | |||
1335 | regmap_update_bits(arizona->regmap, | ||
1318 | ARIZONA_JACK_DETECT_DEBOUNCE, | 1336 | ARIZONA_JACK_DETECT_DEBOUNCE, |
1319 | ARIZONA_MICD_CLAMP_DB, | 1337 | ARIZONA_MICD_CLAMP_DB, |
1320 | ARIZONA_MICD_CLAMP_DB); | 1338 | ARIZONA_MICD_CLAMP_DB); |