Commit 4aad340f authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/adav80x', 'asoc/topic/adsp',...

Merge remote-tracking branches 'asoc/topic/adav80x', 'asoc/topic/adsp', 'asoc/topic/ak4535', 'asoc/topic/ak4641' and 'asoc/topic/ak4642' into asoc-next
...@@ -212,7 +212,7 @@ static const struct snd_soc_dapm_widget adav80x_dapm_widgets[] = { ...@@ -212,7 +212,7 @@ static const struct snd_soc_dapm_widget adav80x_dapm_widgets[] = {
static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source, static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink) struct snd_soc_dapm_widget *sink)
{ {
struct snd_soc_codec *codec = source->codec; struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
const char *clk; const char *clk;
...@@ -236,7 +236,7 @@ static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source, ...@@ -236,7 +236,7 @@ static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source,
static int adav80x_dapm_pll_check(struct snd_soc_dapm_widget *source, static int adav80x_dapm_pll_check(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink) struct snd_soc_dapm_widget *sink)
{ {
struct snd_soc_codec *codec = source->codec; struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
return adav80x->pll_src == ADAV80X_PLL_SRC_XTAL; return adav80x->pll_src == ADAV80X_PLL_SRC_XTAL;
......
...@@ -373,33 +373,9 @@ static struct snd_soc_dai_driver ak4535_dai = { ...@@ -373,33 +373,9 @@ static struct snd_soc_dai_driver ak4535_dai = {
.ops = &ak4535_dai_ops, .ops = &ak4535_dai_ops,
}; };
static int ak4535_suspend(struct snd_soc_codec *codec)
{
ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static int ak4535_resume(struct snd_soc_codec *codec) static int ak4535_resume(struct snd_soc_codec *codec)
{ {
snd_soc_cache_sync(codec); snd_soc_cache_sync(codec);
ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
}
static int ak4535_probe(struct snd_soc_codec *codec)
{
/* power on device */
ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
snd_soc_add_codec_controls(codec, ak4535_snd_controls,
ARRAY_SIZE(ak4535_snd_controls));
return 0;
}
/* power down chip */
static int ak4535_remove(struct snd_soc_codec *codec)
{
ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0; return 0;
} }
...@@ -416,11 +392,12 @@ static const struct regmap_config ak4535_regmap = { ...@@ -416,11 +392,12 @@ static const struct regmap_config ak4535_regmap = {
}; };
static struct snd_soc_codec_driver soc_codec_dev_ak4535 = { static struct snd_soc_codec_driver soc_codec_dev_ak4535 = {
.probe = ak4535_probe,
.remove = ak4535_remove,
.suspend = ak4535_suspend,
.resume = ak4535_resume, .resume = ak4535_resume,
.set_bias_level = ak4535_set_bias_level, .set_bias_level = ak4535_set_bias_level,
.suspend_bias_off = true,
.controls = ak4535_snd_controls,
.num_controls = ARRAY_SIZE(ak4535_snd_controls),
.dapm_widgets = ak4535_dapm_widgets, .dapm_widgets = ak4535_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets),
.dapm_routes = ak4535_audio_map, .dapm_routes = ak4535_audio_map,
......
...@@ -505,39 +505,7 @@ static struct snd_soc_dai_driver ak4641_dai[] = { ...@@ -505,39 +505,7 @@ static struct snd_soc_dai_driver ak4641_dai[] = {
}, },
}; };
static int ak4641_suspend(struct snd_soc_codec *codec)
{
ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static int ak4641_resume(struct snd_soc_codec *codec)
{
ak4641_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
}
static int ak4641_probe(struct snd_soc_codec *codec)
{
/* power on device */
ak4641_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
}
static int ak4641_remove(struct snd_soc_codec *codec)
{
ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static struct snd_soc_codec_driver soc_codec_dev_ak4641 = { static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
.probe = ak4641_probe,
.remove = ak4641_remove,
.suspend = ak4641_suspend,
.resume = ak4641_resume,
.controls = ak4641_snd_controls, .controls = ak4641_snd_controls,
.num_controls = ARRAY_SIZE(ak4641_snd_controls), .num_controls = ARRAY_SIZE(ak4641_snd_controls),
.dapm_widgets = ak4641_dapm_widgets, .dapm_widgets = ak4641_dapm_widgets,
...@@ -545,6 +513,7 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4641 = { ...@@ -545,6 +513,7 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
.dapm_routes = ak4641_audio_map, .dapm_routes = ak4641_audio_map,
.num_dapm_routes = ARRAY_SIZE(ak4641_audio_map), .num_dapm_routes = ARRAY_SIZE(ak4641_audio_map),
.set_bias_level = ak4641_set_bias_level, .set_bias_level = ak4641_set_bias_level,
.suspend_bias_off = true,
}; };
static const struct regmap_config ak4641_regmap = { static const struct regmap_config ak4641_regmap = {
......
...@@ -491,23 +491,7 @@ static int ak4642_resume(struct snd_soc_codec *codec) ...@@ -491,23 +491,7 @@ static int ak4642_resume(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int ak4642_probe(struct snd_soc_codec *codec)
{
ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
}
static int ak4642_remove(struct snd_soc_codec *codec)
{
ak4642_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { static struct snd_soc_codec_driver soc_codec_dev_ak4642 = {
.probe = ak4642_probe,
.remove = ak4642_remove,
.resume = ak4642_resume, .resume = ak4642_resume,
.set_bias_level = ak4642_set_bias_level, .set_bias_level = ak4642_set_bias_level,
.controls = ak4642_snd_controls, .controls = ak4642_snd_controls,
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/pcm.h> #include <sound/pcm.h>
...@@ -169,11 +170,12 @@ static struct wm_adsp_buf *wm_adsp_buf_alloc(const void *src, size_t len, ...@@ -169,11 +170,12 @@ static struct wm_adsp_buf *wm_adsp_buf_alloc(const void *src, size_t len,
if (buf == NULL) if (buf == NULL)
return NULL; return NULL;
buf->buf = kmemdup(src, len, GFP_KERNEL | GFP_DMA); buf->buf = vmalloc(len);
if (!buf->buf) { if (!buf->buf) {
kfree(buf); vfree(buf);
return NULL; return NULL;
} }
memcpy(buf->buf, src, len);
if (list) if (list)
list_add_tail(&buf->list, list); list_add_tail(&buf->list, list);
...@@ -188,7 +190,7 @@ static void wm_adsp_buf_free(struct list_head *list) ...@@ -188,7 +190,7 @@ static void wm_adsp_buf_free(struct list_head *list)
struct wm_adsp_buf, struct wm_adsp_buf,
list); list);
list_del(&buf->list); list_del(&buf->list);
kfree(buf->buf); vfree(buf->buf);
kfree(buf); kfree(buf);
} }
} }
...@@ -684,38 +686,24 @@ static int wm_adsp_load(struct wm_adsp *dsp) ...@@ -684,38 +686,24 @@ static int wm_adsp_load(struct wm_adsp *dsp)
} }
if (reg) { if (reg) {
size_t to_write = PAGE_SIZE; buf = wm_adsp_buf_alloc(region->data,
size_t remain = le32_to_cpu(region->len); le32_to_cpu(region->len),
const u8 *data = region->data; &buf_list);
if (!buf) {
while (remain > 0) { adsp_err(dsp, "Out of memory\n");
if (remain < PAGE_SIZE) ret = -ENOMEM;
to_write = remain; goto out_fw;
}
buf = wm_adsp_buf_alloc(data,
to_write,
&buf_list);
if (!buf) {
adsp_err(dsp, "Out of memory\n");
ret = -ENOMEM;
goto out_fw;
}
ret = regmap_raw_write_async(regmap, reg,
buf->buf,
to_write);
if (ret != 0) {
adsp_err(dsp,
"%s.%d: Failed to write %zd bytes at %d in %s: %d\n",
file, regions,
to_write, offset,
region_name, ret);
goto out_fw;
}
data += to_write; ret = regmap_raw_write_async(regmap, reg, buf->buf,
reg += to_write / 2; le32_to_cpu(region->len));
remain -= to_write; if (ret != 0) {
adsp_err(dsp,
"%s.%d: Failed to write %d bytes at %d in %s: %d\n",
file, regions,
le32_to_cpu(region->len), offset,
region_name, ret);
goto out_fw;
} }
} }
...@@ -1065,8 +1053,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1065,8 +1053,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
be32_to_cpu(adsp1_alg[i].zm)); be32_to_cpu(adsp1_alg[i].zm));
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP1_DM; region->type = WMFW_ADSP1_DM;
region->alg = be32_to_cpu(adsp1_alg[i].alg.id); region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
region->base = be32_to_cpu(adsp1_alg[i].dm); region->base = be32_to_cpu(adsp1_alg[i].dm);
...@@ -1083,8 +1073,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1083,8 +1073,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
} }
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP1_ZM; region->type = WMFW_ADSP1_ZM;
region->alg = be32_to_cpu(adsp1_alg[i].alg.id); region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
region->base = be32_to_cpu(adsp1_alg[i].zm); region->base = be32_to_cpu(adsp1_alg[i].zm);
...@@ -1113,8 +1105,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1113,8 +1105,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
be32_to_cpu(adsp2_alg[i].zm)); be32_to_cpu(adsp2_alg[i].zm));
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP2_XM; region->type = WMFW_ADSP2_XM;
region->alg = be32_to_cpu(adsp2_alg[i].alg.id); region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
region->base = be32_to_cpu(adsp2_alg[i].xm); region->base = be32_to_cpu(adsp2_alg[i].xm);
...@@ -1131,8 +1125,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1131,8 +1125,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
} }
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP2_YM; region->type = WMFW_ADSP2_YM;
region->alg = be32_to_cpu(adsp2_alg[i].alg.id); region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
region->base = be32_to_cpu(adsp2_alg[i].ym); region->base = be32_to_cpu(adsp2_alg[i].ym);
...@@ -1149,8 +1145,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1149,8 +1145,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
} }
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP2_ZM; region->type = WMFW_ADSP2_ZM;
region->alg = be32_to_cpu(adsp2_alg[i].alg.id); region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
region->base = be32_to_cpu(adsp2_alg[i].zm); region->base = be32_to_cpu(adsp2_alg[i].zm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment