(CR):[Kane][kernel]audio:spk pa not power off cause high current
authorzhangjiaquan <zhangjiaquan@huaqin.com>
Wed, 26 Dec 2018 12:01:08 +0000 (07:01 -0500)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:30:09 +0000 (17:30 +0800)
1,wait the pa status to stable when power off

Change-Id: Ife2af1e7c2b35ea2edcdc883381fe62587d3c2aa
Signed-off-by: zhangjiaquan <zhangjiaquan@huaqin.com>
sound/soc/codecs/cs35l41.c

index 77dc57511b1fd3a206511b170e1c0eb88261997b..25c2d328008fd2a5b08b595345b34362970e1a67 100755 (executable)
@@ -775,7 +775,7 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w,
 {
        struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct cs35l41_private *cs35l41 = snd_soc_codec_get_drvdata(codec);
-       int ret = 0;
+       int ret = 0,status = -1;
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -817,6 +817,17 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w,
                regmap_multi_reg_write_bypassed(cs35l41->regmap,
                                        cs35l41_pdn_patch,
                                        ARRAY_SIZE(cs35l41_pdn_patch));
+               for (int i = 0; i < 5; i++) {
+                       msleep(2);
+                       regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS1 , &status);
+                       dev_err(cs35l41->dev, "%s  cs35l41_main_amp_event status=%x\n",__func__,status);
+                       if ((status)& CS35L41_PDN_DONE_MASK)
+                       {
+                               regmap_write(cs35l41->regmap, CS35L41_IRQ1_STATUS1,
+                               CS35L41_PDN_DONE_MASK);
+                               break;
+                       }
+               }
                break;
        default:
                dev_err(codec->dev, "Invalid event = 0x%x\n", event);