mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 04:50:57 +07:00
Merge remote-tracking branches 'asoc/topic/wm8728', 'asoc/topic/wm8731', 'asoc/topic/wm8737', 'asoc/topic/wm8741' and 'asoc/topic/wm8750' into asoc-next
This commit is contained in:
commit
179ef216bb
@ -74,13 +74,13 @@ static const struct snd_soc_dapm_route wm8728_intercon[] = {
|
||||
|
||||
static int wm8728_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
u16 mute_reg = snd_soc_read(codec, WM8728_DACCTL);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
u16 mute_reg = snd_soc_component_read32(component, WM8728_DACCTL);
|
||||
|
||||
if (mute)
|
||||
snd_soc_write(codec, WM8728_DACCTL, mute_reg | 1);
|
||||
snd_soc_component_write(component, WM8728_DACCTL, mute_reg | 1);
|
||||
else
|
||||
snd_soc_write(codec, WM8728_DACCTL, mute_reg & ~1);
|
||||
snd_soc_component_write(component, WM8728_DACCTL, mute_reg & ~1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -89,8 +89,8 @@ static int wm8728_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
u16 dac = snd_soc_read(codec, WM8728_DACCTL);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
u16 dac = snd_soc_component_read32(component, WM8728_DACCTL);
|
||||
|
||||
dac &= ~0x18;
|
||||
|
||||
@ -107,7 +107,7 @@ static int wm8728_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_write(codec, WM8728_DACCTL, dac);
|
||||
snd_soc_component_write(component, WM8728_DACCTL, dac);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -115,8 +115,8 @@ static int wm8728_hw_params(struct snd_pcm_substream *substream,
|
||||
static int wm8728_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
u16 iface = snd_soc_read(codec, WM8728_IFCTL);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
u16 iface = snd_soc_component_read32(component, WM8728_IFCTL);
|
||||
|
||||
/* Currently only I2S is supported by the driver, though the
|
||||
* hardware is more flexible.
|
||||
@ -156,24 +156,24 @@ static int wm8728_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_write(codec, WM8728_IFCTL, iface);
|
||||
snd_soc_component_write(component, WM8728_IFCTL, iface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm8728_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int wm8728_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct wm8728_priv *wm8728 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8728_priv *wm8728 = snd_soc_component_get_drvdata(component);
|
||||
u16 reg;
|
||||
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||
/* Power everything up... */
|
||||
reg = snd_soc_read(codec, WM8728_DACCTL);
|
||||
snd_soc_write(codec, WM8728_DACCTL, reg & ~0x4);
|
||||
reg = snd_soc_component_read32(component, WM8728_DACCTL);
|
||||
snd_soc_component_write(component, WM8728_DACCTL, reg & ~0x4);
|
||||
|
||||
/* ..then sync in the register cache. */
|
||||
regcache_sync(wm8728->regmap);
|
||||
@ -181,8 +181,8 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec,
|
||||
break;
|
||||
|
||||
case SND_SOC_BIAS_OFF:
|
||||
reg = snd_soc_read(codec, WM8728_DACCTL);
|
||||
snd_soc_write(codec, WM8728_DACCTL, reg | 0x4);
|
||||
reg = snd_soc_component_read32(component, WM8728_DACCTL);
|
||||
snd_soc_component_write(component, WM8728_DACCTL, reg | 0x4);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@ -211,18 +211,19 @@ static struct snd_soc_dai_driver wm8728_dai = {
|
||||
.ops = &wm8728_dai_ops,
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm8728 = {
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm8728 = {
|
||||
.set_bias_level = wm8728_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.controls = wm8728_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(wm8728_snd_controls),
|
||||
.dapm_widgets = wm8728_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm8728_dapm_widgets),
|
||||
.dapm_routes = wm8728_intercon,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm8728_intercon),
|
||||
},
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct of_device_id wm8728_of_match[] = {
|
||||
@ -258,26 +259,18 @@ static int wm8728_spi_probe(struct spi_device *spi)
|
||||
|
||||
spi_set_drvdata(spi, wm8728);
|
||||
|
||||
ret = snd_soc_register_codec(&spi->dev,
|
||||
&soc_codec_dev_wm8728, &wm8728_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&spi->dev,
|
||||
&soc_component_dev_wm8728, &wm8728_dai, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm8728_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct spi_driver wm8728_spi_driver = {
|
||||
.driver = {
|
||||
.name = "wm8728",
|
||||
.of_match_table = wm8728_of_match,
|
||||
},
|
||||
.probe = wm8728_spi_probe,
|
||||
.remove = wm8728_spi_remove,
|
||||
};
|
||||
#endif /* CONFIG_SPI_MASTER */
|
||||
|
||||
@ -299,18 +292,12 @@ static int wm8728_i2c_probe(struct i2c_client *i2c,
|
||||
|
||||
i2c_set_clientdata(i2c, wm8728);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c->dev,
|
||||
&soc_codec_dev_wm8728, &wm8728_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c->dev,
|
||||
&soc_component_dev_wm8728, &wm8728_dai, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm8728_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id wm8728_i2c_id[] = {
|
||||
{ "wm8728", 0 },
|
||||
{ }
|
||||
@ -323,7 +310,6 @@ static struct i2c_driver wm8728_i2c_driver = {
|
||||
.of_match_table = wm8728_of_match,
|
||||
},
|
||||
.probe = wm8728_i2c_probe,
|
||||
.remove = wm8728_i2c_remove,
|
||||
.id_table = wm8728_i2c_id,
|
||||
};
|
||||
#endif
|
||||
|
@ -88,9 +88,9 @@ static SOC_ENUM_SINGLE_DECL(wm8731_insel_enum,
|
||||
|
||||
static int wm8731_deemph[] = { 0, 32000, 44100, 48000 };
|
||||
|
||||
static int wm8731_set_deemph(struct snd_soc_codec *codec)
|
||||
static int wm8731_set_deemph(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component);
|
||||
int val, i, best;
|
||||
|
||||
/* If we're using deemphasis select the nearest available sample
|
||||
@ -110,17 +110,17 @@ static int wm8731_set_deemph(struct snd_soc_codec *codec)
|
||||
val = 0;
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "Set deemphasis %d (%dHz)\n",
|
||||
dev_dbg(component->dev, "Set deemphasis %d (%dHz)\n",
|
||||
best, wm8731_deemph[best]);
|
||||
|
||||
return snd_soc_update_bits(codec, WM8731_APDIGI, 0x6, val);
|
||||
return snd_soc_component_update_bits(component, WM8731_APDIGI, 0x6, val);
|
||||
}
|
||||
|
||||
static int wm8731_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] = wm8731->deemph;
|
||||
|
||||
@ -130,8 +130,8 @@ static int wm8731_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int deemph = ucontrol->value.integer.value[0];
|
||||
int ret = 0;
|
||||
|
||||
@ -142,7 +142,7 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
if (wm8731->deemph != deemph) {
|
||||
wm8731->deemph = deemph;
|
||||
|
||||
wm8731_set_deemph(codec);
|
||||
wm8731_set_deemph(component);
|
||||
|
||||
ret = 1;
|
||||
}
|
||||
@ -214,8 +214,8 @@ SND_SOC_DAPM_INPUT("LLINEIN"),
|
||||
static int wm8731_check_osc(struct snd_soc_dapm_widget *source,
|
||||
struct snd_soc_dapm_widget *sink)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||
struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
return wm8731->sysclk_type == WM8731_SYSCLK_XTAL;
|
||||
}
|
||||
@ -337,16 +337,16 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
|
||||
u16 iface = snd_soc_read(codec, WM8731_IFACE) & 0xfff3;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component);
|
||||
u16 iface = snd_soc_component_read32(component, WM8731_IFACE) & 0xfff3;
|
||||
int i = get_coeff(wm8731->sysclk, params_rate(params));
|
||||
u16 srate = (coeff_div[i].sr << 2) |
|
||||
(coeff_div[i].bosr << 1) | coeff_div[i].usb;
|
||||
|
||||
wm8731->playback_fs = params_rate(params);
|
||||
|
||||
snd_soc_write(codec, WM8731_SRATE, srate);
|
||||
snd_soc_component_write(component, WM8731_SRATE, srate);
|
||||
|
||||
/* bit size */
|
||||
switch (params_width(params)) {
|
||||
@ -363,30 +363,30 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream,
|
||||
break;
|
||||
}
|
||||
|
||||
wm8731_set_deemph(codec);
|
||||
wm8731_set_deemph(component);
|
||||
|
||||
snd_soc_write(codec, WM8731_IFACE, iface);
|
||||
snd_soc_component_write(component, WM8731_IFACE, iface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm8731_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
u16 mute_reg = snd_soc_read(codec, WM8731_APDIGI) & 0xfff7;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
u16 mute_reg = snd_soc_component_read32(component, WM8731_APDIGI) & 0xfff7;
|
||||
|
||||
if (mute)
|
||||
snd_soc_write(codec, WM8731_APDIGI, mute_reg | 0x8);
|
||||
snd_soc_component_write(component, WM8731_APDIGI, mute_reg | 0x8);
|
||||
else
|
||||
snd_soc_write(codec, WM8731_APDIGI, mute_reg);
|
||||
snd_soc_component_write(component, WM8731_APDIGI, mute_reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (clk_id) {
|
||||
case WM8731_SYSCLK_XTAL:
|
||||
@ -429,7 +429,7 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
static int wm8731_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
u16 iface = 0;
|
||||
|
||||
/* set master/slave audio interface */
|
||||
@ -481,14 +481,14 @@ static int wm8731_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
}
|
||||
|
||||
/* set iface */
|
||||
snd_soc_write(codec, WM8731_IFACE, iface);
|
||||
snd_soc_component_write(component, WM8731_IFACE, iface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm8731_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int wm8731_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
u16 reg;
|
||||
|
||||
@ -503,7 +503,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies),
|
||||
wm8731->supplies);
|
||||
if (ret != 0)
|
||||
@ -513,13 +513,13 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
|
||||
}
|
||||
|
||||
/* Clear PWROFF, gate CLKOUT, everything else as-is */
|
||||
reg = snd_soc_read(codec, WM8731_PWR) & 0xff7f;
|
||||
snd_soc_write(codec, WM8731_PWR, reg | 0x0040);
|
||||
reg = snd_soc_component_read32(component, WM8731_PWR) & 0xff7f;
|
||||
snd_soc_component_write(component, WM8731_PWR, reg | 0x0040);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF:
|
||||
if (wm8731->mclk)
|
||||
clk_disable_unprepare(wm8731->mclk);
|
||||
snd_soc_write(codec, WM8731_PWR, 0xffff);
|
||||
snd_soc_component_write(component, WM8731_PWR, 0xffff);
|
||||
regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies),
|
||||
wm8731->supplies);
|
||||
regcache_mark_dirty(wm8731->regmap);
|
||||
@ -531,7 +531,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int wm8731_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(dai->codec);
|
||||
struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(dai->component);
|
||||
|
||||
if (wm8731->constraints)
|
||||
snd_pcm_hw_constraint_list(substream->runtime, 0,
|
||||
@ -628,18 +628,19 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm8731 = {
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm8731 = {
|
||||
.set_bias_level = wm8731_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.controls = wm8731_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(wm8731_snd_controls),
|
||||
.dapm_widgets = wm8731_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets),
|
||||
.dapm_routes = wm8731_intercon,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm8731_intercon),
|
||||
},
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct of_device_id wm8731_of_match[] = {
|
||||
@ -704,8 +705,8 @@ static int wm8731_spi_probe(struct spi_device *spi)
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_register_codec(&spi->dev,
|
||||
&soc_codec_dev_wm8731, &wm8731_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&spi->dev,
|
||||
&soc_component_dev_wm8731, &wm8731_dai, 1);
|
||||
if (ret != 0) {
|
||||
dev_err(&spi->dev, "Failed to register CODEC: %d\n", ret);
|
||||
return ret;
|
||||
@ -716,7 +717,6 @@ static int wm8731_spi_probe(struct spi_device *spi)
|
||||
|
||||
static int wm8731_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -775,8 +775,8 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_register_codec(&i2c->dev,
|
||||
&soc_codec_dev_wm8731, &wm8731_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c->dev,
|
||||
&soc_component_dev_wm8731, &wm8731_dai, 1);
|
||||
if (ret != 0) {
|
||||
dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
|
||||
return ret;
|
||||
@ -787,7 +787,6 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
|
||||
|
||||
static int wm8731_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -74,9 +74,9 @@ static bool wm8737_volatile(struct device *dev, unsigned int reg)
|
||||
}
|
||||
}
|
||||
|
||||
static int wm8737_reset(struct snd_soc_codec *codec)
|
||||
static int wm8737_reset(struct snd_soc_component *component)
|
||||
{
|
||||
return snd_soc_write(codec, WM8737_RESET, 0);
|
||||
return snd_soc_component_write(component, WM8737_RESET, 0);
|
||||
}
|
||||
|
||||
static const DECLARE_TLV_DB_RANGE(micboost_tlv,
|
||||
@ -328,8 +328,8 @@ static int wm8737_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct wm8737_priv *wm8737 = snd_soc_component_get_drvdata(component);
|
||||
int i;
|
||||
u16 clocking = 0;
|
||||
u16 af = 0;
|
||||
@ -348,7 +348,7 @@ static int wm8737_hw_params(struct snd_pcm_substream *substream,
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(coeff_div)) {
|
||||
dev_err(codec->dev, "%dHz MCLK can't support %dHz\n",
|
||||
dev_err(component->dev, "%dHz MCLK can't support %dHz\n",
|
||||
wm8737->mclk, params_rate(params));
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -371,8 +371,8 @@ static int wm8737_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, WM8737_AUDIO_FORMAT, WM8737_WL_MASK, af);
|
||||
snd_soc_update_bits(codec, WM8737_CLOCKING,
|
||||
snd_soc_component_update_bits(component, WM8737_AUDIO_FORMAT, WM8737_WL_MASK, af);
|
||||
snd_soc_component_update_bits(component, WM8737_CLOCKING,
|
||||
WM8737_USB_MODE | WM8737_CLKDIV2 | WM8737_SR_MASK,
|
||||
clocking);
|
||||
|
||||
@ -382,8 +382,8 @@ static int wm8737_hw_params(struct snd_pcm_substream *substream,
|
||||
static int wm8737_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct wm8737_priv *wm8737 = snd_soc_component_get_drvdata(component);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(coeff_div); i++) {
|
||||
@ -394,7 +394,7 @@ static int wm8737_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
}
|
||||
}
|
||||
|
||||
dev_err(codec->dev, "MCLK rate %dHz not supported\n", freq);
|
||||
dev_err(component->dev, "MCLK rate %dHz not supported\n", freq);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -403,7 +403,7 @@ static int wm8737_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
static int wm8737_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
u16 af = 0;
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
@ -445,16 +445,16 @@ static int wm8737_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, WM8737_AUDIO_FORMAT,
|
||||
snd_soc_component_update_bits(component, WM8737_AUDIO_FORMAT,
|
||||
WM8737_FORMAT_MASK | WM8737_LRP | WM8737_MS, af);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm8737_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int wm8737_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8737_priv *wm8737 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
switch (level) {
|
||||
@ -463,16 +463,16 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec,
|
||||
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
/* VMID at 2*75k */
|
||||
snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL,
|
||||
snd_soc_component_update_bits(component, WM8737_MISC_BIAS_CONTROL,
|
||||
WM8737_VMIDSEL_MASK, 0);
|
||||
break;
|
||||
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies),
|
||||
wm8737->supplies);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"Failed to enable supplies: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
@ -481,12 +481,12 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec,
|
||||
regcache_sync(wm8737->regmap);
|
||||
|
||||
/* Fast VMID ramp at 2*2.5k */
|
||||
snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL,
|
||||
snd_soc_component_update_bits(component, WM8737_MISC_BIAS_CONTROL,
|
||||
WM8737_VMIDSEL_MASK,
|
||||
2 << WM8737_VMIDSEL_SHIFT);
|
||||
|
||||
/* Bring VMID up */
|
||||
snd_soc_update_bits(codec, WM8737_POWER_MANAGEMENT,
|
||||
snd_soc_component_update_bits(component, WM8737_POWER_MANAGEMENT,
|
||||
WM8737_VMID_MASK |
|
||||
WM8737_VREF_MASK,
|
||||
WM8737_VMID_MASK |
|
||||
@ -496,14 +496,14 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec,
|
||||
}
|
||||
|
||||
/* VMID at 2*300k */
|
||||
snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL,
|
||||
snd_soc_component_update_bits(component, WM8737_MISC_BIAS_CONTROL,
|
||||
WM8737_VMIDSEL_MASK,
|
||||
1 << WM8737_VMIDSEL_SHIFT);
|
||||
|
||||
break;
|
||||
|
||||
case SND_SOC_BIAS_OFF:
|
||||
snd_soc_update_bits(codec, WM8737_POWER_MANAGEMENT,
|
||||
snd_soc_component_update_bits(component, WM8737_POWER_MANAGEMENT,
|
||||
WM8737_VMID_MASK | WM8737_VREF_MASK, 0);
|
||||
|
||||
regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies),
|
||||
@ -537,30 +537,30 @@ static struct snd_soc_dai_driver wm8737_dai = {
|
||||
.ops = &wm8737_dai_ops,
|
||||
};
|
||||
|
||||
static int wm8737_probe(struct snd_soc_codec *codec)
|
||||
static int wm8737_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8737_priv *wm8737 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies),
|
||||
wm8737->supplies);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
|
||||
dev_err(component->dev, "Failed to enable supplies: %d\n", ret);
|
||||
goto err_get;
|
||||
}
|
||||
|
||||
ret = wm8737_reset(codec);
|
||||
ret = wm8737_reset(component);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "Failed to issue reset\n");
|
||||
dev_err(component->dev, "Failed to issue reset\n");
|
||||
goto err_enable;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, WM8737_LEFT_PGA_VOLUME, WM8737_LVU,
|
||||
snd_soc_component_update_bits(component, WM8737_LEFT_PGA_VOLUME, WM8737_LVU,
|
||||
WM8737_LVU);
|
||||
snd_soc_update_bits(codec, WM8737_RIGHT_PGA_VOLUME, WM8737_RVU,
|
||||
snd_soc_component_update_bits(component, WM8737_RIGHT_PGA_VOLUME, WM8737_RVU,
|
||||
WM8737_RVU);
|
||||
|
||||
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY);
|
||||
snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
|
||||
|
||||
/* Bias level configuration will have done an extra enable */
|
||||
regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies);
|
||||
@ -573,19 +573,20 @@ static int wm8737_probe(struct snd_soc_codec *codec)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm8737 = {
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm8737 = {
|
||||
.probe = wm8737_probe,
|
||||
.set_bias_level = wm8737_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.controls = wm8737_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(wm8737_snd_controls),
|
||||
.dapm_widgets = wm8737_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm8737_dapm_widgets),
|
||||
.dapm_routes = intercon,
|
||||
.num_dapm_routes = ARRAY_SIZE(intercon),
|
||||
},
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct of_device_id wm8737_of_match[] = {
|
||||
@ -635,20 +636,13 @@ static int wm8737_i2c_probe(struct i2c_client *i2c,
|
||||
|
||||
i2c_set_clientdata(i2c, wm8737);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c->dev,
|
||||
&soc_codec_dev_wm8737, &wm8737_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c->dev,
|
||||
&soc_component_dev_wm8737, &wm8737_dai, 1);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
static int wm8737_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id wm8737_i2c_id[] = {
|
||||
{ "wm8737", 0 },
|
||||
{ }
|
||||
@ -661,7 +655,6 @@ static struct i2c_driver wm8737_i2c_driver = {
|
||||
.of_match_table = wm8737_of_match,
|
||||
},
|
||||
.probe = wm8737_i2c_probe,
|
||||
.remove = wm8737_i2c_remove,
|
||||
.id_table = wm8737_i2c_id,
|
||||
};
|
||||
#endif
|
||||
@ -693,26 +686,18 @@ static int wm8737_spi_probe(struct spi_device *spi)
|
||||
|
||||
spi_set_drvdata(spi, wm8737);
|
||||
|
||||
ret = snd_soc_register_codec(&spi->dev,
|
||||
&soc_codec_dev_wm8737, &wm8737_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&spi->dev,
|
||||
&soc_component_dev_wm8737, &wm8737_dai, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm8737_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct spi_driver wm8737_spi_driver = {
|
||||
.driver = {
|
||||
.name = "wm8737",
|
||||
.of_match_table = wm8737_of_match,
|
||||
},
|
||||
.probe = wm8737_spi_probe,
|
||||
.remove = wm8737_spi_remove,
|
||||
};
|
||||
#endif /* CONFIG_SPI_MASTER */
|
||||
|
||||
|
@ -59,9 +59,9 @@ static const struct reg_default wm8741_reg_defaults[] = {
|
||||
{ 32, 0x0002 }, /* R32 - ADDITONAL_CONTROL_1 */
|
||||
};
|
||||
|
||||
static int wm8741_reset(struct snd_soc_codec *codec)
|
||||
static int wm8741_reset(struct snd_soc_component *component)
|
||||
{
|
||||
return snd_soc_write(codec, WM8741_RESET, 0);
|
||||
return snd_soc_component_write(component, WM8741_RESET, 0);
|
||||
}
|
||||
|
||||
static const DECLARE_TLV_DB_SCALE(dac_tlv_fine, -12700, 13, 0);
|
||||
@ -179,8 +179,8 @@ static const struct snd_pcm_hw_constraint_list constraints_36864 = {
|
||||
static int wm8741_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct wm8741_priv *wm8741 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (wm8741->sysclk)
|
||||
snd_pcm_hw_constraint_list(substream->runtime, 0,
|
||||
@ -194,8 +194,8 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct wm8741_priv *wm8741 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int iface;
|
||||
int i;
|
||||
|
||||
@ -203,7 +203,7 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream,
|
||||
* MCLK supplied to the CODEC - enforce this.
|
||||
*/
|
||||
if (!wm8741->sysclk) {
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"No MCLK configured, call set_sysclk() on init or in hw_params\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -215,7 +215,7 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream,
|
||||
}
|
||||
|
||||
if (i == wm8741->sysclk_constraints->count) {
|
||||
dev_err(codec->dev, "LRCLK %d unsupported with MCLK %d\n",
|
||||
dev_err(component->dev, "LRCLK %d unsupported with MCLK %d\n",
|
||||
params_rate(params), wm8741->sysclk);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -235,15 +235,15 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream,
|
||||
iface = 0x3;
|
||||
break;
|
||||
default:
|
||||
dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d",
|
||||
dev_dbg(component->dev, "wm8741_hw_params: Unsupported bit size param = %d",
|
||||
params_width(params));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "wm8741_hw_params: bit size param = %d, rate param = %d",
|
||||
dev_dbg(component->dev, "wm8741_hw_params: bit size param = %d, rate param = %d",
|
||||
params_width(params), params_rate(params));
|
||||
|
||||
snd_soc_update_bits(codec, WM8741_FORMAT_CONTROL, WM8741_IWL_MASK,
|
||||
snd_soc_component_update_bits(component, WM8741_FORMAT_CONTROL, WM8741_IWL_MASK,
|
||||
iface);
|
||||
|
||||
return 0;
|
||||
@ -252,10 +252,10 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream,
|
||||
static int wm8741_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct wm8741_priv *wm8741 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
dev_dbg(codec->dev, "wm8741_set_dai_sysclk info: freq=%dHz\n", freq);
|
||||
dev_dbg(component->dev, "wm8741_set_dai_sysclk info: freq=%dHz\n", freq);
|
||||
|
||||
switch (freq) {
|
||||
case 0:
|
||||
@ -297,7 +297,7 @@ static int wm8741_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
unsigned int iface;
|
||||
|
||||
/* check master/slave audio interface */
|
||||
@ -347,11 +347,11 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
}
|
||||
|
||||
|
||||
dev_dbg(codec->dev, "wm8741_set_dai_fmt: Format=%x, Clock Inv=%x\n",
|
||||
dev_dbg(component->dev, "wm8741_set_dai_fmt: Format=%x, Clock Inv=%x\n",
|
||||
fmt & SND_SOC_DAIFMT_FORMAT_MASK,
|
||||
((fmt & SND_SOC_DAIFMT_INV_MASK)));
|
||||
|
||||
snd_soc_update_bits(codec, WM8741_FORMAT_CONTROL,
|
||||
snd_soc_component_update_bits(component, WM8741_FORMAT_CONTROL,
|
||||
WM8741_BCP_MASK | WM8741_LRP_MASK | WM8741_FMT_MASK,
|
||||
iface);
|
||||
|
||||
@ -386,18 +386,18 @@ static struct snd_soc_dai_driver wm8741_dai = {
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int wm8741_resume(struct snd_soc_codec *codec)
|
||||
static int wm8741_resume(struct snd_soc_component *component)
|
||||
{
|
||||
snd_soc_cache_sync(codec);
|
||||
snd_soc_component_cache_sync(component);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define wm8741_resume NULL
|
||||
#endif
|
||||
|
||||
static int wm8741_configure(struct snd_soc_codec *codec)
|
||||
static int wm8741_configure(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8741_priv *wm8741 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
/* Configure differential mode */
|
||||
switch (wm8741->pdata.diff_mode) {
|
||||
@ -405,7 +405,7 @@ static int wm8741_configure(struct snd_soc_codec *codec)
|
||||
case WM8741_DIFF_MODE_STEREO_REVERSED:
|
||||
case WM8741_DIFF_MODE_MONO_LEFT:
|
||||
case WM8741_DIFF_MODE_MONO_RIGHT:
|
||||
snd_soc_update_bits(codec, WM8741_MODE_CONTROL_2,
|
||||
snd_soc_component_update_bits(component, WM8741_MODE_CONTROL_2,
|
||||
WM8741_DIFF_MASK,
|
||||
wm8741->pdata.diff_mode << WM8741_DIFF_SHIFT);
|
||||
break;
|
||||
@ -414,36 +414,36 @@ static int wm8741_configure(struct snd_soc_codec *codec)
|
||||
}
|
||||
|
||||
/* Change some default settings - latch VU */
|
||||
snd_soc_update_bits(codec, WM8741_DACLLSB_ATTENUATION,
|
||||
snd_soc_component_update_bits(component, WM8741_DACLLSB_ATTENUATION,
|
||||
WM8741_UPDATELL, WM8741_UPDATELL);
|
||||
snd_soc_update_bits(codec, WM8741_DACLMSB_ATTENUATION,
|
||||
snd_soc_component_update_bits(component, WM8741_DACLMSB_ATTENUATION,
|
||||
WM8741_UPDATELM, WM8741_UPDATELM);
|
||||
snd_soc_update_bits(codec, WM8741_DACRLSB_ATTENUATION,
|
||||
snd_soc_component_update_bits(component, WM8741_DACRLSB_ATTENUATION,
|
||||
WM8741_UPDATERL, WM8741_UPDATERL);
|
||||
snd_soc_update_bits(codec, WM8741_DACRMSB_ATTENUATION,
|
||||
snd_soc_component_update_bits(component, WM8741_DACRMSB_ATTENUATION,
|
||||
WM8741_UPDATERM, WM8741_UPDATERM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm8741_add_controls(struct snd_soc_codec *codec)
|
||||
static int wm8741_add_controls(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8741_priv *wm8741 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (wm8741->pdata.diff_mode) {
|
||||
case WM8741_DIFF_MODE_STEREO:
|
||||
case WM8741_DIFF_MODE_STEREO_REVERSED:
|
||||
snd_soc_add_codec_controls(codec,
|
||||
snd_soc_add_component_controls(component,
|
||||
wm8741_snd_controls_stereo,
|
||||
ARRAY_SIZE(wm8741_snd_controls_stereo));
|
||||
break;
|
||||
case WM8741_DIFF_MODE_MONO_LEFT:
|
||||
snd_soc_add_codec_controls(codec,
|
||||
snd_soc_add_component_controls(component,
|
||||
wm8741_snd_controls_mono_left,
|
||||
ARRAY_SIZE(wm8741_snd_controls_mono_left));
|
||||
break;
|
||||
case WM8741_DIFF_MODE_MONO_RIGHT:
|
||||
snd_soc_add_codec_controls(codec,
|
||||
snd_soc_add_component_controls(component,
|
||||
wm8741_snd_controls_mono_right,
|
||||
ARRAY_SIZE(wm8741_snd_controls_mono_right));
|
||||
break;
|
||||
@ -454,37 +454,37 @@ static int wm8741_add_controls(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm8741_probe(struct snd_soc_codec *codec)
|
||||
static int wm8741_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8741_priv *wm8741 = snd_soc_component_get_drvdata(component);
|
||||
int ret = 0;
|
||||
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(wm8741->supplies),
|
||||
wm8741->supplies);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
|
||||
dev_err(component->dev, "Failed to enable supplies: %d\n", ret);
|
||||
goto err_get;
|
||||
}
|
||||
|
||||
ret = wm8741_reset(codec);
|
||||
ret = wm8741_reset(component);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "Failed to issue reset\n");
|
||||
dev_err(component->dev, "Failed to issue reset\n");
|
||||
goto err_enable;
|
||||
}
|
||||
|
||||
ret = wm8741_configure(codec);
|
||||
ret = wm8741_configure(component);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "Failed to change default settings\n");
|
||||
dev_err(component->dev, "Failed to change default settings\n");
|
||||
goto err_enable;
|
||||
}
|
||||
|
||||
ret = wm8741_add_controls(codec);
|
||||
ret = wm8741_add_controls(component);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "Failed to add controls\n");
|
||||
dev_err(component->dev, "Failed to add controls\n");
|
||||
goto err_enable;
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "Successful registration\n");
|
||||
dev_dbg(component->dev, "Successful registration\n");
|
||||
return ret;
|
||||
|
||||
err_enable:
|
||||
@ -493,26 +493,25 @@ static int wm8741_probe(struct snd_soc_codec *codec)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm8741_remove(struct snd_soc_codec *codec)
|
||||
static void wm8741_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8741_priv *wm8741 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
regulator_bulk_disable(ARRAY_SIZE(wm8741->supplies), wm8741->supplies);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm8741 = {
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm8741 = {
|
||||
.probe = wm8741_probe,
|
||||
.remove = wm8741_remove,
|
||||
.resume = wm8741_resume,
|
||||
|
||||
.component_driver = {
|
||||
.dapm_widgets = wm8741_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm8741_dapm_widgets),
|
||||
.dapm_routes = wm8741_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm8741_dapm_routes),
|
||||
},
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct of_device_id wm8741_of_match[] = {
|
||||
@ -585,18 +584,12 @@ static int wm8741_i2c_probe(struct i2c_client *i2c,
|
||||
|
||||
i2c_set_clientdata(i2c, wm8741);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c->dev,
|
||||
&soc_codec_dev_wm8741, &wm8741_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c->dev,
|
||||
&soc_component_dev_wm8741, &wm8741_dai, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm8741_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id wm8741_i2c_id[] = {
|
||||
{ "wm8741", 0 },
|
||||
{ }
|
||||
@ -609,7 +602,6 @@ static struct i2c_driver wm8741_i2c_driver = {
|
||||
.of_match_table = wm8741_of_match,
|
||||
},
|
||||
.probe = wm8741_i2c_probe,
|
||||
.remove = wm8741_i2c_remove,
|
||||
.id_table = wm8741_i2c_id,
|
||||
};
|
||||
#endif
|
||||
@ -650,24 +642,17 @@ static int wm8741_spi_probe(struct spi_device *spi)
|
||||
|
||||
spi_set_drvdata(spi, wm8741);
|
||||
|
||||
ret = snd_soc_register_codec(&spi->dev,
|
||||
&soc_codec_dev_wm8741, &wm8741_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&spi->dev,
|
||||
&soc_component_dev_wm8741, &wm8741_dai, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm8741_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct spi_driver wm8741_spi_driver = {
|
||||
.driver = {
|
||||
.name = "wm8741",
|
||||
.of_match_table = wm8741_of_match,
|
||||
},
|
||||
.probe = wm8741_spi_probe,
|
||||
.remove = wm8741_spi_remove,
|
||||
};
|
||||
#endif /* CONFIG_SPI_MASTER */
|
||||
|
||||
|
@ -86,7 +86,7 @@ struct wm8750_priv {
|
||||
unsigned int sysclk;
|
||||
};
|
||||
|
||||
#define wm8750_reset(c) snd_soc_write(c, WM8750_RESET, 0)
|
||||
#define wm8750_reset(c) snd_soc_component_write(c, WM8750_RESET, 0)
|
||||
|
||||
/*
|
||||
* WM8750 Controls
|
||||
@ -502,8 +502,8 @@ static inline int get_coeff(int mclk, int rate)
|
||||
static int wm8750_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct wm8750_priv *wm8750 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct wm8750_priv *wm8750 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (freq) {
|
||||
case 11289600:
|
||||
@ -520,7 +520,7 @@ static int wm8750_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
static int wm8750_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
u16 iface = 0;
|
||||
|
||||
/* set master/slave audio interface */
|
||||
@ -571,7 +571,7 @@ static int wm8750_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_write(codec, WM8750_IFACE, iface);
|
||||
snd_soc_component_write(component, WM8750_IFACE, iface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -579,10 +579,10 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct wm8750_priv *wm8750 = snd_soc_codec_get_drvdata(codec);
|
||||
u16 iface = snd_soc_read(codec, WM8750_IFACE) & 0x1f3;
|
||||
u16 srate = snd_soc_read(codec, WM8750_SRATE) & 0x1c0;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct wm8750_priv *wm8750 = snd_soc_component_get_drvdata(component);
|
||||
u16 iface = snd_soc_component_read32(component, WM8750_IFACE) & 0x1f3;
|
||||
u16 srate = snd_soc_component_read32(component, WM8750_SRATE) & 0x1c0;
|
||||
int coeff = get_coeff(wm8750->sysclk, params_rate(params));
|
||||
|
||||
/* bit size */
|
||||
@ -601,9 +601,9 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
}
|
||||
|
||||
/* set iface & srate */
|
||||
snd_soc_write(codec, WM8750_IFACE, iface);
|
||||
snd_soc_component_write(component, WM8750_IFACE, iface);
|
||||
if (coeff >= 0)
|
||||
snd_soc_write(codec, WM8750_SRATE, srate |
|
||||
snd_soc_component_write(component, WM8750_SRATE, srate |
|
||||
(coeff_div[coeff].sr << 1) | coeff_div[coeff].usb);
|
||||
|
||||
return 0;
|
||||
@ -611,44 +611,44 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
static int wm8750_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
u16 mute_reg = snd_soc_read(codec, WM8750_ADCDAC) & 0xfff7;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
u16 mute_reg = snd_soc_component_read32(component, WM8750_ADCDAC) & 0xfff7;
|
||||
|
||||
if (mute)
|
||||
snd_soc_write(codec, WM8750_ADCDAC, mute_reg | 0x8);
|
||||
snd_soc_component_write(component, WM8750_ADCDAC, mute_reg | 0x8);
|
||||
else
|
||||
snd_soc_write(codec, WM8750_ADCDAC, mute_reg);
|
||||
snd_soc_component_write(component, WM8750_ADCDAC, mute_reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wm8750_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int wm8750_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
u16 pwr_reg = snd_soc_read(codec, WM8750_PWR1) & 0xfe3e;
|
||||
u16 pwr_reg = snd_soc_component_read32(component, WM8750_PWR1) & 0xfe3e;
|
||||
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
/* set vmid to 50k and unmute dac */
|
||||
snd_soc_write(codec, WM8750_PWR1, pwr_reg | 0x00c0);
|
||||
snd_soc_component_write(component, WM8750_PWR1, pwr_reg | 0x00c0);
|
||||
break;
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
||||
snd_soc_cache_sync(codec);
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||
snd_soc_component_cache_sync(component);
|
||||
|
||||
/* Set VMID to 5k */
|
||||
snd_soc_write(codec, WM8750_PWR1, pwr_reg | 0x01c1);
|
||||
snd_soc_component_write(component, WM8750_PWR1, pwr_reg | 0x01c1);
|
||||
|
||||
/* ...and ramp */
|
||||
msleep(1000);
|
||||
}
|
||||
|
||||
/* mute dac and set vmid to 500k, enable VREF */
|
||||
snd_soc_write(codec, WM8750_PWR1, pwr_reg | 0x0141);
|
||||
snd_soc_component_write(component, WM8750_PWR1, pwr_reg | 0x0141);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF:
|
||||
snd_soc_write(codec, WM8750_PWR1, 0x0001);
|
||||
snd_soc_component_write(component, WM8750_PWR1, 0x0001);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@ -685,42 +685,43 @@ static struct snd_soc_dai_driver wm8750_dai = {
|
||||
.ops = &wm8750_dai_ops,
|
||||
};
|
||||
|
||||
static int wm8750_probe(struct snd_soc_codec *codec)
|
||||
static int wm8750_probe(struct snd_soc_component *component)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = wm8750_reset(codec);
|
||||
ret = wm8750_reset(component);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "wm8750: failed to reset: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set the update bits */
|
||||
snd_soc_update_bits(codec, WM8750_LDAC, 0x0100, 0x0100);
|
||||
snd_soc_update_bits(codec, WM8750_RDAC, 0x0100, 0x0100);
|
||||
snd_soc_update_bits(codec, WM8750_LOUT1V, 0x0100, 0x0100);
|
||||
snd_soc_update_bits(codec, WM8750_ROUT1V, 0x0100, 0x0100);
|
||||
snd_soc_update_bits(codec, WM8750_LOUT2V, 0x0100, 0x0100);
|
||||
snd_soc_update_bits(codec, WM8750_ROUT2V, 0x0100, 0x0100);
|
||||
snd_soc_update_bits(codec, WM8750_LINVOL, 0x0100, 0x0100);
|
||||
snd_soc_update_bits(codec, WM8750_RINVOL, 0x0100, 0x0100);
|
||||
snd_soc_component_update_bits(component, WM8750_LDAC, 0x0100, 0x0100);
|
||||
snd_soc_component_update_bits(component, WM8750_RDAC, 0x0100, 0x0100);
|
||||
snd_soc_component_update_bits(component, WM8750_LOUT1V, 0x0100, 0x0100);
|
||||
snd_soc_component_update_bits(component, WM8750_ROUT1V, 0x0100, 0x0100);
|
||||
snd_soc_component_update_bits(component, WM8750_LOUT2V, 0x0100, 0x0100);
|
||||
snd_soc_component_update_bits(component, WM8750_ROUT2V, 0x0100, 0x0100);
|
||||
snd_soc_component_update_bits(component, WM8750_LINVOL, 0x0100, 0x0100);
|
||||
snd_soc_component_update_bits(component, WM8750_RINVOL, 0x0100, 0x0100);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm8750 = {
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm8750 = {
|
||||
.probe = wm8750_probe,
|
||||
.set_bias_level = wm8750_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.controls = wm8750_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(wm8750_snd_controls),
|
||||
.dapm_widgets = wm8750_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets),
|
||||
.dapm_routes = wm8750_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm8750_dapm_routes),
|
||||
},
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct of_device_id wm8750_of_match[] = {
|
||||
@ -758,17 +759,11 @@ static int wm8750_spi_probe(struct spi_device *spi)
|
||||
|
||||
spi_set_drvdata(spi, wm8750);
|
||||
|
||||
ret = snd_soc_register_codec(&spi->dev,
|
||||
&soc_codec_dev_wm8750, &wm8750_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&spi->dev,
|
||||
&soc_component_dev_wm8750, &wm8750_dai, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm8750_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spi_device_id wm8750_spi_ids[] = {
|
||||
{ "wm8750", 0 },
|
||||
{ "wm8987", 0 },
|
||||
@ -783,7 +778,6 @@ static struct spi_driver wm8750_spi_driver = {
|
||||
},
|
||||
.id_table = wm8750_spi_ids,
|
||||
.probe = wm8750_spi_probe,
|
||||
.remove = wm8750_spi_remove,
|
||||
};
|
||||
#endif /* CONFIG_SPI_MASTER */
|
||||
|
||||
@ -806,17 +800,11 @@ static int wm8750_i2c_probe(struct i2c_client *i2c,
|
||||
if (IS_ERR(regmap))
|
||||
return PTR_ERR(regmap);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c->dev,
|
||||
&soc_codec_dev_wm8750, &wm8750_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c->dev,
|
||||
&soc_component_dev_wm8750, &wm8750_dai, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wm8750_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id wm8750_i2c_id[] = {
|
||||
{ "wm8750", 0 },
|
||||
{ "wm8987", 0 },
|
||||
@ -830,7 +818,6 @@ static struct i2c_driver wm8750_i2c_driver = {
|
||||
.of_match_table = wm8750_of_match,
|
||||
},
|
||||
.probe = wm8750_i2c_probe,
|
||||
.remove = wm8750_i2c_remove,
|
||||
.id_table = wm8750_i2c_id,
|
||||
};
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user