Commit 3b04e29f authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/wm8523', 'asoc/topic/wm8524',...

Merge remote-tracking branches 'asoc/topic/wm8523', 'asoc/topic/wm8524', 'asoc/topic/wm8580', 'asoc/topic/wm8711' and 'asoc/topic/wm8727' into asoc-next
......@@ -10,7 +10,7 @@ Required properties:
Example:
codec: wm8524@0 {
codec: wm8524 {
compatible = "wlf,wm8524";
wlf,mute-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
};
......@@ -125,14 +125,14 @@ static const struct {
static int wm8523_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_component *component = dai->component;
struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component);
/* The set of sample rates that can be supported depends on the
* MCLK supplied to the CODEC - enforce this.
*/
if (!wm8523->sysclk) {
dev_err(codec->dev,
dev_err(component->dev,
"No MCLK configured, call set_sysclk() on init\n");
return -EINVAL;
}
......@@ -148,11 +148,11 @@ static int wm8523_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 wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_component *component = dai->component;
struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component);
int i;
u16 aifctrl1 = snd_soc_read(codec, WM8523_AIF_CTRL1);
u16 aifctrl2 = snd_soc_read(codec, WM8523_AIF_CTRL2);
u16 aifctrl1 = snd_soc_component_read32(component, WM8523_AIF_CTRL1);
u16 aifctrl2 = snd_soc_component_read32(component, WM8523_AIF_CTRL2);
/* Find a supported LRCLK ratio */
for (i = 0; i < ARRAY_SIZE(lrclk_ratios); i++) {
......@@ -163,7 +163,7 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream,
/* Should never happen, should be handled by constraints */
if (i == ARRAY_SIZE(lrclk_ratios)) {
dev_err(codec->dev, "MCLK/fs ratio %d unsupported\n",
dev_err(component->dev, "MCLK/fs ratio %d unsupported\n",
wm8523->sysclk / params_rate(params));
return -EINVAL;
}
......@@ -178,7 +178,7 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream,
break;
if (i == ARRAY_SIZE(bclk_ratios)) {
dev_err(codec->dev,
dev_err(component->dev,
"No matching BCLK/fs ratio for word length %d\n",
params_width(params));
return -EINVAL;
......@@ -203,8 +203,8 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream,
break;
}
snd_soc_write(codec, WM8523_AIF_CTRL1, aifctrl1);
snd_soc_write(codec, WM8523_AIF_CTRL2, aifctrl2);
snd_soc_component_write(component, WM8523_AIF_CTRL1, aifctrl1);
snd_soc_component_write(component, WM8523_AIF_CTRL2, aifctrl2);
return 0;
}
......@@ -212,8 +212,8 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream,
static int wm8523_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 wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_component *component = codec_dai->component;
struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component);
unsigned int val;
int i;
......@@ -239,13 +239,13 @@ static int wm8523_set_dai_sysclk(struct snd_soc_dai *codec_dai,
case 96000:
case 176400:
case 192000:
dev_dbg(codec->dev, "Supported sample rate: %dHz\n",
dev_dbg(component->dev, "Supported sample rate: %dHz\n",
val);
wm8523->rate_constraint_list[i] = val;
wm8523->rate_constraint.count++;
break;
default:
dev_dbg(codec->dev, "Skipping sample rate: %dHz\n",
dev_dbg(component->dev, "Skipping sample rate: %dHz\n",
val);
}
}
......@@ -261,8 +261,8 @@ static int wm8523_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int wm8523_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{
struct snd_soc_codec *codec = codec_dai->codec;
u16 aifctrl1 = snd_soc_read(codec, WM8523_AIF_CTRL1);
struct snd_soc_component *component = codec_dai->component;
u16 aifctrl1 = snd_soc_component_read32(component, WM8523_AIF_CTRL1);
aifctrl1 &= ~(WM8523_BCLK_INV_MASK | WM8523_LRCLK_INV_MASK |
WM8523_FMT_MASK | WM8523_AIF_MSTR_MASK);
......@@ -312,15 +312,15 @@ static int wm8523_set_dai_fmt(struct snd_soc_dai *codec_dai,
return -EINVAL;
}
snd_soc_write(codec, WM8523_AIF_CTRL1, aifctrl1);
snd_soc_component_write(component, WM8523_AIF_CTRL1, aifctrl1);
return 0;
}
static int wm8523_set_bias_level(struct snd_soc_codec *codec,
static int wm8523_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{
struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component);
int ret;
switch (level) {
......@@ -329,16 +329,16 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE:
/* Full power on */
snd_soc_update_bits(codec, WM8523_PSCTRL1,
snd_soc_component_update_bits(component, WM8523_PSCTRL1,
WM8523_SYS_ENA_MASK, 3);
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(wm8523->supplies),
wm8523->supplies);
if (ret != 0) {
dev_err(codec->dev,
dev_err(component->dev,
"Failed to enable supplies: %d\n",
ret);
return ret;
......@@ -348,21 +348,21 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
regcache_sync(wm8523->regmap);
/* Initial power up */
snd_soc_update_bits(codec, WM8523_PSCTRL1,
snd_soc_component_update_bits(component, WM8523_PSCTRL1,
WM8523_SYS_ENA_MASK, 1);
msleep(100);
}
/* Power up to mute */
snd_soc_update_bits(codec, WM8523_PSCTRL1,
snd_soc_component_update_bits(component, WM8523_PSCTRL1,
WM8523_SYS_ENA_MASK, 2);
break;
case SND_SOC_BIAS_OFF:
/* The chip runs through the power down sequence for us. */
snd_soc_update_bits(codec, WM8523_PSCTRL1,
snd_soc_component_update_bits(component, WM8523_PSCTRL1,
WM8523_SYS_ENA_MASK, 0);
msleep(100);
......@@ -397,35 +397,36 @@ static struct snd_soc_dai_driver wm8523_dai = {
.ops = &wm8523_dai_ops,
};
static int wm8523_probe(struct snd_soc_codec *codec)
static int wm8523_probe(struct snd_soc_component *component)
{
struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component);
wm8523->rate_constraint.list = &wm8523->rate_constraint_list[0];
wm8523->rate_constraint.count =
ARRAY_SIZE(wm8523->rate_constraint_list);
/* Change some default settings - latch VU and enable ZC */
snd_soc_update_bits(codec, WM8523_DAC_GAINR,
snd_soc_component_update_bits(component, WM8523_DAC_GAINR,
WM8523_DACR_VU, WM8523_DACR_VU);
snd_soc_update_bits(codec, WM8523_DAC_CTRL3, WM8523_ZC, WM8523_ZC);
snd_soc_component_update_bits(component, WM8523_DAC_CTRL3, WM8523_ZC, WM8523_ZC);
return 0;
}
static const struct snd_soc_codec_driver soc_codec_dev_wm8523 = {
.probe = wm8523_probe,
.set_bias_level = wm8523_set_bias_level,
.suspend_bias_off = true,
.component_driver = {
.controls = wm8523_controls,
.num_controls = ARRAY_SIZE(wm8523_controls),
.dapm_widgets = wm8523_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8523_dapm_widgets),
.dapm_routes = wm8523_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm8523_dapm_routes),
},
static const struct snd_soc_component_driver soc_component_dev_wm8523 = {
.probe = wm8523_probe,
.set_bias_level = wm8523_set_bias_level,
.controls = wm8523_controls,
.num_controls = ARRAY_SIZE(wm8523_controls),
.dapm_widgets = wm8523_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8523_dapm_widgets),
.dapm_routes = wm8523_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm8523_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 wm8523_of_match[] = {
......@@ -511,8 +512,8 @@ static int wm8523_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, wm8523);
ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_wm8523, &wm8523_dai, 1);
ret = devm_snd_soc_register_component(&i2c->dev,
&soc_component_dev_wm8523, &wm8523_dai, 1);
return ret;
......@@ -521,12 +522,6 @@ static int wm8523_i2c_probe(struct i2c_client *i2c,
return ret;
}
static int wm8523_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id wm8523_i2c_id[] = {
{ "wm8523", 0 },
{ }
......@@ -539,7 +534,6 @@ static struct i2c_driver wm8523_i2c_driver = {
.of_match_table = wm8523_of_match,
},
.probe = wm8523_i2c_probe,
.remove = wm8523_i2c_remove,
.id_table = wm8523_i2c_id,
};
......
......@@ -62,14 +62,14 @@ static const struct {
static int wm8524_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
struct wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_component *component = dai->component;
struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
/* The set of sample rates that can be supported depends on the
* MCLK supplied to the CODEC - enforce this.
*/
if (!wm8524->sysclk) {
dev_err(codec->dev,
dev_err(component->dev,
"No MCLK configured, call set_sysclk() on init\n");
return -EINVAL;
}
......@@ -86,8 +86,8 @@ static int wm8524_startup(struct snd_pcm_substream *substream,
static void wm8524_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
struct wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_component *component = dai->component;
struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
gpiod_set_value_cansleep(wm8524->mute, 0);
}
......@@ -95,8 +95,8 @@ static void wm8524_shutdown(struct snd_pcm_substream *substream,
static int wm8524_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 wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_component *component = codec_dai->component;
struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
unsigned int val;
int i, j = 0;
......@@ -118,13 +118,13 @@ static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai,
case 96000:
case 176400:
case 192000:
dev_dbg(codec->dev, "Supported sample rate: %dHz\n",
dev_dbg(component->dev, "Supported sample rate: %dHz\n",
val);
wm8524->rate_constraint_list[j++] = val;
wm8524->rate_constraint.count++;
break;
default:
dev_dbg(codec->dev, "Skipping sample rate: %dHz\n",
dev_dbg(component->dev, "Skipping sample rate: %dHz\n",
val);
}
}
......@@ -152,7 +152,7 @@ static int wm8524_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
static int wm8524_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{
struct wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(dai->codec);
struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(dai->component);
if (wm8524->mute)
gpiod_set_value_cansleep(wm8524->mute, mute);
......@@ -184,9 +184,9 @@ static struct snd_soc_dai_driver wm8524_dai = {
.ops = &wm8524_dai_ops,
};
static int wm8524_probe(struct snd_soc_codec *codec)
static int wm8524_probe(struct snd_soc_component *component)
{
struct wm8524_priv *wm8524 = snd_soc_codec_get_drvdata(codec);
struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
wm8524->rate_constraint.list = &wm8524->rate_constraint_list[0];
wm8524->rate_constraint.count =
......@@ -195,15 +195,16 @@ static int wm8524_probe(struct snd_soc_codec *codec)
return 0;
}
static const struct snd_soc_codec_driver soc_codec_dev_wm8524 = {
.probe = wm8524_probe,
.component_driver = {
.dapm_widgets = wm8524_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8524_dapm_widgets),
.dapm_routes = wm8524_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm8524_dapm_routes),
},
static const struct snd_soc_component_driver soc_component_dev_wm8524 = {
.probe = wm8524_probe,
.dapm_widgets = wm8524_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8524_dapm_widgets),
.dapm_routes = wm8524_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm8524_dapm_routes),
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
};
static const struct of_device_id wm8524_of_match[] = {
......@@ -231,23 +232,16 @@ static int wm8524_codec_probe(struct platform_device *pdev)
return ret;
}
ret = snd_soc_register_codec(&pdev->dev,
&soc_codec_dev_wm8524, &wm8524_dai, 1);
ret = devm_snd_soc_register_component(&pdev->dev,
&soc_component_dev_wm8524, &wm8524_dai, 1);
if (ret < 0)
dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
return ret;
}
static int wm8524_codec_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
return 0;
}
static struct platform_driver wm8524_codec_driver = {
.probe = wm8524_codec_probe,
.remove = wm8524_codec_remove,
.driver = {
.name = "wm8524-codec",
.of_match_table = wm8524_of_match,
......
This diff is collapsed.
......@@ -58,7 +58,7 @@ static bool wm8711_volatile(struct device *dev, unsigned int reg)
}
}
#define wm8711_reset(c) snd_soc_write(c, WM8711_RESET, 0)
#define wm8711_reset(c) snd_soc_component_write(c, WM8711_RESET, 0)
static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
......@@ -159,14 +159,14 @@ static int wm8711_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 wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0xfff3;
struct snd_soc_component *component = dai->component;
struct wm8711_priv *wm8711 = snd_soc_component_get_drvdata(component);
u16 iface = snd_soc_component_read32(component, WM8711_IFACE) & 0xfff3;
int i = get_coeff(wm8711->sysclk, params_rate(params));
u16 srate = (coeff_div[i].sr << 2) |
(coeff_div[i].bosr << 1) | coeff_div[i].usb;
snd_soc_write(codec, WM8711_SRATE, srate);
snd_soc_component_write(component, WM8711_SRATE, srate);
/* bit size */
switch (params_width(params)) {
......@@ -180,17 +180,17 @@ static int wm8711_hw_params(struct snd_pcm_substream *substream,
break;
}
snd_soc_write(codec, WM8711_IFACE, iface);
snd_soc_component_write(component, WM8711_IFACE, iface);
return 0;
}
static int wm8711_pcm_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
struct snd_soc_component *component = dai->component;
/* set active */
snd_soc_write(codec, WM8711_ACTIVE, 0x0001);
snd_soc_component_write(component, WM8711_ACTIVE, 0x0001);
return 0;
}
......@@ -198,24 +198,24 @@ static int wm8711_pcm_prepare(struct snd_pcm_substream *substream,
static void wm8711_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
struct snd_soc_component *component = dai->component;
/* deactivate */
if (!snd_soc_codec_is_active(codec)) {
if (!snd_soc_component_is_active(component)) {
udelay(50);
snd_soc_write(codec, WM8711_ACTIVE, 0x0);
snd_soc_component_write(component, WM8711_ACTIVE, 0x0);
}
}
static int wm8711_mute(struct snd_soc_dai *dai, int mute)
{
struct snd_soc_codec *codec = dai->codec;
u16 mute_reg = snd_soc_read(codec, WM8711_APDIGI) & 0xfff7;
struct snd_soc_component *component = dai->component;
u16 mute_reg = snd_soc_component_read32(component, WM8711_APDIGI) & 0xfff7;
if (mute)
snd_soc_write(codec, WM8711_APDIGI, mute_reg | 0x8);
snd_soc_component_write(component, WM8711_APDIGI, mute_reg | 0x8);
else
snd_soc_write(codec, WM8711_APDIGI, mute_reg);
snd_soc_component_write(component, WM8711_APDIGI, mute_reg);
return 0;
}
......@@ -223,8 +223,8 @@ static int wm8711_mute(struct snd_soc_dai *dai, int mute)
static int wm8711_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 wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_component *component = codec_dai->component;
struct wm8711_priv *wm8711 = snd_soc_component_get_drvdata(component);
switch (freq) {
case 11289600:
......@@ -241,8 +241,8 @@ static int wm8711_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int wm8711_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, WM8711_IFACE) & 0x000c;
struct snd_soc_component *component = codec_dai->component;
u16 iface = snd_soc_component_read32(component, WM8711_IFACE) & 0x000c;
/* set master/slave audio interface */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
......@@ -293,31 +293,31 @@ static int wm8711_set_dai_fmt(struct snd_soc_dai *codec_dai,
}
/* set iface */
snd_soc_write(codec, WM8711_IFACE, iface);
snd_soc_component_write(component, WM8711_IFACE, iface);
return 0;
}
static int wm8711_set_bias_level(struct snd_soc_codec *codec,
static int wm8711_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{
struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
u16 reg = snd_soc_read(codec, WM8711_PWR) & 0xff7f;
struct wm8711_priv *wm8711 = snd_soc_component_get_drvdata(component);
u16 reg = snd_soc_component_read32(component, WM8711_PWR) & 0xff7f;
switch (level) {
case SND_SOC_BIAS_ON:
snd_soc_write(codec, WM8711_PWR, reg);
snd_soc_component_write(component, WM8711_PWR, reg);
break;
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)
regcache_sync(wm8711->regmap);
snd_soc_write(codec, WM8711_PWR, reg | 0x0040);
snd_soc_component_write(component, WM8711_PWR, reg | 0x0040);
break;
case SND_SOC_BIAS_OFF:
snd_soc_write(codec, WM8711_ACTIVE, 0x0);
snd_soc_write(codec, WM8711_PWR, 0xffff);
snd_soc_component_write(component, WM8711_ACTIVE, 0x0);
snd_soc_component_write(component, WM8711_PWR, 0xffff);
break;
}
return 0;
......@@ -349,37 +349,38 @@ static struct snd_soc_dai_driver wm8711_dai = {
.ops = &wm8711_ops,
};
static int wm8711_probe(struct snd_soc_codec *codec)
static int wm8711_probe(struct snd_soc_component *component)
{
int ret;
ret = wm8711_reset(codec);
ret = wm8711_reset(component);
if (ret < 0) {
dev_err(codec->dev, "Failed to issue reset\n");
dev_err(component->dev, "Failed to issue reset\n");
return ret;
}
/* Latch the update bits */
snd_soc_update_bits(codec, WM8711_LOUT1V, 0x0100, 0x0100);
snd_soc_update_bits(codec, WM8711_ROUT1V, 0x0100, 0x0100);
snd_soc_component_update_bits(component, WM8711_LOUT1V, 0x0100, 0x0100);
snd_soc_component_update_bits(component, WM8711_ROUT1V, 0x0100, 0x0100);
return ret;
}
static const struct snd_soc_codec_driver soc_codec_dev_wm8711 = {
.probe = wm8711_probe,
.set_bias_level = wm8711_set_bias_level,
.suspend_bias_off = true,
.component_driver = {
.controls = wm8711_snd_controls,
.num_controls = ARRAY_SIZE(wm8711_snd_controls),
.dapm_widgets = wm8711_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8711_dapm_widgets),
.dapm_routes = wm8711_intercon,
.num_dapm_routes = ARRAY_SIZE(wm8711_intercon),
},
static const struct snd_soc_component_driver soc_component_dev_wm8711 = {
.probe = wm8711_probe,
.set_bias_level = wm8711_set_bias_level,
.controls = wm8711_snd_controls,
.num_controls = ARRAY_SIZE(wm8711_snd_controls),
.dapm_widgets = wm8711_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8711_dapm_widgets),
.dapm_routes = wm8711_intercon,
.num_dapm_routes = ARRAY_SIZE(wm8711_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 wm8711_of_match[] = {
......@@ -417,26 +418,18 @@ static int wm8711_spi_probe(struct spi_device *spi)
spi_set_drvdata(spi, wm8711);
ret = snd_soc_register_codec(&spi->dev,
&soc_codec_dev_wm8711, &wm8711_dai, 1);
ret = devm_snd_soc_register_component(&spi->dev,
&soc_component_dev_wm8711, &wm8711_dai, 1);
return ret;
}
static int wm8711_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
return 0;
}
static struct spi_driver wm8711_spi_driver = {
.driver = {
.name = "wm8711",
.of_match_table = wm8711_of_match,
},
.probe = wm8711_spi_probe,
.remove = wm8711_spi_remove,
};
#endif /* CONFIG_SPI_MASTER */
......@@ -458,18 +451,12 @@ static int wm8711_i2c_probe(struct i2c_client *client,
i2c_set_clientdata(client, wm8711);
ret = snd_soc_register_codec(&client->dev,
&soc_codec_dev_wm8711, &wm8711_dai, 1);
ret = devm_snd_soc_register_component(&client->dev,
&soc_component_dev_wm8711, &wm8711_dai, 1);
return ret;
}
static int wm8711_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id wm8711_i2c_id[] = {
{ "wm8711", 0 },
{ }
......@@ -482,7 +469,6 @@ static struct i2c_driver wm8711_i2c_driver = {
.of_match_table = wm8711_of_match,
},
.probe = wm8711_i2c_probe,
.remove = wm8711_i2c_remove,
.id_table = wm8711_i2c_id,
};
#endif
......
......@@ -19,7 +19,6 @@
#include <linux/device.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/initval.h>
#include <sound/soc.h>
......@@ -41,7 +40,6 @@ static const struct snd_soc_dapm_route wm8727_dapm_routes[] = {
SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
SNDRV_PCM_RATE_192000)
static struct snd_soc_dai_driver wm8727_dai = {
.name = "wm8727-hifi",
.playback = {
......@@ -53,25 +51,21 @@ static struct snd_soc_dai_driver wm8727_dai = {
},
};
static const struct snd_soc_codec_driver soc_codec_dev_wm8727 = {
.component_driver = {
.dapm_widgets = wm8727_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8727_dapm_widgets),
.dapm_routes = wm8727_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm8727_dapm_routes),
},
static const struct snd_soc_component_driver soc_component_dev_wm8727 = {
.dapm_widgets = wm8727_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8727_dapm_widgets),
.dapm_routes = wm8727_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm8727_dapm_routes),
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
};
static int wm8727_probe(struct platform_device *pdev)
{
return snd_soc_register_codec(&pdev->dev,
&soc_codec_dev_wm8727, &wm8727_dai, 1);
}
static int wm8727_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
return 0;
return devm_snd_soc_register_component(&pdev->dev,
&soc_component_dev_wm8727, &wm8727_dai, 1);
}
static struct platform_driver wm8727_codec_driver = {
......@@ -80,7 +74,6 @@ static struct platform_driver wm8727_codec_driver = {
},
.probe = wm8727_probe,
.remove = wm8727_remove,
};
module_platform_driver(wm8727_codec_driver);
......
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