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

Shuming [范書銘] shumingf at realtek.com
Wed Nov 4 02:42:00 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?

Oh, I didn't expect that the customers want to render L+R when using TDM configuration.

> 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?

OK, I will remove the mono LR channel selection in rt1015_set_tdm_slot function.
The channel selection setting would be controlled by the application level only.
RT1015 is a mono amplifier, it could select 'Left', 'Right' and 'Left + Right average'.

> 
> Thanks
> -Pierre
> 
> ------Please consider the environment before printing this e-mail.


More information about the Alsa-devel mailing list