Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6e27a09
ASoC: SOF: Define sof_create_platform_device
mengdonglin Jul 25, 2018
7c4d24d
ASoC: SOF: refine and cleanup for request_firmware
keyonjie Aug 9, 2018
c176a3f
ASoC: SOF: bypass ADSP for Force legacy HDA mode
mengdonglin Aug 10, 2018
2c361f5
ASoC: SOF: add pointer callback for dsp_ops
keyonjie Aug 10, 2018
3b7dab1
ASoC: SOF: HDA: add pcm_pointer callback
keyonjie Aug 9, 2018
748035c
ASoC: SOF: apl: add pcm_pointer callback to dsp_ops
keyonjie Aug 9, 2018
a36a21b
ASoC: SOF: HACK to use DPIB position update for hda legacy mode
keyonjie Aug 9, 2018
3d70689
ASoC: SOF: HACK to use coupled mode for hda leagacy
keyonjie Aug 9, 2018
6f2dcae
ASoC: SOF: HACK to disable ipc sending for hda legacy mode
keyonjie Aug 9, 2018
d36b009
ASoC: Intel: bxt-tdf8532: add hdmi support
keyonjie Aug 9, 2018
356a728
[HACK]ASoC: SOF: topology: temporary ignore hw_config for legacy hda …
keyonjie Aug 10, 2018
d75c293
ASoC: temporary disable PM as it will lead to calltrace
keyonjie Aug 10, 2018
95387e2
ASoC: SOF: intel: clear TCSEL after synchronize_irq
keyonjie Aug 13, 2018
7f556f0
ASoC: SOF: topology: only give warning and continue parsing when num_…
keyonjie Aug 17, 2018
456e8c3
ASoC: SOF: PCM: do nothing for HDA dai_link fixup()
keyonjie Aug 17, 2018
caa51af
ASoC: SOF: use dsp .pointer() callback if we have when USE_POS_BUF is
keyonjie Aug 17, 2018
45b7db3
ALSA: HDA: Fix several mismatch for register mask and value
keyonjie Aug 23, 2018
71f91bb
ASoC: SOF: hda-dai: add ops for hda link dais.
keyonjie Aug 24, 2018
209d6f5
debug: hack to use bxt_tdf8532 for leafhill hdmi debug
keyonjie Aug 24, 2018
599324c
ASoC: SOF: hda: replace registers rw with io_ops
keyonjie Aug 27, 2018
992fb07
ASoC: SOF: hda: request hda irq with different dev_id
keyonjie Aug 27, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sound/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
# Makefile for the Linux sound card driver
#

export KBUILD_CFLAGS += -DDEBUG
obj-$(CONFIG_SOUND) += soundcore.o
obj-$(CONFIG_DMASOUND) += oss/dmasound/
obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
Expand Down
22 changes: 7 additions & 15 deletions sound/hda/ext/hdac_ext_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_decouple);
*/
void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *stream)
{
snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, 0, AZX_PPLCCTL_RUN);
snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL,
AZX_PPLCCTL_RUN, AZX_PPLCCTL_RUN);
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_link_stream_start);

Expand All @@ -171,7 +172,8 @@ void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *stream)

snd_hdac_ext_link_stream_clear(stream);

snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, 0, AZX_PPLCCTL_STRST);
snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL,
AZX_PPLCCTL_STRST, AZX_PPLCCTL_STRST);
udelay(3);
timeout = 50;
do {
Expand Down Expand Up @@ -242,7 +244,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_link_set_stream_id);
void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link,
int stream)
{
snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, 0, (1 << stream));
snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 0);
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_link_clear_stream_id);

Expand Down Expand Up @@ -415,7 +417,6 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *bus,
bool enable, int index)
{
u32 mask = 0;
u32 register_mask = 0;

if (!bus->spbcap) {
dev_err(bus->dev, "Address of SPB capability is NULL\n");
Expand All @@ -424,12 +425,8 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *bus,

mask |= (1 << index);

register_mask = readl(bus->spbcap + AZX_REG_SPB_SPBFCCTL);

mask |= register_mask;

if (enable)
snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, 0, mask);
snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, mask, mask);
else
snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, mask, 0);
}
Expand Down Expand Up @@ -503,7 +500,6 @@ void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus,
bool enable, int index)
{
u32 mask = 0;
u32 register_mask = 0;

if (!bus->drsmcap) {
dev_err(bus->dev, "Address of DRSM capability is NULL\n");
Expand All @@ -512,12 +508,8 @@ void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus,

mask |= (1 << index);

register_mask = readl(bus->drsmcap + AZX_REG_SPB_SPBFCCTL);

mask |= register_mask;

if (enable)
snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, 0, mask);
snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, mask, mask);
else
snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, mask, 0);
}
Expand Down
139 changes: 135 additions & 4 deletions sound/soc/intel/boards/bxt_tdf8532.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/pcm_params.h>
#include <sound/jack.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the DSP is not enabled, we should select another machine driver.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's true, will change like that.

#include "../../codecs/hdac_hdmi.h"

struct bxt_hdmi_pcm {
struct list_head head;
struct snd_soc_dai *codec_dai;
int device;
};

struct bxt_sof_private {
struct list_head hdmi_pcm_list;
};


static const struct snd_kcontrol_new broxton_tdf8532_controls[] = {
SOC_DAPM_PIN_SWITCH("Speaker"),
Expand All @@ -29,6 +42,8 @@ static const struct snd_soc_dapm_widget broxton_tdf8532_widgets[] = {
};

static const struct snd_soc_dapm_route broxton_tdf8532_map[] = {
//#ifndef CONFIG_SND_SOC_SOF_FORCE_LEGACY_HDA
#if 1
/* Speaker BE connections */
{ "Speaker", NULL, "ssp4 Tx"},
{ "ssp4 Tx", NULL, "codec0_out"},
Expand Down Expand Up @@ -65,8 +80,52 @@ static const struct snd_soc_dapm_route broxton_tdf8532_map[] = {

{ "ModemUl", NULL, "ssp3 Tx"},
{ "ssp3 Tx", NULL, "Modem_ssp3_out"},

//#else
{ "hifi3", NULL, "iDisp3 Tx"},
{ "hifi2", NULL, "iDisp2 Tx"},
{ "hifi1", NULL, "iDisp1 Tx"},
#endif
};

/* Headset jack detection DAPM pins */
static struct snd_soc_jack broxton_headset;
static struct snd_soc_jack broxton_hdmi[3];

#define NAME_SIZE 32
static int bxt_card_late_probe(struct snd_soc_card *card)
{
struct bxt_sof_private *ctx = snd_soc_card_get_drvdata(card);
struct bxt_hdmi_pcm *pcm;
struct snd_soc_component *component = NULL;
int err, i = 0;
char jack_name[NAME_SIZE];

list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
component = pcm->codec_dai->component;
snprintf(jack_name, sizeof(jack_name),
"HDMI/DP, pcm=%d Jack", pcm->device);
err = snd_soc_card_jack_new(card, jack_name,
SND_JACK_AVOUT, &broxton_hdmi[i],
NULL, 0);

if (err)
return err;

err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
&broxton_hdmi[i]);
if (err < 0)
return err;

i++;
}

if (!component)
return -EINVAL;

return hdac_hdmi_jack_port_init(component, &card->dapm);
}

static int bxt_tdf8532_ssp2_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
Expand All @@ -79,8 +138,29 @@ static int bxt_tdf8532_ssp2_fixup(struct snd_soc_pcm_runtime *rtd,
return 0;
}

static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{
struct bxt_sof_private *ctx = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *dai = rtd->codec_dai;
struct bxt_hdmi_pcm *pcm;

pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
if (!pcm)
return -ENOMEM;

pcm->device = dai->id;
pcm->codec_dai = dai;

list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);

return 0;
}


/* broxton digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
//#ifndef CONFIG_SND_SOC_SOF_FORCE_LEGACY_HDA
#if 0
/* Probe DAI links*/
{
.name = "Bxt Compress Probe playback",
Expand Down Expand Up @@ -185,8 +265,10 @@ static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
.name = "SSP4-Codec",
.id = 4,
.cpu_dai_name = "SSP4 Pin",
.codec_name = "i2c-INT34C3:00",
.codec_dai_name = "tdf8532-hifi",
// .codec_name = "i2c-INT34C3:00",
// .codec_dai_name = "tdf8532-hifi",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.platform_name = "0000:00:0e.0",
.ignore_suspend = 1,
.dpcm_playback = 1,
Expand All @@ -211,9 +293,8 @@ static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
.cpu_dai_name = "iDisp1 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi1",
// .codec_name = "i2c-INT34C3:00",
// .codec_dai_name = "tdf8532-hifi",
.platform_name = "0000:00:0e.0",
.init = broxton_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
},
Expand All @@ -224,6 +305,7 @@ static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi2",
.platform_name = "0000:00:0e.0",
.init = broxton_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
},
Expand All @@ -234,9 +316,46 @@ static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi3",
.platform_name = "0000:00:0e.0",
.init = broxton_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
},
#else
/* Back End DAI links */
{
.name = "iDisp1",
.id = 6,
.cpu_dai_name = "iDisp1 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi1",
.platform_name = "sof-audio",
.init = broxton_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
},
{
.name = "iDisp2",
.id = 7,
.cpu_dai_name = "iDisp2 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi2",
.platform_name = "sof-audio",
.init = broxton_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
},
{
.name = "iDisp3",
.id = 8,
.cpu_dai_name = "iDisp3 Pin",
.codec_name = "ehdaudio0D2",
.codec_dai_name = "intel-hdmi-hifi3",
.platform_name = "sof-audio",
.init = broxton_hdmi_init,
.dpcm_playback = 1,
.no_pcm = 1,
},
#endif
};

#if !IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL)
Expand All @@ -261,15 +380,27 @@ static struct snd_soc_card broxton_tdf8532 = {
.dapm_routes = broxton_tdf8532_map,
.num_dapm_routes = ARRAY_SIZE(broxton_tdf8532_map),
.fully_routed = true,
.late_probe = bxt_card_late_probe,
#if !IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL)
.add_dai_link = bxt_add_dai_link,
#endif
};

static int broxton_tdf8532_audio_probe(struct platform_device *pdev)
{
struct bxt_sof_private *ctx;

dev_info(&pdev->dev, "%s registering %s\n", __func__, pdev->name);
broxton_tdf8532.dev = &pdev->dev;

ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC);
if (!ctx)
return -ENOMEM;

INIT_LIST_HEAD(&ctx->hdmi_pcm_list);

snd_soc_card_set_drvdata(&broxton_tdf8532, ctx);

return snd_soc_register_card(&broxton_tdf8532);
}

Expand Down
7 changes: 5 additions & 2 deletions sound/soc/intel/common/soc-acpi-intel-bxt-match.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ static struct snd_soc_acpi_codecs bxt_codecs = {
struct snd_soc_acpi_mach snd_soc_acpi_intel_bxt_machines[] = {
{
.id = "INT343A",
.drv_name = "bxt_alc298s_i2s",
.fw_filename = "intel/dsp_fw_bxtn.bin",
// .drv_name = "bxt_alc298s_i2s",
// .fw_filename = "intel/dsp_fw_bxtn.bin",
.drv_name = "bxt_tdf8532",
.sof_fw_filename = "intel/sof-apl.ri",
.sof_tplg_filename = "intel/sof-apl-tdf8532.tplg",
},
{
.id = "DLGS7219",
Expand Down
11 changes: 10 additions & 1 deletion sound/soc/sof/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,10 @@ static int sof_probe(struct platform_device *pdev)
goto ipc_err;
}

/* bypass DSP if in force legacy hda debug mode */
#ifndef CONFIG_SND_SOC_SOF_FORCE_LEGACY_HDA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or DSP is not enabled, you could test this on SKL!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will add checking of DSP's availability.

/* load the firmware */
ret = snd_sof_load_firmware(sdev, plat_data->fw, true);
ret = snd_sof_load_firmware(sdev, true);
if (ret < 0) {
dev_err(sdev->dev, "error: failed to load DSP firmware %d\n",
ret);
Expand All @@ -306,6 +308,7 @@ static int sof_probe(struct platform_device *pdev)
ret);
goto fw_run_err;
}
#endif

/* now register audio DSP platform driver */
ret = snd_soc_register_platform(&pdev->dev, &sdev->plat_drv);
Expand All @@ -324,13 +327,16 @@ static int sof_probe(struct platform_device *pdev)
goto comp_err;
}

/* bypass DSP if in force legacy hda debug mode */
#ifndef CONFIG_SND_SOC_SOF_FORCE_LEGACY_HDA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a variable that is enabled if IS_ENABLED(FORCE_LEGACY_HDA) || (DSP not enabled)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will change it.

/* init DMA trace */
ret = snd_sof_init_trace(sdev);
if (ret < 0) {
/* non fatal */
dev_warn(sdev->dev,
"warning: failed to initialize trace %d\n", ret);
}
#endif

/* autosuspend sof device */
pm_runtime_mark_last_busy(sdev->dev);
Expand All @@ -346,9 +352,12 @@ static int sof_probe(struct platform_device *pdev)
snd_soc_unregister_component(&pdev->dev);
snd_sof_free_topology(sdev);
fw_run_err:
/* bypass DSP if in force legacy hda debug mode */
#ifndef CONFIG_SND_SOC_SOF_FORCE_LEGACY_HDA
snd_sof_fw_unload(sdev);
fw_load_err:
snd_sof_ipc_free(sdev);
#endif
ipc_err:
snd_sof_free_debug(sdev);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't the debug tied to DSP?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need refine this part, and adding check to dsp availability also.

dbg_err:
Expand Down
11 changes: 11 additions & 0 deletions sound/soc/sof/intel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,15 @@ config SND_SOC_SOF_HDA
Say Y if you want to enble HDA links with SOF.
If unsure select "N".

config SND_SOC_SOF_FORCE_LEGACY_HDA
bool "SOF force legacy hda and bypass DSP"
depends on SND_SOC_SOF_HDA
depends on SND_SOC_SOF_DEBUG
help
This forces the driver to use HDA legacy mode, and bypasses
the embedded DSP in HD-A controller on Intel SKL+ platforms.
This is designed for debugging only.
Say Y if you do wan't to use this mode.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many double negations or typos?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's typo here, should be "Say Y if you do want to use this mode."

If unsure select "N".

endif ## SND_SOC_SOF_INTEL
1 change: 1 addition & 0 deletions sound/soc/sof/intel/apl.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ struct snd_sof_dsp_ops sof_apl_ops = {
.pcm_close = hda_dsp_pcm_close,
.pcm_hw_params = hda_dsp_pcm_hw_params,
.pcm_trigger = hda_dsp_pcm_trigger,
.pcm_pointer = hda_dsp_pcm_pointer,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't these two patches completely unrelated to legacy HDA?


/* firmware loading */
.load_firmware = hda_dsp_cl_load_fw,
Expand Down
Loading