Merge remote-tracking branches 'asoc/topic/adav80x', 'asoc/topic/adsp', 'asoc/topic/ak4535', 'asoc/topic/ak4641' and 'asoc/topic/ak4642' into asoc-next
This commit is contained in:
commit
4aad340f1b
|
@ -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,
|
||||
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);
|
||||
const char *clk;
|
||||
|
||||
|
@ -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,
|
||||
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);
|
||||
|
||||
return adav80x->pll_src == ADAV80X_PLL_SRC_XTAL;
|
||||
|
|
|
@ -373,33 +373,9 @@ static struct snd_soc_dai_driver ak4535_dai = {
|
|||
.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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -416,11 +392,12 @@ static const struct regmap_config ak4535_regmap = {
|
|||
};
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_ak4535 = {
|
||||
.probe = ak4535_probe,
|
||||
.remove = ak4535_remove,
|
||||
.suspend = ak4535_suspend,
|
||||
.resume = ak4535_resume,
|
||||
.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,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets),
|
||||
.dapm_routes = ak4535_audio_map,
|
||||
|
|
|
@ -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 = {
|
||||
.probe = ak4641_probe,
|
||||
.remove = ak4641_remove,
|
||||
.suspend = ak4641_suspend,
|
||||
.resume = ak4641_resume,
|
||||
.controls = ak4641_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(ak4641_snd_controls),
|
||||
.dapm_widgets = ak4641_dapm_widgets,
|
||||
|
@ -545,6 +513,7 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
|
|||
.dapm_routes = ak4641_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(ak4641_audio_map),
|
||||
.set_bias_level = ak4641_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
};
|
||||
|
||||
static const struct regmap_config ak4641_regmap = {
|
||||
|
|
|
@ -491,23 +491,7 @@ static int ak4642_resume(struct snd_soc_codec *codec)
|
|||
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 = {
|
||||
.probe = ak4642_probe,
|
||||
.remove = ak4642_remove,
|
||||
.resume = ak4642_resume,
|
||||
.set_bias_level = ak4642_set_bias_level,
|
||||
.controls = ak4642_snd_controls,
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
|
@ -169,11 +170,12 @@ static struct wm_adsp_buf *wm_adsp_buf_alloc(const void *src, size_t len,
|
|||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
||||
buf->buf = kmemdup(src, len, GFP_KERNEL | GFP_DMA);
|
||||
buf->buf = vmalloc(len);
|
||||
if (!buf->buf) {
|
||||
kfree(buf);
|
||||
vfree(buf);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(buf->buf, src, len);
|
||||
|
||||
if (list)
|
||||
list_add_tail(&buf->list, list);
|
||||
|
@ -188,7 +190,7 @@ static void wm_adsp_buf_free(struct list_head *list)
|
|||
struct wm_adsp_buf,
|
||||
list);
|
||||
list_del(&buf->list);
|
||||
kfree(buf->buf);
|
||||
vfree(buf->buf);
|
||||
kfree(buf);
|
||||
}
|
||||
}
|
||||
|
@ -684,38 +686,24 @@ static int wm_adsp_load(struct wm_adsp *dsp)
|
|||
}
|
||||
|
||||
if (reg) {
|
||||
size_t to_write = PAGE_SIZE;
|
||||
size_t remain = le32_to_cpu(region->len);
|
||||
const u8 *data = region->data;
|
||||
buf = wm_adsp_buf_alloc(region->data,
|
||||
le32_to_cpu(region->len),
|
||||
&buf_list);
|
||||
if (!buf) {
|
||||
adsp_err(dsp, "Out of memory\n");
|
||||
ret = -ENOMEM;
|
||||
goto out_fw;
|
||||
}
|
||||
|
||||
while (remain > 0) {
|
||||
if (remain < PAGE_SIZE)
|
||||
to_write = remain;
|
||||
|
||||
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;
|
||||
reg += to_write / 2;
|
||||
remain -= to_write;
|
||||
ret = regmap_raw_write_async(regmap, reg, buf->buf,
|
||||
le32_to_cpu(region->len));
|
||||
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)
|
|||
be32_to_cpu(adsp1_alg[i].zm));
|
||||
|
||||
region = kzalloc(sizeof(*region), GFP_KERNEL);
|
||||
if (!region)
|
||||
return -ENOMEM;
|
||||
if (!region) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
region->type = WMFW_ADSP1_DM;
|
||||
region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
|
||||
region->base = be32_to_cpu(adsp1_alg[i].dm);
|
||||
|
@ -1083,8 +1073,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
|
|||
}
|
||||
|
||||
region = kzalloc(sizeof(*region), GFP_KERNEL);
|
||||
if (!region)
|
||||
return -ENOMEM;
|
||||
if (!region) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
region->type = WMFW_ADSP1_ZM;
|
||||
region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
|
||||
region->base = be32_to_cpu(adsp1_alg[i].zm);
|
||||
|
@ -1113,8 +1105,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
|
|||
be32_to_cpu(adsp2_alg[i].zm));
|
||||
|
||||
region = kzalloc(sizeof(*region), GFP_KERNEL);
|
||||
if (!region)
|
||||
return -ENOMEM;
|
||||
if (!region) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
region->type = WMFW_ADSP2_XM;
|
||||
region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
|
||||
region->base = be32_to_cpu(adsp2_alg[i].xm);
|
||||
|
@ -1131,8 +1125,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
|
|||
}
|
||||
|
||||
region = kzalloc(sizeof(*region), GFP_KERNEL);
|
||||
if (!region)
|
||||
return -ENOMEM;
|
||||
if (!region) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
region->type = WMFW_ADSP2_YM;
|
||||
region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
|
||||
region->base = be32_to_cpu(adsp2_alg[i].ym);
|
||||
|
@ -1149,8 +1145,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
|
|||
}
|
||||
|
||||
region = kzalloc(sizeof(*region), GFP_KERNEL);
|
||||
if (!region)
|
||||
return -ENOMEM;
|
||||
if (!region) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
region->type = WMFW_ADSP2_ZM;
|
||||
region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
|
||||
region->base = be32_to_cpu(adsp2_alg[i].zm);
|
||||
|
|
Loading…
Reference in New Issue