aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2015-02-16 10:41:03 -0500
committerChanwoo Choi <cw00.choi@samsung.com>2015-03-03 19:42:24 -0500
commit43f0acd96163754672cfb8c8015c54ec527a2cce (patch)
treecf70cb82e3b91bb6c7c6e4314e00e81ee7cae669
parent112bdfaa525fd5993e17885861342893f15290b0 (diff)
extcon: arizona: Fix headphone clamping on wm5110
wm5110 requires slightly different configuration of the headphone clamps to other Arizona devices. Otherwise headphone detection accuracy will be way off. This patch adds the needed clamping. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
-rw-r--r--drivers/extcon/extcon-arizona.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 95cf7f875bb3..d9e763cddb50 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -140,11 +140,24 @@ static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info,
140 bool clamp) 140 bool clamp)
141{ 141{
142 struct arizona *arizona = info->arizona; 142 struct arizona *arizona = info->arizona;
143 unsigned int val = 0; 143 unsigned int mask = 0, val = 0;
144 int ret; 144 int ret;
145 145
146 if (clamp) 146 switch (arizona->type) {
147 val = ARIZONA_RMV_SHRT_HP1L; 147 case WM5110:
148 mask = ARIZONA_HP1L_SHRTO | ARIZONA_HP1L_FLWR |
149 ARIZONA_HP1L_SHRTI;
150 if (clamp)
151 val = ARIZONA_HP1L_SHRTO;
152 else
153 val = ARIZONA_HP1L_FLWR | ARIZONA_HP1L_SHRTI;
154 break;
155 default:
156 mask = ARIZONA_RMV_SHRT_HP1L;
157 if (clamp)
158 val = ARIZONA_RMV_SHRT_HP1L;
159 break;
160 };
148 161
149 mutex_lock(&arizona->dapm->card->dapm_mutex); 162 mutex_lock(&arizona->dapm->card->dapm_mutex);
150 163
@@ -163,13 +176,13 @@ static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info,
163 } 176 }
164 177
165 ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1L, 178 ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1L,
166 ARIZONA_RMV_SHRT_HP1L, val); 179 mask, val);
167 if (ret != 0) 180 if (ret != 0)
168 dev_warn(arizona->dev, "Failed to do clamp: %d\n", 181 dev_warn(arizona->dev, "Failed to do clamp: %d\n",
169 ret); 182 ret);
170 183
171 ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1R, 184 ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1R,
172 ARIZONA_RMV_SHRT_HP1R, val); 185 mask, val);
173 if (ret != 0) 186 if (ret != 0)
174 dev_warn(arizona->dev, "Failed to do clamp: %d\n", 187 dev_warn(arizona->dev, "Failed to do clamp: %d\n",
175 ret); 188 ret);