[PATCH v2] ASoC: rt1015: support TDM slot configuration

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Tue Nov 3 16:47:21 CET 2020


> +	/* This is an assumption that the system sends stereo audio to the amplifier typically.
> +	 * And the stereo audio is placed in slot 0/2/4/6 as the starting slot.
> +	 * According to the slot number, we also set the mono LR to select the right slot.
> +	 */
> +	first_bit = __ffs(rx_mask);
> +	switch (first_bit) {
> +	case 0:
> +	case 2:
> +	case 4:
> +	case 6:
> +		snd_soc_component_update_bits(component,
> +			RT1015_PAD_DRV2, RT1015_MONO_LR_SEL_MASK,
> +			RT1015_MONO_L_CHANNEL);
> +		snd_soc_component_update_bits(component,
> +			RT1015_TDM1_4,
> +			RT1015_TDM_I2S_TX_L_DAC1_1_MASK |
> +			RT1015_TDM_I2S_TX_R_DAC1_1_MASK,
> +			(first_bit << RT1015_TDM_I2S_TX_L_DAC1_1_SFT) |
> +			((first_bit+1) << RT1015_TDM_I2S_TX_R_DAC1_1_SFT));
> +		break;
> +	case 1:
> +	case 3:
> +	case 5:
> +	case 7:
> +		snd_soc_component_update_bits(component,
> +			RT1015_PAD_DRV2, RT1015_MONO_LR_SEL_MASK,
> +			RT1015_MONO_R_CHANNEL);
> +		snd_soc_component_update_bits(component,
> +			RT1015_TDM1_4,
> +			RT1015_TDM_I2S_TX_L_DAC1_1_MASK |
> +			RT1015_TDM_I2S_TX_R_DAC1_1_MASK,
> +			((first_bit-1) << RT1015_TDM_I2S_TX_L_DAC1_1_SFT) |
> +			(first_bit << RT1015_TDM_I2S_TX_R_DAC1_1_SFT));
> +		break;

One more question from me: if you have 2 amplifiers on the same link and 
use slot 0 and 1, what would be the rx_mask for each amplifier? If the 
mask is BIT(0) for left and BIT(1) for right, it looks like both would 
render L+R?

Also should the settings and channel selection be modifiable using the 
codec configuration as we've done for RT1308, e.g. rt1015-1 would use LL 
and rt1015-2 would use RR?

Thanks
-Pierre


More information about the Alsa-devel mailing list