@@ -204,6 +204,10 @@ static int max98373_set_clock(struct snd_soc_component *component,
204204 return 0 ;
205205}
206206
207+ #define MAX_98373_CODEC_DAI "max98373-aif1"
208+ #define MAX_98373_DEV0_NAME "i2c-MX98373:00"
209+ #define MAX_98373_DEV1_NAME "i2c-MX98373:01"
210+
207211static int max98373_dai_hw_params (struct snd_pcm_substream * substream ,
208212 struct snd_pcm_hw_params * params ,
209213 struct snd_soc_dai * dai )
@@ -213,6 +217,36 @@ static int max98373_dai_hw_params(struct snd_pcm_substream *substream,
213217 unsigned int sampling_rate = 0 ;
214218 unsigned int chan_sz = 0 ;
215219
220+ if (!strcmp (dai -> component -> name , MAX_98373_DEV0_NAME )) {
221+ /* voltage(1), current(0) slot configuration */
222+ regmap_write (max98373 -> regmap ,
223+ MAX98373_R2022_PCM_TX_SRC_1 ,
224+ (0x0 << MAX98373_PCM_TX_CH_SRC_A_I_SHIFT |
225+ 0x1 ) & 0xFF );
226+ regmap_update_bits (max98373 -> regmap ,
227+ MAX98373_R2020_PCM_TX_HIZ_EN_1 ,
228+ 0x3 , 0 );
229+
230+ /* speaker feedback slot configuration */
231+ regmap_write (max98373 -> regmap ,
232+ MAX98373_R2023_PCM_TX_SRC_2 ,
233+ 0x10 );
234+ } else if (!strcmp (dai -> component -> name , MAX_98373_DEV1_NAME )) {
235+ /* voltage(3), current(2) slot configuration */
236+ regmap_write (max98373 -> regmap ,
237+ MAX98373_R2022_PCM_TX_SRC_1 ,
238+ (0x2 << MAX98373_PCM_TX_CH_SRC_A_I_SHIFT |
239+ 0x3 ) & 0xFF );
240+ regmap_update_bits (max98373 -> regmap ,
241+ MAX98373_R2020_PCM_TX_HIZ_EN_1 ,
242+ 0xc , 0 );
243+
244+ /* speaker feedback slot configuration */
245+ regmap_write (max98373 -> regmap ,
246+ MAX98373_R2023_PCM_TX_SRC_2 ,
247+ 0x20 );
248+ }
249+
216250 /* pcm mode configuration */
217251 switch (snd_pcm_format_width (params_format (params ))) {
218252 case 16 :
0 commit comments