Merge tag 'v4.0-rc3' into asoc-rt5670
authorMark Brown <broonie@kernel.org>
Tue, 10 Mar 2015 10:37:02 +0000 (10:37 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 10 Mar 2015 10:37:02 +0000 (10:37 +0000)
Linux 4.0-rc3

Conflicts:
sound/soc/codecs/rt5670.c

1  2 
sound/soc/codecs/rt5670.c

@@@ -225,7 -225,6 +225,6 @@@ static bool rt5670_volatile_register(st
        case RT5670_ADC_EQ_CTRL1:
        case RT5670_EQ_CTRL1:
        case RT5670_ALC_CTRL_1:
-       case RT5670_IRQ_CTRL1:
        case RT5670_IRQ_CTRL2:
        case RT5670_INT_IRQ_ST:
        case RT5670_IL_CMD:
@@@ -500,7 -499,7 +499,7 @@@ static const struct snd_kcontrol_new rt
  static int set_dmic_clk(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
  {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
        int idx = -EINVAL;
  
  static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
  {
 -      struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
 -      unsigned int val;
 +      struct snd_soc_codec *codec = source->codec;
 +      struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
  
 -      val = snd_soc_read(codec, RT5670_GLB_CLK);
 -      val &= RT5670_SCLK_SRC_MASK;
 -      if (val == RT5670_SCLK_SRC_PLL1)
 +      if (rt5670->sysclk_src == RT5670_SCLK_S_PLL1)
                return 1;
        else
                return 0;
  static int is_using_asrc(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
  {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg, shift, val;
  
        switch (source->shift) {
                return 0;
        }
  
-       val = (snd_soc_read(source->codec, reg) >> shift) & 0xf;
+       val = (snd_soc_read(codec, reg) >> shift) & 0xf;
        switch (val) {
        case 1:
        case 2:
@@@ -1230,7 -1232,7 +1230,7 @@@ static const struct snd_kcontrol_new rt
  static int rt5670_hp_power_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
  {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
  
        switch (event) {
  static int rt5670_hp_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
  {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
  
        switch (event) {
  static int rt5670_bst1_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
  {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
  
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
  static int rt5670_bst2_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
  {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
  
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@@ -2269,6 -2271,16 +2269,6 @@@ static int rt5670_set_dai_sysclk(struc
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
        unsigned int reg_val = 0;
  
 -      if (freq == rt5670->sysclk && clk_id == rt5670->sysclk_src)
 -              return 0;
 -
 -      if (rt5670->pdata.jd_mode) {
 -              if (clk_id == RT5670_SCLK_S_PLL1)
 -                      snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL1");
 -              else
 -                      snd_soc_dapm_disable_pin(&codec->dapm, "PLL1");
 -              snd_soc_dapm_sync(&codec->dapm);
 -      }
        switch (clk_id) {
        case RT5670_SCLK_S_MCLK:
                reg_val |= RT5670_SCLK_SRC_MCLK;
        snd_soc_update_bits(codec, RT5670_GLB_CLK,
                RT5670_SCLK_SRC_MASK, reg_val);
        rt5670->sysclk = freq;
 -      rt5670->sysclk_src = clk_id;
 +      if (clk_id != RT5670_SCLK_S_RCCLK)
 +              rt5670->sysclk_src = clk_id;
  
        dev_dbg(dai->dev, "Sysclk is %dHz and clock id is %d\n", freq, clk_id);
  
@@@ -2604,6 -2615,7 +2604,7 @@@ static struct snd_soc_codec_driver soc_
  static const struct regmap_config rt5670_regmap = {
        .reg_bits = 8,
        .val_bits = 16,
+       .use_single_rw = true,
        .max_register = RT5670_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5670_ranges) *
                                               RT5670_PR_SPACING),
        .volatile_reg = rt5670_volatile_register,
@@@ -2714,6 -2726,10 +2715,10 @@@ static int rt5670_i2c_probe(struct i2c_
        }
  
        if (rt5670->pdata.jd_mode) {
+               regmap_update_bits(rt5670->regmap, RT5670_GLB_CLK,
+                                  RT5670_SCLK_SRC_MASK, RT5670_SCLK_SRC_RCCLK);
+               rt5670->sysclk = 0;
+               rt5670->sysclk_src = RT5670_SCLK_S_RCCLK;
                regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1,
                                   RT5670_PWR_MB, RT5670_PWR_MB);
                regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG2,