diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 21:51:26 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 06:45:38 -0500 |
commit | e049cf4e6adcb14e34c37123a67158a7e671d000 (patch) | |
tree | 508eda041717977aa07431e142ab5533989140d8 | |
parent | bab9dc53d5bfbfa057e02c5edd97787829ee0b31 (diff) |
ASoC: txx9aclc: replace platform to component
Now platform can be replaced to component, let's do it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/txx9/txx9aclc.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index a2bb68fea5a3..8d31fe628e2f 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <sound/soc.h> | 23 | #include <sound/soc.h> |
24 | #include "txx9aclc.h" | 24 | #include "txx9aclc.h" |
25 | 25 | ||
26 | #define DRV_NAME "txx9aclc" | ||
27 | |||
26 | static struct txx9aclc_soc_device { | 28 | static struct txx9aclc_soc_device { |
27 | struct txx9aclc_dmadata dmadata[2]; | 29 | struct txx9aclc_dmadata dmadata[2]; |
28 | } txx9aclc_soc_device; | 30 | } txx9aclc_soc_device; |
@@ -53,6 +55,7 @@ static int txx9aclc_pcm_hw_params(struct snd_pcm_substream *substream, | |||
53 | { | 55 | { |
54 | struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); | 56 | struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); |
55 | struct snd_pcm_runtime *runtime = substream->runtime; | 57 | struct snd_pcm_runtime *runtime = substream->runtime; |
58 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); | ||
56 | struct txx9aclc_dmadata *dmadata = runtime->private_data; | 59 | struct txx9aclc_dmadata *dmadata = runtime->private_data; |
57 | int ret; | 60 | int ret; |
58 | 61 | ||
@@ -60,13 +63,13 @@ static int txx9aclc_pcm_hw_params(struct snd_pcm_substream *substream, | |||
60 | if (ret < 0) | 63 | if (ret < 0) |
61 | return ret; | 64 | return ret; |
62 | 65 | ||
63 | dev_dbg(rtd->platform->dev, | 66 | dev_dbg(component->dev, |
64 | "runtime->dma_area = %#lx dma_addr = %#lx dma_bytes = %zd " | 67 | "runtime->dma_area = %#lx dma_addr = %#lx dma_bytes = %zd " |
65 | "runtime->min_align %ld\n", | 68 | "runtime->min_align %ld\n", |
66 | (unsigned long)runtime->dma_area, | 69 | (unsigned long)runtime->dma_area, |
67 | (unsigned long)runtime->dma_addr, runtime->dma_bytes, | 70 | (unsigned long)runtime->dma_addr, runtime->dma_bytes, |
68 | runtime->min_align); | 71 | runtime->min_align); |
69 | dev_dbg(rtd->platform->dev, | 72 | dev_dbg(component->dev, |
70 | "periods %d period_bytes %d stream %d\n", | 73 | "periods %d period_bytes %d stream %d\n", |
71 | params_periods(params), params_period_bytes(params), | 74 | params_periods(params), params_period_bytes(params), |
72 | substream->stream); | 75 | substream->stream); |
@@ -287,7 +290,8 @@ static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
287 | struct snd_card *card = rtd->card->snd_card; | 290 | struct snd_card *card = rtd->card->snd_card; |
288 | struct snd_soc_dai *dai = rtd->cpu_dai; | 291 | struct snd_soc_dai *dai = rtd->cpu_dai; |
289 | struct snd_pcm *pcm = rtd->pcm; | 292 | struct snd_pcm *pcm = rtd->pcm; |
290 | struct platform_device *pdev = to_platform_device(rtd->platform->dev); | 293 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
294 | struct platform_device *pdev = to_platform_device(component->dev); | ||
291 | struct txx9aclc_soc_device *dev; | 295 | struct txx9aclc_soc_device *dev; |
292 | struct resource *r; | 296 | struct resource *r; |
293 | int i; | 297 | int i; |
@@ -371,15 +375,15 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev, | |||
371 | return 0; | 375 | return 0; |
372 | } | 376 | } |
373 | 377 | ||
374 | static int txx9aclc_pcm_probe(struct snd_soc_platform *platform) | 378 | static int txx9aclc_pcm_probe(struct snd_soc_component *component) |
375 | { | 379 | { |
376 | snd_soc_platform_set_drvdata(platform, &txx9aclc_soc_device); | 380 | snd_soc_component_set_drvdata(component, &txx9aclc_soc_device); |
377 | return 0; | 381 | return 0; |
378 | } | 382 | } |
379 | 383 | ||
380 | static int txx9aclc_pcm_remove(struct snd_soc_platform *platform) | 384 | static void txx9aclc_pcm_remove(struct snd_soc_component *component) |
381 | { | 385 | { |
382 | struct txx9aclc_soc_device *dev = snd_soc_platform_get_drvdata(platform); | 386 | struct txx9aclc_soc_device *dev = snd_soc_component_get_drvdata(component); |
383 | struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; | 387 | struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; |
384 | void __iomem *base = drvdata->base; | 388 | void __iomem *base = drvdata->base; |
385 | int i; | 389 | int i; |
@@ -400,10 +404,10 @@ static int txx9aclc_pcm_remove(struct snd_soc_platform *platform) | |||
400 | } | 404 | } |
401 | dev->dmadata[i].dma_chan = NULL; | 405 | dev->dmadata[i].dma_chan = NULL; |
402 | } | 406 | } |
403 | return 0; | ||
404 | } | 407 | } |
405 | 408 | ||
406 | static const struct snd_soc_platform_driver txx9aclc_soc_platform = { | 409 | static const struct snd_soc_component_driver txx9aclc_soc_component = { |
410 | .name = DRV_NAME, | ||
407 | .probe = txx9aclc_pcm_probe, | 411 | .probe = txx9aclc_pcm_probe, |
408 | .remove = txx9aclc_pcm_remove, | 412 | .remove = txx9aclc_pcm_remove, |
409 | .ops = &txx9aclc_pcm_ops, | 413 | .ops = &txx9aclc_pcm_ops, |
@@ -412,8 +416,8 @@ static const struct snd_soc_platform_driver txx9aclc_soc_platform = { | |||
412 | 416 | ||
413 | static int txx9aclc_soc_platform_probe(struct platform_device *pdev) | 417 | static int txx9aclc_soc_platform_probe(struct platform_device *pdev) |
414 | { | 418 | { |
415 | return devm_snd_soc_register_platform(&pdev->dev, | 419 | return devm_snd_soc_register_component(&pdev->dev, |
416 | &txx9aclc_soc_platform); | 420 | &txx9aclc_soc_component, NULL, 0); |
417 | } | 421 | } |
418 | 422 | ||
419 | static struct platform_driver txx9aclc_pcm_driver = { | 423 | static struct platform_driver txx9aclc_pcm_driver = { |