Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,9 @@ struct snd_soc_dai_link_component {
const char *dai_name;
};

/* Split channels between cpu DAIs equally */
#define SND_SOC_DAI_LINK_EVEN_CHANNEL BIT(0)

struct snd_soc_dai_link {
/* config - must be set by machine driver */
const char *name; /* Codec name */
Expand Down Expand Up @@ -691,6 +694,8 @@ struct snd_soc_dai_link {

enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */

unsigned int flags[SNDRV_PCM_STREAM_LAST + 1]; /* dai_link flags */

/* codec/machine specific init - e.g. add machine controls */
int (*init)(struct snd_soc_pcm_runtime *rtd);

Expand Down
1 change: 1 addition & 0 deletions sound/soc/intel/boards/sof_sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ static void init_dai_link(struct device *dev, struct snd_soc_dai_link *dai_links
dai_links->dpcm_capture = capture;
dai_links->init = init;
dai_links->ops = ops;
dai_links->flags[SNDRV_PCM_STREAM_CAPTURE] = SND_SOC_DAI_LINK_EVEN_CHANNEL;
}

static bool is_unique_device(const struct snd_soc_acpi_link_adr *link,
Expand Down
8 changes: 8 additions & 0 deletions sound/soc/soc-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,14 @@ int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
dev_dbg(be->dev, "ASoC: hw_params BE %s\n",
be->dai_link->name);

if (be->dai_link->flags[stream] & SND_SOC_DAI_LINK_EVEN_CHANNEL) {
struct snd_interval *channels;

channels = hw_param_interval(&hw_params, SNDRV_PCM_HW_PARAM_CHANNELS);
channels->min /= be->dai_link->num_cpus;
channels->max = channels->min;
}

ret = __soc_pcm_hw_params(be, be_substream, &hw_params);
if (ret < 0)
goto unwind;
Expand Down