]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'topic/asoc' into next/asoc
authorTakashi Iwai <tiwai@suse.de>
Thu, 15 Jan 2009 17:27:20 +0000 (18:27 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 15 Jan 2009 17:27:20 +0000 (18:27 +0100)
1  2 
sound/soc/soc-dapm.c

diff --combined sound/soc/soc-dapm.c
index 3a759c2872a86b9ad944fcea0ea27e2f4bd20b68,a2f1da8b464602fbac5ec55e86295d0f5fcda7ec..54b4564b82b4c9faa921a1132f5663c6d717a2a8
  static int dapm_up_seq[] = {
        snd_soc_dapm_pre, snd_soc_dapm_micbias, snd_soc_dapm_mic,
        snd_soc_dapm_mux, snd_soc_dapm_value_mux, snd_soc_dapm_dac,
 -      snd_soc_dapm_mixer, snd_soc_dapm_pga, snd_soc_dapm_adc, snd_soc_dapm_hp,
 -      snd_soc_dapm_spk, snd_soc_dapm_post
 +      snd_soc_dapm_mixer, snd_soc_dapm_mixer_named_ctl, snd_soc_dapm_pga,
 +      snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, snd_soc_dapm_post
  };
 +
  static int dapm_down_seq[] = {
        snd_soc_dapm_pre, snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk,
 -      snd_soc_dapm_pga, snd_soc_dapm_mixer, snd_soc_dapm_dac, snd_soc_dapm_mic,
 -      snd_soc_dapm_micbias, snd_soc_dapm_mux, snd_soc_dapm_value_mux,
 -      snd_soc_dapm_post
 +      snd_soc_dapm_pga, snd_soc_dapm_mixer_named_ctl, snd_soc_dapm_mixer,
 +      snd_soc_dapm_dac, snd_soc_dapm_mic, snd_soc_dapm_micbias,
 +      snd_soc_dapm_mux, snd_soc_dapm_value_mux, snd_soc_dapm_post
  };
  
  static int dapm_status = 1;
@@@ -102,8 -101,7 +102,8 @@@ static void dapm_set_path_status(struc
  {
        switch (w->id) {
        case snd_soc_dapm_switch:
 -      case snd_soc_dapm_mixer: {
 +      case snd_soc_dapm_mixer:
 +      case snd_soc_dapm_mixer_named_ctl: {
                int val;
                struct soc_mixer_control *mc = (struct soc_mixer_control *)
                        w->kcontrols[i].private_value;
@@@ -325,33 -323,15 +325,33 @@@ static int dapm_new_mixer(struct snd_so
                        if (path->name != (char*)w->kcontrols[i].name)
                                continue;
  
 -                      /* add dapm control with long name */
 -                      name_len = 2 + strlen(w->name)
 -                              + strlen(w->kcontrols[i].name);
 +                      /* add dapm control with long name.
 +                       * for dapm_mixer this is the concatenation of the
 +                       * mixer and kcontrol name.
 +                       * for dapm_mixer_named_ctl this is simply the
 +                       * kcontrol name.
 +                       */
 +                      name_len = strlen(w->kcontrols[i].name) + 1;
 +                      if (w->id == snd_soc_dapm_mixer)
 +                              name_len += 1 + strlen(w->name);
 +
                        path->long_name = kmalloc(name_len, GFP_KERNEL);
 +
                        if (path->long_name == NULL)
                                return -ENOMEM;
  
 -                      snprintf(path->long_name, name_len, "%s %s",
 -                               w->name, w->kcontrols[i].name);
 +                      switch (w->id) {
 +                      case snd_soc_dapm_mixer:
 +                      default:
 +                              snprintf(path->long_name, name_len, "%s %s",
 +                                       w->name, w->kcontrols[i].name);
 +                      break;
 +                      case snd_soc_dapm_mixer_named_ctl:
 +                              snprintf(path->long_name, name_len, "%s",
 +                                       w->kcontrols[i].name);
 +                      break;
 +                      }
 +
                        path->long_name[name_len - 1] = '\0';
  
                        path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w,
@@@ -707,7 -687,6 +707,7 @@@ static void dbg_dump_dapm(struct snd_so
                case snd_soc_dapm_adc:
                case snd_soc_dapm_pga:
                case snd_soc_dapm_mixer:
 +              case snd_soc_dapm_mixer_named_ctl:
                        if (w->name) {
                                in = is_connected_input_ep(w);
                                dapm_clear_walk(w->codec);
@@@ -741,7 -720,8 +741,8 @@@ static int dapm_mux_update_power(struc
        struct snd_soc_dapm_path *path;
        int found = 0;
  
-       if (widget->id != snd_soc_dapm_mux)
+       if (widget->id != snd_soc_dapm_mux &&
+           widget->id != snd_soc_dapm_value_mux)
                return -ENODEV;
  
        if (!snd_soc_test_bits(widget->codec, e->reg, mask, val))
@@@ -780,7 -760,6 +781,7 @@@ static int dapm_mixer_update_power(stru
        int found = 0;
  
        if (widget->id != snd_soc_dapm_mixer &&
 +          widget->id != snd_soc_dapm_mixer_named_ctl &&
            widget->id != snd_soc_dapm_switch)
                return -ENODEV;
  
@@@ -834,7 -813,6 +835,7 @@@ static ssize_t dapm_widget_show(struct 
                case snd_soc_dapm_adc:
                case snd_soc_dapm_pga:
                case snd_soc_dapm_mixer:
 +              case snd_soc_dapm_mixer_named_ctl:
                        if (w->name)
                                count += sprintf(buf + count, "%s: %s\n",
                                        w->name, w->power ? "On":"Off");
@@@ -898,7 -876,7 +899,7 @@@ static void dapm_free_widgets(struct sn
  }
  
  static int snd_soc_dapm_set_pin(struct snd_soc_codec *codec,
 -      char *pin, int status)
 +                              const char *pin, int status)
  {
        struct snd_soc_dapm_widget *w;
  
@@@ -1013,7 -991,6 +1014,7 @@@ static int snd_soc_dapm_add_route(struc
                break;
        case snd_soc_dapm_switch:
        case snd_soc_dapm_mixer:
 +      case snd_soc_dapm_mixer_named_ctl:
                ret = dapm_connect_mixer(codec, wsource, wsink, path, control);
                if (ret != 0)
                        goto err;
@@@ -1091,7 -1068,6 +1092,7 @@@ int snd_soc_dapm_new_widgets(struct snd
                switch(w->id) {
                case snd_soc_dapm_switch:
                case snd_soc_dapm_mixer:
 +              case snd_soc_dapm_mixer_named_ctl:
                        dapm_new_mixer(codec, w);
                        break;
                case snd_soc_dapm_mux:
@@@ -1573,7 -1549,7 +1574,7 @@@ int snd_soc_dapm_set_bias_level(struct 
   * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
   * do any widget power switching.
   */
 -int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin)
 +int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin)
  {
        return snd_soc_dapm_set_pin(codec, pin, 1);
  }
@@@ -1588,7 -1564,7 +1589,7 @@@ EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_p
   * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
   * do any widget power switching.
   */
 -int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin)
 +int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin)
  {
        return snd_soc_dapm_set_pin(codec, pin, 0);
  }
@@@ -1608,7 -1584,7 +1609,7 @@@ EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_
   * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
   * do any widget power switching.
   */
 -int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin)
 +int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin)
  {
        return snd_soc_dapm_set_pin(codec, pin, 0);
  }
@@@ -1623,7 -1599,7 +1624,7 @@@ EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin)
   *
   * Returns 1 for connected otherwise 0.
   */
 -int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin)
 +int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin)
  {
        struct snd_soc_dapm_widget *w;