Unverified Commit 3d026a8a authored by Mark Brown's avatar Mark Brown
Browse files

Merge series "ASoC: meson: tdm fixes" from Jerome Brunet <jbrunet@baylibre.com>:

This patcheset is collection of fixes for the TDM input and output the
axg audio architecture. Its fixes:
 - slave mode format setting
 - g12 and sm1 skew offset
 - tdm clock inversion
 - standard daifmt props names which don't require a specific prefix

Jerome Brunet (4):
  ASoC: meson: axg-tdm-interface: fix link fmt setup
  ASoC: meson: axg-tdmin: fix g12a skew
  ASoC: meson: axg-tdm-formatters: fix sclk inversion
  ASoC: meson: cards: remove DT_PREFIX for standard daifmt properties

 sound/soc/meson/axg-tdm-formatter.c | 11 ++++++-----
 sound/soc/meson/axg-tdm-formatter.h |  1 -
 sound/soc/meson/axg-tdm-interface.c | 26 +++++++++++++++++---------
 sound/soc/meson/axg-tdmin.c         | 16 +++++++++++++++-
 sound/soc/meson/axg-tdmout.c        |  3 ---
 sound/soc/meson/meson-card-utils.c  |  2 +-
 6 files changed, 39 insertions(+), 20 deletions(-)

--
2.25.4
parents 4d1976c7 e44815a2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -899,7 +899,7 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) |
				     SPI_BPW_MASK(16) | SPI_BPW_MASK(32);

	spi->wq = alloc_ordered_workqueue(dev_name(dev), 0);
	spi->wq = alloc_ordered_workqueue(dev_name(dev), WQ_MEM_RECLAIM);
	if (!spi->wq) {
		err = -ENOMEM;
		goto err_clk_put;
+40 −10
Original line number Diff line number Diff line
@@ -23,36 +23,61 @@
struct max98357a_priv {
	struct gpio_desc *sdmode;
	unsigned int sdmode_delay;
	int sdmode_switch;
};

static int max98357a_sdmode_event(struct snd_soc_dapm_widget *w,
		struct snd_kcontrol *kcontrol, int event)
static int max98357a_daiops_trigger(struct snd_pcm_substream *substream,
		int cmd, struct snd_soc_dai *dai)
{
	struct snd_soc_component *component =
		snd_soc_dapm_to_component(w->dapm);
	struct snd_soc_component *component = dai->component;
	struct max98357a_priv *max98357a =
		snd_soc_component_get_drvdata(component);

	if (!max98357a->sdmode)
		return 0;

	if (event & SND_SOC_DAPM_POST_PMU) {
		msleep(max98357a->sdmode_delay);
	switch (cmd) {
	case SNDRV_PCM_TRIGGER_START:
	case SNDRV_PCM_TRIGGER_RESUME:
	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
		mdelay(max98357a->sdmode_delay);
		if (max98357a->sdmode_switch) {
			gpiod_set_value(max98357a->sdmode, 1);
			dev_dbg(component->dev, "set sdmode to 1");
	} else if (event & SND_SOC_DAPM_PRE_PMD) {
		}
		break;
	case SNDRV_PCM_TRIGGER_STOP:
	case SNDRV_PCM_TRIGGER_SUSPEND:
	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
		gpiod_set_value(max98357a->sdmode, 0);
		dev_dbg(component->dev, "set sdmode to 0");
		break;
	}

	return 0;
}

static int max98357a_sdmode_event(struct snd_soc_dapm_widget *w,
		struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_component *component =
		snd_soc_dapm_to_component(w->dapm);
	struct max98357a_priv *max98357a =
		snd_soc_component_get_drvdata(component);

	if (event & SND_SOC_DAPM_POST_PMU)
		max98357a->sdmode_switch = 1;
	else if (event & SND_SOC_DAPM_POST_PMD)
		max98357a->sdmode_switch = 0;

	return 0;
}

static const struct snd_soc_dapm_widget max98357a_dapm_widgets[] = {
	SND_SOC_DAPM_OUTPUT("Speaker"),
	SND_SOC_DAPM_OUT_DRV_E("SD_MODE", SND_SOC_NOPM, 0, 0, NULL, 0,
			max98357a_sdmode_event,
			SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
			SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
};

static const struct snd_soc_dapm_route max98357a_dapm_routes[] = {
@@ -71,6 +96,10 @@ static const struct snd_soc_component_driver max98357a_component_driver = {
	.non_legacy_dai_naming	= 1,
};

static const struct snd_soc_dai_ops max98357a_dai_ops = {
	.trigger        = max98357a_daiops_trigger,
};

static struct snd_soc_dai_driver max98357a_dai_driver = {
	.name = "HiFi",
	.playback = {
@@ -90,6 +119,7 @@ static struct snd_soc_dai_driver max98357a_dai_driver = {
		.channels_min	= 1,
		.channels_max	= 2,
	},
	.ops    = &max98357a_dai_ops,
};

static int max98357a_platform_probe(struct platform_device *pdev)
+1 −1
Original line number Diff line number Diff line
@@ -678,7 +678,7 @@ static const struct snd_kcontrol_new max98390_dai_controls =

static const struct snd_soc_dapm_widget max98390_dapm_widgets[] = {
	SND_SOC_DAPM_DAC_E("Amp Enable", "HiFi Playback",
		MAX98390_R203A_AMP_EN, 0, 0, max98390_dac_event,
		SND_SOC_NOPM, 0, 0, max98390_dac_event,
		SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_MUX("DAI Sel Mux", SND_SOC_NOPM, 0, 0,
		&max98390_dai_controls),
+32 −9
Original line number Diff line number Diff line
@@ -336,22 +336,45 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
	struct snd_interval *chan = hw_param_interval(params,
			SNDRV_PCM_HW_PARAM_CHANNELS);
	struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
	struct snd_soc_dpcm *dpcm = container_of(
			params, struct snd_soc_dpcm, hw_params);
	struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link;
	struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link;
	struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL;

	/*
	 * The following loop will be called only for playback stream
	 * In this platform, there is only one playback device on every SSP
	 */
	for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) {
		rtd_dpcm = dpcm;
		break;
	}

	/*
	 * This following loop will be called only for capture stream
	 * In this platform, there is only one capture device on every SSP
	 */
	for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) {
		rtd_dpcm = dpcm;
		break;
	}

	if (!rtd_dpcm)
		return -EINVAL;

	/*
	 * The above 2 loops are mutually exclusive based on the stream direction,
	 * thus rtd_dpcm variable will never be overwritten
	 */

	/*
	 * The ADSP will convert the FE rate to 48k, stereo, 24 bit
	 */
	if (!strcmp(fe_dai_link->name, "Kbl Audio Port") ||
	    !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") ||
	    !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) {
	if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") ||
	    !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") ||
	    !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) {
		rate->min = rate->max = 48000;
		chan->min = chan->max = 2;
		snd_mask_none(fmt);
		snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
	} else if (!strcmp(fe_dai_link->name, "Kbl Audio DMIC cap")) {
	} else if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio DMIC cap")) {
		if (params_channels(params) == 2 ||
				DMIC_CH(dmic_constraints) == 2)
			chan->min = chan->max = 2;
@@ -362,7 +385,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
	 * The speaker on the SSP0 supports S16_LE and not S24_LE.
	 * thus changing the mask here
	 */
	if (!strcmp(be_dai_link->name, "SSP0-Codec"))
	if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec"))
		snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);

	return 0;
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ struct skl_hda_private {
	int dai_index;
	const char *platform_name;
	bool common_hdmi_codec_drv;
	bool idisp_codec;
};

extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS];
Loading