Skip to content
Merged
7 changes: 6 additions & 1 deletion include/sound/sof.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/pci.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <uapi/sound/sof-ipc.h>

Expand Down Expand Up @@ -76,6 +77,10 @@ struct sof_dev_desc {
int sof_nocodec_setup(struct device *dev,
struct snd_sof_pdata *sof_pdata,
struct snd_soc_acpi_mach *mach,
const struct sof_dev_desc *desc);
const struct sof_dev_desc *desc,
struct snd_sof_dsp_ops *ops);

int sof_bes_setup(struct device *dev, struct snd_sof_dsp_ops *ops,
struct snd_soc_dai_link *links, int link_num,
struct snd_soc_card *card);
#endif
4 changes: 4 additions & 0 deletions sound/soc/intel/boards/bxt_tdf8532.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
.platform_name = "0000:00:0e.0",
.init = NULL,
.nonatomic = 1,
.dynamic = 1,
},
{
.name = "Bxt Compress Probe capture",
Expand All @@ -276,6 +277,7 @@ static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
.platform_name = "0000:00:0e.0",
.init = NULL,
.nonatomic = 1,
.dynamic = 1,
},
/* Trace Buffer DAI links */
{
Expand All @@ -287,6 +289,7 @@ static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
.platform_name = "0000:00:0e.0",
.capture_only = true,
.ignore_suspend = 1,
.dynamic = 1,
},
{
.name = "Bxt Trace Buffer1",
Expand All @@ -297,6 +300,7 @@ static struct snd_soc_dai_link broxton_tdf8532_dais[] = {
.platform_name = "0000:00:0e.0",
.capture_only = true,
.ignore_suspend = 1,
.dynamic = 1,
},
/* Back End DAI links */
{
Expand Down
3 changes: 0 additions & 3 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2126,12 +2126,9 @@ static void soc_check_tplg_fes(struct snd_soc_card *card)

/* override platform */
dai_link->platform_name = platform->component.name;
dai_link->cpu_dai_name = platform->component.name;

/* convert non BE into BE */
dai_link->no_pcm = 1;
dai_link->dpcm_playback = 1;
Copy link
Member

Choose a reason for hiding this comment

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

I'll merge this into my upstream patch.

dai_link->dpcm_capture = 1;

/* override any BE fixups */
dai_link->be_hw_params_fixup =
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/sof/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ccflags-y += -DDEBUG

snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\
control.o trace.o compressed.o
control.o trace.o compressed.o utils.o
snd-sof-spi-objs := hw-spi.o

snd-sof-pci-objs := sof-pci-dev.o
Expand Down
8 changes: 5 additions & 3 deletions sound/soc/sof/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static int sof_probe(struct platform_device *pdev)
spin_lock_init(&sdev->ipc_lock);
spin_lock_init(&sdev->hw_lock);

/* set up platform and component drivers */
/* set up platform component driver */
snd_sof_new_platform_drv(sdev);
snd_sof_new_dai_drv(sdev);

Expand Down Expand Up @@ -271,14 +271,16 @@ static int sof_probe(struct platform_device *pdev)
goto fw_run_err;
}

ret = snd_soc_register_component(&pdev->dev, sdev->cmpnt_drv,
&sdev->dai_drv, sdev->num_dai);
ret = snd_soc_register_component(&pdev->dev, sdev->cmpnt_drv,
sdev->ops->dai_drv->drv,
sdev->ops->dai_drv->num_drv);
if (ret < 0) {
dev_err(sdev->dev,
"error: failed to register DSP DAI driver %d\n", ret);
goto comp_err;
}

/* init DMA trace */
ret = snd_sof_init_trace(sdev);
if (ret < 0) {
dev_warn(sdev->dev,
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/sof/intel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ snd-sof-intel-byt-objs := byt.o
snd-sof-intel-hsw-objs := hsw.o
snd-sof-intel-bdw-objs := bdw.o
snd-sof-intel-hda-common-objs := hda.o hda-loader.o hda-stream.o hda-trace.o \
hda-dsp.o hda-ipc.o hda-ctrl.o hda-pcm.o \
hda-dsp.o hda-ipc.o hda-ctrl.o hda-pcm.o hda-dai.o\
skl.o apl.o cnl.o

obj-$(CONFIG_SND_SOC_SOF_BAYTRAIL) += snd-sof-intel-byt.o
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/sof/intel/apl.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,8 @@ struct snd_sof_dsp_ops sof_apl_ops = {
.trace_init = hda_dsp_trace_init,
.trace_release = hda_dsp_trace_release,
.trace_trigger = hda_dsp_trace_trigger,

/* DAI drivers */
.dai_drv = &hda_dai_drv,
};
EXPORT_SYMBOL(sof_apl_ops);
29 changes: 29 additions & 0 deletions sound/soc/sof/intel/bdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,32 @@ static int bdw_remove(struct snd_sof_dev *sdev)
return 0;
}

#define BDW_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \
SNDRV_PCM_FMTBIT_S32_LE)

/* Broadwell DAIs */
static struct snd_soc_dai_driver bdw_dai[] = {
{
.name = "ssp0-port",
.playback = SOF_DAI_STREAM("ssp0 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BDW_FORMATS),
.capture = SOF_DAI_STREAM("ssp0 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BDW_FORMATS),
},
{
.name = "ssp1-port",
.playback = SOF_DAI_STREAM("ssp1 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BDW_FORMATS),
.capture = SOF_DAI_STREAM("ssp1 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BDW_FORMATS),
},
};

struct snd_sof_dai_drv bdw_dai_drv = {
.drv = bdw_dai,
.num_drv = ARRAY_SIZE(bdw_dai)
};

/* broadwell ops */
struct snd_sof_dsp_ops sof_bdw_ops = {
/*Device init */
Expand Down Expand Up @@ -750,6 +776,9 @@ struct snd_sof_dsp_ops sof_bdw_ops = {

/*Firmware loading */
.load_firmware = snd_sof_load_firmware_memcpy,

/* DAI drivers */
.dai_drv = &bdw_dai_drv,
};
EXPORT_SYMBOL(sof_bdw_ops);

Expand Down
66 changes: 66 additions & 0 deletions sound/soc/sof/intel/byt.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,66 @@ static int byt_remove(struct snd_sof_dev *sdev)
return byt_acpi_remove(sdev);
}

#define BYT_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \
SNDRV_PCM_FMTBIT_S32_LE)

/* Baytrail DAIs */
static struct snd_soc_dai_driver byt_dai[] = {
{
.name = "ssp0-port",
.playback = SOF_DAI_STREAM("ssp0 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
.capture = SOF_DAI_STREAM("ssp0 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
},
{
.name = "ssp1-port",
.playback = SOF_DAI_STREAM("ssp1 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
.capture = SOF_DAI_STREAM("ssp1 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
},
{
.name = "ssp2-port",
.playback = SOF_DAI_STREAM("ssp2 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
.capture = SOF_DAI_STREAM("ssp2 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
},
{
.name = "ssp3-port",
.playback = SOF_DAI_STREAM("ssp3 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
.capture = SOF_DAI_STREAM("ssp3 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
},
{
.name = "ssp4-port",
.playback = SOF_DAI_STREAM("ssp4 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
.capture = SOF_DAI_STREAM("ssp4 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
},
{
.name = "ssp5-port",
.playback = SOF_DAI_STREAM("ssp5 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
.capture = SOF_DAI_STREAM("ssp5 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, BYT_FORMATS),
},
};

struct snd_sof_dai_drv byt_dai_drv = {
.drv = byt_dai,
.num_drv = 3, /* we have only 3 SSPs on byt*/
};

struct snd_sof_dai_drv cht_dai_drv = {
.drv = byt_dai,
/* all 6 SSPs may be available for cherrytrail */
.num_drv = ARRAY_SIZE(byt_dai),
};

/* baytrail ops */
struct snd_sof_dsp_ops sof_byt_ops = {
/* device init */
Expand Down Expand Up @@ -795,6 +855,9 @@ struct snd_sof_dsp_ops sof_byt_ops = {

/*Firmware loading */
.load_firmware = snd_sof_load_firmware_memcpy,

/* DAI drivers */
.dai_drv = &byt_dai_drv,
};
EXPORT_SYMBOL(sof_byt_ops);

Expand Down Expand Up @@ -843,6 +906,9 @@ struct snd_sof_dsp_ops sof_cht_ops = {

/*Firmware loading */
.load_firmware = snd_sof_load_firmware_memcpy,

/* DAI drivers */
.dai_drv = &cht_dai_drv,
};
EXPORT_SYMBOL(sof_cht_ops);

Expand Down
3 changes: 3 additions & 0 deletions sound/soc/sof/intel/cnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,8 @@ struct snd_sof_dsp_ops sof_cnl_ops = {
.trace_init = hda_dsp_trace_init,
.trace_release = hda_dsp_trace_release,
.trace_trigger = hda_dsp_trace_trigger,

/* DAI drivers */
.dai_drv = &hda_dai_drv,
};
EXPORT_SYMBOL(sof_cnl_ops);
118 changes: 118 additions & 0 deletions sound/soc/sof/intel/hda-dai.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
/*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* Copyright(c) 2018 Intel Corporation. All rights reserved.
*
* Authors: Keyon Jie <yang.jie@linux.intel.com>
*/

#include <sound/pcm_params.h>
#include "../sof-priv.h"

#define SKL_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \
SNDRV_PCM_FMTBIT_S32_LE)

/*
* common dai driver for skl+ platforms.
* some products who use this DAI array only physically have a subset of
* the DAIs, but no harm is done here by adding the whole set.
*/
static struct snd_soc_dai_driver skl_dai[] = {
{
.name = "SSP0 Pin",
.playback = SOF_DAI_STREAM("ssp0 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
.capture = SOF_DAI_STREAM("ssp0 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "SSP1 Pin",
.playback = SOF_DAI_STREAM("ssp1 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
.capture = SOF_DAI_STREAM("ssp1 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "SSP2 Pin",
.playback = SOF_DAI_STREAM("ssp2 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
.capture = SOF_DAI_STREAM("ssp2 Rx", 1, 16,
Copy link
Member

Choose a reason for hiding this comment

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

8

Copy link
Author

Choose a reason for hiding this comment

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

oops, let me send incremental fix soon.

SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "SSP3 Pin",
.playback = SOF_DAI_STREAM("ssp3 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
.capture = SOF_DAI_STREAM("ssp3 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "SSP4 Pin",
.playback = SOF_DAI_STREAM("ssp4 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
.capture = SOF_DAI_STREAM("ssp4 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "SSP5 Pin",
.playback = SOF_DAI_STREAM("ssp5 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
.capture = SOF_DAI_STREAM("ssp5 Rx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "DMIC01 Pin",
.capture = SOF_DAI_STREAM("DMIC01 Rx", 1, 4,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "DMIC16k Pin",
.capture = SOF_DAI_STREAM("DMIC16k Rx", 1, 4,
SNDRV_PCM_RATE_16000, SKL_FORMATS),
},
{
.name = "iDisp1 Pin",
.playback = SOF_DAI_STREAM("iDisp1 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "iDisp2 Pin",
.playback = SOF_DAI_STREAM("iDisp2 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "iDisp3 Pin",
.playback = SOF_DAI_STREAM("iDisp3 Tx", 1, 8,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "Analog Codec DAI",
.playback = SOF_DAI_STREAM("Analog Codec Playback", 1, 16,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
.capture = SOF_DAI_STREAM("Analog Codec Capture", 1, 16,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "Digital Codec DAI",
.playback = SOF_DAI_STREAM("Digital Codec Playback", 1, 16,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
.capture = SOF_DAI_STREAM("Digital Codec Capture", 1, 16,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
{
.name = "Alt Analog Codec DAI",
.playback = SOF_DAI_STREAM("Alt Analog Codec Playback", 1, 16,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
.capture = SOF_DAI_STREAM("Alt Analog Codec Capture", 1, 16,
SNDRV_PCM_RATE_8000_192000, SKL_FORMATS),
},
};

struct snd_sof_dai_drv hda_dai_drv = {
.drv = skl_dai,
.num_drv = ARRAY_SIZE(skl_dai)
};
EXPORT_SYMBOL(hda_dai_drv);

3 changes: 3 additions & 0 deletions sound/soc/sof/intel/hda.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev, u32 *stream_tag);
int hda_dsp_trace_release(struct snd_sof_dev *sdev);
int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd);

/* common dai driver */
extern struct snd_sof_dai_drv hda_dai_drv;

/*
* Platform Specific HW abstraction Ops.
*/
Expand Down
Loading