/* Put the spdif to soft-reset mode, and then can be configured.  */
static int32_t spdif_soft_reset(audio_ctrl_p ctrl)
/* Put the spdif to soft-reset mode, and then can be configured.  */
static int32_t spdif_soft_reset(audio_ctrl_p ctrl)
{
    uint32_t instance = ctrl->instance;
    uint32_t val;
    int cycle = 0;
    UNUSED_VARIABLE(instance);
    val = HW_SPDIF_SCR_RD();
    val |= BM_SPDIF_SCR_SOFT_RESET;
    HW_SPDIF_SCR_WR(val);
    while ((HW_SPDIF_SCR_RD() &  BM_SPDIF_SCR_SOFT_RESET) && (cycle++ < 100)) ;
    return 0;
}