[PATCH v3 2/2] ASoC: spacemit: add i2s support for K1 SoC

Mark Brown broonie at kernel.org
Mon Sep 15 12:52:48 PDT 2025


On Thu, Sep 11, 2025 at 01:47:11PM +0800, Troy Mitchell wrote:

> +
> +static int spacemit_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
> +				unsigned int fmt)
> +{
> +	struct spacemit_i2s_dev *i2s = dev_get_drvdata(cpu_dai->dev);
> +	u32 sspsp_val;

> +	case SND_SOC_DAIFMT_DSP_A:
> +		sspsp_val |= SSPSP_FSRT;
> +	case SND_SOC_DAIFMT_DSP_B:
> +		cpu_dai->driver->playback.channels_min = 1;
> +		cpu_dai->driver->playback.channels_max = 1;
> +		cpu_dai->driver->capture.channels_min = 1;
> +		cpu_dai->driver->capture.channels_max = 1;
> +		cpu_dai->driver->playback.formats = SNDRV_PCM_FMTBIT_S32_LE;
> +		cpu_dai->driver->capture.formats = SNDRV_PCM_FMTBIT_S32_LE;
> +		sspsp_val |= FIELD_PREP(SSPSP_FIELD_SFRMWDTH, 0x1);
> +		break;

You really shouldn't be modifying the driver struct at all, if two
interfaces have different configurations or if one interface changes
modes the two will fight with each other.  Use the constraints API to
enforce any constraints that are discovered at runtime.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20250915/ee3caa63/attachment.sig>


More information about the linux-riscv mailing list