@@ -322,8 +322,8 @@ static int es8374_i2s_config_clock(audio_codec_es8374_t *codec, es_i2s_clock_t c
322322 default :
323323 break ;
324324 }
325- ret |= es8374_write_reg (codec , 0x06 , dacratio_h ); // ADCFsMode,singel SPEED,RATIO=256
326- ret |= es8374_write_reg (codec , 0x07 , dacratio_l ); // ADCFsMode,singel SPEED,RATIO=256
325+ ret |= es8374_write_reg (codec , 0x06 , dacratio_h ); // ADCFsMode, single SPEED, RATIO=256
326+ ret |= es8374_write_reg (codec , 0x07 , dacratio_l ); // ADCFsMode, single SPEED, RATIO=256
327327
328328 return ret ;
329329}
@@ -430,10 +430,10 @@ static int es8374_init_reg(audio_codec_es8374_t *codec, es_i2s_fmt_t fmt, es_i2s
430430
431431 ret |= es8374_i2s_config_clock (codec , cfg );
432432
433- ret |= es8374_write_reg (codec , 0x24 , 0x08 ); // adc set
434- ret |= es8374_write_reg (codec , 0x36 , 0x00 ); // dac set
435- ret |= es8374_write_reg (codec , 0x12 , 0x30 ); // timming set
436- ret |= es8374_write_reg (codec , 0x13 , 0x20 ); // timming set
433+ ret |= es8374_write_reg (codec , 0x24 , 0x08 ); // adc set
434+ ret |= es8374_write_reg (codec , 0x36 , 0x00 ); // dac set
435+ ret |= es8374_write_reg (codec , 0x12 , 0x30 ); // timing set
436+ ret |= es8374_write_reg (codec , 0x13 , 0x20 ); // timing set
437437
438438 ret |= es8374_config_fmt (codec , fmt );
439439
@@ -607,11 +607,12 @@ static void es8374_pa_power(audio_codec_es8374_t *codec, bool enable)
607607
608608static int es8374_open (const audio_codec_if_t * h , void * cfg , int cfg_size )
609609{
610- audio_codec_es8374_t * codec = (audio_codec_es8374_t * ) h ;
611- es8374_codec_cfg_t * codec_cfg = (es8374_codec_cfg_t * ) cfg ;
610+ audio_codec_es8374_t * codec = (audio_codec_es8374_t * )h ;
611+ es8374_codec_cfg_t * codec_cfg = (es8374_codec_cfg_t * )cfg ;
612612 if (codec == NULL || codec_cfg == NULL || codec_cfg -> ctrl_if == NULL || cfg_size != sizeof (es8374_codec_cfg_t )) {
613613 return ESP_CODEC_DEV_INVALID_ARG ;
614614 }
615+ es8374_pa_power (codec , false);
615616 int ret = ESP_CODEC_DEV_OK ;
616617 memcpy (& codec -> cfg , codec_cfg , sizeof (es8374_codec_cfg_t ));
617618 es_i2s_clock_t clkdiv ;
@@ -632,14 +633,14 @@ static int es8374_open(const audio_codec_if_t *h, void *cfg, int cfg_size)
632633
633634static int es8374_close (const audio_codec_if_t * h )
634635{
635- audio_codec_es8374_t * codec = (audio_codec_es8374_t * ) h ;
636+ audio_codec_es8374_t * codec = (audio_codec_es8374_t * )h ;
636637 if (codec == NULL ) {
637638 return ESP_CODEC_DEV_INVALID_ARG ;
638639 }
639640 if (codec -> is_open ) {
640- es8374_stop (codec );
641- es8374_write_reg (codec , 0x00 , 0x7F ); // IC Reset and STOP
642641 es8374_pa_power (codec , false);
642+ es8374_stop (codec );
643+ es8374_write_reg (codec , 0x00 , 0x7F ); // IC Reset and STOP
643644 codec -> is_open = false;
644645 }
645646 return ESP_CODEC_DEV_OK ;
0 commit comments