diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 22:12:39 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 04:44:56 -0500 |
commit | 9123ea9ff5bcdfdb89f7ad6f8efc56f2ca55a071 (patch) | |
tree | 44924e0beef5eb1997da94edd70ab53649bf278e | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
ASoC: ak4613: 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/ak4613.c | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c index 3d1cf4784e87..a7b1e3a1ec58 100644 --- a/sound/soc/codecs/ak4613.c +++ b/sound/soc/codecs/ak4613.c | |||
@@ -243,9 +243,9 @@ static const struct snd_soc_dapm_route ak4613_intercon[] = { | |||
243 | static void ak4613_dai_shutdown(struct snd_pcm_substream *substream, | 243 | static void ak4613_dai_shutdown(struct snd_pcm_substream *substream, |
244 | struct snd_soc_dai *dai) | 244 | struct snd_soc_dai *dai) |
245 | { | 245 | { |
246 | struct snd_soc_codec *codec = dai->codec; | 246 | struct snd_soc_component *component = dai->component; |
247 | struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); | 247 | struct ak4613_priv *priv = snd_soc_component_get_drvdata(component); |
248 | struct device *dev = codec->dev; | 248 | struct device *dev = component->dev; |
249 | 249 | ||
250 | mutex_lock(&priv->lock); | 250 | mutex_lock(&priv->lock); |
251 | priv->cnt--; | 251 | priv->cnt--; |
@@ -305,8 +305,8 @@ static void ak4613_hw_constraints(struct ak4613_priv *priv, | |||
305 | static int ak4613_dai_startup(struct snd_pcm_substream *substream, | 305 | static int ak4613_dai_startup(struct snd_pcm_substream *substream, |
306 | struct snd_soc_dai *dai) | 306 | struct snd_soc_dai *dai) |
307 | { | 307 | { |
308 | struct snd_soc_codec *codec = dai->codec; | 308 | struct snd_soc_component *component = dai->component; |
309 | struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); | 309 | struct ak4613_priv *priv = snd_soc_component_get_drvdata(component); |
310 | 310 | ||
311 | priv->cnt++; | 311 | priv->cnt++; |
312 | 312 | ||
@@ -318,8 +318,8 @@ static int ak4613_dai_startup(struct snd_pcm_substream *substream, | |||
318 | static int ak4613_dai_set_sysclk(struct snd_soc_dai *codec_dai, | 318 | static int ak4613_dai_set_sysclk(struct snd_soc_dai *codec_dai, |
319 | int clk_id, unsigned int freq, int dir) | 319 | int clk_id, unsigned int freq, int dir) |
320 | { | 320 | { |
321 | struct snd_soc_codec *codec = codec_dai->codec; | 321 | struct snd_soc_component *component = codec_dai->component; |
322 | struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); | 322 | struct ak4613_priv *priv = snd_soc_component_get_drvdata(component); |
323 | 323 | ||
324 | priv->sysclk = freq; | 324 | priv->sysclk = freq; |
325 | 325 | ||
@@ -328,8 +328,8 @@ static int ak4613_dai_set_sysclk(struct snd_soc_dai *codec_dai, | |||
328 | 328 | ||
329 | static int ak4613_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | 329 | static int ak4613_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
330 | { | 330 | { |
331 | struct snd_soc_codec *codec = dai->codec; | 331 | struct snd_soc_component *component = dai->component; |
332 | struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); | 332 | struct ak4613_priv *priv = snd_soc_component_get_drvdata(component); |
333 | 333 | ||
334 | fmt &= SND_SOC_DAIFMT_FORMAT_MASK; | 334 | fmt &= SND_SOC_DAIFMT_FORMAT_MASK; |
335 | 335 | ||
@@ -366,10 +366,10 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream, | |||
366 | struct snd_pcm_hw_params *params, | 366 | struct snd_pcm_hw_params *params, |
367 | struct snd_soc_dai *dai) | 367 | struct snd_soc_dai *dai) |
368 | { | 368 | { |
369 | struct snd_soc_codec *codec = dai->codec; | 369 | struct snd_soc_component *component = dai->component; |
370 | struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); | 370 | struct ak4613_priv *priv = snd_soc_component_get_drvdata(component); |
371 | const struct ak4613_interface *iface; | 371 | const struct ak4613_interface *iface; |
372 | struct device *dev = codec->dev; | 372 | struct device *dev = component->dev; |
373 | unsigned int width = params_width(params); | 373 | unsigned int width = params_width(params); |
374 | unsigned int fmt = priv->fmt; | 374 | unsigned int fmt = priv->fmt; |
375 | unsigned int rate; | 375 | unsigned int rate; |
@@ -434,11 +434,11 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream, | |||
434 | 434 | ||
435 | fmt_ctrl = AUDIO_IFACE_TO_VAL(iface); | 435 | fmt_ctrl = AUDIO_IFACE_TO_VAL(iface); |
436 | 436 | ||
437 | snd_soc_update_bits(codec, CTRL1, FMT_MASK, fmt_ctrl); | 437 | snd_soc_component_update_bits(component, CTRL1, FMT_MASK, fmt_ctrl); |
438 | snd_soc_update_bits(codec, CTRL2, DFS_MASK, ctrl2); | 438 | snd_soc_component_update_bits(component, CTRL2, DFS_MASK, ctrl2); |
439 | 439 | ||
440 | snd_soc_update_bits(codec, ICTRL, ICTRL_MASK, priv->ic); | 440 | snd_soc_component_update_bits(component, ICTRL, ICTRL_MASK, priv->ic); |
441 | snd_soc_update_bits(codec, OCTRL, OCTRL_MASK, priv->oc); | 441 | snd_soc_component_update_bits(component, OCTRL, OCTRL_MASK, priv->oc); |
442 | 442 | ||
443 | hw_params_end: | 443 | hw_params_end: |
444 | if (ret < 0) | 444 | if (ret < 0) |
@@ -447,7 +447,7 @@ hw_params_end: | |||
447 | return ret; | 447 | return ret; |
448 | } | 448 | } |
449 | 449 | ||
450 | static int ak4613_set_bias_level(struct snd_soc_codec *codec, | 450 | static int ak4613_set_bias_level(struct snd_soc_component *component, |
451 | enum snd_soc_bias_level level) | 451 | enum snd_soc_bias_level level) |
452 | { | 452 | { |
453 | u8 mgmt1 = 0; | 453 | u8 mgmt1 = 0; |
@@ -467,7 +467,7 @@ static int ak4613_set_bias_level(struct snd_soc_codec *codec, | |||
467 | break; | 467 | break; |
468 | } | 468 | } |
469 | 469 | ||
470 | snd_soc_write(codec, PW_MGMT1, mgmt1); | 470 | snd_soc_component_write(component, PW_MGMT1, mgmt1); |
471 | 471 | ||
472 | return 0; | 472 | return 0; |
473 | } | 473 | } |
@@ -504,8 +504,8 @@ static void ak4613_dummy_write(struct work_struct *work) | |||
504 | static int ak4613_dai_trigger(struct snd_pcm_substream *substream, int cmd, | 504 | static int ak4613_dai_trigger(struct snd_pcm_substream *substream, int cmd, |
505 | struct snd_soc_dai *dai) | 505 | struct snd_soc_dai *dai) |
506 | { | 506 | { |
507 | struct snd_soc_codec *codec = dai->codec; | 507 | struct snd_soc_component *component = dai->component; |
508 | struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); | 508 | struct ak4613_priv *priv = snd_soc_component_get_drvdata(component); |
509 | 509 | ||
510 | /* | 510 | /* |
511 | * FIXME | 511 | * FIXME |
@@ -537,7 +537,7 @@ static int ak4613_dai_trigger(struct snd_pcm_substream *substream, int cmd, | |||
537 | if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) | 537 | if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) |
538 | return 0; | 538 | return 0; |
539 | 539 | ||
540 | priv->component = &codec->component; | 540 | priv->component = component; |
541 | schedule_work(&priv->dummy_write_work); | 541 | schedule_work(&priv->dummy_write_work); |
542 | 542 | ||
543 | return 0; | 543 | return 0; |
@@ -582,35 +582,37 @@ static struct snd_soc_dai_driver ak4613_dai = { | |||
582 | .symmetric_rates = 1, | 582 | .symmetric_rates = 1, |
583 | }; | 583 | }; |
584 | 584 | ||
585 | static int ak4613_suspend(struct snd_soc_codec *codec) | 585 | static int ak4613_suspend(struct snd_soc_component *component) |
586 | { | 586 | { |
587 | struct regmap *regmap = dev_get_regmap(codec->dev, NULL); | 587 | struct regmap *regmap = dev_get_regmap(component->dev, NULL); |
588 | 588 | ||
589 | regcache_cache_only(regmap, true); | 589 | regcache_cache_only(regmap, true); |
590 | regcache_mark_dirty(regmap); | 590 | regcache_mark_dirty(regmap); |
591 | return 0; | 591 | return 0; |
592 | } | 592 | } |
593 | 593 | ||
594 | static int ak4613_resume(struct snd_soc_codec *codec) | 594 | static int ak4613_resume(struct snd_soc_component *component) |
595 | { | 595 | { |
596 | struct regmap *regmap = dev_get_regmap(codec->dev, NULL); | 596 | struct regmap *regmap = dev_get_regmap(component->dev, NULL); |
597 | 597 | ||
598 | regcache_cache_only(regmap, false); | 598 | regcache_cache_only(regmap, false); |
599 | return regcache_sync(regmap); | 599 | return regcache_sync(regmap); |
600 | } | 600 | } |
601 | 601 | ||
602 | static const struct snd_soc_codec_driver soc_codec_dev_ak4613 = { | 602 | static const struct snd_soc_component_driver soc_component_dev_ak4613 = { |
603 | .suspend = ak4613_suspend, | 603 | .suspend = ak4613_suspend, |
604 | .resume = ak4613_resume, | 604 | .resume = ak4613_resume, |
605 | .set_bias_level = ak4613_set_bias_level, | 605 | .set_bias_level = ak4613_set_bias_level, |
606 | .component_driver = { | 606 | .controls = ak4613_snd_controls, |
607 | .controls = ak4613_snd_controls, | 607 | .num_controls = ARRAY_SIZE(ak4613_snd_controls), |
608 | .num_controls = ARRAY_SIZE(ak4613_snd_controls), | 608 | .dapm_widgets = ak4613_dapm_widgets, |
609 | .dapm_widgets = ak4613_dapm_widgets, | 609 | .num_dapm_widgets = ARRAY_SIZE(ak4613_dapm_widgets), |
610 | .num_dapm_widgets = ARRAY_SIZE(ak4613_dapm_widgets), | 610 | .dapm_routes = ak4613_intercon, |
611 | .dapm_routes = ak4613_intercon, | 611 | .num_dapm_routes = ARRAY_SIZE(ak4613_intercon), |
612 | .num_dapm_routes = ARRAY_SIZE(ak4613_intercon), | 612 | .idle_bias_on = 1, |
613 | }, | 613 | .use_pmdown_time = 1, |
614 | .endianness = 1, | ||
615 | .non_legacy_dai_naming = 1, | ||
614 | }; | 616 | }; |
615 | 617 | ||
616 | static void ak4613_parse_of(struct ak4613_priv *priv, | 618 | static void ak4613_parse_of(struct ak4613_priv *priv, |
@@ -677,13 +679,12 @@ static int ak4613_i2c_probe(struct i2c_client *i2c, | |||
677 | if (IS_ERR(regmap)) | 679 | if (IS_ERR(regmap)) |
678 | return PTR_ERR(regmap); | 680 | return PTR_ERR(regmap); |
679 | 681 | ||
680 | return snd_soc_register_codec(dev, &soc_codec_dev_ak4613, | 682 | return devm_snd_soc_register_component(dev, &soc_component_dev_ak4613, |
681 | &ak4613_dai, 1); | 683 | &ak4613_dai, 1); |
682 | } | 684 | } |
683 | 685 | ||
684 | static int ak4613_i2c_remove(struct i2c_client *client) | 686 | static int ak4613_i2c_remove(struct i2c_client *client) |
685 | { | 687 | { |
686 | snd_soc_unregister_codec(&client->dev); | ||
687 | return 0; | 688 | return 0; |
688 | } | 689 | } |
689 | 690 | ||