rk3328_codec: add delays between register writes in the initial setup

MFC after:	1 month
This commit is contained in:
Andriy Gapon 2021-06-09 12:10:50 +03:00
parent 69d202f224
commit 507fdedd83

View File

@ -296,61 +296,77 @@ rkcodec_attach(device_t dev)
val = RKCODEC_READ(sc, CODEC_DAC_PWR_CTRL);
val |= DAC_PWR_CTRL_DAC_PWR;
RKCODEC_WRITE(sc, CODEC_DAC_PWR_CTRL, val);
DELAY(1000);
val |= DAC_PWR_CTRL_DACL_PATH_REFV |
DAC_PWR_CTRL_DACR_PATH_REFV;
RKCODEC_WRITE(sc, CODEC_DAC_PWR_CTRL, val);
DELAY(1000);
val |= DAC_PWR_CTRL_HPOUTL_ZERO_CROSSING |
DAC_PWR_CTRL_HPOUTR_ZERO_CROSSING;
RKCODEC_WRITE(sc, CODEC_DAC_PWR_CTRL, val);
DELAY(1000);
val = RKCODEC_READ(sc, CODEC_HPOUT_POP_CTRL);
val |= HPOUT_POP_CTRL_HPOUTR_POP | HPOUT_POP_CTRL_HPOUTL_POP;
val &= ~(HPOUT_POP_CTRL_HPOUTR_POP_XCHARGE | HPOUT_POP_CTRL_HPOUTL_POP_XCHARGE);
RKCODEC_WRITE(sc, CODEC_HPOUT_POP_CTRL, val);
DELAY(1000);
val = RKCODEC_READ(sc, CODEC_HPMIX_CTRL);
val |= HPMIX_CTRL_HPMIXL_EN | HPMIX_CTRL_HPMIXR_EN;
RKCODEC_WRITE(sc, CODEC_HPMIX_CTRL, val);
DELAY(1000);
val |= HPMIX_CTRL_HPMIXL_INIT_EN | HPMIX_CTRL_HPMIXR_INIT_EN;
RKCODEC_WRITE(sc, CODEC_HPMIX_CTRL, val);
DELAY(1000);
val = RKCODEC_READ(sc, CODEC_HPOUT_CTRL);
val |= HPOUT_CTRL_HPOUTL_EN | HPOUT_CTRL_HPOUTR_EN;
RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val);
DELAY(1000);
val |= HPOUT_CTRL_HPOUTL_INIT_EN | HPOUT_CTRL_HPOUTR_INIT_EN;
RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val);
DELAY(1000);
val = RKCODEC_READ(sc, CODEC_DAC_CLK_CTRL);
val |= DAC_CLK_CTRL_DACL_REFV_ON | DAC_CLK_CTRL_DACR_REFV_ON;
RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val);
DELAY(1000);
val |= DAC_CLK_CTRL_DACL_CLK_ON | DAC_CLK_CTRL_DACR_CLK_ON;
RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val);
DELAY(1000);
val |= DAC_CLK_CTRL_DACL_ON | DAC_CLK_CTRL_DACR_ON;
RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val);
DELAY(1000);
val |= DAC_CLK_CTRL_DACL_INIT_ON | DAC_CLK_CTRL_DACR_INIT_ON;
RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val);
DELAY(1000);
val = RKCODEC_READ(sc, CODEC_DAC_SELECT);
val |= DAC_SELECT_DACL_SELECT | DAC_SELECT_DACR_SELECT;
RKCODEC_WRITE(sc, CODEC_DAC_SELECT, val);
DELAY(1000);
val = RKCODEC_READ(sc, CODEC_HPMIX_CTRL);
val |= HPMIX_CTRL_HPMIXL_INIT2_EN | HPMIX_CTRL_HPMIXR_INIT2_EN;
RKCODEC_WRITE(sc, CODEC_HPMIX_CTRL, val);
DELAY(1000);
val = RKCODEC_READ(sc, CODEC_HPOUT_CTRL);
val |= HPOUT_CTRL_HPOUTL_UNMUTE | HPOUT_CTRL_HPOUTR_UNMUTE;
RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val);
DELAY(1000);
RKCODEC_WRITE(sc, CODEC_HPOUTL_GAIN_CTRL, 0x1f);
RKCODEC_WRITE(sc, CODEC_HPOUTR_GAIN_CTRL, 0x1f);
DELAY(1000);
rkcodec_set_mute(sc, false);