Merge remote-tracking branches 'asoc/topic/adau1977', 'asoc/topic/adav80x', 'asoc...
authorMark Brown <broonie@kernel.org>
Fri, 5 Jun 2015 17:54:49 +0000 (18:54 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 5 Jun 2015 17:54:49 +0000 (18:54 +0100)
1  2  3  4  5 
sound/soc/codecs/adau1977.c
sound/soc/codecs/adav80x.c
sound/soc/codecs/arizona.c
sound/soc/codecs/wm5102.c
sound/soc/codecs/wm5110.c
sound/soc/codecs/wm8997.c

@@@@@@ -202,7 -202,7 -202,7 -202,7 -202,7 +202,7 @@@@@@ static const struct snd_soc_dapm_route 
                ADAU1977_REG_DC_HPF_CAL, (x) - 1, 1, 0)
     
     #define ADAU1977_DC_SUB_SWITCH(x) \
- ---   SOC_SINGLE("ADC" #x " DC Substraction Capture Switch", \
+ +++   SOC_SINGLE("ADC" #x " DC Subtraction Capture Switch", \
                ADAU1977_REG_DC_HPF_CAL, (x) + 3, 1, 0)
     
     static const struct snd_kcontrol_new adau1977_snd_controls[] = {
@@@@@@ -485,7 -485,7 -485,7 -485,7 -485,7 +485,7 @@@@@@ static int adau1977_set_bias_level(stru
        case SND_SOC_BIAS_PREPARE:
                break;
        case SND_SOC_BIAS_STANDBY:
 ----           if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
 ++++           if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF)
                        ret = adau1977_power_enable(adau1977);
                break;
        case SND_SOC_BIAS_OFF:
                break;
        }
     
 ----   if (ret)
 ----           return ret;
 ----
 ----   codec->dapm.bias_level = level;
 ----
 ----   return 0;
 ++++   return ret;
     }
     
     static int adau1977_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
@@@@@@ -848,13 -853,12 -853,12 -853,12 -853,12 +848,13 @@@@@@ static int adau1977_set_sysclk(struct s
     
     static int adau1977_codec_probe(struct snd_soc_codec *codec)
     {
 ++++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(codec);
        int ret;
     
        switch (adau1977->type) {
        case ADAU1977:
 ----           ret = snd_soc_dapm_new_controls(&codec->dapm,
 ++++           ret = snd_soc_dapm_new_controls(dapm,
                        adau1977_micbias_dapm_widgets,
                        ARRAY_SIZE(adau1977_micbias_dapm_widgets));
                if (ret < 0)
@@@@@@ -539,7 -539,7 -539,7 -539,7 -539,7 +539,7 @@@@@@ static int adav80x_set_sysclk(struct sn
                              unsigned int freq, int dir)
     {
        struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
-- --   struct snd_soc_dapm_context *dapm = &codec->dapm;
++ ++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
     
        if (dir == SND_SOC_CLOCK_IN) {
                switch (clk_id) {
     static int adav80x_set_pll(struct snd_soc_codec *codec, int pll_id,
                int source, unsigned int freq_in, unsigned int freq_out)
     {
++ ++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
        unsigned int pll_ctrl1 = 0;
        unsigned int pll_ctrl2 = 0;
     
                adav80x->pll_src = source;
     
-- --           snd_soc_dapm_sync(&codec->dapm);
++ ++           snd_soc_dapm_sync(dapm);
        }
     
        return 0;
@@@@@@ -714,6 -714,7 -715,7 -714,7 -714,7 +715,6 @@@@@@ static int adav80x_set_bias_level(struc
                break;
        }
     
 ----   codec->dapm.bias_level = level;
        return 0;
     }
     
@@@@@@ -800,11 -801,11 -802,12 -801,11 -801,11 +801,12 @@@@@@ static struct snd_soc_dai_driver adav80
     
     static int adav80x_probe(struct snd_soc_codec *codec)
     {
++ ++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
     
        /* Force PLLs on for SYSCLK output */
-- --   snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL1");
-- --   snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL2");
++ ++   snd_soc_dapm_force_enable_pin(dapm, "PLL1");
++ ++   snd_soc_dapm_force_enable_pin(dapm, "PLL2");
     
        /* Power down S/PDIF receiver, since it is currently not supported */
        regmap_write(adav80x->regmap, ADAV80X_PLL_OUTE, 0x20);
@@@@@@ -208,12 -208,11 -208,11 -208,11 -208,11 +208,12 @@@@@@ static const struct snd_soc_dapm_widge
     
     int arizona_init_spk(struct snd_soc_codec *codec)
     {
 ++++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
        struct arizona *arizona = priv->arizona;
        int ret;
     
 ----   ret = snd_soc_dapm_new_controls(&codec->dapm, &arizona_spkl, 1);
 ++++   ret = snd_soc_dapm_new_controls(dapm, &arizona_spkl, 1);
        if (ret != 0)
                return ret;
     
        case WM8997:
                break;
        default:
 ----           ret = snd_soc_dapm_new_controls(&codec->dapm,
 ----                                           &arizona_spkr, 1);
 ++++           ret = snd_soc_dapm_new_controls(dapm, &arizona_spkr, 1);
                if (ret != 0)
                        return ret;
                break;
@@@@@@ -258,14 -258,13 -258,13 -258,13 -258,13 +258,14 @@@@@@ static const struct snd_soc_dapm_route 
     
     int arizona_init_mono(struct snd_soc_codec *codec)
     {
 ++++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
        struct arizona *arizona = priv->arizona;
        int i;
     
        for (i = 0; i < ARIZONA_MAX_OUTPUT; ++i) {
                if (arizona->pdata.out_mono[i])
 ----                   snd_soc_dapm_add_routes(&codec->dapm,
 ++++                   snd_soc_dapm_add_routes(dapm,
                                                &arizona_mono_routes[i], 1);
        }
     
@@@@@@ -275,7 -274,6 -274,6 -274,6 -274,6 +275,7 @@@@@@ EXPORT_SYMBOL_GPL(arizona_init_mono)
     
     int arizona_init_gpio(struct snd_soc_codec *codec)
     {
 ++++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
        struct arizona *arizona = priv->arizona;
        int i;
        switch (arizona->type) {
        case WM5110:
        case WM8280:
 ----           snd_soc_dapm_disable_pin(&codec->dapm, "DRC2 Signal Activity");
 ++++           snd_soc_dapm_disable_pin(dapm, "DRC2 Signal Activity");
                break;
        default:
                break;
        }
     
 ----   snd_soc_dapm_disable_pin(&codec->dapm, "DRC1 Signal Activity");
 ++++   snd_soc_dapm_disable_pin(dapm, "DRC1 Signal Activity");
     
        for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) {
                switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) {
                case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT:
 ----                   snd_soc_dapm_enable_pin(&codec->dapm,
 ----                                           "DRC1 Signal Activity");
 ++++                   snd_soc_dapm_enable_pin(dapm, "DRC1 Signal Activity");
                        break;
                case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT:
 ----                   snd_soc_dapm_enable_pin(&codec->dapm,
 ----                                           "DRC2 Signal Activity");
 ++++                   snd_soc_dapm_enable_pin(dapm, "DRC2 Signal Activity");
                        break;
                default:
                        break;
@@@@@@ -851,6 -851,6 -851,6 -851,134 -851,6 +851,134 @@@@@@ int arizona_hp_ev(struct snd_soc_dapm_w
     }
     EXPORT_SYMBOL_GPL(arizona_hp_ev);
     
+++ +static int arizona_dvfs_enable(struct snd_soc_codec *codec)
+++ +{
+++ +   const struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
+++ +   struct arizona *arizona = priv->arizona;
+++ +   int ret;
+++ +
+++ +   ret = regulator_set_voltage(arizona->dcvdd, 1800000, 1800000);
+++ +   if (ret) {
+++ +           dev_err(codec->dev, "Failed to boost DCVDD: %d\n", ret);
+++ +           return ret;
+++ +   }
+++ +
+++ +   ret = regmap_update_bits(arizona->regmap,
+++ +                            ARIZONA_DYNAMIC_FREQUENCY_SCALING_1,
+++ +                            ARIZONA_SUBSYS_MAX_FREQ,
+++ +                            ARIZONA_SUBSYS_MAX_FREQ);
+++ +   if (ret) {
+++ +           dev_err(codec->dev, "Failed to enable subsys max: %d\n", ret);
+++ +           regulator_set_voltage(arizona->dcvdd, 1200000, 1800000);
+++ +           return ret;
+++ +   }
+++ +
+++ +   return 0;
+++ +}
+++ +
+++ +static int arizona_dvfs_disable(struct snd_soc_codec *codec)
+++ +{
+++ +   const struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
+++ +   struct arizona *arizona = priv->arizona;
+++ +   int ret;
+++ +
+++ +   ret = regmap_update_bits(arizona->regmap,
+++ +                            ARIZONA_DYNAMIC_FREQUENCY_SCALING_1,
+++ +                            ARIZONA_SUBSYS_MAX_FREQ, 0);
+++ +   if (ret) {
+++ +           dev_err(codec->dev, "Failed to disable subsys max: %d\n", ret);
+++ +           return ret;
+++ +   }
+++ +
+++ +   ret = regulator_set_voltage(arizona->dcvdd, 1200000, 1800000);
+++ +   if (ret) {
+++ +           dev_err(codec->dev, "Failed to unboost DCVDD: %d\n", ret);
+++ +           return ret;
+++ +   }
+++ +
+++ +   return 0;
+++ +}
+++ +
+++ +int arizona_dvfs_up(struct snd_soc_codec *codec, unsigned int flags)
+++ +{
+++ +   struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
+++ +   int ret = 0;
+++ +
+++ +   mutex_lock(&priv->dvfs_lock);
+++ +
+++ +   if (!priv->dvfs_cached && !priv->dvfs_reqs) {
+++ +           ret = arizona_dvfs_enable(codec);
+++ +           if (ret)
+++ +                   goto err;
+++ +   }
+++ +
+++ +   priv->dvfs_reqs |= flags;
+++ +err:
+++ +   mutex_unlock(&priv->dvfs_lock);
+++ +   return ret;
+++ +}
+++ +EXPORT_SYMBOL_GPL(arizona_dvfs_up);
+++ +
+++ +int arizona_dvfs_down(struct snd_soc_codec *codec, unsigned int flags)
+++ +{
+++ +   struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
+++ +   unsigned int old_reqs;
+++ +   int ret = 0;
+++ +
+++ +   mutex_lock(&priv->dvfs_lock);
+++ +
+++ +   old_reqs = priv->dvfs_reqs;
+++ +   priv->dvfs_reqs &= ~flags;
+++ +
+++ +   if (!priv->dvfs_cached && old_reqs && !priv->dvfs_reqs)
+++ +           ret = arizona_dvfs_disable(codec);
+++ +
+++ +   mutex_unlock(&priv->dvfs_lock);
+++ +   return ret;
+++ +}
+++ +EXPORT_SYMBOL_GPL(arizona_dvfs_down);
+++ +
+++ +int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
+++ +                      struct snd_kcontrol *kcontrol, int event)
+++ +{
+++ +   struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+++ +   struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
+++ +   int ret = 0;
+++ +
+++ +   mutex_lock(&priv->dvfs_lock);
+++ +
+++ +   switch (event) {
+++ +   case SND_SOC_DAPM_POST_PMU:
+++ +           if (priv->dvfs_reqs)
+++ +                   ret = arizona_dvfs_enable(codec);
+++ +
+++ +           priv->dvfs_cached = false;
+++ +           break;
+++ +   case SND_SOC_DAPM_PRE_PMD:
+++ +           /* We must ensure DVFS is disabled before the codec goes into
+++ +            * suspend so that we are never in an illegal state of DVFS
+++ +            * enabled without enough DCVDD
+++ +            */
+++ +           priv->dvfs_cached = true;
+++ +
+++ +           if (priv->dvfs_reqs)
+++ +                   ret = arizona_dvfs_disable(codec);
+++ +           break;
+++ +   default:
+++ +           break;
+++ +   }
+++ +
+++ +   mutex_unlock(&priv->dvfs_lock);
+++ +   return ret;
+++ +}
+++ +EXPORT_SYMBOL_GPL(arizona_dvfs_sysclk_ev);
+++ +
+++ +void arizona_init_dvfs(struct arizona_priv *priv)
+++ +{
+++ +   mutex_init(&priv->dvfs_lock);
+++ +}
+++ +EXPORT_SYMBOL_GPL(arizona_init_dvfs);
+++ +
     static unsigned int arizona_sysclk_48k_rates[] = {
        6144000,
        12288000,
@@@@@@ -1266,7 -1266,7 -1266,7 -1394,7 -1266,7 +1394,7 @@@@@@ static int arizona_hw_params_rate(struc
        struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
        struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1];
        int base = dai->driver->base;
--- -   int i, sr_val;
+++ +   int i, sr_val, ret;
     
        /*
         * We will need to be more flexible than this in future,
        }
        sr_val = i;
     
+++ +   switch (priv->arizona->type) {
+++ +   case WM5102:
+++ +   case WM8997:
+++ +           if (arizona_sr_vals[sr_val] >= 88200)
+++ +                   ret = arizona_dvfs_up(codec, ARIZONA_DVFS_SR1_RQ);
+++ +           else
+++ +                   ret = arizona_dvfs_down(codec, ARIZONA_DVFS_SR1_RQ);
+++ +
+++ +           if (ret) {
+++ +                   arizona_aif_err(dai, "Failed to change DVFS %d\n", ret);
+++ +                   return ret;
+++ +           }
+++ +           break;
+++ +   default:
+++ +           break;
+++ +   }
+++ +
        switch (dai_priv->clk) {
        case ARIZONA_CLK_SYSCLK:
                switch (priv->arizona->type) {
@@@@@@ -1474,7 -1474,6 -1474,6 -1619,6 -1474,6 +1619,7 @@@@@@ static int arizona_dai_set_sysclk(struc
                                  int clk_id, unsigned int freq, int dir)
     {
        struct snd_soc_codec *codec = dai->codec;
 ++++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
        struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1];
        struct snd_soc_dapm_route routes[2];
     
        routes[0].source = arizona_dai_clk_str(dai_priv->clk);
        routes[1].source = arizona_dai_clk_str(dai_priv->clk);
 ----   snd_soc_dapm_del_routes(&codec->dapm, routes, ARRAY_SIZE(routes));
 ++++   snd_soc_dapm_del_routes(dapm, routes, ARRAY_SIZE(routes));
     
        routes[0].source = arizona_dai_clk_str(clk_id);
        routes[1].source = arizona_dai_clk_str(clk_id);
 ----   snd_soc_dapm_add_routes(&codec->dapm, routes, ARRAY_SIZE(routes));
 ++++   snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes));
     
        dai_priv->clk = clk_id;
     
 ----   return snd_soc_dapm_sync(&codec->dapm);
 ++++   return snd_soc_dapm_sync(dapm);
     }
     
     static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate)
@@@@@@ -42,7 -42,7 -42,7 -42,7 -42,7 +42,7 @@@@@@ struct wm5102_priv 
     static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
     static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
     static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
 ----static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
 ++++static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
     static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
     
     static const struct wm_adsp_region wm5102_dsp1_regions[] = {
@@@@@@ -605,12 -605,12 -605,12 -605,56 -605,12 +605,56 @@@@@@ static int wm5102_sysclk_ev(struct snd_
                                regmap_write_async(regmap, patch[i].reg,
                                                   patch[i].def);
                break;
+++ +   case SND_SOC_DAPM_PRE_PMD:
+++ +           break;
+++ +   default:
+++ +           return 0;
+++ +   }
+++ +
+++ +   return arizona_dvfs_sysclk_ev(w, kcontrol, event);
+++ +}
+++ +
+++ +static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w,
+++ +              struct snd_kcontrol *kcontrol, int event)
+++ +{
+++ +   struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+++ +   struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
+++ +   unsigned int v;
+++ +   int ret;
+++ +
+++ +   switch (event) {
+++ +   case SND_SOC_DAPM_PRE_PMU:
+++ +           ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v);
+++ +           if (ret != 0) {
+++ +                   dev_err(codec->dev,
+++ +                           "Failed to read SYSCLK state: %d\n", ret);
+++ +                   return -EIO;
+++ +           }
+++ +
+++ +           v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT;
+++ +
+++ +           if (v >= 3) {
+++ +                   ret = arizona_dvfs_up(codec, ARIZONA_DVFS_ADSP1_RQ);
+++ +                   if (ret) {
+++ +                           dev_err(codec->dev,
+++ +                                   "Failed to raise DVFS: %d\n", ret);
+++ +                           return ret;
+++ +                   }
+++ +           }
+++ +           break;
+++ +
+++ +   case SND_SOC_DAPM_POST_PMD:
+++ +           ret = arizona_dvfs_down(codec, ARIZONA_DVFS_ADSP1_RQ);
+++ +           if (ret)
+++ +                   dev_warn(codec->dev,
+++ +                            "Failed to lower DVFS: %d\n", ret);
+++ +           break;
     
        default:
                break;
        }
     
--- -   return 0;
+++ +   return wm_adsp2_early_event(w, kcontrol, event);
     }
     
     static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol,
@@@@@@ -1036,7 -1036,7 -1036,7 -1080,8 -1036,7 +1080,8 @@@@@@ static const struct snd_kcontrol_new wm
     
     static const struct snd_soc_dapm_widget wm5102_dapm_widgets[] = {
     SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
--- -               0, wm5102_sysclk_ev, SND_SOC_DAPM_POST_PMU),
+++ +               0, wm5102_sysclk_ev,
+++ +               SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
     SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
                    ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
     SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
@@@@@@ -1367,7 -1367,7 -1367,7 -1412,7 -1367,7 +1412,7 @@@@@@ ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DE
     ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
     ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
     
--- -WM_ADSP2("DSP1", 0),
+++ +WM_ADSP2_E("DSP1", 0, wm5102_adsp_power_ev),
     
     SND_SOC_DAPM_OUTPUT("HPOUT1L"),
     SND_SOC_DAPM_OUTPUT("HPOUT1R"),
@@@@@@ -1827,7 -1827,6 -1827,6 -1872,6 -1827,6 +1872,7 @@@@@@ static struct snd_soc_dai_driver wm5102
     
     static int wm5102_codec_probe(struct snd_soc_codec *codec)
     {
 ++++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
        int ret;
     
        arizona_init_spk(codec);
        arizona_init_gpio(codec);
     
 ----   snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
 ++++   snd_soc_dapm_disable_pin(dapm, "HAPTICS");
     
 ----   priv->core.arizona->dapm = &codec->dapm;
 ++++   priv->core.arizona->dapm = dapm;
     
        return 0;
     }
@@@@@@ -1910,6 -1909,6 -1909,6 -1954,8 -1909,6 +1955,8 @@@@@@ static int wm5102_probe(struct platform
        wm5102->core.arizona = arizona;
        wm5102->core.num_inputs = 6;
     
+++ +   arizona_init_dvfs(&wm5102->core);
+++ +
        wm5102->core.adsp[0].part = "wm5102";
        wm5102->core.adsp[0].num = 1;
        wm5102->core.adsp[0].type = WMFW_ADSP2;
        wm5102->core.adsp[0].mem = wm5102_dsp1_regions;
        wm5102->core.adsp[0].num_mems = ARRAY_SIZE(wm5102_dsp1_regions);
     
--- -   ret = wm_adsp2_init(&wm5102->core.adsp[0], true);
+++ +   ret = wm_adsp2_init(&wm5102->core.adsp[0]);
        if (ret != 0)
                return ret;
     
@@@@@@ -167,7 -167,7 -167,7 -167,7 -167,7 +167,7 @@@@@@ static int wm5110_sysclk_ev(struct snd_
     static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
     static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
     static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
 ----static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
 ++++static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
     static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
     
     #define WM5110_NG_SRC(name, base) \
@@@@@@ -1598,11 -1598,10 -1598,10 -1598,10 -1598,10 +1598,11 @@@@@@ static struct snd_soc_dai_driver wm5110
     
     static int wm5110_codec_probe(struct snd_soc_codec *codec)
     {
 ++++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
        int ret;
     
 ----   priv->core.arizona->dapm = &codec->dapm;
 ++++   priv->core.arizona->dapm = dapm;
     
        arizona_init_spk(codec);
        arizona_init_gpio(codec);
        if (ret != 0)
                return ret;
     
 ----   snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
 ----
 ----   priv->core.arizona->dapm = &codec->dapm;
 ++++   snd_soc_dapm_disable_pin(dapm, "HAPTICS");
     
        return 0;
     }
@@@@@@ -1696,7 -1697,7 -1697,7 -1697,7 -1697,7 +1696,7 @@@@@@ static int wm5110_probe(struct platform
                wm5110->core.adsp[i].num_mems
                        = ARRAY_SIZE(wm5110_dsp1_regions);
     
--- -           ret = wm_adsp2_init(&wm5110->core.adsp[i], false);
+++ +           ret = wm_adsp2_init(&wm5110->core.adsp[i]);
                if (ret != 0)
                        return ret;
        }
@@@@@@ -40,7 -40,7 -40,7 -40,7 -40,7 +40,7 @@@@@@ struct wm8997_priv 
     static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
     static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
     static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
 ----static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
 ++++static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
     static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
     
     static const struct reg_default wm8997_sysclk_reva_patch[] = {
@@@@@@ -106,11 -106,11 -106,11 -106,13 -106,11 +106,13 @@@@@@ static int wm8997_sysclk_ev(struct snd_
                                regmap_write_async(regmap, patch[i].reg,
                                                   patch[i].def);
                break;
--- -   default:
+++ +   case SND_SOC_DAPM_PRE_PMD:
                break;
+++ +   default:
+++ +           return 0;
        }
     
--- -   return 0;
+++ +   return arizona_dvfs_sysclk_ev(w, kcontrol, event);
     }
     
     static const char *wm8997_osr_text[] = {
@@@@@@ -409,7 -409,7 -409,7 -411,8 -409,7 +411,8 @@@@@@ static const struct snd_kcontrol_new wm
     
     static const struct snd_soc_dapm_widget wm8997_dapm_widgets[] = {
     SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
--- -               0, wm8997_sysclk_ev, SND_SOC_DAPM_POST_PMU),
+++ +               0, wm8997_sysclk_ev,
+++ +               SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
     SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
                    ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
     SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
@@@@@@ -1055,14 -1055,13 -1055,13 -1058,13 -1055,13 +1058,14 @@@@@@ static struct snd_soc_dai_driver wm8997
     
     static int wm8997_codec_probe(struct snd_soc_codec *codec)
     {
 ++++   struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);
     
        arizona_init_spk(codec);
     
 ----   snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
 ++++   snd_soc_dapm_disable_pin(dapm, "HAPTICS");
     
 ----   priv->core.arizona->dapm = &codec->dapm;
 ++++   priv->core.arizona->dapm = dapm;
     
        return 0;
     }
@@@@@@ -1127,6 -1126,6 -1126,6 -1129,8 -1126,6 +1130,8 @@@@@@ static int wm8997_probe(struct platform
        wm8997->core.arizona = arizona;
        wm8997->core.num_inputs = 4;
     
+++ +   arizona_init_dvfs(&wm8997->core);
+++ +
        for (i = 0; i < ARRAY_SIZE(wm8997->fll); i++)
                wm8997->fll[i].vco_mult = 1;