ASoC: Decouple DAPM from CODECs

Decoupling Dynamic Audio Power Management (DAPM) from codec devices is
required when developing ASoC further. Such as for other ASoC components to
have DAPM widgets or when extending DAPM to handle cross-device paths.

This patch decouples DAPM related variables from struct snd_soc_codec and
moves them to new struct snd_soc_dapm_context that is used to encapsulate
DAPM context of a device. ASoC core and API of DAPM functions are modified
to use DAPM context instead of codec.

This patch does not change current functionality and a large part of changes
come because of structure and internal API changes.

Core implementation is from Liam Girdwood <lrg@slimlogic.co.uk> with some
minor core changes, codecs and machine driver conversions from
Jarkko Nikula <jhnikula@gmail.com>.

Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Manuel Lauss <manuel.lauss@googlemail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Cliff Cai <cliff.cai@analog.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Ryan Mallon <ryan@bluewatersys.com>
Cc: Timur Tabi <timur@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Jassi Brar <jassi.brar@samsung.com>
Cc: Daniel Gloeckner <dg@emlix.com>
Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Liam Girdwood 2010-11-05 15:53:46 +02:00 committed by Mark Brown
parent 22e2fda566
commit ce6120cca2
108 changed files with 1227 additions and 1052 deletions

View file

@ -297,6 +297,7 @@ enum snd_soc_dapm_type;
struct snd_soc_dapm_path; struct snd_soc_dapm_path;
struct snd_soc_dapm_pin; struct snd_soc_dapm_pin;
struct snd_soc_dapm_route; struct snd_soc_dapm_route;
struct snd_soc_dapm_context;
int dapm_reg_event(struct snd_soc_dapm_widget *w, int dapm_reg_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event); struct snd_kcontrol *kcontrol, int event);
@ -324,16 +325,16 @@ int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *uncontrol); struct snd_ctl_elem_value *uncontrol);
int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *uncontrol); struct snd_ctl_elem_value *uncontrol);
int snd_soc_dapm_new_control(struct snd_soc_codec *codec, int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
const struct snd_soc_dapm_widget *widget); const struct snd_soc_dapm_widget *widget);
int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
const struct snd_soc_dapm_widget *widget, const struct snd_soc_dapm_widget *widget,
int num); int num);
/* dapm path setup */ /* dapm path setup */
int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm);
void snd_soc_dapm_free(struct snd_soc_codec *codec); void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
const struct snd_soc_dapm_route *route, int num); const struct snd_soc_dapm_route *route, int num);
/* dapm events */ /* dapm events */
@ -343,17 +344,21 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card);
/* dapm sys fs - used by the core */ /* dapm sys fs - used by the core */
int snd_soc_dapm_sys_add(struct device *dev); int snd_soc_dapm_sys_add(struct device *dev);
void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec); void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm);
/* dapm audio pin control and status */ /* dapm audio pin control and status */
int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin); int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin); const char *pin);
int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin); int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin); const char *pin);
int snd_soc_dapm_sync(struct snd_soc_codec *codec); int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin);
int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec, int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
const char *pin);
int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
const char *pin); const char *pin);
int snd_soc_dapm_ignore_suspend(struct snd_soc_codec *codec, const char *pin); int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
const char *pin);
/* dapm widget types */ /* dapm widget types */
enum snd_soc_dapm_type { enum snd_soc_dapm_type {
@ -425,6 +430,7 @@ struct snd_soc_dapm_widget {
char *sname; /* stream name */ char *sname; /* stream name */
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct list_head list; struct list_head list;
struct snd_soc_dapm_context *dapm;
/* dapm control */ /* dapm control */
short reg; /* negative reg = no direct dapm */ short reg; /* negative reg = no direct dapm */
@ -461,4 +467,21 @@ struct snd_soc_dapm_widget {
struct list_head power_list; struct list_head power_list;
}; };
/* DAPM context */
struct snd_soc_dapm_context {
u32 pop_time;
struct list_head widgets;
struct list_head paths;
enum snd_soc_bias_level bias_level;
enum snd_soc_bias_level suspend_bias_level;
struct delayed_work delayed_work;
unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
struct device *dev; /* from parent - for debug */
struct snd_soc_codec *codec; /* parent codec */
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_dapm;
#endif
};
#endif #endif

View file

@ -238,6 +238,7 @@ struct soc_enum;
struct snd_soc_ac97_ops; struct snd_soc_ac97_ops;
struct snd_soc_jack; struct snd_soc_jack;
struct snd_soc_jack_pin; struct snd_soc_jack_pin;
#include <sound/soc-dapm.h>
#ifdef CONFIG_GPIOLIB #ifdef CONFIG_GPIOLIB
struct snd_soc_jack_gpio; struct snd_soc_jack_gpio;
@ -436,7 +437,6 @@ struct snd_soc_codec {
/* runtime */ /* runtime */
struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
unsigned int active; unsigned int active;
unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
unsigned int cache_only:1; /* Suppress writes to hardware */ unsigned int cache_only:1; /* Suppress writes to hardware */
unsigned int cache_sync:1; /* Cache needs to be synced to hardware */ unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
unsigned int suspended:1; /* Codec is in suspend PM state */ unsigned int suspended:1; /* Codec is in suspend PM state */
@ -452,12 +452,7 @@ struct snd_soc_codec {
void *reg_cache; void *reg_cache;
/* dapm */ /* dapm */
u32 pop_time; struct snd_soc_dapm_context dapm;
struct list_head dapm_widgets;
struct list_head dapm_paths;
enum snd_soc_bias_level bias_level;
enum snd_soc_bias_level suspend_bias_level;
struct delayed_work delayed_work;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_codec_root; struct dentry *debugfs_codec_root;

View file

@ -318,27 +318,28 @@ static const struct snd_soc_dapm_route intercon[] = {
static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd) static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int i; int i;
/* /*
* Add DAPM widgets * Add DAPM widgets
*/ */
for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++) for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++)
snd_soc_dapm_new_control(codec, &playpaq_dapm_widgets[i]); snd_soc_dapm_new_control(dapm, &playpaq_dapm_widgets[i]);
/* /*
* Setup audio path interconnects * Setup audio path interconnects
*/ */
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
/* always connected pins */ /* always connected pins */
snd_soc_dapm_enable_pin(codec, "Int Mic"); snd_soc_dapm_enable_pin(dapm, "Int Mic");
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);

View file

@ -140,6 +140,7 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
printk(KERN_DEBUG printk(KERN_DEBUG
@ -154,25 +155,25 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
} }
/* Add specific widgets */ /* Add specific widgets */
snd_soc_dapm_new_controls(codec, at91sam9g20ek_dapm_widgets, snd_soc_dapm_new_controls(dapm, at91sam9g20ek_dapm_widgets,
ARRAY_SIZE(at91sam9g20ek_dapm_widgets)); ARRAY_SIZE(at91sam9g20ek_dapm_widgets));
/* Set up specific audio path interconnects */ /* Set up specific audio path interconnects */
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
/* not connected */ /* not connected */
snd_soc_dapm_nc_pin(codec, "RLINEIN"); snd_soc_dapm_nc_pin(dapm, "RLINEIN");
snd_soc_dapm_nc_pin(codec, "LLINEIN"); snd_soc_dapm_nc_pin(dapm, "LLINEIN");
#ifdef ENABLE_MIC_INPUT #ifdef ENABLE_MIC_INPUT
snd_soc_dapm_enable_pin(codec, "Int Mic"); snd_soc_dapm_enable_pin(dapm, "Int Mic");
#else #else
snd_soc_dapm_nc_pin(codec, "Int Mic"); snd_soc_dapm_nc_pin(dapm, "Int Mic");
#endif #endif
/* always connected */ /* always connected */
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -105,19 +105,20 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int afeb9260_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) static int afeb9260_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
/* Add afeb9260 specific widgets */ /* Add afeb9260 specific widgets */
snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
ARRAY_SIZE(tlv320aic23_dapm_widgets)); ARRAY_SIZE(tlv320aic23_dapm_widgets));
/* Set up afeb9260 specific audio path audio_map */ /* Set up afeb9260 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Line In"); snd_soc_dapm_enable_pin(dapm, "Line In");
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -1172,7 +1172,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Enable Audio PLL & Audio section */ /* Enable Audio PLL & Audio section */
data = AUDIO_PLL | AUDIO_SECTION_RESET data = AUDIO_PLL | AUDIO_SECTION_RESET
| AUDIO_SECTION_ON; | AUDIO_SECTION_ON;
@ -1185,7 +1185,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
pm860x_set_bits(codec->control_data, REG_MISC2, data, 0); pm860x_set_bits(codec->control_data, REG_MISC2, data, 0);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -1346,6 +1346,7 @@ EXPORT_SYMBOL_GPL(pm860x_mic_jack_detect);
static int pm860x_probe(struct snd_soc_codec *codec) static int pm860x_probe(struct snd_soc_codec *codec)
{ {
struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec); struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int i, ret; int i, ret;
pm860x->codec = codec; pm860x->codec = codec;
@ -1374,9 +1375,9 @@ static int pm860x_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, pm860x_snd_controls, snd_soc_add_controls(codec, pm860x_snd_controls,
ARRAY_SIZE(pm860x_snd_controls)); ARRAY_SIZE(pm860x_snd_controls));
snd_soc_dapm_new_controls(codec, pm860x_dapm_widgets, snd_soc_dapm_new_controls(dapm, pm860x_dapm_widgets,
ARRAY_SIZE(pm860x_dapm_widgets)); ARRAY_SIZE(pm860x_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
out_codec: out_codec:

View file

@ -220,6 +220,7 @@ static struct snd_soc_dai_driver ad1836_dai = {
static int ad1836_probe(struct snd_soc_codec *codec) static int ad1836_probe(struct snd_soc_codec *codec)
{ {
struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(codec); struct ad1836_priv *ad1836 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret = 0; int ret = 0;
codec->control_data = ad1836->control_data; codec->control_data = ad1836->control_data;
@ -252,9 +253,9 @@ static int ad1836_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, ad1836_snd_controls, snd_soc_add_controls(codec, ad1836_snd_controls,
ARRAY_SIZE(ad1836_snd_controls)); ARRAY_SIZE(ad1836_snd_controls));
snd_soc_dapm_new_controls(codec, ad1836_dapm_widgets, snd_soc_dapm_new_controls(dapm, ad1836_dapm_widgets,
ARRAY_SIZE(ad1836_dapm_widgets)); ARRAY_SIZE(ad1836_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
return ret; return ret;
} }

View file

@ -353,6 +353,7 @@ static struct snd_soc_dai_driver ad193x_dai = {
static int ad193x_probe(struct snd_soc_codec *codec) static int ad193x_probe(struct snd_soc_codec *codec)
{ {
struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec); struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
codec->control_data = ad193x->control_data; codec->control_data = ad193x->control_data;
@ -385,9 +386,9 @@ static int ad193x_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, ad193x_snd_controls, snd_soc_add_controls(codec, ad193x_snd_controls,
ARRAY_SIZE(ad193x_snd_controls)); ARRAY_SIZE(ad193x_snd_controls));
snd_soc_dapm_new_controls(codec, ad193x_dapm_widgets, snd_soc_dapm_new_controls(dapm, ad193x_dapm_widgets,
ARRAY_SIZE(ad193x_dapm_widgets)); ARRAY_SIZE(ad193x_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
return ret; return ret;
} }

View file

@ -290,10 +290,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int ak4535_add_widgets(struct snd_soc_codec *codec) static int ak4535_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, ak4535_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(ak4535_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, ak4535_dapm_widgets,
ARRAY_SIZE(ak4535_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -399,7 +400,7 @@ static int ak4535_set_bias_level(struct snd_soc_codec *codec,
ak4535_write(codec, AK4535_PM1, i & (~0x80)); ak4535_write(codec, AK4535_PM1, i & (~0x80));
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -26,7 +26,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <sound/soc-dapm.h> #include <sound/soc.h>
#include <sound/initval.h> #include <sound/initval.h>
#include <sound/tlv.h> #include <sound/tlv.h>

View file

@ -437,10 +437,11 @@ static const struct snd_soc_dapm_route intercon[] = {
static int ak4671_add_widgets(struct snd_soc_codec *codec) static int ak4671_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, ak4671_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(ak4671_dapm_widgets));
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_new_controls(dapm, ak4671_dapm_widgets,
ARRAY_SIZE(ak4671_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;
} }
@ -602,7 +603,7 @@ static int ak4671_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00); snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -832,7 +832,7 @@ static int alc5623_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, ALC5623_PWR_MANAG_ADD1, 0); snd_soc_write(codec, ALC5623_PWR_MANAG_ADD1, 0);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -888,10 +888,10 @@ static int alc5623_resume(struct snd_soc_codec *codec)
alc5623_set_bias_level(codec, SND_SOC_BIAS_STANDBY); alc5623_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
/* charge alc5623 caps */ /* charge alc5623 caps */
if (codec->suspend_bias_level == SND_SOC_BIAS_ON) { if (codec->dapm.suspend_bias_level == SND_SOC_BIAS_ON) {
alc5623_set_bias_level(codec, SND_SOC_BIAS_STANDBY); alc5623_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
codec->bias_level = SND_SOC_BIAS_ON; codec->dapm.bias_level = SND_SOC_BIAS_ON;
alc5623_set_bias_level(codec, codec->bias_level); alc5623_set_bias_level(codec, codec->dapm.bias_level);
} }
return 0; return 0;
@ -900,6 +900,7 @@ static int alc5623_resume(struct snd_soc_codec *codec)
static int alc5623_probe(struct snd_soc_codec *codec) static int alc5623_probe(struct snd_soc_codec *codec)
{ {
struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec); struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
ret = snd_soc_codec_set_cache_io(codec, 8, 16, alc5623->control_type); ret = snd_soc_codec_set_cache_io(codec, 8, 16, alc5623->control_type);
@ -943,24 +944,24 @@ static int alc5623_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, alc5623_snd_controls, snd_soc_add_controls(codec, alc5623_snd_controls,
ARRAY_SIZE(alc5623_snd_controls)); ARRAY_SIZE(alc5623_snd_controls));
snd_soc_dapm_new_controls(codec, alc5623_dapm_widgets, snd_soc_dapm_new_controls(dapm, alc5623_dapm_widgets,
ARRAY_SIZE(alc5623_dapm_widgets)); ARRAY_SIZE(alc5623_dapm_widgets));
/* set up audio path interconnects */ /* set up audio path interconnects */
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
switch (alc5623->id) { switch (alc5623->id) {
default: default:
case 0x21: case 0x21:
case 0x22: case 0x22:
snd_soc_dapm_new_controls(codec, alc5623_dapm_amp_widgets, snd_soc_dapm_new_controls(dapm, alc5623_dapm_amp_widgets,
ARRAY_SIZE(alc5623_dapm_amp_widgets)); ARRAY_SIZE(alc5623_dapm_amp_widgets));
snd_soc_dapm_add_routes(codec, intercon_amp_spk, snd_soc_dapm_add_routes(dapm, intercon_amp_spk,
ARRAY_SIZE(intercon_amp_spk)); ARRAY_SIZE(intercon_amp_spk));
break; break;
case 0x23: case 0x23:
snd_soc_dapm_add_routes(codec, intercon_spk, snd_soc_dapm_add_routes(dapm, intercon_spk,
ARRAY_SIZE(intercon_spk)); ARRAY_SIZE(intercon_spk));
break; break;
} }

View file

@ -116,7 +116,7 @@ static int cq93vc_set_bias_level(struct snd_soc_codec *codec,
DAVINCI_VC_REG12_POWER_ALL_OFF); DAVINCI_VC_REG12_POWER_ALL_OFF);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -519,6 +519,7 @@ static struct snd_soc_dai_driver cs42l51_dai = {
static int cs42l51_probe(struct snd_soc_codec *codec) static int cs42l51_probe(struct snd_soc_codec *codec)
{ {
struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret, reg; int ret, reg;
codec->control_data = cs42l51->control_data; codec->control_data = cs42l51->control_data;
@ -550,9 +551,9 @@ static int cs42l51_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, cs42l51_snd_controls, snd_soc_add_controls(codec, cs42l51_snd_controls,
ARRAY_SIZE(cs42l51_snd_controls)); ARRAY_SIZE(cs42l51_snd_controls));
snd_soc_dapm_new_controls(codec, cs42l51_dapm_widgets, snd_soc_dapm_new_controls(dapm, cs42l51_dapm_widgets,
ARRAY_SIZE(cs42l51_dapm_widgets)); ARRAY_SIZE(cs42l51_dapm_widgets));
snd_soc_dapm_add_routes(codec, cs42l51_routes, snd_soc_dapm_add_routes(dapm, cs42l51_routes,
ARRAY_SIZE(cs42l51_routes)); ARRAY_SIZE(cs42l51_routes));
return 0; return 0;

View file

@ -18,7 +18,7 @@
#include <sound/core.h> #include <sound/core.h>
#include <sound/initval.h> #include <sound/initval.h>
#include <sound/soc-dapm.h> #include <sound/soc.h>
#include "cx20442.h" #include "cx20442.h"
@ -89,10 +89,11 @@ static const struct snd_soc_dapm_route cx20442_audio_map[] = {
static int cx20442_add_widgets(struct snd_soc_codec *codec) static int cx20442_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, cx20442_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(cx20442_dapm_widgets));
snd_soc_dapm_add_routes(codec, cx20442_audio_map, snd_soc_dapm_new_controls(dapm, cx20442_dapm_widgets,
ARRAY_SIZE(cx20442_dapm_widgets));
snd_soc_dapm_add_routes(dapm, cx20442_audio_map,
ARRAY_SIZE(cx20442_audio_map)); ARRAY_SIZE(cx20442_audio_map));
return 0; return 0;
@ -263,7 +264,7 @@ static void v253_close(struct tty_struct *tty)
/* Prevent the codec driver from further accessing the modem */ /* Prevent the codec driver from further accessing the modem */
codec->hw_write = NULL; codec->hw_write = NULL;
cx20442->control_data = NULL; cx20442->control_data = NULL;
codec->pop_time = 0; codec->dapm.pop_time = 0;
} }
/* Line discipline .hangup() */ /* Line discipline .hangup() */
@ -291,7 +292,7 @@ static void v253_receive(struct tty_struct *tty,
/* Set up codec driver access to modem controls */ /* Set up codec driver access to modem controls */
cx20442->control_data = tty; cx20442->control_data = tty;
codec->hw_write = (hw_write_t)tty->ops->write; codec->hw_write = (hw_write_t)tty->ops->write;
codec->pop_time = 1; codec->dapm.pop_time = 1;
} }
} }
@ -348,7 +349,7 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
cx20442->control_data = NULL; cx20442->control_data = NULL;
codec->hw_write = NULL; codec->hw_write = NULL;
codec->pop_time = 0; codec->dapm.pop_time = 0;
return 0; return 0;
} }

View file

@ -21,7 +21,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <sound/soc-dapm.h> #include <sound/soc.h>
#include <sound/initval.h> #include <sound/initval.h>
#include <sound/tlv.h> #include <sound/tlv.h>

View file

@ -266,7 +266,7 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
/* The only way to clear the suspend flag is to reset the codec */ /* The only way to clear the suspend flag is to reset the codec */
if (codec->bias_level == SND_SOC_BIAS_OFF) if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
jz4740_codec_wakeup(codec); jz4740_codec_wakeup(codec);
mask = JZ4740_CODEC_1_VREF_DISABLE | mask = JZ4740_CODEC_1_VREF_DISABLE |
@ -288,23 +288,25 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) static int jz4740_codec_dev_probe(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, snd_soc_update_bits(codec, JZ4740_REG_CODEC_1,
JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE); JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE);
snd_soc_add_controls(codec, jz4740_codec_controls, snd_soc_add_controls(codec, jz4740_codec_controls,
ARRAY_SIZE(jz4740_codec_controls)); ARRAY_SIZE(jz4740_codec_controls));
snd_soc_dapm_new_controls(codec, jz4740_codec_dapm_widgets, snd_soc_dapm_new_controls(dapm, jz4740_codec_dapm_widgets,
ARRAY_SIZE(jz4740_codec_dapm_widgets)); ARRAY_SIZE(jz4740_codec_dapm_widgets));
snd_soc_dapm_add_routes(codec, jz4740_codec_dapm_routes, snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes,
ARRAY_SIZE(jz4740_codec_dapm_routes)); ARRAY_SIZE(jz4740_codec_dapm_routes));
snd_soc_dapm_new_widgets(codec); snd_soc_dapm_new_widgets(codec);

View file

@ -1224,15 +1224,17 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int max98088_add_widgets(struct snd_soc_codec *codec) static int max98088_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, max98088_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, max98088_dapm_widgets,
ARRAY_SIZE(max98088_dapm_widgets)); ARRAY_SIZE(max98088_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_add_controls(codec, max98088_snd_controls, snd_soc_add_controls(codec, max98088_snd_controls,
ARRAY_SIZE(max98088_snd_controls)); ARRAY_SIZE(max98088_snd_controls));
snd_soc_dapm_new_widgets(codec); snd_soc_dapm_new_widgets(dapm);
return 0; return 0;
} }
@ -1617,7 +1619,7 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
max98088_sync_cache(codec); max98088_sync_cache(codec);
snd_soc_update_bits(codec, M98088_REG_4C_PWR_EN_IN, snd_soc_update_bits(codec, M98088_REG_4C_PWR_EN_IN,
@ -1630,7 +1632,7 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec,
codec->cache_sync = 1; codec->cache_sync = 1;
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -207,10 +207,11 @@ static const struct snd_soc_dapm_route audio_conn[] = {
static int ssm2602_add_widgets(struct snd_soc_codec *codec) static int ssm2602_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, ssm2602_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(ssm2602_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_conn, ARRAY_SIZE(audio_conn)); snd_soc_dapm_new_controls(dapm, ssm2602_dapm_widgets,
ARRAY_SIZE(ssm2602_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_conn, ARRAY_SIZE(audio_conn));
return 0; return 0;
} }
@ -493,7 +494,7 @@ static int ssm2602_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -24,6 +24,7 @@
#include <sound/initval.h> #include <sound/initval.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h> #include <sound/tlv.h>
#include "stac9766.h" #include "stac9766.h"
@ -236,7 +237,7 @@ static int stac9766_set_bias_level(struct snd_soc_codec *codec,
stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff); stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -391,11 +391,12 @@ static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk,
static int tlv320aic23_add_widgets(struct snd_soc_codec *codec) static int tlv320aic23_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(tlv320aic23_dapm_widgets));
snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
ARRAY_SIZE(tlv320aic23_dapm_widgets));
/* set up audio path interconnects */ /* set up audio path interconnects */
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;
} }
@ -574,7 +575,7 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec,
tlv320aic23_write(codec, TLV320AIC23_PWR, 0xffff); tlv320aic23_write(codec, TLV320AIC23_PWR, 0xffff);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -183,7 +183,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) { if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) {
/* find dapm widget path assoc with kcontrol */ /* find dapm widget path assoc with kcontrol */
list_for_each_entry(path, &widget->codec->dapm_paths, list) { list_for_each_entry(path, &widget->dapm->paths, list) {
if (path->kcontrol != kcontrol) if (path->kcontrol != kcontrol)
continue; continue;
@ -199,7 +199,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
} }
if (found) if (found)
snd_soc_dapm_sync(widget->codec); snd_soc_dapm_sync(widget->dapm);
} }
ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); ret = snd_soc_update_bits(widget->codec, reg, val_mask, val);
@ -788,17 +788,19 @@ static const struct snd_soc_dapm_route intercon_3007[] = {
static int aic3x_add_widgets(struct snd_soc_codec *codec) static int aic3x_add_widgets(struct snd_soc_codec *codec)
{ {
struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
ARRAY_SIZE(aic3x_dapm_widgets)); ARRAY_SIZE(aic3x_dapm_widgets));
/* set up audio path interconnects */ /* set up audio path interconnects */
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
if (aic3x->model == AIC3X_MODEL_3007) { if (aic3x->model == AIC3X_MODEL_3007) {
snd_soc_dapm_new_controls(codec, aic3007_dapm_widgets, snd_soc_dapm_new_controls(dapm, aic3007_dapm_widgets,
ARRAY_SIZE(aic3007_dapm_widgets)); ARRAY_SIZE(aic3007_dapm_widgets));
snd_soc_dapm_add_routes(codec, intercon_3007, ARRAY_SIZE(intercon_3007)); snd_soc_dapm_add_routes(dapm, intercon_3007,
ARRAY_SIZE(intercon_3007));
} }
return 0; return 0;
@ -1135,7 +1137,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
break; break;
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
if (codec->bias_level == SND_SOC_BIAS_STANDBY && if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY &&
aic3x->master) { aic3x->master) {
/* enable pll */ /* enable pll */
reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG);
@ -1146,7 +1148,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (!aic3x->power) if (!aic3x->power)
aic3x_set_power(codec, 1); aic3x_set_power(codec, 1);
if (codec->bias_level == SND_SOC_BIAS_PREPARE && if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE &&
aic3x->master) { aic3x->master) {
/* disable pll */ /* disable pll */
reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG);
@ -1159,7 +1161,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
aic3x_set_power(codec, 0); aic3x_set_power(codec, 0);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -1351,7 +1353,7 @@ static int aic3x_probe(struct snd_soc_codec *codec)
codec->control_data = aic3x->control_data; codec->control_data = aic3x->control_data;
aic3x->codec = codec; aic3x->codec = codec;
codec->idle_bias_off = 1; codec->dapm.idle_bias_off = 1;
ret = snd_soc_codec_set_cache_io(codec, 8, 8, aic3x->control_type); ret = snd_soc_codec_set_cache_io(codec, 8, 8, aic3x->control_type);
if (ret != 0) { if (ret != 0) {

View file

@ -628,11 +628,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int dac33_add_widgets(struct snd_soc_codec *codec) static int dac33_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, dac33_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(dac33_dapm_widgets));
snd_soc_dapm_new_controls(dapm, dac33_dapm_widgets,
ARRAY_SIZE(dac33_dapm_widgets));
/* set up audio path interconnects */ /* set up audio path interconnects */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -649,7 +650,7 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Coming from OFF, switch on the codec */ /* Coming from OFF, switch on the codec */
ret = dac33_hard_power(codec, 1); ret = dac33_hard_power(codec, 1);
if (ret != 0) if (ret != 0)
@ -660,14 +661,14 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
/* Do not power off, when the codec is already off */ /* Do not power off, when the codec is already off */
if (codec->bias_level == SND_SOC_BIAS_OFF) if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
return 0; return 0;
ret = dac33_hard_power(codec, 0); ret = dac33_hard_power(codec, 0);
if (ret != 0) if (ret != 0)
return ret; return ret;
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -1415,7 +1416,7 @@ static int dac33_soc_probe(struct snd_soc_codec *codec)
codec->control_data = dac33->control_data; codec->control_data = dac33->control_data;
codec->hw_write = (hw_write_t) i2c_master_send; codec->hw_write = (hw_write_t) i2c_master_send;
codec->idle_bias_off = 1; codec->dapm.idle_bias_off = 1;
dac33->codec = codec; dac33->codec = codec;
/* Read the tlv320dac33 ID registers */ /* Read the tlv320dac33 ID registers */

View file

@ -388,16 +388,17 @@ static const struct snd_soc_dapm_route audio_map[] = {
int tpa6130a2_add_controls(struct snd_soc_codec *codec) int tpa6130a2_add_controls(struct snd_soc_codec *codec)
{ {
struct tpa6130a2_data *data; struct tpa6130a2_data *data;
struct snd_soc_dapm_context *dapm = &codec->dapm;
if (tpa6130a2_client == NULL) if (tpa6130a2_client == NULL)
return -ENODEV; return -ENODEV;
data = i2c_get_clientdata(tpa6130a2_client); data = i2c_get_clientdata(tpa6130a2_client);
snd_soc_dapm_new_controls(codec, tpa6130a2_dapm_widgets, snd_soc_dapm_new_controls(dapm, tpa6130a2_dapm_widgets,
ARRAY_SIZE(tpa6130a2_dapm_widgets)); ARRAY_SIZE(tpa6130a2_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
if (data->id == TPA6140A2) if (data->id == TPA6140A2)
return snd_soc_add_controls(codec, tpa6140a2_controls, return snd_soc_add_controls(codec, tpa6140a2_controls,

View file

@ -1621,10 +1621,11 @@ static const struct snd_soc_dapm_route intercon[] = {
static int twl4030_add_widgets(struct snd_soc_codec *codec) static int twl4030_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, twl4030_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(twl4030_dapm_widgets));
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_new_controls(dapm, twl4030_dapm_widgets,
ARRAY_SIZE(twl4030_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;
} }
@ -1638,14 +1639,14 @@ static int twl4030_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
twl4030_codec_enable(codec, 1); twl4030_codec_enable(codec, 1);
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
twl4030_codec_enable(codec, 0); twl4030_codec_enable(codec, 0);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -2245,7 +2246,7 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec)
snd_soc_codec_set_drvdata(codec, twl4030); snd_soc_codec_set_drvdata(codec, twl4030);
/* Set the defaults, and power up the codec */ /* Set the defaults, and power up the codec */
twl4030->sysclk = twl4030_codec_get_mclk() / 1000; twl4030->sysclk = twl4030_codec_get_mclk() / 1000;
codec->idle_bias_off = 1; codec->dapm.idle_bias_off = 1;
twl4030_init_chip(codec); twl4030_init_chip(codec);

View file

@ -641,12 +641,12 @@ static const struct snd_soc_dapm_route intercon[] = {
static int twl6040_add_widgets(struct snd_soc_codec *codec) static int twl6040_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, twl6040_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, twl6040_dapm_widgets,
ARRAY_SIZE(twl6040_dapm_widgets)); ARRAY_SIZE(twl6040_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_new_widgets(dapm);
snd_soc_dapm_new_widgets(codec);
return 0; return 0;
} }
@ -739,7 +739,7 @@ static int twl6040_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -389,7 +389,7 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec,
pd->power(0); pd->power(0);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -414,10 +414,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int uda1380_add_widgets(struct snd_soc_codec *codec) static int uda1380_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(uda1380_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
ARRAY_SIZE(uda1380_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -603,7 +604,7 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec,
int reg; int reg;
struct uda1380_platform_data *pdata = codec->dev->platform_data; struct uda1380_platform_data *pdata = codec->dev->platform_data;
if (codec->bias_level == level) if (codec->dapm.bias_level == level)
return 0; return 0;
switch (level) { switch (level) {
@ -613,7 +614,7 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec,
uda1380_write(codec, UDA1380_PM, R02_PON_BIAS | pm); uda1380_write(codec, UDA1380_PM, R02_PON_BIAS | pm);
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
if (gpio_is_valid(pdata->gpio_power)) { if (gpio_is_valid(pdata->gpio_power)) {
gpio_set_value(pdata->gpio_power, 1); gpio_set_value(pdata->gpio_power, 1);
mdelay(1); mdelay(1);
@ -636,7 +637,7 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec,
for (reg = UDA1380_MVOL; reg < UDA1380_CACHEREGNUM; reg++) for (reg = UDA1380_MVOL; reg < UDA1380_CACHEREGNUM; reg++)
set_bit(reg - 0x10, &uda1380_cache_dirty); set_bit(reg - 0x10, &uda1380_cache_dirty);
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -705,6 +705,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
/* Called from the machine driver */ /* Called from the machine driver */
int wm2000_add_controls(struct snd_soc_codec *codec) int wm2000_add_controls(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
if (!wm2000_i2c) { if (!wm2000_i2c) {
@ -712,12 +713,12 @@ int wm2000_add_controls(struct snd_soc_codec *codec)
return -ENODEV; return -ENODEV;
} }
ret = snd_soc_dapm_new_controls(codec, wm2000_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, wm2000_dapm_widgets,
ARRAY_SIZE(wm2000_dapm_widgets)); ARRAY_SIZE(wm2000_dapm_widgets));
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
if (ret < 0) if (ret < 0)
return ret; return ret;

View file

@ -230,8 +230,9 @@ static inline int wm8350_out2_ramp_step(struct snd_soc_codec *codec)
*/ */
static void wm8350_pga_work(struct work_struct *work) static void wm8350_pga_work(struct work_struct *work)
{ {
struct snd_soc_codec *codec = struct snd_soc_dapm_context *dapm =
container_of(work, struct snd_soc_codec, delayed_work.work); container_of(work, struct snd_soc_dapm_context, delayed_work.work);
struct snd_soc_codec *codec = dapm->codec;
struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
struct wm8350_output *out1 = &wm8350_data->out1, struct wm8350_output *out1 = &wm8350_data->out1,
*out2 = &wm8350_data->out2; *out2 = &wm8350_data->out2;
@ -302,8 +303,8 @@ static int pga_event(struct snd_soc_dapm_widget *w,
out->ramp = WM8350_RAMP_UP; out->ramp = WM8350_RAMP_UP;
out->active = 1; out->active = 1;
if (!delayed_work_pending(&codec->delayed_work)) if (!delayed_work_pending(&codec->dapm.delayed_work))
schedule_delayed_work(&codec->delayed_work, schedule_delayed_work(&codec->dapm.delayed_work,
msecs_to_jiffies(1)); msecs_to_jiffies(1));
break; break;
@ -311,8 +312,8 @@ static int pga_event(struct snd_soc_dapm_widget *w,
out->ramp = WM8350_RAMP_DOWN; out->ramp = WM8350_RAMP_DOWN;
out->active = 0; out->active = 0;
if (!delayed_work_pending(&codec->delayed_work)) if (!delayed_work_pending(&codec->dapm.delayed_work))
schedule_delayed_work(&codec->delayed_work, schedule_delayed_work(&codec->dapm.delayed_work,
msecs_to_jiffies(1)); msecs_to_jiffies(1));
break; break;
} }
@ -786,9 +787,10 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8350_add_widgets(struct snd_soc_codec *codec) static int wm8350_add_widgets(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
ret = snd_soc_dapm_new_controls(codec, ret = snd_soc_dapm_new_controls(dapm,
wm8350_dapm_widgets, wm8350_dapm_widgets,
ARRAY_SIZE(wm8350_dapm_widgets)); ARRAY_SIZE(wm8350_dapm_widgets));
if (ret != 0) { if (ret != 0) {
@ -797,7 +799,7 @@ static int wm8350_add_widgets(struct snd_soc_codec *codec)
} }
/* set up audio paths */ /* set up audio paths */
ret = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "DAPM route register failed\n"); dev_err(codec->dev, "DAPM route register failed\n");
return ret; return ret;
@ -1184,7 +1186,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies),
priv->supplies); priv->supplies);
if (ret != 0) if (ret != 0)
@ -1317,7 +1319,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
priv->supplies); priv->supplies);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -1550,7 +1552,7 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
/* Put the codec into reset if it wasn't already */ /* Put the codec into reset if it wasn't already */
wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
INIT_DELAYED_WORK(&codec->delayed_work, wm8350_pga_work); INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8350_pga_work);
/* Enable the codec */ /* Enable the codec */
wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
@ -1635,12 +1637,12 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
priv->mic.jack = NULL; priv->mic.jack = NULL;
/* cancel any work waiting to be queued. */ /* cancel any work waiting to be queued. */
ret = cancel_delayed_work(&codec->delayed_work); ret = cancel_delayed_work(&codec->dapm.delayed_work);
/* if there was any work waiting then we run it now and /* if there was any work waiting then we run it now and
* wait for its completion */ * wait for its completion */
if (ret) { if (ret) {
schedule_delayed_work(&codec->delayed_work, 0); schedule_delayed_work(&codec->dapm.delayed_work, 0);
flush_scheduled_work(); flush_scheduled_work();
} }

View file

@ -911,10 +911,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8400_add_widgets(struct snd_soc_codec *codec) static int wm8400_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8400_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8400_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, wm8400_dapm_widgets,
ARRAY_SIZE(wm8400_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -1219,7 +1220,7 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(power), ret = regulator_bulk_enable(ARRAY_SIZE(power),
&power[0]); &power[0]);
if (ret != 0) { if (ret != 0) {
@ -1306,7 +1307,7 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -216,10 +216,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8510_add_widgets(struct snd_soc_codec *codec) static int wm8510_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8510_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8510_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, wm8510_dapm_widgets,
ARRAY_SIZE(wm8510_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -478,7 +479,7 @@ static int wm8510_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN; power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN;
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Initial cap charge at VMID 5k */ /* Initial cap charge at VMID 5k */
snd_soc_write(codec, WM8510_POWER1, power1 | 0x3); snd_soc_write(codec, WM8510_POWER1, power1 | 0x3);
mdelay(100); mdelay(100);
@ -495,7 +496,7 @@ static int wm8510_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -110,10 +110,11 @@ static const struct snd_soc_dapm_route intercon[] = {
static int wm8523_add_widgets(struct snd_soc_codec *codec) static int wm8523_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8523_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8523_dapm_widgets));
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_new_controls(dapm, wm8523_dapm_widgets,
ARRAY_SIZE(wm8523_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;
} }
@ -328,7 +329,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies),
wm8523->supplies); wm8523->supplies);
if (ret != 0) { if (ret != 0) {
@ -367,7 +368,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
wm8523->supplies); wm8523->supplies);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -302,10 +302,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8580_add_widgets(struct snd_soc_codec *codec) static int wm8580_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8580_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, wm8580_dapm_widgets,
ARRAY_SIZE(wm8580_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -767,7 +768,7 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Power up and get individual control of the DACs */ /* Power up and get individual control of the DACs */
reg = snd_soc_read(codec, WM8580_PWRDN1); reg = snd_soc_read(codec, WM8580_PWRDN1);
reg &= ~(WM8580_PWRDN1_PWDN | WM8580_PWRDN1_ALLDACPD); reg &= ~(WM8580_PWRDN1_PWDN | WM8580_PWRDN1_ALLDACPD);
@ -785,7 +786,7 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, WM8580_PWRDN1, reg | WM8580_PWRDN1_PWDN); snd_soc_write(codec, WM8580_PWRDN1, reg | WM8580_PWRDN1_PWDN);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -93,10 +93,11 @@ static const struct snd_soc_dapm_route intercon[] = {
static int wm8711_add_widgets(struct snd_soc_codec *codec) static int wm8711_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8711_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8711_dapm_widgets));
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_new_controls(dapm, wm8711_dapm_widgets,
ARRAY_SIZE(wm8711_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;
} }
@ -318,7 +319,7 @@ static int wm8711_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, WM8711_PWR, 0xffff); snd_soc_write(codec, WM8711_PWR, 0xffff);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -73,10 +73,11 @@ static const struct snd_soc_dapm_route intercon[] = {
static int wm8728_add_widgets(struct snd_soc_codec *codec) static int wm8728_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8728_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8728_dapm_widgets));
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_new_controls(dapm, wm8728_dapm_widgets,
ARRAY_SIZE(wm8728_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;
} }
@ -180,7 +181,7 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Power everything up... */ /* Power everything up... */
reg = snd_soc_read(codec, WM8728_DACCTL); reg = snd_soc_read(codec, WM8728_DACCTL);
snd_soc_write(codec, WM8728_DACCTL, reg & ~0x4); snd_soc_write(codec, WM8728_DACCTL, reg & ~0x4);
@ -197,7 +198,7 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, WM8728_DACCTL, reg | 0x4); snd_soc_write(codec, WM8728_DACCTL, reg | 0x4);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -165,10 +165,11 @@ static const struct snd_soc_dapm_route intercon[] = {
static int wm8731_add_widgets(struct snd_soc_codec *codec) static int wm8731_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8731_dapm_widgets));
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
ARRAY_SIZE(wm8731_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;
} }
@ -319,7 +320,7 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai,
return -EINVAL; return -EINVAL;
} }
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(&codec->dapm);
return 0; return 0;
} }
@ -399,7 +400,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies),
wm8731->supplies); wm8731->supplies);
if (ret != 0) if (ret != 0)
@ -428,7 +429,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
wm8731->supplies); wm8731->supplies);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -95,10 +95,11 @@ static const struct snd_soc_dapm_route intercon[] = {
static int wm8741_add_widgets(struct snd_soc_codec *codec) static int wm8741_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8741_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8741_dapm_widgets));
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_new_controls(dapm, wm8741_dapm_widgets,
ARRAY_SIZE(wm8741_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;
} }

View file

@ -399,10 +399,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8750_add_widgets(struct snd_soc_codec *codec) static int wm8750_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8750_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
ARRAY_SIZE(wm8750_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -615,7 +616,7 @@ static int wm8750_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Set VMID to 5k */ /* Set VMID to 5k */
snd_soc_write(codec, WM8750_PWR1, pwr_reg | 0x01c1); snd_soc_write(codec, WM8750_PWR1, pwr_reg | 0x01c1);
@ -630,7 +631,7 @@ static int wm8750_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, WM8750_PWR1, 0x0001); snd_soc_write(codec, WM8750_PWR1, 0x0001);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -670,10 +670,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8753_add_widgets(struct snd_soc_codec *codec) static int wm8753_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8753_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets,
ARRAY_SIZE(wm8753_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -1292,7 +1293,7 @@ static int wm8753_set_bias_level(struct snd_soc_codec *codec,
wm8753_write(codec, WM8753_PWR1, 0x0001); wm8753_write(codec, WM8753_PWR1, 0x0001);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -1482,9 +1483,11 @@ static void wm8753_set_dai_mode(struct snd_soc_codec *codec,
static void wm8753_work(struct work_struct *work) static void wm8753_work(struct work_struct *work)
{ {
struct snd_soc_codec *codec = struct snd_soc_dapm_context *dapm =
container_of(work, struct snd_soc_codec, delayed_work.work); container_of(work, struct snd_soc_dapm_context,
wm8753_set_bias_level(codec, codec->bias_level); delayed_work.work);
struct snd_soc_codec *codec = dapm->codec;
wm8753_set_bias_level(codec, dapm->bias_level);
} }
static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state) static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state)
@ -1516,10 +1519,10 @@ static int wm8753_resume(struct snd_soc_codec *codec)
wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY); wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
/* charge wm8753 caps */ /* charge wm8753 caps */
if (codec->suspend_bias_level == SND_SOC_BIAS_ON) { if (codec->dapm.suspend_bias_level == SND_SOC_BIAS_ON) {
wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE); wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
codec->bias_level = SND_SOC_BIAS_ON; codec->dapm.bias_level = SND_SOC_BIAS_ON;
schedule_delayed_work(&codec->delayed_work, schedule_delayed_work(&codec->dapm.delayed_work,
msecs_to_jiffies(caps_charge)); msecs_to_jiffies(caps_charge));
} }
@ -1550,7 +1553,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
int ret = 0, reg; int ret = 0, reg;
INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8753_work);
ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8753->control_type); ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8753->control_type);
if (ret < 0) { if (ret < 0) {
@ -1569,7 +1572,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
/* charge output caps */ /* charge output caps */
wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE); wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
schedule_delayed_work(&codec->delayed_work, schedule_delayed_work(&codec->dapm.delayed_work,
msecs_to_jiffies(caps_charge)); msecs_to_jiffies(caps_charge));
/* set the update bits */ /* set the update bits */
@ -1604,7 +1607,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
/* power down chip */ /* power down chip */
static int wm8753_remove(struct snd_soc_codec *codec) static int wm8753_remove(struct snd_soc_codec *codec)
{ {
run_delayed_work(&codec->delayed_work); run_delayed_work(&codec->dapm.delayed_work);
wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0; return 0;

View file

@ -307,7 +307,7 @@ static int wm8776_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Disable the global powerdown; DAPM does the rest */ /* Disable the global powerdown; DAPM does the rest */
snd_soc_update_bits(codec, WM8776_PWRDOWN, 1, 0); snd_soc_update_bits(codec, WM8776_PWRDOWN, 1, 0);
} }
@ -318,7 +318,7 @@ static int wm8776_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -405,6 +405,7 @@ static int wm8776_resume(struct snd_soc_codec *codec)
static int wm8776_probe(struct snd_soc_codec *codec) static int wm8776_probe(struct snd_soc_codec *codec)
{ {
struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec); struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret = 0; int ret = 0;
ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8776->control_type); ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8776->control_type);
@ -428,9 +429,9 @@ static int wm8776_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, wm8776_snd_controls, snd_soc_add_controls(codec, wm8776_snd_controls,
ARRAY_SIZE(wm8776_snd_controls)); ARRAY_SIZE(wm8776_snd_controls));
snd_soc_dapm_new_controls(codec, wm8776_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8776_dapm_widgets,
ARRAY_SIZE(wm8776_dapm_widgets)); ARRAY_SIZE(wm8776_dapm_widgets));
snd_soc_dapm_add_routes(codec, routes, ARRAY_SIZE(routes)); snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes));
return ret; return ret;
} }

View file

@ -515,7 +515,7 @@ static int wm8804_set_bias_level(struct snd_soc_codec *codec,
snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0);
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(wm8804->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8804->supplies),
wm8804->supplies); wm8804->supplies);
if (ret) { if (ret) {
@ -537,7 +537,7 @@ static int wm8804_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -581,7 +581,7 @@ static int wm8804_probe(struct snd_soc_codec *codec)
wm8804 = snd_soc_codec_get_drvdata(codec); wm8804 = snd_soc_codec_get_drvdata(codec);
wm8804->codec = codec; wm8804->codec = codec;
codec->idle_bias_off = 1; codec->dapm.idle_bias_off = 1;
ret = snd_soc_codec_set_cache_io(codec, 8, 8, wm8804->control_type); ret = snd_soc_codec_set_cache_io(codec, 8, 8, wm8804->control_type);
if (ret < 0) { if (ret < 0) {

View file

@ -611,10 +611,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8900_add_widgets(struct snd_soc_codec *codec) static int wm8900_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8900_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8900_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, wm8900_dapm_widgets,
ARRAY_SIZE(wm8900_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -1051,7 +1052,7 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
/* Charge capacitors if initial power up */ /* Charge capacitors if initial power up */
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* STARTUP_BIAS_ENA on */ /* STARTUP_BIAS_ENA on */
snd_soc_write(codec, WM8900_REG_POWER1, snd_soc_write(codec, WM8900_REG_POWER1,
WM8900_REG_POWER1_STARTUP_BIAS_ENA); WM8900_REG_POWER1_STARTUP_BIAS_ENA);
@ -1119,7 +1120,7 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec,
WM8900_REG_POWER2_SYSCLK_ENA); WM8900_REG_POWER2_SYSCLK_ENA);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -923,10 +923,11 @@ static const struct snd_soc_dapm_route intercon[] = {
static int wm8903_add_widgets(struct snd_soc_codec *codec) static int wm8903_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8903_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8903_dapm_widgets));
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_new_controls(dapm, wm8903_dapm_widgets,
ARRAY_SIZE(wm8903_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;
} }
@ -946,7 +947,7 @@ static int wm8903_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
snd_soc_write(codec, WM8903_CLOCK_RATES_2, snd_soc_write(codec, WM8903_CLOCK_RATES_2,
WM8903_CLK_SYS_ENA); WM8903_CLK_SYS_ENA);
@ -991,7 +992,7 @@ static int wm8903_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -1428,10 +1428,11 @@ static const struct snd_soc_dapm_route wm8912_intercon[] = {
static int wm8904_add_widgets(struct snd_soc_codec *codec) static int wm8904_add_widgets(struct snd_soc_codec *codec)
{ {
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(codec, wm8904_core_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8904_core_dapm_widgets,
ARRAY_SIZE(wm8904_core_dapm_widgets)); ARRAY_SIZE(wm8904_core_dapm_widgets));
snd_soc_dapm_add_routes(codec, core_intercon, snd_soc_dapm_add_routes(dapm, core_intercon,
ARRAY_SIZE(core_intercon)); ARRAY_SIZE(core_intercon));
switch (wm8904->devtype) { switch (wm8904->devtype) {
@ -1443,20 +1444,20 @@ static int wm8904_add_widgets(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, wm8904_snd_controls, snd_soc_add_controls(codec, wm8904_snd_controls,
ARRAY_SIZE(wm8904_snd_controls)); ARRAY_SIZE(wm8904_snd_controls));
snd_soc_dapm_new_controls(codec, wm8904_adc_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8904_adc_dapm_widgets,
ARRAY_SIZE(wm8904_adc_dapm_widgets)); ARRAY_SIZE(wm8904_adc_dapm_widgets));
snd_soc_dapm_new_controls(codec, wm8904_dac_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8904_dac_dapm_widgets,
ARRAY_SIZE(wm8904_dac_dapm_widgets)); ARRAY_SIZE(wm8904_dac_dapm_widgets));
snd_soc_dapm_new_controls(codec, wm8904_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8904_dapm_widgets,
ARRAY_SIZE(wm8904_dapm_widgets)); ARRAY_SIZE(wm8904_dapm_widgets));
snd_soc_dapm_add_routes(codec, core_intercon, snd_soc_dapm_add_routes(dapm, core_intercon,
ARRAY_SIZE(core_intercon)); ARRAY_SIZE(core_intercon));
snd_soc_dapm_add_routes(codec, adc_intercon, snd_soc_dapm_add_routes(dapm, adc_intercon,
ARRAY_SIZE(adc_intercon)); ARRAY_SIZE(adc_intercon));
snd_soc_dapm_add_routes(codec, dac_intercon, snd_soc_dapm_add_routes(dapm, dac_intercon,
ARRAY_SIZE(dac_intercon)); ARRAY_SIZE(dac_intercon));
snd_soc_dapm_add_routes(codec, wm8904_intercon, snd_soc_dapm_add_routes(dapm, wm8904_intercon,
ARRAY_SIZE(wm8904_intercon)); ARRAY_SIZE(wm8904_intercon));
break; break;
@ -1464,17 +1465,17 @@ static int wm8904_add_widgets(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, wm8904_dac_snd_controls, snd_soc_add_controls(codec, wm8904_dac_snd_controls,
ARRAY_SIZE(wm8904_dac_snd_controls)); ARRAY_SIZE(wm8904_dac_snd_controls));
snd_soc_dapm_new_controls(codec, wm8904_dac_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8904_dac_dapm_widgets,
ARRAY_SIZE(wm8904_dac_dapm_widgets)); ARRAY_SIZE(wm8904_dac_dapm_widgets));
snd_soc_dapm_add_routes(codec, dac_intercon, snd_soc_dapm_add_routes(dapm, dac_intercon,
ARRAY_SIZE(dac_intercon)); ARRAY_SIZE(dac_intercon));
snd_soc_dapm_add_routes(codec, wm8912_intercon, snd_soc_dapm_add_routes(dapm, wm8912_intercon,
ARRAY_SIZE(wm8912_intercon)); ARRAY_SIZE(wm8912_intercon));
break; break;
} }
snd_soc_dapm_new_widgets(codec); snd_soc_dapm_new_widgets(dapm);
return 0; return 0;
} }
@ -2139,7 +2140,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(wm8904->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8904->supplies),
wm8904->supplies); wm8904->supplies);
if (ret != 0) { if (ret != 0) {
@ -2198,7 +2199,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
wm8904->supplies); wm8904->supplies);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -2373,7 +2374,7 @@ static int wm8904_probe(struct snd_soc_codec *codec)
int ret, i; int ret, i;
codec->cache_sync = 1; codec->cache_sync = 1;
codec->idle_bias_off = 1; codec->dapm.idle_bias_off = 1;
switch (wm8904->devtype) { switch (wm8904->devtype) {
case WM8904: case WM8904:

View file

@ -291,13 +291,14 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8940_add_widgets(struct snd_soc_codec *codec) static int wm8940_add_widgets(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
ret = snd_soc_dapm_new_controls(codec, wm8940_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, wm8940_dapm_widgets,
ARRAY_SIZE(wm8940_dapm_widgets)); ARRAY_SIZE(wm8940_dapm_widgets));
if (ret) if (ret)
goto error_ret; goto error_ret;
ret = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
if (ret) if (ret)
goto error_ret; goto error_ret;

View file

@ -577,13 +577,14 @@ static const struct snd_soc_dapm_route wm8955_intercon[] = {
static int wm8955_add_widgets(struct snd_soc_codec *codec) static int wm8955_add_widgets(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_add_controls(codec, wm8955_snd_controls, snd_soc_add_controls(codec, wm8955_snd_controls,
ARRAY_SIZE(wm8955_snd_controls)); ARRAY_SIZE(wm8955_snd_controls));
snd_soc_dapm_new_controls(codec, wm8955_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8955_dapm_widgets,
ARRAY_SIZE(wm8955_dapm_widgets)); ARRAY_SIZE(wm8955_dapm_widgets));
snd_soc_dapm_add_routes(dapm, wm8955_intercon,
snd_soc_dapm_add_routes(codec, wm8955_intercon,
ARRAY_SIZE(wm8955_intercon)); ARRAY_SIZE(wm8955_intercon));
return 0; return 0;
@ -786,7 +787,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(wm8955->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8955->supplies),
wm8955->supplies); wm8955->supplies);
if (ret != 0) { if (ret != 0) {
@ -850,7 +851,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec,
wm8955->supplies); wm8955->supplies);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -388,27 +388,28 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec)
{ {
struct wm8960_data *pdata = codec->dev->platform_data; struct wm8960_data *pdata = codec->dev->platform_data;
struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
struct snd_soc_dapm_widget *w; struct snd_soc_dapm_widget *w;
snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets,
ARRAY_SIZE(wm8960_dapm_widgets)); ARRAY_SIZE(wm8960_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
/* In capless mode OUT3 is used to provide VMID for the /* In capless mode OUT3 is used to provide VMID for the
* headphone outputs, otherwise it is used as a mono mixer. * headphone outputs, otherwise it is used as a mono mixer.
*/ */
if (pdata && pdata->capless) { if (pdata && pdata->capless) {
snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets_capless, snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets_capless,
ARRAY_SIZE(wm8960_dapm_widgets_capless)); ARRAY_SIZE(wm8960_dapm_widgets_capless));
snd_soc_dapm_add_routes(codec, audio_paths_capless, snd_soc_dapm_add_routes(dapm, audio_paths_capless,
ARRAY_SIZE(audio_paths_capless)); ARRAY_SIZE(audio_paths_capless));
} else { } else {
snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets_out3, snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets_out3,
ARRAY_SIZE(wm8960_dapm_widgets_out3)); ARRAY_SIZE(wm8960_dapm_widgets_out3));
snd_soc_dapm_add_routes(codec, audio_paths_out3, snd_soc_dapm_add_routes(dapm, audio_paths_out3,
ARRAY_SIZE(audio_paths_out3)); ARRAY_SIZE(audio_paths_out3));
} }
@ -417,7 +418,7 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec)
* list each time to find the desired power state do so now * list each time to find the desired power state do so now
* and save the result. * and save the result.
*/ */
list_for_each_entry(w, &codec->dapm_widgets, list) { list_for_each_entry(w, &codec->dapm.widgets, list) {
if (strcmp(w->name, "LOUT1 PGA") == 0) if (strcmp(w->name, "LOUT1 PGA") == 0)
wm8960->lout1 = w; wm8960->lout1 = w;
if (strcmp(w->name, "ROUT1 PGA") == 0) if (strcmp(w->name, "ROUT1 PGA") == 0)
@ -572,7 +573,7 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Enable anti-pop features */ /* Enable anti-pop features */
snd_soc_write(codec, WM8960_APOP1, snd_soc_write(codec, WM8960_APOP1,
WM8960_POBCTRL | WM8960_SOFT_ST | WM8960_POBCTRL | WM8960_SOFT_ST |
@ -610,7 +611,7 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -626,7 +627,7 @@ static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
switch (codec->bias_level) { switch (codec->dapm.bias_level) {
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
/* Enable anti pop mode */ /* Enable anti pop mode */
snd_soc_update_bits(codec, WM8960_APOP1, snd_soc_update_bits(codec, WM8960_APOP1,
@ -681,7 +682,7 @@ static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
switch (codec->bias_level) { switch (codec->dapm.bias_level) {
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
/* Disable HP discharge */ /* Disable HP discharge */
snd_soc_update_bits(codec, WM8960_APOP2, snd_soc_update_bits(codec, WM8960_APOP2,
@ -705,7 +706,7 @@ static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -882,7 +882,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
if (codec->bias_level == SND_SOC_BIAS_STANDBY) { if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
/* Enable bias generation */ /* Enable bias generation */
reg = snd_soc_read(codec, WM8961_ANTI_POP); reg = snd_soc_read(codec, WM8961_ANTI_POP);
reg |= WM8961_BUFIOEN | WM8961_BUFDCOPEN; reg |= WM8961_BUFIOEN | WM8961_BUFDCOPEN;
@ -897,7 +897,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_PREPARE) { if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) {
/* VREF off */ /* VREF off */
reg = snd_soc_read(codec, WM8961_PWR_MGMT_1); reg = snd_soc_read(codec, WM8961_PWR_MGMT_1);
reg &= ~WM8961_VREF; reg &= ~WM8961_VREF;
@ -919,7 +919,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -959,6 +959,7 @@ static struct snd_soc_dai_driver wm8961_dai = {
static int wm8961_probe(struct snd_soc_codec *codec) static int wm8961_probe(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret = 0; int ret = 0;
u16 reg; u16 reg;
@ -1024,9 +1025,9 @@ static int wm8961_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, wm8961_snd_controls, snd_soc_add_controls(codec, wm8961_snd_controls,
ARRAY_SIZE(wm8961_snd_controls)); ARRAY_SIZE(wm8961_snd_controls));
snd_soc_dapm_new_controls(codec, wm8961_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8961_dapm_widgets,
ARRAY_SIZE(wm8961_dapm_widgets)); ARRAY_SIZE(wm8961_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
return 0; return 0;
} }

View file

@ -2682,6 +2682,7 @@ static const struct snd_soc_dapm_route wm8962_spk_stereo_intercon[] = {
static int wm8962_add_widgets(struct snd_soc_codec *codec) static int wm8962_add_widgets(struct snd_soc_codec *codec)
{ {
struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); struct wm8962_pdata *pdata = dev_get_platdata(codec->dev);
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_add_controls(codec, wm8962_snd_controls, snd_soc_add_controls(codec, wm8962_snd_controls,
ARRAY_SIZE(wm8962_snd_controls)); ARRAY_SIZE(wm8962_snd_controls));
@ -2693,26 +2694,26 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec)
ARRAY_SIZE(wm8962_spk_stereo_controls)); ARRAY_SIZE(wm8962_spk_stereo_controls));
snd_soc_dapm_new_controls(codec, wm8962_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8962_dapm_widgets,
ARRAY_SIZE(wm8962_dapm_widgets)); ARRAY_SIZE(wm8962_dapm_widgets));
if (pdata && pdata->spk_mono) if (pdata && pdata->spk_mono)
snd_soc_dapm_new_controls(codec, wm8962_dapm_spk_mono_widgets, snd_soc_dapm_new_controls(dapm, wm8962_dapm_spk_mono_widgets,
ARRAY_SIZE(wm8962_dapm_spk_mono_widgets)); ARRAY_SIZE(wm8962_dapm_spk_mono_widgets));
else else
snd_soc_dapm_new_controls(codec, wm8962_dapm_spk_stereo_widgets, snd_soc_dapm_new_controls(dapm, wm8962_dapm_spk_stereo_widgets,
ARRAY_SIZE(wm8962_dapm_spk_stereo_widgets)); ARRAY_SIZE(wm8962_dapm_spk_stereo_widgets));
snd_soc_dapm_add_routes(codec, wm8962_intercon, snd_soc_dapm_add_routes(dapm, wm8962_intercon,
ARRAY_SIZE(wm8962_intercon)); ARRAY_SIZE(wm8962_intercon));
if (pdata && pdata->spk_mono) if (pdata && pdata->spk_mono)
snd_soc_dapm_add_routes(codec, wm8962_spk_mono_intercon, snd_soc_dapm_add_routes(dapm, wm8962_spk_mono_intercon,
ARRAY_SIZE(wm8962_spk_mono_intercon)); ARRAY_SIZE(wm8962_spk_mono_intercon));
else else
snd_soc_dapm_add_routes(codec, wm8962_spk_stereo_intercon, snd_soc_dapm_add_routes(dapm, wm8962_spk_stereo_intercon,
ARRAY_SIZE(wm8962_spk_stereo_intercon)); ARRAY_SIZE(wm8962_spk_stereo_intercon));
snd_soc_dapm_disable_pin(codec, "Beep"); snd_soc_dapm_disable_pin(dapm, "Beep");
return 0; return 0;
} }
@ -2819,7 +2820,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
int ret; int ret;
if (level == codec->bias_level) if (level == codec->dapm.bias_level)
return 0; return 0;
switch (level) { switch (level) {
@ -2833,7 +2834,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies),
wm8962->supplies); wm8962->supplies);
if (ret != 0) { if (ret != 0) {
@ -2883,7 +2884,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
wm8962->supplies); wm8962->supplies);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -3441,6 +3442,7 @@ static void wm8962_beep_work(struct work_struct *work)
struct wm8962_priv *wm8962 = struct wm8962_priv *wm8962 =
container_of(work, struct wm8962_priv, beep_work); container_of(work, struct wm8962_priv, beep_work);
struct snd_soc_codec *codec = wm8962->codec; struct snd_soc_codec *codec = wm8962->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int i; int i;
int reg = 0; int reg = 0;
int best = 0; int best = 0;
@ -3457,16 +3459,16 @@ static void wm8962_beep_work(struct work_struct *work)
reg = WM8962_BEEP_ENA | (best << WM8962_BEEP_RATE_SHIFT); reg = WM8962_BEEP_ENA | (best << WM8962_BEEP_RATE_SHIFT);
snd_soc_dapm_enable_pin(codec, "Beep"); snd_soc_dapm_enable_pin(dapm, "Beep");
} else { } else {
dev_dbg(codec->dev, "Disabling beep\n"); dev_dbg(codec->dev, "Disabling beep\n");
snd_soc_dapm_disable_pin(codec, "Beep"); snd_soc_dapm_disable_pin(dapm, "Beep");
} }
snd_soc_update_bits(codec, WM8962_BEEP_GENERATOR_1, snd_soc_update_bits(codec, WM8962_BEEP_GENERATOR_1,
WM8962_BEEP_ENA | WM8962_BEEP_RATE_MASK, reg); WM8962_BEEP_ENA | WM8962_BEEP_RATE_MASK, reg);
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
} }
/* For usability define a way of injecting beep events for the device - /* For usability define a way of injecting beep events for the device -
@ -3713,7 +3715,7 @@ static int wm8962_probe(struct snd_soc_codec *codec)
INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work); INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work);
codec->cache_sync = 1; codec->cache_sync = 1;
codec->idle_bias_off = 1; codec->dapm.idle_bias_off = 1;
ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C); ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C);
if (ret != 0) { if (ret != 0) {

View file

@ -333,10 +333,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8971_add_widgets(struct snd_soc_codec *codec) static int wm8971_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8971_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8971_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, wm8971_dapm_widgets,
ARRAY_SIZE(wm8971_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -553,7 +554,7 @@ static int wm8971_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, WM8971_PWR1, 0x0001); snd_soc_write(codec, WM8971_PWR1, 0x0001);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -590,9 +591,11 @@ static struct snd_soc_dai_driver wm8971_dai = {
static void wm8971_work(struct work_struct *work) static void wm8971_work(struct work_struct *work)
{ {
struct snd_soc_codec *codec = struct snd_soc_dapm_context *dapm =
container_of(work, struct snd_soc_codec, delayed_work.work); container_of(work, struct snd_soc_dapm_context,
wm8971_set_bias_level(codec, codec->bias_level); delayed_work.work);
struct snd_soc_codec *codec = dapm->codec;
wm8971_set_bias_level(codec, codec->dapm.bias_level);
} }
static int wm8971_suspend(struct snd_soc_codec *codec, pm_message_t state) static int wm8971_suspend(struct snd_soc_codec *codec, pm_message_t state)
@ -620,11 +623,11 @@ static int wm8971_resume(struct snd_soc_codec *codec)
wm8971_set_bias_level(codec, SND_SOC_BIAS_STANDBY); wm8971_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
/* charge wm8971 caps */ /* charge wm8971 caps */
if (codec->suspend_bias_level == SND_SOC_BIAS_ON) { if (codec->dapm.suspend_bias_level == SND_SOC_BIAS_ON) {
reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e; reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e;
snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0); snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0);
codec->bias_level = SND_SOC_BIAS_ON; codec->dapm.bias_level = SND_SOC_BIAS_ON;
queue_delayed_work(wm8971_workq, &codec->delayed_work, queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work,
msecs_to_jiffies(1000)); msecs_to_jiffies(1000));
} }
@ -643,7 +646,7 @@ static int wm8971_probe(struct snd_soc_codec *codec)
return ret; return ret;
} }
INIT_DELAYED_WORK(&codec->delayed_work, wm8971_work); INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8971_work);
wm8971_workq = create_workqueue("wm8971"); wm8971_workq = create_workqueue("wm8971");
if (wm8971_workq == NULL) if (wm8971_workq == NULL)
return -ENOMEM; return -ENOMEM;
@ -653,8 +656,8 @@ static int wm8971_probe(struct snd_soc_codec *codec)
/* charge output caps - set vmid to 5k for quick power up */ /* charge output caps - set vmid to 5k for quick power up */
reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e; reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e;
snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0); snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0);
codec->bias_level = SND_SOC_BIAS_STANDBY; codec->dapm.bias_level = SND_SOC_BIAS_STANDBY;
queue_delayed_work(wm8971_workq, &codec->delayed_work, queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work,
msecs_to_jiffies(1000)); msecs_to_jiffies(1000));
/* set the update bits */ /* set the update bits */

View file

@ -274,10 +274,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8974_add_widgets(struct snd_soc_codec *codec) static int wm8974_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8974_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8974_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, wm8974_dapm_widgets,
ARRAY_SIZE(wm8974_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -530,7 +531,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
power1 |= WM8974_POWER1_BIASEN | WM8974_POWER1_BUFIOEN; power1 |= WM8974_POWER1_BIASEN | WM8974_POWER1_BUFIOEN;
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Initial cap charge at VMID 5k */ /* Initial cap charge at VMID 5k */
snd_soc_write(codec, WM8974_POWER1, power1 | 0x3); snd_soc_write(codec, WM8974_POWER1, power1 | 0x3);
mdelay(100); mdelay(100);
@ -547,7 +548,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -355,11 +355,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8978_add_widgets(struct snd_soc_codec *codec) static int wm8978_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8978_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8978_dapm_widgets));
snd_soc_dapm_new_controls(dapm, wm8978_dapm_widgets,
ARRAY_SIZE(wm8978_dapm_widgets));
/* set up the WM8978 audio map */ /* set up the WM8978 audio map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -837,7 +838,7 @@ static int wm8978_set_bias_level(struct snd_soc_codec *codec,
/* bit 3: enable bias, bit 2: enable I/O tie off buffer */ /* bit 3: enable bias, bit 2: enable I/O tie off buffer */
power1 |= 0xc; power1 |= 0xc;
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Initial cap charge at VMID 5k */ /* Initial cap charge at VMID 5k */
snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1,
power1 | 0x3); power1 | 0x3);
@ -857,7 +858,7 @@ static int wm8978_set_bias_level(struct snd_soc_codec *codec,
dev_dbg(codec->dev, "%s: %d, %x\n", __func__, level, power1); dev_dbg(codec->dev, "%s: %d, %x\n", __func__, level, power1);
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -533,10 +533,11 @@ static int eqmode_put(struct snd_kcontrol *kcontrol,
static int wm8985_add_widgets(struct snd_soc_codec *codec) static int wm8985_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8985_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8985_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, snd_soc_dapm_new_controls(dapm, wm8985_dapm_widgets,
ARRAY_SIZE(wm8985_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map,
ARRAY_SIZE(audio_map)); ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -879,7 +880,7 @@ static int wm8985_set_bias_level(struct snd_soc_codec *codec,
1 << WM8985_VMIDSEL_SHIFT); 1 << WM8985_VMIDSEL_SHIFT);
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies),
wm8985->supplies); wm8985->supplies);
if (ret) { if (ret) {
@ -939,7 +940,7 @@ static int wm8985_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -677,7 +677,7 @@ static int wm8988_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* VREF, VMID=2x5k */ /* VREF, VMID=2x5k */
snd_soc_write(codec, WM8988_PWR1, pwr_reg | 0x1c1); snd_soc_write(codec, WM8988_PWR1, pwr_reg | 0x1c1);
@ -693,7 +693,7 @@ static int wm8988_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, WM8988_PWR1, 0x0000); snd_soc_write(codec, WM8988_PWR1, 0x0000);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -759,6 +759,7 @@ static int wm8988_resume(struct snd_soc_codec *codec)
static int wm8988_probe(struct snd_soc_codec *codec) static int wm8988_probe(struct snd_soc_codec *codec)
{ {
struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec); struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret = 0; int ret = 0;
u16 reg; u16 reg;
@ -790,9 +791,9 @@ static int wm8988_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, wm8988_snd_controls, snd_soc_add_controls(codec, wm8988_snd_controls,
ARRAY_SIZE(wm8988_snd_controls)); ARRAY_SIZE(wm8988_snd_controls));
snd_soc_dapm_new_controls(codec, wm8988_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8988_dapm_widgets,
ARRAY_SIZE(wm8988_dapm_widgets)); ARRAY_SIZE(wm8988_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }

View file

@ -914,11 +914,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm8990_add_widgets(struct snd_soc_codec *codec) static int wm8990_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm8990_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm8990_dapm_widgets));
snd_soc_dapm_new_controls(dapm, wm8990_dapm_widgets,
ARRAY_SIZE(wm8990_dapm_widgets));
/* set up the WM8990 audio map */ /* set up the WM8990 audio map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -1170,7 +1171,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Enable all output discharge bits */ /* Enable all output discharge bits */
snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE | snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE |
WM8990_DIS_RLINE | WM8990_DIS_OUT3 | WM8990_DIS_RLINE | WM8990_DIS_OUT3 |
@ -1266,7 +1267,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -970,7 +970,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies),
wm8993->supplies); wm8993->supplies);
if (ret != 0) if (ret != 0)
@ -1045,7 +1045,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -1424,6 +1424,7 @@ static struct snd_soc_dai_driver wm8993_dai = {
static int wm8993_probe(struct snd_soc_codec *codec) static int wm8993_probe(struct snd_soc_codec *codec)
{ {
struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret, i, val; int ret, i, val;
wm8993->hubs_data.hp_startup_mode = 1; wm8993->hubs_data.hp_startup_mode = 1;
@ -1505,11 +1506,11 @@ static int wm8993_probe(struct snd_soc_codec *codec)
ARRAY_SIZE(wm8993_eq_controls)); ARRAY_SIZE(wm8993_eq_controls));
} }
snd_soc_dapm_new_controls(codec, wm8993_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8993_dapm_widgets,
ARRAY_SIZE(wm8993_dapm_widgets)); ARRAY_SIZE(wm8993_dapm_widgets));
wm_hubs_add_analogue_controls(codec); wm_hubs_add_analogue_controls(codec);
snd_soc_dapm_add_routes(codec, routes, ARRAY_SIZE(routes)); snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes));
wm_hubs_add_analogue_routes(codec, wm8993->pdata.lineout1_diff, wm_hubs_add_analogue_routes(codec, wm8993->pdata.lineout1_diff,
wm8993->pdata.lineout2_diff); wm8993->pdata.lineout2_diff);

View file

@ -1835,7 +1835,7 @@ static int configure_clock(struct snd_soc_codec *codec)
snd_soc_update_bits(codec, WM8994_CLOCKING_1, WM8994_SYSCLK_SRC, new); snd_soc_update_bits(codec, WM8994_CLOCKING_1, WM8994_SYSCLK_SRC, new);
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(&codec->dapm);
return 0; return 0;
} }
@ -3108,7 +3108,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Tweak DC servo and DSP configuration for /* Tweak DC servo and DSP configuration for
* improved performance. */ * improved performance. */
if (wm8994->revision < 4) { if (wm8994->revision < 4) {
@ -3152,7 +3152,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
if (codec->bias_level == SND_SOC_BIAS_STANDBY) { if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
/* Switch over to startup biases */ /* Switch over to startup biases */
snd_soc_update_bits(codec, WM8994_ANTIPOP_2, snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
WM8994_BIAS_SRC | WM8994_BIAS_SRC |
@ -3187,7 +3187,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
} }
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -3895,6 +3895,7 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data)
static int wm8994_codec_probe(struct snd_soc_codec *codec) static int wm8994_codec_probe(struct snd_soc_codec *codec)
{ {
struct wm8994_priv *wm8994; struct wm8994_priv *wm8994;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret, i; int ret, i;
codec->control_data = dev_get_drvdata(codec->dev->parent); codec->control_data = dev_get_drvdata(codec->dev->parent);
@ -4033,10 +4034,10 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
wm_hubs_add_analogue_controls(codec); wm_hubs_add_analogue_controls(codec);
snd_soc_add_controls(codec, wm8994_snd_controls, snd_soc_add_controls(codec, wm8994_snd_controls,
ARRAY_SIZE(wm8994_snd_controls)); ARRAY_SIZE(wm8994_snd_controls));
snd_soc_dapm_new_controls(codec, wm8994_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8994_dapm_widgets,
ARRAY_SIZE(wm8994_dapm_widgets)); ARRAY_SIZE(wm8994_dapm_widgets));
wm_hubs_add_analogue_routes(codec, 0, 0); wm_hubs_add_analogue_routes(codec, 0, 0);
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0; return 0;

View file

@ -805,7 +805,7 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
/* Initial cold start */ /* Initial cold start */
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Disable LINEOUT discharge */ /* Disable LINEOUT discharge */
reg = snd_soc_read(codec, WM9081_ANTI_POP_CONTROL); reg = snd_soc_read(codec, WM9081_ANTI_POP_CONTROL);
reg &= ~WM9081_LINEOUT_DISCH; reg &= ~WM9081_LINEOUT_DISCH;
@ -865,7 +865,7 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -1228,6 +1228,7 @@ static struct snd_soc_dai_driver wm9081_dai = {
static int wm9081_probe(struct snd_soc_codec *codec) static int wm9081_probe(struct snd_soc_codec *codec)
{ {
struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
u16 reg; u16 reg;
@ -1269,9 +1270,9 @@ static int wm9081_probe(struct snd_soc_codec *codec)
ARRAY_SIZE(wm9081_eq_controls)); ARRAY_SIZE(wm9081_eq_controls));
} }
snd_soc_dapm_new_controls(codec, wm9081_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm9081_dapm_widgets,
ARRAY_SIZE(wm9081_dapm_widgets)); ARRAY_SIZE(wm9081_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
return ret; return ret;
} }

View file

@ -443,31 +443,32 @@ static const struct snd_soc_dapm_route audio_map_in2_diff[] = {
static int wm9090_add_controls(struct snd_soc_codec *codec) static int wm9090_add_controls(struct snd_soc_codec *codec)
{ {
struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int i; int i;
snd_soc_dapm_new_controls(codec, wm9090_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm9090_dapm_widgets,
ARRAY_SIZE(wm9090_dapm_widgets)); ARRAY_SIZE(wm9090_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_add_controls(codec, wm9090_controls, snd_soc_add_controls(codec, wm9090_controls,
ARRAY_SIZE(wm9090_controls)); ARRAY_SIZE(wm9090_controls));
if (wm9090->pdata.lin1_diff) { if (wm9090->pdata.lin1_diff) {
snd_soc_dapm_add_routes(codec, audio_map_in1_diff, snd_soc_dapm_add_routes(dapm, audio_map_in1_diff,
ARRAY_SIZE(audio_map_in1_diff)); ARRAY_SIZE(audio_map_in1_diff));
} else { } else {
snd_soc_dapm_add_routes(codec, audio_map_in1_se, snd_soc_dapm_add_routes(dapm, audio_map_in1_se,
ARRAY_SIZE(audio_map_in1_se)); ARRAY_SIZE(audio_map_in1_se));
snd_soc_add_controls(codec, wm9090_in1_se_controls, snd_soc_add_controls(codec, wm9090_in1_se_controls,
ARRAY_SIZE(wm9090_in1_se_controls)); ARRAY_SIZE(wm9090_in1_se_controls));
} }
if (wm9090->pdata.lin2_diff) { if (wm9090->pdata.lin2_diff) {
snd_soc_dapm_add_routes(codec, audio_map_in2_diff, snd_soc_dapm_add_routes(dapm, audio_map_in2_diff,
ARRAY_SIZE(audio_map_in2_diff)); ARRAY_SIZE(audio_map_in2_diff));
} else { } else {
snd_soc_dapm_add_routes(codec, audio_map_in2_se, snd_soc_dapm_add_routes(dapm, audio_map_in2_se,
ARRAY_SIZE(audio_map_in2_se)); ARRAY_SIZE(audio_map_in2_se));
snd_soc_add_controls(codec, wm9090_in2_se_controls, snd_soc_add_controls(codec, wm9090_in2_se_controls,
ARRAY_SIZE(wm9090_in2_se_controls)); ARRAY_SIZE(wm9090_in2_se_controls));
@ -514,7 +515,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) { if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
/* Restore the register cache */ /* Restore the register cache */
for (i = 1; i < codec->driver->reg_cache_size; i++) { for (i = 1; i < codec->driver->reg_cache_size; i++) {
if (reg_cache[i] == wm9090_reg_defaults[i]) if (reg_cache[i] == wm9090_reg_defaults[i])
@ -544,7 +545,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -203,9 +203,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm9705_add_widgets(struct snd_soc_codec *codec) static int wm9705_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm9705_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, wm9705_dapm_widgets,
ARRAY_SIZE(wm9705_dapm_widgets)); ARRAY_SIZE(wm9705_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }

View file

@ -432,10 +432,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm9712_add_widgets(struct snd_soc_codec *codec) static int wm9712_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm9712_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(wm9712_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_new_controls(dapm, wm9712_dapm_widgets,
ARRAY_SIZE(wm9712_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -570,7 +571,7 @@ static int wm9712_set_bias_level(struct snd_soc_codec *codec,
ac97_write(codec, AC97_POWERDOWN, 0xffff); ac97_write(codec, AC97_POWERDOWN, 0xffff);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -647,10 +647,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int wm9713_add_widgets(struct snd_soc_codec *codec) static int wm9713_add_widgets(struct snd_soc_codec *codec)
{ {
snd_soc_dapm_new_controls(codec, wm9713_dapm_widgets, struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, wm9713_dapm_widgets,
ARRAY_SIZE(wm9713_dapm_widgets)); ARRAY_SIZE(wm9713_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }
@ -1147,7 +1149,7 @@ static int wm9713_set_bias_level(struct snd_soc_codec *codec,
ac97_write(codec, AC97_POWERDOWN, 0xffff); ac97_write(codec, AC97_POWERDOWN, 0xffff);
break; break;
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }

View file

@ -814,6 +814,8 @@ static const struct snd_soc_dapm_route lineout2_se_routes[] = {
int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec) int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
/* Latch volume update bits & default ZC on */ /* Latch volume update bits & default ZC on */
snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_1_2_VOLUME, snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_1_2_VOLUME,
WM8993_IN1_VU, WM8993_IN1_VU); WM8993_IN1_VU, WM8993_IN1_VU);
@ -842,7 +844,7 @@ int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, analogue_snd_controls, snd_soc_add_controls(codec, analogue_snd_controls,
ARRAY_SIZE(analogue_snd_controls)); ARRAY_SIZE(analogue_snd_controls));
snd_soc_dapm_new_controls(codec, analogue_dapm_widgets, snd_soc_dapm_new_controls(dapm, analogue_dapm_widgets,
ARRAY_SIZE(analogue_dapm_widgets)); ARRAY_SIZE(analogue_dapm_widgets));
return 0; return 0;
} }
@ -851,24 +853,26 @@ EXPORT_SYMBOL_GPL(wm_hubs_add_analogue_controls);
int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec, int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec,
int lineout1_diff, int lineout2_diff) int lineout1_diff, int lineout2_diff)
{ {
snd_soc_dapm_add_routes(codec, analogue_routes, struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_add_routes(dapm, analogue_routes,
ARRAY_SIZE(analogue_routes)); ARRAY_SIZE(analogue_routes));
if (lineout1_diff) if (lineout1_diff)
snd_soc_dapm_add_routes(codec, snd_soc_dapm_add_routes(dapm,
lineout1_diff_routes, lineout1_diff_routes,
ARRAY_SIZE(lineout1_diff_routes)); ARRAY_SIZE(lineout1_diff_routes));
else else
snd_soc_dapm_add_routes(codec, snd_soc_dapm_add_routes(dapm,
lineout1_se_routes, lineout1_se_routes,
ARRAY_SIZE(lineout1_se_routes)); ARRAY_SIZE(lineout1_se_routes));
if (lineout2_diff) if (lineout2_diff)
snd_soc_dapm_add_routes(codec, snd_soc_dapm_add_routes(dapm,
lineout2_diff_routes, lineout2_diff_routes,
ARRAY_SIZE(lineout2_diff_routes)); ARRAY_SIZE(lineout2_diff_routes));
else else
snd_soc_dapm_add_routes(codec, snd_soc_dapm_add_routes(dapm,
lineout2_se_routes, lineout2_se_routes,
ARRAY_SIZE(lineout2_se_routes)); ARRAY_SIZE(lineout2_se_routes));
@ -895,7 +899,7 @@ int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *codec,
* VMID as an output and can disable it. * VMID as an output and can disable it.
*/ */
if (lineout1_diff && lineout2_diff) if (lineout1_diff && lineout2_diff)
codec->idle_bias_off = 1; codec->dapm.idle_bias_off = 1;
if (lineout1fb) if (lineout1fb)
snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL, snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL,

View file

@ -132,26 +132,27 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
/* Add davinci-evm specific widgets */ /* Add davinci-evm specific widgets */
snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
ARRAY_SIZE(aic3x_dapm_widgets)); ARRAY_SIZE(aic3x_dapm_widgets));
/* Set up davinci-evm specific audio path audio_map */ /* Set up davinci-evm specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
/* not connected */ /* not connected */
snd_soc_dapm_disable_pin(codec, "MONO_LOUT"); snd_soc_dapm_disable_pin(dapm, "MONO_LOUT");
snd_soc_dapm_disable_pin(codec, "HPLCOM"); snd_soc_dapm_disable_pin(dapm, "HPLCOM");
snd_soc_dapm_disable_pin(codec, "HPRCOM"); snd_soc_dapm_disable_pin(dapm, "HPRCOM");
/* always connected */ /* always connected */
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Line Out"); snd_soc_dapm_enable_pin(dapm, "Line Out");
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
snd_soc_dapm_enable_pin(codec, "Line In"); snd_soc_dapm_enable_pin(dapm, "Line In");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -79,11 +79,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int snappercl15_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) static int snappercl15_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
ARRAY_SIZE(tlv320aic23_dapm_widgets)); ARRAY_SIZE(tlv320aic23_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0; return 0;
} }

View file

@ -213,11 +213,12 @@ static struct snd_soc_jack_pin mic_jack_pins[] = {
static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd) static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(codec, wm1133_ev1_widgets, snd_soc_dapm_new_controls(dapm, wm1133_ev1_widgets,
ARRAY_SIZE(wm1133_ev1_widgets)); ARRAY_SIZE(wm1133_ev1_widgets));
snd_soc_dapm_add_routes(codec, wm1133_ev1_map, snd_soc_dapm_add_routes(dapm, wm1133_ev1_map,
ARRAY_SIZE(wm1133_ev1_map)); ARRAY_SIZE(wm1133_ev1_map));
/* Headphone jack detection */ /* Headphone jack detection */
@ -234,7 +235,7 @@ static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd)
wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE, wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE,
SND_JACK_BTN_0); SND_JACK_BTN_0);
snd_soc_dapm_force_enable_pin(codec, "Mic Bias"); snd_soc_dapm_force_enable_pin(dapm, "Mic Bias");
return 0; return 0;
} }

View file

@ -59,10 +59,11 @@ static int qi_lb60_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
snd_soc_dapm_nc_pin(codec, "LIN"); snd_soc_dapm_nc_pin(dapm, "LIN");
snd_soc_dapm_nc_pin(codec, "RIN"); snd_soc_dapm_nc_pin(dapm, "RIN");
ret = snd_soc_dai_set_fmt(cpu_dai, QI_LB60_DAIFMT); ret = snd_soc_dai_set_fmt(cpu_dai, QI_LB60_DAIFMT);
if (ret < 0) { if (ret < 0) {
@ -70,9 +71,11 @@ static int qi_lb60_codec_init(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
} }
snd_soc_dapm_new_controls(codec, qi_lb60_widgets, ARRAY_SIZE(qi_lb60_widgets)); snd_soc_dapm_new_controls(dapm, qi_lb60_widgets,
snd_soc_dapm_add_routes(codec, qi_lb60_routes, ARRAY_SIZE(qi_lb60_routes)); ARRAY_SIZE(qi_lb60_widgets));
snd_soc_dapm_sync(codec); snd_soc_dapm_add_routes(dapm, qi_lb60_routes,
ARRAY_SIZE(qi_lb60_routes));
snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -69,17 +69,18 @@ static const struct snd_soc_dapm_route t5325_route[] = {
static int t5325_dai_init(struct snd_soc_pcm_runtime *rtd) static int t5325_dai_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(codec, t5325_dapm_widgets, snd_soc_dapm_new_controls(dapm, t5325_dapm_widgets,
ARRAY_SIZE(t5325_dapm_widgets)); ARRAY_SIZE(t5325_dapm_widgets));
snd_soc_dapm_add_routes(codec, t5325_route, ARRAY_SIZE(t5325_route)); snd_soc_dapm_add_routes(dapm, t5325_route, ARRAY_SIZE(t5325_route));
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Speaker"); snd_soc_dapm_enable_pin(dapm, "Speaker");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -114,20 +114,21 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int am3517evm_aic23_init(struct snd_soc_pcm_runtime *rtd) static int am3517evm_aic23_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
/* Add am3517-evm specific widgets */ /* Add am3517-evm specific widgets */
snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
ARRAY_SIZE(tlv320aic23_dapm_widgets)); ARRAY_SIZE(tlv320aic23_dapm_widgets));
/* Set up davinci-evm specific audio path audio_map */ /* Set up davinci-evm specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
/* always connected */ /* always connected */
snd_soc_dapm_enable_pin(codec, "Line Out"); snd_soc_dapm_enable_pin(dapm, "Line Out");
snd_soc_dapm_enable_pin(codec, "Line In"); snd_soc_dapm_enable_pin(dapm, "Line In");
snd_soc_dapm_enable_pin(codec, "Mic In"); snd_soc_dapm_enable_pin(dapm, "Mic In");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -26,7 +26,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <sound/soc-dapm.h> #include <sound/soc.h>
#include <sound/jack.h> #include <sound/jack.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
@ -94,6 +94,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
struct snd_soc_dapm_context *dapm = &codec->dapm;
struct soc_enum *control = (struct soc_enum *)kcontrol->private_value; struct soc_enum *control = (struct soc_enum *)kcontrol->private_value;
unsigned short pins; unsigned short pins;
int pin, changed = 0; int pin, changed = 0;
@ -112,48 +113,48 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
/* Setup pins after corresponding bits if changed */ /* Setup pins after corresponding bits if changed */
pin = !!(pins & (1 << AMS_DELTA_MOUTHPIECE)); pin = !!(pins & (1 << AMS_DELTA_MOUTHPIECE));
if (pin != snd_soc_dapm_get_pin_status(codec, "Mouthpiece")) { if (pin != snd_soc_dapm_get_pin_status(dapm, "Mouthpiece")) {
changed = 1; changed = 1;
if (pin) if (pin)
snd_soc_dapm_enable_pin(codec, "Mouthpiece"); snd_soc_dapm_enable_pin(dapm, "Mouthpiece");
else else
snd_soc_dapm_disable_pin(codec, "Mouthpiece"); snd_soc_dapm_disable_pin(dapm, "Mouthpiece");
} }
pin = !!(pins & (1 << AMS_DELTA_EARPIECE)); pin = !!(pins & (1 << AMS_DELTA_EARPIECE));
if (pin != snd_soc_dapm_get_pin_status(codec, "Earpiece")) { if (pin != snd_soc_dapm_get_pin_status(dapm, "Earpiece")) {
changed = 1; changed = 1;
if (pin) if (pin)
snd_soc_dapm_enable_pin(codec, "Earpiece"); snd_soc_dapm_enable_pin(dapm, "Earpiece");
else else
snd_soc_dapm_disable_pin(codec, "Earpiece"); snd_soc_dapm_disable_pin(dapm, "Earpiece");
} }
pin = !!(pins & (1 << AMS_DELTA_MICROPHONE)); pin = !!(pins & (1 << AMS_DELTA_MICROPHONE));
if (pin != snd_soc_dapm_get_pin_status(codec, "Microphone")) { if (pin != snd_soc_dapm_get_pin_status(dapm, "Microphone")) {
changed = 1; changed = 1;
if (pin) if (pin)
snd_soc_dapm_enable_pin(codec, "Microphone"); snd_soc_dapm_enable_pin(dapm, "Microphone");
else else
snd_soc_dapm_disable_pin(codec, "Microphone"); snd_soc_dapm_disable_pin(dapm, "Microphone");
} }
pin = !!(pins & (1 << AMS_DELTA_SPEAKER)); pin = !!(pins & (1 << AMS_DELTA_SPEAKER));
if (pin != snd_soc_dapm_get_pin_status(codec, "Speaker")) { if (pin != snd_soc_dapm_get_pin_status(dapm, "Speaker")) {
changed = 1; changed = 1;
if (pin) if (pin)
snd_soc_dapm_enable_pin(codec, "Speaker"); snd_soc_dapm_enable_pin(dapm, "Speaker");
else else
snd_soc_dapm_disable_pin(codec, "Speaker"); snd_soc_dapm_disable_pin(dapm, "Speaker");
} }
pin = !!(pins & (1 << AMS_DELTA_AGC)); pin = !!(pins & (1 << AMS_DELTA_AGC));
if (pin != ams_delta_audio_agc) { if (pin != ams_delta_audio_agc) {
ams_delta_audio_agc = pin; ams_delta_audio_agc = pin;
changed = 1; changed = 1;
if (pin) if (pin)
snd_soc_dapm_enable_pin(codec, "AGCIN"); snd_soc_dapm_enable_pin(dapm, "AGCIN");
else else
snd_soc_dapm_disable_pin(codec, "AGCIN"); snd_soc_dapm_disable_pin(dapm, "AGCIN");
} }
if (changed) if (changed)
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
mutex_unlock(&codec->mutex); mutex_unlock(&codec->mutex);
@ -164,19 +165,20 @@ static int ams_delta_get_audio_mode(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
struct snd_soc_dapm_context *dapm = &codec->dapm;
unsigned short pins, mode; unsigned short pins, mode;
pins = ((snd_soc_dapm_get_pin_status(codec, "Mouthpiece") << pins = ((snd_soc_dapm_get_pin_status(dapm, "Mouthpiece") <<
AMS_DELTA_MOUTHPIECE) | AMS_DELTA_MOUTHPIECE) |
(snd_soc_dapm_get_pin_status(codec, "Earpiece") << (snd_soc_dapm_get_pin_status(dapm, "Earpiece") <<
AMS_DELTA_EARPIECE)); AMS_DELTA_EARPIECE));
if (pins) if (pins)
pins |= (snd_soc_dapm_get_pin_status(codec, "Microphone") << pins |= (snd_soc_dapm_get_pin_status(dapm, "Microphone") <<
AMS_DELTA_MICROPHONE); AMS_DELTA_MICROPHONE);
else else
pins = ((snd_soc_dapm_get_pin_status(codec, "Microphone") << pins = ((snd_soc_dapm_get_pin_status(dapm, "Microphone") <<
AMS_DELTA_MICROPHONE) | AMS_DELTA_MICROPHONE) |
(snd_soc_dapm_get_pin_status(codec, "Speaker") << (snd_soc_dapm_get_pin_status(dapm, "Speaker") <<
AMS_DELTA_SPEAKER) | AMS_DELTA_SPEAKER) |
(ams_delta_audio_agc << AMS_DELTA_AGC)); (ams_delta_audio_agc << AMS_DELTA_AGC));
@ -300,6 +302,7 @@ static int cx81801_open(struct tty_struct *tty)
static void cx81801_close(struct tty_struct *tty) static void cx81801_close(struct tty_struct *tty)
{ {
struct snd_soc_codec *codec = tty->disc_data; struct snd_soc_codec *codec = tty->disc_data;
struct snd_soc_dapm_context *dapm = &codec->dapm;
del_timer_sync(&cx81801_timer); del_timer_sync(&cx81801_timer);
@ -312,12 +315,12 @@ static void cx81801_close(struct tty_struct *tty)
v253_ops.close(tty); v253_ops.close(tty);
/* Revert back to default audio input/output constellation */ /* Revert back to default audio input/output constellation */
snd_soc_dapm_disable_pin(codec, "Mouthpiece"); snd_soc_dapm_disable_pin(dapm, "Mouthpiece");
snd_soc_dapm_enable_pin(codec, "Earpiece"); snd_soc_dapm_enable_pin(dapm, "Earpiece");
snd_soc_dapm_enable_pin(codec, "Microphone"); snd_soc_dapm_enable_pin(dapm, "Microphone");
snd_soc_dapm_disable_pin(codec, "Speaker"); snd_soc_dapm_disable_pin(dapm, "Speaker");
snd_soc_dapm_disable_pin(codec, "AGCIN"); snd_soc_dapm_disable_pin(dapm, "AGCIN");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
} }
/* Line discipline .hangup() */ /* Line discipline .hangup() */
@ -432,16 +435,16 @@ static int ams_delta_set_bias_level(struct snd_soc_card *card,
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->bias_level == SND_SOC_BIAS_OFF) if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
AMS_DELTA_LATCH2_MODEM_NRESET); AMS_DELTA_LATCH2_MODEM_NRESET);
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
if (codec->bias_level != SND_SOC_BIAS_OFF) if (codec->dapm.bias_level != SND_SOC_BIAS_OFF)
ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
0); 0);
} }
codec->bias_level = level; codec->dapm.bias_level = level;
return 0; return 0;
} }
@ -492,6 +495,7 @@ static void ams_delta_shutdown(struct snd_pcm_substream *substream)
static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
@ -541,7 +545,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
} }
/* Add board specific DAPM widgets and routes */ /* Add board specific DAPM widgets and routes */
ret = snd_soc_dapm_new_controls(codec, ams_delta_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, ams_delta_dapm_widgets,
ARRAY_SIZE(ams_delta_dapm_widgets)); ARRAY_SIZE(ams_delta_dapm_widgets));
if (ret) { if (ret) {
dev_warn(card->dev, dev_warn(card->dev,
@ -550,7 +554,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
return 0; return 0;
} }
ret = snd_soc_dapm_add_routes(codec, ams_delta_audio_map, ret = snd_soc_dapm_add_routes(dapm, ams_delta_audio_map,
ARRAY_SIZE(ams_delta_audio_map)); ARRAY_SIZE(ams_delta_audio_map));
if (ret) { if (ret) {
dev_warn(card->dev, dev_warn(card->dev,
@ -560,13 +564,13 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
} }
/* Set up initial pin constellation */ /* Set up initial pin constellation */
snd_soc_dapm_disable_pin(codec, "Mouthpiece"); snd_soc_dapm_disable_pin(dapm, "Mouthpiece");
snd_soc_dapm_enable_pin(codec, "Earpiece"); snd_soc_dapm_enable_pin(dapm, "Earpiece");
snd_soc_dapm_enable_pin(codec, "Microphone"); snd_soc_dapm_enable_pin(dapm, "Microphone");
snd_soc_dapm_disable_pin(codec, "Speaker"); snd_soc_dapm_disable_pin(dapm, "Speaker");
snd_soc_dapm_disable_pin(codec, "AGCIN"); snd_soc_dapm_disable_pin(dapm, "AGCIN");
snd_soc_dapm_disable_pin(codec, "AGCOUT"); snd_soc_dapm_disable_pin(dapm, "AGCOUT");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
/* Add virtual switch */ /* Add virtual switch */
ret = snd_soc_add_controls(codec, ams_delta_audio_controls, ret = snd_soc_add_controls(codec, ams_delta_audio_controls,

View file

@ -58,6 +58,7 @@ static int n810_dmic_func;
static void n810_ext_control(struct snd_soc_codec *codec) static void n810_ext_control(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
int hp = 0, line1l = 0; int hp = 0, line1l = 0;
switch (n810_jack_func) { switch (n810_jack_func) {
@ -72,25 +73,25 @@ static void n810_ext_control(struct snd_soc_codec *codec)
} }
if (n810_spk_func) if (n810_spk_func)
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
else else
snd_soc_dapm_disable_pin(codec, "Ext Spk"); snd_soc_dapm_disable_pin(dapm, "Ext Spk");
if (hp) if (hp)
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
else else
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
if (line1l) if (line1l)
snd_soc_dapm_enable_pin(codec, "LINE1L"); snd_soc_dapm_enable_pin(dapm, "LINE1L");
else else
snd_soc_dapm_disable_pin(codec, "LINE1L"); snd_soc_dapm_disable_pin(dapm, "LINE1L");
if (n810_dmic_func) if (n810_dmic_func)
snd_soc_dapm_enable_pin(codec, "DMic"); snd_soc_dapm_enable_pin(dapm, "DMic");
else else
snd_soc_dapm_disable_pin(codec, "DMic"); snd_soc_dapm_disable_pin(dapm, "DMic");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
} }
static int n810_startup(struct snd_pcm_substream *substream) static int n810_startup(struct snd_pcm_substream *substream)
@ -274,17 +275,18 @@ static const struct snd_kcontrol_new aic33_n810_controls[] = {
static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd) static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
/* Not connected */ /* Not connected */
snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); snd_soc_dapm_nc_pin(dapm, "MONO_LOUT");
snd_soc_dapm_nc_pin(codec, "HPLCOM"); snd_soc_dapm_nc_pin(dapm, "HPLCOM");
snd_soc_dapm_nc_pin(codec, "HPRCOM"); snd_soc_dapm_nc_pin(dapm, "HPRCOM");
snd_soc_dapm_nc_pin(codec, "MIC3L"); snd_soc_dapm_nc_pin(dapm, "MIC3L");
snd_soc_dapm_nc_pin(codec, "MIC3R"); snd_soc_dapm_nc_pin(dapm, "MIC3R");
snd_soc_dapm_nc_pin(codec, "LINE1R"); snd_soc_dapm_nc_pin(dapm, "LINE1R");
snd_soc_dapm_nc_pin(codec, "LINE2L"); snd_soc_dapm_nc_pin(dapm, "LINE2L");
snd_soc_dapm_nc_pin(codec, "LINE2R"); snd_soc_dapm_nc_pin(dapm, "LINE2R");
/* Add N810 specific controls */ /* Add N810 specific controls */
err = snd_soc_add_controls(codec, aic33_n810_controls, err = snd_soc_add_controls(codec, aic33_n810_controls,
@ -293,13 +295,13 @@ static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
/* Add N810 specific widgets */ /* Add N810 specific widgets */
snd_soc_dapm_new_controls(codec, aic33_dapm_widgets, snd_soc_dapm_new_controls(dapm, aic33_dapm_widgets,
ARRAY_SIZE(aic33_dapm_widgets)); ARRAY_SIZE(aic33_dapm_widgets));
/* Set up N810 specific audio path audio_map */ /* Set up N810 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -170,51 +170,53 @@ static const struct snd_soc_dapm_route omap3pandora_in_map[] = {
static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
/* All TWL4030 output pins are floating */ /* All TWL4030 output pins are floating */
snd_soc_dapm_nc_pin(codec, "EARPIECE"); snd_soc_dapm_nc_pin(dapm, "EARPIECE");
snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); snd_soc_dapm_nc_pin(dapm, "PREDRIVEL");
snd_soc_dapm_nc_pin(codec, "PREDRIVER"); snd_soc_dapm_nc_pin(dapm, "PREDRIVER");
snd_soc_dapm_nc_pin(codec, "HSOL"); snd_soc_dapm_nc_pin(dapm, "HSOL");
snd_soc_dapm_nc_pin(codec, "HSOR"); snd_soc_dapm_nc_pin(dapm, "HSOR");
snd_soc_dapm_nc_pin(codec, "CARKITL"); snd_soc_dapm_nc_pin(dapm, "CARKITL");
snd_soc_dapm_nc_pin(codec, "CARKITR"); snd_soc_dapm_nc_pin(dapm, "CARKITR");
snd_soc_dapm_nc_pin(codec, "HFL"); snd_soc_dapm_nc_pin(dapm, "HFL");
snd_soc_dapm_nc_pin(codec, "HFR"); snd_soc_dapm_nc_pin(dapm, "HFR");
snd_soc_dapm_nc_pin(codec, "VIBRA"); snd_soc_dapm_nc_pin(dapm, "VIBRA");
ret = snd_soc_dapm_new_controls(codec, omap3pandora_out_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets,
ARRAY_SIZE(omap3pandora_out_dapm_widgets)); ARRAY_SIZE(omap3pandora_out_dapm_widgets));
if (ret < 0) if (ret < 0)
return ret; return ret;
snd_soc_dapm_add_routes(codec, omap3pandora_out_map, snd_soc_dapm_add_routes(dapm, omap3pandora_out_map,
ARRAY_SIZE(omap3pandora_out_map)); ARRAY_SIZE(omap3pandora_out_map));
return snd_soc_dapm_sync(codec); return snd_soc_dapm_sync(dapm);
} }
static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
/* Not comnnected */ /* Not comnnected */
snd_soc_dapm_nc_pin(codec, "HSMIC"); snd_soc_dapm_nc_pin(dapm, "HSMIC");
snd_soc_dapm_nc_pin(codec, "CARKITMIC"); snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");
ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets,
ARRAY_SIZE(omap3pandora_in_dapm_widgets)); ARRAY_SIZE(omap3pandora_in_dapm_widgets));
if (ret < 0) if (ret < 0)
return ret; return ret;
snd_soc_dapm_add_routes(codec, omap3pandora_in_map, snd_soc_dapm_add_routes(dapm, omap3pandora_in_map,
ARRAY_SIZE(omap3pandora_in_map)); ARRAY_SIZE(omap3pandora_in_map));
return snd_soc_dapm_sync(codec); return snd_soc_dapm_sync(dapm);
} }
static struct snd_soc_ops omap3pandora_ops = { static struct snd_soc_ops omap3pandora_ops = {

View file

@ -116,19 +116,20 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int osk_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) static int osk_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
/* Add osk5912 specific widgets */ /* Add osk5912 specific widgets */
snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
ARRAY_SIZE(tlv320aic23_dapm_widgets)); ARRAY_SIZE(tlv320aic23_dapm_widgets));
/* Set up osk5912 specific audio path audio_map */ /* Set up osk5912 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Line In"); snd_soc_dapm_enable_pin(dapm, "Line In");
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -58,19 +58,21 @@ static int rx51_jack_func;
static void rx51_ext_control(struct snd_soc_codec *codec) static void rx51_ext_control(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
if (rx51_spk_func) if (rx51_spk_func)
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
else else
snd_soc_dapm_disable_pin(codec, "Ext Spk"); snd_soc_dapm_disable_pin(dapm, "Ext Spk");
if (rx51_dmic_func) if (rx51_dmic_func)
snd_soc_dapm_enable_pin(codec, "DMic"); snd_soc_dapm_enable_pin(dapm, "DMic");
else else
snd_soc_dapm_disable_pin(codec, "DMic"); snd_soc_dapm_disable_pin(dapm, "DMic");
gpio_set_value(RX51_TVOUT_SEL_GPIO, gpio_set_value(RX51_TVOUT_SEL_GPIO,
rx51_jack_func == RX51_JACK_TVOUT); rx51_jack_func == RX51_JACK_TVOUT);
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
} }
static int rx51_startup(struct snd_pcm_substream *substream) static int rx51_startup(struct snd_pcm_substream *substream)
@ -244,12 +246,13 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = {
static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
/* Set up NC codec pins */ /* Set up NC codec pins */
snd_soc_dapm_nc_pin(codec, "MIC3L"); snd_soc_dapm_nc_pin(dapm, "MIC3L");
snd_soc_dapm_nc_pin(codec, "MIC3R"); snd_soc_dapm_nc_pin(dapm, "MIC3R");
snd_soc_dapm_nc_pin(codec, "LINE1R"); snd_soc_dapm_nc_pin(dapm, "LINE1R");
/* Add RX-51 specific controls */ /* Add RX-51 specific controls */
err = snd_soc_add_controls(codec, aic34_rx51_controls, err = snd_soc_add_controls(codec, aic34_rx51_controls,
@ -258,13 +261,13 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
/* Add RX-51 specific widgets */ /* Add RX-51 specific widgets */
snd_soc_dapm_new_controls(codec, aic34_dapm_widgets, snd_soc_dapm_new_controls(dapm, aic34_dapm_widgets,
ARRAY_SIZE(aic34_dapm_widgets)); ARRAY_SIZE(aic34_dapm_widgets));
/* Set up RX-51 specific audio path audio_map */ /* Set up RX-51 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
/* AV jack detection */ /* AV jack detection */
err = snd_soc_jack_new(codec, "AV Jack", err = snd_soc_jack_new(codec, "AV Jack",

View file

@ -191,39 +191,40 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd) static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
/* Add SDP3430 specific widgets */ /* Add SDP3430 specific widgets */
ret = snd_soc_dapm_new_controls(codec, sdp3430_twl4030_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, sdp3430_twl4030_dapm_widgets,
ARRAY_SIZE(sdp3430_twl4030_dapm_widgets)); ARRAY_SIZE(sdp3430_twl4030_dapm_widgets));
if (ret) if (ret)
return ret; return ret;
/* Set up SDP3430 specific audio path audio_map */ /* Set up SDP3430 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
/* SDP3430 connected pins */ /* SDP3430 connected pins */
snd_soc_dapm_enable_pin(codec, "Ext Mic"); snd_soc_dapm_enable_pin(dapm, "Ext Mic");
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Headset Stereophone"); snd_soc_dapm_disable_pin(dapm, "Headset Stereophone");
/* TWL4030 not connected pins */ /* TWL4030 not connected pins */
snd_soc_dapm_nc_pin(codec, "AUXL"); snd_soc_dapm_nc_pin(dapm, "AUXL");
snd_soc_dapm_nc_pin(codec, "AUXR"); snd_soc_dapm_nc_pin(dapm, "AUXR");
snd_soc_dapm_nc_pin(codec, "CARKITMIC"); snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");
snd_soc_dapm_nc_pin(codec, "OUTL"); snd_soc_dapm_nc_pin(dapm, "OUTL");
snd_soc_dapm_nc_pin(codec, "OUTR"); snd_soc_dapm_nc_pin(dapm, "OUTR");
snd_soc_dapm_nc_pin(codec, "EARPIECE"); snd_soc_dapm_nc_pin(dapm, "EARPIECE");
snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); snd_soc_dapm_nc_pin(dapm, "PREDRIVEL");
snd_soc_dapm_nc_pin(codec, "PREDRIVER"); snd_soc_dapm_nc_pin(dapm, "PREDRIVER");
snd_soc_dapm_nc_pin(codec, "CARKITL"); snd_soc_dapm_nc_pin(dapm, "CARKITL");
snd_soc_dapm_nc_pin(codec, "CARKITR"); snd_soc_dapm_nc_pin(dapm, "CARKITR");
ret = snd_soc_dapm_sync(codec); ret = snd_soc_dapm_sync(dapm);
if (ret) if (ret)
return ret; return ret;

View file

@ -129,6 +129,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
/* Add SDP4430 specific controls */ /* Add SDP4430 specific controls */
@ -138,25 +139,25 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
/* Add SDP4430 specific widgets */ /* Add SDP4430 specific widgets */
ret = snd_soc_dapm_new_controls(codec, sdp4430_twl6040_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets,
ARRAY_SIZE(sdp4430_twl6040_dapm_widgets)); ARRAY_SIZE(sdp4430_twl6040_dapm_widgets));
if (ret) if (ret)
return ret; return ret;
/* Set up SDP4430 specific audio path audio_map */ /* Set up SDP4430 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
/* SDP4430 connected pins */ /* SDP4430 connected pins */
snd_soc_dapm_enable_pin(codec, "Ext Mic"); snd_soc_dapm_enable_pin(dapm, "Ext Mic");
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
snd_soc_dapm_enable_pin(codec, "Headset Mic"); snd_soc_dapm_enable_pin(dapm, "Headset Mic");
snd_soc_dapm_enable_pin(codec, "Headset Stereophone"); snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
/* TWL6040 not connected pins */ /* TWL6040 not connected pins */
snd_soc_dapm_nc_pin(codec, "AFML"); snd_soc_dapm_nc_pin(dapm, "AFML");
snd_soc_dapm_nc_pin(codec, "AFMR"); snd_soc_dapm_nc_pin(dapm, "AFMR");
ret = snd_soc_dapm_sync(codec); ret = snd_soc_dapm_sync(dapm);
return ret; return ret;
} }

View file

@ -162,35 +162,36 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd) static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
/* Add Zoom2 specific widgets */ /* Add Zoom2 specific widgets */
ret = snd_soc_dapm_new_controls(codec, zoom2_twl4030_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, zoom2_twl4030_dapm_widgets,
ARRAY_SIZE(zoom2_twl4030_dapm_widgets)); ARRAY_SIZE(zoom2_twl4030_dapm_widgets));
if (ret) if (ret)
return ret; return ret;
/* Set up Zoom2 specific audio path audio_map */ /* Set up Zoom2 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
/* Zoom2 connected pins */ /* Zoom2 connected pins */
snd_soc_dapm_enable_pin(codec, "Ext Mic"); snd_soc_dapm_enable_pin(dapm, "Ext Mic");
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
snd_soc_dapm_enable_pin(codec, "Headset Mic"); snd_soc_dapm_enable_pin(dapm, "Headset Mic");
snd_soc_dapm_enable_pin(codec, "Headset Stereophone"); snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
snd_soc_dapm_enable_pin(codec, "Aux In"); snd_soc_dapm_enable_pin(dapm, "Aux In");
/* TWL4030 not connected pins */ /* TWL4030 not connected pins */
snd_soc_dapm_nc_pin(codec, "CARKITMIC"); snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");
snd_soc_dapm_nc_pin(codec, "EARPIECE"); snd_soc_dapm_nc_pin(dapm, "EARPIECE");
snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); snd_soc_dapm_nc_pin(dapm, "PREDRIVEL");
snd_soc_dapm_nc_pin(codec, "PREDRIVER"); snd_soc_dapm_nc_pin(dapm, "PREDRIVER");
snd_soc_dapm_nc_pin(codec, "CARKITL"); snd_soc_dapm_nc_pin(dapm, "CARKITL");
snd_soc_dapm_nc_pin(codec, "CARKITR"); snd_soc_dapm_nc_pin(dapm, "CARKITR");
ret = snd_soc_dapm_sync(codec); ret = snd_soc_dapm_sync(dapm);
return ret; return ret;
} }

View file

@ -48,51 +48,53 @@ static int corgi_spk_func;
static void corgi_ext_control(struct snd_soc_codec *codec) static void corgi_ext_control(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
/* set up jack connection */ /* set up jack connection */
switch (corgi_jack_func) { switch (corgi_jack_func) {
case CORGI_HP: case CORGI_HP:
/* set = unmute headphone */ /* set = unmute headphone */
gpio_set_value(CORGI_GPIO_MUTE_L, 1); gpio_set_value(CORGI_GPIO_MUTE_L, 1);
gpio_set_value(CORGI_GPIO_MUTE_R, 1); gpio_set_value(CORGI_GPIO_MUTE_R, 1);
snd_soc_dapm_disable_pin(codec, "Mic Jack"); snd_soc_dapm_disable_pin(dapm, "Mic Jack");
snd_soc_dapm_disable_pin(codec, "Line Jack"); snd_soc_dapm_disable_pin(dapm, "Line Jack");
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(dapm, "Headset Jack");
break; break;
case CORGI_MIC: case CORGI_MIC:
/* reset = mute headphone */ /* reset = mute headphone */
gpio_set_value(CORGI_GPIO_MUTE_L, 0); gpio_set_value(CORGI_GPIO_MUTE_L, 0);
gpio_set_value(CORGI_GPIO_MUTE_R, 0); gpio_set_value(CORGI_GPIO_MUTE_R, 0);
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
snd_soc_dapm_disable_pin(codec, "Line Jack"); snd_soc_dapm_disable_pin(dapm, "Line Jack");
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(dapm, "Headset Jack");
break; break;
case CORGI_LINE: case CORGI_LINE:
gpio_set_value(CORGI_GPIO_MUTE_L, 0); gpio_set_value(CORGI_GPIO_MUTE_L, 0);
gpio_set_value(CORGI_GPIO_MUTE_R, 0); gpio_set_value(CORGI_GPIO_MUTE_R, 0);
snd_soc_dapm_disable_pin(codec, "Mic Jack"); snd_soc_dapm_disable_pin(dapm, "Mic Jack");
snd_soc_dapm_enable_pin(codec, "Line Jack"); snd_soc_dapm_enable_pin(dapm, "Line Jack");
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(dapm, "Headset Jack");
break; break;
case CORGI_HEADSET: case CORGI_HEADSET:
gpio_set_value(CORGI_GPIO_MUTE_L, 0); gpio_set_value(CORGI_GPIO_MUTE_L, 0);
gpio_set_value(CORGI_GPIO_MUTE_R, 1); gpio_set_value(CORGI_GPIO_MUTE_R, 1);
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
snd_soc_dapm_disable_pin(codec, "Line Jack"); snd_soc_dapm_disable_pin(dapm, "Line Jack");
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Headset Jack"); snd_soc_dapm_enable_pin(dapm, "Headset Jack");
break; break;
} }
if (corgi_spk_func == CORGI_SPK_ON) if (corgi_spk_func == CORGI_SPK_ON)
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
else else
snd_soc_dapm_disable_pin(codec, "Ext Spk"); snd_soc_dapm_disable_pin(dapm, "Ext Spk");
/* signal a DAPM event */ /* signal a DAPM event */
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
} }
static int corgi_startup(struct snd_pcm_substream *substream) static int corgi_startup(struct snd_pcm_substream *substream)
@ -274,10 +276,11 @@ static const struct snd_kcontrol_new wm8731_corgi_controls[] = {
static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd) static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
snd_soc_dapm_nc_pin(codec, "LLINEIN"); snd_soc_dapm_nc_pin(dapm, "LLINEIN");
snd_soc_dapm_nc_pin(codec, "RLINEIN"); snd_soc_dapm_nc_pin(dapm, "RLINEIN");
/* Add corgi specific controls */ /* Add corgi specific controls */
err = snd_soc_add_controls(codec, wm8731_corgi_controls, err = snd_soc_add_controls(codec, wm8731_corgi_controls,
@ -286,13 +289,13 @@ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
/* Add corgi specific widgets */ /* Add corgi specific widgets */
snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
ARRAY_SIZE(wm8731_dapm_widgets)); ARRAY_SIZE(wm8731_dapm_widgets));
/* Set up corgi specific audio path audio_map */ /* Set up corgi specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -92,23 +92,24 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int e740_ac97_init(struct snd_soc_pcm_runtime *rtd) static int e740_ac97_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_nc_pin(codec, "HPOUTL"); snd_soc_dapm_nc_pin(dapm, "HPOUTL");
snd_soc_dapm_nc_pin(codec, "HPOUTR"); snd_soc_dapm_nc_pin(dapm, "HPOUTR");
snd_soc_dapm_nc_pin(codec, "PHONE"); snd_soc_dapm_nc_pin(dapm, "PHONE");
snd_soc_dapm_nc_pin(codec, "LINEINL"); snd_soc_dapm_nc_pin(dapm, "LINEINL");
snd_soc_dapm_nc_pin(codec, "LINEINR"); snd_soc_dapm_nc_pin(dapm, "LINEINR");
snd_soc_dapm_nc_pin(codec, "CDINL"); snd_soc_dapm_nc_pin(dapm, "CDINL");
snd_soc_dapm_nc_pin(codec, "CDINR"); snd_soc_dapm_nc_pin(dapm, "CDINR");
snd_soc_dapm_nc_pin(codec, "PCBEEP"); snd_soc_dapm_nc_pin(dapm, "PCBEEP");
snd_soc_dapm_nc_pin(codec, "MIC2"); snd_soc_dapm_nc_pin(dapm, "MIC2");
snd_soc_dapm_new_controls(codec, e740_dapm_widgets, snd_soc_dapm_new_controls(dapm, e740_dapm_widgets,
ARRAY_SIZE(e740_dapm_widgets)); ARRAY_SIZE(e740_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -74,23 +74,24 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int e750_ac97_init(struct snd_soc_pcm_runtime *rtd) static int e750_ac97_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_nc_pin(codec, "LOUT"); snd_soc_dapm_nc_pin(dapm, "LOUT");
snd_soc_dapm_nc_pin(codec, "ROUT"); snd_soc_dapm_nc_pin(dapm, "ROUT");
snd_soc_dapm_nc_pin(codec, "PHONE"); snd_soc_dapm_nc_pin(dapm, "PHONE");
snd_soc_dapm_nc_pin(codec, "LINEINL"); snd_soc_dapm_nc_pin(dapm, "LINEINL");
snd_soc_dapm_nc_pin(codec, "LINEINR"); snd_soc_dapm_nc_pin(dapm, "LINEINR");
snd_soc_dapm_nc_pin(codec, "CDINL"); snd_soc_dapm_nc_pin(dapm, "CDINL");
snd_soc_dapm_nc_pin(codec, "CDINR"); snd_soc_dapm_nc_pin(dapm, "CDINR");
snd_soc_dapm_nc_pin(codec, "PCBEEP"); snd_soc_dapm_nc_pin(dapm, "PCBEEP");
snd_soc_dapm_nc_pin(codec, "MIC2"); snd_soc_dapm_nc_pin(dapm, "MIC2");
snd_soc_dapm_new_controls(codec, e750_dapm_widgets, snd_soc_dapm_new_controls(dapm, e750_dapm_widgets,
ARRAY_SIZE(e750_dapm_widgets)); ARRAY_SIZE(e750_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -75,12 +75,13 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int e800_ac97_init(struct snd_soc_pcm_runtime *rtd) static int e800_ac97_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(codec, e800_dapm_widgets, snd_soc_dapm_new_controls(dapm, e800_dapm_widgets,
ARRAY_SIZE(e800_dapm_widgets)); ARRAY_SIZE(e800_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -44,27 +44,29 @@ static int magician_in_sel = MAGICIAN_MIC;
static void magician_ext_control(struct snd_soc_codec *codec) static void magician_ext_control(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
if (magician_spk_switch) if (magician_spk_switch)
snd_soc_dapm_enable_pin(codec, "Speaker"); snd_soc_dapm_enable_pin(dapm, "Speaker");
else else
snd_soc_dapm_disable_pin(codec, "Speaker"); snd_soc_dapm_disable_pin(dapm, "Speaker");
if (magician_hp_switch) if (magician_hp_switch)
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
else else
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
switch (magician_in_sel) { switch (magician_in_sel) {
case MAGICIAN_MIC: case MAGICIAN_MIC:
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_enable_pin(codec, "Call Mic"); snd_soc_dapm_enable_pin(dapm, "Call Mic");
break; break;
case MAGICIAN_MIC_EXT: case MAGICIAN_MIC_EXT:
snd_soc_dapm_disable_pin(codec, "Call Mic"); snd_soc_dapm_disable_pin(dapm, "Call Mic");
snd_soc_dapm_enable_pin(codec, "Headset Mic"); snd_soc_dapm_enable_pin(dapm, "Headset Mic");
break; break;
} }
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
} }
static int magician_startup(struct snd_pcm_substream *substream) static int magician_startup(struct snd_pcm_substream *substream)
@ -395,15 +397,16 @@ static const struct snd_kcontrol_new uda1380_magician_controls[] = {
static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd) static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
/* NC codec pins */ /* NC codec pins */
snd_soc_dapm_nc_pin(codec, "VOUTLHP"); snd_soc_dapm_nc_pin(dapm, "VOUTLHP");
snd_soc_dapm_nc_pin(codec, "VOUTRHP"); snd_soc_dapm_nc_pin(dapm, "VOUTRHP");
/* FIXME: is anything connected here? */ /* FIXME: is anything connected here? */
snd_soc_dapm_nc_pin(codec, "VINL"); snd_soc_dapm_nc_pin(dapm, "VINL");
snd_soc_dapm_nc_pin(codec, "VINR"); snd_soc_dapm_nc_pin(dapm, "VINR");
/* Add magician specific controls */ /* Add magician specific controls */
err = snd_soc_add_controls(codec, uda1380_magician_controls, err = snd_soc_add_controls(codec, uda1380_magician_controls,
@ -412,13 +415,13 @@ static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
/* Add magician specific widgets */ /* Add magician specific widgets */
snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets, snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
ARRAY_SIZE(uda1380_dapm_widgets)); ARRAY_SIZE(uda1380_dapm_widgets));
/* Set up magician specific audio path interconnects */ /* Set up magician specific audio path interconnects */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -130,13 +130,14 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd) static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
unsigned short reg; unsigned short reg;
/* Add mioa701 specific widgets */ /* Add mioa701 specific widgets */
snd_soc_dapm_new_controls(codec, ARRAY_AND_SIZE(mioa701_dapm_widgets)); snd_soc_dapm_new_controls(dapm, ARRAY_AND_SIZE(mioa701_dapm_widgets));
/* Set up mioa701 specific audio path audio_mapnects */ /* Set up mioa701 specific audio path audio_mapnects */
snd_soc_dapm_add_routes(codec, ARRAY_AND_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, ARRAY_AND_SIZE(audio_map));
/* Prepare GPIO8 for rear speaker amplifier */ /* Prepare GPIO8 for rear speaker amplifier */
reg = codec->driver->read(codec, AC97_GPIO_CFG); reg = codec->driver->read(codec, AC97_GPIO_CFG);
@ -146,12 +147,12 @@ static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
reg = codec->driver->read(codec, AC97_3D_CONTROL); reg = codec->driver->read(codec, AC97_3D_CONTROL);
codec->driver->write(codec, AC97_3D_CONTROL, reg | 0xc000); codec->driver->write(codec, AC97_3D_CONTROL, reg | 0xc000);
snd_soc_dapm_enable_pin(codec, "Front Speaker"); snd_soc_dapm_enable_pin(dapm, "Front Speaker");
snd_soc_dapm_enable_pin(codec, "Rear Speaker"); snd_soc_dapm_enable_pin(dapm, "Rear Speaker");
snd_soc_dapm_enable_pin(codec, "Front Mic"); snd_soc_dapm_enable_pin(dapm, "Front Mic");
snd_soc_dapm_enable_pin(codec, "GSM Line In"); snd_soc_dapm_enable_pin(dapm, "GSM Line In");
snd_soc_dapm_enable_pin(codec, "GSM Line Out"); snd_soc_dapm_enable_pin(dapm, "GSM Line Out");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -77,37 +77,38 @@ static struct snd_soc_card palm27x_asoc;
static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd) static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
/* add palm27x specific widgets */ /* add palm27x specific widgets */
err = snd_soc_dapm_new_controls(codec, palm27x_dapm_widgets, err = snd_soc_dapm_new_controls(dapm, palm27x_dapm_widgets,
ARRAY_SIZE(palm27x_dapm_widgets)); ARRAY_SIZE(palm27x_dapm_widgets));
if (err) if (err)
return err; return err;
/* set up palm27x specific audio path audio_map */ /* set up palm27x specific audio path audio_map */
err = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); err = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
if (err) if (err)
return err; return err;
/* connected pins */ /* connected pins */
if (machine_is_palmld()) if (machine_is_palmld())
snd_soc_dapm_enable_pin(codec, "MIC1"); snd_soc_dapm_enable_pin(dapm, "MIC1");
snd_soc_dapm_enable_pin(codec, "HPOUTL"); snd_soc_dapm_enable_pin(dapm, "HPOUTL");
snd_soc_dapm_enable_pin(codec, "HPOUTR"); snd_soc_dapm_enable_pin(dapm, "HPOUTR");
snd_soc_dapm_enable_pin(codec, "LOUT2"); snd_soc_dapm_enable_pin(dapm, "LOUT2");
snd_soc_dapm_enable_pin(codec, "ROUT2"); snd_soc_dapm_enable_pin(dapm, "ROUT2");
/* not connected pins */ /* not connected pins */
snd_soc_dapm_nc_pin(codec, "OUT3"); snd_soc_dapm_nc_pin(dapm, "OUT3");
snd_soc_dapm_nc_pin(codec, "MONOOUT"); snd_soc_dapm_nc_pin(dapm, "MONOOUT");
snd_soc_dapm_nc_pin(codec, "LINEINL"); snd_soc_dapm_nc_pin(dapm, "LINEINL");
snd_soc_dapm_nc_pin(codec, "LINEINR"); snd_soc_dapm_nc_pin(dapm, "LINEINR");
snd_soc_dapm_nc_pin(codec, "PCBEEP"); snd_soc_dapm_nc_pin(dapm, "PCBEEP");
snd_soc_dapm_nc_pin(codec, "PHONE"); snd_soc_dapm_nc_pin(dapm, "PHONE");
snd_soc_dapm_nc_pin(codec, "MIC2"); snd_soc_dapm_nc_pin(dapm, "MIC2");
err = snd_soc_dapm_sync(codec); err = snd_soc_dapm_sync(dapm);
if (err) if (err)
return err; return err;

View file

@ -46,6 +46,8 @@ static int poodle_spk_func;
static void poodle_ext_control(struct snd_soc_codec *codec) static void poodle_ext_control(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
/* set up jack connection */ /* set up jack connection */
if (poodle_jack_func == POODLE_HP) { if (poodle_jack_func == POODLE_HP) {
/* set = unmute headphone */ /* set = unmute headphone */
@ -53,23 +55,23 @@ static void poodle_ext_control(struct snd_soc_codec *codec)
POODLE_LOCOMO_GPIO_MUTE_L, 1); POODLE_LOCOMO_GPIO_MUTE_L, 1);
locomo_gpio_write(&poodle_locomo_device.dev, locomo_gpio_write(&poodle_locomo_device.dev,
POODLE_LOCOMO_GPIO_MUTE_R, 1); POODLE_LOCOMO_GPIO_MUTE_R, 1);
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
} else { } else {
locomo_gpio_write(&poodle_locomo_device.dev, locomo_gpio_write(&poodle_locomo_device.dev,
POODLE_LOCOMO_GPIO_MUTE_L, 0); POODLE_LOCOMO_GPIO_MUTE_L, 0);
locomo_gpio_write(&poodle_locomo_device.dev, locomo_gpio_write(&poodle_locomo_device.dev,
POODLE_LOCOMO_GPIO_MUTE_R, 0); POODLE_LOCOMO_GPIO_MUTE_R, 0);
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
} }
/* set the enpoints to their new connetion states */ /* set the enpoints to their new connetion states */
if (poodle_spk_func == POODLE_SPK_ON) if (poodle_spk_func == POODLE_SPK_ON)
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
else else
snd_soc_dapm_disable_pin(codec, "Ext Spk"); snd_soc_dapm_disable_pin(dapm, "Ext Spk");
/* signal a DAPM event */ /* signal a DAPM event */
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
} }
static int poodle_startup(struct snd_pcm_substream *substream) static int poodle_startup(struct snd_pcm_substream *substream)
@ -239,11 +241,12 @@ static const struct snd_kcontrol_new wm8731_poodle_controls[] = {
static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd) static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
snd_soc_dapm_nc_pin(codec, "LLINEIN"); snd_soc_dapm_nc_pin(dapm, "LLINEIN");
snd_soc_dapm_nc_pin(codec, "RLINEIN"); snd_soc_dapm_nc_pin(dapm, "RLINEIN");
snd_soc_dapm_enable_pin(codec, "MICIN"); snd_soc_dapm_enable_pin(dapm, "MICIN");
/* Add poodle specific controls */ /* Add poodle specific controls */
err = snd_soc_add_controls(codec, wm8731_poodle_controls, err = snd_soc_add_controls(codec, wm8731_poodle_controls,
@ -252,13 +255,13 @@ static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
/* Add poodle specific widgets */ /* Add poodle specific widgets */
snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
ARRAY_SIZE(wm8731_dapm_widgets)); ARRAY_SIZE(wm8731_dapm_widgets));
/* Set up poodle specific audio path audio_map */ /* Set up poodle specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -133,20 +133,21 @@ static struct snd_soc_card snd_soc_card_saarb = {
static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd) static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
snd_soc_dapm_new_controls(codec, saarb_dapm_widgets, snd_soc_dapm_new_controls(dapm, saarb_dapm_widgets,
ARRAY_SIZE(saarb_dapm_widgets)); ARRAY_SIZE(saarb_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
/* connected pins */ /* connected pins */
snd_soc_dapm_enable_pin(codec, "Ext Speaker"); snd_soc_dapm_enable_pin(dapm, "Ext Speaker");
snd_soc_dapm_enable_pin(codec, "Ext Mic 1"); snd_soc_dapm_enable_pin(dapm, "Ext Mic 1");
snd_soc_dapm_enable_pin(codec, "Ext Mic 3"); snd_soc_dapm_enable_pin(dapm, "Ext Mic 3");
snd_soc_dapm_disable_pin(codec, "Headset Mic 2"); snd_soc_dapm_disable_pin(dapm, "Headset Mic 2");
snd_soc_dapm_disable_pin(codec, "Headset Stereophone"); snd_soc_dapm_disable_pin(dapm, "Headset Stereophone");
ret = snd_soc_dapm_sync(codec); ret = snd_soc_dapm_sync(dapm);
if (ret) if (ret)
return ret; return ret;

View file

@ -46,61 +46,63 @@ static int spitz_spk_func;
static void spitz_ext_control(struct snd_soc_codec *codec) static void spitz_ext_control(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
if (spitz_spk_func == SPITZ_SPK_ON) if (spitz_spk_func == SPITZ_SPK_ON)
snd_soc_dapm_enable_pin(codec, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "Ext Spk");
else else
snd_soc_dapm_disable_pin(codec, "Ext Spk"); snd_soc_dapm_disable_pin(dapm, "Ext Spk");
/* set up jack connection */ /* set up jack connection */
switch (spitz_jack_func) { switch (spitz_jack_func) {
case SPITZ_HP: case SPITZ_HP:
/* enable and unmute hp jack, disable mic bias */ /* enable and unmute hp jack, disable mic bias */
snd_soc_dapm_disable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(dapm, "Headset Jack");
snd_soc_dapm_disable_pin(codec, "Mic Jack"); snd_soc_dapm_disable_pin(dapm, "Mic Jack");
snd_soc_dapm_disable_pin(codec, "Line Jack"); snd_soc_dapm_disable_pin(dapm, "Line Jack");
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
gpio_set_value(SPITZ_GPIO_MUTE_L, 1); gpio_set_value(SPITZ_GPIO_MUTE_L, 1);
gpio_set_value(SPITZ_GPIO_MUTE_R, 1); gpio_set_value(SPITZ_GPIO_MUTE_R, 1);
break; break;
case SPITZ_MIC: case SPITZ_MIC:
/* enable mic jack and bias, mute hp */ /* enable mic jack and bias, mute hp */
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(dapm, "Headset Jack");
snd_soc_dapm_disable_pin(codec, "Line Jack"); snd_soc_dapm_disable_pin(dapm, "Line Jack");
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
gpio_set_value(SPITZ_GPIO_MUTE_L, 0); gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
gpio_set_value(SPITZ_GPIO_MUTE_R, 0); gpio_set_value(SPITZ_GPIO_MUTE_R, 0);
break; break;
case SPITZ_LINE: case SPITZ_LINE:
/* enable line jack, disable mic bias and mute hp */ /* enable line jack, disable mic bias and mute hp */
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(dapm, "Headset Jack");
snd_soc_dapm_disable_pin(codec, "Mic Jack"); snd_soc_dapm_disable_pin(dapm, "Mic Jack");
snd_soc_dapm_enable_pin(codec, "Line Jack"); snd_soc_dapm_enable_pin(dapm, "Line Jack");
gpio_set_value(SPITZ_GPIO_MUTE_L, 0); gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
gpio_set_value(SPITZ_GPIO_MUTE_R, 0); gpio_set_value(SPITZ_GPIO_MUTE_R, 0);
break; break;
case SPITZ_HEADSET: case SPITZ_HEADSET:
/* enable and unmute headset jack enable mic bias, mute L hp */ /* enable and unmute headset jack enable mic bias, mute L hp */
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
snd_soc_dapm_disable_pin(codec, "Line Jack"); snd_soc_dapm_disable_pin(dapm, "Line Jack");
snd_soc_dapm_enable_pin(codec, "Headset Jack"); snd_soc_dapm_enable_pin(dapm, "Headset Jack");
gpio_set_value(SPITZ_GPIO_MUTE_L, 0); gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
gpio_set_value(SPITZ_GPIO_MUTE_R, 1); gpio_set_value(SPITZ_GPIO_MUTE_R, 1);
break; break;
case SPITZ_HP_OFF: case SPITZ_HP_OFF:
/* jack removed, everything off */ /* jack removed, everything off */
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(dapm, "Headset Jack");
snd_soc_dapm_disable_pin(codec, "Mic Jack"); snd_soc_dapm_disable_pin(dapm, "Mic Jack");
snd_soc_dapm_disable_pin(codec, "Line Jack"); snd_soc_dapm_disable_pin(dapm, "Line Jack");
gpio_set_value(SPITZ_GPIO_MUTE_L, 0); gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
gpio_set_value(SPITZ_GPIO_MUTE_R, 0); gpio_set_value(SPITZ_GPIO_MUTE_R, 0);
break; break;
} }
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
} }
static int spitz_startup(struct snd_pcm_substream *substream) static int spitz_startup(struct snd_pcm_substream *substream)
@ -276,16 +278,17 @@ static const struct snd_kcontrol_new wm8750_spitz_controls[] = {
static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd) static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
/* NC codec pins */ /* NC codec pins */
snd_soc_dapm_nc_pin(codec, "RINPUT1"); snd_soc_dapm_nc_pin(dapm, "RINPUT1");
snd_soc_dapm_nc_pin(codec, "LINPUT2"); snd_soc_dapm_nc_pin(dapm, "LINPUT2");
snd_soc_dapm_nc_pin(codec, "RINPUT2"); snd_soc_dapm_nc_pin(dapm, "RINPUT2");
snd_soc_dapm_nc_pin(codec, "LINPUT3"); snd_soc_dapm_nc_pin(dapm, "LINPUT3");
snd_soc_dapm_nc_pin(codec, "RINPUT3"); snd_soc_dapm_nc_pin(dapm, "RINPUT3");
snd_soc_dapm_nc_pin(codec, "OUT3"); snd_soc_dapm_nc_pin(dapm, "OUT3");
snd_soc_dapm_nc_pin(codec, "MONO1"); snd_soc_dapm_nc_pin(dapm, "MONO1");
/* Add spitz specific controls */ /* Add spitz specific controls */
err = snd_soc_add_controls(codec, wm8750_spitz_controls, err = snd_soc_add_controls(codec, wm8750_spitz_controls,
@ -294,13 +297,13 @@ static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
/* Add spitz specific widgets */ /* Add spitz specific widgets */
snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
ARRAY_SIZE(wm8750_dapm_widgets)); ARRAY_SIZE(wm8750_dapm_widgets));
/* Set up spitz specific audio paths */ /* Set up spitz specific audio paths */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -133,20 +133,21 @@ static struct snd_soc_card snd_soc_card_evb3 = {
static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd) static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
snd_soc_dapm_new_controls(codec, evb3_dapm_widgets, snd_soc_dapm_new_controls(dapm, evb3_dapm_widgets,
ARRAY_SIZE(evb3_dapm_widgets)); ARRAY_SIZE(evb3_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
/* connected pins */ /* connected pins */
snd_soc_dapm_enable_pin(codec, "Ext Speaker"); snd_soc_dapm_enable_pin(dapm, "Ext Speaker");
snd_soc_dapm_enable_pin(codec, "Ext Mic 1"); snd_soc_dapm_enable_pin(dapm, "Ext Mic 1");
snd_soc_dapm_enable_pin(codec, "Ext Mic 3"); snd_soc_dapm_enable_pin(dapm, "Ext Mic 3");
snd_soc_dapm_disable_pin(codec, "Headset Mic 2"); snd_soc_dapm_disable_pin(dapm, "Headset Mic 2");
snd_soc_dapm_disable_pin(codec, "Headset Stereophone"); snd_soc_dapm_disable_pin(dapm, "Headset Stereophone");
ret = snd_soc_dapm_sync(codec); ret = snd_soc_dapm_sync(dapm);
if (ret) if (ret)
return ret; return ret;

View file

@ -49,31 +49,33 @@ static int tosa_spk_func;
static void tosa_ext_control(struct snd_soc_codec *codec) static void tosa_ext_control(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
/* set up jack connection */ /* set up jack connection */
switch (tosa_jack_func) { switch (tosa_jack_func) {
case TOSA_HP: case TOSA_HP:
snd_soc_dapm_disable_pin(codec, "Mic (Internal)"); snd_soc_dapm_disable_pin(dapm, "Mic (Internal)");
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(dapm, "Headset Jack");
break; break;
case TOSA_MIC_INT: case TOSA_MIC_INT:
snd_soc_dapm_enable_pin(codec, "Mic (Internal)"); snd_soc_dapm_enable_pin(dapm, "Mic (Internal)");
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin(codec, "Headset Jack"); snd_soc_dapm_disable_pin(dapm, "Headset Jack");
break; break;
case TOSA_HEADSET: case TOSA_HEADSET:
snd_soc_dapm_disable_pin(codec, "Mic (Internal)"); snd_soc_dapm_disable_pin(dapm, "Mic (Internal)");
snd_soc_dapm_disable_pin(codec, "Headphone Jack"); snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Headset Jack"); snd_soc_dapm_enable_pin(dapm, "Headset Jack");
break; break;
} }
if (tosa_spk_func == TOSA_SPK_ON) if (tosa_spk_func == TOSA_SPK_ON)
snd_soc_dapm_enable_pin(codec, "Speaker"); snd_soc_dapm_enable_pin(dapm, "Speaker");
else else
snd_soc_dapm_disable_pin(codec, "Speaker"); snd_soc_dapm_disable_pin(dapm, "Speaker");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
} }
static int tosa_startup(struct snd_pcm_substream *substream) static int tosa_startup(struct snd_pcm_substream *substream)
@ -186,10 +188,11 @@ static const struct snd_kcontrol_new tosa_controls[] = {
static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd) static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
snd_soc_dapm_nc_pin(codec, "OUT3"); snd_soc_dapm_nc_pin(dapm, "OUT3");
snd_soc_dapm_nc_pin(codec, "MONOOUT"); snd_soc_dapm_nc_pin(dapm, "MONOOUT");
/* add tosa specific controls */ /* add tosa specific controls */
err = snd_soc_add_controls(codec, tosa_controls, err = snd_soc_add_controls(codec, tosa_controls,
@ -198,13 +201,13 @@ static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
/* add tosa specific widgets */ /* add tosa specific widgets */
snd_soc_dapm_new_controls(codec, tosa_dapm_widgets, snd_soc_dapm_new_controls(dapm, tosa_dapm_widgets,
ARRAY_SIZE(tosa_dapm_widgets)); ARRAY_SIZE(tosa_dapm_widgets));
/* set up tosa specific audio path audio_map */ /* set up tosa specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -140,22 +140,23 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd) static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
/* NC codec pins */ /* NC codec pins */
snd_soc_dapm_disable_pin(codec, "LINPUT3"); snd_soc_dapm_disable_pin(dapm, "LINPUT3");
snd_soc_dapm_disable_pin(codec, "RINPUT3"); snd_soc_dapm_disable_pin(dapm, "RINPUT3");
snd_soc_dapm_disable_pin(codec, "OUT3"); snd_soc_dapm_disable_pin(dapm, "OUT3");
snd_soc_dapm_disable_pin(codec, "MONO"); snd_soc_dapm_disable_pin(dapm, "MONO");
/* Add z2 specific widgets */ /* Add z2 specific widgets */
snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
ARRAY_SIZE(wm8750_dapm_widgets)); ARRAY_SIZE(wm8750_dapm_widgets));
/* Set up z2 specific audio paths */ /* Set up z2 specific audio paths */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
ret = snd_soc_dapm_sync(codec); ret = snd_soc_dapm_sync(dapm);
if (ret) if (ret)
goto err; goto err;

View file

@ -73,21 +73,22 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd) static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
if (clk_pout) if (clk_pout)
snd_soc_dai_set_pll(rtd->codec_dai, 0, 0, snd_soc_dai_set_pll(rtd->codec_dai, 0, 0,
clk_get_rate(pout), 0); clk_get_rate(pout), 0);
snd_soc_dapm_new_controls(codec, zylonite_dapm_widgets, snd_soc_dapm_new_controls(dapm, zylonite_dapm_widgets,
ARRAY_SIZE(zylonite_dapm_widgets)); ARRAY_SIZE(zylonite_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
/* Static setup for now */ /* Static setup for now */
snd_soc_dapm_enable_pin(codec, "Headphone"); snd_soc_dapm_enable_pin(dapm, "Headphone");
snd_soc_dapm_enable_pin(codec, "Headset Earpiece"); snd_soc_dapm_enable_pin(dapm, "Headset Earpiece");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -93,27 +93,28 @@ static const struct snd_soc_dapm_route aquila_dapm_routes[] = {
static int aquila_wm8994_init(struct snd_soc_pcm_runtime *rtd) static int aquila_wm8994_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
/* add aquila specific widgets */ /* add aquila specific widgets */
snd_soc_dapm_new_controls(codec, aquila_dapm_widgets, snd_soc_dapm_new_controls(dapm, aquila_dapm_widgets,
ARRAY_SIZE(aquila_dapm_widgets)); ARRAY_SIZE(aquila_dapm_widgets));
/* set up aquila specific audio routes */ /* set up aquila specific audio routes */
snd_soc_dapm_add_routes(codec, aquila_dapm_routes, snd_soc_dapm_add_routes(dapm, aquila_dapm_routes,
ARRAY_SIZE(aquila_dapm_routes)); ARRAY_SIZE(aquila_dapm_routes));
/* set endpoints to not connected */ /* set endpoints to not connected */
snd_soc_dapm_nc_pin(codec, "IN2LP:VXRN"); snd_soc_dapm_nc_pin(dapm, "IN2LP:VXRN");
snd_soc_dapm_nc_pin(codec, "IN2RP:VXRP"); snd_soc_dapm_nc_pin(dapm, "IN2RP:VXRP");
snd_soc_dapm_nc_pin(codec, "LINEOUT1N"); snd_soc_dapm_nc_pin(dapm, "LINEOUT1N");
snd_soc_dapm_nc_pin(codec, "LINEOUT1P"); snd_soc_dapm_nc_pin(dapm, "LINEOUT1P");
snd_soc_dapm_nc_pin(codec, "LINEOUT2N"); snd_soc_dapm_nc_pin(dapm, "LINEOUT2N");
snd_soc_dapm_nc_pin(codec, "LINEOUT2P"); snd_soc_dapm_nc_pin(dapm, "LINEOUT2P");
snd_soc_dapm_nc_pin(codec, "SPKOUTRN"); snd_soc_dapm_nc_pin(dapm, "SPKOUTRN");
snd_soc_dapm_nc_pin(codec, "SPKOUTRP"); snd_soc_dapm_nc_pin(dapm, "SPKOUTRP");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
/* Headset jack detection */ /* Headset jack detection */
ret = snd_soc_jack_new(&aquila, "Headset Jack", ret = snd_soc_jack_new(&aquila, "Headset Jack",

View file

@ -97,25 +97,26 @@ static const struct snd_soc_dapm_route goni_dapm_routes[] = {
static int goni_wm8994_init(struct snd_soc_pcm_runtime *rtd) static int goni_wm8994_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
/* add goni specific widgets */ /* add goni specific widgets */
snd_soc_dapm_new_controls(codec, goni_dapm_widgets, snd_soc_dapm_new_controls(dapm, goni_dapm_widgets,
ARRAY_SIZE(goni_dapm_widgets)); ARRAY_SIZE(goni_dapm_widgets));
/* set up goni specific audio routes */ /* set up goni specific audio routes */
snd_soc_dapm_add_routes(codec, goni_dapm_routes, snd_soc_dapm_add_routes(dapm, goni_dapm_routes,
ARRAY_SIZE(goni_dapm_routes)); ARRAY_SIZE(goni_dapm_routes));
/* set endpoints to not connected */ /* set endpoints to not connected */
snd_soc_dapm_nc_pin(codec, "IN2LP:VXRN"); snd_soc_dapm_nc_pin(dapm, "IN2LP:VXRN");
snd_soc_dapm_nc_pin(codec, "IN2RP:VXRP"); snd_soc_dapm_nc_pin(dapm, "IN2RP:VXRP");
snd_soc_dapm_nc_pin(codec, "LINEOUT1N"); snd_soc_dapm_nc_pin(dapm, "LINEOUT1N");
snd_soc_dapm_nc_pin(codec, "LINEOUT1P"); snd_soc_dapm_nc_pin(dapm, "LINEOUT1P");
snd_soc_dapm_nc_pin(codec, "LINEOUT2N"); snd_soc_dapm_nc_pin(dapm, "LINEOUT2N");
snd_soc_dapm_nc_pin(codec, "LINEOUT2P"); snd_soc_dapm_nc_pin(dapm, "LINEOUT2P");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
/* Headset jack detection */ /* Headset jack detection */
ret = snd_soc_jack_new(&goni, "Headset Jack", ret = snd_soc_jack_new(&goni, "Headset Jack",

View file

@ -111,18 +111,19 @@ static struct snd_soc_ops jive_ops = {
static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd) static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
/* These endpoints are not being used. */ /* These endpoints are not being used. */
snd_soc_dapm_nc_pin(codec, "LINPUT2"); snd_soc_dapm_nc_pin(dapm, "LINPUT2");
snd_soc_dapm_nc_pin(codec, "RINPUT2"); snd_soc_dapm_nc_pin(dapm, "RINPUT2");
snd_soc_dapm_nc_pin(codec, "LINPUT3"); snd_soc_dapm_nc_pin(dapm, "LINPUT3");
snd_soc_dapm_nc_pin(codec, "RINPUT3"); snd_soc_dapm_nc_pin(dapm, "RINPUT3");
snd_soc_dapm_nc_pin(codec, "OUT3"); snd_soc_dapm_nc_pin(dapm, "OUT3");
snd_soc_dapm_nc_pin(codec, "MONO"); snd_soc_dapm_nc_pin(dapm, "MONO");
/* Add jive specific widgets */ /* Add jive specific widgets */
err = snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, err = snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
ARRAY_SIZE(wm8750_dapm_widgets)); ARRAY_SIZE(wm8750_dapm_widgets));
if (err) { if (err) {
printk(KERN_ERR "%s: failed to add widgets (%d)\n", printk(KERN_ERR "%s: failed to add widgets (%d)\n",
@ -130,8 +131,8 @@ static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
} }
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -333,16 +333,17 @@ static const struct snd_kcontrol_new wm8753_neo1973_gta02_controls[] = {
static int neo1973_gta02_wm8753_init(struct snd_soc_pcm_runtime *rtd) static int neo1973_gta02_wm8753_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
/* set up NC codec pins */ /* set up NC codec pins */
snd_soc_dapm_nc_pin(codec, "OUT3"); snd_soc_dapm_nc_pin(dapm, "OUT3");
snd_soc_dapm_nc_pin(codec, "OUT4"); snd_soc_dapm_nc_pin(dapm, "OUT4");
snd_soc_dapm_nc_pin(codec, "LINE1"); snd_soc_dapm_nc_pin(dapm, "LINE1");
snd_soc_dapm_nc_pin(codec, "LINE2"); snd_soc_dapm_nc_pin(dapm, "LINE2");
/* Add neo1973 gta02 specific widgets */ /* Add neo1973 gta02 specific widgets */
snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets,
ARRAY_SIZE(wm8753_dapm_widgets)); ARRAY_SIZE(wm8753_dapm_widgets));
/* add neo1973 gta02 specific controls */ /* add neo1973 gta02 specific controls */
@ -353,25 +354,25 @@ static int neo1973_gta02_wm8753_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
/* set up neo1973 gta02 specific audio path audio_map */ /* set up neo1973 gta02 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
/* set endpoints to default off mode */ /* set endpoints to default off mode */
snd_soc_dapm_disable_pin(codec, "Stereo Out"); snd_soc_dapm_disable_pin(dapm, "Stereo Out");
snd_soc_dapm_disable_pin(codec, "GSM Line Out"); snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(codec, "GSM Line In"); snd_soc_dapm_disable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Handset Mic"); snd_soc_dapm_disable_pin(dapm, "Handset Mic");
snd_soc_dapm_disable_pin(codec, "Handset Spk"); snd_soc_dapm_disable_pin(dapm, "Handset Spk");
/* allow audio paths from the GSM modem to run during suspend */ /* allow audio paths from the GSM modem to run during suspend */
snd_soc_dapm_ignore_suspend(codec, "Stereo Out"); snd_soc_dapm_ignore_suspend(dapm, "Stereo Out");
snd_soc_dapm_ignore_suspend(codec, "GSM Line Out"); snd_soc_dapm_ignore_suspend(dapm, "GSM Line Out");
snd_soc_dapm_ignore_suspend(codec, "GSM Line In"); snd_soc_dapm_ignore_suspend(dapm, "GSM Line In");
snd_soc_dapm_ignore_suspend(codec, "Headset Mic"); snd_soc_dapm_ignore_suspend(dapm, "Headset Mic");
snd_soc_dapm_ignore_suspend(codec, "Handset Mic"); snd_soc_dapm_ignore_suspend(dapm, "Handset Mic");
snd_soc_dapm_ignore_suspend(codec, "Handset Spk"); snd_soc_dapm_ignore_suspend(dapm, "Handset Spk");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -237,81 +237,83 @@ static int neo1973_get_scenario(struct snd_kcontrol *kcontrol,
static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario) static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
pr_debug("Entered %s\n", __func__); pr_debug("Entered %s\n", __func__);
switch (neo1973_scenario) { switch (neo1973_scenario) {
case NEO_AUDIO_OFF: case NEO_AUDIO_OFF:
snd_soc_dapm_disable_pin(codec, "Audio Out"); snd_soc_dapm_disable_pin(dapm, "Audio Out");
snd_soc_dapm_disable_pin(codec, "GSM Line Out"); snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(codec, "GSM Line In"); snd_soc_dapm_disable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Call Mic"); snd_soc_dapm_disable_pin(dapm, "Call Mic");
break; break;
case NEO_GSM_CALL_AUDIO_HANDSET: case NEO_GSM_CALL_AUDIO_HANDSET:
snd_soc_dapm_enable_pin(codec, "Audio Out"); snd_soc_dapm_enable_pin(dapm, "Audio Out");
snd_soc_dapm_enable_pin(codec, "GSM Line Out"); snd_soc_dapm_enable_pin(dapm, "GSM Line Out");
snd_soc_dapm_enable_pin(codec, "GSM Line In"); snd_soc_dapm_enable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_enable_pin(codec, "Call Mic"); snd_soc_dapm_enable_pin(dapm, "Call Mic");
break; break;
case NEO_GSM_CALL_AUDIO_HEADSET: case NEO_GSM_CALL_AUDIO_HEADSET:
snd_soc_dapm_enable_pin(codec, "Audio Out"); snd_soc_dapm_enable_pin(dapm, "Audio Out");
snd_soc_dapm_enable_pin(codec, "GSM Line Out"); snd_soc_dapm_enable_pin(dapm, "GSM Line Out");
snd_soc_dapm_enable_pin(codec, "GSM Line In"); snd_soc_dapm_enable_pin(dapm, "GSM Line In");
snd_soc_dapm_enable_pin(codec, "Headset Mic"); snd_soc_dapm_enable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Call Mic"); snd_soc_dapm_disable_pin(dapm, "Call Mic");
break; break;
case NEO_GSM_CALL_AUDIO_BLUETOOTH: case NEO_GSM_CALL_AUDIO_BLUETOOTH:
snd_soc_dapm_disable_pin(codec, "Audio Out"); snd_soc_dapm_disable_pin(dapm, "Audio Out");
snd_soc_dapm_enable_pin(codec, "GSM Line Out"); snd_soc_dapm_enable_pin(dapm, "GSM Line Out");
snd_soc_dapm_enable_pin(codec, "GSM Line In"); snd_soc_dapm_enable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Call Mic"); snd_soc_dapm_disable_pin(dapm, "Call Mic");
break; break;
case NEO_STEREO_TO_SPEAKERS: case NEO_STEREO_TO_SPEAKERS:
snd_soc_dapm_enable_pin(codec, "Audio Out"); snd_soc_dapm_enable_pin(dapm, "Audio Out");
snd_soc_dapm_disable_pin(codec, "GSM Line Out"); snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(codec, "GSM Line In"); snd_soc_dapm_disable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Call Mic"); snd_soc_dapm_disable_pin(dapm, "Call Mic");
break; break;
case NEO_STEREO_TO_HEADPHONES: case NEO_STEREO_TO_HEADPHONES:
snd_soc_dapm_enable_pin(codec, "Audio Out"); snd_soc_dapm_enable_pin(dapm, "Audio Out");
snd_soc_dapm_disable_pin(codec, "GSM Line Out"); snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(codec, "GSM Line In"); snd_soc_dapm_disable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Call Mic"); snd_soc_dapm_disable_pin(dapm, "Call Mic");
break; break;
case NEO_CAPTURE_HANDSET: case NEO_CAPTURE_HANDSET:
snd_soc_dapm_disable_pin(codec, "Audio Out"); snd_soc_dapm_disable_pin(dapm, "Audio Out");
snd_soc_dapm_disable_pin(codec, "GSM Line Out"); snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(codec, "GSM Line In"); snd_soc_dapm_disable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_enable_pin(codec, "Call Mic"); snd_soc_dapm_enable_pin(dapm, "Call Mic");
break; break;
case NEO_CAPTURE_HEADSET: case NEO_CAPTURE_HEADSET:
snd_soc_dapm_disable_pin(codec, "Audio Out"); snd_soc_dapm_disable_pin(dapm, "Audio Out");
snd_soc_dapm_disable_pin(codec, "GSM Line Out"); snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(codec, "GSM Line In"); snd_soc_dapm_disable_pin(dapm, "GSM Line In");
snd_soc_dapm_enable_pin(codec, "Headset Mic"); snd_soc_dapm_enable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Call Mic"); snd_soc_dapm_disable_pin(dapm, "Call Mic");
break; break;
case NEO_CAPTURE_BLUETOOTH: case NEO_CAPTURE_BLUETOOTH:
snd_soc_dapm_disable_pin(codec, "Audio Out"); snd_soc_dapm_disable_pin(dapm, "Audio Out");
snd_soc_dapm_disable_pin(codec, "GSM Line Out"); snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(codec, "GSM Line In"); snd_soc_dapm_disable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Call Mic"); snd_soc_dapm_disable_pin(dapm, "Call Mic");
break; break;
default: default:
snd_soc_dapm_disable_pin(codec, "Audio Out"); snd_soc_dapm_disable_pin(dapm, "Audio Out");
snd_soc_dapm_disable_pin(codec, "GSM Line Out"); snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(codec, "GSM Line In"); snd_soc_dapm_disable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(codec, "Headset Mic"); snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(codec, "Call Mic"); snd_soc_dapm_disable_pin(dapm, "Call Mic");
} }
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }
@ -502,20 +504,21 @@ static const struct snd_kcontrol_new wm8753_neo1973_controls[] = {
static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
pr_debug("Entered %s\n", __func__); pr_debug("Entered %s\n", __func__);
/* set up NC codec pins */ /* set up NC codec pins */
snd_soc_dapm_nc_pin(codec, "LOUT2"); snd_soc_dapm_nc_pin(dapm, "LOUT2");
snd_soc_dapm_nc_pin(codec, "ROUT2"); snd_soc_dapm_nc_pin(dapm, "ROUT2");
snd_soc_dapm_nc_pin(codec, "OUT3"); snd_soc_dapm_nc_pin(dapm, "OUT3");
snd_soc_dapm_nc_pin(codec, "OUT4"); snd_soc_dapm_nc_pin(dapm, "OUT4");
snd_soc_dapm_nc_pin(codec, "LINE1"); snd_soc_dapm_nc_pin(dapm, "LINE1");
snd_soc_dapm_nc_pin(codec, "LINE2"); snd_soc_dapm_nc_pin(dapm, "LINE2");
/* Add neo1973 specific widgets */ /* Add neo1973 specific widgets */
snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets,
ARRAY_SIZE(wm8753_dapm_widgets)); ARRAY_SIZE(wm8753_dapm_widgets));
/* set endpoints to default mode */ /* set endpoints to default mode */
@ -528,10 +531,10 @@ static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
return err; return err;
/* set up neo1973 specific audio routes */ /* set up neo1973 specific audio routes */
err = snd_soc_dapm_add_routes(codec, dapm_routes, err = snd_soc_dapm_add_routes(dapm, dapm_routes,
ARRAY_SIZE(dapm_routes)); ARRAY_SIZE(dapm_routes));
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -232,26 +232,27 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream,
static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd) static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int err; int err;
/* Add rx1950 specific widgets */ /* Add rx1950 specific widgets */
err = snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets, err = snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
ARRAY_SIZE(uda1380_dapm_widgets)); ARRAY_SIZE(uda1380_dapm_widgets));
if (err) if (err)
return err; return err;
/* Set up rx1950 specific audio path audio_mapnects */ /* Set up rx1950 specific audio path audio_mapnects */
err = snd_soc_dapm_add_routes(codec, audio_map, err = snd_soc_dapm_add_routes(dapm, audio_map,
ARRAY_SIZE(audio_map)); ARRAY_SIZE(audio_map));
if (err) if (err)
return err; return err;
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Speaker"); snd_soc_dapm_enable_pin(dapm, "Speaker");
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
&hp_jack); &hp_jack);

View file

@ -76,19 +76,20 @@ static const struct snd_soc_dapm_route base_map[] = {
static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd) static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(codec, dapm_widgets, snd_soc_dapm_new_controls(dapm, dapm_widgets,
ARRAY_SIZE(dapm_widgets)); ARRAY_SIZE(dapm_widgets));
snd_soc_dapm_add_routes(codec, base_map, ARRAY_SIZE(base_map)); snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Line In"); snd_soc_dapm_enable_pin(dapm, "Line In");
snd_soc_dapm_enable_pin(codec, "Line Out"); snd_soc_dapm_enable_pin(dapm, "Line Out");
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
simtec_audio_init(rtd); simtec_audio_init(rtd);
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

View file

@ -65,19 +65,20 @@ static const struct snd_soc_dapm_route base_map[] = {
static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(codec, dapm_widgets, snd_soc_dapm_new_controls(dapm, dapm_widgets,
ARRAY_SIZE(dapm_widgets)); ARRAY_SIZE(dapm_widgets));
snd_soc_dapm_add_routes(codec, base_map, ARRAY_SIZE(base_map)); snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));
snd_soc_dapm_enable_pin(codec, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Line In"); snd_soc_dapm_enable_pin(dapm, "Line In");
snd_soc_dapm_enable_pin(codec, "Line Out"); snd_soc_dapm_enable_pin(dapm, "Line Out");
snd_soc_dapm_enable_pin(codec, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Mic Jack");
simtec_audio_init(rtd); simtec_audio_init(rtd);
snd_soc_dapm_sync(codec); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }

Some files were not shown because too many files have changed in this diff Show more