Commit ae32cf88 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/cs4271', 'asoc/topic/cs42l42',...

Merge remote-tracking branches 'asoc/topic/cs4271', 'asoc/topic/cs42l42', 'asoc/topic/cs42l51', 'asoc/topic/cs42l52' and 'asoc/topic/cs42l56' into asoc-next
...@@ -33,12 +33,6 @@ static int cs4271_i2c_probe(struct i2c_client *client, ...@@ -33,12 +33,6 @@ static int cs4271_i2c_probe(struct i2c_client *client,
devm_regmap_init_i2c(client, &config)); devm_regmap_init_i2c(client, &config));
} }
static int cs4271_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id cs4271_i2c_id[] = { static const struct i2c_device_id cs4271_i2c_id[] = {
{ "cs4271", 0 }, { "cs4271", 0 },
{ } { }
...@@ -51,7 +45,6 @@ static struct i2c_driver cs4271_i2c_driver = { ...@@ -51,7 +45,6 @@ static struct i2c_driver cs4271_i2c_driver = {
.of_match_table = of_match_ptr(cs4271_dt_ids), .of_match_table = of_match_ptr(cs4271_dt_ids),
}, },
.probe = cs4271_i2c_probe, .probe = cs4271_i2c_probe,
.remove = cs4271_i2c_remove,
.id_table = cs4271_i2c_id, .id_table = cs4271_i2c_id,
}; };
module_i2c_driver(cs4271_i2c_driver); module_i2c_driver(cs4271_i2c_driver);
......
...@@ -33,19 +33,12 @@ static int cs4271_spi_probe(struct spi_device *spi) ...@@ -33,19 +33,12 @@ static int cs4271_spi_probe(struct spi_device *spi)
return cs4271_probe(&spi->dev, devm_regmap_init_spi(spi, &config)); return cs4271_probe(&spi->dev, devm_regmap_init_spi(spi, &config));
} }
static int cs4271_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
return 0;
}
static struct spi_driver cs4271_spi_driver = { static struct spi_driver cs4271_spi_driver = {
.driver = { .driver = {
.name = "cs4271", .name = "cs4271",
.of_match_table = of_match_ptr(cs4271_dt_ids), .of_match_table = of_match_ptr(cs4271_dt_ids),
}, },
.probe = cs4271_spi_probe, .probe = cs4271_spi_probe,
.remove = cs4271_spi_remove,
}; };
module_spi_driver(cs4271_spi_driver); module_spi_driver(cs4271_spi_driver);
......
...@@ -206,8 +206,8 @@ static const struct snd_soc_dapm_route cs4271_dapm_routes[] = { ...@@ -206,8 +206,8 @@ static const struct snd_soc_dapm_route cs4271_dapm_routes[] = {
static int cs4271_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int cs4271_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
cs4271->mclk = freq; cs4271->mclk = freq;
return 0; return 0;
...@@ -216,8 +216,8 @@ static int cs4271_set_dai_sysclk(struct snd_soc_dai *codec_dai, ...@@ -216,8 +216,8 @@ static int cs4271_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int format) unsigned int format)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
unsigned int val = 0; unsigned int val = 0;
int ret; int ret;
...@@ -230,7 +230,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -230,7 +230,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai,
val |= CS4271_MODE1_MASTER; val |= CS4271_MODE1_MASTER;
break; break;
default: default:
dev_err(codec->dev, "Invalid DAI format\n"); dev_err(component->dev, "Invalid DAI format\n");
return -EINVAL; return -EINVAL;
} }
...@@ -250,7 +250,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -250,7 +250,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai,
return ret; return ret;
break; break;
default: default:
dev_err(codec->dev, "Invalid DAI format\n"); dev_err(component->dev, "Invalid DAI format\n");
return -EINVAL; return -EINVAL;
} }
...@@ -263,9 +263,9 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -263,9 +263,9 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai,
static int cs4271_deemph[] = {0, 44100, 48000, 32000}; static int cs4271_deemph[] = {0, 44100, 48000, 32000};
static int cs4271_set_deemph(struct snd_soc_codec *codec) static int cs4271_set_deemph(struct snd_soc_component *component)
{ {
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
int i, ret; int i, ret;
int val = CS4271_DACCTL_DEM_DIS; int val = CS4271_DACCTL_DEM_DIS;
...@@ -289,8 +289,8 @@ static int cs4271_set_deemph(struct snd_soc_codec *codec) ...@@ -289,8 +289,8 @@ static int cs4271_set_deemph(struct snd_soc_codec *codec)
static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, static int cs4271_get_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = cs4271->deemph; ucontrol->value.integer.value[0] = cs4271->deemph;
return 0; return 0;
...@@ -299,11 +299,11 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, ...@@ -299,11 +299,11 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol,
static int cs4271_put_deemph(struct snd_kcontrol *kcontrol, static int cs4271_put_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
cs4271->deemph = ucontrol->value.integer.value[0]; cs4271->deemph = ucontrol->value.integer.value[0];
return cs4271_set_deemph(codec); return cs4271_set_deemph(component);
} }
struct cs4271_clk_cfg { struct cs4271_clk_cfg {
...@@ -349,8 +349,8 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream, ...@@ -349,8 +349,8 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
int i, ret; int i, ret;
unsigned int ratio, val; unsigned int ratio, val;
...@@ -399,7 +399,7 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream, ...@@ -399,7 +399,7 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream,
break; break;
if (i == CS4171_NR_RATIOS) { if (i == CS4171_NR_RATIOS) {
dev_err(codec->dev, "Invalid sample rate\n"); dev_err(component->dev, "Invalid sample rate\n");
return -EINVAL; return -EINVAL;
} }
...@@ -410,13 +410,13 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream, ...@@ -410,13 +410,13 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream,
if (ret < 0) if (ret < 0)
return ret; return ret;
return cs4271_set_deemph(codec); return cs4271_set_deemph(component);
} }
static int cs4271_mute_stream(struct snd_soc_dai *dai, int mute, int stream) static int cs4271_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
int ret; int ret;
int val_a = 0; int val_a = 0;
int val_b = 0; int val_b = 0;
...@@ -493,9 +493,9 @@ static struct snd_soc_dai_driver cs4271_dai = { ...@@ -493,9 +493,9 @@ static struct snd_soc_dai_driver cs4271_dai = {
.symmetric_rates = 1, .symmetric_rates = 1,
}; };
static int cs4271_reset(struct snd_soc_codec *codec) static int cs4271_reset(struct snd_soc_component *component)
{ {
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
if (gpio_is_valid(cs4271->gpio_nreset)) { if (gpio_is_valid(cs4271->gpio_nreset)) {
gpio_direction_output(cs4271->gpio_nreset, 0); gpio_direction_output(cs4271->gpio_nreset, 0);
...@@ -508,10 +508,10 @@ static int cs4271_reset(struct snd_soc_codec *codec) ...@@ -508,10 +508,10 @@ static int cs4271_reset(struct snd_soc_codec *codec)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int cs4271_soc_suspend(struct snd_soc_codec *codec) static int cs4271_soc_suspend(struct snd_soc_component *component)
{ {
int ret; int ret;
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
/* Set power-down bit */ /* Set power-down bit */
ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
...@@ -525,20 +525,20 @@ static int cs4271_soc_suspend(struct snd_soc_codec *codec) ...@@ -525,20 +525,20 @@ static int cs4271_soc_suspend(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int cs4271_soc_resume(struct snd_soc_codec *codec) static int cs4271_soc_resume(struct snd_soc_component *component)
{ {
int ret; int ret;
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies),
cs4271->supplies); cs4271->supplies);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Failed to enable regulators: %d\n", ret); dev_err(component->dev, "Failed to enable regulators: %d\n", ret);
return ret; return ret;
} }
/* Do a proper reset after power up */ /* Do a proper reset after power up */
cs4271_reset(codec); cs4271_reset(component);
/* Restore codec state */ /* Restore codec state */
ret = regcache_sync(cs4271->regmap); ret = regcache_sync(cs4271->regmap);
...@@ -567,20 +567,20 @@ MODULE_DEVICE_TABLE(of, cs4271_dt_ids); ...@@ -567,20 +567,20 @@ MODULE_DEVICE_TABLE(of, cs4271_dt_ids);
EXPORT_SYMBOL_GPL(cs4271_dt_ids); EXPORT_SYMBOL_GPL(cs4271_dt_ids);
#endif #endif
static int cs4271_codec_probe(struct snd_soc_codec *codec) static int cs4271_component_probe(struct snd_soc_component *component)
{ {
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; struct cs4271_platform_data *cs4271plat = component->dev->platform_data;
int ret; int ret;
bool amutec_eq_bmutec = false; bool amutec_eq_bmutec = false;
#ifdef CONFIG_OF #ifdef CONFIG_OF
if (of_match_device(cs4271_dt_ids, codec->dev)) { if (of_match_device(cs4271_dt_ids, component->dev)) {
if (of_get_property(codec->dev->of_node, if (of_get_property(component->dev->of_node,
"cirrus,amutec-eq-bmutec", NULL)) "cirrus,amutec-eq-bmutec", NULL))
amutec_eq_bmutec = true; amutec_eq_bmutec = true;
if (of_get_property(codec->dev->of_node, if (of_get_property(component->dev->of_node,
"cirrus,enable-soft-reset", NULL)) "cirrus,enable-soft-reset", NULL))
cs4271->enable_soft_reset = true; cs4271->enable_soft_reset = true;
} }
...@@ -589,7 +589,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec) ...@@ -589,7 +589,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec)
ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies),
cs4271->supplies); cs4271->supplies);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Failed to enable regulators: %d\n", ret); dev_err(component->dev, "Failed to enable regulators: %d\n", ret);
return ret; return ret;
} }
...@@ -599,7 +599,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec) ...@@ -599,7 +599,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec)
} }
/* Reset codec */ /* Reset codec */
cs4271_reset(codec); cs4271_reset(component);
ret = regcache_sync(cs4271->regmap); ret = regcache_sync(cs4271->regmap);
if (ret < 0) if (ret < 0)
...@@ -625,9 +625,9 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec) ...@@ -625,9 +625,9 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int cs4271_codec_remove(struct snd_soc_codec *codec) static void cs4271_component_remove(struct snd_soc_component *component)
{ {
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
if (gpio_is_valid(cs4271->gpio_nreset)) if (gpio_is_valid(cs4271->gpio_nreset))
/* Set codec to the reset state */ /* Set codec to the reset state */
...@@ -635,24 +635,23 @@ static int cs4271_codec_remove(struct snd_soc_codec *codec) ...@@ -635,24 +635,23 @@ static int cs4271_codec_remove(struct snd_soc_codec *codec)
regcache_mark_dirty(cs4271->regmap); regcache_mark_dirty(cs4271->regmap);
regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies);
return 0;
}; };
static const struct snd_soc_codec_driver soc_codec_dev_cs4271 = { static const struct snd_soc_component_driver soc_component_dev_cs4271 = {
.probe = cs4271_codec_probe, .probe = cs4271_component_probe,
.remove = cs4271_codec_remove, .remove = cs4271_component_remove,
.suspend = cs4271_soc_suspend, .suspend = cs4271_soc_suspend,
.resume = cs4271_soc_resume, .resume = cs4271_soc_resume,
.component_driver = {
.controls = cs4271_snd_controls, .controls = cs4271_snd_controls,
.num_controls = ARRAY_SIZE(cs4271_snd_controls), .num_controls = ARRAY_SIZE(cs4271_snd_controls),
.dapm_widgets = cs4271_dapm_widgets, .dapm_widgets = cs4271_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(cs4271_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(cs4271_dapm_widgets),
.dapm_routes = cs4271_dapm_routes, .dapm_routes = cs4271_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(cs4271_dapm_routes), .num_dapm_routes = ARRAY_SIZE(cs4271_dapm_routes),
}, .idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static int cs4271_common_probe(struct device *dev, static int cs4271_common_probe(struct device *dev,
...@@ -721,8 +720,8 @@ int cs4271_probe(struct device *dev, struct regmap *regmap) ...@@ -721,8 +720,8 @@ int cs4271_probe(struct device *dev, struct regmap *regmap)
dev_set_drvdata(dev, cs4271); dev_set_drvdata(dev, cs4271);
cs4271->regmap = regmap; cs4271->regmap = regmap;
return snd_soc_register_codec(dev, &soc_codec_dev_cs4271, &cs4271_dai, return devm_snd_soc_register_component(dev, &soc_component_dev_cs4271,
1); &cs4271_dai, 1);
} }
EXPORT_SYMBOL_GPL(cs4271_probe); EXPORT_SYMBOL_GPL(cs4271_probe);
......
This diff is collapsed.
...@@ -754,7 +754,7 @@ static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = { ...@@ -754,7 +754,7 @@ static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = {
struct cs42l42_private { struct cs42l42_private {
struct regmap *regmap; struct regmap *regmap;
struct snd_soc_codec *codec; struct snd_soc_component *component;
struct regulator_bulk_data supplies[CS42L42_NUM_SUPPLIES]; struct regulator_bulk_data supplies[CS42L42_NUM_SUPPLIES];
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct completion pdn_done; struct completion pdn_done;
......
...@@ -35,20 +35,12 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c, ...@@ -35,20 +35,12 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c,
return cs42l51_probe(&i2c->dev, devm_regmap_init_i2c(i2c, &config)); return cs42l51_probe(&i2c->dev, devm_regmap_init_i2c(i2c, &config));
} }
static int cs42l51_i2c_remove(struct i2c_client *i2c)
{
snd_soc_unregister_codec(&i2c->dev);
return 0;
}
static struct i2c_driver cs42l51_i2c_driver = { static struct i2c_driver cs42l51_i2c_driver = {
.driver = { .driver = {
.name = "cs42l51", .name = "cs42l51",
.of_match_table = cs42l51_of_match, .of_match_table = cs42l51_of_match,
}, },
.probe = cs42l51_i2c_probe, .probe = cs42l51_i2c_probe,
.remove = cs42l51_i2c_remove,
.id_table = cs42l51_i2c_id, .id_table = cs42l51_i2c_id,
}; };
......
...@@ -54,8 +54,8 @@ struct cs42l51_private { ...@@ -54,8 +54,8 @@ struct cs42l51_private {
static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
unsigned long value = snd_soc_read(codec, CS42L51_PCM_MIXER)&3; unsigned long value = snd_soc_component_read32(component, CS42L51_PCM_MIXER)&3;
switch (value) { switch (value) {
default: default:
...@@ -82,7 +82,7 @@ static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, ...@@ -82,7 +82,7 @@ static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol,
static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol, static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
unsigned char val; unsigned char val;
switch (ucontrol->value.enumerated.item[0]) { switch (ucontrol->value.enumerated.item[0]) {
...@@ -98,7 +98,7 @@ static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol, ...@@ -98,7 +98,7 @@ static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol,
break; break;
} }
snd_soc_write(codec, CS42L51_PCM_MIXER, val); snd_soc_component_write(component, CS42L51_PCM_MIXER, val);
return 1; return 1;
} }
...@@ -153,17 +153,17 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = { ...@@ -153,17 +153,17 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w, static int cs42l51_pdn_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);
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMD: case SND_SOC_DAPM_PRE_PMD:
snd_soc_update_bits(codec, CS42L51_POWER_CTL1, snd_soc_component_update_bits(component, CS42L51_POWER_CTL1,
CS42L51_POWER_CTL1_PDN, CS42L51_POWER_CTL1_PDN,
CS42L51_POWER_CTL1_PDN); CS42L51_POWER_CTL1_PDN);
break; break;
default: default:
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
snd_soc_update_bits(codec, CS42L51_POWER_CTL1, snd_soc_component_update_bits(component, CS42L51_POWER_CTL1,
CS42L51_POWER_CTL1_PDN, 0); CS42L51_POWER_CTL1_PDN, 0);
break; break;
} }
...@@ -263,8 +263,8 @@ static const struct snd_soc_dapm_route cs42l51_routes[] = { ...@@ -263,8 +263,8 @@ static const struct snd_soc_dapm_route cs42l51_routes[] = {
static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int format) unsigned int format)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component);
switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { switch (format & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
...@@ -273,7 +273,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -273,7 +273,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai,
cs42l51->audio_mode = format & SND_SOC_DAIFMT_FORMAT_MASK; cs42l51->audio_mode = format & SND_SOC_DAIFMT_FORMAT_MASK;
break; break;
default: default:
dev_err(codec->dev, "invalid DAI format\n"); dev_err(component->dev, "invalid DAI format\n");
return -EINVAL; return -EINVAL;
} }
...@@ -285,7 +285,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -285,7 +285,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai,
cs42l51->func = MODE_SLAVE_AUTO; cs42l51->func = MODE_SLAVE_AUTO;
break; break;
default: default:
dev_err(codec->dev, "Unknown master/slave configuration\n"); dev_err(component->dev, "Unknown master/slave configuration\n");
return -EINVAL; return -EINVAL;
} }
...@@ -326,8 +326,8 @@ static struct cs42l51_ratios slave_auto_ratios[] = { ...@@ -326,8 +326,8 @@ static struct cs42l51_ratios slave_auto_ratios[] = {
static int cs42l51_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int cs42l51_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component);
cs42l51->mclk = freq; cs42l51->mclk = freq;
return 0; return 0;
...@@ -337,8 +337,8 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, ...@@ -337,8 +337,8 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component);
int ret; int ret;
unsigned int i; unsigned int i;
unsigned int rate; unsigned int rate;
...@@ -370,12 +370,12 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, ...@@ -370,12 +370,12 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream,
if (i == nr_ratios) { if (i == nr_ratios) {
/* We did not find a matching ratio */ /* We did not find a matching ratio */
dev_err(codec->dev, "could not find matching ratio\n"); dev_err(component->dev, "could not find matching ratio\n");
return -EINVAL; return -EINVAL;
} }
intf_ctl = snd_soc_read(codec, CS42L51_INTF_CTL); intf_ctl = snd_soc_component_read32(component, CS42L51_INTF_CTL);
power_ctl = snd_soc_read(codec, CS42L51_MIC_POWER_CTL); power_ctl = snd_soc_component_read32(component, CS42L51_MIC_POWER_CTL);
intf_ctl &= ~(CS42L51_INTF_CTL_MASTER | CS42L51_INTF_CTL_ADC_I2S intf_ctl &= ~(CS42L51_INTF_CTL_MASTER | CS42L51_INTF_CTL_ADC_I2S
| CS42L51_INTF_CTL_DAC_FORMAT(7)); | CS42L51_INTF_CTL_DAC_FORMAT(7));
...@@ -418,24 +418,24 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, ...@@ -418,24 +418,24 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream,
fmt = CS42L51_DAC_DIF_RJ24; fmt = CS42L51_DAC_DIF_RJ24;
break; break;
default: default:
dev_err(codec->dev, "unknown format\n"); dev_err(component->dev, "unknown format\n");
return -EINVAL; return -EINVAL;
} }
intf_ctl |= CS42L51_INTF_CTL_DAC_FORMAT(fmt); intf_ctl |= CS42L51_INTF_CTL_DAC_FORMAT(fmt);
break; break;
default: default:
dev_err(codec->dev, "unknown format\n"); dev_err(component->dev, "unknown format\n");
return -EINVAL; return -EINVAL;
} }
if (ratios[i].mclk) if (ratios[i].mclk)
power_ctl |= CS42L51_MIC_POWER_CTL_MCLK_DIV2; power_ctl |= CS42L51_MIC_POWER_CTL_MCLK_DIV2;
ret = snd_soc_write(codec, CS42L51_INTF_CTL, intf_ctl); ret = snd_soc_component_write(component, CS42L51_INTF_CTL, intf_ctl);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = snd_soc_write(codec, CS42L51_MIC_POWER_CTL, power_ctl); ret = snd_soc_component_write(component, CS42L51_MIC_POWER_CTL, power_ctl);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -444,18 +444,18 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, ...@@ -444,18 +444,18 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream,
static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute) static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
int reg; int reg;
int mask = CS42L51_DAC_OUT_CTL_DACA_MUTE|CS42L51_DAC_OUT_CTL_DACB_MUTE; int mask = CS42L51_DAC_OUT_CTL_DACA_MUTE|CS42L51_DAC_OUT_CTL_DACB_MUTE;
reg = snd_soc_read(codec, CS42L51_DAC_OUT_CTL); reg = snd_soc_component_read32(component, CS42L51_DAC_OUT_CTL);
if (mute) if (mute)
reg |= mask; reg |= mask;
else else
reg &= ~mask; reg &= ~mask;
return snd_soc_write(codec, CS42L51_DAC_OUT_CTL, reg); return snd_soc_component_write(component, CS42L51_DAC_OUT_CTL, reg);
} }
static const struct snd_soc_dai_ops cs42l51_dai_ops = { static const struct snd_soc_dai_ops cs42l51_dai_ops = {
...@@ -484,7 +484,7 @@ static struct snd_soc_dai_driver cs42l51_dai = { ...@@ -484,7 +484,7 @@ static struct snd_soc_dai_driver cs42l51_dai = {
.ops = &cs42l51_dai_ops, .ops = &cs42l51_dai_ops,
}; };
static int cs42l51_codec_probe(struct snd_soc_codec *codec) static int cs42l51_component_probe(struct snd_soc_component *component)
{ {
int ret, reg; int ret, reg;
...@@ -497,24 +497,25 @@ static int cs42l51_codec_probe(struct snd_soc_codec *codec) ...@@ -497,24 +497,25 @@ static int cs42l51_codec_probe(struct snd_soc_codec *codec)
*/ */
reg = CS42L51_DAC_CTL_DATA_SEL(1) reg = CS42L51_DAC_CTL_DATA_SEL(1)
| CS42L51_DAC_CTL_AMUTE | CS42L51_DAC_CTL_DACSZ(0); | CS42L51_DAC_CTL_AMUTE | CS42L51_DAC_CTL_DACSZ(0);
ret = snd_soc_write(codec, CS42L51_DAC_CTL, reg); ret = snd_soc_component_write(component, CS42L51_DAC_CTL, reg);
if (ret < 0) if (ret < 0)
return ret; return ret;
return 0; return 0;
} }
static const struct snd_soc_codec_driver soc_codec_device_cs42l51 = { static const struct snd_soc_component_driver soc_component_device_cs42l51 = {
.probe = cs42l51_codec_probe, .probe = cs42l51_component_probe,
.component_driver = {
.controls = cs42l51_snd_controls, .controls = cs42l51_snd_controls,
.num_controls = ARRAY_SIZE(cs42l51_snd_controls), .num_controls = ARRAY_SIZE(cs42l51_snd_controls),
.dapm_widgets = cs42l51_dapm_widgets, .dapm_widgets = cs42l51_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets),
.dapm_routes = cs42l51_routes, .dapm_routes = cs42l51_routes,
.num_dapm_routes = ARRAY_SIZE(cs42l51_routes), .num_dapm_routes = ARRAY_SIZE(cs42l51_routes),
}, .idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
const struct regmap_config cs42l51_regmap = { const struct regmap_config cs42l51_regmap = {
...@@ -555,8 +556,8 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap) ...@@ -555,8 +556,8 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap)
dev_info(dev, "Cirrus Logic CS42L51, Revision: %02X\n", dev_info(dev, "Cirrus Logic CS42L51, Revision: %02X\n",
val & CS42L51_CHIP_REV_MASK); val & CS42L51_CHIP_REV_MASK);
ret = snd_soc_register_codec(dev, ret = devm_snd_soc_register_component(dev,
&soc_codec_device_cs42l51, &cs42l51_dai, 1); &soc_component_device_cs42l51, &cs42l51_dai, 1);
error: error:
return ret; return ret;
} }
......
This diff is collapsed.
This diff is collapsed.
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