forked from Minki/linux
Merge remote-tracking branches 'asoc/topic/cs4271', 'asoc/topic/cs42l42', 'asoc/topic/cs42l51', 'asoc/topic/cs42l52' and 'asoc/topic/cs42l56' into asoc-next
This commit is contained in:
commit
ae32cf888c
@ -33,12 +33,6 @@ static int cs4271_i2c_probe(struct i2c_client *client,
|
||||
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[] = {
|
||||
{ "cs4271", 0 },
|
||||
{ }
|
||||
@ -51,7 +45,6 @@ static struct i2c_driver cs4271_i2c_driver = {
|
||||
.of_match_table = of_match_ptr(cs4271_dt_ids),
|
||||
},
|
||||
.probe = cs4271_i2c_probe,
|
||||
.remove = cs4271_i2c_remove,
|
||||
.id_table = cs4271_i2c_id,
|
||||
};
|
||||
module_i2c_driver(cs4271_i2c_driver);
|
||||
|
@ -33,19 +33,12 @@ static int cs4271_spi_probe(struct spi_device *spi)
|
||||
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 = {
|
||||
.driver = {
|
||||
.name = "cs4271",
|
||||
.of_match_table = of_match_ptr(cs4271_dt_ids),
|
||||
},
|
||||
.probe = cs4271_spi_probe,
|
||||
.remove = cs4271_spi_remove,
|
||||
};
|
||||
module_spi_driver(cs4271_spi_driver);
|
||||
|
||||
|
@ -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,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
cs4271->mclk = freq;
|
||||
return 0;
|
||||
@ -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,
|
||||
unsigned int format)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int val = 0;
|
||||
int ret;
|
||||
|
||||
@ -230,7 +230,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
val |= CS4271_MODE1_MASTER;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Invalid DAI format\n");
|
||||
dev_err(component->dev, "Invalid DAI format\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
return ret;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Invalid DAI format\n");
|
||||
dev_err(component->dev, "Invalid DAI format\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -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_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 val = CS4271_DACCTL_DEM_DIS;
|
||||
|
||||
@ -289,8 +289,8 @@ static int cs4271_set_deemph(struct snd_soc_codec *codec)
|
||||
static int cs4271_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] = cs4271->deemph;
|
||||
return 0;
|
||||
@ -299,11 +299,11 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int cs4271_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
cs4271->deemph = ucontrol->value.integer.value[0];
|
||||
return cs4271_set_deemph(codec);
|
||||
return cs4271_set_deemph(component);
|
||||
}
|
||||
|
||||
struct cs4271_clk_cfg {
|
||||
@ -349,8 +349,8 @@ static int cs4271_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 cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
|
||||
int i, ret;
|
||||
unsigned int ratio, val;
|
||||
|
||||
@ -399,7 +399,7 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream,
|
||||
break;
|
||||
|
||||
if (i == CS4171_NR_RATIOS) {
|
||||
dev_err(codec->dev, "Invalid sample rate\n");
|
||||
dev_err(component->dev, "Invalid sample rate\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -410,13 +410,13 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream,
|
||||
if (ret < 0)
|
||||
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)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
int val_a = 0;
|
||||
int val_b = 0;
|
||||
@ -493,9 +493,9 @@ static struct snd_soc_dai_driver cs4271_dai = {
|
||||
.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)) {
|
||||
gpio_direction_output(cs4271->gpio_nreset, 0);
|
||||
@ -508,10 +508,10 @@ static int cs4271_reset(struct snd_soc_codec *codec)
|
||||
}
|
||||
|
||||
#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;
|
||||
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
/* Set power-down bit */
|
||||
ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
|
||||
@ -525,20 +525,20 @@ static int cs4271_soc_suspend(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs4271_soc_resume(struct snd_soc_codec *codec)
|
||||
static int cs4271_soc_resume(struct snd_soc_component *component)
|
||||
{
|
||||
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),
|
||||
cs4271->supplies);
|
||||
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;
|
||||
}
|
||||
|
||||
/* Do a proper reset after power up */
|
||||
cs4271_reset(codec);
|
||||
cs4271_reset(component);
|
||||
|
||||
/* Restore codec state */
|
||||
ret = regcache_sync(cs4271->regmap);
|
||||
@ -567,20 +567,20 @@ MODULE_DEVICE_TABLE(of, cs4271_dt_ids);
|
||||
EXPORT_SYMBOL_GPL(cs4271_dt_ids);
|
||||
#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_platform_data *cs4271plat = codec->dev->platform_data;
|
||||
struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
|
||||
struct cs4271_platform_data *cs4271plat = component->dev->platform_data;
|
||||
int ret;
|
||||
bool amutec_eq_bmutec = false;
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
if (of_match_device(cs4271_dt_ids, codec->dev)) {
|
||||
if (of_get_property(codec->dev->of_node,
|
||||
if (of_match_device(cs4271_dt_ids, component->dev)) {
|
||||
if (of_get_property(component->dev->of_node,
|
||||
"cirrus,amutec-eq-bmutec", NULL))
|
||||
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))
|
||||
cs4271->enable_soft_reset = true;
|
||||
}
|
||||
@ -589,7 +589,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec)
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies),
|
||||
cs4271->supplies);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -599,7 +599,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec)
|
||||
}
|
||||
|
||||
/* Reset codec */
|
||||
cs4271_reset(codec);
|
||||
cs4271_reset(component);
|
||||
|
||||
ret = regcache_sync(cs4271->regmap);
|
||||
if (ret < 0)
|
||||
@ -625,9 +625,9 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec)
|
||||
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))
|
||||
/* Set codec to the reset state */
|
||||
@ -635,24 +635,23 @@ static int cs4271_codec_remove(struct snd_soc_codec *codec)
|
||||
|
||||
regcache_mark_dirty(cs4271->regmap);
|
||||
regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
|
||||
.probe = cs4271_codec_probe,
|
||||
.remove = cs4271_codec_remove,
|
||||
static const struct snd_soc_component_driver soc_component_dev_cs4271 = {
|
||||
.probe = cs4271_component_probe,
|
||||
.remove = cs4271_component_remove,
|
||||
.suspend = cs4271_soc_suspend,
|
||||
.resume = cs4271_soc_resume,
|
||||
|
||||
.component_driver = {
|
||||
.controls = cs4271_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs4271_snd_controls),
|
||||
.dapm_widgets = cs4271_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs4271_dapm_widgets),
|
||||
.dapm_routes = cs4271_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs4271_dapm_routes),
|
||||
},
|
||||
.controls = cs4271_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs4271_snd_controls),
|
||||
.dapm_widgets = cs4271_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs4271_dapm_widgets),
|
||||
.dapm_routes = 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,
|
||||
@ -721,8 +720,8 @@ int cs4271_probe(struct device *dev, struct regmap *regmap)
|
||||
dev_set_drvdata(dev, cs4271);
|
||||
cs4271->regmap = regmap;
|
||||
|
||||
return snd_soc_register_codec(dev, &soc_codec_dev_cs4271, &cs4271_dai,
|
||||
1);
|
||||
return devm_snd_soc_register_component(dev, &soc_component_dev_cs4271,
|
||||
&cs4271_dai, 1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cs4271_probe);
|
||||
|
||||
|
@ -468,33 +468,33 @@ static const struct snd_kcontrol_new cs42l42_snd_controls[] = {
|
||||
static int cs42l42_hpdrv_evt(struct snd_soc_dapm_widget *w,
|
||||
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);
|
||||
|
||||
if (event & SND_SOC_DAPM_POST_PMU) {
|
||||
/* Enable the channels */
|
||||
snd_soc_update_bits(codec, CS42L42_ASP_RX_DAI0_EN,
|
||||
snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_EN,
|
||||
CS42L42_ASP_RX0_CH_EN_MASK,
|
||||
(CS42L42_ASP_RX0_CH1_EN |
|
||||
CS42L42_ASP_RX0_CH2_EN) <<
|
||||
CS42L42_ASP_RX0_CH_EN_SHIFT);
|
||||
|
||||
/* Power up */
|
||||
snd_soc_update_bits(codec, CS42L42_PWR_CTL1,
|
||||
snd_soc_component_update_bits(component, CS42L42_PWR_CTL1,
|
||||
CS42L42_ASP_DAI_PDN_MASK | CS42L42_MIXER_PDN_MASK |
|
||||
CS42L42_HP_PDN_MASK, 0);
|
||||
} else if (event & SND_SOC_DAPM_PRE_PMD) {
|
||||
/* Disable the channels */
|
||||
snd_soc_update_bits(codec, CS42L42_ASP_RX_DAI0_EN,
|
||||
snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_EN,
|
||||
CS42L42_ASP_RX0_CH_EN_MASK, 0);
|
||||
|
||||
/* Power down */
|
||||
snd_soc_update_bits(codec, CS42L42_PWR_CTL1,
|
||||
snd_soc_component_update_bits(component, CS42L42_PWR_CTL1,
|
||||
CS42L42_ASP_DAI_PDN_MASK | CS42L42_MIXER_PDN_MASK |
|
||||
CS42L42_HP_PDN_MASK,
|
||||
CS42L42_ASP_DAI_PDN_MASK | CS42L42_MIXER_PDN_MASK |
|
||||
CS42L42_HP_PDN_MASK);
|
||||
} else {
|
||||
dev_err(codec->dev, "Invalid event 0x%x\n", event);
|
||||
dev_err(component->dev, "Invalid event 0x%x\n", event);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -515,10 +515,10 @@ static const struct snd_soc_dapm_route cs42l42_audio_map[] = {
|
||||
{"HP", NULL, "HPDRV"}
|
||||
};
|
||||
|
||||
static int cs42l42_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int cs42l42_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct cs42l42_private *cs42l42 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
switch (level) {
|
||||
@ -527,14 +527,14 @@ static int cs42l42_set_bias_level(struct snd_soc_codec *codec,
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||
regcache_cache_only(cs42l42->regmap, false);
|
||||
regcache_sync(cs42l42->regmap);
|
||||
ret = regulator_bulk_enable(
|
||||
ARRAY_SIZE(cs42l42->supplies),
|
||||
cs42l42->supplies);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"Failed to enable regulators: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
@ -552,30 +552,28 @@ static int cs42l42_set_bias_level(struct snd_soc_codec *codec,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs42l42_codec_probe(struct snd_soc_codec *codec)
|
||||
static int cs42l42_component_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs42l42_private *cs42l42 =
|
||||
(struct cs42l42_private *)snd_soc_codec_get_drvdata(codec);
|
||||
(struct cs42l42_private *)snd_soc_component_get_drvdata(component);
|
||||
|
||||
cs42l42->codec = codec;
|
||||
cs42l42->component = component;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_cs42l42 = {
|
||||
.probe = cs42l42_codec_probe,
|
||||
.set_bias_level = cs42l42_set_bias_level,
|
||||
.ignore_pmdown_time = true,
|
||||
|
||||
.component_driver = {
|
||||
.dapm_widgets = cs42l42_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs42l42_dapm_widgets),
|
||||
.dapm_routes = cs42l42_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs42l42_audio_map),
|
||||
|
||||
.controls = cs42l42_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs42l42_snd_controls),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_cs42l42 = {
|
||||
.probe = cs42l42_component_probe,
|
||||
.set_bias_level = cs42l42_set_bias_level,
|
||||
.dapm_widgets = cs42l42_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs42l42_dapm_widgets),
|
||||
.dapm_routes = cs42l42_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs42l42_audio_map),
|
||||
.controls = cs42l42_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs42l42_snd_controls),
|
||||
.idle_bias_on = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
struct cs42l42_pll_params {
|
||||
@ -613,16 +611,16 @@ static const struct cs42l42_pll_params pll_ratio_table[] = {
|
||||
{ 24576000, 1, 0, 0, 0, 0, 0, 0, 24576000, 0 }
|
||||
};
|
||||
|
||||
static int cs42l42_pll_config(struct snd_soc_codec *codec)
|
||||
static int cs42l42_pll_config(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs42l42_private *cs42l42 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component);
|
||||
int i;
|
||||
u32 fsync;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(pll_ratio_table); i++) {
|
||||
if (pll_ratio_table[i].sclk == cs42l42->sclk) {
|
||||
/* Configure the internal sample rate */
|
||||
snd_soc_update_bits(codec, CS42L42_MCLK_CTL,
|
||||
snd_soc_component_update_bits(component, CS42L42_MCLK_CTL,
|
||||
CS42L42_INTERNAL_FS_MASK,
|
||||
((pll_ratio_table[i].mclk_int !=
|
||||
12000000) &&
|
||||
@ -632,7 +630,7 @@ static int cs42l42_pll_config(struct snd_soc_codec *codec)
|
||||
/* Set the MCLK src (PLL or SCLK) and the divide
|
||||
* ratio
|
||||
*/
|
||||
snd_soc_update_bits(codec, CS42L42_MCLK_SRC_SEL,
|
||||
snd_soc_component_update_bits(component, CS42L42_MCLK_SRC_SEL,
|
||||
CS42L42_MCLK_SRC_SEL_MASK |
|
||||
CS42L42_MCLKDIV_MASK,
|
||||
(pll_ratio_table[i].mclk_src_sel
|
||||
@ -643,62 +641,62 @@ static int cs42l42_pll_config(struct snd_soc_codec *codec)
|
||||
fsync = cs42l42->sclk / cs42l42->srate;
|
||||
if (((fsync * cs42l42->srate) != cs42l42->sclk)
|
||||
|| ((fsync % 2) != 0)) {
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"Unsupported sclk %d/sample rate %d\n",
|
||||
cs42l42->sclk,
|
||||
cs42l42->srate);
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Set the LRCLK period */
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_FSYNC_P_LOWER,
|
||||
CS42L42_FSYNC_PERIOD_MASK,
|
||||
CS42L42_FRAC0_VAL(fsync - 1) <<
|
||||
CS42L42_FSYNC_PERIOD_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_FSYNC_P_UPPER,
|
||||
CS42L42_FSYNC_PERIOD_MASK,
|
||||
CS42L42_FRAC1_VAL(fsync - 1) <<
|
||||
CS42L42_FSYNC_PERIOD_SHIFT);
|
||||
/* Set the LRCLK to 50% duty cycle */
|
||||
fsync = fsync / 2;
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_FSYNC_PW_LOWER,
|
||||
CS42L42_FSYNC_PULSE_WIDTH_MASK,
|
||||
CS42L42_FRAC0_VAL(fsync - 1) <<
|
||||
CS42L42_FSYNC_PULSE_WIDTH_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_FSYNC_PW_UPPER,
|
||||
CS42L42_FSYNC_PULSE_WIDTH_MASK,
|
||||
CS42L42_FRAC1_VAL(fsync - 1) <<
|
||||
CS42L42_FSYNC_PULSE_WIDTH_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_ASP_FRM_CFG,
|
||||
CS42L42_ASP_5050_MASK,
|
||||
CS42L42_ASP_5050_MASK);
|
||||
/* Set the frame delay to 1.0 SCLK clocks */
|
||||
snd_soc_update_bits(codec, CS42L42_ASP_FRM_CFG,
|
||||
snd_soc_component_update_bits(component, CS42L42_ASP_FRM_CFG,
|
||||
CS42L42_ASP_FSD_MASK,
|
||||
CS42L42_ASP_FSD_1_0 <<
|
||||
CS42L42_ASP_FSD_SHIFT);
|
||||
/* Set the sample rates (96k or lower) */
|
||||
snd_soc_update_bits(codec, CS42L42_FS_RATE_EN,
|
||||
snd_soc_component_update_bits(component, CS42L42_FS_RATE_EN,
|
||||
CS42L42_FS_EN_MASK,
|
||||
(CS42L42_FS_EN_IASRC_96K |
|
||||
CS42L42_FS_EN_OASRC_96K) <<
|
||||
CS42L42_FS_EN_SHIFT);
|
||||
/* Set the input/output internal MCLK clock ~12 MHz */
|
||||
snd_soc_update_bits(codec, CS42L42_IN_ASRC_CLK,
|
||||
snd_soc_component_update_bits(component, CS42L42_IN_ASRC_CLK,
|
||||
CS42L42_CLK_IASRC_SEL_MASK,
|
||||
CS42L42_CLK_IASRC_SEL_12 <<
|
||||
CS42L42_CLK_IASRC_SEL_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_OUT_ASRC_CLK,
|
||||
CS42L42_CLK_OASRC_SEL_MASK,
|
||||
CS42L42_CLK_OASRC_SEL_12 <<
|
||||
CS42L42_CLK_OASRC_SEL_SHIFT);
|
||||
/* channel 1 on low LRCLK, 32 bit */
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_ASP_RX_DAI0_CH1_AP_RES,
|
||||
CS42L42_ASP_RX_CH_AP_MASK |
|
||||
CS42L42_ASP_RX_CH_RES_MASK,
|
||||
@ -707,7 +705,7 @@ static int cs42l42_pll_config(struct snd_soc_codec *codec)
|
||||
(CS42L42_ASP_RX_CH_RES_32 <<
|
||||
CS42L42_ASP_RX_CH_RES_SHIFT));
|
||||
/* Channel 2 on high LRCLK, 32 bit */
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_ASP_RX_DAI0_CH2_AP_RES,
|
||||
CS42L42_ASP_RX_CH_AP_MASK |
|
||||
CS42L42_ASP_RX_CH_RES_MASK,
|
||||
@ -717,50 +715,50 @@ static int cs42l42_pll_config(struct snd_soc_codec *codec)
|
||||
CS42L42_ASP_RX_CH_RES_SHIFT));
|
||||
if (pll_ratio_table[i].mclk_src_sel == 0) {
|
||||
/* Pass the clock straight through */
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_CTL1,
|
||||
CS42L42_PLL_START_MASK, 0);
|
||||
} else {
|
||||
/* Configure PLL per table 4-5 */
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_DIV_CFG1,
|
||||
CS42L42_SCLK_PREDIV_MASK,
|
||||
pll_ratio_table[i].sclk_prediv
|
||||
<< CS42L42_SCLK_PREDIV_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_DIV_INT,
|
||||
CS42L42_PLL_DIV_INT_MASK,
|
||||
pll_ratio_table[i].pll_div_int
|
||||
<< CS42L42_PLL_DIV_INT_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_DIV_FRAC0,
|
||||
CS42L42_PLL_DIV_FRAC_MASK,
|
||||
CS42L42_FRAC0_VAL(
|
||||
pll_ratio_table[i].pll_div_frac)
|
||||
<< CS42L42_PLL_DIV_FRAC_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_DIV_FRAC1,
|
||||
CS42L42_PLL_DIV_FRAC_MASK,
|
||||
CS42L42_FRAC1_VAL(
|
||||
pll_ratio_table[i].pll_div_frac)
|
||||
<< CS42L42_PLL_DIV_FRAC_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_DIV_FRAC2,
|
||||
CS42L42_PLL_DIV_FRAC_MASK,
|
||||
CS42L42_FRAC2_VAL(
|
||||
pll_ratio_table[i].pll_div_frac)
|
||||
<< CS42L42_PLL_DIV_FRAC_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_CTL4,
|
||||
CS42L42_PLL_MODE_MASK,
|
||||
pll_ratio_table[i].pll_mode
|
||||
<< CS42L42_PLL_MODE_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_CTL3,
|
||||
CS42L42_PLL_DIVOUT_MASK,
|
||||
pll_ratio_table[i].pll_divout
|
||||
<< CS42L42_PLL_DIVOUT_SHIFT);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_CAL_RATIO,
|
||||
CS42L42_PLL_CAL_RATIO_MASK,
|
||||
pll_ratio_table[i].pll_cal_ratio
|
||||
@ -775,7 +773,7 @@ static int cs42l42_pll_config(struct snd_soc_codec *codec)
|
||||
|
||||
static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
u32 asp_cfg_val = 0;
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
@ -820,7 +818,7 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
break;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, CS42L42_ASP_CLK_CFG,
|
||||
snd_soc_component_update_bits(component, CS42L42_ASP_CLK_CFG,
|
||||
CS42L42_ASP_MODE_MASK |
|
||||
CS42L42_ASP_SCPOL_IN_DAC_MASK |
|
||||
CS42L42_ASP_LCPOL_IN_MASK, asp_cfg_val);
|
||||
@ -832,14 +830,14 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs42l42_private *cs42l42 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component);
|
||||
int retval;
|
||||
|
||||
cs42l42->srate = params_rate(params);
|
||||
cs42l42->swidth = params_width(params);
|
||||
|
||||
retval = cs42l42_pll_config(codec);
|
||||
retval = cs42l42_pll_config(component);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -847,8 +845,8 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
static int cs42l42_set_sysclk(struct snd_soc_dai *dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs42l42_private *cs42l42 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
cs42l42->sclk = freq;
|
||||
|
||||
@ -857,7 +855,7 @@ static int cs42l42_set_sysclk(struct snd_soc_dai *dai,
|
||||
|
||||
static int cs42l42_digital_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
unsigned int regval;
|
||||
u8 fullScaleVol;
|
||||
|
||||
@ -865,25 +863,25 @@ static int cs42l42_digital_mute(struct snd_soc_dai *dai, int mute)
|
||||
/* Mark SCLK as not present to turn on the internal
|
||||
* oscillator.
|
||||
*/
|
||||
snd_soc_update_bits(codec, CS42L42_OSC_SWITCH,
|
||||
snd_soc_component_update_bits(component, CS42L42_OSC_SWITCH,
|
||||
CS42L42_SCLK_PRESENT_MASK, 0);
|
||||
|
||||
snd_soc_update_bits(codec, CS42L42_PLL_CTL1,
|
||||
snd_soc_component_update_bits(component, CS42L42_PLL_CTL1,
|
||||
CS42L42_PLL_START_MASK,
|
||||
0 << CS42L42_PLL_START_SHIFT);
|
||||
|
||||
/* Mute the headphone */
|
||||
snd_soc_update_bits(codec, CS42L42_HP_CTL,
|
||||
snd_soc_component_update_bits(component, CS42L42_HP_CTL,
|
||||
CS42L42_HP_ANA_AMUTE_MASK |
|
||||
CS42L42_HP_ANA_BMUTE_MASK,
|
||||
CS42L42_HP_ANA_AMUTE_MASK |
|
||||
CS42L42_HP_ANA_BMUTE_MASK);
|
||||
} else {
|
||||
snd_soc_update_bits(codec, CS42L42_PLL_CTL1,
|
||||
snd_soc_component_update_bits(component, CS42L42_PLL_CTL1,
|
||||
CS42L42_PLL_START_MASK,
|
||||
1 << CS42L42_PLL_START_SHIFT);
|
||||
/* Read the headphone load */
|
||||
regval = snd_soc_read(codec, CS42L42_LOAD_DET_RCSTAT);
|
||||
regval = snd_soc_component_read32(component, CS42L42_LOAD_DET_RCSTAT);
|
||||
if (((regval & CS42L42_RLA_STAT_MASK) >>
|
||||
CS42L42_RLA_STAT_SHIFT) == CS42L42_RLA_STAT_15_OHM) {
|
||||
fullScaleVol = CS42L42_HP_FULL_SCALE_VOL_MASK;
|
||||
@ -892,13 +890,13 @@ static int cs42l42_digital_mute(struct snd_soc_dai *dai, int mute)
|
||||
}
|
||||
|
||||
/* Un-mute the headphone, set the full scale volume flag */
|
||||
snd_soc_update_bits(codec, CS42L42_HP_CTL,
|
||||
snd_soc_component_update_bits(component, CS42L42_HP_CTL,
|
||||
CS42L42_HP_ANA_AMUTE_MASK |
|
||||
CS42L42_HP_ANA_BMUTE_MASK |
|
||||
CS42L42_HP_FULL_SCALE_VOL_MASK, fullScaleVol);
|
||||
|
||||
/* Mark SCLK as present, turn off internal oscillator */
|
||||
snd_soc_update_bits(codec, CS42L42_OSC_SWITCH,
|
||||
snd_soc_component_update_bits(component, CS42L42_OSC_SWITCH,
|
||||
CS42L42_SCLK_PRESENT_MASK,
|
||||
CS42L42_SCLK_PRESENT_MASK);
|
||||
}
|
||||
@ -1262,16 +1260,16 @@ static void cs42l42_handle_button_press(struct cs42l42_private *cs42l42)
|
||||
|
||||
switch (bias_level) {
|
||||
case 1: /* Function C button press */
|
||||
dev_dbg(cs42l42->codec->dev, "Function C button press\n");
|
||||
dev_dbg(cs42l42->component->dev, "Function C button press\n");
|
||||
break;
|
||||
case 2: /* Function B button press */
|
||||
dev_dbg(cs42l42->codec->dev, "Function B button press\n");
|
||||
dev_dbg(cs42l42->component->dev, "Function B button press\n");
|
||||
break;
|
||||
case 3: /* Function D button press */
|
||||
dev_dbg(cs42l42->codec->dev, "Function D button press\n");
|
||||
dev_dbg(cs42l42->component->dev, "Function D button press\n");
|
||||
break;
|
||||
case 4: /* Function A button press */
|
||||
dev_dbg(cs42l42->codec->dev, "Function A button press\n");
|
||||
dev_dbg(cs42l42->component->dev, "Function A button press\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1340,7 +1338,7 @@ static const struct cs42l42_irq_params irq_params_table[] = {
|
||||
static irqreturn_t cs42l42_irq_thread(int irq, void *data)
|
||||
{
|
||||
struct cs42l42_private *cs42l42 = (struct cs42l42_private *)data;
|
||||
struct snd_soc_codec *codec = cs42l42->codec;
|
||||
struct snd_soc_component *component = cs42l42->component;
|
||||
unsigned int stickies[12];
|
||||
unsigned int masks[12];
|
||||
unsigned int current_plug_status;
|
||||
@ -1372,7 +1370,7 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data)
|
||||
if ((~masks[5]) & irq_params_table[5].mask) {
|
||||
if (stickies[5] & CS42L42_HSDET_AUTO_DONE_MASK) {
|
||||
cs42l42_process_hs_type_detect(cs42l42);
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Auto detect done (%d)\n",
|
||||
cs42l42->hs_type);
|
||||
}
|
||||
@ -1392,7 +1390,7 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data)
|
||||
if (cs42l42->plug_state != CS42L42_TS_UNPLUG) {
|
||||
cs42l42->plug_state = CS42L42_TS_UNPLUG;
|
||||
cs42l42_cancel_hs_type_detect(cs42l42);
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Unplug event\n");
|
||||
}
|
||||
break;
|
||||
@ -1410,7 +1408,7 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data)
|
||||
|
||||
if (current_button_status &
|
||||
CS42L42_M_DETECT_TF_MASK) {
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Button released\n");
|
||||
} else if (current_button_status &
|
||||
CS42L42_M_DETECT_FT_MASK) {
|
||||
@ -1879,8 +1877,8 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,
|
||||
cs42l42_set_interrupt_masks(cs42l42);
|
||||
|
||||
/* Register codec for machine driver */
|
||||
ret = snd_soc_register_codec(&i2c_client->dev,
|
||||
&soc_codec_dev_cs42l42, &cs42l42_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c_client->dev,
|
||||
&soc_component_dev_cs42l42, &cs42l42_dai, 1);
|
||||
if (ret < 0)
|
||||
goto err_disable;
|
||||
return 0;
|
||||
@ -1895,8 +1893,6 @@ static int cs42l42_i2c_remove(struct i2c_client *i2c_client)
|
||||
{
|
||||
struct cs42l42_private *cs42l42 = i2c_get_clientdata(i2c_client);
|
||||
|
||||
snd_soc_unregister_codec(&i2c_client->dev);
|
||||
|
||||
/* Hold down reset */
|
||||
gpiod_set_value_cansleep(cs42l42->reset_gpio, 0);
|
||||
|
||||
|
@ -754,7 +754,7 @@ static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = {
|
||||
|
||||
struct cs42l42_private {
|
||||
struct regmap *regmap;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
struct regulator_bulk_data supplies[CS42L42_NUM_SUPPLIES];
|
||||
struct gpio_desc *reset_gpio;
|
||||
struct completion pdn_done;
|
||||
|
@ -35,20 +35,12 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c,
|
||||
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 = {
|
||||
.driver = {
|
||||
.name = "cs42l51",
|
||||
.of_match_table = cs42l51_of_match,
|
||||
},
|
||||
.probe = cs42l51_i2c_probe,
|
||||
.remove = cs42l51_i2c_remove,
|
||||
.id_table = cs42l51_i2c_id,
|
||||
};
|
||||
|
||||
|
@ -54,8 +54,8 @@ struct cs42l51_private {
|
||||
static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned long value = snd_soc_read(codec, CS42L51_PCM_MIXER)&3;
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
unsigned long value = snd_soc_component_read32(component, CS42L51_PCM_MIXER)&3;
|
||||
|
||||
switch (value) {
|
||||
default:
|
||||
@ -82,7 +82,7 @@ static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol,
|
||||
static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol,
|
||||
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;
|
||||
|
||||
switch (ucontrol->value.enumerated.item[0]) {
|
||||
@ -98,7 +98,7 @@ static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol,
|
||||
break;
|
||||
}
|
||||
|
||||
snd_soc_write(codec, CS42L51_PCM_MIXER, val);
|
||||
snd_soc_component_write(component, CS42L51_PCM_MIXER, val);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -153,17 +153,17 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
|
||||
static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w,
|
||||
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) {
|
||||
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);
|
||||
break;
|
||||
default:
|
||||
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);
|
||||
break;
|
||||
}
|
||||
@ -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,
|
||||
unsigned int format)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (format & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
case SND_SOC_DAIFMT_I2S:
|
||||
@ -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;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "invalid DAI format\n");
|
||||
dev_err(component->dev, "invalid DAI format\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
cs42l51->func = MODE_SLAVE_AUTO;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Unknown master/slave configuration\n");
|
||||
dev_err(component->dev, "Unknown master/slave configuration\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -326,8 +326,8 @@ static struct cs42l51_ratios slave_auto_ratios[] = {
|
||||
static int cs42l51_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 cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
cs42l51->mclk = freq;
|
||||
return 0;
|
||||
@ -337,8 +337,8 @@ static int cs42l51_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 cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
unsigned int i;
|
||||
unsigned int rate;
|
||||
@ -370,12 +370,12 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
if (i == nr_ratios) {
|
||||
/* 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;
|
||||
}
|
||||
|
||||
intf_ctl = snd_soc_read(codec, CS42L51_INTF_CTL);
|
||||
power_ctl = snd_soc_read(codec, CS42L51_MIC_POWER_CTL);
|
||||
intf_ctl = snd_soc_component_read32(component, CS42L51_INTF_CTL);
|
||||
power_ctl = snd_soc_component_read32(component, CS42L51_MIC_POWER_CTL);
|
||||
|
||||
intf_ctl &= ~(CS42L51_INTF_CTL_MASTER | CS42L51_INTF_CTL_ADC_I2S
|
||||
| CS42L51_INTF_CTL_DAC_FORMAT(7));
|
||||
@ -418,24 +418,24 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream,
|
||||
fmt = CS42L51_DAC_DIF_RJ24;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "unknown format\n");
|
||||
dev_err(component->dev, "unknown format\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
intf_ctl |= CS42L51_INTF_CTL_DAC_FORMAT(fmt);
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "unknown format\n");
|
||||
dev_err(component->dev, "unknown format\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ratios[i].mclk)
|
||||
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)
|
||||
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)
|
||||
return ret;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
int reg;
|
||||
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)
|
||||
reg |= mask;
|
||||
else
|
||||
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 = {
|
||||
@ -484,7 +484,7 @@ static struct snd_soc_dai_driver cs42l51_dai = {
|
||||
.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;
|
||||
|
||||
@ -497,24 +497,25 @@ static int cs42l51_codec_probe(struct snd_soc_codec *codec)
|
||||
*/
|
||||
reg = CS42L51_DAC_CTL_DATA_SEL(1)
|
||||
| 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)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_device_cs42l51 = {
|
||||
.probe = cs42l51_codec_probe,
|
||||
|
||||
.component_driver = {
|
||||
.controls = cs42l51_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs42l51_snd_controls),
|
||||
.dapm_widgets = cs42l51_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets),
|
||||
.dapm_routes = cs42l51_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs42l51_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_device_cs42l51 = {
|
||||
.probe = cs42l51_component_probe,
|
||||
.controls = cs42l51_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs42l51_snd_controls),
|
||||
.dapm_widgets = cs42l51_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets),
|
||||
.dapm_routes = 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 = {
|
||||
@ -555,8 +556,8 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap)
|
||||
dev_info(dev, "Cirrus Logic CS42L51, Revision: %02X\n",
|
||||
val & CS42L51_CHIP_REV_MASK);
|
||||
|
||||
ret = snd_soc_register_codec(dev,
|
||||
&soc_codec_device_cs42l51, &cs42l51_dai, 1);
|
||||
ret = devm_snd_soc_register_component(dev,
|
||||
&soc_component_device_cs42l51, &cs42l51_dai, 1);
|
||||
error:
|
||||
return ret;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ struct sp_config {
|
||||
|
||||
struct cs42l52_private {
|
||||
struct regmap *regmap;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
struct device *dev;
|
||||
struct sp_config config;
|
||||
struct cs42l52_platform_data pdata;
|
||||
@ -473,17 +473,17 @@ static const struct snd_kcontrol_new cs42l52_micb_controls[] = {
|
||||
SOC_ENUM("MICB Select", micb_enum),
|
||||
};
|
||||
|
||||
static int cs42l52_add_mic_controls(struct snd_soc_codec *codec)
|
||||
static int cs42l52_add_mic_controls(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
|
||||
struct cs42l52_platform_data *pdata = &cs42l52->pdata;
|
||||
|
||||
if (!pdata->mica_diff_cfg)
|
||||
snd_soc_add_codec_controls(codec, cs42l52_mica_controls,
|
||||
snd_soc_add_component_controls(component, cs42l52_mica_controls,
|
||||
ARRAY_SIZE(cs42l52_mica_controls));
|
||||
|
||||
if (!pdata->micb_diff_cfg)
|
||||
snd_soc_add_codec_controls(codec, cs42l52_micb_controls,
|
||||
snd_soc_add_component_controls(component, cs42l52_micb_controls,
|
||||
ARRAY_SIZE(cs42l52_micb_controls));
|
||||
|
||||
return 0;
|
||||
@ -716,13 +716,13 @@ static int cs42l52_get_clk(int mclk, int rate)
|
||||
static int cs42l52_set_sysclk(struct snd_soc_dai *codec_dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if ((freq >= CS42L52_MIN_CLK) && (freq <= CS42L52_MAX_CLK)) {
|
||||
cs42l52->sysclk = freq;
|
||||
} else {
|
||||
dev_err(codec->dev, "Invalid freq parameter\n");
|
||||
dev_err(component->dev, "Invalid freq parameter\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
@ -730,8 +730,8 @@ static int cs42l52_set_sysclk(struct snd_soc_dai *codec_dai,
|
||||
|
||||
static int cs42l52_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
|
||||
u8 iface = 0;
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
@ -783,21 +783,21 @@ static int cs42l52_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
return -EINVAL;
|
||||
}
|
||||
cs42l52->config.format = iface;
|
||||
snd_soc_write(codec, CS42L52_IFACE_CTL1, cs42l52->config.format);
|
||||
snd_soc_component_write(component, CS42L52_IFACE_CTL1, cs42l52->config.format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs42l52_digital_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
|
||||
if (mute)
|
||||
snd_soc_update_bits(codec, CS42L52_PB_CTL1,
|
||||
snd_soc_component_update_bits(component, CS42L52_PB_CTL1,
|
||||
CS42L52_PB_CTL1_MUTE_MASK,
|
||||
CS42L52_PB_CTL1_MUTE);
|
||||
else
|
||||
snd_soc_update_bits(codec, CS42L52_PB_CTL1,
|
||||
snd_soc_component_update_bits(component, CS42L52_PB_CTL1,
|
||||
CS42L52_PB_CTL1_MUTE_MASK,
|
||||
CS42L52_PB_CTL1_UNMUTE);
|
||||
|
||||
@ -808,8 +808,8 @@ static int cs42l52_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
|
||||
u32 clk = 0;
|
||||
int index;
|
||||
|
||||
@ -823,36 +823,36 @@ static int cs42l52_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
(clk_map_table[index].ratio << CLK_RATIO_SHIFT) |
|
||||
clk_map_table[index].mclkdiv2;
|
||||
|
||||
snd_soc_write(codec, CS42L52_CLK_CTL, clk);
|
||||
snd_soc_component_write(component, CS42L52_CLK_CTL, clk);
|
||||
} else {
|
||||
dev_err(codec->dev, "can't get correct mclk\n");
|
||||
dev_err(component->dev, "can't get correct mclk\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs42l52_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int cs42l52_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
break;
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
snd_soc_update_bits(codec, CS42L52_PWRCTL1,
|
||||
snd_soc_component_update_bits(component, CS42L52_PWRCTL1,
|
||||
CS42L52_PWRCTL1_PDN_CODEC, 0);
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||
regcache_cache_only(cs42l52->regmap, false);
|
||||
regcache_sync(cs42l52->regmap);
|
||||
}
|
||||
snd_soc_write(codec, CS42L52_PWRCTL1, CS42L52_PWRCTL1_PDN_ALL);
|
||||
snd_soc_component_write(component, CS42L52_PWRCTL1, CS42L52_PWRCTL1_PDN_ALL);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF:
|
||||
snd_soc_write(codec, CS42L52_PWRCTL1, CS42L52_PWRCTL1_PDN_ALL);
|
||||
snd_soc_component_write(component, CS42L52_PWRCTL1, CS42L52_PWRCTL1_PDN_ALL);
|
||||
regcache_cache_only(cs42l52->regmap, true);
|
||||
break;
|
||||
}
|
||||
@ -902,8 +902,8 @@ static void cs42l52_beep_work(struct work_struct *work)
|
||||
{
|
||||
struct cs42l52_private *cs42l52 =
|
||||
container_of(work, struct cs42l52_private, beep_work);
|
||||
struct snd_soc_codec *codec = cs42l52->codec;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct snd_soc_component *component = cs42l52->component;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
int i;
|
||||
int val = 0;
|
||||
int best = 0;
|
||||
@ -915,18 +915,18 @@ static void cs42l52_beep_work(struct work_struct *work)
|
||||
best = i;
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "Set beep rate %dHz for requested %dHz\n",
|
||||
dev_dbg(component->dev, "Set beep rate %dHz for requested %dHz\n",
|
||||
beep_rates[best], cs42l52->beep_rate);
|
||||
|
||||
val = (best << CS42L52_BEEP_RATE_SHIFT);
|
||||
|
||||
snd_soc_dapm_enable_pin(dapm, "Beep");
|
||||
} else {
|
||||
dev_dbg(codec->dev, "Disabling beep\n");
|
||||
dev_dbg(component->dev, "Disabling beep\n");
|
||||
snd_soc_dapm_disable_pin(dapm, "Beep");
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, CS42L52_BEEP_FREQ,
|
||||
snd_soc_component_update_bits(component, CS42L52_BEEP_FREQ,
|
||||
CS42L52_BEEP_RATE_MASK, val);
|
||||
|
||||
snd_soc_dapm_sync(dapm);
|
||||
@ -938,10 +938,10 @@ static void cs42l52_beep_work(struct work_struct *work)
|
||||
static int cs42l52_beep_event(struct input_dev *dev, unsigned int type,
|
||||
unsigned int code, int hz)
|
||||
{
|
||||
struct snd_soc_codec *codec = input_get_drvdata(dev);
|
||||
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = input_get_drvdata(dev);
|
||||
struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
dev_dbg(codec->dev, "Beep event %x %x\n", code, hz);
|
||||
dev_dbg(component->dev, "Beep event %x %x\n", code, hz);
|
||||
|
||||
switch (code) {
|
||||
case SND_BELL:
|
||||
@ -978,14 +978,14 @@ static ssize_t cs42l52_beep_set(struct device *dev,
|
||||
|
||||
static DEVICE_ATTR(beep, 0200, NULL, cs42l52_beep_set);
|
||||
|
||||
static void cs42l52_init_beep(struct snd_soc_codec *codec)
|
||||
static void cs42l52_init_beep(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
cs42l52->beep = devm_input_allocate_device(codec->dev);
|
||||
cs42l52->beep = devm_input_allocate_device(component->dev);
|
||||
if (!cs42l52->beep) {
|
||||
dev_err(codec->dev, "Failed to allocate beep device\n");
|
||||
dev_err(component->dev, "Failed to allocate beep device\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -993,49 +993,49 @@ static void cs42l52_init_beep(struct snd_soc_codec *codec)
|
||||
cs42l52->beep_rate = 0;
|
||||
|
||||
cs42l52->beep->name = "CS42L52 Beep Generator";
|
||||
cs42l52->beep->phys = dev_name(codec->dev);
|
||||
cs42l52->beep->phys = dev_name(component->dev);
|
||||
cs42l52->beep->id.bustype = BUS_I2C;
|
||||
|
||||
cs42l52->beep->evbit[0] = BIT_MASK(EV_SND);
|
||||
cs42l52->beep->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
|
||||
cs42l52->beep->event = cs42l52_beep_event;
|
||||
cs42l52->beep->dev.parent = codec->dev;
|
||||
input_set_drvdata(cs42l52->beep, codec);
|
||||
cs42l52->beep->dev.parent = component->dev;
|
||||
input_set_drvdata(cs42l52->beep, component);
|
||||
|
||||
ret = input_register_device(cs42l52->beep);
|
||||
if (ret != 0) {
|
||||
cs42l52->beep = NULL;
|
||||
dev_err(codec->dev, "Failed to register beep device\n");
|
||||
dev_err(component->dev, "Failed to register beep device\n");
|
||||
}
|
||||
|
||||
ret = device_create_file(codec->dev, &dev_attr_beep);
|
||||
ret = device_create_file(component->dev, &dev_attr_beep);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to create keyclick file: %d\n",
|
||||
dev_err(component->dev, "Failed to create keyclick file: %d\n",
|
||||
ret);
|
||||
}
|
||||
}
|
||||
|
||||
static void cs42l52_free_beep(struct snd_soc_codec *codec)
|
||||
static void cs42l52_free_beep(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
device_remove_file(codec->dev, &dev_attr_beep);
|
||||
device_remove_file(component->dev, &dev_attr_beep);
|
||||
cancel_work_sync(&cs42l52->beep_work);
|
||||
cs42l52->beep = NULL;
|
||||
|
||||
snd_soc_update_bits(codec, CS42L52_BEEP_TONE_CTL,
|
||||
snd_soc_component_update_bits(component, CS42L52_BEEP_TONE_CTL,
|
||||
CS42L52_BEEP_EN_MASK, 0);
|
||||
}
|
||||
|
||||
static int cs42l52_probe(struct snd_soc_codec *codec)
|
||||
static int cs42l52_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
regcache_cache_only(cs42l52->regmap, true);
|
||||
|
||||
cs42l52_add_mic_controls(codec);
|
||||
cs42l52_add_mic_controls(component);
|
||||
|
||||
cs42l52_init_beep(codec);
|
||||
cs42l52_init_beep(component);
|
||||
|
||||
cs42l52->sysclk = CS42L52_DEFAULT_CLK;
|
||||
cs42l52->config.format = CS42L52_DEFAULT_FORMAT;
|
||||
@ -1043,27 +1043,26 @@ static int cs42l52_probe(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs42l52_remove(struct snd_soc_codec *codec)
|
||||
static void cs42l52_remove(struct snd_soc_component *component)
|
||||
{
|
||||
cs42l52_free_beep(codec);
|
||||
|
||||
return 0;
|
||||
cs42l52_free_beep(component);
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_cs42l52 = {
|
||||
.probe = cs42l52_probe,
|
||||
.remove = cs42l52_remove,
|
||||
.set_bias_level = cs42l52_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.controls = cs42l52_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs42l52_snd_controls),
|
||||
.dapm_widgets = cs42l52_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs42l52_dapm_widgets),
|
||||
.dapm_routes = cs42l52_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs42l52_audio_map),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_cs42l52 = {
|
||||
.probe = cs42l52_probe,
|
||||
.remove = cs42l52_remove,
|
||||
.set_bias_level = cs42l52_set_bias_level,
|
||||
.controls = cs42l52_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs42l52_snd_controls),
|
||||
.dapm_widgets = cs42l52_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs42l52_dapm_widgets),
|
||||
.dapm_routes = cs42l52_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs42l52_audio_map),
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
/* Current and threshold powerup sequence Pg37 */
|
||||
@ -1202,19 +1201,13 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
|
||||
CS42L52_IFACE_CTL2_BIAS_LVL,
|
||||
cs42l52->pdata.micbias_lvl);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c_client->dev,
|
||||
&soc_codec_dev_cs42l52, &cs42l52_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c_client->dev,
|
||||
&soc_component_dev_cs42l52, &cs42l52_dai, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs42l52_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id cs42l52_of_match[] = {
|
||||
{ .compatible = "cirrus,cs42l52", },
|
||||
{},
|
||||
@ -1235,7 +1228,6 @@ static struct i2c_driver cs42l52_i2c_driver = {
|
||||
},
|
||||
.id_table = cs42l52_id,
|
||||
.probe = cs42l52_i2c_probe,
|
||||
.remove = cs42l52_i2c_remove,
|
||||
};
|
||||
|
||||
module_i2c_driver(cs42l52_i2c_driver);
|
||||
|
@ -45,7 +45,7 @@ static const char *const cs42l56_supply_names[CS42L56_NUM_SUPPLIES] = {
|
||||
|
||||
struct cs42l56_private {
|
||||
struct regmap *regmap;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
struct device *dev;
|
||||
struct cs42l56_platform_data pdata;
|
||||
struct regulator_bulk_data supplies[CS42L56_NUM_SUPPLIES];
|
||||
@ -726,8 +726,8 @@ static int cs42l56_get_mclk_ratio(int mclk, int rate)
|
||||
static int cs42l56_set_sysclk(struct snd_soc_dai *codec_dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs42l56_private *cs42l56 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (freq) {
|
||||
case CS42L56_MCLK_5P6448MHZ:
|
||||
@ -753,10 +753,10 @@ static int cs42l56_set_sysclk(struct snd_soc_dai *codec_dai,
|
||||
}
|
||||
cs42l56->mclk = freq;
|
||||
|
||||
snd_soc_update_bits(codec, CS42L56_CLKCTL_1,
|
||||
snd_soc_component_update_bits(component, CS42L56_CLKCTL_1,
|
||||
CS42L56_MCLK_PREDIV_MASK,
|
||||
cs42l56->mclk_prediv);
|
||||
snd_soc_update_bits(codec, CS42L56_CLKCTL_1,
|
||||
snd_soc_component_update_bits(component, CS42L56_CLKCTL_1,
|
||||
CS42L56_MCLK_DIV2_MASK,
|
||||
cs42l56->mclk_div2);
|
||||
|
||||
@ -765,8 +765,8 @@ static int cs42l56_set_sysclk(struct snd_soc_dai *codec_dai,
|
||||
|
||||
static int cs42l56_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs42l56_private *cs42l56 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
case SND_SOC_DAIFMT_CBM_CFM:
|
||||
@ -803,22 +803,22 @@ static int cs42l56_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, CS42L56_CLKCTL_1,
|
||||
snd_soc_component_update_bits(component, CS42L56_CLKCTL_1,
|
||||
CS42L56_MS_MODE_MASK, cs42l56->iface);
|
||||
snd_soc_update_bits(codec, CS42L56_SERIAL_FMT,
|
||||
snd_soc_component_update_bits(component, CS42L56_SERIAL_FMT,
|
||||
CS42L56_DIG_FMT_MASK, cs42l56->iface_fmt);
|
||||
snd_soc_update_bits(codec, CS42L56_CLKCTL_1,
|
||||
snd_soc_component_update_bits(component, CS42L56_CLKCTL_1,
|
||||
CS42L56_SCLK_INV_MASK, cs42l56->iface_inv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs42l56_digital_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
|
||||
if (mute) {
|
||||
/* Hit the DSP Mixer first */
|
||||
snd_soc_update_bits(codec, CS42L56_DSP_MUTE_CTL,
|
||||
snd_soc_component_update_bits(component, CS42L56_DSP_MUTE_CTL,
|
||||
CS42L56_ADCAMIX_MUTE_MASK |
|
||||
CS42L56_ADCBMIX_MUTE_MASK |
|
||||
CS42L56_PCMAMIX_MUTE_MASK |
|
||||
@ -827,21 +827,21 @@ static int cs42l56_digital_mute(struct snd_soc_dai *dai, int mute)
|
||||
CS42L56_MSTA_MUTE_MASK,
|
||||
CS42L56_MUTE_ALL);
|
||||
/* Mute ADC's */
|
||||
snd_soc_update_bits(codec, CS42L56_MISC_ADC_CTL,
|
||||
snd_soc_component_update_bits(component, CS42L56_MISC_ADC_CTL,
|
||||
CS42L56_ADCA_MUTE_MASK |
|
||||
CS42L56_ADCB_MUTE_MASK,
|
||||
CS42L56_MUTE_ALL);
|
||||
/* HP And LO */
|
||||
snd_soc_update_bits(codec, CS42L56_HPA_VOLUME,
|
||||
snd_soc_component_update_bits(component, CS42L56_HPA_VOLUME,
|
||||
CS42L56_HP_MUTE_MASK, CS42L56_MUTE_ALL);
|
||||
snd_soc_update_bits(codec, CS42L56_HPB_VOLUME,
|
||||
snd_soc_component_update_bits(component, CS42L56_HPB_VOLUME,
|
||||
CS42L56_HP_MUTE_MASK, CS42L56_MUTE_ALL);
|
||||
snd_soc_update_bits(codec, CS42L56_LOA_VOLUME,
|
||||
snd_soc_component_update_bits(component, CS42L56_LOA_VOLUME,
|
||||
CS42L56_LO_MUTE_MASK, CS42L56_MUTE_ALL);
|
||||
snd_soc_update_bits(codec, CS42L56_LOB_VOLUME,
|
||||
snd_soc_component_update_bits(component, CS42L56_LOB_VOLUME,
|
||||
CS42L56_LO_MUTE_MASK, CS42L56_MUTE_ALL);
|
||||
} else {
|
||||
snd_soc_update_bits(codec, CS42L56_DSP_MUTE_CTL,
|
||||
snd_soc_component_update_bits(component, CS42L56_DSP_MUTE_CTL,
|
||||
CS42L56_ADCAMIX_MUTE_MASK |
|
||||
CS42L56_ADCBMIX_MUTE_MASK |
|
||||
CS42L56_PCMAMIX_MUTE_MASK |
|
||||
@ -850,18 +850,18 @@ static int cs42l56_digital_mute(struct snd_soc_dai *dai, int mute)
|
||||
CS42L56_MSTA_MUTE_MASK,
|
||||
CS42L56_UNMUTE);
|
||||
|
||||
snd_soc_update_bits(codec, CS42L56_MISC_ADC_CTL,
|
||||
snd_soc_component_update_bits(component, CS42L56_MISC_ADC_CTL,
|
||||
CS42L56_ADCA_MUTE_MASK |
|
||||
CS42L56_ADCB_MUTE_MASK,
|
||||
CS42L56_UNMUTE);
|
||||
|
||||
snd_soc_update_bits(codec, CS42L56_HPA_VOLUME,
|
||||
snd_soc_component_update_bits(component, CS42L56_HPA_VOLUME,
|
||||
CS42L56_HP_MUTE_MASK, CS42L56_UNMUTE);
|
||||
snd_soc_update_bits(codec, CS42L56_HPB_VOLUME,
|
||||
snd_soc_component_update_bits(component, CS42L56_HPB_VOLUME,
|
||||
CS42L56_HP_MUTE_MASK, CS42L56_UNMUTE);
|
||||
snd_soc_update_bits(codec, CS42L56_LOA_VOLUME,
|
||||
snd_soc_component_update_bits(component, CS42L56_LOA_VOLUME,
|
||||
CS42L56_LO_MUTE_MASK, CS42L56_UNMUTE);
|
||||
snd_soc_update_bits(codec, CS42L56_LOB_VOLUME,
|
||||
snd_soc_component_update_bits(component, CS42L56_LOB_VOLUME,
|
||||
CS42L56_LO_MUTE_MASK, CS42L56_UNMUTE);
|
||||
}
|
||||
return 0;
|
||||
@ -871,39 +871,39 @@ static int cs42l56_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs42l56_private *cs42l56 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component);
|
||||
int ratio;
|
||||
|
||||
ratio = cs42l56_get_mclk_ratio(cs42l56->mclk, params_rate(params));
|
||||
if (ratio >= 0) {
|
||||
snd_soc_update_bits(codec, CS42L56_CLKCTL_2,
|
||||
snd_soc_component_update_bits(component, CS42L56_CLKCTL_2,
|
||||
CS42L56_CLK_RATIO_MASK, ratio);
|
||||
} else {
|
||||
dev_err(codec->dev, "unsupported mclk/sclk/lrclk ratio\n");
|
||||
dev_err(component->dev, "unsupported mclk/sclk/lrclk ratio\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs42l56_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int cs42l56_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct cs42l56_private *cs42l56 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
break;
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
snd_soc_update_bits(codec, CS42L56_CLKCTL_1,
|
||||
snd_soc_component_update_bits(component, CS42L56_CLKCTL_1,
|
||||
CS42L56_MCLK_DIS_MASK, 0);
|
||||
snd_soc_update_bits(codec, CS42L56_PWRCTL_1,
|
||||
snd_soc_component_update_bits(component, CS42L56_PWRCTL_1,
|
||||
CS42L56_PDN_ALL_MASK, 0);
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||
regcache_cache_only(cs42l56->regmap, false);
|
||||
regcache_sync(cs42l56->regmap);
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(cs42l56->supplies),
|
||||
@ -915,13 +915,13 @@ static int cs42l56_set_bias_level(struct snd_soc_codec *codec,
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
snd_soc_update_bits(codec, CS42L56_PWRCTL_1,
|
||||
snd_soc_component_update_bits(component, CS42L56_PWRCTL_1,
|
||||
CS42L56_PDN_ALL_MASK, 1);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF:
|
||||
snd_soc_update_bits(codec, CS42L56_PWRCTL_1,
|
||||
snd_soc_component_update_bits(component, CS42L56_PWRCTL_1,
|
||||
CS42L56_PDN_ALL_MASK, 1);
|
||||
snd_soc_update_bits(codec, CS42L56_CLKCTL_1,
|
||||
snd_soc_component_update_bits(component, CS42L56_CLKCTL_1,
|
||||
CS42L56_MCLK_DIS_MASK, 1);
|
||||
regcache_cache_only(cs42l56->regmap, true);
|
||||
regulator_bulk_disable(ARRAY_SIZE(cs42l56->supplies),
|
||||
@ -974,8 +974,8 @@ static void cs42l56_beep_work(struct work_struct *work)
|
||||
{
|
||||
struct cs42l56_private *cs42l56 =
|
||||
container_of(work, struct cs42l56_private, beep_work);
|
||||
struct snd_soc_codec *codec = cs42l56->codec;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct snd_soc_component *component = cs42l56->component;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
int i;
|
||||
int val = 0;
|
||||
int best = 0;
|
||||
@ -987,18 +987,18 @@ static void cs42l56_beep_work(struct work_struct *work)
|
||||
best = i;
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "Set beep rate %dHz for requested %dHz\n",
|
||||
dev_dbg(component->dev, "Set beep rate %dHz for requested %dHz\n",
|
||||
beep_freq[best], cs42l56->beep_rate);
|
||||
|
||||
val = (best << CS42L56_BEEP_RATE_SHIFT);
|
||||
|
||||
snd_soc_dapm_enable_pin(dapm, "Beep");
|
||||
} else {
|
||||
dev_dbg(codec->dev, "Disabling beep\n");
|
||||
dev_dbg(component->dev, "Disabling beep\n");
|
||||
snd_soc_dapm_disable_pin(dapm, "Beep");
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, CS42L56_BEEP_FREQ_ONTIME,
|
||||
snd_soc_component_update_bits(component, CS42L56_BEEP_FREQ_ONTIME,
|
||||
CS42L56_BEEP_FREQ_MASK, val);
|
||||
|
||||
snd_soc_dapm_sync(dapm);
|
||||
@ -1010,10 +1010,10 @@ static void cs42l56_beep_work(struct work_struct *work)
|
||||
static int cs42l56_beep_event(struct input_dev *dev, unsigned int type,
|
||||
unsigned int code, int hz)
|
||||
{
|
||||
struct snd_soc_codec *codec = input_get_drvdata(dev);
|
||||
struct cs42l56_private *cs42l56 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = input_get_drvdata(dev);
|
||||
struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
dev_dbg(codec->dev, "Beep event %x %x\n", code, hz);
|
||||
dev_dbg(component->dev, "Beep event %x %x\n", code, hz);
|
||||
|
||||
switch (code) {
|
||||
case SND_BELL:
|
||||
@ -1050,14 +1050,14 @@ static ssize_t cs42l56_beep_set(struct device *dev,
|
||||
|
||||
static DEVICE_ATTR(beep, 0200, NULL, cs42l56_beep_set);
|
||||
|
||||
static void cs42l56_init_beep(struct snd_soc_codec *codec)
|
||||
static void cs42l56_init_beep(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs42l56_private *cs42l56 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
cs42l56->beep = devm_input_allocate_device(codec->dev);
|
||||
cs42l56->beep = devm_input_allocate_device(component->dev);
|
||||
if (!cs42l56->beep) {
|
||||
dev_err(codec->dev, "Failed to allocate beep device\n");
|
||||
dev_err(component->dev, "Failed to allocate beep device\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1065,68 +1065,67 @@ static void cs42l56_init_beep(struct snd_soc_codec *codec)
|
||||
cs42l56->beep_rate = 0;
|
||||
|
||||
cs42l56->beep->name = "CS42L56 Beep Generator";
|
||||
cs42l56->beep->phys = dev_name(codec->dev);
|
||||
cs42l56->beep->phys = dev_name(component->dev);
|
||||
cs42l56->beep->id.bustype = BUS_I2C;
|
||||
|
||||
cs42l56->beep->evbit[0] = BIT_MASK(EV_SND);
|
||||
cs42l56->beep->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
|
||||
cs42l56->beep->event = cs42l56_beep_event;
|
||||
cs42l56->beep->dev.parent = codec->dev;
|
||||
input_set_drvdata(cs42l56->beep, codec);
|
||||
cs42l56->beep->dev.parent = component->dev;
|
||||
input_set_drvdata(cs42l56->beep, component);
|
||||
|
||||
ret = input_register_device(cs42l56->beep);
|
||||
if (ret != 0) {
|
||||
cs42l56->beep = NULL;
|
||||
dev_err(codec->dev, "Failed to register beep device\n");
|
||||
dev_err(component->dev, "Failed to register beep device\n");
|
||||
}
|
||||
|
||||
ret = device_create_file(codec->dev, &dev_attr_beep);
|
||||
ret = device_create_file(component->dev, &dev_attr_beep);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to create keyclick file: %d\n",
|
||||
dev_err(component->dev, "Failed to create keyclick file: %d\n",
|
||||
ret);
|
||||
}
|
||||
}
|
||||
|
||||
static void cs42l56_free_beep(struct snd_soc_codec *codec)
|
||||
static void cs42l56_free_beep(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs42l56_private *cs42l56 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
device_remove_file(codec->dev, &dev_attr_beep);
|
||||
device_remove_file(component->dev, &dev_attr_beep);
|
||||
cancel_work_sync(&cs42l56->beep_work);
|
||||
cs42l56->beep = NULL;
|
||||
|
||||
snd_soc_update_bits(codec, CS42L56_BEEP_TONE_CFG,
|
||||
snd_soc_component_update_bits(component, CS42L56_BEEP_TONE_CFG,
|
||||
CS42L56_BEEP_EN_MASK, 0);
|
||||
}
|
||||
|
||||
static int cs42l56_probe(struct snd_soc_codec *codec)
|
||||
static int cs42l56_probe(struct snd_soc_component *component)
|
||||
{
|
||||
cs42l56_init_beep(codec);
|
||||
cs42l56_init_beep(component);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs42l56_remove(struct snd_soc_codec *codec)
|
||||
static void cs42l56_remove(struct snd_soc_component *component)
|
||||
{
|
||||
cs42l56_free_beep(codec);
|
||||
|
||||
return 0;
|
||||
cs42l56_free_beep(component);
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_cs42l56 = {
|
||||
.probe = cs42l56_probe,
|
||||
.remove = cs42l56_remove,
|
||||
.set_bias_level = cs42l56_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.controls = cs42l56_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs42l56_snd_controls),
|
||||
.dapm_widgets = cs42l56_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs42l56_dapm_widgets),
|
||||
.dapm_routes = cs42l56_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs42l56_audio_map),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_cs42l56 = {
|
||||
.probe = cs42l56_probe,
|
||||
.remove = cs42l56_remove,
|
||||
.set_bias_level = cs42l56_set_bias_level,
|
||||
.controls = cs42l56_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs42l56_snd_controls),
|
||||
.dapm_widgets = cs42l56_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs42l56_dapm_widgets),
|
||||
.dapm_routes = cs42l56_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs42l56_audio_map),
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct regmap_config cs42l56_regmap = {
|
||||
@ -1315,8 +1314,8 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,
|
||||
CS42L56_ADAPT_PWR_MASK,
|
||||
cs42l56->pdata.adaptive_pwr);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c_client->dev,
|
||||
&soc_codec_dev_cs42l56, &cs42l56_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c_client->dev,
|
||||
&soc_component_dev_cs42l56, &cs42l56_dai, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -1332,7 +1331,6 @@ static int cs42l56_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cs42l56_private *cs42l56 = i2c_get_clientdata(client);
|
||||
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
regulator_bulk_disable(ARRAY_SIZE(cs42l56->supplies),
|
||||
cs42l56->supplies);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user