Commit ca7a2317 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

Merge tag 'asoc-fix-v6.18-merge-window' of...

Merge tag 'asoc-fix-v6.18-merge-window' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.18

A small pile of fixes, almost all for the Intel and SOF code surrounding
management of the host buffer.  We've also got one fix for Meson and new
device IDs and quirk supporting the RT722VB.
parents f4ace70f a2753981
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ static int rt722_sdca_mbq_size(struct device *dev, unsigned int reg)
	switch (reg) {
	case 0x2f01 ... 0x2f0a:
	case 0x2f35 ... 0x2f36:
	case 0x2f50:
	case 0x2f50 ... 0x2f52:
	case 0x2f54:
	case 0x2f58 ... 0x2f5d:
	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT0, RT722_SDCA_CTL_FUNC_STATUS, 0):
+14 −0
Original line number Diff line number Diff line
@@ -1378,6 +1378,9 @@ static void rt722_sdca_dmic_preset(struct rt722_sdca_priv *rt722)
		/* PHYtiming TDZ/TZD control */
		regmap_write(rt722->regmap, 0x2f03, 0x06);

		if (rt722->hw_vid == RT722_VB)
			regmap_write(rt722->regmap, 0x2f52, 0x00);

		/* clear flag */
		regmap_write(rt722->regmap,
			SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT0, RT722_SDCA_CTL_FUNC_STATUS, 0),
@@ -1415,6 +1418,9 @@ static void rt722_sdca_amp_preset(struct rt722_sdca_priv *rt722)
			SDW_SDCA_CTL(FUNC_NUM_AMP, RT722_SDCA_ENT_OT23,
				RT722_SDCA_CTL_VENDOR_DEF, CH_08), 0x04);

		if (rt722->hw_vid == RT722_VB)
			regmap_write(rt722->regmap, 0x2f54, 0x00);

		/* clear flag */
		regmap_write(rt722->regmap,
			SDW_SDCA_CTL(FUNC_NUM_AMP, RT722_SDCA_ENT0, RT722_SDCA_CTL_FUNC_STATUS, 0),
@@ -1506,6 +1512,9 @@ static void rt722_sdca_jack_preset(struct rt722_sdca_priv *rt722)
		rt722_sdca_index_write(rt722, RT722_VENDOR_REG, RT722_DIGITAL_MISC_CTRL4,
			0x0010);

		if (rt722->hw_vid == RT722_VB)
			regmap_write(rt722->regmap, 0x2f51, 0x00);

		/* clear flag */
		regmap_write(rt722->regmap,
			SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT0, RT722_SDCA_CTL_FUNC_STATUS, 0),
@@ -1516,6 +1525,7 @@ static void rt722_sdca_jack_preset(struct rt722_sdca_priv *rt722)
int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave)
{
	struct rt722_sdca_priv *rt722 = dev_get_drvdata(dev);
	unsigned int val;

	rt722->disable_irq = false;

@@ -1545,6 +1555,10 @@ int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave)

	pm_runtime_get_noresume(&slave->dev);

	rt722_sdca_index_read(rt722, RT722_VENDOR_REG, RT722_JD_PRODUCT_NUM, &val);
	rt722->hw_vid = (val & 0x0f00) >> 8;
	dev_dbg(&slave->dev, "%s hw_vid=0x%x\n", __func__, rt722->hw_vid);

	rt722_sdca_dmic_preset(rt722);
	rt722_sdca_amp_preset(rt722);
	rt722_sdca_jack_preset(rt722);
+6 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ struct rt722_sdca_priv {
	/* For DMIC */
	bool fu1e_dapm_mute;
	bool fu1e_mixer_mute[4];
	int hw_vid;
};

struct rt722_sdca_dmic_kctrl_priv {
@@ -233,6 +234,11 @@ enum rt722_sdca_jd_src {
	RT722_JD1,
};

enum rt722_sdca_version {
	RT722_VA,
	RT722_VB,
};

int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave);
int rt722_sdca_init(struct device *dev, struct regmap *regmap, struct sdw_slave *slave);
int rt722_sdca_index_write(struct rt722_sdca_priv *rt722,
+6 −3
Original line number Diff line number Diff line
@@ -236,8 +236,12 @@ static int aiu_encoder_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
	    inv == SND_SOC_DAIFMT_IB_IF)
		val |= AIU_CLK_CTRL_LRCLK_INVERT;

	if (inv == SND_SOC_DAIFMT_IB_NF ||
	    inv == SND_SOC_DAIFMT_IB_IF)
	/*
	 * The SoC changes data on the rising edge of the bitclock
	 * so an inversion of the bitclock is required in normal mode
	 */
	if (inv == SND_SOC_DAIFMT_NB_NF ||
	    inv == SND_SOC_DAIFMT_NB_IF)
		val |= AIU_CLK_CTRL_AOCLK_INVERT;

	/* Signal skew */
@@ -328,4 +332,3 @@ const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops = {
	.startup	= aiu_encoder_i2s_startup,
	.shutdown	= aiu_encoder_i2s_shutdown,
};
+21 −8
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@
#define SDnFMT_BITS(x)	((x) << 4)
#define SDnFMT_CHAN(x)	((x) << 0)

#define HDA_MAX_PERIOD_TIME_HEADROOM	10

static bool hda_always_enable_dmi_l1;
module_param_named(always_enable_dmi_l1, hda_always_enable_dmi_l1, bool, 0444);
MODULE_PARM_DESC(always_enable_dmi_l1, "SOF HDA always enable DMI l1");
@@ -291,19 +293,30 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
	 * On playback start the DMA will transfer dsp_max_burst_size_in_ms
	 * amount of data in one initial burst to fill up the host DMA buffer.
	 * Consequent DMA burst sizes are shorter and their length can vary.
	 * To make sure that userspace allocate large enough ALSA buffer we need
	 * to place a constraint on the buffer time.
	 * To avoid immediate xrun by the initial burst we need to place
	 * constraint on the period size (via PERIOD_TIME) to cover the size of
	 * the host buffer.
	 * We need to add headroom of max 10ms as the firmware needs time to
	 * settle to the 1ms pacing and initially it can run faster for few
	 * internal periods.
	 *
	 * On capture the DMA will transfer 1ms chunks.
	 *
	 * Exact dsp_max_burst_size_in_ms constraint is racy, so set the
	 * constraint to a minimum of 2x dsp_max_burst_size_in_ms.
	 */
	if (spcm->stream[direction].dsp_max_burst_size_in_ms)
	if (spcm->stream[direction].dsp_max_burst_size_in_ms) {
		unsigned int period_time = spcm->stream[direction].dsp_max_burst_size_in_ms;

		/*
		 * add headroom over the maximum burst size to cover the time
		 * needed for the DMA pace to settle.
		 * Limit the headroom time to HDA_MAX_PERIOD_TIME_HEADROOM
		 */
		period_time += min(period_time, HDA_MAX_PERIOD_TIME_HEADROOM);

		snd_pcm_hw_constraint_minmax(substream->runtime,
			SNDRV_PCM_HW_PARAM_BUFFER_TIME,
			spcm->stream[direction].dsp_max_burst_size_in_ms * USEC_PER_MSEC * 2,
			SNDRV_PCM_HW_PARAM_PERIOD_TIME,
			period_time * USEC_PER_MSEC,
			UINT_MAX);
	}

	/* binding pcm substream to hda stream */
	substream->runtime->private_data = &dsp_stream->hstream;
Loading