Commit f5d5240e authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: lm49453: replace codec to component

Now we can replace Codec to Component. Let's do it.

Note:
	xxx_codec_xxx()		->	xxx_component_xxx()
	.idle_bias_off = 1	->	.idle_bias_on = 0
	.ignore_pmdown_time = 0	->	.use_pmdown_time = 1
	-			->	.endianness = 1
	-			->	.non_legacy_dai_naming = 1
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7928b2cb
...@@ -1110,7 +1110,7 @@ static int lm49453_hw_params(struct snd_pcm_substream *substream, ...@@ -1110,7 +1110,7 @@ static int lm49453_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;
u16 clk_div = 0; u16 clk_div = 0;
/* Setting DAC clock dividers based on substream sample rate. */ /* Setting DAC clock dividers based on substream sample rate. */
...@@ -1134,15 +1134,15 @@ static int lm49453_hw_params(struct snd_pcm_substream *substream, ...@@ -1134,15 +1134,15 @@ static int lm49453_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
snd_soc_write(codec, LM49453_P0_ADC_CLK_DIV_REG, clk_div); snd_soc_component_write(component, LM49453_P0_ADC_CLK_DIV_REG, clk_div);
snd_soc_write(codec, LM49453_P0_DAC_HP_CLK_DIV_REG, clk_div); snd_soc_component_write(component, LM49453_P0_DAC_HP_CLK_DIV_REG, clk_div);
return 0; return 0;
} }
static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) static int lm49453_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;
u16 aif_val; u16 aif_val;
int mode = 0; int mode = 0;
...@@ -1185,11 +1185,11 @@ static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -1185,11 +1185,11 @@ static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
return -EINVAL; return -EINVAL;
} }
snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG, snd_soc_component_update_bits(component, LM49453_P0_AUDIO_PORT1_BASIC_REG,
LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(0)|BIT(5), LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(0)|BIT(5),
(aif_val | mode | clk_phase)); (aif_val | mode | clk_phase));
snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift); snd_soc_component_write(component, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift);
return 0; return 0;
} }
...@@ -1197,7 +1197,7 @@ static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -1197,7 +1197,7 @@ static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
static int lm49453_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, static int lm49453_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
unsigned int freq, int dir) unsigned int freq, int dir)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
u16 pll_clk = 0; u16 pll_clk = 0;
switch (freq) { switch (freq) {
...@@ -1216,50 +1216,50 @@ static int lm49453_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, ...@@ -1216,50 +1216,50 @@ static int lm49453_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
return -EINVAL; return -EINVAL;
} }
snd_soc_update_bits(codec, LM49453_P0_PMC_SETUP_REG, BIT(4), pll_clk); snd_soc_component_update_bits(component, LM49453_P0_PMC_SETUP_REG, BIT(4), pll_clk);
return 0; return 0;
} }
static int lm49453_hp_mute(struct snd_soc_dai *dai, int mute) static int lm49453_hp_mute(struct snd_soc_dai *dai, int mute)
{ {
snd_soc_update_bits(dai->codec, LM49453_P0_DAC_DSP_REG, BIT(1)|BIT(0), snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(1)|BIT(0),
(mute ? (BIT(1)|BIT(0)) : 0)); (mute ? (BIT(1)|BIT(0)) : 0));
return 0; return 0;
} }
static int lm49453_lo_mute(struct snd_soc_dai *dai, int mute) static int lm49453_lo_mute(struct snd_soc_dai *dai, int mute)
{ {
snd_soc_update_bits(dai->codec, LM49453_P0_DAC_DSP_REG, BIT(3)|BIT(2), snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(3)|BIT(2),
(mute ? (BIT(3)|BIT(2)) : 0)); (mute ? (BIT(3)|BIT(2)) : 0));
return 0; return 0;
} }
static int lm49453_ls_mute(struct snd_soc_dai *dai, int mute) static int lm49453_ls_mute(struct snd_soc_dai *dai, int mute)
{ {
snd_soc_update_bits(dai->codec, LM49453_P0_DAC_DSP_REG, BIT(5)|BIT(4), snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(5)|BIT(4),
(mute ? (BIT(5)|BIT(4)) : 0)); (mute ? (BIT(5)|BIT(4)) : 0));
return 0; return 0;
} }
static int lm49453_ep_mute(struct snd_soc_dai *dai, int mute) static int lm49453_ep_mute(struct snd_soc_dai *dai, int mute)
{ {
snd_soc_update_bits(dai->codec, LM49453_P0_DAC_DSP_REG, BIT(4), snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(4),
(mute ? BIT(4) : 0)); (mute ? BIT(4) : 0));
return 0; return 0;
} }
static int lm49453_ha_mute(struct snd_soc_dai *dai, int mute) static int lm49453_ha_mute(struct snd_soc_dai *dai, int mute)
{ {
snd_soc_update_bits(dai->codec, LM49453_P0_DAC_DSP_REG, BIT(7)|BIT(6), snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(7)|BIT(6),
(mute ? (BIT(7)|BIT(6)) : 0)); (mute ? (BIT(7)|BIT(6)) : 0));
return 0; return 0;
} }
static int lm49453_set_bias_level(struct snd_soc_codec *codec, static int lm49453_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct lm49453_priv *lm49453 = snd_soc_codec_get_drvdata(codec); struct lm49453_priv *lm49453 = snd_soc_component_get_drvdata(component);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
...@@ -1267,15 +1267,15 @@ static int lm49453_set_bias_level(struct snd_soc_codec *codec, ...@@ -1267,15 +1267,15 @@ static int lm49453_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)
regcache_sync(lm49453->regmap); regcache_sync(lm49453->regmap);
snd_soc_update_bits(codec, LM49453_P0_PMC_SETUP_REG, snd_soc_component_update_bits(component, LM49453_P0_PMC_SETUP_REG,
LM49453_PMC_SETUP_CHIP_EN, LM49453_CHIP_EN); LM49453_PMC_SETUP_CHIP_EN, LM49453_CHIP_EN);
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
snd_soc_update_bits(codec, LM49453_P0_PMC_SETUP_REG, snd_soc_component_update_bits(component, LM49453_P0_PMC_SETUP_REG,
LM49453_PMC_SETUP_CHIP_EN, 0); LM49453_PMC_SETUP_CHIP_EN, 0);
break; break;
} }
...@@ -1389,17 +1389,17 @@ static struct snd_soc_dai_driver lm49453_dai[] = { ...@@ -1389,17 +1389,17 @@ static struct snd_soc_dai_driver lm49453_dai[] = {
}, },
}; };
static const struct snd_soc_codec_driver soc_codec_dev_lm49453 = { static const struct snd_soc_component_driver soc_component_dev_lm49453 = {
.set_bias_level = lm49453_set_bias_level, .set_bias_level = lm49453_set_bias_level,
.component_driver = {
.controls = lm49453_snd_controls, .controls = lm49453_snd_controls,
.num_controls = ARRAY_SIZE(lm49453_snd_controls), .num_controls = ARRAY_SIZE(lm49453_snd_controls),
.dapm_widgets = lm49453_dapm_widgets, .dapm_widgets = lm49453_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(lm49453_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(lm49453_dapm_widgets),
.dapm_routes = lm49453_audio_map, .dapm_routes = lm49453_audio_map,
.num_dapm_routes = ARRAY_SIZE(lm49453_audio_map), .num_dapm_routes = ARRAY_SIZE(lm49453_audio_map),
}, .use_pmdown_time = 1,
.idle_bias_off = true, .endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct regmap_config lm49453_regmap_config = { static const struct regmap_config lm49453_regmap_config = {
...@@ -1434,18 +1434,17 @@ static int lm49453_i2c_probe(struct i2c_client *i2c, ...@@ -1434,18 +1434,17 @@ static int lm49453_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
ret = snd_soc_register_codec(&i2c->dev, ret = devm_snd_soc_register_component(&i2c->dev,
&soc_codec_dev_lm49453, &soc_component_dev_lm49453,
lm49453_dai, ARRAY_SIZE(lm49453_dai)); lm49453_dai, ARRAY_SIZE(lm49453_dai));
if (ret < 0) if (ret < 0)
dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); dev_err(&i2c->dev, "Failed to register component: %d\n", ret);
return ret; return ret;
} }
static int lm49453_i2c_remove(struct i2c_client *client) static int lm49453_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