diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 23:06:51 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 04:49:38 -0500 |
commit | 6f2b5d0db19a0e428dd7fc3abf326ebbc0726693 (patch) | |
tree | 9267878aede6935029a99d5245a4ea293c43d249 | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
ASoC: max98926: 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/max98926.c | 56 | ||||
-rw-r--r-- | sound/soc/codecs/max98926.h | 2 |
2 files changed, 27 insertions, 31 deletions
diff --git a/sound/soc/codecs/max98926.c b/sound/soc/codecs/max98926.c index 7b1d1b0fa879..d9b1f68f243d 100644 --- a/sound/soc/codecs/max98926.c +++ b/sound/soc/codecs/max98926.c | |||
@@ -336,18 +336,18 @@ static void max98926_set_sense_data(struct max98926_priv *max98926) | |||
336 | static int max98926_dai_set_fmt(struct snd_soc_dai *codec_dai, | 336 | static int max98926_dai_set_fmt(struct snd_soc_dai *codec_dai, |
337 | unsigned int fmt) | 337 | unsigned int fmt) |
338 | { | 338 | { |
339 | struct snd_soc_codec *codec = codec_dai->codec; | 339 | struct snd_soc_component *component = codec_dai->component; |
340 | struct max98926_priv *max98926 = snd_soc_codec_get_drvdata(codec); | 340 | struct max98926_priv *max98926 = snd_soc_component_get_drvdata(component); |
341 | unsigned int invert = 0; | 341 | unsigned int invert = 0; |
342 | 342 | ||
343 | dev_dbg(codec->dev, "%s: fmt 0x%08X\n", __func__, fmt); | 343 | dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); |
344 | 344 | ||
345 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 345 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
346 | case SND_SOC_DAIFMT_CBS_CFS: | 346 | case SND_SOC_DAIFMT_CBS_CFS: |
347 | max98926_set_sense_data(max98926); | 347 | max98926_set_sense_data(max98926); |
348 | break; | 348 | break; |
349 | default: | 349 | default: |
350 | dev_err(codec->dev, "DAI clock mode unsupported\n"); | 350 | dev_err(component->dev, "DAI clock mode unsupported\n"); |
351 | return -EINVAL; | 351 | return -EINVAL; |
352 | } | 352 | } |
353 | 353 | ||
@@ -364,7 +364,7 @@ static int max98926_dai_set_fmt(struct snd_soc_dai *codec_dai, | |||
364 | invert = MAX98926_DAI_BCI_MASK | MAX98926_DAI_WCI_MASK; | 364 | invert = MAX98926_DAI_BCI_MASK | MAX98926_DAI_WCI_MASK; |
365 | break; | 365 | break; |
366 | default: | 366 | default: |
367 | dev_err(codec->dev, "DAI invert mode unsupported\n"); | 367 | dev_err(component->dev, "DAI invert mode unsupported\n"); |
368 | return -EINVAL; | 368 | return -EINVAL; |
369 | } | 369 | } |
370 | 370 | ||
@@ -381,8 +381,8 @@ static int max98926_dai_hw_params(struct snd_pcm_substream *substream, | |||
381 | { | 381 | { |
382 | int dai_sr = -EINVAL; | 382 | int dai_sr = -EINVAL; |
383 | int rate = params_rate(params), i; | 383 | int rate = params_rate(params), i; |
384 | struct snd_soc_codec *codec = dai->codec; | 384 | struct snd_soc_component *component = dai->component; |
385 | struct max98926_priv *max98926 = snd_soc_codec_get_drvdata(codec); | 385 | struct max98926_priv *max98926 = snd_soc_component_get_drvdata(component); |
386 | int blr_clk_ratio; | 386 | int blr_clk_ratio; |
387 | 387 | ||
388 | switch (params_format(params)) { | 388 | switch (params_format(params)) { |
@@ -408,7 +408,7 @@ static int max98926_dai_hw_params(struct snd_pcm_substream *substream, | |||
408 | max98926->ch_size = 32; | 408 | max98926->ch_size = 32; |
409 | break; | 409 | break; |
410 | default: | 410 | default: |
411 | dev_dbg(codec->dev, "format unsupported %d\n", | 411 | dev_dbg(component->dev, "format unsupported %d\n", |
412 | params_format(params)); | 412 | params_format(params)); |
413 | return -EINVAL; | 413 | return -EINVAL; |
414 | } | 414 | } |
@@ -485,27 +485,29 @@ static struct snd_soc_dai_driver max98926_dai[] = { | |||
485 | } | 485 | } |
486 | }; | 486 | }; |
487 | 487 | ||
488 | static int max98926_probe(struct snd_soc_codec *codec) | 488 | static int max98926_probe(struct snd_soc_component *component) |
489 | { | 489 | { |
490 | struct max98926_priv *max98926 = snd_soc_codec_get_drvdata(codec); | 490 | struct max98926_priv *max98926 = snd_soc_component_get_drvdata(component); |
491 | 491 | ||
492 | max98926->codec = codec; | 492 | max98926->component = component; |
493 | 493 | ||
494 | /* Hi-Z all the slots */ | 494 | /* Hi-Z all the slots */ |
495 | regmap_write(max98926->regmap, MAX98926_DOUT_HIZ_CFG4, 0xF0); | 495 | regmap_write(max98926->regmap, MAX98926_DOUT_HIZ_CFG4, 0xF0); |
496 | return 0; | 496 | return 0; |
497 | } | 497 | } |
498 | 498 | ||
499 | static const struct snd_soc_codec_driver soc_codec_dev_max98926 = { | 499 | static const struct snd_soc_component_driver soc_component_dev_max98926 = { |
500 | .probe = max98926_probe, | 500 | .probe = max98926_probe, |
501 | .component_driver = { | 501 | .controls = max98926_snd_controls, |
502 | .controls = max98926_snd_controls, | 502 | .num_controls = ARRAY_SIZE(max98926_snd_controls), |
503 | .num_controls = ARRAY_SIZE(max98926_snd_controls), | 503 | .dapm_routes = max98926_audio_map, |
504 | .dapm_routes = max98926_audio_map, | 504 | .num_dapm_routes = ARRAY_SIZE(max98926_audio_map), |
505 | .num_dapm_routes = ARRAY_SIZE(max98926_audio_map), | 505 | .dapm_widgets = max98926_dapm_widgets, |
506 | .dapm_widgets = max98926_dapm_widgets, | 506 | .num_dapm_widgets = ARRAY_SIZE(max98926_dapm_widgets), |
507 | .num_dapm_widgets = ARRAY_SIZE(max98926_dapm_widgets), | 507 | .idle_bias_on = 1, |
508 | }, | 508 | .use_pmdown_time = 1, |
509 | .endianness = 1, | ||
510 | .non_legacy_dai_naming = 1, | ||
509 | }; | 511 | }; |
510 | 512 | ||
511 | static const struct regmap_config max98926_regmap = { | 513 | static const struct regmap_config max98926_regmap = { |
@@ -563,22 +565,17 @@ static int max98926_i2c_probe(struct i2c_client *i2c, | |||
563 | return ret; | 565 | return ret; |
564 | } | 566 | } |
565 | 567 | ||
566 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98926, | 568 | ret = devm_snd_soc_register_component(&i2c->dev, |
569 | &soc_component_dev_max98926, | ||
567 | max98926_dai, ARRAY_SIZE(max98926_dai)); | 570 | max98926_dai, ARRAY_SIZE(max98926_dai)); |
568 | if (ret < 0) | 571 | if (ret < 0) |
569 | dev_err(&i2c->dev, | 572 | dev_err(&i2c->dev, |
570 | "Failed to register codec: %d\n", ret); | 573 | "Failed to register component: %d\n", ret); |
571 | dev_info(&i2c->dev, "device version: %x\n", reg); | 574 | dev_info(&i2c->dev, "device version: %x\n", reg); |
572 | err_out: | 575 | err_out: |
573 | return ret; | 576 | return ret; |
574 | } | 577 | } |
575 | 578 | ||
576 | static int max98926_i2c_remove(struct i2c_client *client) | ||
577 | { | ||
578 | snd_soc_unregister_codec(&client->dev); | ||
579 | return 0; | ||
580 | } | ||
581 | |||
582 | static const struct i2c_device_id max98926_i2c_id[] = { | 579 | static const struct i2c_device_id max98926_i2c_id[] = { |
583 | { "max98926", 0 }, | 580 | { "max98926", 0 }, |
584 | { } | 581 | { } |
@@ -598,7 +595,6 @@ static struct i2c_driver max98926_i2c_driver = { | |||
598 | .pm = NULL, | 595 | .pm = NULL, |
599 | }, | 596 | }, |
600 | .probe = max98926_i2c_probe, | 597 | .probe = max98926_i2c_probe, |
601 | .remove = max98926_i2c_remove, | ||
602 | .id_table = max98926_i2c_id, | 598 | .id_table = max98926_i2c_id, |
603 | }; | 599 | }; |
604 | 600 | ||
diff --git a/sound/soc/codecs/max98926.h b/sound/soc/codecs/max98926.h index 9d7ab6df79ca..ccf2c3f66c07 100644 --- a/sound/soc/codecs/max98926.h +++ b/sound/soc/codecs/max98926.h | |||
@@ -838,7 +838,7 @@ | |||
838 | 838 | ||
839 | struct max98926_priv { | 839 | struct max98926_priv { |
840 | struct regmap *regmap; | 840 | struct regmap *regmap; |
841 | struct snd_soc_codec *codec; | 841 | struct snd_soc_component *component; |
842 | unsigned int sysclk; | 842 | unsigned int sysclk; |
843 | unsigned int v_slot; | 843 | unsigned int v_slot; |
844 | unsigned int i_slot; | 844 | unsigned int i_slot; |