Lines Matching refs:mclk_id

213 static int dai_ssp_setup_initial_mclk_source(struct dai_intel_ssp *dp, uint32_t mclk_id,  in dai_ssp_setup_initial_mclk_source()  argument
224 if (mclk_id >= DAI_INTEL_SSP_NUM_MCLK) { in dai_ssp_setup_initial_mclk_source()
226 mclk_id, DAI_INTEL_SSP_NUM_MCLK); in dai_ssp_setup_initial_mclk_source()
250 mdivc |= MN_MDIVCTRL_M_DIV_ENABLE(mclk_id); in dai_ssp_setup_initial_mclk_source()
260 mp->mclk_sources_ref[mclk_id]++; in dai_ssp_setup_initial_mclk_source()
271 static int dai_ssp_check_current_mclk_source(struct dai_intel_ssp *dp, uint16_t mclk_id, in dai_ssp_check_current_mclk_source() argument
288 if (mp->mclk_sources_ref[mclk_id] > 0) { in dai_ssp_check_current_mclk_source()
289 if (mp->mclk_rate[mclk_id] != mclk_rate) { in dai_ssp_check_current_mclk_source()
291 mclk_id, mclk_rate, mp->mclk_rate[mclk_id]); in dai_ssp_check_current_mclk_source()
295 mp->mclk_sources_ref[mclk_id]++; in dai_ssp_check_current_mclk_source()
300 mdivc |= MN_MDIVCTRL_M_DIV_ENABLE(mclk_id); in dai_ssp_check_current_mclk_source()
303 mp->mclk_sources_ref[mclk_id]++; in dai_ssp_check_current_mclk_source()
315 static int dai_ssp_set_mclk_divider(struct dai_intel_ssp *dp, uint16_t mclk_id, uint32_t mdivr_val) in dai_ssp_set_mclk_divider() argument
319 LOG_INF("mclk_id %d mdivr_val %d", mclk_id, mdivr_val); in dai_ssp_set_mclk_divider()
332 sys_write32(mdivr, dai_mn_base(dp) + MN_MDIVR(mclk_id)); in dai_ssp_set_mclk_divider()
337 static int dai_ssp_mn_set_mclk(struct dai_intel_ssp *dp, uint16_t mclk_id, uint32_t mclk_rate) in dai_ssp_mn_set_mclk() argument
344 if (mclk_id >= DAI_INTEL_SSP_NUM_MCLK) { in dai_ssp_mn_set_mclk()
345 LOG_ERR("mclk ID (%d) >= %d", mclk_id, DAI_INTEL_SSP_NUM_MCLK); in dai_ssp_mn_set_mclk()
352 ret = dai_ssp_check_current_mclk_source(dp, mclk_id, mclk_rate); in dai_ssp_mn_set_mclk()
354 ret = dai_ssp_setup_initial_mclk_source(dp, mclk_id, mclk_rate); in dai_ssp_mn_set_mclk()
363 ret = dai_ssp_set_mclk_divider(dp, mclk_id, ft[mp->mclk_source_clock].freq / mclk_rate); in dai_ssp_mn_set_mclk()
365 mp->mclk_rate[mclk_id] = mclk_rate; in dai_ssp_mn_set_mclk()
382 static void dai_ssp_mn_release_mclk(struct dai_intel_ssp *dp, uint32_t mclk_id) in dai_ssp_mn_release_mclk() argument
390 mp->mclk_sources_ref[mclk_id]--; in dai_ssp_mn_release_mclk()
393 if (!mp->mclk_sources_ref[mclk_id]) { in dai_ssp_mn_release_mclk()
396 mdivc &= ~MN_MDIVCTRL_M_DIV_ENABLE(mclk_id); in dai_ssp_mn_release_mclk()
1132 ret = dai_ssp_mn_set_mclk(dp, ssp_plat_data->params.mclk_id, in dai_ssp_mclk_prepare_enable()
1136 ssp_plat_data->params.mclk_id); in dai_ssp_mclk_prepare_enable()
1152 dai_ssp_mn_release_mclk(dp, ssp_plat_data->params.mclk_id); in dai_ssp_mclk_disable_unprepare()