diff options
author | Mark Brown <broonie@kernel.org> | 2015-03-27 19:00:39 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-27 19:00:39 -0400 |
commit | f8d04e7d91f86c61dbb096d81b99cd692b87fa19 (patch) | |
tree | 591ab0bb2a0c7145fd5c299028db97be7398c789 /sound | |
parent | af7e2be96623785816c1a6e521307b7af11ad016 (diff) | |
parent | 2f78dd7f40264697afed4c2ac0890df8f0588e49 (diff) |
Merge branch 'asoc-fix-rcar' into HEAD
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/sh/rcar/core.c | 24 | ||||
-rw-r--r-- | sound/soc/sh/rcar/dvc.c | 17 | ||||
-rw-r--r-- | sound/soc/sh/rcar/rsnd.h | 11 | ||||
-rw-r--r-- | sound/soc/sh/rcar/src.c | 17 | ||||
-rw-r--r-- | sound/soc/sh/rcar/ssi.c | 17 |
5 files changed, 76 insertions, 10 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 519d85692e0c..770247cddb6c 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -145,16 +145,29 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod) | |||
145 | return mod->ops->dma_req(mod); | 145 | return mod->ops->dma_req(mod); |
146 | } | 146 | } |
147 | 147 | ||
148 | void rsnd_mod_init(struct rsnd_mod *mod, | 148 | int rsnd_mod_init(struct rsnd_mod *mod, |
149 | struct rsnd_mod_ops *ops, | 149 | struct rsnd_mod_ops *ops, |
150 | struct clk *clk, | 150 | struct clk *clk, |
151 | enum rsnd_mod_type type, | 151 | enum rsnd_mod_type type, |
152 | int id) | 152 | int id) |
153 | { | 153 | { |
154 | int ret = clk_prepare(clk); | ||
155 | |||
156 | if (ret) | ||
157 | return ret; | ||
158 | |||
154 | mod->id = id; | 159 | mod->id = id; |
155 | mod->ops = ops; | 160 | mod->ops = ops; |
156 | mod->type = type; | 161 | mod->type = type; |
157 | mod->clk = clk; | 162 | mod->clk = clk; |
163 | |||
164 | return ret; | ||
165 | } | ||
166 | |||
167 | void rsnd_mod_quit(struct rsnd_mod *mod) | ||
168 | { | ||
169 | if (mod->clk) | ||
170 | clk_unprepare(mod->clk); | ||
158 | } | 171 | } |
159 | 172 | ||
160 | /* | 173 | /* |
@@ -1073,6 +1086,12 @@ static int rsnd_remove(struct platform_device *pdev) | |||
1073 | { | 1086 | { |
1074 | struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev); | 1087 | struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev); |
1075 | struct rsnd_dai *rdai; | 1088 | struct rsnd_dai *rdai; |
1089 | void (*remove_func[])(struct platform_device *pdev, | ||
1090 | struct rsnd_priv *priv) = { | ||
1091 | rsnd_ssi_remove, | ||
1092 | rsnd_src_remove, | ||
1093 | rsnd_dvc_remove, | ||
1094 | }; | ||
1076 | int ret = 0, i; | 1095 | int ret = 0, i; |
1077 | 1096 | ||
1078 | pm_runtime_disable(&pdev->dev); | 1097 | pm_runtime_disable(&pdev->dev); |
@@ -1082,6 +1101,9 @@ static int rsnd_remove(struct platform_device *pdev) | |||
1082 | ret |= rsnd_dai_call(remove, &rdai->capture, priv); | 1101 | ret |= rsnd_dai_call(remove, &rdai->capture, priv); |
1083 | } | 1102 | } |
1084 | 1103 | ||
1104 | for (i = 0; i < ARRAY_SIZE(remove_func); i++) | ||
1105 | remove_func[i](pdev, priv); | ||
1106 | |||
1085 | snd_soc_unregister_component(&pdev->dev); | 1107 | snd_soc_unregister_component(&pdev->dev); |
1086 | snd_soc_unregister_platform(&pdev->dev); | 1108 | snd_soc_unregister_platform(&pdev->dev); |
1087 | 1109 | ||
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 6d85e36c6c2b..aab45267e508 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c | |||
@@ -345,7 +345,7 @@ int rsnd_dvc_probe(struct platform_device *pdev, | |||
345 | struct rsnd_dvc *dvc; | 345 | struct rsnd_dvc *dvc; |
346 | struct clk *clk; | 346 | struct clk *clk; |
347 | char name[RSND_DVC_NAME_SIZE]; | 347 | char name[RSND_DVC_NAME_SIZE]; |
348 | int i, nr; | 348 | int i, nr, ret; |
349 | 349 | ||
350 | rsnd_of_parse_dvc(pdev, of_data, priv); | 350 | rsnd_of_parse_dvc(pdev, of_data, priv); |
351 | 351 | ||
@@ -378,11 +378,24 @@ int rsnd_dvc_probe(struct platform_device *pdev, | |||
378 | 378 | ||
379 | dvc->info = &info->dvc_info[i]; | 379 | dvc->info = &info->dvc_info[i]; |
380 | 380 | ||
381 | rsnd_mod_init(&dvc->mod, &rsnd_dvc_ops, | 381 | ret = rsnd_mod_init(&dvc->mod, &rsnd_dvc_ops, |
382 | clk, RSND_MOD_DVC, i); | 382 | clk, RSND_MOD_DVC, i); |
383 | if (ret) | ||
384 | return ret; | ||
383 | 385 | ||
384 | dev_dbg(dev, "CMD%d probed\n", i); | 386 | dev_dbg(dev, "CMD%d probed\n", i); |
385 | } | 387 | } |
386 | 388 | ||
387 | return 0; | 389 | return 0; |
388 | } | 390 | } |
391 | |||
392 | void rsnd_dvc_remove(struct platform_device *pdev, | ||
393 | struct rsnd_priv *priv) | ||
394 | { | ||
395 | struct rsnd_dvc *dvc; | ||
396 | int i; | ||
397 | |||
398 | for_each_rsnd_dvc(dvc, priv, i) { | ||
399 | rsnd_mod_quit(&dvc->mod); | ||
400 | } | ||
401 | } | ||
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 5f35af7ff821..f7af0be11558 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h | |||
@@ -285,14 +285,15 @@ struct rsnd_mod { | |||
285 | #define rsnd_mod_to_dma(mod) (&(mod)->dma) | 285 | #define rsnd_mod_to_dma(mod) (&(mod)->dma) |
286 | #define rsnd_mod_to_io(mod) ((mod)->io) | 286 | #define rsnd_mod_to_io(mod) ((mod)->io) |
287 | #define rsnd_mod_id(mod) ((mod)->id) | 287 | #define rsnd_mod_id(mod) ((mod)->id) |
288 | #define rsnd_mod_hw_start(mod) clk_prepare_enable((mod)->clk) | 288 | #define rsnd_mod_hw_start(mod) clk_enable((mod)->clk) |
289 | #define rsnd_mod_hw_stop(mod) clk_disable_unprepare((mod)->clk) | 289 | #define rsnd_mod_hw_stop(mod) clk_disable((mod)->clk) |
290 | 290 | ||
291 | void rsnd_mod_init(struct rsnd_mod *mod, | 291 | int rsnd_mod_init(struct rsnd_mod *mod, |
292 | struct rsnd_mod_ops *ops, | 292 | struct rsnd_mod_ops *ops, |
293 | struct clk *clk, | 293 | struct clk *clk, |
294 | enum rsnd_mod_type type, | 294 | enum rsnd_mod_type type, |
295 | int id); | 295 | int id); |
296 | void rsnd_mod_quit(struct rsnd_mod *mod); | ||
296 | char *rsnd_mod_name(struct rsnd_mod *mod); | 297 | char *rsnd_mod_name(struct rsnd_mod *mod); |
297 | struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod); | 298 | struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod); |
298 | 299 | ||
@@ -496,6 +497,8 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod, | |||
496 | int rsnd_src_probe(struct platform_device *pdev, | 497 | int rsnd_src_probe(struct platform_device *pdev, |
497 | const struct rsnd_of_data *of_data, | 498 | const struct rsnd_of_data *of_data, |
498 | struct rsnd_priv *priv); | 499 | struct rsnd_priv *priv); |
500 | void rsnd_src_remove(struct platform_device *pdev, | ||
501 | struct rsnd_priv *priv); | ||
499 | struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id); | 502 | struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id); |
500 | unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv, | 503 | unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv, |
501 | struct rsnd_dai_stream *io, | 504 | struct rsnd_dai_stream *io, |
@@ -514,6 +517,8 @@ int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod); | |||
514 | int rsnd_ssi_probe(struct platform_device *pdev, | 517 | int rsnd_ssi_probe(struct platform_device *pdev, |
515 | const struct rsnd_of_data *of_data, | 518 | const struct rsnd_of_data *of_data, |
516 | struct rsnd_priv *priv); | 519 | struct rsnd_priv *priv); |
520 | void rsnd_ssi_remove(struct platform_device *pdev, | ||
521 | struct rsnd_priv *priv); | ||
517 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id); | 522 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id); |
518 | int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod); | 523 | int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod); |
519 | int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod); | 524 | int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod); |
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index cc93f32b0de0..6099a8ee0007 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c | |||
@@ -867,7 +867,7 @@ int rsnd_src_probe(struct platform_device *pdev, | |||
867 | struct rsnd_mod_ops *ops; | 867 | struct rsnd_mod_ops *ops; |
868 | struct clk *clk; | 868 | struct clk *clk; |
869 | char name[RSND_SRC_NAME_SIZE]; | 869 | char name[RSND_SRC_NAME_SIZE]; |
870 | int i, nr; | 870 | int i, nr, ret; |
871 | 871 | ||
872 | ops = NULL; | 872 | ops = NULL; |
873 | if (rsnd_is_gen1(priv)) | 873 | if (rsnd_is_gen1(priv)) |
@@ -907,10 +907,23 @@ int rsnd_src_probe(struct platform_device *pdev, | |||
907 | 907 | ||
908 | src->info = &info->src_info[i]; | 908 | src->info = &info->src_info[i]; |
909 | 909 | ||
910 | rsnd_mod_init(&src->mod, ops, clk, RSND_MOD_SRC, i); | 910 | ret = rsnd_mod_init(&src->mod, ops, clk, RSND_MOD_SRC, i); |
911 | if (ret) | ||
912 | return ret; | ||
911 | 913 | ||
912 | dev_dbg(dev, "SRC%d probed\n", i); | 914 | dev_dbg(dev, "SRC%d probed\n", i); |
913 | } | 915 | } |
914 | 916 | ||
915 | return 0; | 917 | return 0; |
916 | } | 918 | } |
919 | |||
920 | void rsnd_src_remove(struct platform_device *pdev, | ||
921 | struct rsnd_priv *priv) | ||
922 | { | ||
923 | struct rsnd_src *src; | ||
924 | int i; | ||
925 | |||
926 | for_each_rsnd_src(src, priv, i) { | ||
927 | rsnd_mod_quit(&src->mod); | ||
928 | } | ||
929 | } | ||
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 060d3d205250..79dc7a3c78e6 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -710,7 +710,7 @@ int rsnd_ssi_probe(struct platform_device *pdev, | |||
710 | struct clk *clk; | 710 | struct clk *clk; |
711 | struct rsnd_ssi *ssi; | 711 | struct rsnd_ssi *ssi; |
712 | char name[RSND_SSI_NAME_SIZE]; | 712 | char name[RSND_SSI_NAME_SIZE]; |
713 | int i, nr; | 713 | int i, nr, ret; |
714 | 714 | ||
715 | rsnd_of_parse_ssi(pdev, of_data, priv); | 715 | rsnd_of_parse_ssi(pdev, of_data, priv); |
716 | 716 | ||
@@ -745,10 +745,23 @@ int rsnd_ssi_probe(struct platform_device *pdev, | |||
745 | else if (rsnd_ssi_pio_available(ssi)) | 745 | else if (rsnd_ssi_pio_available(ssi)) |
746 | ops = &rsnd_ssi_pio_ops; | 746 | ops = &rsnd_ssi_pio_ops; |
747 | 747 | ||
748 | rsnd_mod_init(&ssi->mod, ops, clk, RSND_MOD_SSI, i); | 748 | ret = rsnd_mod_init(&ssi->mod, ops, clk, RSND_MOD_SSI, i); |
749 | if (ret) | ||
750 | return ret; | ||
749 | 751 | ||
750 | rsnd_ssi_parent_clk_setup(priv, ssi); | 752 | rsnd_ssi_parent_clk_setup(priv, ssi); |
751 | } | 753 | } |
752 | 754 | ||
753 | return 0; | 755 | return 0; |
754 | } | 756 | } |
757 | |||
758 | void rsnd_ssi_remove(struct platform_device *pdev, | ||
759 | struct rsnd_priv *priv) | ||
760 | { | ||
761 | struct rsnd_ssi *ssi; | ||
762 | int i; | ||
763 | |||
764 | for_each_rsnd_ssi(ssi, priv, i) { | ||
765 | rsnd_mod_quit(&ssi->mod); | ||
766 | } | ||
767 | } | ||