Merge tag 'sound-4.7-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 28 May 2016 19:23:12 +0000 (12:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 28 May 2016 19:23:12 +0000 (12:23 -0700)
Pull more sound updates from Takashi Iwai:
 "This is the second update round for 4.7-rc1.  Most of changes are
  about the pending ASoC updates and fixes, including a few new drivers.
  Below are some highlights:

  ASoC:
   - New drivers for MAX98371 and TAS5720
   - SPI support for TLV320AIC32x4, along with the module split
   - TDM support for STI Uniperf IPs
   - Remaining topology API fixes / updates

  HDA:
   - A couple of Dell quirks and new Realtek codec support"

* tag 'sound-4.7-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (63 commits)
  ALSA: hda - Fix headset mic detection problem for one Dell machine
  spi: spi-ep93xx: Fix the PTR_ERR() argument
  ALSA: hda/realtek - Add support for ALC295/ALC3254
  ASoC: kirkwood: fix build failure
  ALSA: hda - Fix headphone noise on Dell XPS 13 9360
  ASoC: ak4642: Enable cache usage to fix crashes on resume
  ASoC: twl6040: Disconnect AUX output pads on digital mute
  ASoC: tlv320aic32x4: Properly implement the positive and negative pins into the mixers
  rcar: src: skip disabled-SRC nodes
  ASoC: max98371 Remove duplicate entry in max98371_reg
  ASoC: twl6040: Select LPPLL during standby
  ASoC: rsnd: don't use prohibited number to PDMACHCRn.SRS
  ASoC: simple-card: Add pm callbacks to platform driver
  ASoC: pxa: Fix module autoload for platform drivers
  ASoC: topology: Fix memory leak in widget creation
  ASoC: Add max98371 codec driver
  ASoC: rsnd: count .probe/.remove for rsnd_mod_call()
  ASoC: topology: Check size mismatch of ABI objects before parsing
  ASoC: topology: Check failure to create a widget
  ASoC: add support for TAS5720 digital amplifier
  ...

1  2 
sound/soc/codecs/rt5677.c
sound/soc/codecs/wm8962.c

@@@ -1241,60 -1241,46 +1241,46 @@@ static int rt5677_dmic_use_asrc(struct 
                regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting);
                asrc_setting = (asrc_setting & RT5677_AD_STO1_CLK_SEL_MASK) >>
                                RT5677_AD_STO1_CLK_SEL_SFT;
-               if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC &&
-                       asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC)
-                       return 1;
                break;
  
        case 10:
                regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting);
                asrc_setting = (asrc_setting & RT5677_AD_STO2_CLK_SEL_MASK) >>
                                RT5677_AD_STO2_CLK_SEL_SFT;
-               if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC &&
-                       asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC)
-                       return 1;
                break;
  
        case 9:
                regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting);
                asrc_setting = (asrc_setting & RT5677_AD_STO3_CLK_SEL_MASK) >>
                                RT5677_AD_STO3_CLK_SEL_SFT;
-               if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC &&
-                       asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC)
-                       return 1;
                break;
  
        case 8:
                regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting);
                asrc_setting = (asrc_setting & RT5677_AD_STO4_CLK_SEL_MASK) >>
                        RT5677_AD_STO4_CLK_SEL_SFT;
-               if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC &&
-                       asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC)
-                       return 1;
                break;
  
        case 7:
                regmap_read(rt5677->regmap, RT5677_ASRC_6, &asrc_setting);
                asrc_setting = (asrc_setting & RT5677_AD_MONOL_CLK_SEL_MASK) >>
                        RT5677_AD_MONOL_CLK_SEL_SFT;
-               if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC &&
-                       asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC)
-                       return 1;
                break;
  
        case 6:
                regmap_read(rt5677->regmap, RT5677_ASRC_6, &asrc_setting);
                asrc_setting = (asrc_setting & RT5677_AD_MONOR_CLK_SEL_MASK) >>
                        RT5677_AD_MONOR_CLK_SEL_SFT;
-               if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC &&
-                       asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC)
-                       return 1;
                break;
  
        default:
-               break;
+               return 0;
        }
  
+       if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC &&
+           asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC)
+               return 1;
        return 0;
  }
  
@@@ -4520,9 -4506,14 +4506,9 @@@ static int rt5677_set_bias_level(struc
  }
  
  #ifdef CONFIG_GPIOLIB
 -static inline struct rt5677_priv *gpio_to_rt5677(struct gpio_chip *chip)
 -{
 -      return container_of(chip, struct rt5677_priv, gpio_chip);
 -}
 -
  static void rt5677_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
  {
 -      struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
 +      struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
  
        switch (offset) {
        case RT5677_GPIO1 ... RT5677_GPIO5:
  static int rt5677_gpio_direction_out(struct gpio_chip *chip,
                                     unsigned offset, int value)
  {
 -      struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
 +      struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
  
        switch (offset) {
        case RT5677_GPIO1 ... RT5677_GPIO5:
  
  static int rt5677_gpio_get(struct gpio_chip *chip, unsigned offset)
  {
 -      struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
 +      struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
        int value, ret;
  
        ret = regmap_read(rt5677->regmap, RT5677_GPIO_ST, &value);
  
  static int rt5677_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
  {
 -      struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
 +      struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
  
        switch (offset) {
        case RT5677_GPIO1 ... RT5677_GPIO5:
@@@ -4633,7 -4624,7 +4619,7 @@@ static void rt5677_gpio_config(struct r
  
  static int rt5677_to_irq(struct gpio_chip *chip, unsigned offset)
  {
 -      struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
 +      struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
        struct regmap_irq_chip_data *data = rt5677->irq_data;
        int irq;
  
@@@ -4692,7 -4683,7 +4678,7 @@@ static void rt5677_init_gpio(struct i2c
        rt5677->gpio_chip.parent = &i2c->dev;
        rt5677->gpio_chip.base = -1;
  
 -      ret = gpiochip_add(&rt5677->gpio_chip);
 +      ret = gpiochip_add_data(&rt5677->gpio_chip, rt5677);
        if (ret != 0)
                dev_err(&i2c->dev, "Failed to add GPIOs: %d\n", ret);
  }
@@@ -18,7 -18,7 +18,7 @@@
  #include <linux/delay.h>
  #include <linux/pm.h>
  #include <linux/gcd.h>
 -#include <linux/gpio.h>
 +#include <linux/gpio/driver.h>
  #include <linux/i2c.h>
  #include <linux/input.h>
  #include <linux/pm_runtime.h>
@@@ -3307,9 -3307,14 +3307,9 @@@ static void wm8962_set_gpio_mode(struc
  }
  
  #ifdef CONFIG_GPIOLIB
 -static inline struct wm8962_priv *gpio_to_wm8962(struct gpio_chip *chip)
 -{
 -      return container_of(chip, struct wm8962_priv, gpio_chip);
 -}
 -
  static int wm8962_gpio_request(struct gpio_chip *chip, unsigned offset)
  {
 -      struct wm8962_priv *wm8962 = gpio_to_wm8962(chip);
 +      struct wm8962_priv *wm8962 = gpiochip_get_data(chip);
  
        /* The WM8962 GPIOs aren't linearly numbered.  For simplicity
         * we export linear numbers and error out if the unsupported
  
  static void wm8962_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
  {
 -      struct wm8962_priv *wm8962 = gpio_to_wm8962(chip);
 +      struct wm8962_priv *wm8962 = gpiochip_get_data(chip);
        struct snd_soc_codec *codec = wm8962->codec;
  
        snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset,
  static int wm8962_gpio_direction_out(struct gpio_chip *chip,
                                     unsigned offset, int value)
  {
 -      struct wm8962_priv *wm8962 = gpio_to_wm8962(chip);
 +      struct wm8962_priv *wm8962 = gpiochip_get_data(chip);
        struct snd_soc_codec *codec = wm8962->codec;
        int ret, val;
  
@@@ -3381,7 -3386,7 +3381,7 @@@ static void wm8962_init_gpio(struct snd
        else
                wm8962->gpio_chip.base = -1;
  
 -      ret = gpiochip_add(&wm8962->gpio_chip);
 +      ret = gpiochip_add_data(&wm8962->gpio_chip, wm8962);
        if (ret != 0)
                dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret);
  }
@@@ -3793,9 -3798,8 +3793,8 @@@ static int wm8962_runtime_resume(struc
        ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies),
                                    wm8962->supplies);
        if (ret != 0) {
-               dev_err(dev,
-                       "Failed to enable supplies: %d\n", ret);
-               return ret;
+               dev_err(dev, "Failed to enable supplies: %d\n", ret);
+               goto disable_clock;
        }
  
        regcache_cache_only(wm8962->regmap, false);
        msleep(5);
  
        return 0;
+ disable_clock:
+       clk_disable_unprepare(wm8962->pdata.mclk);
+       return ret;
  }
  
  static int wm8962_runtime_suspend(struct device *dev)