aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/adav80x.c4
-rw-r--r--sound/soc/codecs/ak4535.c31
-rw-r--r--sound/soc/codecs/ak4641.c33
-rw-r--r--sound/soc/codecs/ak4642.c16
-rw-r--r--sound/soc/codecs/wm_adsp.c86
5 files changed, 49 insertions, 121 deletions
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index ce3cdca9fc62..b67480f1b1aa 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -212,7 +212,7 @@ static const struct snd_soc_dapm_widget adav80x_dapm_widgets[] = {
212static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source, 212static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source,
213 struct snd_soc_dapm_widget *sink) 213 struct snd_soc_dapm_widget *sink)
214{ 214{
215 struct snd_soc_codec *codec = source->codec; 215 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
216 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); 216 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
217 const char *clk; 217 const char *clk;
218 218
@@ -236,7 +236,7 @@ static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source,
236static int adav80x_dapm_pll_check(struct snd_soc_dapm_widget *source, 236static int adav80x_dapm_pll_check(struct snd_soc_dapm_widget *source,
237 struct snd_soc_dapm_widget *sink) 237 struct snd_soc_dapm_widget *sink)
238{ 238{
239 struct snd_soc_codec *codec = source->codec; 239 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
240 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); 240 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
241 241
242 return adav80x->pll_src == ADAV80X_PLL_SRC_XTAL; 242 return adav80x->pll_src == ADAV80X_PLL_SRC_XTAL;
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index 30e297890fec..9130d916f2f4 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -373,33 +373,9 @@ static struct snd_soc_dai_driver ak4535_dai = {
373 .ops = &ak4535_dai_ops, 373 .ops = &ak4535_dai_ops,
374}; 374};
375 375
376static int ak4535_suspend(struct snd_soc_codec *codec)
377{
378 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
379 return 0;
380}
381
382static int ak4535_resume(struct snd_soc_codec *codec) 376static int ak4535_resume(struct snd_soc_codec *codec)
383{ 377{
384 snd_soc_cache_sync(codec); 378 snd_soc_cache_sync(codec);
385 ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
386 return 0;
387}
388
389static int ak4535_probe(struct snd_soc_codec *codec)
390{
391 /* power on device */
392 ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
393
394 snd_soc_add_codec_controls(codec, ak4535_snd_controls,
395 ARRAY_SIZE(ak4535_snd_controls));
396 return 0;
397}
398
399/* power down chip */
400static int ak4535_remove(struct snd_soc_codec *codec)
401{
402 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
403 return 0; 379 return 0;
404} 380}
405 381
@@ -416,11 +392,12 @@ static const struct regmap_config ak4535_regmap = {
416}; 392};
417 393
418static struct snd_soc_codec_driver soc_codec_dev_ak4535 = { 394static struct snd_soc_codec_driver soc_codec_dev_ak4535 = {
419 .probe = ak4535_probe,
420 .remove = ak4535_remove,
421 .suspend = ak4535_suspend,
422 .resume = ak4535_resume, 395 .resume = ak4535_resume,
423 .set_bias_level = ak4535_set_bias_level, 396 .set_bias_level = ak4535_set_bias_level,
397 .suspend_bias_off = true,
398
399 .controls = ak4535_snd_controls,
400 .num_controls = ARRAY_SIZE(ak4535_snd_controls),
424 .dapm_widgets = ak4535_dapm_widgets, 401 .dapm_widgets = ak4535_dapm_widgets,
425 .num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets), 402 .num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets),
426 .dapm_routes = ak4535_audio_map, 403 .dapm_routes = ak4535_audio_map,
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index 7afe8f482088..70861c7b1631 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -505,39 +505,7 @@ static struct snd_soc_dai_driver ak4641_dai[] = {
505}, 505},
506}; 506};
507 507
508static int ak4641_suspend(struct snd_soc_codec *codec)
509{
510 ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF);
511 return 0;
512}
513
514static int ak4641_resume(struct snd_soc_codec *codec)
515{
516 ak4641_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
517 return 0;
518}
519
520static int ak4641_probe(struct snd_soc_codec *codec)
521{
522 /* power on device */
523 ak4641_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
524
525 return 0;
526}
527
528static int ak4641_remove(struct snd_soc_codec *codec)
529{
530 ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF);
531
532 return 0;
533}
534
535
536static struct snd_soc_codec_driver soc_codec_dev_ak4641 = { 508static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
537 .probe = ak4641_probe,
538 .remove = ak4641_remove,
539 .suspend = ak4641_suspend,
540 .resume = ak4641_resume,
541 .controls = ak4641_snd_controls, 509 .controls = ak4641_snd_controls,
542 .num_controls = ARRAY_SIZE(ak4641_snd_controls), 510 .num_controls = ARRAY_SIZE(ak4641_snd_controls),
543 .dapm_widgets = ak4641_dapm_widgets, 511 .dapm_widgets = ak4641_dapm_widgets,
@@ -545,6 +513,7 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
545 .dapm_routes = ak4641_audio_map, 513 .dapm_routes = ak4641_audio_map,
546 .num_dapm_routes = ARRAY_SIZE(ak4641_audio_map), 514 .num_dapm_routes = ARRAY_SIZE(ak4641_audio_map),
547 .set_bias_level = ak4641_set_bias_level, 515 .set_bias_level = ak4641_set_bias_level,
516 .suspend_bias_off = true,
548}; 517};
549 518
550static const struct regmap_config ak4641_regmap = { 519static const struct regmap_config ak4641_regmap = {
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index 041712592e29..dde8b49c19ad 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -491,23 +491,7 @@ static int ak4642_resume(struct snd_soc_codec *codec)
491 return 0; 491 return 0;
492} 492}
493 493
494
495static int ak4642_probe(struct snd_soc_codec *codec)
496{
497 ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
498
499 return 0;
500}
501
502static int ak4642_remove(struct snd_soc_codec *codec)
503{
504 ak4642_set_bias_level(codec, SND_SOC_BIAS_OFF);
505 return 0;
506}
507
508static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { 494static struct snd_soc_codec_driver soc_codec_dev_ak4642 = {
509 .probe = ak4642_probe,
510 .remove = ak4642_remove,
511 .resume = ak4642_resume, 495 .resume = ak4642_resume,
512 .set_bias_level = ak4642_set_bias_level, 496 .set_bias_level = ak4642_set_bias_level,
513 .controls = ak4642_snd_controls, 497 .controls = ak4642_snd_controls,
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index cce9020933c6..720d6e852986 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -21,6 +21,7 @@
21#include <linux/regmap.h> 21#include <linux/regmap.h>
22#include <linux/regulator/consumer.h> 22#include <linux/regulator/consumer.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/vmalloc.h>
24#include <linux/workqueue.h> 25#include <linux/workqueue.h>
25#include <sound/core.h> 26#include <sound/core.h>
26#include <sound/pcm.h> 27#include <sound/pcm.h>
@@ -169,11 +170,12 @@ static struct wm_adsp_buf *wm_adsp_buf_alloc(const void *src, size_t len,
169 if (buf == NULL) 170 if (buf == NULL)
170 return NULL; 171 return NULL;
171 172
172 buf->buf = kmemdup(src, len, GFP_KERNEL | GFP_DMA); 173 buf->buf = vmalloc(len);
173 if (!buf->buf) { 174 if (!buf->buf) {
174 kfree(buf); 175 vfree(buf);
175 return NULL; 176 return NULL;
176 } 177 }
178 memcpy(buf->buf, src, len);
177 179
178 if (list) 180 if (list)
179 list_add_tail(&buf->list, list); 181 list_add_tail(&buf->list, list);
@@ -188,7 +190,7 @@ static void wm_adsp_buf_free(struct list_head *list)
188 struct wm_adsp_buf, 190 struct wm_adsp_buf,
189 list); 191 list);
190 list_del(&buf->list); 192 list_del(&buf->list);
191 kfree(buf->buf); 193 vfree(buf->buf);
192 kfree(buf); 194 kfree(buf);
193 } 195 }
194} 196}
@@ -684,38 +686,24 @@ static int wm_adsp_load(struct wm_adsp *dsp)
684 } 686 }
685 687
686 if (reg) { 688 if (reg) {
687 size_t to_write = PAGE_SIZE; 689 buf = wm_adsp_buf_alloc(region->data,
688 size_t remain = le32_to_cpu(region->len); 690 le32_to_cpu(region->len),
689 const u8 *data = region->data; 691 &buf_list);
690 692 if (!buf) {
691 while (remain > 0) { 693 adsp_err(dsp, "Out of memory\n");
692 if (remain < PAGE_SIZE) 694 ret = -ENOMEM;
693 to_write = remain; 695 goto out_fw;
694 696 }
695 buf = wm_adsp_buf_alloc(data,
696 to_write,
697 &buf_list);
698 if (!buf) {
699 adsp_err(dsp, "Out of memory\n");
700 ret = -ENOMEM;
701 goto out_fw;
702 }
703
704 ret = regmap_raw_write_async(regmap, reg,
705 buf->buf,
706 to_write);
707 if (ret != 0) {
708 adsp_err(dsp,
709 "%s.%d: Failed to write %zd bytes at %d in %s: %d\n",
710 file, regions,
711 to_write, offset,
712 region_name, ret);
713 goto out_fw;
714 }
715 697
716 data += to_write; 698 ret = regmap_raw_write_async(regmap, reg, buf->buf,
717 reg += to_write / 2; 699 le32_to_cpu(region->len));
718 remain -= to_write; 700 if (ret != 0) {
701 adsp_err(dsp,
702 "%s.%d: Failed to write %d bytes at %d in %s: %d\n",
703 file, regions,
704 le32_to_cpu(region->len), offset,
705 region_name, ret);
706 goto out_fw;
719 } 707 }
720 } 708 }
721 709
@@ -1065,8 +1053,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1065 be32_to_cpu(adsp1_alg[i].zm)); 1053 be32_to_cpu(adsp1_alg[i].zm));
1066 1054
1067 region = kzalloc(sizeof(*region), GFP_KERNEL); 1055 region = kzalloc(sizeof(*region), GFP_KERNEL);
1068 if (!region) 1056 if (!region) {
1069 return -ENOMEM; 1057 ret = -ENOMEM;
1058 goto out;
1059 }
1070 region->type = WMFW_ADSP1_DM; 1060 region->type = WMFW_ADSP1_DM;
1071 region->alg = be32_to_cpu(adsp1_alg[i].alg.id); 1061 region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
1072 region->base = be32_to_cpu(adsp1_alg[i].dm); 1062 region->base = be32_to_cpu(adsp1_alg[i].dm);
@@ -1083,8 +1073,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1083 } 1073 }
1084 1074
1085 region = kzalloc(sizeof(*region), GFP_KERNEL); 1075 region = kzalloc(sizeof(*region), GFP_KERNEL);
1086 if (!region) 1076 if (!region) {
1087 return -ENOMEM; 1077 ret = -ENOMEM;
1078 goto out;
1079 }
1088 region->type = WMFW_ADSP1_ZM; 1080 region->type = WMFW_ADSP1_ZM;
1089 region->alg = be32_to_cpu(adsp1_alg[i].alg.id); 1081 region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
1090 region->base = be32_to_cpu(adsp1_alg[i].zm); 1082 region->base = be32_to_cpu(adsp1_alg[i].zm);
@@ -1113,8 +1105,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1113 be32_to_cpu(adsp2_alg[i].zm)); 1105 be32_to_cpu(adsp2_alg[i].zm));
1114 1106
1115 region = kzalloc(sizeof(*region), GFP_KERNEL); 1107 region = kzalloc(sizeof(*region), GFP_KERNEL);
1116 if (!region) 1108 if (!region) {
1117 return -ENOMEM; 1109 ret = -ENOMEM;
1110 goto out;
1111 }
1118 region->type = WMFW_ADSP2_XM; 1112 region->type = WMFW_ADSP2_XM;
1119 region->alg = be32_to_cpu(adsp2_alg[i].alg.id); 1113 region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
1120 region->base = be32_to_cpu(adsp2_alg[i].xm); 1114 region->base = be32_to_cpu(adsp2_alg[i].xm);
@@ -1131,8 +1125,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1131 } 1125 }
1132 1126
1133 region = kzalloc(sizeof(*region), GFP_KERNEL); 1127 region = kzalloc(sizeof(*region), GFP_KERNEL);
1134 if (!region) 1128 if (!region) {
1135 return -ENOMEM; 1129 ret = -ENOMEM;
1130 goto out;
1131 }
1136 region->type = WMFW_ADSP2_YM; 1132 region->type = WMFW_ADSP2_YM;
1137 region->alg = be32_to_cpu(adsp2_alg[i].alg.id); 1133 region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
1138 region->base = be32_to_cpu(adsp2_alg[i].ym); 1134 region->base = be32_to_cpu(adsp2_alg[i].ym);
@@ -1149,8 +1145,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
1149 } 1145 }
1150 1146
1151 region = kzalloc(sizeof(*region), GFP_KERNEL); 1147 region = kzalloc(sizeof(*region), GFP_KERNEL);
1152 if (!region) 1148 if (!region) {
1153 return -ENOMEM; 1149 ret = -ENOMEM;
1150 goto out;
1151 }
1154 region->type = WMFW_ADSP2_ZM; 1152 region->type = WMFW_ADSP2_ZM;
1155 region->alg = be32_to_cpu(adsp2_alg[i].alg.id); 1153 region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
1156 region->base = be32_to_cpu(adsp2_alg[i].zm); 1154 region->base = be32_to_cpu(adsp2_alg[i].zm);