diff options
author | Bard Liao <bardliao@realtek.com> | 2017-06-29 08:07:50 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-06-30 07:36:38 -0400 |
commit | b059ca720e2ac04380240500eb8d8ba931898570 (patch) | |
tree | 8923e0e60aca973096ae97db142a45b179953f01 | |
parent | 18fe7869764c0b86e8ce6539bbb6e528f1d9928f (diff) |
ASoC: rt5665: calibration should be done before jack detection
We will set some volatile registers in jack detection function. But
those volatile registers will be clear in rt5665_calibrate function
because we set cache bypass and reset codec in rt5665_calibrate function.
This patch add a flag to make sure that rt5665_calibrate is done
before starting jack detection.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/rt5665.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5665.c b/sound/soc/codecs/rt5665.c index 7420010fd8e9..370ed54d1e15 100644 --- a/sound/soc/codecs/rt5665.c +++ b/sound/soc/codecs/rt5665.c | |||
@@ -70,6 +70,7 @@ struct rt5665_priv { | |||
70 | int jack_type; | 70 | int jack_type; |
71 | int irq_work_delay_time; | 71 | int irq_work_delay_time; |
72 | unsigned int sar_adc_value; | 72 | unsigned int sar_adc_value; |
73 | bool calibration_done; | ||
73 | }; | 74 | }; |
74 | 75 | ||
75 | static const struct reg_default rt5665_reg[] = { | 76 | static const struct reg_default rt5665_reg[] = { |
@@ -1305,6 +1306,11 @@ static void rt5665_jack_detect_handler(struct work_struct *work) | |||
1305 | usleep_range(10000, 15000); | 1306 | usleep_range(10000, 15000); |
1306 | } | 1307 | } |
1307 | 1308 | ||
1309 | while (!rt5665->calibration_done) { | ||
1310 | pr_debug("%s calibration not ready\n", __func__); | ||
1311 | usleep_range(10000, 15000); | ||
1312 | } | ||
1313 | |||
1308 | mutex_lock(&rt5665->calibrate_mutex); | 1314 | mutex_lock(&rt5665->calibrate_mutex); |
1309 | 1315 | ||
1310 | val = snd_soc_read(rt5665->codec, RT5665_AJD1_CTRL) & 0x0010; | 1316 | val = snd_soc_read(rt5665->codec, RT5665_AJD1_CTRL) & 0x0010; |
@@ -4695,6 +4701,7 @@ static void rt5665_calibrate(struct rt5665_priv *rt5665) | |||
4695 | regmap_write(rt5665->regmap, RT5665_ASRC_8, 0x0120); | 4701 | regmap_write(rt5665->regmap, RT5665_ASRC_8, 0x0120); |
4696 | 4702 | ||
4697 | out_unlock: | 4703 | out_unlock: |
4704 | rt5665->calibration_done = true; | ||
4698 | mutex_unlock(&rt5665->calibrate_mutex); | 4705 | mutex_unlock(&rt5665->calibrate_mutex); |
4699 | } | 4706 | } |
4700 | 4707 | ||