Merge remote-tracking branches 'asoc/topic/txx9', 'asoc/topic/wm8750', 'asoc/topic...
authorMark Brown <broonie@kernel.org>
Wed, 4 Feb 2015 20:57:24 +0000 (20:57 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 4 Feb 2015 20:57:24 +0000 (20:57 +0000)
1  2  3  4  5 
sound/soc/codecs/wm8904.c
sound/soc/codecs/wm8995.c

@@@@@@ -673,7 -673,7 -673,7 -673,7 -673,7 +673,7 @@@@@@ static int cp_event(struct snd_soc_dapm
     static int sysclk_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
     {
 ----   struct snd_soc_codec *codec = w->codec;
 ++++   struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
     
        switch (event) {
     static int out_pga_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
     {
 ----   struct snd_soc_codec *codec = w->codec;
 ++++   struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        int reg, val;
        int dcs_mask;
@@@@@@ -1076,13 -1076,10 -1076,10 -1076,10 -1076,10 +1076,13 @@@@@@ static const struct snd_soc_dapm_route 
        { "Right Capture PGA", NULL, "Right Capture Mux" },
        { "Right Capture PGA", NULL, "Right Capture Inverting Mux" },
     
 ----   { "AIFOUTL", "Left",  "ADCL" },
 ----   { "AIFOUTL", "Right", "ADCR" },
 ----   { "AIFOUTR", "Left",  "ADCL" },
 ----   { "AIFOUTR", "Right", "ADCR" },
 ++++   { "AIFOUTL Mux", "Left", "ADCL" },
 ++++   { "AIFOUTL Mux", "Right", "ADCR" },
 ++++   { "AIFOUTR Mux", "Left", "ADCL" },
 ++++   { "AIFOUTR Mux", "Right", "ADCR" },
 ++++
 ++++   { "AIFOUTL", NULL, "AIFOUTL Mux" },
 ++++   { "AIFOUTR", NULL, "AIFOUTR Mux" },
     
        { "ADCL", NULL, "CLK_DSP" },
        { "ADCL", NULL, "Left Capture PGA" },
     };
     
     static const struct snd_soc_dapm_route dac_intercon[] = {
 ----   { "DACL", "Right", "AIFINR" },
 ----   { "DACL", "Left",  "AIFINL" },
 ++++   { "DACL Mux", "Left", "AIFINL" },
 ++++   { "DACL Mux", "Right", "AIFINR" },
 ++++
 ++++   { "DACR Mux", "Left", "AIFINL" },
 ++++   { "DACR Mux", "Right", "AIFINR" },
 ++++
 ++++   { "DACL", NULL, "DACL Mux" },
        { "DACL", NULL, "CLK_DSP" },
     
 ----   { "DACR", "Right", "AIFINR" },
 ----   { "DACR", "Left",  "AIFINL" },
 ++++   { "DACR", NULL, "DACR Mux" },
        { "DACR", NULL, "CLK_DSP" },
     
        { "Charge pump", NULL, "SYSCLK" },
@@@@@@ -2105,6 -2098,6 -2098,6 -2098,6 -2098,24 +2105,24 @@@@@@ static const struct regmap_config wm890
        .num_reg_defaults = ARRAY_SIZE(wm8904_reg_defaults),
     };
     
++++ #ifdef CONFIG_OF
++++ static enum wm8904_type wm8904_data = WM8904;
++++ static enum wm8904_type wm8912_data = WM8912;
++++ 
++++ static const struct of_device_id wm8904_of_match[] = {
++++    {
++++            .compatible = "wlf,wm8904",
++++            .data = &wm8904_data,
++++    }, {
++++            .compatible = "wlf,wm8912",
++++            .data = &wm8912_data,
++++    }, {
++++            /* sentinel */
++++    }
++++ };
++++ MODULE_DEVICE_TABLE(of, wm8904_of_match);
++++ #endif
++++ 
     static int wm8904_i2c_probe(struct i2c_client *i2c,
                            const struct i2c_device_id *id)
     {
                return ret;
        }
     
----    wm8904->devtype = id->driver_data;
++++    if (i2c->dev.of_node) {
++++            const struct of_device_id *match;
++++ 
++++            match = of_match_node(wm8904_of_match, i2c->dev.of_node);
++++            if (match == NULL)
++++                    return -EINVAL;
++++            wm8904->devtype = *((enum wm8904_type *)match->data);
++++    } else {
++++            wm8904->devtype = id->driver_data;
++++    }
++++ 
        i2c_set_clientdata(i2c, wm8904);
        wm8904->pdata = i2c->dev.platform_data;
     
@@@@@@ -2266,6 -2259,6 -2259,6 -2259,6 -2287,7 +2294,7 @@@@@@ static struct i2c_driver wm8904_i2c_dri
        .driver = {
                .name = "wm8904",
                .owner = THIS_MODULE,
++++            .of_match_table = of_match_ptr(wm8904_of_match),
        },
        .probe =    wm8904_i2c_probe,
        .remove =   wm8904_i2c_remove,
@@@@@@ -44,7 -44,7 -44,7 -44,7 -44,7 +44,7 @@@@@@ static const char *wm8995_supply_names[
        "MICVDD"
     };
     
--- -static struct reg_default wm8995_reg_defaults[] = {
+++ +static const struct reg_default wm8995_reg_defaults[] = {
        { 0, 0x8995 },
        { 5, 0x0100 },
        { 16, 0x000b },
@@@@@@ -534,11 -534,10 -534,10 -534,10 -534,10 +534,11 @@@@@@ static void wm8995_update_class_w(struc
     static int check_clk_sys(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
     {
 ++++   struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg;
        const char *clk;
     
 ----   reg = snd_soc_read(source->codec, WM8995_CLOCKING_1);
 ++++   reg = snd_soc_read(codec, WM8995_CLOCKING_1);
        /* Check what we're currently using for CLK_SYS */
        if (reg & WM8995_SYSCLK_SRC)
                clk = "AIF2CLK";
@@@@@@ -561,7 -560,9 -560,9 -560,9 -560,9 +561,7 @@@@@@ static int wm8995_put_class_w(struct sn
     static int hp_supply_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
     {
 ----   struct snd_soc_codec *codec;
 ----
 ----   codec = w->codec;
 ++++   struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
     
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
@@@@@@ -610,9 -611,10 -611,10 -611,10 -611,10 +610,9 @@@@@@ static void dc_servo_cmd(struct snd_soc
     static int hp_event(struct snd_soc_dapm_widget *w,
                    struct snd_kcontrol *kcontrol, int event)
     {
 ----   struct snd_soc_codec *codec;
 ++++   struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        unsigned int reg;
     
 ----   codec = w->codec;
        reg = snd_soc_read(codec, WM8995_ANALOGUE_HP_1);
     
        switch (event) {
@@@@@@ -759,7 -761,9 -761,9 -761,9 -761,9 +759,7 @@@@@@ static int configure_clock(struct snd_s
     static int clk_sys_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
     {
 ----   struct snd_soc_codec *codec;
 ----
 ----   codec = w->codec;
 ++++   struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
     
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
@@@@@@ -2000,6 -2004,6 -2004,7 -2004,6 -2004,6 +2000,6 @@@@@@ static int wm8995_remove(struct snd_soc
        int i;
     
        wm8995 = snd_soc_codec_get_drvdata(codec);
  -     wm8995_set_bias_level(codec, SND_SOC_BIAS_OFF);
     
        for (i = 0; i < ARRAY_SIZE(wm8995->supplies); ++i)
                regulator_unregister_notifier(wm8995->supplies[i].consumer,
@@@@@@ -2073,6 -2077,6 -2078,8 -2077,6 -2077,6 +2073,6 @@@@@@ static int wm8995_probe(struct snd_soc_
                goto err_reg_enable;
        }
     
  -     wm8995_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
  -  
        /* Latch volume updates (right only; we always do left then right). */
        snd_soc_update_bits(codec, WM8995_AIF1_DAC1_RIGHT_VOLUME,
                            WM8995_AIF1DAC1_VU_MASK, WM8995_AIF1DAC1_VU);
     
        wm8995_update_class_w(codec);
     
  -     snd_soc_add_codec_controls(codec, wm8995_snd_controls,
  -                          ARRAY_SIZE(wm8995_snd_controls));
  -     snd_soc_dapm_new_controls(&codec->dapm, wm8995_dapm_widgets,
  -                               ARRAY_SIZE(wm8995_dapm_widgets));
  -     snd_soc_dapm_add_routes(&codec->dapm, wm8995_intercon,
  -                             ARRAY_SIZE(wm8995_intercon));
  -  
        return 0;
     
     err_reg_enable:
@@@@@@ -2186,21 -2190,21 -2200,14 -2190,21 -2190,21 +2186,21 @@@@@@ static struct snd_soc_dai_driver wm8995
        }
     };
     
--- -static struct snd_soc_codec_driver soc_codec_dev_wm8995 = {
+++ +static const struct snd_soc_codec_driver soc_codec_dev_wm8995 = {
        .probe = wm8995_probe,
        .remove = wm8995_remove,
        .set_bias_level = wm8995_set_bias_level,
        .idle_bias_off = true,
  +  
  +     .controls = wm8995_snd_controls,
  +     .num_controls = ARRAY_SIZE(wm8995_snd_controls),
  +     .dapm_widgets = wm8995_dapm_widgets,
  +     .num_dapm_widgets = ARRAY_SIZE(wm8995_dapm_widgets),
  +     .dapm_routes = wm8995_intercon,
  +     .num_dapm_routes = ARRAY_SIZE(wm8995_intercon),
     };
     
--- -static struct regmap_config wm8995_regmap = {
+++ +static const struct regmap_config wm8995_regmap = {
        .reg_bits = 16,
        .val_bits = 16,