]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'asoc/topic/fsl' into tmp
authorMark Brown <broonie@linaro.org>
Sun, 1 Sep 2013 20:15:52 +0000 (21:15 +0100)
committerMark Brown <broonie@linaro.org>
Sun, 1 Sep 2013 20:15:52 +0000 (21:15 +0100)
1  2 
include/sound/soc.h
sound/soc/mxs/mxs-sgtl5000.c
sound/soc/soc-pcm.c

diff --combined include/sound/soc.h
index 71848058ffd4d11e5d228db35079340d81929d7d,65414e82c762407a25d689266d25ad66a315ef72..d22cb0a06feb36949476ac8c761e3f1c0efa671c
  /*
   * Convenience kcontrol builders
   */
 -#define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert) \
 +#define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert, xautodisable) \
        ((unsigned long)&(struct soc_mixer_control) \
        {.reg = xreg, .rreg = xreg, .shift = shift_left, \
        .rshift = shift_right, .max = xmax, .platform_max = xmax, \
 -      .invert = xinvert})
 -#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
 -      SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert)
 +      .invert = xinvert, .autodisable = xautodisable})
 +#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \
 +      SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable)
  #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
        ((unsigned long)&(struct soc_mixer_control) \
        {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
@@@ -52,7 -52,7 +52,7 @@@
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
        .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
        .put = snd_soc_put_volsw, \
 -      .private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
 +      .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
  #define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
        .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \
@@@ -68,7 -68,7 +68,7 @@@
        .tlv.p = (tlv_array), \
        .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
        .put = snd_soc_put_volsw, \
 -      .private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
 +      .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
  #define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \
  {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@@ -97,7 -97,7 +97,7 @@@
        .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
        .put = snd_soc_put_volsw, \
        .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
 -                                        max, invert) }
 +                                        max, invert, 0) }
  #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
        .info = snd_soc_info_volsw, \
        .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
        .put = snd_soc_put_volsw, \
        .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
 -                                        max, invert) }
 +                                        max, invert, 0) }
  #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
        .info = snd_soc_info_volsw, \
        .get = xhandler_get, .put = xhandler_put, \
 -      .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
 +      .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) }
  #define SOC_DOUBLE_EXT(xname, reg, shift_left, shift_right, max, invert,\
         xhandler_get, xhandler_put) \
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
        .info = snd_soc_info_volsw, \
        .get = xhandler_get, .put = xhandler_put, \
        .private_value = \
 -              SOC_DOUBLE_VALUE(reg, shift_left, shift_right, max, invert) }
 +              SOC_DOUBLE_VALUE(reg, shift_left, shift_right, max, invert, 0) }
  #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
         xhandler_get, xhandler_put, tlv_array) \
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
        .tlv.p = (tlv_array), \
        .info = snd_soc_info_volsw, \
        .get = xhandler_get, .put = xhandler_put, \
 -      .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
 +      .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) }
  #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), \
        .info = snd_soc_info_volsw, \
        .get = xhandler_get, .put = xhandler_put, \
        .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
 -                                        xmax, xinvert) }
 +                                        xmax, xinvert, 0) }
  #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
         xhandler_get, xhandler_put, tlv_array) \
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
        .private_value = xdata }
  #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
  {     .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 -      .info = snd_soc_info_enum_ext, \
 +      .info = snd_soc_info_enum_double, \
        .get = xhandler_get, .put = xhandler_put, \
        .private_value = (unsigned long)&xenum }
  
@@@ -477,8 -477,6 +477,8 @@@ int snd_soc_set_ac97_ops_of_reset(struc
  struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
                                  void *data, const char *long_name,
                                  const char *prefix);
 +struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
 +                                             const char *name);
  int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
        const struct snd_kcontrol_new *controls, int num_controls);
  int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
@@@ -489,6 -487,8 +489,6 @@@ int snd_soc_add_dai_controls(struct snd
        const struct snd_kcontrol_new *controls, int num_controls);
  int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_info *uinfo);
 -int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
 -      struct snd_ctl_elem_info *uinfo);
  int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
  int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
@@@ -499,6 -499,8 +499,6 @@@ int snd_soc_put_value_enum_double(struc
        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_ext(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);
@@@ -697,6 -699,7 +697,6 @@@ struct snd_soc_codec 
        unsigned int probed:1; /* Codec has been probed */
        unsigned int ac97_registered:1; /* Codec has been AC97 registered */
        unsigned int ac97_created:1; /* Codec has been created by SoC */
 -      unsigned int sysfs_registered:1; /* codec has been sysfs registered */
        unsigned int cache_init:1; /* codec cache has been initialized */
        unsigned int using_regmap:1; /* using regmap access */
        u32 cache_only;  /* Suppress writes to hardware */
  
        /* codec IO */
        void *control_data; /* codec control (i2c/3wire) data */
 -      enum snd_soc_control_type control_type;
        hw_write_t hw_write;
        unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
        unsigned int (*read)(struct snd_soc_codec *, unsigned int);
  #ifdef CONFIG_DEBUG_FS
        struct dentry *debugfs_codec_root;
        struct dentry *debugfs_reg;
 -      struct dentry *debugfs_dapm;
  #endif
  };
  
@@@ -846,6 -851,7 +846,6 @@@ struct snd_soc_platform 
  
  #ifdef CONFIG_DEBUG_FS
        struct dentry *debugfs_platform_root;
 -      struct dentry *debugfs_dapm;
  #endif
  };
  
@@@ -930,6 -936,10 +930,10 @@@ struct snd_soc_dai_link 
        /* machine stream operations */
        const struct snd_soc_ops *ops;
        const struct snd_soc_compr_ops *compr_ops;
+       /* For unidirectional dai links */
+       bool playback_only;
+       bool capture_only;
  };
  
  struct snd_soc_codec_conf {
@@@ -1038,7 -1048,6 +1042,7 @@@ struct snd_soc_card 
        /* Generic DAPM context for the card */
        struct snd_soc_dapm_context dapm;
        struct snd_soc_dapm_stats dapm_stats;
 +      struct snd_soc_dapm_update *update;
  
  #ifdef CONFIG_DEBUG_FS
        struct dentry *debugfs_card_root;
@@@ -1084,9 -1093,7 +1088,9 @@@ struct snd_soc_pcm_runtime 
  /* mixer control */
  struct soc_mixer_control {
        int min, max, platform_max;
 -      unsigned int reg, rreg, shift, rshift, invert;
 +      unsigned int reg, rreg, shift, rshift;
 +      unsigned int invert:1;
 +      unsigned int autodisable:1;
  };
  
  struct soc_bytes {
index ce084eb10c49f2f826fac137a14e0ba48e98db6b,ed8a51945306956cb889c0a3108fedd6ef2112ea..4bb273786ff336aef16c08122915520f69467ef6
@@@ -25,6 -25,7 +25,6 @@@
  #include <sound/soc.h>
  #include <sound/jack.h>
  #include <sound/soc-dapm.h>
 -#include <asm/mach-types.h>
  
  #include "../codecs/sgtl5000.h"
  #include "mxs-saif.h"
@@@ -50,27 -51,18 +50,27 @@@ static int mxs_sgtl5000_hw_params(struc
        }
  
        /* Sgtl5000 sysclk should be >= 8MHz and <= 27M */
 -      if (mclk < 8000000 || mclk > 27000000)
 +      if (mclk < 8000000 || mclk > 27000000) {
 +              dev_err(codec_dai->dev, "Invalid mclk frequency: %u.%03uMHz\n",
 +                      mclk / 1000000, mclk / 1000 % 1000);
                return -EINVAL;
 +      }
  
        /* Set SGTL5000's SYSCLK (provided by SAIF MCLK) */
        ret = snd_soc_dai_set_sysclk(codec_dai, SGTL5000_SYSCLK, mclk, 0);
 -      if (ret)
 +      if (ret) {
 +              dev_err(codec_dai->dev, "Failed to set sysclk to %u.%03uMHz\n",
 +                      mclk / 1000000, mclk / 1000 % 1000);
                return ret;
 +      }
  
        /* The SAIF MCLK should be the same as SGTL5000_SYSCLK */
        ret = snd_soc_dai_set_sysclk(cpu_dai, MXS_SAIF_MCLK, mclk, 0);
 -      if (ret)
 +      if (ret) {
 +              dev_err(cpu_dai->dev, "Failed to set sysclk to %u.%03uMHz\n",
 +                      mclk / 1000000, mclk / 1000 % 1000);
                return ret;
 +      }
  
        /* set codec to slave mode */
        dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
  
        /* set codec DAI configuration */
        ret = snd_soc_dai_set_fmt(codec_dai, dai_format);
 -      if (ret)
 +      if (ret) {
 +              dev_err(codec_dai->dev, "Failed to set dai format to %08x\n",
 +                      dai_format);
                return ret;
 +      }
  
        /* set cpu DAI configuration */
        ret = snd_soc_dai_set_fmt(cpu_dai, dai_format);
 -      if (ret)
 +      if (ret) {
 +              dev_err(cpu_dai->dev, "Failed to set dai format to %08x\n",
 +                      dai_format);
                return ret;
 +      }
  
        return 0;
  }
@@@ -105,11 -91,13 +105,13 @@@ static struct snd_soc_dai_link mxs_sgtl
                .stream_name    = "HiFi Playback",
                .codec_dai_name = "sgtl5000",
                .ops            = &mxs_sgtl5000_hifi_ops,
+               .playback_only  = true,
        }, {
                .name           = "HiFi Rx",
                .stream_name    = "HiFi Capture",
                .codec_dai_name = "sgtl5000",
                .ops            = &mxs_sgtl5000_hifi_ops,
+               .capture_only   = true,
        },
  };
  
@@@ -168,10 -156,8 +170,10 @@@ static int mxs_sgtl5000_probe(struct pl
         * should be >= 8MHz and <= 27M.
         */
        ret = mxs_saif_get_mclk(0, 44100 * 256, 44100);
 -      if (ret)
 +      if (ret) {
 +              dev_err(&pdev->dev, "failed to get mclk\n");
                return ret;
 +      }
  
        card->dev = &pdev->dev;
        platform_set_drvdata(pdev, card);
diff --combined sound/soc/soc-pcm.c
index fb70fbe26862f63ef879b5fde3c58e49e2fd49a6,9abaa52efb2e682146eeaf4af481c25e5345f167..330c9a6b5cb5bf9810da6afd76a6cc8155b13845
@@@ -411,9 -411,8 +411,9 @@@ static int soc_pcm_close(struct snd_pcm
                } else {
                        /* start delayed pop wq here for playback streams */
                        rtd->pop_wait = 1;
 -                      schedule_delayed_work(&rtd->delayed_work,
 -                              msecs_to_jiffies(rtd->pmdown_time));
 +                      queue_delayed_work(system_power_efficient_wq,
 +                                         &rtd->delayed_work,
 +                                         msecs_to_jiffies(rtd->pmdown_time));
                }
        } else {
                /* capture streams can be powered down now */
@@@ -1833,10 -1832,18 +1833,10 @@@ static int dpcm_run_old_update(struct s
  /* Called by DAPM mixer/mux changes to update audio routing between PCMs and
   * any DAI links.
   */
 -int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)
 +int soc_dpcm_runtime_update(struct snd_soc_card *card)
  {
 -      struct snd_soc_card *card;
        int i, old, new, paths;
  
 -      if (widget->codec)
 -              card = widget->codec->card;
 -      else if (widget->platform)
 -              card = widget->platform->card;
 -      else
 -              return -EINVAL;
 -
        mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
        for (i = 0; i < card->num_rtd; i++) {
                struct snd_soc_dapm_widget_list *list;
@@@ -2020,6 -2027,16 +2020,16 @@@ int soc_new_pcm(struct snd_soc_pcm_runt
                        capture = 1;
        }
  
+       if (rtd->dai_link->playback_only) {
+               playback = 1;
+               capture = 0;
+       }
+       if (rtd->dai_link->capture_only) {
+               playback = 0;
+               capture = 1;
+       }
        /* create the PCM */
        if (rtd->dai_link->no_pcm) {
                snprintf(new_name, sizeof(new_name), "(%s)",