Commit 74d01b14 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/fix/cs4270', 'asoc/fix/da7219',...

Merge remote-tracking branches 'asoc/fix/cs4270', 'asoc/fix/da7219', 'asoc/fix/hdmi-codec', 'asoc/fix/pxa', 'asoc/fix/qcom' and 'asoc/fix/rt298' into asoc-linus
...@@ -148,11 +148,11 @@ SND_SOC_DAPM_OUTPUT("AOUTR"), ...@@ -148,11 +148,11 @@ SND_SOC_DAPM_OUTPUT("AOUTR"),
}; };
static const struct snd_soc_dapm_route cs4270_dapm_routes[] = { static const struct snd_soc_dapm_route cs4270_dapm_routes[] = {
{ "Capture", NULL, "AINA" }, { "Capture", NULL, "AINL" },
{ "Capture", NULL, "AINB" }, { "Capture", NULL, "AINR" },
{ "AOUTA", NULL, "Playback" }, { "AOUTL", NULL, "Playback" },
{ "AOUTB", NULL, "Playback" }, { "AOUTR", NULL, "Playback" },
}; };
/** /**
......
...@@ -880,7 +880,8 @@ static const struct snd_soc_dapm_widget da7219_dapm_widgets[] = { ...@@ -880,7 +880,8 @@ static const struct snd_soc_dapm_widget da7219_dapm_widgets[] = {
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
/* DAI */ /* DAI */
SND_SOC_DAPM_AIF_OUT("DAIOUT", "Capture", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_OUT("DAIOUT", "Capture", 0, DA7219_DAI_TDM_CTRL,
DA7219_DAI_OE_SHIFT, DA7219_NO_INVERT),
SND_SOC_DAPM_AIF_IN("DAIIN", "Playback", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_IN("DAIIN", "Playback", 0, SND_SOC_NOPM, 0, 0),
/* Output Muxes */ /* Output Muxes */
......
...@@ -364,7 +364,12 @@ static int hdmi_of_xlate_dai_name(struct snd_soc_component *component, ...@@ -364,7 +364,12 @@ static int hdmi_of_xlate_dai_name(struct snd_soc_component *component,
struct of_phandle_args *args, struct of_phandle_args *args,
const char **dai_name) const char **dai_name)
{ {
int id = args->args[0]; int id;
if (args->args_count)
id = args->args[0];
else
id = 0;
if (id < ARRAY_SIZE(hdmi_dai_name)) { if (id < ARRAY_SIZE(hdmi_dai_name)) {
*dai_name = hdmi_dai_name[id]; *dai_name = hdmi_dai_name[id];
......
...@@ -249,6 +249,11 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic) ...@@ -249,6 +249,11 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic)
snd_soc_dapm_force_enable_pin(dapm, "LDO1"); snd_soc_dapm_force_enable_pin(dapm, "LDO1");
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
regmap_update_bits(rt298->regmap,
RT298_POWER_CTRL1, 0x1001, 0);
regmap_update_bits(rt298->regmap,
RT298_POWER_CTRL2, 0x4, 0x4);
regmap_write(rt298->regmap, RT298_SET_MIC1, 0x24); regmap_write(rt298->regmap, RT298_SET_MIC1, 0x24);
msleep(50); msleep(50);
......
...@@ -208,7 +208,7 @@ config SND_PXA2XX_SOC_IMOTE2 ...@@ -208,7 +208,7 @@ config SND_PXA2XX_SOC_IMOTE2
config SND_MMP_SOC_BROWNSTONE config SND_MMP_SOC_BROWNSTONE
tristate "SoC Audio support for Marvell Brownstone" tristate "SoC Audio support for Marvell Brownstone"
depends on SND_MMP_SOC && MACH_BROWNSTONE depends on SND_MMP_SOC && MACH_BROWNSTONE && I2C
select SND_MMP_SOC_SSPA select SND_MMP_SOC_SSPA
select MFD_WM8994 select MFD_WM8994
select SND_SOC_WM8994 select SND_SOC_WM8994
......
...@@ -586,3 +586,6 @@ int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev) ...@@ -586,3 +586,6 @@ int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_remove); EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_remove);
MODULE_DESCRIPTION("QTi LPASS CPU Driver");
MODULE_LICENSE("GPL v2");
...@@ -61,7 +61,40 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) ...@@ -61,7 +61,40 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
int ret; struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
struct lpass_data *drvdata =
snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_variant *v = drvdata->variant;
int ret, dma_ch, dir = substream->stream;
struct lpass_pcm_data *data;
data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->i2s_port = cpu_dai->driver->id;
runtime->private_data = data;
if (v->alloc_dma_channel)
dma_ch = v->alloc_dma_channel(drvdata, dir);
if (dma_ch < 0)
return dma_ch;
drvdata->substream[dma_ch] = substream;
ret = regmap_write(drvdata->lpaif_map,
LPAIF_DMACTL_REG(v, dma_ch, dir), 0);
if (ret) {
dev_err(soc_runtime->dev,
"%s() error writing to rdmactl reg: %d\n",
__func__, ret);
return ret;
}
if (dir == SNDRV_PCM_STREAM_PLAYBACK)
data->rdma_ch = dma_ch;
else
data->wrdma_ch = dma_ch;
snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware); snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware);
...@@ -80,13 +113,40 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) ...@@ -80,13 +113,40 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
struct lpass_data *drvdata =
snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_variant *v = drvdata->variant;
struct lpass_pcm_data *data;
int dma_ch, dir = substream->stream;
data = runtime->private_data;
v = drvdata->variant;
if (dir == SNDRV_PCM_STREAM_PLAYBACK)
dma_ch = data->rdma_ch;
else
dma_ch = data->wrdma_ch;
drvdata->substream[dma_ch] = NULL;
if (v->free_dma_channel)
v->free_dma_channel(drvdata, dma_ch);
return 0;
}
static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream, static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
struct lpass_data *drvdata = struct lpass_data *drvdata =
snd_soc_platform_get_drvdata(soc_runtime->platform); snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_pcm_data *pcm_data = drvdata->private_data; struct snd_pcm_runtime *rt = substream->runtime;
struct lpass_pcm_data *pcm_data = rt->private_data;
struct lpass_variant *v = drvdata->variant; struct lpass_variant *v = drvdata->variant;
snd_pcm_format_t format = params_format(params); snd_pcm_format_t format = params_format(params);
unsigned int channels = params_channels(params); unsigned int channels = params_channels(params);
...@@ -179,7 +239,8 @@ static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream) ...@@ -179,7 +239,8 @@ static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
struct lpass_data *drvdata = struct lpass_data *drvdata =
snd_soc_platform_get_drvdata(soc_runtime->platform); snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_pcm_data *pcm_data = drvdata->private_data; struct snd_pcm_runtime *rt = substream->runtime;
struct lpass_pcm_data *pcm_data = rt->private_data;
struct lpass_variant *v = drvdata->variant; struct lpass_variant *v = drvdata->variant;
unsigned int reg; unsigned int reg;
int ret; int ret;
...@@ -203,7 +264,8 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream) ...@@ -203,7 +264,8 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
struct lpass_data *drvdata = struct lpass_data *drvdata =
snd_soc_platform_get_drvdata(soc_runtime->platform); snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_pcm_data *pcm_data = drvdata->private_data; struct snd_pcm_runtime *rt = substream->runtime;
struct lpass_pcm_data *pcm_data = rt->private_data;
struct lpass_variant *v = drvdata->variant; struct lpass_variant *v = drvdata->variant;
int ret, ch, dir = substream->stream; int ret, ch, dir = substream->stream;
...@@ -257,7 +319,8 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream, ...@@ -257,7 +319,8 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
struct lpass_data *drvdata = struct lpass_data *drvdata =
snd_soc_platform_get_drvdata(soc_runtime->platform); snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_pcm_data *pcm_data = drvdata->private_data; struct snd_pcm_runtime *rt = substream->runtime;
struct lpass_pcm_data *pcm_data = rt->private_data;
struct lpass_variant *v = drvdata->variant; struct lpass_variant *v = drvdata->variant;
int ret, ch, dir = substream->stream; int ret, ch, dir = substream->stream;
...@@ -333,7 +396,8 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer( ...@@ -333,7 +396,8 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
struct lpass_data *drvdata = struct lpass_data *drvdata =
snd_soc_platform_get_drvdata(soc_runtime->platform); snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_pcm_data *pcm_data = drvdata->private_data; struct snd_pcm_runtime *rt = substream->runtime;
struct lpass_pcm_data *pcm_data = rt->private_data;
struct lpass_variant *v = drvdata->variant; struct lpass_variant *v = drvdata->variant;
unsigned int base_addr, curr_addr; unsigned int base_addr, curr_addr;
int ret, ch, dir = substream->stream; int ret, ch, dir = substream->stream;
...@@ -374,6 +438,7 @@ static int lpass_platform_pcmops_mmap(struct snd_pcm_substream *substream, ...@@ -374,6 +438,7 @@ static int lpass_platform_pcmops_mmap(struct snd_pcm_substream *substream,
static const struct snd_pcm_ops lpass_platform_pcm_ops = { static const struct snd_pcm_ops lpass_platform_pcm_ops = {
.open = lpass_platform_pcmops_open, .open = lpass_platform_pcmops_open,
.close = lpass_platform_pcmops_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = lpass_platform_pcmops_hw_params, .hw_params = lpass_platform_pcmops_hw_params,
.hw_free = lpass_platform_pcmops_hw_free, .hw_free = lpass_platform_pcmops_hw_free,
...@@ -470,117 +535,45 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) ...@@ -470,117 +535,45 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
{ {
struct snd_pcm *pcm = soc_runtime->pcm; struct snd_pcm *pcm = soc_runtime->pcm;
struct snd_pcm_substream *psubstream, *csubstream; struct snd_pcm_substream *psubstream, *csubstream;
struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
struct lpass_data *drvdata =
snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_variant *v = drvdata->variant;
int ret = -EINVAL; int ret = -EINVAL;
struct lpass_pcm_data *data;
size_t size = lpass_platform_pcm_hardware.buffer_bytes_max; size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->i2s_port = cpu_dai->driver->id;
drvdata->private_data = data;
psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
if (psubstream) { if (psubstream) {
if (v->alloc_dma_channel)
data->rdma_ch = v->alloc_dma_channel(drvdata,
SNDRV_PCM_STREAM_PLAYBACK);
if (data->rdma_ch < 0)
return data->rdma_ch;
drvdata->substream[data->rdma_ch] = psubstream;
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
soc_runtime->platform->dev, soc_runtime->platform->dev,
size, &psubstream->dma_buffer); size, &psubstream->dma_buffer);
if (ret)
goto playback_alloc_err;
ret = regmap_write(drvdata->lpaif_map,
LPAIF_RDMACTL_REG(v, data->rdma_ch), 0);
if (ret) { if (ret) {
dev_err(soc_runtime->dev, dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
"%s() error writing to rdmactl reg: %d\n", return ret;
__func__, ret);
goto capture_alloc_err;
} }
} }
csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
if (csubstream) { if (csubstream) {
if (v->alloc_dma_channel)
data->wrdma_ch = v->alloc_dma_channel(drvdata,
SNDRV_PCM_STREAM_CAPTURE);
if (data->wrdma_ch < 0) {
ret = data->wrdma_ch;
goto capture_alloc_err;
}
drvdata->substream[data->wrdma_ch] = csubstream;
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
soc_runtime->platform->dev, soc_runtime->platform->dev,
size, &csubstream->dma_buffer); size, &csubstream->dma_buffer);
if (ret)
goto capture_alloc_err;
ret = regmap_write(drvdata->lpaif_map,
LPAIF_WRDMACTL_REG(v, data->wrdma_ch), 0);
if (ret) { if (ret) {
dev_err(soc_runtime->dev, dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
"%s() error writing to wrdmactl reg: %d\n",
__func__, ret);
goto capture_reg_err;
}
}
return 0;
capture_reg_err:
if (csubstream)
snd_dma_free_pages(&csubstream->dma_buffer);
capture_alloc_err:
if (psubstream) if (psubstream)
snd_dma_free_pages(&psubstream->dma_buffer); snd_dma_free_pages(&psubstream->dma_buffer);
return ret;
}
playback_alloc_err: }
dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
return ret; return 0;
} }
static void lpass_platform_pcm_free(struct snd_pcm *pcm) static void lpass_platform_pcm_free(struct snd_pcm *pcm)
{ {
struct snd_soc_pcm_runtime *rt;
struct lpass_data *drvdata;
struct lpass_pcm_data *data;
struct lpass_variant *v;
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
int ch, i; int i;
for (i = 0; i < ARRAY_SIZE(pcm->streams); i++) { for (i = 0; i < ARRAY_SIZE(pcm->streams); i++) {
substream = pcm->streams[i].substream; substream = pcm->streams[i].substream;
if (substream) { if (substream) {
rt = substream->private_data;
drvdata = snd_soc_platform_get_drvdata(rt->platform);
data = drvdata->private_data;
ch = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
? data->rdma_ch
: data->wrdma_ch;
v = drvdata->variant;
drvdata->substream[ch] = NULL;
if (v->free_dma_channel)
v->free_dma_channel(drvdata, ch);
snd_dma_free_pages(&substream->dma_buffer); snd_dma_free_pages(&substream->dma_buffer);
substream->dma_buffer.area = NULL; substream->dma_buffer.area = NULL;
substream->dma_buffer.addr = 0; substream->dma_buffer.addr = 0;
......
...@@ -59,7 +59,6 @@ struct lpass_data { ...@@ -59,7 +59,6 @@ struct lpass_data {
struct clk *pcnoc_mport_clk; struct clk *pcnoc_mport_clk;
struct clk *pcnoc_sway_clk; struct clk *pcnoc_sway_clk;
void *private_data;
}; };
/* Vairant data per each SOC */ /* Vairant data per each SOC */
......
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