diff options
-rw-r--r-- | drivers/extcon/extcon-arizona.c | 36 | ||||
-rw-r--r-- | include/linux/mfd/arizona/core.h | 2 | ||||
-rw-r--r-- | sound/soc/codecs/arizona.c | 4 |
3 files changed, 23 insertions, 19 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 63f01c42aed4..95cf7f875bb3 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -136,18 +136,22 @@ static const char *arizona_cable[] = { | |||
136 | 136 | ||
137 | static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info); | 137 | static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info); |
138 | 138 | ||
139 | static void arizona_extcon_do_magic(struct arizona_extcon_info *info, | 139 | static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info, |
140 | unsigned int magic) | 140 | bool clamp) |
141 | { | 141 | { |
142 | struct arizona *arizona = info->arizona; | 142 | struct arizona *arizona = info->arizona; |
143 | unsigned int val = 0; | ||
143 | int ret; | 144 | int ret; |
144 | 145 | ||
146 | if (clamp) | ||
147 | val = ARIZONA_RMV_SHRT_HP1L; | ||
148 | |||
145 | mutex_lock(&arizona->dapm->card->dapm_mutex); | 149 | mutex_lock(&arizona->dapm->card->dapm_mutex); |
146 | 150 | ||
147 | arizona->hpdet_magic = magic; | 151 | arizona->hpdet_clamp = clamp; |
148 | 152 | ||
149 | /* Keep the HP output stages disabled while doing the magic */ | 153 | /* Keep the HP output stages disabled while doing the clamp */ |
150 | if (magic) { | 154 | if (clamp) { |
151 | ret = regmap_update_bits(arizona->regmap, | 155 | ret = regmap_update_bits(arizona->regmap, |
152 | ARIZONA_OUTPUT_ENABLES_1, | 156 | ARIZONA_OUTPUT_ENABLES_1, |
153 | ARIZONA_OUT1L_ENA | | 157 | ARIZONA_OUT1L_ENA | |
@@ -158,20 +162,20 @@ static void arizona_extcon_do_magic(struct arizona_extcon_info *info, | |||
158 | ret); | 162 | ret); |
159 | } | 163 | } |
160 | 164 | ||
161 | ret = regmap_update_bits(arizona->regmap, 0x225, 0x4000, | 165 | ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1L, |
162 | magic); | 166 | ARIZONA_RMV_SHRT_HP1L, val); |
163 | if (ret != 0) | 167 | if (ret != 0) |
164 | dev_warn(arizona->dev, "Failed to do magic: %d\n", | 168 | dev_warn(arizona->dev, "Failed to do clamp: %d\n", |
165 | ret); | 169 | ret); |
166 | 170 | ||
167 | ret = regmap_update_bits(arizona->regmap, 0x226, 0x4000, | 171 | ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1R, |
168 | magic); | 172 | ARIZONA_RMV_SHRT_HP1R, val); |
169 | if (ret != 0) | 173 | if (ret != 0) |
170 | dev_warn(arizona->dev, "Failed to do magic: %d\n", | 174 | dev_warn(arizona->dev, "Failed to do clamp: %d\n", |
171 | ret); | 175 | ret); |
172 | 176 | ||
173 | /* Restore the desired state while not doing the magic */ | 177 | /* Restore the desired state while not doing the clamp */ |
174 | if (!magic) { | 178 | if (!clamp) { |
175 | ret = regmap_update_bits(arizona->regmap, | 179 | ret = regmap_update_bits(arizona->regmap, |
176 | ARIZONA_OUTPUT_ENABLES_1, | 180 | ARIZONA_OUTPUT_ENABLES_1, |
177 | ARIZONA_OUT1L_ENA | | 181 | ARIZONA_OUT1L_ENA | |
@@ -603,7 +607,7 @@ done: | |||
603 | ARIZONA_HP_IMPEDANCE_RANGE_MASK | ARIZONA_HP_POLL, | 607 | ARIZONA_HP_IMPEDANCE_RANGE_MASK | ARIZONA_HP_POLL, |
604 | 0); | 608 | 0); |
605 | 609 | ||
606 | arizona_extcon_do_magic(info, 0); | 610 | arizona_extcon_hp_clamp(info, false); |
607 | 611 | ||
608 | if (id_gpio) | 612 | if (id_gpio) |
609 | gpio_set_value_cansleep(id_gpio, 0); | 613 | gpio_set_value_cansleep(id_gpio, 0); |
@@ -648,7 +652,7 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) | |||
648 | if (info->mic) | 652 | if (info->mic) |
649 | arizona_stop_mic(info); | 653 | arizona_stop_mic(info); |
650 | 654 | ||
651 | arizona_extcon_do_magic(info, 0x4000); | 655 | arizona_extcon_hp_clamp(info, true); |
652 | 656 | ||
653 | ret = regmap_update_bits(arizona->regmap, | 657 | ret = regmap_update_bits(arizona->regmap, |
654 | ARIZONA_ACCESSORY_DETECT_MODE_1, | 658 | ARIZONA_ACCESSORY_DETECT_MODE_1, |
@@ -699,7 +703,7 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) | |||
699 | 703 | ||
700 | info->hpdet_active = true; | 704 | info->hpdet_active = true; |
701 | 705 | ||
702 | arizona_extcon_do_magic(info, 0x4000); | 706 | arizona_extcon_hp_clamp(info, true); |
703 | 707 | ||
704 | ret = regmap_update_bits(arizona->regmap, | 708 | ret = regmap_update_bits(arizona->regmap, |
705 | ARIZONA_ACCESSORY_DETECT_MODE_1, | 709 | ARIZONA_ACCESSORY_DETECT_MODE_1, |
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h index 910e3aa1e965..4863548faff7 100644 --- a/include/linux/mfd/arizona/core.h +++ b/include/linux/mfd/arizona/core.h | |||
@@ -126,7 +126,7 @@ struct arizona { | |||
126 | struct regmap_irq_chip_data *aod_irq_chip; | 126 | struct regmap_irq_chip_data *aod_irq_chip; |
127 | struct regmap_irq_chip_data *irq_chip; | 127 | struct regmap_irq_chip_data *irq_chip; |
128 | 128 | ||
129 | bool hpdet_magic; | 129 | bool hpdet_clamp; |
130 | unsigned int hp_ena; | 130 | unsigned int hp_ena; |
131 | 131 | ||
132 | struct mutex clk_lock; | 132 | struct mutex clk_lock; |
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 29202610dd0d..fb58c7ee3780 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -840,8 +840,8 @@ int arizona_hp_ev(struct snd_soc_dapm_widget *w, | |||
840 | priv->arizona->hp_ena &= ~mask; | 840 | priv->arizona->hp_ena &= ~mask; |
841 | priv->arizona->hp_ena |= val; | 841 | priv->arizona->hp_ena |= val; |
842 | 842 | ||
843 | /* Force off if HPDET magic is active */ | 843 | /* Force off if HPDET clamp is active */ |
844 | if (priv->arizona->hpdet_magic) | 844 | if (priv->arizona->hpdet_clamp) |
845 | val = 0; | 845 | val = 0; |
846 | 846 | ||
847 | regmap_update_bits_async(arizona->regmap, ARIZONA_OUTPUT_ENABLES_1, | 847 | regmap_update_bits_async(arizona->regmap, ARIZONA_OUTPUT_ENABLES_1, |