X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sound%2Fsoc%2Fcodecs%2Fda7219-aad.c;h=4e369a1c5d88707eee3011d59aa406339e27bd1f;hb=7e75c99e6e2aac23b3e563b8c9e93d3e13afad1e;hp=f0057cd223a4e2dfa23e2acd23d6154cd9ec993f;hpb=62e6e9bab3014e3931ffbc82de7a9d2fd94cb8cd;p=deliverable%2Flinux.git diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index f0057cd223a4..4e369a1c5d88 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -115,12 +116,23 @@ static void da7219_aad_hptest_work(struct work_struct *work) u16 tonegen_freq_hptest; u8 accdet_cfg8; - int report = 0; + int report = 0, ret = 0; /* Lock DAPM and any Kcontrols that are affected by this test */ snd_soc_dapm_mutex_lock(dapm); mutex_lock(&da7219->lock); + /* Ensure MCLK is available for HP test procedure */ + if (da7219->mclk) { + ret = clk_prepare_enable(da7219->mclk); + if (ret) { + dev_err(codec->dev, "Failed to enable mclk - %d\n", ret); + mutex_unlock(&da7219->lock); + snd_soc_dapm_mutex_unlock(dapm); + return; + } + } + /* Bypass cache so it saves current settings */ regcache_cache_bypass(da7219->regmap, true); @@ -250,6 +262,10 @@ static void da7219_aad_hptest_work(struct work_struct *work) snd_soc_update_bits(codec, DA7219_HP_R_CTRL, DA7219_HP_R_AMP_OE_MASK, DA7219_HP_R_AMP_OE_MASK); + /* Remove MCLK, if previously enabled */ + if (da7219->mclk) + clk_disable_unprepare(da7219->mclk); + mutex_unlock(&da7219->lock); snd_soc_dapm_mutex_unlock(dapm);