Merge branch 'for-2.6.29' into for-2.6.30
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 6 Feb 2009 14:19:45 +0000 (14:19 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 6 Feb 2009 14:19:45 +0000 (14:19 +0000)
1  2 
sound/soc/codecs/tlv320aic3x.c
sound/soc/codecs/wm8990.c

@@@ -165,10 -165,13 +165,13 @@@ static int snd_soc_dapm_put_volsw_aic3x
                                        struct snd_ctl_elem_value *ucontrol)
  {
        struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
-       int reg = kcontrol->private_value & 0xff;
-       int shift = (kcontrol->private_value >> 8) & 0x0f;
-       int mask = (kcontrol->private_value >> 16) & 0xff;
-       int invert = (kcontrol->private_value >> 24) & 0x01;
+       struct soc_mixer_control *mc =
+               (struct soc_mixer_control *)kcontrol->private_value;
+       unsigned int reg = mc->reg;
+       unsigned int shift = mc->shift;
+       int max = mc->max;
+       unsigned int mask = (1 << fls(max)) - 1;
+       unsigned int invert = mc->invert;
        unsigned short val, val_mask;
        int ret;
        struct snd_soc_dapm_path *path;
@@@ -311,6 -314,22 +314,6 @@@ static const struct snd_kcontrol_new ai
        SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]),
  };
  
 -/* add non dapm controls */
 -static int aic3x_add_controls(struct snd_soc_codec *codec)
 -{
 -      int err, i;
 -
 -      for (i = 0; i < ARRAY_SIZE(aic3x_snd_controls); i++) {
 -              err = snd_ctl_add(codec->card,
 -                                snd_soc_cnew(&aic3x_snd_controls[i],
 -                                             codec, NULL));
 -              if (err < 0)
 -                      return err;
 -      }
 -
 -      return 0;
 -}
 -
  /* Left DAC Mux */
  static const struct snd_kcontrol_new aic3x_left_dac_mux_controls =
  SOC_DAPM_ENUM("Route", aic3x_enum[LDAC_ENUM]);
@@@ -727,7 -746,7 +730,7 @@@ static int aic3x_hw_params(struct snd_p
  {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
        struct aic3x_priv *aic3x = codec->private_data;
        int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0;
        u8 data, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1;
@@@ -1079,7 -1098,7 +1082,7 @@@ EXPORT_SYMBOL_GPL(aic3x_dai)
  static int aic3x_suspend(struct platform_device *pdev, pm_message_t state)
  {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
  
        aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF);
  
  static int aic3x_resume(struct platform_device *pdev)
  {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
        int i;
        u8 data[2];
        u8 *cache = codec->reg_cache;
   */
  static int aic3x_init(struct snd_soc_device *socdev)
  {
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
        struct aic3x_setup_data *setup = socdev->codec_data;
        int reg, ret = 0;
  
        aic3x_write(codec, AIC3X_GPIO1_REG, (setup->gpio_func[0] & 0xf) << 4);
        aic3x_write(codec, AIC3X_GPIO2_REG, (setup->gpio_func[1] & 0xf) << 4);
  
 -      aic3x_add_controls(codec);
 +      snd_soc_add_controls(codec, aic3x_snd_controls,
 +                              ARRAY_SIZE(aic3x_snd_controls));
        aic3x_add_widgets(codec);
        ret = snd_soc_init_card(socdev);
        if (ret < 0) {
@@@ -1243,7 -1261,7 +1246,7 @@@ static int aic3x_i2c_probe(struct i2c_c
                           const struct i2c_device_id *id)
  {
        struct snd_soc_device *socdev = aic3x_socdev;
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
        int ret;
  
        i2c_set_clientdata(i2c, codec);
@@@ -1348,7 -1366,7 +1351,7 @@@ static int aic3x_probe(struct platform_
        }
  
        codec->private_data = aic3x;
 -      socdev->codec = codec;
 +      socdev->card->codec = codec;
        mutex_init(&codec->mutex);
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
  static int aic3x_remove(struct platform_device *pdev)
  {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
  
        /* power down chip */
        if (codec->control_data)
@@@ -115,7 -115,7 +115,7 @@@ static inline unsigned int wm8990_read_
        unsigned int reg)
  {
        u16 *cache = codec->reg_cache;
 -      BUG_ON(reg > (ARRAY_SIZE(wm8990_reg)) - 1);
 +      BUG_ON(reg >= ARRAY_SIZE(wm8990_reg));
        return cache[reg];
  }
  
@@@ -128,7 -128,7 +128,7 @@@ static inline void wm8990_write_reg_cac
        u16 *cache = codec->reg_cache;
  
        /* Reset register and reserved registers are uncached */
 -      if (reg == 0 || reg > ARRAY_SIZE(wm8990_reg) - 1)
 +      if (reg == 0 || reg >= ARRAY_SIZE(wm8990_reg))
                return;
  
        cache[reg] = value;
@@@ -176,7 -176,9 +176,9 @@@ static int wm899x_outpga_put_volsw_vu(s
        struct snd_ctl_elem_value *ucontrol)
  {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       int reg = kcontrol->private_value & 0xff;
+       struct soc_mixer_control *mc =
+               (struct soc_mixer_control *)kcontrol->private_value;
+       int reg = mc->reg;
        int ret;
        u16 val;
  
@@@ -416,6 -418,21 +418,6 @@@ SOC_SINGLE("RIN34 Mute Switch", WM8990_
  
  };
  
 -/* add non dapm controls */
 -static int wm8990_add_controls(struct snd_soc_codec *codec)
 -{
 -      int err, i;
 -
 -      for (i = 0; i < ARRAY_SIZE(wm8990_snd_controls); i++) {
 -              err = snd_ctl_add(codec->card,
 -                              snd_soc_cnew(&wm8990_snd_controls[i], codec,
 -                                      NULL));
 -              if (err < 0)
 -                      return err;
 -      }
 -      return 0;
 -}
 -
  /*
   * _DAPM_ Controls
   */
@@@ -1161,7 -1178,7 +1163,7 @@@ static int wm8990_hw_params(struct snd_
  {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
        u16 audio1 = wm8990_read_reg_cache(codec, WM8990_AUDIO_INTERFACE_1);
  
        audio1 &= ~WM8990_AIF_WL_MASK;
@@@ -1360,7 -1377,7 +1362,7 @@@ EXPORT_SYMBOL_GPL(wm8990_dai)
  static int wm8990_suspend(struct platform_device *pdev, pm_message_t state)
  {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
  
        /* we only need to suspend if we are a valid card */
        if (!codec->card)
  static int wm8990_resume(struct platform_device *pdev)
  {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
        int i;
        u8 data[2];
        u16 *cache = codec->reg_cache;
   */
  static int wm8990_init(struct snd_soc_device *socdev)
  {
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
        u16 reg;
        int ret = 0;
  
        wm8990_write(codec, WM8990_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8));
        wm8990_write(codec, WM8990_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8));
  
 -      wm8990_add_controls(codec);
 +      snd_soc_add_controls(codec, wm8990_snd_controls,
 +                              ARRAY_SIZE(wm8990_snd_controls));
        wm8990_add_widgets(codec);
        ret = snd_soc_init_card(socdev);
        if (ret < 0) {
@@@ -1479,7 -1495,7 +1481,7 @@@ static int wm8990_i2c_probe(struct i2c_
                            const struct i2c_device_id *id)
  {
        struct snd_soc_device *socdev = wm8990_socdev;
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
        int ret;
  
        i2c_set_clientdata(i2c, codec);
@@@ -1578,7 -1594,7 +1580,7 @@@ static int wm8990_probe(struct platform
        }
  
        codec->private_data = wm8990;
 -      socdev->codec = codec;
 +      socdev->card->codec = codec;
        mutex_init(&codec->mutex);
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
  static int wm8990_remove(struct platform_device *pdev)
  {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 -      struct snd_soc_codec *codec = socdev->codec;
 +      struct snd_soc_codec *codec = socdev->card->codec;
  
        if (codec->control_data)
                wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF);