Skip to content

Commit

Permalink
Merge remote-tracking branches 'asoc/topic/wm8961', 'asoc/topic/wm896…
Browse files Browse the repository at this point in the history
…2', 'asoc/topic/wm8974', 'asoc/topic/wm8983', 'asoc/topic/wm8988', 'asoc/topic/wm8990', 'asoc/topic/wm8991', 'asoc/topic/wm8993' and 'asoc/topic/wm8994' into asoc-next
  • Loading branch information
Mark Brown committed Mar 12, 2014
10 parents 543f190 + a6616cd + d7f31d3 + de461bd + 060ec80 + b13a054 + 830b501 + d07338b + 180c275 + abc4b4f commit 139f4b8
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 157 deletions.
16 changes: 8 additions & 8 deletions sound/soc/codecs/wm8961.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,15 @@ static const char *adc_hpf_text[] = {
"Hi-fi", "Voice 1", "Voice 2", "Voice 3",
};

static const struct soc_enum adc_hpf =
SOC_ENUM_SINGLE(WM8961_ADC_DAC_CONTROL_2, 7, 4, adc_hpf_text);
static SOC_ENUM_SINGLE_DECL(adc_hpf,
WM8961_ADC_DAC_CONTROL_2, 7, adc_hpf_text);

static const char *dac_deemph_text[] = {
"None", "32kHz", "44.1kHz", "48kHz",
};

static const struct soc_enum dac_deemph =
SOC_ENUM_SINGLE(WM8961_ADC_DAC_CONTROL_1, 1, 4, dac_deemph_text);
static SOC_ENUM_SINGLE_DECL(dac_deemph,
WM8961_ADC_DAC_CONTROL_1, 1, dac_deemph_text);

static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
static const DECLARE_TLV_DB_SCALE(hp_sec_tlv, -700, 100, 0);
Expand Down Expand Up @@ -385,11 +385,11 @@ static const char *sidetone_text[] = {
"None", "Left", "Right"
};

static const struct soc_enum dacl_sidetone =
SOC_ENUM_SINGLE(WM8961_DSP_SIDETONE_0, 2, 3, sidetone_text);
static SOC_ENUM_SINGLE_DECL(dacl_sidetone,
WM8961_DSP_SIDETONE_0, 2, sidetone_text);

static const struct soc_enum dacr_sidetone =
SOC_ENUM_SINGLE(WM8961_DSP_SIDETONE_1, 2, 3, sidetone_text);
static SOC_ENUM_SINGLE_DECL(dacr_sidetone,
WM8961_DSP_SIDETONE_1, 2, sidetone_text);

static const struct snd_kcontrol_new dacl_mux =
SOC_DAPM_ENUM("DACL Sidetone", dacl_sidetone);
Expand Down
67 changes: 43 additions & 24 deletions sound/soc/codecs/wm8962.c
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,9 @@ static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);

static int wm8962_dsp2_write_config(struct snd_soc_codec *codec)
{
return regcache_sync_region(codec->control_data,
struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);

return regcache_sync_region(wm8962->regmap,
WM8962_HDBASS_AI_1, WM8962_MAX_REGISTER);
}

Expand Down Expand Up @@ -1658,16 +1660,16 @@ static const char *cap_hpf_mode_text[] = {
"Hi-fi", "Application"
};

static const struct soc_enum cap_hpf_mode =
SOC_ENUM_SINGLE(WM8962_ADC_DAC_CONTROL_2, 10, 2, cap_hpf_mode_text);
static SOC_ENUM_SINGLE_DECL(cap_hpf_mode,
WM8962_ADC_DAC_CONTROL_2, 10, cap_hpf_mode_text);


static const char *cap_lhpf_mode_text[] = {
"LPF", "HPF"
};

static const struct soc_enum cap_lhpf_mode =
SOC_ENUM_SINGLE(WM8962_LHPF1, 1, 2, cap_lhpf_mode_text);
static SOC_ENUM_SINGLE_DECL(cap_lhpf_mode,
WM8962_LHPF1, 1, cap_lhpf_mode_text);

static const struct snd_kcontrol_new wm8962_snd_controls[] = {
SOC_DOUBLE("Input Mixer Switch", WM8962_INPUT_MIXER_CONTROL_1, 3, 2, 1, 1),
Expand Down Expand Up @@ -2014,40 +2016,40 @@ static int dsp2_event(struct snd_soc_dapm_widget *w,

static const char *st_text[] = { "None", "Left", "Right" };

static const struct soc_enum str_enum =
SOC_ENUM_SINGLE(WM8962_DAC_DSP_MIXING_1, 2, 3, st_text);
static SOC_ENUM_SINGLE_DECL(str_enum,
WM8962_DAC_DSP_MIXING_1, 2, st_text);

static const struct snd_kcontrol_new str_mux =
SOC_DAPM_ENUM("Right Sidetone", str_enum);

static const struct soc_enum stl_enum =
SOC_ENUM_SINGLE(WM8962_DAC_DSP_MIXING_2, 2, 3, st_text);
static SOC_ENUM_SINGLE_DECL(stl_enum,
WM8962_DAC_DSP_MIXING_2, 2, st_text);

static const struct snd_kcontrol_new stl_mux =
SOC_DAPM_ENUM("Left Sidetone", stl_enum);

static const char *outmux_text[] = { "DAC", "Mixer" };

static const struct soc_enum spkoutr_enum =
SOC_ENUM_SINGLE(WM8962_SPEAKER_MIXER_2, 7, 2, outmux_text);
static SOC_ENUM_SINGLE_DECL(spkoutr_enum,
WM8962_SPEAKER_MIXER_2, 7, outmux_text);

static const struct snd_kcontrol_new spkoutr_mux =
SOC_DAPM_ENUM("SPKOUTR Mux", spkoutr_enum);

static const struct soc_enum spkoutl_enum =
SOC_ENUM_SINGLE(WM8962_SPEAKER_MIXER_1, 7, 2, outmux_text);
static SOC_ENUM_SINGLE_DECL(spkoutl_enum,
WM8962_SPEAKER_MIXER_1, 7, outmux_text);

static const struct snd_kcontrol_new spkoutl_mux =
SOC_DAPM_ENUM("SPKOUTL Mux", spkoutl_enum);

static const struct soc_enum hpoutr_enum =
SOC_ENUM_SINGLE(WM8962_HEADPHONE_MIXER_2, 7, 2, outmux_text);
static SOC_ENUM_SINGLE_DECL(hpoutr_enum,
WM8962_HEADPHONE_MIXER_2, 7, outmux_text);

static const struct snd_kcontrol_new hpoutr_mux =
SOC_DAPM_ENUM("HPOUTR Mux", hpoutr_enum);

static const struct soc_enum hpoutl_enum =
SOC_ENUM_SINGLE(WM8962_HEADPHONE_MIXER_1, 7, 2, outmux_text);
static SOC_ENUM_SINGLE_DECL(hpoutl_enum,
WM8962_HEADPHONE_MIXER_1, 7, outmux_text);

static const struct snd_kcontrol_new hpoutl_mux =
SOC_DAPM_ENUM("HPOUTL Mux", hpoutl_enum);
Expand Down Expand Up @@ -2884,18 +2886,20 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
snd_soc_write(codec, WM8962_FLL_CONTROL_7, fll_div.lambda);
snd_soc_write(codec, WM8962_FLL_CONTROL_8, fll_div.n);

try_wait_for_completion(&wm8962->fll_lock);
reinit_completion(&wm8962->fll_lock);

pm_runtime_get_sync(codec->dev);
ret = pm_runtime_get_sync(codec->dev);
if (ret < 0) {
dev_err(codec->dev, "Failed to resume device: %d\n", ret);
return ret;
}

snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1,
WM8962_FLL_FRAC | WM8962_FLL_REFCLK_SRC_MASK |
WM8962_FLL_ENA, fll1 | WM8962_FLL_ENA);

dev_dbg(codec->dev, "FLL configured for %dHz->%dHz\n", Fref, Fout);

ret = 0;

/* This should be a massive overestimate but go even
* higher if we'll error out
*/
Expand All @@ -2909,14 +2913,17 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source,

if (timeout == 0 && wm8962->irq) {
dev_err(codec->dev, "FLL lock timed out");
ret = -ETIMEDOUT;
snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1,
WM8962_FLL_ENA, 0);
pm_runtime_put(codec->dev);
return -ETIMEDOUT;
}

wm8962->fll_fref = Fref;
wm8962->fll_fout = Fout;
wm8962->fll_src = source;

return ret;
return 0;
}

static int wm8962_mute(struct snd_soc_dai *dai, int mute)
Expand Down Expand Up @@ -3003,24 +3010,34 @@ static irqreturn_t wm8962_irq(int irq, void *data)
unsigned int active;
int reg, ret;

ret = pm_runtime_get_sync(dev);
if (ret < 0) {
dev_err(dev, "Failed to resume: %d\n", ret);
return IRQ_NONE;
}

ret = regmap_read(wm8962->regmap, WM8962_INTERRUPT_STATUS_2_MASK,
&mask);
if (ret != 0) {
pm_runtime_put(dev);
dev_err(dev, "Failed to read interrupt mask: %d\n",
ret);
return IRQ_NONE;
}

ret = regmap_read(wm8962->regmap, WM8962_INTERRUPT_STATUS_2, &active);
if (ret != 0) {
pm_runtime_put(dev);
dev_err(dev, "Failed to read interrupt: %d\n", ret);
return IRQ_NONE;
}

active &= ~mask;

if (!active)
if (!active) {
pm_runtime_put(dev);
return IRQ_NONE;
}

/* Acknowledge the interrupts */
ret = regmap_write(wm8962->regmap, WM8962_INTERRUPT_STATUS_2, active);
Expand Down Expand Up @@ -3070,6 +3087,8 @@ static irqreturn_t wm8962_irq(int irq, void *data)
msecs_to_jiffies(250));
}

pm_runtime_put(dev);

return IRQ_HANDLED;
}

Expand Down
4 changes: 2 additions & 2 deletions sound/soc/codecs/wm8974.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ static const struct soc_enum wm8974_enum[] = {

static const char *wm8974_auxmode_text[] = { "Buffer", "Mixer" };

static const struct soc_enum wm8974_auxmode =
SOC_ENUM_SINGLE(WM8974_INPUT, 3, 2, wm8974_auxmode_text);
static SOC_ENUM_SINGLE_DECL(wm8974_auxmode,
WM8974_INPUT, 3, wm8974_auxmode_text);

static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1);
static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
Expand Down
6 changes: 3 additions & 3 deletions sound/soc/codecs/wm8983.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ static struct spi_driver wm8983_spi_driver = {
};
#endif

#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
#if IS_ENABLED(CONFIG_I2C)
static int wm8983_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
Expand Down Expand Up @@ -1177,7 +1177,7 @@ static int __init wm8983_modinit(void)
{
int ret = 0;

#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
#if IS_ENABLED(CONFIG_I2C)
ret = i2c_add_driver(&wm8983_i2c_driver);
if (ret) {
printk(KERN_ERR "Failed to register wm8983 I2C driver: %d\n",
Expand All @@ -1197,7 +1197,7 @@ module_init(wm8983_modinit);

static void __exit wm8983_exit(void)
{
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
#if IS_ENABLED(CONFIG_I2C)
i2c_del_driver(&wm8983_i2c_driver);
#endif
#if defined(CONFIG_SPI_MASTER)
Expand Down
62 changes: 31 additions & 31 deletions sound/soc/codecs/wm8988.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static bool wm8988_writeable(struct device *dev, unsigned int reg)
struct wm8988_priv {
struct regmap *regmap;
unsigned int sysclk;
struct snd_pcm_hw_constraint_list *sysclk_constraints;
const struct snd_pcm_hw_constraint_list *sysclk_constraints;
};

#define wm8988_reset(c) snd_soc_write(c, WM8988_RESET, 0)
Expand All @@ -126,46 +126,46 @@ struct wm8988_priv {
*/

static const char *bass_boost_txt[] = {"Linear Control", "Adaptive Boost"};
static const struct soc_enum bass_boost =
SOC_ENUM_SINGLE(WM8988_BASS, 7, 2, bass_boost_txt);
static SOC_ENUM_SINGLE_DECL(bass_boost,
WM8988_BASS, 7, bass_boost_txt);

static const char *bass_filter_txt[] = { "130Hz @ 48kHz", "200Hz @ 48kHz" };
static const struct soc_enum bass_filter =
SOC_ENUM_SINGLE(WM8988_BASS, 6, 2, bass_filter_txt);
static SOC_ENUM_SINGLE_DECL(bass_filter,
WM8988_BASS, 6, bass_filter_txt);

static const char *treble_txt[] = {"8kHz", "4kHz"};
static const struct soc_enum treble =
SOC_ENUM_SINGLE(WM8988_TREBLE, 6, 2, treble_txt);
static SOC_ENUM_SINGLE_DECL(treble,
WM8988_TREBLE, 6, treble_txt);

static const char *stereo_3d_lc_txt[] = {"200Hz", "500Hz"};
static const struct soc_enum stereo_3d_lc =
SOC_ENUM_SINGLE(WM8988_3D, 5, 2, stereo_3d_lc_txt);
static SOC_ENUM_SINGLE_DECL(stereo_3d_lc,
WM8988_3D, 5, stereo_3d_lc_txt);

static const char *stereo_3d_uc_txt[] = {"2.2kHz", "1.5kHz"};
static const struct soc_enum stereo_3d_uc =
SOC_ENUM_SINGLE(WM8988_3D, 6, 2, stereo_3d_uc_txt);
static SOC_ENUM_SINGLE_DECL(stereo_3d_uc,
WM8988_3D, 6, stereo_3d_uc_txt);

static const char *stereo_3d_func_txt[] = {"Capture", "Playback"};
static const struct soc_enum stereo_3d_func =
SOC_ENUM_SINGLE(WM8988_3D, 7, 2, stereo_3d_func_txt);
static SOC_ENUM_SINGLE_DECL(stereo_3d_func,
WM8988_3D, 7, stereo_3d_func_txt);

static const char *alc_func_txt[] = {"Off", "Right", "Left", "Stereo"};
static const struct soc_enum alc_func =
SOC_ENUM_SINGLE(WM8988_ALC1, 7, 4, alc_func_txt);
static SOC_ENUM_SINGLE_DECL(alc_func,
WM8988_ALC1, 7, alc_func_txt);

static const char *ng_type_txt[] = {"Constant PGA Gain",
"Mute ADC Output"};
static const struct soc_enum ng_type =
SOC_ENUM_SINGLE(WM8988_NGATE, 1, 2, ng_type_txt);
static SOC_ENUM_SINGLE_DECL(ng_type,
WM8988_NGATE, 1, ng_type_txt);

static const char *deemph_txt[] = {"None", "32Khz", "44.1Khz", "48Khz"};
static const struct soc_enum deemph =
SOC_ENUM_SINGLE(WM8988_ADCDAC, 1, 4, deemph_txt);
static SOC_ENUM_SINGLE_DECL(deemph,
WM8988_ADCDAC, 1, deemph_txt);

static const char *adcpol_txt[] = {"Normal", "L Invert", "R Invert",
"L + R Invert"};
static const struct soc_enum adcpol =
SOC_ENUM_SINGLE(WM8988_ADCDAC, 5, 4, adcpol_txt);
static SOC_ENUM_SINGLE_DECL(adcpol,
WM8988_ADCDAC, 5, adcpol_txt);

static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0);
static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
Expand Down Expand Up @@ -317,16 +317,16 @@ static const struct snd_kcontrol_new wm8988_right_pga_controls =

/* Differential Mux */
static const char *wm8988_diff_sel[] = {"Line 1", "Line 2"};
static const struct soc_enum diffmux =
SOC_ENUM_SINGLE(WM8988_ADCIN, 8, 2, wm8988_diff_sel);
static SOC_ENUM_SINGLE_DECL(diffmux,
WM8988_ADCIN, 8, wm8988_diff_sel);
static const struct snd_kcontrol_new wm8988_diffmux_controls =
SOC_DAPM_ENUM("Route", diffmux);

/* Mono ADC Mux */
static const char *wm8988_mono_mux[] = {"Stereo", "Mono (Left)",
"Mono (Right)", "Digital Mono"};
static const struct soc_enum monomux =
SOC_ENUM_SINGLE(WM8988_ADCIN, 6, 4, wm8988_mono_mux);
static SOC_ENUM_SINGLE_DECL(monomux,
WM8988_ADCIN, 6, wm8988_mono_mux);
static const struct snd_kcontrol_new wm8988_monomux_controls =
SOC_DAPM_ENUM("Route", monomux);

Expand Down Expand Up @@ -521,30 +521,30 @@ static inline int get_coeff(int mclk, int rate)

/* The set of rates we can generate from the above for each SYSCLK */

static unsigned int rates_12288[] = {
static const unsigned int rates_12288[] = {
8000, 12000, 16000, 24000, 24000, 32000, 48000, 96000,
};

static struct snd_pcm_hw_constraint_list constraints_12288 = {
static const struct snd_pcm_hw_constraint_list constraints_12288 = {
.count = ARRAY_SIZE(rates_12288),
.list = rates_12288,
};

static unsigned int rates_112896[] = {
static const unsigned int rates_112896[] = {
8000, 11025, 22050, 44100,
};

static struct snd_pcm_hw_constraint_list constraints_112896 = {
static const struct snd_pcm_hw_constraint_list constraints_112896 = {
.count = ARRAY_SIZE(rates_112896),
.list = rates_112896,
};

static unsigned int rates_12[] = {
static const unsigned int rates_12[] = {
8000, 11025, 12000, 16000, 22050, 2400, 32000, 41100, 48000,
48000, 88235, 96000,
};

static struct snd_pcm_hw_constraint_list constraints_12 = {
static const struct snd_pcm_hw_constraint_list constraints_12 = {
.count = ARRAY_SIZE(rates_12),
.list = rates_12,
};
Expand Down
Loading

0 comments on commit 139f4b8

Please sign in to comment.