Commit 4e8f557b authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/ssm2518', 'asoc/topic/ssm2602',...

Merge remote-tracking branches 'asoc/topic/ssm2518', 'asoc/topic/ssm2602', 'asoc/topic/ssm4567', 'asoc/topic/sta32x' and 'asoc/topic/sta350' into asoc-next
...@@ -336,8 +336,8 @@ static int ssm2518_lookup_mcs(struct ssm2518 *ssm2518, ...@@ -336,8 +336,8 @@ static int ssm2518_lookup_mcs(struct ssm2518 *ssm2518,
static int ssm2518_hw_params(struct snd_pcm_substream *substream, static int ssm2518_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(codec); struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(component);
unsigned int rate = params_rate(params); unsigned int rate = params_rate(params);
unsigned int ctrl1, ctrl1_mask; unsigned int ctrl1, ctrl1_mask;
int mcs; int mcs;
...@@ -391,7 +391,7 @@ static int ssm2518_hw_params(struct snd_pcm_substream *substream, ...@@ -391,7 +391,7 @@ static int ssm2518_hw_params(struct snd_pcm_substream *substream,
static int ssm2518_mute(struct snd_soc_dai *dai, int mute) static int ssm2518_mute(struct snd_soc_dai *dai, int mute)
{ {
struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(dai->codec); struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component);
unsigned int val; unsigned int val;
if (mute) if (mute)
...@@ -405,7 +405,7 @@ static int ssm2518_mute(struct snd_soc_dai *dai, int mute) ...@@ -405,7 +405,7 @@ static int ssm2518_mute(struct snd_soc_dai *dai, int mute)
static int ssm2518_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int ssm2518_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ {
struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(dai->codec); struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component);
unsigned int ctrl1 = 0, ctrl2 = 0; unsigned int ctrl1 = 0, ctrl2 = 0;
bool invert_fclk; bool invert_fclk;
int ret; int ret;
...@@ -498,10 +498,10 @@ static int ssm2518_set_power(struct ssm2518 *ssm2518, bool enable) ...@@ -498,10 +498,10 @@ static int ssm2518_set_power(struct ssm2518 *ssm2518, bool enable)
return ret; return ret;
} }
static int ssm2518_set_bias_level(struct snd_soc_codec *codec, static int ssm2518_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(codec); struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(component);
int ret = 0; int ret = 0;
switch (level) { switch (level) {
...@@ -510,7 +510,7 @@ static int ssm2518_set_bias_level(struct snd_soc_codec *codec, ...@@ -510,7 +510,7 @@ static int ssm2518_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
ret = ssm2518_set_power(ssm2518, true); ret = ssm2518_set_power(ssm2518, true);
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
...@@ -524,7 +524,7 @@ static int ssm2518_set_bias_level(struct snd_soc_codec *codec, ...@@ -524,7 +524,7 @@ static int ssm2518_set_bias_level(struct snd_soc_codec *codec,
static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int width) unsigned int rx_mask, int slots, int width)
{ {
struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(dai->codec); struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component);
unsigned int ctrl1, ctrl2; unsigned int ctrl1, ctrl2;
int left_slot, right_slot; int left_slot, right_slot;
int ret; int ret;
...@@ -609,7 +609,7 @@ static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, ...@@ -609,7 +609,7 @@ static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
static int ssm2518_startup(struct snd_pcm_substream *substream, static int ssm2518_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(dai->codec); struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component);
if (ssm2518->constraints) if (ssm2518->constraints)
snd_pcm_hw_constraint_list(substream->runtime, 0, snd_pcm_hw_constraint_list(substream->runtime, 0,
...@@ -641,10 +641,10 @@ static struct snd_soc_dai_driver ssm2518_dai = { ...@@ -641,10 +641,10 @@ static struct snd_soc_dai_driver ssm2518_dai = {
.ops = &ssm2518_dai_ops, .ops = &ssm2518_dai_ops,
}; };
static int ssm2518_set_sysclk(struct snd_soc_codec *codec, int clk_id, static int ssm2518_set_sysclk(struct snd_soc_component *component, int clk_id,
int source, unsigned int freq, int dir) int source, unsigned int freq, int dir)
{ {
struct ssm2518 *ssm2518 = snd_soc_codec_get_drvdata(codec); struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(component);
unsigned int val; unsigned int val;
if (clk_id != SSM2518_SYSCLK) if (clk_id != SSM2518_SYSCLK)
...@@ -710,19 +710,18 @@ static int ssm2518_set_sysclk(struct snd_soc_codec *codec, int clk_id, ...@@ -710,19 +710,18 @@ static int ssm2518_set_sysclk(struct snd_soc_codec *codec, int clk_id,
SSM2518_POWER1_NO_BCLK, val); SSM2518_POWER1_NO_BCLK, val);
} }
static const struct snd_soc_codec_driver ssm2518_codec_driver = { static const struct snd_soc_component_driver ssm2518_component_driver = {
.set_bias_level = ssm2518_set_bias_level, .set_bias_level = ssm2518_set_bias_level,
.set_sysclk = ssm2518_set_sysclk, .set_sysclk = ssm2518_set_sysclk,
.idle_bias_off = true,
.component_driver = {
.controls = ssm2518_snd_controls, .controls = ssm2518_snd_controls,
.num_controls = ARRAY_SIZE(ssm2518_snd_controls), .num_controls = ARRAY_SIZE(ssm2518_snd_controls),
.dapm_widgets = ssm2518_dapm_widgets, .dapm_widgets = ssm2518_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(ssm2518_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(ssm2518_dapm_widgets),
.dapm_routes = ssm2518_routes, .dapm_routes = ssm2518_routes,
.num_dapm_routes = ARRAY_SIZE(ssm2518_routes), .num_dapm_routes = ARRAY_SIZE(ssm2518_routes),
}, .use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct regmap_config ssm2518_regmap_config = { static const struct regmap_config ssm2518_regmap_config = {
...@@ -792,16 +791,11 @@ static int ssm2518_i2c_probe(struct i2c_client *i2c, ...@@ -792,16 +791,11 @@ static int ssm2518_i2c_probe(struct i2c_client *i2c,
if (ret) if (ret)
return ret; return ret;
return snd_soc_register_codec(&i2c->dev, &ssm2518_codec_driver, return devm_snd_soc_register_component(&i2c->dev,
&ssm2518_component_driver,
&ssm2518_dai, 1); &ssm2518_dai, 1);
} }
static int ssm2518_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
#ifdef CONFIG_OF #ifdef CONFIG_OF
static const struct of_device_id ssm2518_dt_ids[] = { static const struct of_device_id ssm2518_dt_ids[] = {
{ .compatible = "adi,ssm2518", }, { .compatible = "adi,ssm2518", },
...@@ -822,7 +816,6 @@ static struct i2c_driver ssm2518_driver = { ...@@ -822,7 +816,6 @@ static struct i2c_driver ssm2518_driver = {
.of_match_table = of_match_ptr(ssm2518_dt_ids), .of_match_table = of_match_ptr(ssm2518_dt_ids),
}, },
.probe = ssm2518_i2c_probe, .probe = ssm2518_i2c_probe,
.remove = ssm2518_i2c_remove,
.id_table = ssm2518_i2c_ids, .id_table = ssm2518_i2c_ids,
}; };
module_i2c_driver(ssm2518_driver); module_i2c_driver(ssm2518_driver);
......
...@@ -27,12 +27,6 @@ static int ssm2602_i2c_probe(struct i2c_client *client, ...@@ -27,12 +27,6 @@ static int ssm2602_i2c_probe(struct i2c_client *client,
devm_regmap_init_i2c(client, &ssm2602_regmap_config)); devm_regmap_init_i2c(client, &ssm2602_regmap_config));
} }
static int ssm2602_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id ssm2602_i2c_id[] = { static const struct i2c_device_id ssm2602_i2c_id[] = {
{ "ssm2602", SSM2602 }, { "ssm2602", SSM2602 },
{ "ssm2603", SSM2602 }, { "ssm2603", SSM2602 },
...@@ -55,7 +49,6 @@ static struct i2c_driver ssm2602_i2c_driver = { ...@@ -55,7 +49,6 @@ static struct i2c_driver ssm2602_i2c_driver = {
.of_match_table = ssm2602_of_match, .of_match_table = ssm2602_of_match,
}, },
.probe = ssm2602_i2c_probe, .probe = ssm2602_i2c_probe,
.remove = ssm2602_i2c_remove,
.id_table = ssm2602_i2c_id, .id_table = ssm2602_i2c_id,
}; };
module_i2c_driver(ssm2602_i2c_driver); module_i2c_driver(ssm2602_i2c_driver);
......
...@@ -20,12 +20,6 @@ static int ssm2602_spi_probe(struct spi_device *spi) ...@@ -20,12 +20,6 @@ static int ssm2602_spi_probe(struct spi_device *spi)
devm_regmap_init_spi(spi, &ssm2602_regmap_config)); devm_regmap_init_spi(spi, &ssm2602_regmap_config));
} }
static int ssm2602_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
return 0;
}
static const struct of_device_id ssm2602_of_match[] = { static const struct of_device_id ssm2602_of_match[] = {
{ .compatible = "adi,ssm2602", }, { .compatible = "adi,ssm2602", },
{ } { }
...@@ -38,7 +32,6 @@ static struct spi_driver ssm2602_spi_driver = { ...@@ -38,7 +32,6 @@ static struct spi_driver ssm2602_spi_driver = {
.of_match_table = ssm2602_of_match, .of_match_table = ssm2602_of_match,
}, },
.probe = ssm2602_spi_probe, .probe = ssm2602_spi_probe,
.remove = ssm2602_spi_remove,
}; };
module_spi_driver(ssm2602_spi_driver); module_spi_driver(ssm2602_spi_driver);
......
...@@ -280,8 +280,8 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream, ...@@ -280,8 +280,8 @@ static int ssm2602_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 ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
int srate = ssm2602_get_coeff(ssm2602->sysclk, params_rate(params)); int srate = ssm2602_get_coeff(ssm2602->sysclk, params_rate(params));
unsigned int iface; unsigned int iface;
...@@ -315,8 +315,8 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream, ...@@ -315,8 +315,8 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
static int ssm2602_startup(struct snd_pcm_substream *substream, static int ssm2602_startup(struct snd_pcm_substream *substream,
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 ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
if (ssm2602->sysclk_constraints) { if (ssm2602->sysclk_constraints) {
snd_pcm_hw_constraint_list(substream->runtime, 0, snd_pcm_hw_constraint_list(substream->runtime, 0,
...@@ -329,7 +329,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream, ...@@ -329,7 +329,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
static int ssm2602_mute(struct snd_soc_dai *dai, int mute) static int ssm2602_mute(struct snd_soc_dai *dai, int mute)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(dai->codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(dai->component);
if (mute) if (mute)
regmap_update_bits(ssm2602->regmap, SSM2602_APDIGI, regmap_update_bits(ssm2602->regmap, SSM2602_APDIGI,
...@@ -344,8 +344,8 @@ static int ssm2602_mute(struct snd_soc_dai *dai, int mute) ...@@ -344,8 +344,8 @@ static int ssm2602_mute(struct snd_soc_dai *dai, int mute)
static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int ssm2602_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 ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
if (dir == SND_SOC_CLOCK_IN) { if (dir == SND_SOC_CLOCK_IN) {
if (clk_id != SSM2602_SYSCLK) if (clk_id != SSM2602_SYSCLK)
...@@ -396,7 +396,7 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai, ...@@ -396,7 +396,7 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai, static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt) unsigned int fmt)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec_dai->codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(codec_dai->component);
unsigned int iface = 0; unsigned int iface = 0;
/* set master/slave audio interface */ /* set master/slave audio interface */
...@@ -452,10 +452,10 @@ static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -452,10 +452,10 @@ static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai,
return 0; return 0;
} }
static int ssm2602_set_bias_level(struct snd_soc_codec *codec, static int ssm2602_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
...@@ -518,19 +518,19 @@ static struct snd_soc_dai_driver ssm2602_dai = { ...@@ -518,19 +518,19 @@ static struct snd_soc_dai_driver ssm2602_dai = {
.symmetric_samplebits = 1, .symmetric_samplebits = 1,
}; };
static int ssm2602_resume(struct snd_soc_codec *codec) static int ssm2602_resume(struct snd_soc_component *component)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
regcache_sync(ssm2602->regmap); regcache_sync(ssm2602->regmap);
return 0; return 0;
} }
static int ssm2602_codec_probe(struct snd_soc_codec *codec) static int ssm2602_component_probe(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
int ret; int ret;
regmap_update_bits(ssm2602->regmap, SSM2602_LOUT1V, regmap_update_bits(ssm2602->regmap, SSM2602_LOUT1V,
...@@ -538,7 +538,7 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec) ...@@ -538,7 +538,7 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec)
regmap_update_bits(ssm2602->regmap, SSM2602_ROUT1V, regmap_update_bits(ssm2602->regmap, SSM2602_ROUT1V,
ROUT1V_RLHP_BOTH, ROUT1V_RLHP_BOTH); ROUT1V_RLHP_BOTH, ROUT1V_RLHP_BOTH);
ret = snd_soc_add_codec_controls(codec, ssm2602_snd_controls, ret = snd_soc_add_component_controls(component, ssm2602_snd_controls,
ARRAY_SIZE(ssm2602_snd_controls)); ARRAY_SIZE(ssm2602_snd_controls));
if (ret) if (ret)
return ret; return ret;
...@@ -552,9 +552,9 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec) ...@@ -552,9 +552,9 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec)
ARRAY_SIZE(ssm2602_routes)); ARRAY_SIZE(ssm2602_routes));
} }
static int ssm2604_codec_probe(struct snd_soc_codec *codec) static int ssm2604_component_probe(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
int ret; int ret;
ret = snd_soc_dapm_new_controls(dapm, ssm2604_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, ssm2604_dapm_widgets,
...@@ -566,14 +566,14 @@ static int ssm2604_codec_probe(struct snd_soc_codec *codec) ...@@ -566,14 +566,14 @@ static int ssm2604_codec_probe(struct snd_soc_codec *codec)
ARRAY_SIZE(ssm2604_routes)); ARRAY_SIZE(ssm2604_routes));
} }
static int ssm260x_codec_probe(struct snd_soc_codec *codec) static int ssm260x_component_probe(struct snd_soc_component *component)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0); ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Failed to issue reset: %d\n", ret); dev_err(component->dev, "Failed to issue reset: %d\n", ret);
return ret; return ret;
} }
...@@ -588,30 +588,31 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec) ...@@ -588,30 +588,31 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec)
switch (ssm2602->type) { switch (ssm2602->type) {
case SSM2602: case SSM2602:
ret = ssm2602_codec_probe(codec); ret = ssm2602_component_probe(component);
break; break;
case SSM2604: case SSM2604:
ret = ssm2604_codec_probe(codec); ret = ssm2604_component_probe(component);
break; break;
} }
return ret; return ret;
} }
static const struct snd_soc_codec_driver soc_codec_dev_ssm2602 = { static const struct snd_soc_component_driver soc_component_dev_ssm2602 = {
.probe = ssm260x_codec_probe, .probe = ssm260x_component_probe,
.resume = ssm2602_resume, .resume = ssm2602_resume,
.set_bias_level = ssm2602_set_bias_level, .set_bias_level = ssm2602_set_bias_level,
.suspend_bias_off = true,
.component_driver = {
.controls = ssm260x_snd_controls, .controls = ssm260x_snd_controls,
.num_controls = ARRAY_SIZE(ssm260x_snd_controls), .num_controls = ARRAY_SIZE(ssm260x_snd_controls),
.dapm_widgets = ssm260x_dapm_widgets, .dapm_widgets = ssm260x_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(ssm260x_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(ssm260x_dapm_widgets),
.dapm_routes = ssm260x_routes, .dapm_routes = ssm260x_routes,
.num_dapm_routes = ARRAY_SIZE(ssm260x_routes), .num_dapm_routes = ARRAY_SIZE(ssm260x_routes),
}, .suspend_bias_off = 1,
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static bool ssm2602_register_volatile(struct device *dev, unsigned int reg) static bool ssm2602_register_volatile(struct device *dev, unsigned int reg)
...@@ -648,7 +649,7 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type, ...@@ -648,7 +649,7 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type,
ssm2602->type = type; ssm2602->type = type;
ssm2602->regmap = regmap; ssm2602->regmap = regmap;
return snd_soc_register_codec(dev, &soc_codec_dev_ssm2602, return devm_snd_soc_register_component(dev, &soc_component_dev_ssm2602,
&ssm2602_dai, 1); &ssm2602_dai, 1);
} }
EXPORT_SYMBOL_GPL(ssm2602_probe); EXPORT_SYMBOL_GPL(ssm2602_probe);
......
...@@ -199,8 +199,8 @@ static const struct snd_soc_dapm_route ssm4567_routes[] = { ...@@ -199,8 +199,8 @@ static const struct snd_soc_dapm_route ssm4567_routes[] = {
static int ssm4567_hw_params(struct snd_pcm_substream *substream, static int ssm4567_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct ssm4567 *ssm4567 = snd_soc_codec_get_drvdata(codec); struct ssm4567 *ssm4567 = snd_soc_component_get_drvdata(component);
unsigned int rate = params_rate(params); unsigned int rate = params_rate(params);
unsigned int dacfs; unsigned int dacfs;
...@@ -223,7 +223,7 @@ static int ssm4567_hw_params(struct snd_pcm_substream *substream, ...@@ -223,7 +223,7 @@ static int ssm4567_hw_params(struct snd_pcm_substream *substream,
static int ssm4567_mute(struct snd_soc_dai *dai, int mute) static int ssm4567_mute(struct snd_soc_dai *dai, int mute)
{ {
struct ssm4567 *ssm4567 = snd_soc_codec_get_drvdata(dai->codec); struct ssm4567 *ssm4567 = snd_soc_component_get_drvdata(dai->component);
unsigned int val; unsigned int val;
val = mute ? SSM4567_DAC_MUTE : 0; val = mute ? SSM4567_DAC_MUTE : 0;
...@@ -366,10 +366,10 @@ static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable) ...@@ -366,10 +366,10 @@ static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable)
return ret; return ret;
} }
static int ssm4567_set_bias_level(struct snd_soc_codec *codec, static int ssm4567_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct ssm4567 *ssm4567 = snd_soc_codec_get_drvdata(codec); struct ssm4567 *ssm4567 = snd_soc_component_get_drvdata(component);
int ret = 0; int ret = 0;
switch (level) { switch (level) {
...@@ -378,7 +378,7 @@ static int ssm4567_set_bias_level(struct snd_soc_codec *codec, ...@@ -378,7 +378,7 @@ static int ssm4567_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
ret = ssm4567_set_power(ssm4567, true); ret = ssm4567_set_power(ssm4567, true);
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
...@@ -417,18 +417,17 @@ static struct snd_soc_dai_driver ssm4567_dai = { ...@@ -417,18 +417,17 @@ static struct snd_soc_dai_driver ssm4567_dai = {
.ops = &ssm4567_dai_ops, .ops = &ssm4567_dai_ops,
}; };
static const struct snd_soc_codec_driver ssm4567_codec_driver = { static const struct snd_soc_component_driver ssm4567_component_driver = {
.set_bias_level = ssm4567_set_bias_level, .set_bias_level = ssm4567_set_bias_level,
.idle_bias_off = true,
.component_driver = {
.controls = ssm4567_snd_controls, .controls = ssm4567_snd_controls,
.num_controls = ARRAY_SIZE(ssm4567_snd_controls), .num_controls = ARRAY_SIZE(ssm4567_snd_controls),
.dapm_widgets = ssm4567_dapm_widgets, .dapm_widgets = ssm4567_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(ssm4567_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(ssm4567_dapm_widgets),
.dapm_routes = ssm4567_routes, .dapm_routes = ssm4567_routes,
.num_dapm_routes = ARRAY_SIZE(ssm4567_routes), .num_dapm_routes = ARRAY_SIZE(ssm4567_routes),
}, .use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct regmap_config ssm4567_regmap_config = { static const struct regmap_config ssm4567_regmap_config = {
...@@ -469,16 +468,10 @@ static int ssm4567_i2c_probe(struct i2c_client *i2c, ...@@ -469,16 +468,10 @@ static int ssm4567_i2c_probe(struct i2c_client *i2c,
if (ret) if (ret)
return ret; return ret;
return snd_soc_register_codec(&i2c->dev, &ssm4567_codec_driver, return devm_snd_soc_register_component(&i2c->dev, &ssm4567_component_driver,
&ssm4567_dai, 1); &ssm4567_dai, 1);
} }
static int ssm4567_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id ssm4567_i2c_ids[] = { static const struct i2c_device_id ssm4567_i2c_ids[] = {
{ "ssm4567", 0 }, { "ssm4567", 0 },
{ } { }
...@@ -510,7 +503,6 @@ static struct i2c_driver ssm4567_driver = { ...@@ -510,7 +503,6 @@ static struct i2c_driver ssm4567_driver = {
.acpi_match_table = ACPI_PTR(ssm4567_acpi_match), .acpi_match_table = ACPI_PTR(ssm4567_acpi_match),
}, },
.probe = ssm4567_i2c_probe, .probe = ssm4567_i2c_probe,
.remove = ssm4567_i2c_remove,
.id_table = ssm4567_i2c_ids, .id_table = ssm4567_i2c_ids,
}; };
module_i2c_driver(ssm4567_driver); module_i2c_driver(ssm4567_driver);
......
...@@ -143,7 +143,7 @@ static const char *sta32x_supply_names[] = { ...@@ -143,7 +143,7 @@ static const char *sta32x_supply_names[] = {
struct sta32x_priv { struct sta32x_priv {
struct regmap *regmap; struct regmap *regmap;
struct regulator_bulk_data supplies[ARRAY_SIZE(sta32x_supply_names)]; struct regulator_bulk_data supplies[ARRAY_SIZE(sta32x_supply_names)];
struct snd_soc_codec *codec; struct snd_soc_component *component;
struct sta32x_platform_data *pdata; struct sta32x_platform_data *pdata;
unsigned int mclk; unsigned int mclk;
...@@ -270,8 +270,8 @@ static int sta32x_coefficient_info(struct snd_kcontrol *kcontrol, ...@@ -270,8 +270,8 @@ static int sta32x_coefficient_info(struct snd_kcontrol *kcontrol,
static int sta32x_coefficient_get(struct snd_kcontrol *kcontrol, static int sta32x_coefficient_get(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 sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
int numcoef = kcontrol->private_value >> 16; int numcoef = kcontrol->private_value >> 16;
int index = kcontrol->private_value & 0xffff; int index = kcontrol->private_value & 0xffff;
unsigned int cfud, val; unsigned int cfud, val;
...@@ -312,8 +312,8 @@ static int sta32x_coefficient_get(struct snd_kcontrol *kcontrol, ...@@ -312,8 +312,8 @@ static int sta32x_coefficient_get(struct snd_kcontrol *kcontrol,
static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol, static int sta32x_coefficient_put(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 sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
int numcoef = kcontrol->private_value >> 16; int numcoef = kcontrol->private_value >> 16;
int index = kcontrol->private_value & 0xffff; int index = kcontrol->private_value & 0xffff;
unsigned int cfud; unsigned int cfud;
...@@ -347,9 +347,9 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol, ...@@ -347,9 +347,9 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol,
return 0; return 0;
} }
static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) static int sta32x_sync_coef_shadow(struct snd_soc_component *component)
{ {
struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
unsigned int cfud; unsigned int cfud;
int i; int i;
...@@ -375,16 +375,16 @@ static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) ...@@ -375,16 +375,16 @@ static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int sta32x_cache_sync(struct snd_soc_codec *codec) static int sta32x_cache_sync(struct snd_soc_component *component)
{ {
struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
unsigned int mute; unsigned int mute;
int rc; int rc;
/* mute during register sync */ /* mute during register sync */
regmap_read(sta32x->regmap, STA32X_MMUTE, &mute); regmap_read(sta32x->regmap, STA32X_MMUTE, &mute);
regmap_write(sta32x->regmap, STA32X_MMUTE, mute | STA32X_MMUTE_MMUTE); regmap_write(sta32x->regmap, STA32X_MMUTE, mute | STA32X_MMUTE_MMUTE);
sta32x_sync_coef_shadow(codec); sta32x_sync_coef_shadow(component);
rc = regcache_sync(sta32x->regmap); rc = regcache_sync(sta32x->regmap);
regmap_write(sta32x->regmap, STA32X_MMUTE, mute); regmap_write(sta32x->regmap, STA32X_MMUTE, mute);
return rc; return rc;
...@@ -395,17 +395,17 @@ static void sta32x_watchdog(struct work_struct *work) ...@@ -395,17 +395,17 @@ static void sta32x_watchdog(struct work_struct *work)
{ {
struct sta32x_priv *sta32x = container_of(work, struct sta32x_priv, struct sta32x_priv *sta32x = container_of(work, struct sta32x_priv,
watchdog_work.work); watchdog_work.work);
struct snd_soc_codec *codec = sta32x->codec; struct snd_soc_component *component = sta32x->component;
unsigned int confa, confa_cached; unsigned int confa, confa_cached;
/* check if sta32x has reset itself */ /* check if sta32x has reset itself */
confa_cached = snd_soc_read(codec, STA32X_CONFA); confa_cached = snd_soc_component_read32(component, STA32X_CONFA);
regcache_cache_bypass(sta32x->regmap, true); regcache_cache_bypass(sta32x->regmap, true);
confa = snd_soc_read(codec, STA32X_CONFA); confa = snd_soc_component_read32(component, STA32X_CONFA);
regcache_cache_bypass(sta32x->regmap, false); regcache_cache_bypass(sta32x->regmap, false);
if (confa != confa_cached) { if (confa != confa_cached) {
regcache_mark_dirty(sta32x->regmap); regcache_mark_dirty(sta32x->regmap);
sta32x_cache_sync(codec); sta32x_cache_sync(component);
} }
if (!sta32x->shutdown) if (!sta32x->shutdown)
...@@ -582,10 +582,10 @@ static int mcs_ratio_table[3][7] = { ...@@ -582,10 +582,10 @@ static int mcs_ratio_table[3][7] = {
static int sta32x_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int sta32x_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 sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
dev_dbg(codec->dev, "mclk=%u\n", freq); dev_dbg(component->dev, "mclk=%u\n", freq);
sta32x->mclk = freq; sta32x->mclk = freq;
return 0; return 0;
...@@ -602,8 +602,8 @@ static int sta32x_set_dai_sysclk(struct snd_soc_dai *codec_dai, ...@@ -602,8 +602,8 @@ static int sta32x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int sta32x_set_dai_fmt(struct snd_soc_dai *codec_dai, static int sta32x_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt) unsigned int fmt)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
u8 confb = 0; u8 confb = 0;
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
...@@ -651,22 +651,22 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -651,22 +651,22 @@ static int sta32x_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 sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
int i, mcs = -EINVAL, ir = -EINVAL; int i, mcs = -EINVAL, ir = -EINVAL;
unsigned int confa, confb; unsigned int confa, confb;
unsigned int rate, ratio; unsigned int rate, ratio;
int ret; int ret;
if (!sta32x->mclk) { if (!sta32x->mclk) {
dev_err(codec->dev, dev_err(component->dev,
"sta32x->mclk is unset. Unable to determine ratio\n"); "sta32x->mclk is unset. Unable to determine ratio\n");
return -EIO; return -EIO;
} }
rate = params_rate(params); rate = params_rate(params);
ratio = sta32x->mclk / rate; ratio = sta32x->mclk / rate;
dev_dbg(codec->dev, "rate: %u, ratio: %u\n", rate, ratio); dev_dbg(component->dev, "rate: %u, ratio: %u\n", rate, ratio);
for (i = 0; i < ARRAY_SIZE(interpolation_ratios); i++) { for (i = 0; i < ARRAY_SIZE(interpolation_ratios); i++) {
if (interpolation_ratios[i].fs == rate) { if (interpolation_ratios[i].fs == rate) {
...@@ -676,7 +676,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -676,7 +676,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
} }
if (ir < 0) { if (ir < 0) {
dev_err(codec->dev, "Unsupported samplerate: %u\n", rate); dev_err(component->dev, "Unsupported samplerate: %u\n", rate);
return -EINVAL; return -EINVAL;
} }
...@@ -688,7 +688,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -688,7 +688,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
} }
if (mcs < 0) { if (mcs < 0) {
dev_err(codec->dev, "Unresolvable ratio: %u\n", ratio); dev_err(component->dev, "Unresolvable ratio: %u\n", ratio);
return -EINVAL; return -EINVAL;
} }
...@@ -698,10 +698,10 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -698,10 +698,10 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
switch (params_width(params)) { switch (params_width(params)) {
case 24: case 24:
dev_dbg(codec->dev, "24bit\n"); dev_dbg(component->dev, "24bit\n");
/* fall through */ /* fall through */
case 32: case 32:
dev_dbg(codec->dev, "24bit or 32bit\n"); dev_dbg(component->dev, "24bit or 32bit\n");
switch (sta32x->format) { switch (sta32x->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
confb |= 0x0; confb |= 0x0;
...@@ -716,7 +716,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -716,7 +716,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
break; break;
case 20: case 20:
dev_dbg(codec->dev, "20bit\n"); dev_dbg(component->dev, "20bit\n");
switch (sta32x->format) { switch (sta32x->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
confb |= 0x4; confb |= 0x4;
...@@ -731,7 +731,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -731,7 +731,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
break; break;
case 18: case 18:
dev_dbg(codec->dev, "18bit\n"); dev_dbg(component->dev, "18bit\n");
switch (sta32x->format) { switch (sta32x->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
confb |= 0x8; confb |= 0x8;
...@@ -746,7 +746,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -746,7 +746,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
break; break;
case 16: case 16:
dev_dbg(codec->dev, "16bit\n"); dev_dbg(component->dev, "16bit\n");
switch (sta32x->format) { switch (sta32x->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
confb |= 0x0; confb |= 0x0;
...@@ -793,20 +793,20 @@ static int sta32x_startup_sequence(struct sta32x_priv *sta32x) ...@@ -793,20 +793,20 @@ static int sta32x_startup_sequence(struct sta32x_priv *sta32x)
/** /**
* sta32x_set_bias_level - DAPM callback * sta32x_set_bias_level - DAPM callback
* @codec: the codec device * @component: the component device
* @level: DAPM power level * @level: DAPM power level
* *
* This is called by ALSA to put the codec into low power mode * This is called by ALSA to put the component into low power mode
* or to wake it up. If the codec is powered off completely * or to wake it up. If the component is powered off completely
* all registers must be restored after power on. * all registers must be restored after power on.
*/ */
static int sta32x_set_bias_level(struct snd_soc_codec *codec, static int sta32x_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
int ret; int ret;
struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
dev_dbg(codec->dev, "level = %d\n", level); dev_dbg(component->dev, "level = %d\n", level);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
break; break;
...@@ -819,17 +819,17 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec, ...@@ -819,17 +819,17 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(sta32x->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(sta32x->supplies),
sta32x->supplies); sta32x->supplies);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to enable supplies: %d\n", ret); "Failed to enable supplies: %d\n", ret);
return ret; return ret;
} }
sta32x_startup_sequence(sta32x); sta32x_startup_sequence(sta32x);
sta32x_cache_sync(codec); sta32x_cache_sync(component);
sta32x_watchdog_start(sta32x); sta32x_watchdog_start(sta32x);
} }
...@@ -874,21 +874,21 @@ static struct snd_soc_dai_driver sta32x_dai = { ...@@ -874,21 +874,21 @@ static struct snd_soc_dai_driver sta32x_dai = {
.ops = &sta32x_dai_ops, .ops = &sta32x_dai_ops,
}; };
static int sta32x_probe(struct snd_soc_codec *codec) static int sta32x_probe(struct snd_soc_component *component)
{ {
struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
struct sta32x_platform_data *pdata = sta32x->pdata; struct sta32x_platform_data *pdata = sta32x->pdata;
int i, ret = 0, thermal = 0; int i, ret = 0, thermal = 0;
ret = regulator_bulk_enable(ARRAY_SIZE(sta32x->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(sta32x->supplies),
sta32x->supplies); sta32x->supplies);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); dev_err(component->dev, "Failed to enable supplies: %d\n", ret);
return ret; return ret;
} }
ret = sta32x_startup_sequence(sta32x); ret = sta32x_startup_sequence(sta32x);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Failed to startup device\n"); dev_err(component->dev, "Failed to startup device\n");
return ret; return ret;
} }
...@@ -968,36 +968,36 @@ static int sta32x_probe(struct snd_soc_codec *codec) ...@@ -968,36 +968,36 @@ static int sta32x_probe(struct snd_soc_codec *codec)
if (sta32x->pdata->needs_esd_watchdog) if (sta32x->pdata->needs_esd_watchdog)
INIT_DELAYED_WORK(&sta32x->watchdog_work, sta32x_watchdog); INIT_DELAYED_WORK(&sta32x->watchdog_work, sta32x_watchdog);
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
/* Bias level configuration will have done an extra enable */ /* Bias level configuration will have done an extra enable */
regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
return 0; return 0;
} }
static int sta32x_remove(struct snd_soc_codec *codec) static void sta32x_remove(struct snd_soc_component *component)
{ {
struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
sta32x_watchdog_stop(sta32x); sta32x_watchdog_stop(sta32x);
regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
return 0;
} }
static const struct snd_soc_codec_driver sta32x_codec = { static const struct snd_soc_component_driver sta32x_component = {
.probe = sta32x_probe, .probe = sta32x_probe,
.remove = sta32x_remove, .remove = sta32x_remove,
.set_bias_level = sta32x_set_bias_level, .set_bias_level = sta32x_set_bias_level,
.suspend_bias_off = true,
.component_driver = {
.controls = sta32x_snd_controls, .controls = sta32x_snd_controls,
.num_controls = ARRAY_SIZE(sta32x_snd_controls), .num_controls = ARRAY_SIZE(sta32x_snd_controls),
.dapm_widgets = sta32x_dapm_widgets, .dapm_widgets = sta32x_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(sta32x_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(sta32x_dapm_widgets),
.dapm_routes = sta32x_dapm_routes, .dapm_routes = sta32x_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(sta32x_dapm_routes), .num_dapm_routes = ARRAY_SIZE(sta32x_dapm_routes),
}, .suspend_bias_off = 1,
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct regmap_config sta32x_regmap = { static const struct regmap_config sta32x_regmap = {
...@@ -1121,19 +1121,14 @@ static int sta32x_i2c_probe(struct i2c_client *i2c, ...@@ -1121,19 +1121,14 @@ static int sta32x_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, sta32x); i2c_set_clientdata(i2c, sta32x);
ret = snd_soc_register_codec(dev, &sta32x_codec, &sta32x_dai, 1); ret = devm_snd_soc_register_component(dev, &sta32x_component,
&sta32x_dai, 1);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to register codec (%d)\n", ret); dev_err(dev, "Failed to register component (%d)\n", ret);
return ret; return ret;
} }
static int sta32x_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id sta32x_i2c_id[] = { static const struct i2c_device_id sta32x_i2c_id[] = {
{ "sta326", 0 }, { "sta326", 0 },
{ "sta328", 0 }, { "sta328", 0 },
...@@ -1148,7 +1143,6 @@ static struct i2c_driver sta32x_i2c_driver = { ...@@ -1148,7 +1143,6 @@ static struct i2c_driver sta32x_i2c_driver = {
.of_match_table = of_match_ptr(st32x_dt_ids), .of_match_table = of_match_ptr(st32x_dt_ids),
}, },
.probe = sta32x_i2c_probe, .probe = sta32x_i2c_probe,
.remove = sta32x_i2c_remove,
.id_table = sta32x_i2c_id, .id_table = sta32x_i2c_id,
}; };
......
...@@ -309,8 +309,8 @@ static int sta350_coefficient_info(struct snd_kcontrol *kcontrol, ...@@ -309,8 +309,8 @@ static int sta350_coefficient_info(struct snd_kcontrol *kcontrol,
static int sta350_coefficient_get(struct snd_kcontrol *kcontrol, static int sta350_coefficient_get(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 sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
int numcoef = kcontrol->private_value >> 16; int numcoef = kcontrol->private_value >> 16;
int index = kcontrol->private_value & 0xffff; int index = kcontrol->private_value & 0xffff;
unsigned int cfud, val; unsigned int cfud, val;
...@@ -351,8 +351,8 @@ static int sta350_coefficient_get(struct snd_kcontrol *kcontrol, ...@@ -351,8 +351,8 @@ static int sta350_coefficient_get(struct snd_kcontrol *kcontrol,
static int sta350_coefficient_put(struct snd_kcontrol *kcontrol, static int sta350_coefficient_put(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 sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
int numcoef = kcontrol->private_value >> 16; int numcoef = kcontrol->private_value >> 16;
int index = kcontrol->private_value & 0xffff; int index = kcontrol->private_value & 0xffff;
unsigned int cfud; unsigned int cfud;
...@@ -386,9 +386,9 @@ static int sta350_coefficient_put(struct snd_kcontrol *kcontrol, ...@@ -386,9 +386,9 @@ static int sta350_coefficient_put(struct snd_kcontrol *kcontrol,
return 0; return 0;
} }
static int sta350_sync_coef_shadow(struct snd_soc_codec *codec) static int sta350_sync_coef_shadow(struct snd_soc_component *component)
{ {
struct sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
unsigned int cfud; unsigned int cfud;
int i; int i;
...@@ -414,16 +414,16 @@ static int sta350_sync_coef_shadow(struct snd_soc_codec *codec) ...@@ -414,16 +414,16 @@ static int sta350_sync_coef_shadow(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int sta350_cache_sync(struct snd_soc_codec *codec) static int sta350_cache_sync(struct snd_soc_component *component)
{ {
struct sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
unsigned int mute; unsigned int mute;
int rc; int rc;
/* mute during register sync */ /* mute during register sync */
regmap_read(sta350->regmap, STA350_CFUD, &mute); regmap_read(sta350->regmap, STA350_CFUD, &mute);
regmap_write(sta350->regmap, STA350_MMUTE, mute | STA350_MMUTE_MMUTE); regmap_write(sta350->regmap, STA350_MMUTE, mute | STA350_MMUTE_MMUTE);
sta350_sync_coef_shadow(codec); sta350_sync_coef_shadow(component);
rc = regcache_sync(sta350->regmap); rc = regcache_sync(sta350->regmap);
regmap_write(sta350->regmap, STA350_MMUTE, mute); regmap_write(sta350->regmap, STA350_MMUTE, mute);
return rc; return rc;
...@@ -613,10 +613,10 @@ static int mcs_ratio_table[3][6] = { ...@@ -613,10 +613,10 @@ static int mcs_ratio_table[3][6] = {
static int sta350_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int sta350_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 sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
dev_dbg(codec->dev, "mclk=%u\n", freq); dev_dbg(component->dev, "mclk=%u\n", freq);
sta350->mclk = freq; sta350->mclk = freq;
return 0; return 0;
...@@ -633,8 +633,8 @@ static int sta350_set_dai_sysclk(struct snd_soc_dai *codec_dai, ...@@ -633,8 +633,8 @@ static int sta350_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int sta350_set_dai_fmt(struct snd_soc_dai *codec_dai, static int sta350_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt) unsigned int fmt)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
unsigned int confb = 0; unsigned int confb = 0;
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
...@@ -682,22 +682,22 @@ static int sta350_hw_params(struct snd_pcm_substream *substream, ...@@ -682,22 +682,22 @@ static int sta350_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 sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
int i, mcs = -EINVAL, ir = -EINVAL; int i, mcs = -EINVAL, ir = -EINVAL;
unsigned int confa, confb; unsigned int confa, confb;
unsigned int rate, ratio; unsigned int rate, ratio;
int ret; int ret;
if (!sta350->mclk) { if (!sta350->mclk) {
dev_err(codec->dev, dev_err(component->dev,
"sta350->mclk is unset. Unable to determine ratio\n"); "sta350->mclk is unset. Unable to determine ratio\n");
return -EIO; return -EIO;
} }
rate = params_rate(params); rate = params_rate(params);
ratio = sta350->mclk / rate; ratio = sta350->mclk / rate;
dev_dbg(codec->dev, "rate: %u, ratio: %u\n", rate, ratio); dev_dbg(component->dev, "rate: %u, ratio: %u\n", rate, ratio);
for (i = 0; i < ARRAY_SIZE(interpolation_ratios); i++) { for (i = 0; i < ARRAY_SIZE(interpolation_ratios); i++) {
if (interpolation_ratios[i].fs == rate) { if (interpolation_ratios[i].fs == rate) {
...@@ -707,7 +707,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream, ...@@ -707,7 +707,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream,
} }
if (ir < 0) { if (ir < 0) {
dev_err(codec->dev, "Unsupported samplerate: %u\n", rate); dev_err(component->dev, "Unsupported samplerate: %u\n", rate);
return -EINVAL; return -EINVAL;
} }
...@@ -719,7 +719,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream, ...@@ -719,7 +719,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream,
} }
if (mcs < 0) { if (mcs < 0) {
dev_err(codec->dev, "Unresolvable ratio: %u\n", ratio); dev_err(component->dev, "Unresolvable ratio: %u\n", ratio);
return -EINVAL; return -EINVAL;
} }
...@@ -729,10 +729,10 @@ static int sta350_hw_params(struct snd_pcm_substream *substream, ...@@ -729,10 +729,10 @@ static int sta350_hw_params(struct snd_pcm_substream *substream,
switch (params_width(params)) { switch (params_width(params)) {
case 24: case 24:
dev_dbg(codec->dev, "24bit\n"); dev_dbg(component->dev, "24bit\n");
/* fall through */ /* fall through */
case 32: case 32:
dev_dbg(codec->dev, "24bit or 32bit\n"); dev_dbg(component->dev, "24bit or 32bit\n");
switch (sta350->format) { switch (sta350->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
confb |= 0x0; confb |= 0x0;
...@@ -747,7 +747,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream, ...@@ -747,7 +747,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream,
break; break;
case 20: case 20:
dev_dbg(codec->dev, "20bit\n"); dev_dbg(component->dev, "20bit\n");
switch (sta350->format) { switch (sta350->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
confb |= 0x4; confb |= 0x4;
...@@ -762,7 +762,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream, ...@@ -762,7 +762,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream,
break; break;
case 18: case 18:
dev_dbg(codec->dev, "18bit\n"); dev_dbg(component->dev, "18bit\n");
switch (sta350->format) { switch (sta350->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
confb |= 0x8; confb |= 0x8;
...@@ -777,7 +777,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream, ...@@ -777,7 +777,7 @@ static int sta350_hw_params(struct snd_pcm_substream *substream,
break; break;
case 16: case 16:
dev_dbg(codec->dev, "16bit\n"); dev_dbg(component->dev, "16bit\n");
switch (sta350->format) { switch (sta350->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
confb |= 0x0; confb |= 0x0;
...@@ -827,20 +827,20 @@ static int sta350_startup_sequence(struct sta350_priv *sta350) ...@@ -827,20 +827,20 @@ static int sta350_startup_sequence(struct sta350_priv *sta350)
/** /**
* sta350_set_bias_level - DAPM callback * sta350_set_bias_level - DAPM callback
* @codec: the codec device * @component: the component device
* @level: DAPM power level * @level: DAPM power level
* *
* This is called by ALSA to put the codec into low power mode * This is called by ALSA to put the component into low power mode
* or to wake it up. If the codec is powered off completely * or to wake it up. If the component is powered off completely
* all registers must be restored after power on. * all registers must be restored after power on.
*/ */
static int sta350_set_bias_level(struct snd_soc_codec *codec, static int sta350_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
int ret; int ret;
dev_dbg(codec->dev, "level = %d\n", level); dev_dbg(component->dev, "level = %d\n", level);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
break; break;
...@@ -853,18 +853,18 @@ static int sta350_set_bias_level(struct snd_soc_codec *codec, ...@@ -853,18 +853,18 @@ static int sta350_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable( ret = regulator_bulk_enable(
ARRAY_SIZE(sta350->supplies), ARRAY_SIZE(sta350->supplies),
sta350->supplies); sta350->supplies);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, dev_err(component->dev,
"Failed to enable supplies: %d\n", "Failed to enable supplies: %d\n",
ret); ret);
return ret; return ret;
} }
sta350_startup_sequence(sta350); sta350_startup_sequence(sta350);
sta350_cache_sync(codec); sta350_cache_sync(component);
} }
/* Power down */ /* Power down */
...@@ -911,22 +911,22 @@ static struct snd_soc_dai_driver sta350_dai = { ...@@ -911,22 +911,22 @@ static struct snd_soc_dai_driver sta350_dai = {
.ops = &sta350_dai_ops, .ops = &sta350_dai_ops,
}; };
static int sta350_probe(struct snd_soc_codec *codec) static int sta350_probe(struct snd_soc_component *component)
{ {
struct sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
struct sta350_platform_data *pdata = sta350->pdata; struct sta350_platform_data *pdata = sta350->pdata;
int i, ret = 0, thermal = 0; int i, ret = 0, thermal = 0;
ret = regulator_bulk_enable(ARRAY_SIZE(sta350->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(sta350->supplies),
sta350->supplies); sta350->supplies);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); dev_err(component->dev, "Failed to enable supplies: %d\n", ret);
return ret; return ret;
} }
ret = sta350_startup_sequence(sta350); ret = sta350_startup_sequence(sta350);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Failed to startup device\n"); dev_err(component->dev, "Failed to startup device\n");
return ret; return ret;
} }
...@@ -1036,35 +1036,35 @@ static int sta350_probe(struct snd_soc_codec *codec) ...@@ -1036,35 +1036,35 @@ static int sta350_probe(struct snd_soc_codec *codec)
sta350->coef_shadow[60] = 0x400000; sta350->coef_shadow[60] = 0x400000;
sta350->coef_shadow[61] = 0x400000; sta350->coef_shadow[61] = 0x400000;
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
/* Bias level configuration will have done an extra enable */ /* Bias level configuration will have done an extra enable */
regulator_bulk_disable(ARRAY_SIZE(sta350->supplies), sta350->supplies); regulator_bulk_disable(ARRAY_SIZE(sta350->supplies), sta350->supplies);
return 0; return 0;
} }
static int sta350_remove(struct snd_soc_codec *codec) static void sta350_remove(struct snd_soc_component *component)
{ {
struct sta350_priv *sta350 = snd_soc_codec_get_drvdata(codec); struct sta350_priv *sta350 = snd_soc_component_get_drvdata(component);
regulator_bulk_disable(ARRAY_SIZE(sta350->supplies), sta350->supplies); regulator_bulk_disable(ARRAY_SIZE(sta350->supplies), sta350->supplies);
return 0;
} }
static const struct snd_soc_codec_driver sta350_codec = { static const struct snd_soc_component_driver sta350_component = {
.probe = sta350_probe, .probe = sta350_probe,
.remove = sta350_remove, .remove = sta350_remove,
.set_bias_level = sta350_set_bias_level, .set_bias_level = sta350_set_bias_level,
.suspend_bias_off = true,
.component_driver = {
.controls = sta350_snd_controls, .controls = sta350_snd_controls,
.num_controls = ARRAY_SIZE(sta350_snd_controls), .num_controls = ARRAY_SIZE(sta350_snd_controls),
.dapm_widgets = sta350_dapm_widgets, .dapm_widgets = sta350_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(sta350_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(sta350_dapm_widgets),
.dapm_routes = sta350_dapm_routes, .dapm_routes = sta350_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(sta350_dapm_routes), .num_dapm_routes = ARRAY_SIZE(sta350_dapm_routes),
}, .suspend_bias_off = 1,
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct regmap_config sta350_regmap = { static const struct regmap_config sta350_regmap = {
...@@ -1244,16 +1244,15 @@ static int sta350_i2c_probe(struct i2c_client *i2c, ...@@ -1244,16 +1244,15 @@ static int sta350_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, sta350); i2c_set_clientdata(i2c, sta350);
ret = snd_soc_register_codec(dev, &sta350_codec, &sta350_dai, 1); ret = devm_snd_soc_register_component(dev, &sta350_component, &sta350_dai, 1);
if (ret < 0) if (ret < 0)
dev_err(dev, "Failed to register codec (%d)\n", ret); dev_err(dev, "Failed to register component (%d)\n", ret);
return ret; return ret;
} }
static int sta350_i2c_remove(struct i2c_client *client) static int sta350_i2c_remove(struct i2c_client *client)
{ {
snd_soc_unregister_codec(&client->dev);
return 0; return 0;
} }
......
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