Merge remote-tracking branch 'asoc/topic/core' into asoc-next
authorMark Brown <broonie@kernel.org>
Mon, 26 Oct 2015 02:15:55 +0000 (11:15 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 26 Oct 2015 02:15:55 +0000 (11:15 +0900)
1  2 
include/sound/soc.h
sound/soc/Kconfig
sound/soc/Makefile
sound/soc/intel/atom/sst-mfld-platform-pcm.c
sound/soc/soc-core.c
sound/soc/soc-ops.c

diff --combined include/sound/soc.h
@@@ -86,7 -86,7 +86,7 @@@
        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
        SNDRV_CTL_ELEM_ACCESS_READWRITE, \
        .tlv.p  = (tlv_array),\
 -      .info = snd_soc_info_volsw, \
 +      .info = snd_soc_info_volsw_sx, \
        .get = snd_soc_get_volsw_sx,\
        .put = snd_soc_put_volsw_sx, \
        .private_value = (unsigned long)&(struct soc_mixer_control) \
        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
        SNDRV_CTL_ELEM_ACCESS_READWRITE, \
        .tlv.p  = (tlv_array), \
 -      .info = snd_soc_info_volsw, \
 +      .info = snd_soc_info_volsw_sx, \
        .get = snd_soc_get_volsw_sx, \
        .put = snd_soc_put_volsw_sx, \
        .private_value = (unsigned long)&(struct soc_mixer_control) \
        .info = snd_soc_info_volsw, \
        .get = xhandler_get, .put = xhandler_put, \
        .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) }
 +#define SOC_SINGLE_RANGE_EXT_TLV(xname, xreg, xshift, xmin, xmax, xinvert, \
 +                               xhandler_get, xhandler_put, tlv_array) \
 +{     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
 +      .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
 +               SNDRV_CTL_ELEM_ACCESS_READWRITE,\
 +      .tlv.p = (tlv_array), \
 +      .info = snd_soc_info_volsw_range, \
 +      .get = xhandler_get, .put = xhandler_put, \
 +      .private_value = (unsigned long)&(struct soc_mixer_control) \
 +              {.reg = xreg, .rreg = xreg, .shift = xshift, \
 +               .rshift = xshift, .min = xmin, .max = xmax, \
 +               .platform_max = xmax, .invert = xinvert} }
  #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
         xhandler_get, xhandler_put, tlv_array) \
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@@ -452,7 -440,9 +452,9 @@@ int snd_soc_platform_read(struct snd_so
  int snd_soc_platform_write(struct snd_soc_platform *platform,
                                        unsigned int reg, unsigned int val);
  int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
- int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num);
+ #ifdef CONFIG_SND_SOC_COMPRESS
+ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num);
+ #endif
  
  struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
                const char *dai_link, int stream);
@@@ -586,8 -576,6 +588,8 @@@ int snd_soc_put_enum_double(struct snd_
        struct snd_ctl_elem_value *ucontrol);
  int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_info *uinfo);
 +int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
 +                        struct snd_ctl_elem_info *uinfo);
  #define snd_soc_info_bool_ext         snd_ctl_boolean_mono_info
  int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
@@@ -605,7 -593,7 +607,7 @@@ int snd_soc_put_volsw_range(struct snd_
        struct snd_ctl_elem_value *ucontrol);
  int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
- int snd_soc_limit_volume(struct snd_soc_codec *codec,
+ int snd_soc_limit_volume(struct snd_soc_card *card,
        const char *name, int max);
  int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
                       struct snd_ctl_elem_info *uinfo);
@@@ -1615,8 -1603,6 +1617,8 @@@ int snd_soc_of_parse_card_name(struct s
  int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
                                          const char *propname);
  int snd_soc_of_parse_tdm_slot(struct device_node *np,
 +                            unsigned int *tx_mask,
 +                            unsigned int *rx_mask,
                              unsigned int *slots,
                              unsigned int *slot_width);
  void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
diff --combined sound/soc/Kconfig
@@@ -9,7 -9,6 +9,6 @@@ menuconfig SND_SO
        select SND_JACK if INPUT=y || INPUT=SND
        select REGMAP_I2C if I2C
        select REGMAP_SPI if SPI_MASTER
-       select SND_COMPRESS_OFFLOAD
        ---help---
  
          If you want ASoC support, you should say Y here and also to the
@@@ -30,6 -29,10 +29,10 @@@ config SND_SOC_GENERIC_DMAENGINE_PC
        bool
        select SND_DMAENGINE_PCM
  
+ config SND_SOC_COMPRESS
+       bool
+       select SND_COMPRESS_OFFLOAD
  config SND_SOC_TOPOLOGY
        bool
  
@@@ -58,7 -61,6 +61,7 @@@ source "sound/soc/sh/Kconfig
  source "sound/soc/sirf/Kconfig"
  source "sound/soc/spear/Kconfig"
  source "sound/soc/sti/Kconfig"
 +source "sound/soc/sunxi/Kconfig"
  source "sound/soc/tegra/Kconfig"
  source "sound/soc/txx9/Kconfig"
  source "sound/soc/ux500/Kconfig"
diff --combined sound/soc/Makefile
@@@ -1,5 -1,6 +1,6 @@@
  snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o
- snd-soc-core-objs += soc-pcm.o soc-compress.o soc-io.o soc-devres.o soc-ops.o
+ snd-soc-core-objs += soc-pcm.o soc-io.o soc-devres.o soc-ops.o
+ snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
  
  ifneq ($(CONFIG_SND_SOC_TOPOLOGY),)
  snd-soc-core-objs += soc-topology.o
@@@ -40,7 -41,6 +41,7 @@@ obj-$(CONFIG_SND_SOC) += sh
  obj-$(CONFIG_SND_SOC) += sirf/
  obj-$(CONFIG_SND_SOC) += spear/
  obj-$(CONFIG_SND_SOC) += sti/
 +obj-$(CONFIG_SND_SOC) += sunxi/
  obj-$(CONFIG_SND_SOC) += tegra/
  obj-$(CONFIG_SND_SOC) += txx9/
  obj-$(CONFIG_SND_SOC) += ux500/
@@@ -368,6 -368,23 +368,6 @@@ static void sst_media_close(struct snd_
        kfree(stream);
  }
  
 -static inline unsigned int get_current_pipe_id(struct snd_soc_dai *dai,
 -                                             struct snd_pcm_substream *substream)
 -{
 -      struct sst_data *sst = snd_soc_dai_get_drvdata(dai);
 -      struct sst_dev_stream_map *map = sst->pdata->pdev_strm_map;
 -      struct sst_runtime_stream *stream =
 -                      substream->runtime->private_data;
 -      u32 str_id = stream->stream_info.str_id;
 -      unsigned int pipe_id;
 -
 -      pipe_id = map[str_id].device_id;
 -
 -      dev_dbg(dai->dev, "got pipe_id = %#x for str_id = %d\n",
 -                      pipe_id, str_id);
 -      return pipe_id;
 -}
 -
  static int sst_media_prepare(struct snd_pcm_substream *substream,
                struct snd_soc_dai *dai)
  {
@@@ -512,7 -529,7 +512,7 @@@ static struct snd_soc_dai_driver sst_pl
  },
  {
        .name = "compress-cpu-dai",
-       .compress_dai = 1,
+       .compress_new = snd_soc_new_compress,
        .ops = &sst_compr_dai_ops,
        .playback = {
                .stream_name = "Compress Playback",
diff --combined sound/soc/soc-core.c
@@@ -1370,9 -1370,9 +1370,9 @@@ static int soc_probe_link_dais(struct s
                soc_dpcm_debugfs_add(rtd);
  #endif
  
-       if (cpu_dai->driver->compress_dai) {
+       if (cpu_dai->driver->compress_new) {
                /*create compress_device"*/
-               ret = soc_new_compress(rtd, num);
+               ret = cpu_dai->driver->compress_new(rtd, num);
                if (ret < 0) {
                        dev_err(card->dev, "ASoC: can't create compress %s\n",
                                         dai_link->stream_name);
@@@ -3291,38 -3291,13 +3291,38 @@@ int snd_soc_of_parse_audio_simple_widge
  }
  EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_simple_widgets);
  
 +static int snd_soc_of_get_slot_mask(struct device_node *np,
 +                                  const char *prop_name,
 +                                  unsigned int *mask)
 +{
 +      u32 val;
 +      const __be32 *of_slot_mask = of_get_property(np, prop_name, &val);
 +      int i;
 +
 +      if (!of_slot_mask)
 +              return 0;
 +      val /= sizeof(u32);
 +      for (i = 0; i < val; i++)
 +              if (be32_to_cpup(&of_slot_mask[i]))
 +                      *mask |= (1 << i);
 +
 +      return val;
 +}
 +
  int snd_soc_of_parse_tdm_slot(struct device_node *np,
 +                            unsigned int *tx_mask,
 +                            unsigned int *rx_mask,
                              unsigned int *slots,
                              unsigned int *slot_width)
  {
        u32 val;
        int ret;
  
 +      if (tx_mask)
 +              snd_soc_of_get_slot_mask(np, "dai-tdm-slot-tx-mask", tx_mask);
 +      if (rx_mask)
 +              snd_soc_of_get_slot_mask(np, "dai-tdm-slot-rx-mask", rx_mask);
 +
        if (of_property_read_bool(np, "dai-tdm-slot-num")) {
                ret = of_property_read_u32(np, "dai-tdm-slot-num", &val);
                if (ret)
diff --combined sound/soc/soc-ops.c
@@@ -206,34 -206,6 +206,34 @@@ int snd_soc_info_volsw(struct snd_kcont
  }
  EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
  
 +/**
 + * snd_soc_info_volsw_sx - Mixer info callback for SX TLV controls
 + * @kcontrol: mixer control
 + * @uinfo: control element information
 + *
 + * Callback to provide information about a single mixer control, or a double
 + * mixer control that spans 2 registers of the SX TLV type. SX TLV controls
 + * have a range that represents both positive and negative values either side
 + * of zero but without a sign bit.
 + *
 + * Returns 0 for success.
 + */
 +int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
 +                        struct snd_ctl_elem_info *uinfo)
 +{
 +      struct soc_mixer_control *mc =
 +              (struct soc_mixer_control *)kcontrol->private_value;
 +
 +      snd_soc_info_volsw(kcontrol, uinfo);
 +      /* Max represents the number of levels in an SX control not the
 +       * maximum value, so add the minimum value back on
 +       */
 +      uinfo->value.integer.max += mc->min;
 +
 +      return 0;
 +}
 +EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx);
 +
  /**
   * snd_soc_get_volsw - single mixer get callback
   * @kcontrol: mixer control
@@@ -588,16 -560,16 +588,16 @@@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_ran
  /**
   * snd_soc_limit_volume - Set new limit to an existing volume control.
   *
-  * @codec: where to look for the control
+  * @card: where to look for the control
   * @name: Name of the control
   * @max: new maximum limit
   *
   * Return 0 for success, else error.
   */
- int snd_soc_limit_volume(struct snd_soc_codec *codec,
+ int snd_soc_limit_volume(struct snd_soc_card *card,
        const char *name, int max)
  {
-       struct snd_card *card = codec->component.card->snd_card;
+       struct snd_card *snd_card = card->snd_card;
        struct snd_kcontrol *kctl;
        struct soc_mixer_control *mc;
        int found = 0;
        if (unlikely(!name || max <= 0))
                return -EINVAL;
  
-       list_for_each_entry(kctl, &card->controls, list) {
+       list_for_each_entry(kctl, &snd_card->controls, list) {
                if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name))) {
                        found = 1;
                        break;