diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2015-09-16 05:42:18 -0400 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2015-09-22 02:27:59 -0400 |
commit | f719ae3311f9b609151a0319f0cc2fdb7491d37a (patch) | |
tree | 1ae0906efed7d6435f43e2388f564f3641af44b7 /drivers/extcon | |
parent | 6772a5ab4f53672adce6310dffe2b0c6987d8f92 (diff) |
extcon: arizona: Additional settings to improve accuracy of HP detect
If the TST_CAP_SEL bits aren't set correctly on wm5110/8280 there will
be a 100k load along side the headphones, which will affect the accurary
towards the very top of the detection range. This patch sets those bits.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r-- | drivers/extcon/extcon-arizona.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index d719ee724651..6d35147b1d6c 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -43,6 +43,9 @@ | |||
43 | #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 | 43 | #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 |
44 | #define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb | 44 | #define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb |
45 | 45 | ||
46 | #define ARIZONA_TST_CAP_DEFAULT 0x3 | ||
47 | #define ARIZONA_TST_CAP_CLAMP 0x1 | ||
48 | |||
46 | #define ARIZONA_HPDET_MAX 10000 | 49 | #define ARIZONA_HPDET_MAX 10000 |
47 | 50 | ||
48 | #define HPDET_DEBOUNCE 500 | 51 | #define HPDET_DEBOUNCE 500 |
@@ -147,6 +150,7 @@ static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info, | |||
147 | { | 150 | { |
148 | struct arizona *arizona = info->arizona; | 151 | struct arizona *arizona = info->arizona; |
149 | unsigned int mask = 0, val = 0; | 152 | unsigned int mask = 0, val = 0; |
153 | unsigned int cap_sel = 0; | ||
150 | int ret; | 154 | int ret; |
151 | 155 | ||
152 | switch (arizona->type) { | 156 | switch (arizona->type) { |
@@ -154,10 +158,21 @@ static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info, | |||
154 | case WM8280: | 158 | case WM8280: |
155 | mask = ARIZONA_HP1L_SHRTO | ARIZONA_HP1L_FLWR | | 159 | mask = ARIZONA_HP1L_SHRTO | ARIZONA_HP1L_FLWR | |
156 | ARIZONA_HP1L_SHRTI; | 160 | ARIZONA_HP1L_SHRTI; |
157 | if (clamp) | 161 | if (clamp) { |
158 | val = ARIZONA_HP1L_SHRTO; | 162 | val = ARIZONA_HP1L_SHRTO; |
159 | else | 163 | cap_sel = ARIZONA_TST_CAP_CLAMP; |
164 | } else { | ||
160 | val = ARIZONA_HP1L_FLWR | ARIZONA_HP1L_SHRTI; | 165 | val = ARIZONA_HP1L_FLWR | ARIZONA_HP1L_SHRTI; |
166 | cap_sel = ARIZONA_TST_CAP_DEFAULT; | ||
167 | } | ||
168 | |||
169 | ret = regmap_update_bits(arizona->regmap, | ||
170 | ARIZONA_HP_TEST_CTRL_1, | ||
171 | ARIZONA_HP1_TST_CAP_SEL_MASK, | ||
172 | cap_sel); | ||
173 | if (ret != 0) | ||
174 | dev_warn(arizona->dev, | ||
175 | "Failed to set TST_CAP_SEL: %d\n", ret); | ||
161 | break; | 176 | break; |
162 | default: | 177 | default: |
163 | mask = ARIZONA_RMV_SHRT_HP1L; | 178 | mask = ARIZONA_RMV_SHRT_HP1L; |