diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 23:43:36 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 06:08:16 -0500 |
commit | b48e6ef3a1db8527d0c99e578f3dd3ee40a2d573 (patch) | |
tree | efcd6632aedec18422e8a51e6af82413f056da45 | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
ASoC: jz4740: 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 = 0 -> .idle_bias_on = 1
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/jz4740.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index 6324ccdc8a5c..9395b583432c 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c | |||
@@ -157,7 +157,7 @@ static const struct snd_soc_dapm_route jz4740_codec_dapm_routes[] = { | |||
157 | static int jz4740_codec_hw_params(struct snd_pcm_substream *substream, | 157 | static int jz4740_codec_hw_params(struct snd_pcm_substream *substream, |
158 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) | 158 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) |
159 | { | 159 | { |
160 | struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(dai->codec); | 160 | struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(dai->component); |
161 | uint32_t val; | 161 | uint32_t val; |
162 | 162 | ||
163 | switch (params_rate(params)) { | 163 | switch (params_rate(params)) { |
@@ -236,10 +236,10 @@ static void jz4740_codec_wakeup(struct regmap *regmap) | |||
236 | regcache_sync(regmap); | 236 | regcache_sync(regmap); |
237 | } | 237 | } |
238 | 238 | ||
239 | static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, | 239 | static int jz4740_codec_set_bias_level(struct snd_soc_component *component, |
240 | enum snd_soc_bias_level level) | 240 | enum snd_soc_bias_level level) |
241 | { | 241 | { |
242 | struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec); | 242 | struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(component); |
243 | struct regmap *regmap = jz4740_codec->regmap; | 243 | struct regmap *regmap = jz4740_codec->regmap; |
244 | unsigned int mask; | 244 | unsigned int mask; |
245 | unsigned int value; | 245 | unsigned int value; |
@@ -257,7 +257,7 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, | |||
257 | break; | 257 | break; |
258 | case SND_SOC_BIAS_STANDBY: | 258 | case SND_SOC_BIAS_STANDBY: |
259 | /* The only way to clear the suspend flag is to reset the codec */ | 259 | /* The only way to clear the suspend flag is to reset the codec */ |
260 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) | 260 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) |
261 | jz4740_codec_wakeup(regmap); | 261 | jz4740_codec_wakeup(regmap); |
262 | 262 | ||
263 | mask = JZ4740_CODEC_1_VREF_DISABLE | | 263 | mask = JZ4740_CODEC_1_VREF_DISABLE | |
@@ -283,9 +283,9 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, | |||
283 | return 0; | 283 | return 0; |
284 | } | 284 | } |
285 | 285 | ||
286 | static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) | 286 | static int jz4740_codec_dev_probe(struct snd_soc_component *component) |
287 | { | 287 | { |
288 | struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec); | 288 | struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(component); |
289 | 289 | ||
290 | regmap_update_bits(jz4740_codec->regmap, JZ4740_REG_CODEC_1, | 290 | regmap_update_bits(jz4740_codec->regmap, JZ4740_REG_CODEC_1, |
291 | JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE); | 291 | JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE); |
@@ -293,19 +293,21 @@ static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) | |||
293 | return 0; | 293 | return 0; |
294 | } | 294 | } |
295 | 295 | ||
296 | static const struct snd_soc_codec_driver soc_codec_dev_jz4740_codec = { | 296 | static const struct snd_soc_component_driver soc_codec_dev_jz4740_codec = { |
297 | .probe = jz4740_codec_dev_probe, | 297 | .probe = jz4740_codec_dev_probe, |
298 | .set_bias_level = jz4740_codec_set_bias_level, | 298 | .set_bias_level = jz4740_codec_set_bias_level, |
299 | .suspend_bias_off = true, | 299 | .controls = jz4740_codec_controls, |
300 | 300 | .num_controls = ARRAY_SIZE(jz4740_codec_controls), | |
301 | .component_driver = { | 301 | .dapm_widgets = jz4740_codec_dapm_widgets, |
302 | .controls = jz4740_codec_controls, | 302 | .num_dapm_widgets = ARRAY_SIZE(jz4740_codec_dapm_widgets), |
303 | .num_controls = ARRAY_SIZE(jz4740_codec_controls), | 303 | .dapm_routes = jz4740_codec_dapm_routes, |
304 | .dapm_widgets = jz4740_codec_dapm_widgets, | 304 | .num_dapm_routes = ARRAY_SIZE(jz4740_codec_dapm_routes), |
305 | .num_dapm_widgets = ARRAY_SIZE(jz4740_codec_dapm_widgets), | 305 | .suspend_bias_off = 1, |
306 | .dapm_routes = jz4740_codec_dapm_routes, | 306 | .idle_bias_on = 1, |
307 | .num_dapm_routes = ARRAY_SIZE(jz4740_codec_dapm_routes), | 307 | .use_pmdown_time = 1, |
308 | }, | 308 | .endianness = 1, |
309 | .non_legacy_dai_naming = 1, | ||
310 | |||
309 | }; | 311 | }; |
310 | 312 | ||
311 | static const struct regmap_config jz4740_codec_regmap_config = { | 313 | static const struct regmap_config jz4740_codec_regmap_config = { |
@@ -343,7 +345,7 @@ static int jz4740_codec_probe(struct platform_device *pdev) | |||
343 | 345 | ||
344 | platform_set_drvdata(pdev, jz4740_codec); | 346 | platform_set_drvdata(pdev, jz4740_codec); |
345 | 347 | ||
346 | ret = snd_soc_register_codec(&pdev->dev, | 348 | ret = devm_snd_soc_register_component(&pdev->dev, |
347 | &soc_codec_dev_jz4740_codec, &jz4740_codec_dai, 1); | 349 | &soc_codec_dev_jz4740_codec, &jz4740_codec_dai, 1); |
348 | if (ret) | 350 | if (ret) |
349 | dev_err(&pdev->dev, "Failed to register codec\n"); | 351 | dev_err(&pdev->dev, "Failed to register codec\n"); |
@@ -351,16 +353,8 @@ static int jz4740_codec_probe(struct platform_device *pdev) | |||
351 | return ret; | 353 | return ret; |
352 | } | 354 | } |
353 | 355 | ||
354 | static int jz4740_codec_remove(struct platform_device *pdev) | ||
355 | { | ||
356 | snd_soc_unregister_codec(&pdev->dev); | ||
357 | |||
358 | return 0; | ||
359 | } | ||
360 | |||
361 | static struct platform_driver jz4740_codec_driver = { | 356 | static struct platform_driver jz4740_codec_driver = { |
362 | .probe = jz4740_codec_probe, | 357 | .probe = jz4740_codec_probe, |
363 | .remove = jz4740_codec_remove, | ||
364 | .driver = { | 358 | .driver = { |
365 | .name = "jz4740-codec", | 359 | .name = "jz4740-codec", |
366 | }, | 360 | }, |