Commit e7ca8fcd authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/wm8753' and 'asoc/topic/wm8985' into asoc-next

...@@ -1002,7 +1002,8 @@ config SND_SOC_WM8983 ...@@ -1002,7 +1002,8 @@ config SND_SOC_WM8983
tristate tristate
config SND_SOC_WM8985 config SND_SOC_WM8985
tristate tristate "Wolfson Microelectronics WM8985 and WM8758 codec driver"
depends on SND_SOC_I2C_AND_SPI
config SND_SOC_WM8988 config SND_SOC_WM8988
tristate tristate
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -486,7 +485,7 @@ SND_SOC_DAPM_DAC("Voice DAC", "Voice Playback", WM8753_PWR1, 4, 0), ...@@ -486,7 +485,7 @@ SND_SOC_DAPM_DAC("Voice DAC", "Voice Playback", WM8753_PWR1, 4, 0),
SND_SOC_DAPM_OUTPUT("MONO1"), SND_SOC_DAPM_OUTPUT("MONO1"),
SND_SOC_DAPM_MUX("Mono 2 Mux", SND_SOC_NOPM, 0, 0, &wm8753_mono2_controls), SND_SOC_DAPM_MUX("Mono 2 Mux", SND_SOC_NOPM, 0, 0, &wm8753_mono2_controls),
SND_SOC_DAPM_OUTPUT("MONO2"), SND_SOC_DAPM_OUTPUT("MONO2"),
SND_SOC_DAPM_MIXER("Out3 Left + Right", -1, 0, 0, NULL, 0), SND_SOC_DAPM_MIXER("Out3 Left + Right", SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_MUX("Out3 Mux", SND_SOC_NOPM, 0, 0, &wm8753_out3_controls), SND_SOC_DAPM_MUX("Out3 Mux", SND_SOC_NOPM, 0, 0, &wm8753_out3_controls),
SND_SOC_DAPM_PGA("Out 3", WM8753_PWR3, 4, 0, NULL, 0), SND_SOC_DAPM_PGA("Out 3", WM8753_PWR3, 4, 0, NULL, 0),
SND_SOC_DAPM_OUTPUT("OUT3"), SND_SOC_DAPM_OUTPUT("OUT3"),
......
/* /*
* wm8985.c -- WM8985 ALSA SoC Audio driver * wm8985.c -- WM8985 / WM8758 ALSA SoC Audio driver
* *
* Copyright 2010 Wolfson Microelectronics plc * Copyright 2010 Wolfson Microelectronics plc
*
* Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
* *
* WM8758 support:
* Copyright: 2016 Barix AG
* Author: Petr Kulhavy <petr@barix.com>
*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
...@@ -40,6 +43,11 @@ static const char *wm8985_supply_names[WM8985_NUM_SUPPLIES] = { ...@@ -40,6 +43,11 @@ static const char *wm8985_supply_names[WM8985_NUM_SUPPLIES] = {
"AVDD2" "AVDD2"
}; };
enum wm8985_type {
WM8985,
WM8758,
};
static const struct reg_default wm8985_reg_defaults[] = { static const struct reg_default wm8985_reg_defaults[] = {
{ 1, 0x0000 }, /* R1 - Power management 1 */ { 1, 0x0000 }, /* R1 - Power management 1 */
{ 2, 0x0000 }, /* R2 - Power management 2 */ { 2, 0x0000 }, /* R2 - Power management 2 */
...@@ -181,6 +189,7 @@ static const int volume_update_regs[] = { ...@@ -181,6 +189,7 @@ static const int volume_update_regs[] = {
struct wm8985_priv { struct wm8985_priv {
struct regmap *regmap; struct regmap *regmap;
struct regulator_bulk_data supplies[WM8985_NUM_SUPPLIES]; struct regulator_bulk_data supplies[WM8985_NUM_SUPPLIES];
enum wm8985_type dev_type;
unsigned int sysclk; unsigned int sysclk;
unsigned int bclk; unsigned int bclk;
}; };
...@@ -289,7 +298,7 @@ static const char *depth_3d_text[] = { ...@@ -289,7 +298,7 @@ static const char *depth_3d_text[] = {
}; };
static SOC_ENUM_SINGLE_DECL(depth_3d, WM8985_3D_CONTROL, 0, depth_3d_text); static SOC_ENUM_SINGLE_DECL(depth_3d, WM8985_3D_CONTROL, 0, depth_3d_text);
static const struct snd_kcontrol_new wm8985_snd_controls[] = { static const struct snd_kcontrol_new wm8985_common_snd_controls[] = {
SOC_SINGLE("Digital Loopback Switch", WM8985_COMPANDING_CONTROL, SOC_SINGLE("Digital Loopback Switch", WM8985_COMPANDING_CONTROL,
0, 1, 0), 0, 1, 0),
...@@ -355,10 +364,6 @@ static const struct snd_kcontrol_new wm8985_snd_controls[] = { ...@@ -355,10 +364,6 @@ static const struct snd_kcontrol_new wm8985_snd_controls[] = {
SOC_ENUM("High Pass Filter Mode", filter_mode), SOC_ENUM("High Pass Filter Mode", filter_mode),
SOC_SINGLE("High Pass Filter Cutoff", WM8985_ADC_CONTROL, 4, 7, 0), SOC_SINGLE("High Pass Filter Cutoff", WM8985_ADC_CONTROL, 4, 7, 0),
SOC_DOUBLE_R_TLV("Aux Bypass Volume",
WM8985_LEFT_MIXER_CTRL, WM8985_RIGHT_MIXER_CTRL, 6, 7, 0,
aux_tlv),
SOC_DOUBLE_R_TLV("Input PGA Bypass Volume", SOC_DOUBLE_R_TLV("Input PGA Bypass Volume",
WM8985_LEFT_MIXER_CTRL, WM8985_RIGHT_MIXER_CTRL, 2, 7, 0, WM8985_LEFT_MIXER_CTRL, WM8985_RIGHT_MIXER_CTRL, 2, 7, 0,
bypass_tlv), bypass_tlv),
...@@ -379,20 +384,30 @@ static const struct snd_kcontrol_new wm8985_snd_controls[] = { ...@@ -379,20 +384,30 @@ static const struct snd_kcontrol_new wm8985_snd_controls[] = {
SOC_SINGLE_TLV("EQ5 Volume", WM8985_EQ5_HIGH_SHELF, 0, 24, 1, eq_tlv), SOC_SINGLE_TLV("EQ5 Volume", WM8985_EQ5_HIGH_SHELF, 0, 24, 1, eq_tlv),
SOC_ENUM("3D Depth", depth_3d), SOC_ENUM("3D Depth", depth_3d),
};
static const struct snd_kcontrol_new wm8985_specific_snd_controls[] = {
SOC_DOUBLE_R_TLV("Aux Bypass Volume",
WM8985_LEFT_MIXER_CTRL, WM8985_RIGHT_MIXER_CTRL, 6, 7, 0,
aux_tlv),
SOC_ENUM("Speaker Mode", speaker_mode) SOC_ENUM("Speaker Mode", speaker_mode)
}; };
static const struct snd_kcontrol_new left_out_mixer[] = { static const struct snd_kcontrol_new left_out_mixer[] = {
SOC_DAPM_SINGLE("Line Switch", WM8985_LEFT_MIXER_CTRL, 1, 1, 0), SOC_DAPM_SINGLE("Line Switch", WM8985_LEFT_MIXER_CTRL, 1, 1, 0),
SOC_DAPM_SINGLE("Aux Switch", WM8985_LEFT_MIXER_CTRL, 5, 1, 0),
SOC_DAPM_SINGLE("PCM Switch", WM8985_LEFT_MIXER_CTRL, 0, 1, 0), SOC_DAPM_SINGLE("PCM Switch", WM8985_LEFT_MIXER_CTRL, 0, 1, 0),
/* --- WM8985 only --- */
SOC_DAPM_SINGLE("Aux Switch", WM8985_LEFT_MIXER_CTRL, 5, 1, 0),
}; };
static const struct snd_kcontrol_new right_out_mixer[] = { static const struct snd_kcontrol_new right_out_mixer[] = {
SOC_DAPM_SINGLE("Line Switch", WM8985_RIGHT_MIXER_CTRL, 1, 1, 0), SOC_DAPM_SINGLE("Line Switch", WM8985_RIGHT_MIXER_CTRL, 1, 1, 0),
SOC_DAPM_SINGLE("Aux Switch", WM8985_RIGHT_MIXER_CTRL, 5, 1, 0),
SOC_DAPM_SINGLE("PCM Switch", WM8985_RIGHT_MIXER_CTRL, 0, 1, 0), SOC_DAPM_SINGLE("PCM Switch", WM8985_RIGHT_MIXER_CTRL, 0, 1, 0),
/* --- WM8985 only --- */
SOC_DAPM_SINGLE("Aux Switch", WM8985_RIGHT_MIXER_CTRL, 5, 1, 0),
}; };
static const struct snd_kcontrol_new left_input_mixer[] = { static const struct snd_kcontrol_new left_input_mixer[] = {
...@@ -410,6 +425,8 @@ static const struct snd_kcontrol_new right_input_mixer[] = { ...@@ -410,6 +425,8 @@ static const struct snd_kcontrol_new right_input_mixer[] = {
static const struct snd_kcontrol_new left_boost_mixer[] = { static const struct snd_kcontrol_new left_boost_mixer[] = {
SOC_DAPM_SINGLE_TLV("L2 Volume", WM8985_LEFT_ADC_BOOST_CTRL, SOC_DAPM_SINGLE_TLV("L2 Volume", WM8985_LEFT_ADC_BOOST_CTRL,
4, 7, 0, boost_tlv), 4, 7, 0, boost_tlv),
/* --- WM8985 only --- */
SOC_DAPM_SINGLE_TLV("AUXL Volume", WM8985_LEFT_ADC_BOOST_CTRL, SOC_DAPM_SINGLE_TLV("AUXL Volume", WM8985_LEFT_ADC_BOOST_CTRL,
0, 7, 0, boost_tlv) 0, 7, 0, boost_tlv)
}; };
...@@ -417,11 +434,13 @@ static const struct snd_kcontrol_new left_boost_mixer[] = { ...@@ -417,11 +434,13 @@ static const struct snd_kcontrol_new left_boost_mixer[] = {
static const struct snd_kcontrol_new right_boost_mixer[] = { static const struct snd_kcontrol_new right_boost_mixer[] = {
SOC_DAPM_SINGLE_TLV("R2 Volume", WM8985_RIGHT_ADC_BOOST_CTRL, SOC_DAPM_SINGLE_TLV("R2 Volume", WM8985_RIGHT_ADC_BOOST_CTRL,
4, 7, 0, boost_tlv), 4, 7, 0, boost_tlv),
/* --- WM8985 only --- */
SOC_DAPM_SINGLE_TLV("AUXR Volume", WM8985_RIGHT_ADC_BOOST_CTRL, SOC_DAPM_SINGLE_TLV("AUXR Volume", WM8985_RIGHT_ADC_BOOST_CTRL,
0, 7, 0, boost_tlv) 0, 7, 0, boost_tlv)
}; };
static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { static const struct snd_soc_dapm_widget wm8985_common_dapm_widgets[] = {
SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8985_POWER_MANAGEMENT_3, SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8985_POWER_MANAGEMENT_3,
0, 0), 0, 0),
SND_SOC_DAPM_DAC("Right DAC", "Right Playback", WM8985_POWER_MANAGEMENT_3, SND_SOC_DAPM_DAC("Right DAC", "Right Playback", WM8985_POWER_MANAGEMENT_3,
...@@ -431,21 +450,11 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { ...@@ -431,21 +450,11 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = {
SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8985_POWER_MANAGEMENT_2, SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8985_POWER_MANAGEMENT_2,
1, 0), 1, 0),
SND_SOC_DAPM_MIXER("Left Output Mixer", WM8985_POWER_MANAGEMENT_3,
2, 0, left_out_mixer, ARRAY_SIZE(left_out_mixer)),
SND_SOC_DAPM_MIXER("Right Output Mixer", WM8985_POWER_MANAGEMENT_3,
3, 0, right_out_mixer, ARRAY_SIZE(right_out_mixer)),
SND_SOC_DAPM_MIXER("Left Input Mixer", WM8985_POWER_MANAGEMENT_2, SND_SOC_DAPM_MIXER("Left Input Mixer", WM8985_POWER_MANAGEMENT_2,
2, 0, left_input_mixer, ARRAY_SIZE(left_input_mixer)), 2, 0, left_input_mixer, ARRAY_SIZE(left_input_mixer)),
SND_SOC_DAPM_MIXER("Right Input Mixer", WM8985_POWER_MANAGEMENT_2, SND_SOC_DAPM_MIXER("Right Input Mixer", WM8985_POWER_MANAGEMENT_2,
3, 0, right_input_mixer, ARRAY_SIZE(right_input_mixer)), 3, 0, right_input_mixer, ARRAY_SIZE(right_input_mixer)),
SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8985_POWER_MANAGEMENT_2,
4, 0, left_boost_mixer, ARRAY_SIZE(left_boost_mixer)),
SND_SOC_DAPM_MIXER("Right Boost Mixer", WM8985_POWER_MANAGEMENT_2,
5, 0, right_boost_mixer, ARRAY_SIZE(right_boost_mixer)),
SND_SOC_DAPM_PGA("Left Capture PGA", WM8985_LEFT_INP_PGA_GAIN_CTRL, SND_SOC_DAPM_PGA("Left Capture PGA", WM8985_LEFT_INP_PGA_GAIN_CTRL,
6, 1, NULL, 0), 6, 1, NULL, 0),
SND_SOC_DAPM_PGA("Right Capture PGA", WM8985_RIGHT_INP_PGA_GAIN_CTRL, SND_SOC_DAPM_PGA("Right Capture PGA", WM8985_RIGHT_INP_PGA_GAIN_CTRL,
...@@ -468,8 +477,6 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { ...@@ -468,8 +477,6 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = {
SND_SOC_DAPM_INPUT("LIP"), SND_SOC_DAPM_INPUT("LIP"),
SND_SOC_DAPM_INPUT("RIN"), SND_SOC_DAPM_INPUT("RIN"),
SND_SOC_DAPM_INPUT("RIP"), SND_SOC_DAPM_INPUT("RIP"),
SND_SOC_DAPM_INPUT("AUXL"),
SND_SOC_DAPM_INPUT("AUXR"),
SND_SOC_DAPM_INPUT("L2"), SND_SOC_DAPM_INPUT("L2"),
SND_SOC_DAPM_INPUT("R2"), SND_SOC_DAPM_INPUT("R2"),
SND_SOC_DAPM_OUTPUT("HPL"), SND_SOC_DAPM_OUTPUT("HPL"),
...@@ -478,13 +485,42 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { ...@@ -478,13 +485,42 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("SPKR") SND_SOC_DAPM_OUTPUT("SPKR")
}; };
static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = {
SND_SOC_DAPM_MIXER("Left Output Mixer", WM8985_POWER_MANAGEMENT_3,
2, 0, left_out_mixer, ARRAY_SIZE(left_out_mixer)),
SND_SOC_DAPM_MIXER("Right Output Mixer", WM8985_POWER_MANAGEMENT_3,
3, 0, right_out_mixer, ARRAY_SIZE(right_out_mixer)),
SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8985_POWER_MANAGEMENT_2,
4, 0, left_boost_mixer, ARRAY_SIZE(left_boost_mixer)),
SND_SOC_DAPM_MIXER("Right Boost Mixer", WM8985_POWER_MANAGEMENT_2,
5, 0, right_boost_mixer, ARRAY_SIZE(right_boost_mixer)),
SND_SOC_DAPM_INPUT("AUXL"),
SND_SOC_DAPM_INPUT("AUXR"),
};
static const struct snd_soc_dapm_widget wm8758_dapm_widgets[] = {
SND_SOC_DAPM_MIXER("Left Output Mixer", WM8985_POWER_MANAGEMENT_3,
2, 0, left_out_mixer,
ARRAY_SIZE(left_out_mixer) - 1),
SND_SOC_DAPM_MIXER("Right Output Mixer", WM8985_POWER_MANAGEMENT_3,
3, 0, right_out_mixer,
ARRAY_SIZE(right_out_mixer) - 1),
SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8985_POWER_MANAGEMENT_2,
4, 0, left_boost_mixer,
ARRAY_SIZE(left_boost_mixer) - 1),
SND_SOC_DAPM_MIXER("Right Boost Mixer", WM8985_POWER_MANAGEMENT_2,
5, 0, right_boost_mixer,
ARRAY_SIZE(right_boost_mixer) - 1),
};
static const struct snd_soc_dapm_route wm8985_common_dapm_routes[] = {
{ "Right Output Mixer", "PCM Switch", "Right DAC" }, { "Right Output Mixer", "PCM Switch", "Right DAC" },
{ "Right Output Mixer", "Aux Switch", "AUXR" },
{ "Right Output Mixer", "Line Switch", "Right Boost Mixer" }, { "Right Output Mixer", "Line Switch", "Right Boost Mixer" },
{ "Left Output Mixer", "PCM Switch", "Left DAC" }, { "Left Output Mixer", "PCM Switch", "Left DAC" },
{ "Left Output Mixer", "Aux Switch", "AUXL" },
{ "Left Output Mixer", "Line Switch", "Left Boost Mixer" }, { "Left Output Mixer", "Line Switch", "Left Boost Mixer" },
{ "Right Headphone Out", NULL, "Right Output Mixer" }, { "Right Headphone Out", NULL, "Right Output Mixer" },
...@@ -501,13 +537,11 @@ static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { ...@@ -501,13 +537,11 @@ static const struct snd_soc_dapm_route wm8985_dapm_routes[] = {
{ "Right ADC", NULL, "Right Boost Mixer" }, { "Right ADC", NULL, "Right Boost Mixer" },
{ "Right Boost Mixer", "AUXR Volume", "AUXR" },
{ "Right Boost Mixer", NULL, "Right Capture PGA" }, { "Right Boost Mixer", NULL, "Right Capture PGA" },
{ "Right Boost Mixer", "R2 Volume", "R2" }, { "Right Boost Mixer", "R2 Volume", "R2" },
{ "Left ADC", NULL, "Left Boost Mixer" }, { "Left ADC", NULL, "Left Boost Mixer" },
{ "Left Boost Mixer", "AUXL Volume", "AUXL" },
{ "Left Boost Mixer", NULL, "Left Capture PGA" }, { "Left Boost Mixer", NULL, "Left Capture PGA" },
{ "Left Boost Mixer", "L2 Volume", "L2" }, { "Left Boost Mixer", "L2 Volume", "L2" },
...@@ -522,6 +556,38 @@ static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { ...@@ -522,6 +556,38 @@ static const struct snd_soc_dapm_route wm8985_dapm_routes[] = {
{ "Left Input Mixer", "MicN Switch", "LIN" }, { "Left Input Mixer", "MicN Switch", "LIN" },
{ "Left Input Mixer", "MicP Switch", "LIP" }, { "Left Input Mixer", "MicP Switch", "LIP" },
}; };
static const struct snd_soc_dapm_route wm8985_aux_dapm_routes[] = {
{ "Right Output Mixer", "Aux Switch", "AUXR" },
{ "Left Output Mixer", "Aux Switch", "AUXL" },
{ "Right Boost Mixer", "AUXR Volume", "AUXR" },
{ "Left Boost Mixer", "AUXL Volume", "AUXL" },
};
static int wm8985_add_widgets(struct snd_soc_codec *codec)
{
struct wm8985_priv *wm8985 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
switch (wm8985->dev_type) {
case WM8758:
snd_soc_dapm_new_controls(dapm, wm8758_dapm_widgets,
ARRAY_SIZE(wm8758_dapm_widgets));
break;
case WM8985:
snd_soc_add_codec_controls(codec, wm8985_specific_snd_controls,
ARRAY_SIZE(wm8985_specific_snd_controls));
snd_soc_dapm_new_controls(dapm, wm8985_dapm_widgets,
ARRAY_SIZE(wm8985_dapm_widgets));
snd_soc_dapm_add_routes(dapm, wm8985_aux_dapm_routes,
ARRAY_SIZE(wm8985_aux_dapm_routes));
break;
}
return 0;
}
static int eqmode_get(struct snd_kcontrol *kcontrol, static int eqmode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
...@@ -999,6 +1065,8 @@ static int wm8985_probe(struct snd_soc_codec *codec) ...@@ -999,6 +1065,8 @@ static int wm8985_probe(struct snd_soc_codec *codec)
snd_soc_update_bits(codec, WM8985_BIAS_CTRL, WM8985_BIASCUT, snd_soc_update_bits(codec, WM8985_BIAS_CTRL, WM8985_BIASCUT,
WM8985_BIASCUT); WM8985_BIASCUT);
wm8985_add_widgets(codec);
return 0; return 0;
err_reg_enable: err_reg_enable:
...@@ -1042,12 +1110,12 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8985 = { ...@@ -1042,12 +1110,12 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8985 = {
.set_bias_level = wm8985_set_bias_level, .set_bias_level = wm8985_set_bias_level,
.suspend_bias_off = true, .suspend_bias_off = true,
.controls = wm8985_snd_controls, .controls = wm8985_common_snd_controls,
.num_controls = ARRAY_SIZE(wm8985_snd_controls), .num_controls = ARRAY_SIZE(wm8985_common_snd_controls),
.dapm_widgets = wm8985_dapm_widgets, .dapm_widgets = wm8985_common_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8985_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(wm8985_common_dapm_widgets),
.dapm_routes = wm8985_dapm_routes, .dapm_routes = wm8985_common_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm8985_dapm_routes), .num_dapm_routes = ARRAY_SIZE(wm8985_common_dapm_routes),
}; };
static const struct regmap_config wm8985_regmap = { static const struct regmap_config wm8985_regmap = {
...@@ -1074,6 +1142,8 @@ static int wm8985_spi_probe(struct spi_device *spi) ...@@ -1074,6 +1142,8 @@ static int wm8985_spi_probe(struct spi_device *spi)
spi_set_drvdata(spi, wm8985); spi_set_drvdata(spi, wm8985);
wm8985->dev_type = WM8985;
wm8985->regmap = devm_regmap_init_spi(spi, &wm8985_regmap); wm8985->regmap = devm_regmap_init_spi(spi, &wm8985_regmap);
if (IS_ERR(wm8985->regmap)) { if (IS_ERR(wm8985->regmap)) {
ret = PTR_ERR(wm8985->regmap); ret = PTR_ERR(wm8985->regmap);
...@@ -1115,6 +1185,8 @@ static int wm8985_i2c_probe(struct i2c_client *i2c, ...@@ -1115,6 +1185,8 @@ static int wm8985_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, wm8985); i2c_set_clientdata(i2c, wm8985);
wm8985->dev_type = id->driver_data;
wm8985->regmap = devm_regmap_init_i2c(i2c, &wm8985_regmap); wm8985->regmap = devm_regmap_init_i2c(i2c, &wm8985_regmap);
if (IS_ERR(wm8985->regmap)) { if (IS_ERR(wm8985->regmap)) {
ret = PTR_ERR(wm8985->regmap); ret = PTR_ERR(wm8985->regmap);
...@@ -1135,7 +1207,8 @@ static int wm8985_i2c_remove(struct i2c_client *i2c) ...@@ -1135,7 +1207,8 @@ static int wm8985_i2c_remove(struct i2c_client *i2c)
} }
static const struct i2c_device_id wm8985_i2c_id[] = { static const struct i2c_device_id wm8985_i2c_id[] = {
{ "wm8985", 0 }, { "wm8985", WM8985 },
{ "wm8758", WM8758 },
{ } { }
}; };
MODULE_DEVICE_TABLE(i2c, wm8985_i2c_id); MODULE_DEVICE_TABLE(i2c, wm8985_i2c_id);
...@@ -1183,6 +1256,6 @@ static void __exit wm8985_exit(void) ...@@ -1183,6 +1256,6 @@ static void __exit wm8985_exit(void)
} }
module_exit(wm8985_exit); module_exit(wm8985_exit);
MODULE_DESCRIPTION("ASoC WM8985 driver"); MODULE_DESCRIPTION("ASoC WM8985 / WM8758 driver");
MODULE_AUTHOR("Dimitris Papastamos <dp@opensource.wolfsonmicro.com>"); MODULE_AUTHOR("Dimitris Papastamos <dp@opensource.wolfsonmicro.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -290,6 +290,9 @@ ...@@ -290,6 +290,9 @@
#define WM8985_GPIO1GPD_MASK 0x0040 /* GPIO1GPD */ #define WM8985_GPIO1GPD_MASK 0x0040 /* GPIO1GPD */
#define WM8985_GPIO1GPD_SHIFT 6 /* GPIO1GPD */ #define WM8985_GPIO1GPD_SHIFT 6 /* GPIO1GPD */
#define WM8985_GPIO1GPD_WIDTH 1 /* GPIO1GPD */ #define WM8985_GPIO1GPD_WIDTH 1 /* GPIO1GPD */
#define WM8758_OPCLKDIV_MASK 0x0030 /* OPCLKDIV - [1:0] */
#define WM8758_OPCLKDIV_SHIFT 4 /* OPCLKDIV - [1:0] */
#define WM8758_OPCLKDIV_WIDTH 2 /* OPCLKDIV - [1:0] */
#define WM8985_GPIO1POL 0x0008 /* GPIO1POL */ #define WM8985_GPIO1POL 0x0008 /* GPIO1POL */
#define WM8985_GPIO1POL_MASK 0x0008 /* GPIO1POL */ #define WM8985_GPIO1POL_MASK 0x0008 /* GPIO1POL */
#define WM8985_GPIO1POL_SHIFT 3 /* GPIO1POL */ #define WM8985_GPIO1POL_SHIFT 3 /* GPIO1POL */
...@@ -301,6 +304,12 @@ ...@@ -301,6 +304,12 @@
/* /*
* R9 (0x09) - Jack Detect Control 1 * R9 (0x09) - Jack Detect Control 1
*/ */
#define WM8758_JD_VMID1_MASK 0x0100 /* JD_VMID1 */
#define WM8758_JD_VMID1_SHIFT 8 /* JD_VMID1 */
#define WM8758_JD_VMID1_WIDTH 1 /* JD_VMID1 */
#define WM8758_JD_VMID0_MASK 0x0080 /* JD_VMID0 */
#define WM8758_JD_VMID0_SHIFT 7 /* JD_VMID0 */
#define WM8758_JD_VMID0_WIDTH 1 /* JD_VMID0 */
#define WM8985_JD_EN 0x0040 /* JD_EN */ #define WM8985_JD_EN 0x0040 /* JD_EN */
#define WM8985_JD_EN_MASK 0x0040 /* JD_EN */ #define WM8985_JD_EN_MASK 0x0040 /* JD_EN */
#define WM8985_JD_EN_SHIFT 6 /* JD_EN */ #define WM8985_JD_EN_SHIFT 6 /* JD_EN */
...@@ -649,6 +658,12 @@ ...@@ -649,6 +658,12 @@
#define WM8985_OUT4_2LNR_MASK 0x0020 /* OUT4_2LNR */ #define WM8985_OUT4_2LNR_MASK 0x0020 /* OUT4_2LNR */
#define WM8985_OUT4_2LNR_SHIFT 5 /* OUT4_2LNR */ #define WM8985_OUT4_2LNR_SHIFT 5 /* OUT4_2LNR */
#define WM8985_OUT4_2LNR_WIDTH 1 /* OUT4_2LNR */ #define WM8985_OUT4_2LNR_WIDTH 1 /* OUT4_2LNR */
#define WM8758_VMIDTOG_MASK 0x0010 /* VMIDTOG */
#define WM8758_VMIDTOG_SHIFT 4 /* VMIDTOG */
#define WM8758_VMIDTOG_WIDTH 1 /* VMIDTOG */
#define WM8758_OUT2DEL_MASK 0x0008 /* OUT2DEL */
#define WM8758_OUT2DEL_SHIFT 3 /* OUT2DEL */
#define WM8758_OUT2DEL_WIDTH 1 /* OUT2DEL */
#define WM8985_POBCTRL 0x0004 /* POBCTRL */ #define WM8985_POBCTRL 0x0004 /* POBCTRL */
#define WM8985_POBCTRL_MASK 0x0004 /* POBCTRL */ #define WM8985_POBCTRL_MASK 0x0004 /* POBCTRL */
#define WM8985_POBCTRL_SHIFT 2 /* POBCTRL */ #define WM8985_POBCTRL_SHIFT 2 /* POBCTRL */
...@@ -684,6 +699,9 @@ ...@@ -684,6 +699,9 @@
#define WM8985_BEEPVOL_MASK 0x000E /* BEEPVOL - [3:1] */ #define WM8985_BEEPVOL_MASK 0x000E /* BEEPVOL - [3:1] */
#define WM8985_BEEPVOL_SHIFT 1 /* BEEPVOL - [3:1] */ #define WM8985_BEEPVOL_SHIFT 1 /* BEEPVOL - [3:1] */
#define WM8985_BEEPVOL_WIDTH 3 /* BEEPVOL - [3:1] */ #define WM8985_BEEPVOL_WIDTH 3 /* BEEPVOL - [3:1] */
#define WM8758_DELEN2_MASK 0x0004 /* DELEN2 */
#define WM8758_DELEN2_SHIFT 2 /* DELEN2 */
#define WM8758_DELEN2_WIDTH 1 /* DELEN2 */
#define WM8985_BEEPEN 0x0001 /* BEEPEN */ #define WM8985_BEEPEN 0x0001 /* BEEPEN */
#define WM8985_BEEPEN_MASK 0x0001 /* BEEPEN */ #define WM8985_BEEPEN_MASK 0x0001 /* BEEPEN */
#define WM8985_BEEPEN_SHIFT 0 /* BEEPEN */ #define WM8985_BEEPEN_SHIFT 0 /* BEEPEN */
...@@ -790,6 +808,14 @@ ...@@ -790,6 +808,14 @@
/* /*
* R49 (0x31) - Output ctrl * R49 (0x31) - Output ctrl
*/ */
#define WM8758_HP_COM 0x0100 /* HP_COM */
#define WM8758_HP_COM_MASK 0x0100 /* HP_COM */
#define WM8758_HP_COM_SHIFT 8 /* HP_COM */
#define WM8758_HP_COM_WIDTH 1 /* HP_COM */
#define WM8758_LINE_COM 0x0080 /* LINE_COM */
#define WM8758_LINE_COM_MASK 0x0080 /* LINE_COM */
#define WM8758_LINE_COM_SHIFT 7 /* LINE_COM */
#define WM8758_LINE_COM_WIDTH 1 /* LINE_COM */
#define WM8985_DACL2RMIX 0x0040 /* DACL2RMIX */ #define WM8985_DACL2RMIX 0x0040 /* DACL2RMIX */
#define WM8985_DACL2RMIX_MASK 0x0040 /* DACL2RMIX */ #define WM8985_DACL2RMIX_MASK 0x0040 /* DACL2RMIX */
#define WM8985_DACL2RMIX_SHIFT 6 /* DACL2RMIX */ #define WM8985_DACL2RMIX_SHIFT 6 /* DACL2RMIX */
...@@ -806,6 +832,14 @@ ...@@ -806,6 +832,14 @@
#define WM8985_OUT3BOOST_MASK 0x0008 /* OUT3BOOST */ #define WM8985_OUT3BOOST_MASK 0x0008 /* OUT3BOOST */
#define WM8985_OUT3BOOST_SHIFT 3 /* OUT3BOOST */ #define WM8985_OUT3BOOST_SHIFT 3 /* OUT3BOOST */
#define WM8985_OUT3BOOST_WIDTH 1 /* OUT3BOOST */ #define WM8985_OUT3BOOST_WIDTH 1 /* OUT3BOOST */
#define WM8758_OUT4ENDEL 0x0010 /* OUT4ENDEL */
#define WM8758_OUT4ENDEL_MASK 0x0010 /* OUT4ENDEL */
#define WM8758_OUT4ENDEL_SHIFT 4 /* OUT4ENDEL */
#define WM8758_OUT4ENDEL_WIDTH 1 /* OUT4ENDEL */
#define WM8758_OUT3ENDEL 0x0008 /* OUT3ENDEL */
#define WM8758_OUT3ENDEL_MASK 0x0008 /* OUT3ENDEL */
#define WM8758_OUT3ENDEL_SHIFT 3 /* OUT3ENDEL */
#define WM8758_OUT3ENDEL_WIDTH 1 /* OUT3ENDEL */
#define WM8985_TSOPCTRL 0x0004 /* TSOPCTRL */ #define WM8985_TSOPCTRL 0x0004 /* TSOPCTRL */
#define WM8985_TSOPCTRL_MASK 0x0004 /* TSOPCTRL */ #define WM8985_TSOPCTRL_MASK 0x0004 /* TSOPCTRL */
#define WM8985_TSOPCTRL_SHIFT 2 /* TSOPCTRL */ #define WM8985_TSOPCTRL_SHIFT 2 /* TSOPCTRL */
...@@ -1021,6 +1055,10 @@ ...@@ -1021,6 +1055,10 @@
#define WM8985_HALFIPBIAS_MASK 0x0080 /* HALFIPBIAS */ #define WM8985_HALFIPBIAS_MASK 0x0080 /* HALFIPBIAS */
#define WM8985_HALFIPBIAS_SHIFT 7 /* HALFIPBIAS */ #define WM8985_HALFIPBIAS_SHIFT 7 /* HALFIPBIAS */
#define WM8985_HALFIPBIAS_WIDTH 1 /* HALFIPBIAS */ #define WM8985_HALFIPBIAS_WIDTH 1 /* HALFIPBIAS */
#define WM8758_HALFIPBIAS 0x0040 /* HALFI_IPGA */
#define WM8758_HALFI_IPGA_MASK 0x0040 /* HALFI_IPGA */
#define WM8758_HALFI_IPGA_SHIFT 6 /* HALFI_IPGA */
#define WM8758_HALFI_IPGA_WIDTH 1 /* HALFI_IPGA */
#define WM8985_VBBIASTST_MASK 0x0060 /* VBBIASTST - [6:5] */ #define WM8985_VBBIASTST_MASK 0x0060 /* VBBIASTST - [6:5] */
#define WM8985_VBBIASTST_SHIFT 5 /* VBBIASTST - [6:5] */ #define WM8985_VBBIASTST_SHIFT 5 /* VBBIASTST - [6:5] */
#define WM8985_VBBIASTST_WIDTH 2 /* VBBIASTST - [6:5] */ #define WM8985_VBBIASTST_WIDTH 2 /* VBBIASTST - [6:5] */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment