Commit 231b5607 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/ad73311', 'asoc/topic/adau1373',...

Merge remote-tracking branches 'asoc/topic/ad73311', 'asoc/topic/adau1373', 'asoc/topic/adau17x1', 'asoc/topic/adau1977' and 'asoc/topic/adau7002' into asoc-next
...@@ -549,8 +549,8 @@ static const struct snd_kcontrol_new adau1373_drc_controls[] = { ...@@ -549,8 +549,8 @@ static const struct snd_kcontrol_new adau1373_drc_controls[] = {
static int adau1373_pll_event(struct snd_soc_dapm_widget *w, static int adau1373_pll_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
unsigned int pll_id = w->name[3] - '1'; unsigned int pll_id = w->name[3] - '1';
unsigned int val; unsigned int val;
...@@ -821,8 +821,8 @@ static const struct snd_soc_dapm_widget adau1373_dapm_widgets[] = { ...@@ -821,8 +821,8 @@ static const struct snd_soc_dapm_widget adau1373_dapm_widgets[] = {
static int adau1373_check_aif_clk(struct snd_soc_dapm_widget *source, static int adau1373_check_aif_clk(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink) struct snd_soc_dapm_widget *sink)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
unsigned int dai; unsigned int dai;
const char *clk; const char *clk;
...@@ -842,8 +842,8 @@ static int adau1373_check_aif_clk(struct snd_soc_dapm_widget *source, ...@@ -842,8 +842,8 @@ static int adau1373_check_aif_clk(struct snd_soc_dapm_widget *source,
static int adau1373_check_src(struct snd_soc_dapm_widget *source, static int adau1373_check_src(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink) struct snd_soc_dapm_widget *sink)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
unsigned int dai; unsigned int dai;
dai = sink->name[3] - '1'; dai = sink->name[3] - '1';
...@@ -1031,8 +1031,8 @@ static const struct snd_soc_dapm_route adau1373_dapm_routes[] = { ...@@ -1031,8 +1031,8 @@ static const struct snd_soc_dapm_route adau1373_dapm_routes[] = {
static int adau1373_hw_params(struct snd_pcm_substream *substream, static int adau1373_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id]; struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id];
unsigned int div; unsigned int div;
unsigned int freq; unsigned int freq;
...@@ -1098,8 +1098,8 @@ static int adau1373_hw_params(struct snd_pcm_substream *substream, ...@@ -1098,8 +1098,8 @@ static int adau1373_hw_params(struct snd_pcm_substream *substream,
static int adau1373_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int adau1373_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id]; struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id];
unsigned int ctrl; unsigned int ctrl;
...@@ -1158,7 +1158,7 @@ static int adau1373_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) ...@@ -1158,7 +1158,7 @@ static int adau1373_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
static int adau1373_set_dai_sysclk(struct snd_soc_dai *dai, static int adau1373_set_dai_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(dai->codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(dai->component);
struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id]; struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id];
switch (clk_id) { switch (clk_id) {
...@@ -1250,10 +1250,10 @@ static struct snd_soc_dai_driver adau1373_dai_driver[] = { ...@@ -1250,10 +1250,10 @@ static struct snd_soc_dai_driver adau1373_dai_driver[] = {
}, },
}; };
static int adau1373_set_pll(struct snd_soc_codec *codec, int pll_id, static int adau1373_set_pll(struct snd_soc_component *component, int pll_id,
int source, unsigned int freq_in, unsigned int freq_out) int source, unsigned int freq_in, unsigned int freq_out)
{ {
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
unsigned int dpll_div = 0; unsigned int dpll_div = 0;
uint8_t pll_regs[5]; uint8_t pll_regs[5];
int ret; int ret;
...@@ -1348,10 +1348,10 @@ static bool adau1373_valid_micbias(enum adau1373_micbias_voltage micbias) ...@@ -1348,10 +1348,10 @@ static bool adau1373_valid_micbias(enum adau1373_micbias_voltage micbias)
return false; return false;
} }
static int adau1373_probe(struct snd_soc_codec *codec) static int adau1373_probe(struct snd_soc_component *component)
{ {
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
struct adau1373_platform_data *pdata = codec->dev->platform_data; struct adau1373_platform_data *pdata = component->dev->platform_data;
bool lineout_differential = false; bool lineout_differential = false;
unsigned int val; unsigned int val;
int i; int i;
...@@ -1369,7 +1369,7 @@ static int adau1373_probe(struct snd_soc_codec *codec) ...@@ -1369,7 +1369,7 @@ static int adau1373_probe(struct snd_soc_codec *codec)
pdata->drc_setting[i]); pdata->drc_setting[i]);
} }
snd_soc_add_codec_controls(codec, adau1373_drc_controls, snd_soc_add_component_controls(component, adau1373_drc_controls,
pdata->num_drc); pdata->num_drc);
val = 0; val = 0;
...@@ -1394,7 +1394,7 @@ static int adau1373_probe(struct snd_soc_codec *codec) ...@@ -1394,7 +1394,7 @@ static int adau1373_probe(struct snd_soc_codec *codec)
} }
if (!lineout_differential) { if (!lineout_differential) {
snd_soc_add_codec_controls(codec, adau1373_lineout2_controls, snd_soc_add_component_controls(component, adau1373_lineout2_controls,
ARRAY_SIZE(adau1373_lineout2_controls)); ARRAY_SIZE(adau1373_lineout2_controls));
} }
...@@ -1404,10 +1404,10 @@ static int adau1373_probe(struct snd_soc_codec *codec) ...@@ -1404,10 +1404,10 @@ static int adau1373_probe(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int adau1373_set_bias_level(struct snd_soc_codec *codec, static int adau1373_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
...@@ -1426,9 +1426,9 @@ static int adau1373_set_bias_level(struct snd_soc_codec *codec, ...@@ -1426,9 +1426,9 @@ static int adau1373_set_bias_level(struct snd_soc_codec *codec,
return 0; return 0;
} }
static int adau1373_resume(struct snd_soc_codec *codec) static int adau1373_resume(struct snd_soc_component *component)
{ {
struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec); struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
regcache_sync(adau1373->regmap); regcache_sync(adau1373->regmap);
...@@ -1458,22 +1458,20 @@ static const struct regmap_config adau1373_regmap_config = { ...@@ -1458,22 +1458,20 @@ static const struct regmap_config adau1373_regmap_config = {
.num_reg_defaults = ARRAY_SIZE(adau1373_reg_defaults), .num_reg_defaults = ARRAY_SIZE(adau1373_reg_defaults),
}; };
static const struct snd_soc_codec_driver adau1373_codec_driver = { static const struct snd_soc_component_driver adau1373_component_driver = {
.probe = adau1373_probe, .probe = adau1373_probe,
.resume = adau1373_resume, .resume = adau1373_resume,
.set_bias_level = adau1373_set_bias_level, .set_bias_level = adau1373_set_bias_level,
.idle_bias_off = true, .set_pll = adau1373_set_pll,
.controls = adau1373_controls,
.set_pll = adau1373_set_pll, .num_controls = ARRAY_SIZE(adau1373_controls),
.dapm_widgets = adau1373_dapm_widgets,
.component_driver = { .num_dapm_widgets = ARRAY_SIZE(adau1373_dapm_widgets),
.controls = adau1373_controls, .dapm_routes = adau1373_dapm_routes,
.num_controls = ARRAY_SIZE(adau1373_controls), .num_dapm_routes = ARRAY_SIZE(adau1373_dapm_routes),
.dapm_widgets = adau1373_dapm_widgets, .use_pmdown_time = 1,
.num_dapm_widgets = ARRAY_SIZE(adau1373_dapm_widgets), .endianness = 1,
.dapm_routes = adau1373_dapm_routes, .non_legacy_dai_naming = 1,
.num_dapm_routes = ARRAY_SIZE(adau1373_dapm_routes),
},
}; };
static int adau1373_i2c_probe(struct i2c_client *client, static int adau1373_i2c_probe(struct i2c_client *client,
...@@ -1495,17 +1493,12 @@ static int adau1373_i2c_probe(struct i2c_client *client, ...@@ -1495,17 +1493,12 @@ static int adau1373_i2c_probe(struct i2c_client *client,
dev_set_drvdata(&client->dev, adau1373); dev_set_drvdata(&client->dev, adau1373);
ret = snd_soc_register_codec(&client->dev, &adau1373_codec_driver, ret = devm_snd_soc_register_component(&client->dev,
&adau1373_component_driver,
adau1373_dai_driver, ARRAY_SIZE(adau1373_dai_driver)); adau1373_dai_driver, ARRAY_SIZE(adau1373_dai_driver));
return ret; return ret;
} }
static int adau1373_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id adau1373_i2c_id[] = { static const struct i2c_device_id adau1373_i2c_id[] = {
{ "adau1373", 0 }, { "adau1373", 0 },
{ } { }
...@@ -1517,7 +1510,6 @@ static struct i2c_driver adau1373_i2c_driver = { ...@@ -1517,7 +1510,6 @@ static struct i2c_driver adau1373_i2c_driver = {
.name = "adau1373", .name = "adau1373",
}, },
.probe = adau1373_i2c_probe, .probe = adau1373_i2c_probe,
.remove = adau1373_i2c_remove,
.id_table = adau1373_i2c_id, .id_table = adau1373_i2c_id,
}; };
......
This diff is collapsed.
...@@ -255,8 +255,8 @@ static const struct snd_kcontrol_new adau1761_input_mux_control = ...@@ -255,8 +255,8 @@ static const struct snd_kcontrol_new adau1761_input_mux_control =
static int adau1761_dejitter_fixup(struct snd_soc_dapm_widget *w, static int adau1761_dejitter_fixup(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
/* After any power changes have been made the dejitter circuit /* After any power changes have been made the dejitter circuit
* has to be reinitialized. */ * has to be reinitialized. */
...@@ -445,10 +445,10 @@ static const struct snd_soc_dapm_route adau1761_dapm_routes[] = { ...@@ -445,10 +445,10 @@ static const struct snd_soc_dapm_route adau1761_dapm_routes[] = {
{ "Digital Clock 1", NULL, "SYSCLK" }, { "Digital Clock 1", NULL, "SYSCLK" },
}; };
static int adau1761_set_bias_level(struct snd_soc_codec *codec, static int adau1761_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
...@@ -460,7 +460,7 @@ static int adau1761_set_bias_level(struct snd_soc_codec *codec, ...@@ -460,7 +460,7 @@ static int adau1761_set_bias_level(struct snd_soc_codec *codec,
regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL, regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL,
ADAU17X1_CLOCK_CONTROL_SYSCLK_EN, ADAU17X1_CLOCK_CONTROL_SYSCLK_EN,
ADAU17X1_CLOCK_CONTROL_SYSCLK_EN); ADAU17X1_CLOCK_CONTROL_SYSCLK_EN);
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(adau->regmap); regcache_sync(adau->regmap);
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
...@@ -474,9 +474,9 @@ static int adau1761_set_bias_level(struct snd_soc_codec *codec, ...@@ -474,9 +474,9 @@ static int adau1761_set_bias_level(struct snd_soc_codec *codec,
} }
static enum adau1761_output_mode adau1761_get_lineout_mode( static enum adau1761_output_mode adau1761_get_lineout_mode(
struct snd_soc_codec *codec) struct snd_soc_component *component)
{ {
struct adau1761_platform_data *pdata = codec->dev->platform_data; struct adau1761_platform_data *pdata = component->dev->platform_data;
if (pdata) if (pdata)
return pdata->lineout_mode; return pdata->lineout_mode;
...@@ -484,11 +484,11 @@ static enum adau1761_output_mode adau1761_get_lineout_mode( ...@@ -484,11 +484,11 @@ static enum adau1761_output_mode adau1761_get_lineout_mode(
return ADAU1761_OUTPUT_MODE_LINE; return ADAU1761_OUTPUT_MODE_LINE;
} }
static int adau1761_setup_digmic_jackdetect(struct snd_soc_codec *codec) static int adau1761_setup_digmic_jackdetect(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct adau1761_platform_data *pdata = codec->dev->platform_data; struct adau1761_platform_data *pdata = component->dev->platform_data;
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
enum adau1761_digmic_jackdet_pin_mode mode; enum adau1761_digmic_jackdet_pin_mode mode;
unsigned int val = 0; unsigned int val = 0;
int ret; int ret;
...@@ -513,7 +513,7 @@ static int adau1761_setup_digmic_jackdetect(struct snd_soc_codec *codec) ...@@ -513,7 +513,7 @@ static int adau1761_setup_digmic_jackdetect(struct snd_soc_codec *codec)
if (pdata->jackdetect_active_low) if (pdata->jackdetect_active_low)
val |= ADAU1761_DIGMIC_JACKDETECT_ACTIVE_LOW; val |= ADAU1761_DIGMIC_JACKDETECT_ACTIVE_LOW;
ret = snd_soc_add_codec_controls(codec, ret = snd_soc_add_component_controls(component,
adau1761_jack_detect_controls, adau1761_jack_detect_controls,
ARRAY_SIZE(adau1761_jack_detect_controls)); ARRAY_SIZE(adau1761_jack_detect_controls));
if (ret) if (ret)
...@@ -546,11 +546,11 @@ static int adau1761_setup_digmic_jackdetect(struct snd_soc_codec *codec) ...@@ -546,11 +546,11 @@ static int adau1761_setup_digmic_jackdetect(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int adau1761_setup_headphone_mode(struct snd_soc_codec *codec) static int adau1761_setup_headphone_mode(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
struct adau1761_platform_data *pdata = codec->dev->platform_data; struct adau1761_platform_data *pdata = component->dev->platform_data;
enum adau1761_output_mode mode; enum adau1761_output_mode mode;
int ret; int ret;
...@@ -588,7 +588,7 @@ static int adau1761_setup_headphone_mode(struct snd_soc_codec *codec) ...@@ -588,7 +588,7 @@ static int adau1761_setup_headphone_mode(struct snd_soc_codec *codec)
adau1761_capless_dapm_routes, adau1761_capless_dapm_routes,
ARRAY_SIZE(adau1761_capless_dapm_routes)); ARRAY_SIZE(adau1761_capless_dapm_routes));
} else { } else {
ret = snd_soc_add_codec_controls(codec, adau1761_mono_controls, ret = snd_soc_add_component_controls(component, adau1761_mono_controls,
ARRAY_SIZE(adau1761_mono_controls)); ARRAY_SIZE(adau1761_mono_controls));
if (ret) if (ret)
return ret; return ret;
...@@ -640,14 +640,14 @@ static bool adau1761_readable_register(struct device *dev, unsigned int reg) ...@@ -640,14 +640,14 @@ static bool adau1761_readable_register(struct device *dev, unsigned int reg)
return adau17x1_readable_register(dev, reg); return adau17x1_readable_register(dev, reg);
} }
static int adau1761_codec_probe(struct snd_soc_codec *codec) static int adau1761_component_probe(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct adau1761_platform_data *pdata = codec->dev->platform_data; struct adau1761_platform_data *pdata = component->dev->platform_data;
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = adau17x1_add_widgets(codec); ret = adau17x1_add_widgets(component);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -658,20 +658,20 @@ static int adau1761_codec_probe(struct snd_soc_codec *codec) ...@@ -658,20 +658,20 @@ static int adau1761_codec_probe(struct snd_soc_codec *codec)
regmap_update_bits(adau->regmap, ADAU1761_RIGHT_DIFF_INPUT_VOL, regmap_update_bits(adau->regmap, ADAU1761_RIGHT_DIFF_INPUT_VOL,
ADAU1761_DIFF_INPUT_VOL_LDEN, ADAU1761_DIFF_INPUT_VOL_LDEN,
ADAU1761_DIFF_INPUT_VOL_LDEN); ADAU1761_DIFF_INPUT_VOL_LDEN);
ret = snd_soc_add_codec_controls(codec, ret = snd_soc_add_component_controls(component,
adau1761_differential_mode_controls, adau1761_differential_mode_controls,
ARRAY_SIZE(adau1761_differential_mode_controls)); ARRAY_SIZE(adau1761_differential_mode_controls));
if (ret) if (ret)
return ret; return ret;
} else { } else {
ret = snd_soc_add_codec_controls(codec, ret = snd_soc_add_component_controls(component,
adau1761_single_mode_controls, adau1761_single_mode_controls,
ARRAY_SIZE(adau1761_single_mode_controls)); ARRAY_SIZE(adau1761_single_mode_controls));
if (ret) if (ret)
return ret; return ret;
} }
switch (adau1761_get_lineout_mode(codec)) { switch (adau1761_get_lineout_mode(component)) {
case ADAU1761_OUTPUT_MODE_LINE: case ADAU1761_OUTPUT_MODE_LINE:
break; break;
case ADAU1761_OUTPUT_MODE_HEADPHONE: case ADAU1761_OUTPUT_MODE_HEADPHONE:
...@@ -686,11 +686,11 @@ static int adau1761_codec_probe(struct snd_soc_codec *codec) ...@@ -686,11 +686,11 @@ static int adau1761_codec_probe(struct snd_soc_codec *codec)
return -EINVAL; return -EINVAL;
} }
ret = adau1761_setup_headphone_mode(codec); ret = adau1761_setup_headphone_mode(component);
if (ret) if (ret)
return ret; return ret;
ret = adau1761_setup_digmic_jackdetect(codec); ret = adau1761_setup_digmic_jackdetect(component);
if (ret) if (ret)
return ret; return ret;
...@@ -706,27 +706,28 @@ static int adau1761_codec_probe(struct snd_soc_codec *codec) ...@@ -706,27 +706,28 @@ static int adau1761_codec_probe(struct snd_soc_codec *codec)
return ret; return ret;
} }
ret = adau17x1_add_routes(codec); ret = adau17x1_add_routes(component);
if (ret < 0) if (ret < 0)
return ret; return ret;
return 0; return 0;
} }
static const struct snd_soc_codec_driver adau1761_codec_driver = { static const struct snd_soc_component_driver adau1761_component_driver = {
.probe = adau1761_codec_probe, .probe = adau1761_component_probe,
.resume = adau17x1_resume, .resume = adau17x1_resume,
.set_bias_level = adau1761_set_bias_level, .set_bias_level = adau1761_set_bias_level,
.suspend_bias_off = true, .controls = adau1761_controls,
.num_controls = ARRAY_SIZE(adau1761_controls),
.component_driver = { .dapm_widgets = adau1x61_dapm_widgets,
.controls = adau1761_controls, .num_dapm_widgets = ARRAY_SIZE(adau1x61_dapm_widgets),
.num_controls = ARRAY_SIZE(adau1761_controls), .dapm_routes = adau1x61_dapm_routes,
.dapm_widgets = adau1x61_dapm_widgets, .num_dapm_routes = ARRAY_SIZE(adau1x61_dapm_routes),
.num_dapm_widgets = ARRAY_SIZE(adau1x61_dapm_widgets), .suspend_bias_off = 1,
.dapm_routes = adau1x61_dapm_routes, .idle_bias_on = 1,
.num_dapm_routes = ARRAY_SIZE(adau1x61_dapm_routes), .use_pmdown_time = 1,
}, .endianness = 1,
.non_legacy_dai_naming = 1,
}; };
#define ADAU1761_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \ #define ADAU1761_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \
...@@ -793,7 +794,8 @@ int adau1761_probe(struct device *dev, struct regmap *regmap, ...@@ -793,7 +794,8 @@ int adau1761_probe(struct device *dev, struct regmap *regmap,
* reaches standby and the core clock is enabled */ * reaches standby and the core clock is enabled */
regcache_cache_only(regmap, true); regcache_cache_only(regmap, true);
return snd_soc_register_codec(dev, &adau1761_codec_driver, dai_drv, 1); return devm_snd_soc_register_component(dev, &adau1761_component_driver,
dai_drv, 1);
} }
EXPORT_SYMBOL_GPL(adau1761_probe); EXPORT_SYMBOL_GPL(adau1761_probe);
......
...@@ -174,8 +174,8 @@ static const struct snd_kcontrol_new adau1781_mono_mixer_controls[] = { ...@@ -174,8 +174,8 @@ static const struct snd_kcontrol_new adau1781_mono_mixer_controls[] = {
static int adau1781_dejitter_fixup(struct snd_soc_dapm_widget *w, static int adau1781_dejitter_fixup(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
/* After any power changes have been made the dejitter circuit /* After any power changes have been made the dejitter circuit
* has to be reinitialized. */ * has to be reinitialized. */
...@@ -314,10 +314,10 @@ static const struct snd_soc_dapm_route adau1781_dmic_dapm_routes[] = { ...@@ -314,10 +314,10 @@ static const struct snd_soc_dapm_route adau1781_dmic_dapm_routes[] = {
{ "Right Decimator", NULL, "DMIC Select" }, { "Right Decimator", NULL, "DMIC Select" },
}; };
static int adau1781_set_bias_level(struct snd_soc_codec *codec, static int adau1781_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
...@@ -380,14 +380,14 @@ static int adau1781_set_input_mode(struct adau *adau, unsigned int reg, ...@@ -380,14 +380,14 @@ static int adau1781_set_input_mode(struct adau *adau, unsigned int reg,
ADAU1781_INPUT_DIFFERNTIAL, val); ADAU1781_INPUT_DIFFERNTIAL, val);
} }
static int adau1781_codec_probe(struct snd_soc_codec *codec) static int adau1781_component_probe(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct adau1781_platform_data *pdata = dev_get_platdata(codec->dev); struct adau1781_platform_data *pdata = dev_get_platdata(component->dev);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = adau17x1_add_widgets(codec); ret = adau17x1_add_widgets(component);
if (ret) if (ret)
return ret; return ret;
...@@ -419,27 +419,28 @@ static int adau1781_codec_probe(struct snd_soc_codec *codec) ...@@ -419,27 +419,28 @@ static int adau1781_codec_probe(struct snd_soc_codec *codec)
return ret; return ret;
} }
ret = adau17x1_add_routes(codec); ret = adau17x1_add_routes(component);
if (ret < 0) if (ret < 0)
return ret; return ret;
return 0; return 0;
} }
static const struct snd_soc_codec_driver adau1781_codec_driver = { static const struct snd_soc_component_driver adau1781_component_driver = {
.probe = adau1781_codec_probe, .probe = adau1781_component_probe,
.resume = adau17x1_resume, .resume = adau17x1_resume,
.set_bias_level = adau1781_set_bias_level, .set_bias_level = adau1781_set_bias_level,
.suspend_bias_off = true, .controls = adau1781_controls,
.num_controls = ARRAY_SIZE(adau1781_controls),
.component_driver = { .dapm_widgets = adau1781_dapm_widgets,
.controls = adau1781_controls, .num_dapm_widgets = ARRAY_SIZE(adau1781_dapm_widgets),
.num_controls = ARRAY_SIZE(adau1781_controls), .dapm_routes = adau1781_dapm_routes,
.dapm_widgets = adau1781_dapm_widgets, .num_dapm_routes = ARRAY_SIZE(adau1781_dapm_routes),
.num_dapm_widgets = ARRAY_SIZE(adau1781_dapm_widgets), .suspend_bias_off = 1,
.dapm_routes = adau1781_dapm_routes, .idle_bias_on = 1,
.num_dapm_routes = ARRAY_SIZE(adau1781_dapm_routes), .use_pmdown_time = 1,
}, .endianness = 1,
.non_legacy_dai_naming = 1,
}; };
#define ADAU1781_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \ #define ADAU1781_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \
...@@ -498,7 +499,7 @@ int adau1781_probe(struct device *dev, struct regmap *regmap, ...@@ -498,7 +499,7 @@ int adau1781_probe(struct device *dev, struct regmap *regmap,
if (ret) if (ret)
return ret; return ret;
return snd_soc_register_codec(dev, &adau1781_codec_driver, return devm_snd_soc_register_component(dev, &adau1781_component_driver,
&adau1781_dai_driver, 1); &adau1781_dai_driver, 1);
} }
EXPORT_SYMBOL_GPL(adau1781_probe); EXPORT_SYMBOL_GPL(adau1781_probe);
......
...@@ -63,8 +63,8 @@ static const struct snd_kcontrol_new adau17x1_controls[] = { ...@@ -63,8 +63,8 @@ static const struct snd_kcontrol_new adau17x1_controls[] = {
static int adau17x1_pll_event(struct snd_soc_dapm_widget *w, static int adau17x1_pll_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
if (SND_SOC_DAPM_EVENT_ON(event)) { if (SND_SOC_DAPM_EVENT_ON(event)) {
adau->pll_regs[5] = 1; adau->pll_regs[5] = 1;
...@@ -93,8 +93,8 @@ static int adau17x1_pll_event(struct snd_soc_dapm_widget *w, ...@@ -93,8 +93,8 @@ static int adau17x1_pll_event(struct snd_soc_dapm_widget *w,
static int adau17x1_adc_fixup(struct snd_soc_dapm_widget *w, static int adau17x1_adc_fixup(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
/* /*
* If we are capturing, toggle the ADOSR bit in Converter Control 0 to * If we are capturing, toggle the ADOSR bit in Converter Control 0 to
...@@ -177,11 +177,11 @@ static const struct snd_soc_dapm_route adau17x1_dapm_pll_route = { ...@@ -177,11 +177,11 @@ static const struct snd_soc_dapm_route adau17x1_dapm_pll_route = {
static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol, static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
struct snd_soc_dapm_update update = { 0 }; struct snd_soc_dapm_update update = {};
unsigned int stream = e->shift_l; unsigned int stream = e->shift_l;
unsigned int val, change; unsigned int val, change;
int reg; int reg;
...@@ -205,7 +205,7 @@ static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol, ...@@ -205,7 +205,7 @@ static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol,
else else
reg = ADAU17X1_SERIAL_OUTPUT_ROUTE; reg = ADAU17X1_SERIAL_OUTPUT_ROUTE;
change = snd_soc_test_bits(codec, reg, 0xff, val); change = snd_soc_component_test_bits(component, reg, 0xff, val);
if (change) { if (change) {
update.kcontrol = kcontrol; update.kcontrol = kcontrol;
update.mask = 0xff; update.mask = 0xff;
...@@ -222,8 +222,8 @@ static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol, ...@@ -222,8 +222,8 @@ static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol,
static int adau17x1_dsp_mux_enum_get(struct snd_kcontrol *kcontrol, static int adau17x1_dsp_mux_enum_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int stream = e->shift_l; unsigned int stream = e->shift_l;
unsigned int reg, val; unsigned int reg, val;
...@@ -328,8 +328,8 @@ EXPORT_SYMBOL_GPL(adau17x1_has_dsp); ...@@ -328,8 +328,8 @@ EXPORT_SYMBOL_GPL(adau17x1_has_dsp);
static int adau17x1_set_dai_pll(struct snd_soc_dai *dai, int pll_id, static int adau17x1_set_dai_pll(struct snd_soc_dai *dai, int pll_id,
int source, unsigned int freq_in, unsigned int freq_out) int source, unsigned int freq_in, unsigned int freq_out)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
int ret; int ret;
if (freq_in < 8000000 || freq_in > 27000000) if (freq_in < 8000000 || freq_in > 27000000)
...@@ -353,8 +353,8 @@ static int adau17x1_set_dai_pll(struct snd_soc_dai *dai, int pll_id, ...@@ -353,8 +353,8 @@ static int adau17x1_set_dai_pll(struct snd_soc_dai *dai, int pll_id,
static int adau17x1_set_dai_sysclk(struct snd_soc_dai *dai, static int adau17x1_set_dai_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(dai->codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(dai->component);
struct adau *adau = snd_soc_codec_get_drvdata(dai->codec); struct adau *adau = snd_soc_component_get_drvdata(dai->component);
bool is_pll; bool is_pll;
bool was_pll; bool was_pll;
...@@ -438,8 +438,8 @@ static int adau17x1_auto_pll(struct snd_soc_dai *dai, ...@@ -438,8 +438,8 @@ static int adau17x1_auto_pll(struct snd_soc_dai *dai,
static int adau17x1_hw_params(struct snd_pcm_substream *substream, static int adau17x1_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
unsigned int val, div, dsp_div; unsigned int val, div, dsp_div;
unsigned int freq; unsigned int freq;
int ret; int ret;
...@@ -531,7 +531,7 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream, ...@@ -531,7 +531,7 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream,
static int adau17x1_set_dai_fmt(struct snd_soc_dai *dai, static int adau17x1_set_dai_fmt(struct snd_soc_dai *dai,
unsigned int fmt) unsigned int fmt)
{ {
struct adau *adau = snd_soc_codec_get_drvdata(dai->codec); struct adau *adau = snd_soc_component_get_drvdata(dai->component);
unsigned int ctrl0, ctrl1; unsigned int ctrl0, ctrl1;
int lrclk_pol; int lrclk_pol;
...@@ -603,7 +603,7 @@ static int adau17x1_set_dai_fmt(struct snd_soc_dai *dai, ...@@ -603,7 +603,7 @@ static int adau17x1_set_dai_fmt(struct snd_soc_dai *dai,
static int adau17x1_set_dai_tdm_slot(struct snd_soc_dai *dai, static int adau17x1_set_dai_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
{ {
struct adau *adau = snd_soc_codec_get_drvdata(dai->codec); struct adau *adau = snd_soc_component_get_drvdata(dai->component);
unsigned int ser_ctrl0, ser_ctrl1; unsigned int ser_ctrl0, ser_ctrl1;
unsigned int conv_ctrl0, conv_ctrl1; unsigned int conv_ctrl0, conv_ctrl1;
...@@ -728,7 +728,7 @@ static int adau17x1_set_dai_tdm_slot(struct snd_soc_dai *dai, ...@@ -728,7 +728,7 @@ static int adau17x1_set_dai_tdm_slot(struct snd_soc_dai *dai,
static int adau17x1_startup(struct snd_pcm_substream *substream, static int adau17x1_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct adau *adau = snd_soc_codec_get_drvdata(dai->codec); struct adau *adau = snd_soc_component_get_drvdata(dai->component);
if (adau->sigmadsp) if (adau->sigmadsp)
return sigmadsp_restrict_params(adau->sigmadsp, substream); return sigmadsp_restrict_params(adau->sigmadsp, substream);
...@@ -746,10 +746,10 @@ const struct snd_soc_dai_ops adau17x1_dai_ops = { ...@@ -746,10 +746,10 @@ const struct snd_soc_dai_ops adau17x1_dai_ops = {
}; };
EXPORT_SYMBOL_GPL(adau17x1_dai_ops); EXPORT_SYMBOL_GPL(adau17x1_dai_ops);
int adau17x1_set_micbias_voltage(struct snd_soc_codec *codec, int adau17x1_set_micbias_voltage(struct snd_soc_component *component,
enum adau17x1_micbias_voltage micbias) enum adau17x1_micbias_voltage micbias)
{ {
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
switch (micbias) { switch (micbias) {
case ADAU17X1_MICBIAS_0_90_AVDD: case ADAU17X1_MICBIAS_0_90_AVDD:
...@@ -858,13 +858,13 @@ int adau17x1_setup_firmware(struct adau *adau, unsigned int rate) ...@@ -858,13 +858,13 @@ int adau17x1_setup_firmware(struct adau *adau, unsigned int rate)
} }
EXPORT_SYMBOL_GPL(adau17x1_setup_firmware); EXPORT_SYMBOL_GPL(adau17x1_setup_firmware);
int adau17x1_add_widgets(struct snd_soc_codec *codec) int adau17x1_add_widgets(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = snd_soc_add_codec_controls(codec, adau17x1_controls, ret = snd_soc_add_component_controls(component, adau17x1_controls,
ARRAY_SIZE(adau17x1_controls)); ARRAY_SIZE(adau17x1_controls));
if (ret) if (ret)
return ret; return ret;
...@@ -882,9 +882,9 @@ int adau17x1_add_widgets(struct snd_soc_codec *codec) ...@@ -882,9 +882,9 @@ int adau17x1_add_widgets(struct snd_soc_codec *codec)
if (!adau->sigmadsp) if (!adau->sigmadsp)
return 0; return 0;
ret = sigmadsp_attach(adau->sigmadsp, &codec->component); ret = sigmadsp_attach(adau->sigmadsp, component);
if (ret) { if (ret) {
dev_err(codec->dev, "Failed to attach firmware: %d\n", dev_err(component->dev, "Failed to attach firmware: %d\n",
ret); ret);
return ret; return ret;
} }
...@@ -894,10 +894,10 @@ int adau17x1_add_widgets(struct snd_soc_codec *codec) ...@@ -894,10 +894,10 @@ int adau17x1_add_widgets(struct snd_soc_codec *codec)
} }
EXPORT_SYMBOL_GPL(adau17x1_add_widgets); EXPORT_SYMBOL_GPL(adau17x1_add_widgets);
int adau17x1_add_routes(struct snd_soc_codec *codec) int adau17x1_add_routes(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = snd_soc_dapm_add_routes(dapm, adau17x1_dapm_routes, ret = snd_soc_dapm_add_routes(dapm, adau17x1_dapm_routes,
...@@ -920,12 +920,12 @@ int adau17x1_add_routes(struct snd_soc_codec *codec) ...@@ -920,12 +920,12 @@ int adau17x1_add_routes(struct snd_soc_codec *codec)
} }
EXPORT_SYMBOL_GPL(adau17x1_add_routes); EXPORT_SYMBOL_GPL(adau17x1_add_routes);
int adau17x1_resume(struct snd_soc_codec *codec) int adau17x1_resume(struct snd_soc_component *component)
{ {
struct adau *adau = snd_soc_codec_get_drvdata(codec); struct adau *adau = snd_soc_component_get_drvdata(component);
if (adau->switch_mode) if (adau->switch_mode)
adau->switch_mode(codec->dev); adau->switch_mode(component->dev);
regcache_sync(adau->regmap); regcache_sync(adau->regmap);
...@@ -998,7 +998,6 @@ void adau17x1_remove(struct device *dev) ...@@ -998,7 +998,6 @@ void adau17x1_remove(struct device *dev)
{ {
struct adau *adau = dev_get_drvdata(dev); struct adau *adau = dev_get_drvdata(dev);
snd_soc_unregister_codec(dev);
if (adau->mclk) if (adau->mclk)
clk_disable_unprepare(adau->mclk); clk_disable_unprepare(adau->mclk);
} }
......
...@@ -53,18 +53,18 @@ struct adau { ...@@ -53,18 +53,18 @@ struct adau {
struct sigmadsp *sigmadsp; struct sigmadsp *sigmadsp;
}; };
int adau17x1_add_widgets(struct snd_soc_codec *codec); int adau17x1_add_widgets(struct snd_soc_component *component);
int adau17x1_add_routes(struct snd_soc_codec *codec); int adau17x1_add_routes(struct snd_soc_component *component);
int adau17x1_probe(struct device *dev, struct regmap *regmap, int adau17x1_probe(struct device *dev, struct regmap *regmap,
enum adau17x1_type type, void (*switch_mode)(struct device *dev), enum adau17x1_type type, void (*switch_mode)(struct device *dev),
const char *firmware_name); const char *firmware_name);
void adau17x1_remove(struct device *dev); void adau17x1_remove(struct device *dev);
int adau17x1_set_micbias_voltage(struct snd_soc_codec *codec, int adau17x1_set_micbias_voltage(struct snd_soc_component *component,
enum adau17x1_micbias_voltage micbias); enum adau17x1_micbias_voltage micbias);
bool adau17x1_readable_register(struct device *dev, unsigned int reg); bool adau17x1_readable_register(struct device *dev, unsigned int reg);
bool adau17x1_volatile_register(struct device *dev, unsigned int reg); bool adau17x1_volatile_register(struct device *dev, unsigned int reg);
bool adau17x1_precious_register(struct device *dev, unsigned int reg); bool adau17x1_precious_register(struct device *dev, unsigned int reg);
int adau17x1_resume(struct snd_soc_codec *codec); int adau17x1_resume(struct snd_soc_component *component);
extern const struct snd_soc_dai_ops adau17x1_dai_ops; extern const struct snd_soc_dai_ops adau17x1_dai_ops;
......
...@@ -29,12 +29,6 @@ static int adau1977_i2c_probe(struct i2c_client *client, ...@@ -29,12 +29,6 @@ static int adau1977_i2c_probe(struct i2c_client *client,
id->driver_data, NULL); id->driver_data, NULL);
} }
static int adau1977_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id adau1977_i2c_ids[] = { static const struct i2c_device_id adau1977_i2c_ids[] = {
{ "adau1977", ADAU1977 }, { "adau1977", ADAU1977 },
{ "adau1978", ADAU1978 }, { "adau1978", ADAU1978 },
...@@ -48,7 +42,6 @@ static struct i2c_driver adau1977_i2c_driver = { ...@@ -48,7 +42,6 @@ static struct i2c_driver adau1977_i2c_driver = {
.name = "adau1977", .name = "adau1977",
}, },
.probe = adau1977_i2c_probe, .probe = adau1977_i2c_probe,
.remove = adau1977_i2c_remove,
.id_table = adau1977_i2c_ids, .id_table = adau1977_i2c_ids,
}; };
module_i2c_driver(adau1977_i2c_driver); module_i2c_driver(adau1977_i2c_driver);
......
...@@ -46,12 +46,6 @@ static int adau1977_spi_probe(struct spi_device *spi) ...@@ -46,12 +46,6 @@ static int adau1977_spi_probe(struct spi_device *spi)
id->driver_data, adau1977_spi_switch_mode); id->driver_data, adau1977_spi_switch_mode);
} }
static int adau1977_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
return 0;
}
static const struct spi_device_id adau1977_spi_ids[] = { static const struct spi_device_id adau1977_spi_ids[] = {
{ "adau1977", ADAU1977 }, { "adau1977", ADAU1977 },
{ "adau1978", ADAU1978 }, { "adau1978", ADAU1978 },
...@@ -65,7 +59,6 @@ static struct spi_driver adau1977_spi_driver = { ...@@ -65,7 +59,6 @@ static struct spi_driver adau1977_spi_driver = {
.name = "adau1977", .name = "adau1977",
}, },
.probe = adau1977_spi_probe, .probe = adau1977_spi_probe,
.remove = adau1977_spi_remove,
.id_table = adau1977_spi_ids, .id_table = adau1977_spi_ids,
}; };
module_spi_driver(adau1977_spi_driver); module_spi_driver(adau1977_spi_driver);
......
...@@ -294,8 +294,8 @@ static int adau1977_lookup_mcs(struct adau1977 *adau1977, unsigned int rate, ...@@ -294,8 +294,8 @@ static int adau1977_lookup_mcs(struct adau1977 *adau1977, unsigned int rate,
static int adau1977_hw_params(struct snd_pcm_substream *substream, static int adau1977_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(codec); struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
unsigned int rate = params_rate(params); unsigned int rate = params_rate(params);
unsigned int slot_width; unsigned int slot_width;
unsigned int ctrl0, ctrl0_mask; unsigned int ctrl0, ctrl0_mask;
...@@ -471,10 +471,10 @@ static int adau1977_power_enable(struct adau1977 *adau1977) ...@@ -471,10 +471,10 @@ static int adau1977_power_enable(struct adau1977 *adau1977)
return ret; return ret;
} }
static int adau1977_set_bias_level(struct snd_soc_codec *codec, static int adau1977_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(codec); struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
int ret = 0; int ret = 0;
switch (level) { switch (level) {
...@@ -483,7 +483,7 @@ static int adau1977_set_bias_level(struct snd_soc_codec *codec, ...@@ -483,7 +483,7 @@ static int adau1977_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
case SND_SOC_BIAS_STANDBY: 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 = adau1977_power_enable(adau1977); ret = adau1977_power_enable(adau1977);
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
...@@ -497,7 +497,7 @@ static int adau1977_set_bias_level(struct snd_soc_codec *codec, ...@@ -497,7 +497,7 @@ static int adau1977_set_bias_level(struct snd_soc_codec *codec,
static int adau1977_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, static int adau1977_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int width) unsigned int rx_mask, int slots, int width)
{ {
struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(dai->codec); struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
unsigned int ctrl0, ctrl1, drv; unsigned int ctrl0, ctrl1, drv;
unsigned int slot[4]; unsigned int slot[4];
unsigned int i; unsigned int i;
...@@ -603,7 +603,7 @@ static int adau1977_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, ...@@ -603,7 +603,7 @@ static int adau1977_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
static int adau1977_mute(struct snd_soc_dai *dai, int mute, int stream) static int adau1977_mute(struct snd_soc_dai *dai, int mute, int stream)
{ {
struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(dai->codec); struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
unsigned int val; unsigned int val;
if (mute) if (mute)
...@@ -617,7 +617,7 @@ static int adau1977_mute(struct snd_soc_dai *dai, int mute, int stream) ...@@ -617,7 +617,7 @@ static int adau1977_mute(struct snd_soc_dai *dai, int mute, int stream)
static int adau1977_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int adau1977_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ {
struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(dai->codec); struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
unsigned int ctrl0 = 0, ctrl1 = 0, block_power = 0; unsigned int ctrl0 = 0, ctrl1 = 0, block_power = 0;
bool invert_lrclk; bool invert_lrclk;
int ret; int ret;
...@@ -704,7 +704,7 @@ static int adau1977_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) ...@@ -704,7 +704,7 @@ static int adau1977_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
static int adau1977_startup(struct snd_pcm_substream *substream, static int adau1977_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(dai->codec); struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
u64 formats = 0; u64 formats = 0;
if (adau1977->slot_width == 16) if (adau1977->slot_width == 16)
...@@ -729,7 +729,7 @@ static int adau1977_startup(struct snd_pcm_substream *substream, ...@@ -729,7 +729,7 @@ static int adau1977_startup(struct snd_pcm_substream *substream,
static int adau1977_set_tristate(struct snd_soc_dai *dai, int tristate) static int adau1977_set_tristate(struct snd_soc_dai *dai, int tristate)
{ {
struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(dai->codec); struct adau1977 *adau1977 = snd_soc_component_get_drvdata(dai->component);
unsigned int val; unsigned int val;
if (tristate) if (tristate)
...@@ -790,10 +790,10 @@ static bool adau1977_check_sysclk(unsigned int mclk, unsigned int base_freq) ...@@ -790,10 +790,10 @@ static bool adau1977_check_sysclk(unsigned int mclk, unsigned int base_freq)
return true; return true;
} }
static int adau1977_set_sysclk(struct snd_soc_codec *codec, static int adau1977_set_sysclk(struct snd_soc_component *component,
int clk_id, int source, unsigned int freq, int dir) int clk_id, int source, unsigned int freq, int dir)
{ {
struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(codec); struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
unsigned int mask = 0; unsigned int mask = 0;
unsigned int clk_src; unsigned int clk_src;
unsigned int ret; unsigned int ret;
...@@ -844,10 +844,10 @@ static int adau1977_set_sysclk(struct snd_soc_codec *codec, ...@@ -844,10 +844,10 @@ static int adau1977_set_sysclk(struct snd_soc_codec *codec,
return 0; return 0;
} }
static int adau1977_codec_probe(struct snd_soc_codec *codec) static int adau1977_component_probe(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct adau1977 *adau1977 = snd_soc_codec_get_drvdata(codec); struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
int ret; int ret;
switch (adau1977->type) { switch (adau1977->type) {
...@@ -865,20 +865,19 @@ static int adau1977_codec_probe(struct snd_soc_codec *codec) ...@@ -865,20 +865,19 @@ static int adau1977_codec_probe(struct snd_soc_codec *codec)
return 0; return 0;
} }
static const struct snd_soc_codec_driver adau1977_codec_driver = { static const struct snd_soc_component_driver adau1977_component_driver = {
.probe = adau1977_codec_probe, .probe = adau1977_component_probe,
.set_bias_level = adau1977_set_bias_level, .set_bias_level = adau1977_set_bias_level,
.set_sysclk = adau1977_set_sysclk, .set_sysclk = adau1977_set_sysclk,
.idle_bias_off = true, .controls = adau1977_snd_controls,
.num_controls = ARRAY_SIZE(adau1977_snd_controls),
.component_driver = { .dapm_widgets = adau1977_dapm_widgets,
.controls = adau1977_snd_controls, .num_dapm_widgets = ARRAY_SIZE(adau1977_dapm_widgets),
.num_controls = ARRAY_SIZE(adau1977_snd_controls), .dapm_routes = adau1977_dapm_routes,
.dapm_widgets = adau1977_dapm_widgets, .num_dapm_routes = ARRAY_SIZE(adau1977_dapm_routes),
.num_dapm_widgets = ARRAY_SIZE(adau1977_dapm_widgets), .use_pmdown_time = 1,
.dapm_routes = adau1977_dapm_routes, .endianness = 1,
.num_dapm_routes = ARRAY_SIZE(adau1977_dapm_routes), .non_legacy_dai_naming = 1,
},
}; };
static int adau1977_setup_micbias(struct adau1977 *adau1977) static int adau1977_setup_micbias(struct adau1977 *adau1977)
...@@ -968,7 +967,7 @@ int adau1977_probe(struct device *dev, struct regmap *regmap, ...@@ -968,7 +967,7 @@ int adau1977_probe(struct device *dev, struct regmap *regmap,
if (ret) if (ret)
return ret; return ret;
return snd_soc_register_codec(dev, &adau1977_codec_driver, return devm_snd_soc_register_component(dev, &adau1977_component_driver,
&adau1977_dai, 1); &adau1977_dai, 1);
err_poweroff: err_poweroff:
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Licensed under the GPL-2. * Licensed under the GPL-2.
*/ */
#include <linux/acpi.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
...@@ -38,24 +39,26 @@ static struct snd_soc_dai_driver adau7002_dai = { ...@@ -38,24 +39,26 @@ static struct snd_soc_dai_driver adau7002_dai = {
}, },
}; };
static const struct snd_soc_codec_driver adau7002_codec_driver = { static const struct snd_soc_component_driver adau7002_component_driver = {
.component_driver = { .dapm_widgets = adau7002_widgets,
.dapm_widgets = adau7002_widgets, .num_dapm_widgets = ARRAY_SIZE(adau7002_widgets),
.num_dapm_widgets = ARRAY_SIZE(adau7002_widgets), .dapm_routes = adau7002_routes,
.dapm_routes = adau7002_routes, .num_dapm_routes = ARRAY_SIZE(adau7002_routes),
.num_dapm_routes = ARRAY_SIZE(adau7002_routes), .idle_bias_on = 1,
}, .use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static int adau7002_probe(struct platform_device *pdev) static int adau7002_probe(struct platform_device *pdev)
{ {
return snd_soc_register_codec(&pdev->dev, &adau7002_codec_driver, return devm_snd_soc_register_component(&pdev->dev,
&adau7002_component_driver,
&adau7002_dai, 1); &adau7002_dai, 1);
} }
static int adau7002_remove(struct platform_device *pdev) static int adau7002_remove(struct platform_device *pdev)
{ {
snd_soc_unregister_codec(&pdev->dev);
return 0; return 0;
} }
...@@ -67,10 +70,19 @@ static const struct of_device_id adau7002_dt_ids[] = { ...@@ -67,10 +70,19 @@ static const struct of_device_id adau7002_dt_ids[] = {
MODULE_DEVICE_TABLE(of, adau7002_dt_ids); MODULE_DEVICE_TABLE(of, adau7002_dt_ids);
#endif #endif
#ifdef CONFIG_ACPI
static const struct acpi_device_id adau7002_acpi_match[] = {
{ "ADAU7002", 0 },
{},
};
MODULE_DEVICE_TABLE(acpi, adau7002_acpi_match);
#endif
static struct platform_driver adau7002_driver = { static struct platform_driver adau7002_driver = {
.driver = { .driver = {
.name = "adau7002", .name = "adau7002",
.of_match_table = of_match_ptr(adau7002_dt_ids), .of_match_table = of_match_ptr(adau7002_dt_ids),
.acpi_match_table = ACPI_PTR(adau7002_acpi_match),
}, },
.probe = adau7002_probe, .probe = adau7002_probe,
.remove = adau7002_remove, .remove = adau7002_remove,
......
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