Loading include/sound/soc-dapm.h +46 −0 Original line number Original line Diff line number Diff line Loading @@ -107,6 +107,10 @@ struct device; { .id = snd_soc_dapm_mux, .name = wname, \ { .id = snd_soc_dapm_mux, .name = wname, \ SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ .kcontrol_news = wcontrols, .num_kcontrols = 1} .kcontrol_news = wcontrols, .num_kcontrols = 1} #define SND_SOC_DAPM_DEMUX(wname, wreg, wshift, winvert, wcontrols) \ { .id = snd_soc_dapm_demux, .name = wname, \ SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ .kcontrol_news = wcontrols, .num_kcontrols = 1} /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ Loading Loading @@ -444,11 +448,15 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( struct snd_kcontrol *kcontrol); struct snd_kcontrol *kcontrol); int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level); /* dapm widget types */ /* dapm widget types */ enum snd_soc_dapm_type { enum snd_soc_dapm_type { snd_soc_dapm_input = 0, /* input pin */ snd_soc_dapm_input = 0, /* input pin */ snd_soc_dapm_output, /* output pin */ snd_soc_dapm_output, /* output pin */ snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ snd_soc_dapm_demux, /* connects the input to one of multiple outputs */ snd_soc_dapm_mixer, /* mixes several analog signals together */ snd_soc_dapm_mixer, /* mixes several analog signals together */ snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ Loading Loading @@ -585,6 +593,10 @@ struct snd_soc_dapm_update { int val; int val; }; }; struct snd_soc_dapm_wcache { struct snd_soc_dapm_widget *widget; }; /* DAPM context */ /* DAPM context */ struct snd_soc_dapm_context { struct snd_soc_dapm_context { enum snd_soc_bias_level bias_level; enum snd_soc_bias_level bias_level; Loading @@ -606,6 +618,9 @@ struct snd_soc_dapm_context { int (*set_bias_level)(struct snd_soc_dapm_context *dapm, int (*set_bias_level)(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level); enum snd_soc_bias_level level); struct snd_soc_dapm_wcache path_sink_cache; struct snd_soc_dapm_wcache path_source_cache; #ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS struct dentry *debugfs_dapm; struct dentry *debugfs_dapm; #endif #endif Loading @@ -623,4 +638,35 @@ struct snd_soc_dapm_stats { int neighbour_checks; int neighbour_checks; }; }; /** * snd_soc_dapm_init_bias_level() - Initialize DAPM bias level * @dapm: The DAPM context to initialize * @level: The DAPM level to initialize to * * This function only sets the driver internal state of the DAPM level and will * not modify the state of the device. Hence it should not be used during normal * operation, but only to synchronize the internal state to the device state. * E.g. during driver probe to set the DAPM level to the one corresponding with * the power-on reset state of the device. * * To change the DAPM state of the device use snd_soc_dapm_set_bias_level(). */ static inline void snd_soc_dapm_init_bias_level( struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) { dapm->bias_level = level; } /** * snd_soc_dapm_get_bias_level() - Get current DAPM bias level * @dapm: The context for which to get the bias level * * Returns: The current bias level of the passed DAPM context. */ static inline enum snd_soc_bias_level snd_soc_dapm_get_bias_level( struct snd_soc_dapm_context *dapm) { return dapm->bias_level; } #endif #endif include/sound/soc.h +65 −3 Original line number Original line Diff line number Diff line Loading @@ -190,8 +190,12 @@ #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \ #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues) SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xitems, xtexts, xvalues) #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ { .reg = xreg, .shift_l = xshift, .shift_r = xshift, \ .mask = xmask, .items = xitems, .texts = xtexts, \ .values = xvalues, .autodisable = 1} #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) #define SOC_ENUM(xname, xenum) \ #define SOC_ENUM(xname, xenum) \ Loading Loading @@ -312,6 +316,11 @@ ARRAY_SIZE(xtexts), xtexts, xvalues) ARRAY_SIZE(xtexts), xtexts, xvalues) #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ const struct soc_enum name = SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, \ xshift, xmask, ARRAY_SIZE(xtexts), xtexts, xvalues) #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) Loading Loading @@ -819,7 +828,7 @@ struct snd_soc_codec { /* component */ /* component */ struct snd_soc_component component; struct snd_soc_component component; /* dapm */ /* Don't access this directly, use snd_soc_codec_get_dapm() */ struct snd_soc_dapm_context dapm; struct snd_soc_dapm_context dapm; #ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS Loading Loading @@ -1200,6 +1209,7 @@ struct soc_enum { unsigned int mask; unsigned int mask; const char * const *texts; const char * const *texts; const unsigned int *values; const unsigned int *values; unsigned int autodisable:1; }; }; /** /** Loading Loading @@ -1281,6 +1291,58 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm( return component->dapm_ptr; return component->dapm_ptr; } } /** * snd_soc_codec_get_dapm() - Returns the DAPM context for the CODEC * @codec: The CODEC for which to get the DAPM context * * Note: Use this function instead of directly accessing the CODEC's dapm field */ static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm( struct snd_soc_codec *codec) { return &codec->dapm; } /** * snd_soc_dapm_init_bias_level() - Initialize CODEC DAPM bias level * @dapm: The CODEC for which to initialize the DAPM bias level * @level: The DAPM level to initialize to * * Initializes the CODEC DAPM bias level. See snd_soc_dapm_init_bias_level(). */ static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level); } /** * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level * @codec: The CODEC for which to get the DAPM bias level * * Returns: The current DAPM bias level of the CODEC. */ static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level( struct snd_soc_codec *codec) { return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec)); } /** * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level * @codec: The CODEC for which to set the level * @level: The level to set to * * Forces the CODEC bias level to a specific state. See * snd_soc_dapm_force_bias_level(). */ static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { return snd_soc_dapm_force_bias_level(snd_soc_codec_get_dapm(codec), level); } /** /** * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol * @kcontrol: The kcontrol * @kcontrol: The kcontrol Loading sound/soc/codecs/88pm860x-codec.c +1 −2 Original line number Original line Diff line number Diff line Loading @@ -1140,7 +1140,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->dapm.bias_level == SND_SOC_BIAS_OFF) { if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { /* Enable Audio PLL & Audio section */ /* Enable Audio PLL & Audio section */ data = AUDIO_PLL | AUDIO_SECTION_ON; data = AUDIO_PLL | AUDIO_SECTION_ON; pm860x_reg_write(pm860x->i2c, REG_MISC2, data); pm860x_reg_write(pm860x->i2c, REG_MISC2, data); Loading @@ -1156,7 +1156,6 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec, pm860x_set_bits(pm860x->i2c, REG_MISC2, data, 0); pm860x_set_bits(pm860x->i2c, REG_MISC2, data, 0); break; break; } } codec->dapm.bias_level = level; return 0; return 0; } } Loading sound/soc/codecs/ab8500-codec.c +11 −9 Original line number Original line Diff line number Diff line Loading @@ -1209,6 +1209,7 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol) { { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev); struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev); struct device *dev = codec->dev; struct device *dev = codec->dev; bool apply_fir, apply_iir; bool apply_fir, apply_iir; Loading @@ -1234,15 +1235,14 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol, apply_fir = req == ANC_APPLY_FIR || req == ANC_APPLY_FIR_IIR; apply_fir = req == ANC_APPLY_FIR || req == ANC_APPLY_FIR_IIR; apply_iir = req == ANC_APPLY_IIR || req == ANC_APPLY_FIR_IIR; apply_iir = req == ANC_APPLY_IIR || req == ANC_APPLY_FIR_IIR; status = snd_soc_dapm_force_enable_pin(&codec->dapm, status = snd_soc_dapm_force_enable_pin(dapm, "ANC Configure Input"); "ANC Configure Input"); if (status < 0) { if (status < 0) { dev_err(dev, dev_err(dev, "%s: ERROR: Failed to enable power (status = %d)!\n", "%s: ERROR: Failed to enable power (status = %d)!\n", __func__, status); __func__, status); goto cleanup; goto cleanup; } } snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm); anc_configure(codec, apply_fir, apply_iir); anc_configure(codec, apply_fir, apply_iir); Loading @@ -1259,8 +1259,8 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol, drvdata->anc_status = ANC_IIR_CONFIGURED; drvdata->anc_status = ANC_IIR_CONFIGURED; } } status = snd_soc_dapm_disable_pin(&codec->dapm, "ANC Configure Input"); status = snd_soc_dapm_disable_pin(dapm, "ANC Configure Input"); snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm); cleanup: cleanup: mutex_unlock(&drvdata->ctrl_lock); mutex_unlock(&drvdata->ctrl_lock); Loading Loading @@ -1947,6 +1947,7 @@ static int ab8500_audio_init_audioblock(struct snd_soc_codec *codec) static int ab8500_audio_setup_mics(struct snd_soc_codec *codec, static int ab8500_audio_setup_mics(struct snd_soc_codec *codec, struct amic_settings *amics) struct amic_settings *amics) { { struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); u8 value8; u8 value8; unsigned int value; unsigned int value; int status; int status; Loading @@ -1973,15 +1974,15 @@ static int ab8500_audio_setup_mics(struct snd_soc_codec *codec, dev_dbg(codec->dev, "%s: Mic 1a regulator: %s\n", __func__, dev_dbg(codec->dev, "%s: Mic 1a regulator: %s\n", __func__, amic_micbias_str(amics->mic1a_micbias)); amic_micbias_str(amics->mic1a_micbias)); route = &ab8500_dapm_routes_mic1a_vamicx[amics->mic1a_micbias]; route = &ab8500_dapm_routes_mic1a_vamicx[amics->mic1a_micbias]; status = snd_soc_dapm_add_routes(&codec->dapm, route, 1); status = snd_soc_dapm_add_routes(dapm, route, 1); dev_dbg(codec->dev, "%s: Mic 1b regulator: %s\n", __func__, dev_dbg(codec->dev, "%s: Mic 1b regulator: %s\n", __func__, amic_micbias_str(amics->mic1b_micbias)); amic_micbias_str(amics->mic1b_micbias)); route = &ab8500_dapm_routes_mic1b_vamicx[amics->mic1b_micbias]; route = &ab8500_dapm_routes_mic1b_vamicx[amics->mic1b_micbias]; status |= snd_soc_dapm_add_routes(&codec->dapm, route, 1); status |= snd_soc_dapm_add_routes(dapm, route, 1); dev_dbg(codec->dev, "%s: Mic 2 regulator: %s\n", __func__, dev_dbg(codec->dev, "%s: Mic 2 regulator: %s\n", __func__, amic_micbias_str(amics->mic2_micbias)); amic_micbias_str(amics->mic2_micbias)); route = &ab8500_dapm_routes_mic2_vamicx[amics->mic2_micbias]; route = &ab8500_dapm_routes_mic2_vamicx[amics->mic2_micbias]; status |= snd_soc_dapm_add_routes(&codec->dapm, route, 1); status |= snd_soc_dapm_add_routes(dapm, route, 1); if (status < 0) { if (status < 0) { dev_err(codec->dev, dev_err(codec->dev, "%s: Failed to add AMic-regulator DAPM-routes (%d).\n", "%s: Failed to add AMic-regulator DAPM-routes (%d).\n", Loading Loading @@ -2461,6 +2462,7 @@ static void ab8500_codec_of_probe(struct device *dev, struct device_node *np, static int ab8500_codec_probe(struct snd_soc_codec *codec) static int ab8500_codec_probe(struct snd_soc_codec *codec) { { struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct device *dev = codec->dev; struct device *dev = codec->dev; struct device_node *np = dev->of_node; struct device_node *np = dev->of_node; struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); Loading Loading @@ -2541,7 +2543,7 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec) &ab8500_filter_controls[AB8500_FILTER_SID_FIR].private_value; &ab8500_filter_controls[AB8500_FILTER_SID_FIR].private_value; drvdata->sid_fir_values = (long *)fc->value; drvdata->sid_fir_values = (long *)fc->value; (void)snd_soc_dapm_disable_pin(&codec->dapm, "ANC Configure Input"); snd_soc_dapm_disable_pin(dapm, "ANC Configure Input"); mutex_init(&drvdata->ctrl_lock); mutex_init(&drvdata->ctrl_lock); Loading sound/soc/codecs/adau1373.c +0 −1 Original line number Original line Diff line number Diff line Loading @@ -1444,7 +1444,6 @@ static int adau1373_set_bias_level(struct snd_soc_codec *codec, ADAU1373_PWDN_CTRL3_PWR_EN, 0); ADAU1373_PWDN_CTRL3_PWR_EN, 0); break; break; } } codec->dapm.bias_level = level; return 0; return 0; } } Loading Loading
include/sound/soc-dapm.h +46 −0 Original line number Original line Diff line number Diff line Loading @@ -107,6 +107,10 @@ struct device; { .id = snd_soc_dapm_mux, .name = wname, \ { .id = snd_soc_dapm_mux, .name = wname, \ SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ .kcontrol_news = wcontrols, .num_kcontrols = 1} .kcontrol_news = wcontrols, .num_kcontrols = 1} #define SND_SOC_DAPM_DEMUX(wname, wreg, wshift, winvert, wcontrols) \ { .id = snd_soc_dapm_demux, .name = wname, \ SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ .kcontrol_news = wcontrols, .num_kcontrols = 1} /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ Loading Loading @@ -444,11 +448,15 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( struct snd_kcontrol *kcontrol); struct snd_kcontrol *kcontrol); int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level); /* dapm widget types */ /* dapm widget types */ enum snd_soc_dapm_type { enum snd_soc_dapm_type { snd_soc_dapm_input = 0, /* input pin */ snd_soc_dapm_input = 0, /* input pin */ snd_soc_dapm_output, /* output pin */ snd_soc_dapm_output, /* output pin */ snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ snd_soc_dapm_demux, /* connects the input to one of multiple outputs */ snd_soc_dapm_mixer, /* mixes several analog signals together */ snd_soc_dapm_mixer, /* mixes several analog signals together */ snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ Loading Loading @@ -585,6 +593,10 @@ struct snd_soc_dapm_update { int val; int val; }; }; struct snd_soc_dapm_wcache { struct snd_soc_dapm_widget *widget; }; /* DAPM context */ /* DAPM context */ struct snd_soc_dapm_context { struct snd_soc_dapm_context { enum snd_soc_bias_level bias_level; enum snd_soc_bias_level bias_level; Loading @@ -606,6 +618,9 @@ struct snd_soc_dapm_context { int (*set_bias_level)(struct snd_soc_dapm_context *dapm, int (*set_bias_level)(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level); enum snd_soc_bias_level level); struct snd_soc_dapm_wcache path_sink_cache; struct snd_soc_dapm_wcache path_source_cache; #ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS struct dentry *debugfs_dapm; struct dentry *debugfs_dapm; #endif #endif Loading @@ -623,4 +638,35 @@ struct snd_soc_dapm_stats { int neighbour_checks; int neighbour_checks; }; }; /** * snd_soc_dapm_init_bias_level() - Initialize DAPM bias level * @dapm: The DAPM context to initialize * @level: The DAPM level to initialize to * * This function only sets the driver internal state of the DAPM level and will * not modify the state of the device. Hence it should not be used during normal * operation, but only to synchronize the internal state to the device state. * E.g. during driver probe to set the DAPM level to the one corresponding with * the power-on reset state of the device. * * To change the DAPM state of the device use snd_soc_dapm_set_bias_level(). */ static inline void snd_soc_dapm_init_bias_level( struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) { dapm->bias_level = level; } /** * snd_soc_dapm_get_bias_level() - Get current DAPM bias level * @dapm: The context for which to get the bias level * * Returns: The current bias level of the passed DAPM context. */ static inline enum snd_soc_bias_level snd_soc_dapm_get_bias_level( struct snd_soc_dapm_context *dapm) { return dapm->bias_level; } #endif #endif
include/sound/soc.h +65 −3 Original line number Original line Diff line number Diff line Loading @@ -190,8 +190,12 @@ #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \ #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues) SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xitems, xtexts, xvalues) #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ { .reg = xreg, .shift_l = xshift, .shift_r = xshift, \ .mask = xmask, .items = xitems, .texts = xtexts, \ .values = xvalues, .autodisable = 1} #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) #define SOC_ENUM(xname, xenum) \ #define SOC_ENUM(xname, xenum) \ Loading Loading @@ -312,6 +316,11 @@ ARRAY_SIZE(xtexts), xtexts, xvalues) ARRAY_SIZE(xtexts), xtexts, xvalues) #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ const struct soc_enum name = SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, \ xshift, xmask, ARRAY_SIZE(xtexts), xtexts, xvalues) #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) Loading Loading @@ -819,7 +828,7 @@ struct snd_soc_codec { /* component */ /* component */ struct snd_soc_component component; struct snd_soc_component component; /* dapm */ /* Don't access this directly, use snd_soc_codec_get_dapm() */ struct snd_soc_dapm_context dapm; struct snd_soc_dapm_context dapm; #ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS Loading Loading @@ -1200,6 +1209,7 @@ struct soc_enum { unsigned int mask; unsigned int mask; const char * const *texts; const char * const *texts; const unsigned int *values; const unsigned int *values; unsigned int autodisable:1; }; }; /** /** Loading Loading @@ -1281,6 +1291,58 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm( return component->dapm_ptr; return component->dapm_ptr; } } /** * snd_soc_codec_get_dapm() - Returns the DAPM context for the CODEC * @codec: The CODEC for which to get the DAPM context * * Note: Use this function instead of directly accessing the CODEC's dapm field */ static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm( struct snd_soc_codec *codec) { return &codec->dapm; } /** * snd_soc_dapm_init_bias_level() - Initialize CODEC DAPM bias level * @dapm: The CODEC for which to initialize the DAPM bias level * @level: The DAPM level to initialize to * * Initializes the CODEC DAPM bias level. See snd_soc_dapm_init_bias_level(). */ static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level); } /** * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level * @codec: The CODEC for which to get the DAPM bias level * * Returns: The current DAPM bias level of the CODEC. */ static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level( struct snd_soc_codec *codec) { return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec)); } /** * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level * @codec: The CODEC for which to set the level * @level: The level to set to * * Forces the CODEC bias level to a specific state. See * snd_soc_dapm_force_bias_level(). */ static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { return snd_soc_dapm_force_bias_level(snd_soc_codec_get_dapm(codec), level); } /** /** * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol * @kcontrol: The kcontrol * @kcontrol: The kcontrol Loading
sound/soc/codecs/88pm860x-codec.c +1 −2 Original line number Original line Diff line number Diff line Loading @@ -1140,7 +1140,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->dapm.bias_level == SND_SOC_BIAS_OFF) { if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { /* Enable Audio PLL & Audio section */ /* Enable Audio PLL & Audio section */ data = AUDIO_PLL | AUDIO_SECTION_ON; data = AUDIO_PLL | AUDIO_SECTION_ON; pm860x_reg_write(pm860x->i2c, REG_MISC2, data); pm860x_reg_write(pm860x->i2c, REG_MISC2, data); Loading @@ -1156,7 +1156,6 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec, pm860x_set_bits(pm860x->i2c, REG_MISC2, data, 0); pm860x_set_bits(pm860x->i2c, REG_MISC2, data, 0); break; break; } } codec->dapm.bias_level = level; return 0; return 0; } } Loading
sound/soc/codecs/ab8500-codec.c +11 −9 Original line number Original line Diff line number Diff line Loading @@ -1209,6 +1209,7 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol) { { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev); struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev); struct device *dev = codec->dev; struct device *dev = codec->dev; bool apply_fir, apply_iir; bool apply_fir, apply_iir; Loading @@ -1234,15 +1235,14 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol, apply_fir = req == ANC_APPLY_FIR || req == ANC_APPLY_FIR_IIR; apply_fir = req == ANC_APPLY_FIR || req == ANC_APPLY_FIR_IIR; apply_iir = req == ANC_APPLY_IIR || req == ANC_APPLY_FIR_IIR; apply_iir = req == ANC_APPLY_IIR || req == ANC_APPLY_FIR_IIR; status = snd_soc_dapm_force_enable_pin(&codec->dapm, status = snd_soc_dapm_force_enable_pin(dapm, "ANC Configure Input"); "ANC Configure Input"); if (status < 0) { if (status < 0) { dev_err(dev, dev_err(dev, "%s: ERROR: Failed to enable power (status = %d)!\n", "%s: ERROR: Failed to enable power (status = %d)!\n", __func__, status); __func__, status); goto cleanup; goto cleanup; } } snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm); anc_configure(codec, apply_fir, apply_iir); anc_configure(codec, apply_fir, apply_iir); Loading @@ -1259,8 +1259,8 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol, drvdata->anc_status = ANC_IIR_CONFIGURED; drvdata->anc_status = ANC_IIR_CONFIGURED; } } status = snd_soc_dapm_disable_pin(&codec->dapm, "ANC Configure Input"); status = snd_soc_dapm_disable_pin(dapm, "ANC Configure Input"); snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm); cleanup: cleanup: mutex_unlock(&drvdata->ctrl_lock); mutex_unlock(&drvdata->ctrl_lock); Loading Loading @@ -1947,6 +1947,7 @@ static int ab8500_audio_init_audioblock(struct snd_soc_codec *codec) static int ab8500_audio_setup_mics(struct snd_soc_codec *codec, static int ab8500_audio_setup_mics(struct snd_soc_codec *codec, struct amic_settings *amics) struct amic_settings *amics) { { struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); u8 value8; u8 value8; unsigned int value; unsigned int value; int status; int status; Loading @@ -1973,15 +1974,15 @@ static int ab8500_audio_setup_mics(struct snd_soc_codec *codec, dev_dbg(codec->dev, "%s: Mic 1a regulator: %s\n", __func__, dev_dbg(codec->dev, "%s: Mic 1a regulator: %s\n", __func__, amic_micbias_str(amics->mic1a_micbias)); amic_micbias_str(amics->mic1a_micbias)); route = &ab8500_dapm_routes_mic1a_vamicx[amics->mic1a_micbias]; route = &ab8500_dapm_routes_mic1a_vamicx[amics->mic1a_micbias]; status = snd_soc_dapm_add_routes(&codec->dapm, route, 1); status = snd_soc_dapm_add_routes(dapm, route, 1); dev_dbg(codec->dev, "%s: Mic 1b regulator: %s\n", __func__, dev_dbg(codec->dev, "%s: Mic 1b regulator: %s\n", __func__, amic_micbias_str(amics->mic1b_micbias)); amic_micbias_str(amics->mic1b_micbias)); route = &ab8500_dapm_routes_mic1b_vamicx[amics->mic1b_micbias]; route = &ab8500_dapm_routes_mic1b_vamicx[amics->mic1b_micbias]; status |= snd_soc_dapm_add_routes(&codec->dapm, route, 1); status |= snd_soc_dapm_add_routes(dapm, route, 1); dev_dbg(codec->dev, "%s: Mic 2 regulator: %s\n", __func__, dev_dbg(codec->dev, "%s: Mic 2 regulator: %s\n", __func__, amic_micbias_str(amics->mic2_micbias)); amic_micbias_str(amics->mic2_micbias)); route = &ab8500_dapm_routes_mic2_vamicx[amics->mic2_micbias]; route = &ab8500_dapm_routes_mic2_vamicx[amics->mic2_micbias]; status |= snd_soc_dapm_add_routes(&codec->dapm, route, 1); status |= snd_soc_dapm_add_routes(dapm, route, 1); if (status < 0) { if (status < 0) { dev_err(codec->dev, dev_err(codec->dev, "%s: Failed to add AMic-regulator DAPM-routes (%d).\n", "%s: Failed to add AMic-regulator DAPM-routes (%d).\n", Loading Loading @@ -2461,6 +2462,7 @@ static void ab8500_codec_of_probe(struct device *dev, struct device_node *np, static int ab8500_codec_probe(struct snd_soc_codec *codec) static int ab8500_codec_probe(struct snd_soc_codec *codec) { { struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct device *dev = codec->dev; struct device *dev = codec->dev; struct device_node *np = dev->of_node; struct device_node *np = dev->of_node; struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); Loading Loading @@ -2541,7 +2543,7 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec) &ab8500_filter_controls[AB8500_FILTER_SID_FIR].private_value; &ab8500_filter_controls[AB8500_FILTER_SID_FIR].private_value; drvdata->sid_fir_values = (long *)fc->value; drvdata->sid_fir_values = (long *)fc->value; (void)snd_soc_dapm_disable_pin(&codec->dapm, "ANC Configure Input"); snd_soc_dapm_disable_pin(dapm, "ANC Configure Input"); mutex_init(&drvdata->ctrl_lock); mutex_init(&drvdata->ctrl_lock); Loading
sound/soc/codecs/adau1373.c +0 −1 Original line number Original line Diff line number Diff line Loading @@ -1444,7 +1444,6 @@ static int adau1373_set_bias_level(struct snd_soc_codec *codec, ADAU1373_PWDN_CTRL3_PWR_EN, 0); ADAU1373_PWDN_CTRL3_PWR_EN, 0); break; break; } } codec->dapm.bias_level = level; return 0; return 0; } } Loading