Lines Matching refs:player

64 	struct uniperif *player = dev_id;  in uni_player_irq_handler()  local
68 spin_lock(&player->irq_lock); in uni_player_irq_handler()
69 if (!player->substream) in uni_player_irq_handler()
72 snd_pcm_stream_lock(player->substream); in uni_player_irq_handler()
73 if (player->state == UNIPERIF_STATE_STOPPED) in uni_player_irq_handler()
77 status = GET_UNIPERIF_ITS(player); in uni_player_irq_handler()
78 SET_UNIPERIF_ITS_BCLR(player, status); in uni_player_irq_handler()
81 if (unlikely(status & UNIPERIF_ITS_FIFO_ERROR_MASK(player))) { in uni_player_irq_handler()
82 dev_err(player->dev, "FIFO underflow error detected\n"); in uni_player_irq_handler()
85 if (player->underflow_enabled) { in uni_player_irq_handler()
87 player->state = UNIPERIF_STATE_UNDERFLOW; in uni_player_irq_handler()
91 SET_UNIPERIF_ITM_BCLR_FIFO_ERROR(player); in uni_player_irq_handler()
94 snd_pcm_stop_xrun(player->substream); in uni_player_irq_handler()
101 if (unlikely(status & UNIPERIF_ITS_DMA_ERROR_MASK(player))) { in uni_player_irq_handler()
102 dev_err(player->dev, "DMA error detected\n"); in uni_player_irq_handler()
105 SET_UNIPERIF_ITM_BCLR_DMA_ERROR(player); in uni_player_irq_handler()
108 snd_pcm_stop_xrun(player->substream); in uni_player_irq_handler()
114 if (unlikely(status & UNIPERIF_ITM_UNDERFLOW_REC_DONE_MASK(player))) { in uni_player_irq_handler()
115 if (!player->underflow_enabled) { in uni_player_irq_handler()
116 dev_err(player->dev, in uni_player_irq_handler()
122 tmp = GET_UNIPERIF_STATUS_1_UNDERFLOW_DURATION(player); in uni_player_irq_handler()
123 dev_dbg(player->dev, "Underflow recovered (%d LR clocks max)\n", in uni_player_irq_handler()
127 SET_UNIPERIF_BIT_CONTROL_CLR_UNDERFLOW_DURATION(player); in uni_player_irq_handler()
130 player->state = UNIPERIF_STATE_STARTED; in uni_player_irq_handler()
137 UNIPERIF_ITM_UNDERFLOW_REC_FAILED_MASK(player))) { in uni_player_irq_handler()
138 dev_err(player->dev, "Underflow recovery failed\n"); in uni_player_irq_handler()
141 snd_pcm_stop_xrun(player->substream); in uni_player_irq_handler()
147 snd_pcm_stream_unlock(player->substream); in uni_player_irq_handler()
149 spin_unlock(&player->irq_lock); in uni_player_irq_handler()
154 static int uni_player_clk_set_rate(struct uniperif *player, unsigned long rate) in uni_player_clk_set_rate() argument
157 int adjustment = player->clk_adj; in uni_player_clk_set_rate()
190 ret = clk_set_rate(player->clk, rate_adjusted); in uni_player_clk_set_rate()
194 rate_achieved = clk_get_rate(player->clk); in uni_player_clk_set_rate()
214 player->clk_adj = adjustment; in uni_player_clk_set_rate()
218 static void uni_player_set_channel_status(struct uniperif *player, in uni_player_set_channel_status() argument
229 mutex_lock(&player->ctrl_lock); in uni_player_set_channel_status()
233 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
237 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
241 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
245 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
249 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
253 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
257 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
261 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
265 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
270 player->stream_settings.iec958.status[3] = in uni_player_set_channel_status()
279 if (player->stream_settings.iec958.status[0] & IEC958_AES0_NONAUDIO) in uni_player_set_channel_status()
280 player->stream_settings.encoding_mode = in uni_player_set_channel_status()
283 player->stream_settings.encoding_mode = in uni_player_set_channel_status()
286 if (player->stream_settings.encoding_mode == in uni_player_set_channel_status()
289 SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(player, 0); in uni_player_set_channel_status()
292 SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(player, 1); in uni_player_set_channel_status()
297 player->stream_settings.iec958.status[0 + (n * 4)] & 0xf; in uni_player_set_channel_status()
299 player->stream_settings.iec958.status[1 + (n * 4)] << 8; in uni_player_set_channel_status()
301 player->stream_settings.iec958.status[2 + (n * 4)] << 16; in uni_player_set_channel_status()
303 player->stream_settings.iec958.status[3 + (n * 4)] << 24; in uni_player_set_channel_status()
304 SET_UNIPERIF_CHANNEL_STA_REGN(player, n, status); in uni_player_set_channel_status()
306 mutex_unlock(&player->ctrl_lock); in uni_player_set_channel_status()
309 if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) in uni_player_set_channel_status()
310 SET_UNIPERIF_CONFIG_CHL_STS_UPDATE(player); in uni_player_set_channel_status()
312 SET_UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE(player); in uni_player_set_channel_status()
315 static int uni_player_prepare_iec958(struct uniperif *player, in uni_player_prepare_iec958() argument
320 clk_div = player->mclk / runtime->rate; in uni_player_prepare_iec958()
324 dev_err(player->dev, "%s: invalid clk_div %d\n", in uni_player_prepare_iec958()
332 SET_UNIPERIF_CONFIG_MEM_FMT_16_16(player); in uni_player_prepare_iec958()
334 SET_UNIPERIF_I2S_FMT_NBIT_32(player); in uni_player_prepare_iec958()
336 SET_UNIPERIF_I2S_FMT_DATA_SIZE_16(player); in uni_player_prepare_iec958()
340 SET_UNIPERIF_CONFIG_MEM_FMT_16_0(player); in uni_player_prepare_iec958()
342 SET_UNIPERIF_I2S_FMT_NBIT_32(player); in uni_player_prepare_iec958()
344 SET_UNIPERIF_I2S_FMT_DATA_SIZE_24(player); in uni_player_prepare_iec958()
347 dev_err(player->dev, "format not supported\n"); in uni_player_prepare_iec958()
352 SET_UNIPERIF_CONFIG_PARITY_CNTR_BY_HW(player); in uni_player_prepare_iec958()
355 SET_UNIPERIF_CONFIG_CHANNEL_STA_CNTR_BY_HW(player); in uni_player_prepare_iec958()
358 SET_UNIPERIF_CONFIG_USER_DAT_CNTR_BY_HW(player); in uni_player_prepare_iec958()
361 SET_UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_BY_HW(player); in uni_player_prepare_iec958()
364 SET_UNIPERIF_CONFIG_SPDIF_SW_CTRL_DISABLE(player); in uni_player_prepare_iec958()
366 SET_UNIPERIF_CTRL_ZERO_STUFF_HW(player); in uni_player_prepare_iec958()
369 uni_player_set_channel_status(player, runtime); in uni_player_prepare_iec958()
372 SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(player, 0); in uni_player_prepare_iec958()
375 SET_UNIPERIF_CONFIG_ONE_BIT_AUD_DISABLE(player); in uni_player_prepare_iec958()
378 SET_UNIPERIF_CONFIG_REPEAT_CHL_STS_ENABLE(player); in uni_player_prepare_iec958()
381 SET_UNIPERIF_CONFIG_SUBFRAME_SEL_SUBF1_SUBF0(player); in uni_player_prepare_iec958()
384 SET_UNIPERIF_I2S_FMT_ORDER_MSB(player); in uni_player_prepare_iec958()
386 if (player->stream_settings.encoding_mode == in uni_player_prepare_iec958()
388 SET_UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_ON(player); in uni_player_prepare_iec958()
390 SET_UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_OFF(player); in uni_player_prepare_iec958()
392 SET_UNIPERIF_I2S_FMT_NUM_CH(player, runtime->channels / 2); in uni_player_prepare_iec958()
395 SET_UNIPERIF_CTRL_ROUNDING_OFF(player); in uni_player_prepare_iec958()
398 SET_UNIPERIF_CTRL_DIVIDER(player, clk_div / 128); in uni_player_prepare_iec958()
401 SET_UNIPERIF_CTRL_SPDIF_LAT_OFF(player); in uni_player_prepare_iec958()
408 if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) in uni_player_prepare_iec958()
409 SET_UNIPERIF_CTRL_SPDIF_FMT_OFF(player); in uni_player_prepare_iec958()
411 SET_UNIPERIF_CTRL_SPDIF_FMT_ON(player); in uni_player_prepare_iec958()
416 static int uni_player_prepare_pcm(struct uniperif *player, in uni_player_prepare_pcm() argument
422 if ((player->daifmt & SND_SOC_DAIFMT_FORMAT_MASK) == in uni_player_prepare_pcm()
430 clk_div = player->mclk / runtime->rate; in uni_player_prepare_pcm()
436 dev_err(player->dev, "%s: invalid clk_div\n", __func__); in uni_player_prepare_pcm()
441 dev_err(player->dev, "%s: invalid clk_div\n", __func__); in uni_player_prepare_pcm()
451 SET_UNIPERIF_I2S_FMT_NBIT_32(player); in uni_player_prepare_pcm()
452 SET_UNIPERIF_I2S_FMT_DATA_SIZE_32(player); in uni_player_prepare_pcm()
455 SET_UNIPERIF_I2S_FMT_NBIT_16(player); in uni_player_prepare_pcm()
456 SET_UNIPERIF_I2S_FMT_DATA_SIZE_16(player); in uni_player_prepare_pcm()
459 dev_err(player->dev, "subframe format not supported\n"); in uni_player_prepare_pcm()
467 SET_UNIPERIF_CONFIG_MEM_FMT_16_16(player); in uni_player_prepare_pcm()
475 SET_UNIPERIF_CONFIG_MEM_FMT_16_0(player); in uni_player_prepare_pcm()
479 dev_err(player->dev, "format not supported\n"); in uni_player_prepare_pcm()
484 SET_UNIPERIF_CTRL_ROUNDING_OFF(player); in uni_player_prepare_pcm()
487 SET_UNIPERIF_CTRL_DIVIDER(player, clk_div / (2 * output_frame_size)); in uni_player_prepare_pcm()
492 dev_err(player->dev, "%s: invalid nb of channels\n", __func__); in uni_player_prepare_pcm()
496 SET_UNIPERIF_I2S_FMT_NUM_CH(player, runtime->channels / 2); in uni_player_prepare_pcm()
499 SET_UNIPERIF_CONFIG_ONE_BIT_AUD_DISABLE(player); in uni_player_prepare_pcm()
501 SET_UNIPERIF_I2S_FMT_ORDER_MSB(player); in uni_player_prepare_pcm()
504 SET_UNIPERIF_CTRL_SPDIF_FMT_OFF(player); in uni_player_prepare_pcm()
509 static int uni_player_prepare_tdm(struct uniperif *player, in uni_player_prepare_tdm() argument
520 sti_uniperiph_get_unip_tdm_frame_size(player); in uni_player_prepare_tdm()
525 SET_UNIPERIF_CONFIG_MEM_FMT_16_0(player); in uni_player_prepare_tdm()
526 SET_UNIPERIF_I2S_FMT_DATA_SIZE_32(player); in uni_player_prepare_tdm()
529 SET_UNIPERIF_I2S_FMT_NUM_CH(player, user_frame_size / 4 / 2); in uni_player_prepare_tdm()
531 SET_UNIPERIF_I2S_FMT_ORDER_MSB(player); in uni_player_prepare_tdm()
532 SET_UNIPERIF_I2S_FMT_ALIGN_LEFT(player); in uni_player_prepare_tdm()
535 SET_UNIPERIF_TDM_ENABLE_TDM_ENABLE(player); in uni_player_prepare_tdm()
538 SET_UNIPERIF_TDM_FS_REF_DIV_NUM_TIMESLOT(player, tdm_frame_size); in uni_player_prepare_tdm()
541 sti_uniperiph_get_tdm_word_pos(player, word_pos); in uni_player_prepare_tdm()
542 SET_UNIPERIF_TDM_WORD_POS(player, 1_2, word_pos[WORD_1_2]); in uni_player_prepare_tdm()
543 SET_UNIPERIF_TDM_WORD_POS(player, 3_4, word_pos[WORD_3_4]); in uni_player_prepare_tdm()
544 SET_UNIPERIF_TDM_WORD_POS(player, 5_6, word_pos[WORD_5_6]); in uni_player_prepare_tdm()
545 SET_UNIPERIF_TDM_WORD_POS(player, 7_8, word_pos[WORD_7_8]); in uni_player_prepare_tdm()
549 mutex_lock(&player->ctrl_lock); in uni_player_prepare_tdm()
550 ret = uni_player_clk_set_rate(player, freq); in uni_player_prepare_tdm()
552 player->mclk = freq; in uni_player_prepare_tdm()
553 mutex_unlock(&player->ctrl_lock); in uni_player_prepare_tdm()
575 struct uniperif *player = priv->dai_data.uni; in uni_player_ctl_iec958_get() local
576 struct snd_aes_iec958 *iec958 = &player->stream_settings.iec958; in uni_player_ctl_iec958_get()
578 mutex_lock(&player->ctrl_lock); in uni_player_ctl_iec958_get()
583 mutex_unlock(&player->ctrl_lock); in uni_player_ctl_iec958_get()
592 struct uniperif *player = priv->dai_data.uni; in uni_player_ctl_iec958_put() local
593 struct snd_aes_iec958 *iec958 = &player->stream_settings.iec958; in uni_player_ctl_iec958_put()
596 mutex_lock(&player->ctrl_lock); in uni_player_ctl_iec958_put()
601 mutex_unlock(&player->ctrl_lock); in uni_player_ctl_iec958_put()
603 spin_lock_irqsave(&player->irq_lock, flags); in uni_player_ctl_iec958_put()
604 if (player->substream && player->substream->runtime) in uni_player_ctl_iec958_put()
605 uni_player_set_channel_status(player, in uni_player_ctl_iec958_put()
606 player->substream->runtime); in uni_player_ctl_iec958_put()
608 uni_player_set_channel_status(player, NULL); in uni_player_ctl_iec958_put()
610 spin_unlock_irqrestore(&player->irq_lock, flags); in uni_player_ctl_iec958_put()
642 struct uniperif *player = priv->dai_data.uni; in snd_sti_clk_adjustment_get() local
644 mutex_lock(&player->ctrl_lock); in snd_sti_clk_adjustment_get()
645 ucontrol->value.integer.value[0] = player->clk_adj; in snd_sti_clk_adjustment_get()
646 mutex_unlock(&player->ctrl_lock); in snd_sti_clk_adjustment_get()
656 struct uniperif *player = priv->dai_data.uni; in snd_sti_clk_adjustment_put() local
663 mutex_lock(&player->ctrl_lock); in snd_sti_clk_adjustment_put()
664 player->clk_adj = ucontrol->value.integer.value[0]; in snd_sti_clk_adjustment_put()
666 if (player->mclk) in snd_sti_clk_adjustment_put()
667 ret = uni_player_clk_set_rate(player, player->mclk); in snd_sti_clk_adjustment_put()
668 mutex_unlock(&player->ctrl_lock); in snd_sti_clk_adjustment_put()
694 struct uniperif *player = priv->dai_data.uni; in uni_player_startup() local
698 spin_lock_irqsave(&player->irq_lock, flags); in uni_player_startup()
699 player->substream = substream; in uni_player_startup()
700 spin_unlock_irqrestore(&player->irq_lock, flags); in uni_player_startup()
702 player->clk_adj = 0; in uni_player_startup()
704 if (!UNIPERIF_TYPE_IS_TDM(player)) in uni_player_startup()
711 player, SNDRV_PCM_HW_PARAM_CHANNELS, in uni_player_startup()
719 player, SNDRV_PCM_HW_PARAM_FORMAT, in uni_player_startup()
727 struct uniperif *player = priv->dai_data.uni; in uni_player_set_sysclk() local
730 if (UNIPERIF_TYPE_IS_TDM(player) || (dir == SND_SOC_CLOCK_IN)) in uni_player_set_sysclk()
736 mutex_lock(&player->ctrl_lock); in uni_player_set_sysclk()
737 ret = uni_player_clk_set_rate(player, freq); in uni_player_set_sysclk()
739 player->mclk = freq; in uni_player_set_sysclk()
740 mutex_unlock(&player->ctrl_lock); in uni_player_set_sysclk()
749 struct uniperif *player = priv->dai_data.uni; in uni_player_prepare() local
755 if (player->state != UNIPERIF_STATE_STOPPED) { in uni_player_prepare()
756 dev_err(player->dev, "%s: invalid player state %d\n", __func__, in uni_player_prepare()
757 player->state); in uni_player_prepare()
762 if (player->type == SND_ST_UNIPERIF_TYPE_TDM) { in uni_player_prepare()
771 if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) { in uni_player_prepare()
784 (trigger_limit > UNIPERIF_CONFIG_DMA_TRIG_LIMIT_MASK(player))) { in uni_player_prepare()
785 dev_err(player->dev, "invalid trigger limit %d\n", in uni_player_prepare()
790 SET_UNIPERIF_CONFIG_DMA_TRIG_LIMIT(player, trigger_limit); in uni_player_prepare()
793 switch (player->type) { in uni_player_prepare()
795 ret = uni_player_prepare_iec958(player, runtime); in uni_player_prepare()
798 ret = uni_player_prepare_pcm(player, runtime); in uni_player_prepare()
801 ret = uni_player_prepare_iec958(player, runtime); in uni_player_prepare()
804 ret = uni_player_prepare_tdm(player, runtime); in uni_player_prepare()
807 dev_err(player->dev, "invalid player type\n"); in uni_player_prepare()
814 switch (player->daifmt & SND_SOC_DAIFMT_INV_MASK) { in uni_player_prepare()
816 SET_UNIPERIF_I2S_FMT_LR_POL_LOW(player); in uni_player_prepare()
817 SET_UNIPERIF_I2S_FMT_SCLK_EDGE_RISING(player); in uni_player_prepare()
820 SET_UNIPERIF_I2S_FMT_LR_POL_HIG(player); in uni_player_prepare()
821 SET_UNIPERIF_I2S_FMT_SCLK_EDGE_RISING(player); in uni_player_prepare()
824 SET_UNIPERIF_I2S_FMT_LR_POL_LOW(player); in uni_player_prepare()
825 SET_UNIPERIF_I2S_FMT_SCLK_EDGE_FALLING(player); in uni_player_prepare()
828 SET_UNIPERIF_I2S_FMT_LR_POL_HIG(player); in uni_player_prepare()
829 SET_UNIPERIF_I2S_FMT_SCLK_EDGE_FALLING(player); in uni_player_prepare()
833 switch (player->daifmt & SND_SOC_DAIFMT_FORMAT_MASK) { in uni_player_prepare()
835 SET_UNIPERIF_I2S_FMT_ALIGN_LEFT(player); in uni_player_prepare()
836 SET_UNIPERIF_I2S_FMT_PADDING_I2S_MODE(player); in uni_player_prepare()
839 SET_UNIPERIF_I2S_FMT_ALIGN_LEFT(player); in uni_player_prepare()
840 SET_UNIPERIF_I2S_FMT_PADDING_SONY_MODE(player); in uni_player_prepare()
843 SET_UNIPERIF_I2S_FMT_ALIGN_RIGHT(player); in uni_player_prepare()
844 SET_UNIPERIF_I2S_FMT_PADDING_SONY_MODE(player); in uni_player_prepare()
847 dev_err(player->dev, "format not supported\n"); in uni_player_prepare()
851 SET_UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ(player, 0); in uni_player_prepare()
854 return sti_uniperiph_reset(player); in uni_player_prepare()
857 static int uni_player_start(struct uniperif *player) in uni_player_start() argument
862 if (player->state != UNIPERIF_STATE_STOPPED) { in uni_player_start()
863 dev_err(player->dev, "%s: invalid player state\n", __func__); in uni_player_start()
867 ret = clk_prepare_enable(player->clk); in uni_player_start()
869 dev_err(player->dev, "%s: Failed to enable clock\n", __func__); in uni_player_start()
874 SET_UNIPERIF_ITS_BCLR(player, GET_UNIPERIF_ITS(player)); in uni_player_start()
877 SET_UNIPERIF_ITM_BSET_DMA_ERROR(player); in uni_player_start()
878 SET_UNIPERIF_ITM_BSET_FIFO_ERROR(player); in uni_player_start()
881 if (player->underflow_enabled) { in uni_player_start()
882 SET_UNIPERIF_ITM_BSET_UNDERFLOW_REC_DONE(player); in uni_player_start()
883 SET_UNIPERIF_ITM_BSET_UNDERFLOW_REC_FAILED(player); in uni_player_start()
886 ret = sti_uniperiph_reset(player); in uni_player_start()
888 clk_disable_unprepare(player->clk); in uni_player_start()
899 SET_UNIPERIF_CTRL_OPERATION_PCM_DATA(player); in uni_player_start()
906 if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) in uni_player_start()
907 if (UNIPERIF_TYPE_IS_IEC958(player)) in uni_player_start()
908 SET_UNIPERIF_CTRL_SPDIF_FMT_ON(player); in uni_player_start()
911 if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) in uni_player_start()
912 SET_UNIPERIF_CONFIG_CHL_STS_UPDATE(player); in uni_player_start()
914 SET_UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE(player); in uni_player_start()
917 player->state = UNIPERIF_STATE_STARTED; in uni_player_start()
922 static int uni_player_stop(struct uniperif *player) in uni_player_stop() argument
927 if (player->state == UNIPERIF_STATE_STOPPED) { in uni_player_stop()
928 dev_err(player->dev, "%s: invalid player state\n", __func__); in uni_player_stop()
933 SET_UNIPERIF_CTRL_OPERATION_OFF(player); in uni_player_stop()
935 ret = sti_uniperiph_reset(player); in uni_player_stop()
940 SET_UNIPERIF_ITM_BCLR(player, GET_UNIPERIF_ITM(player)); in uni_player_stop()
943 clk_disable_unprepare(player->clk); in uni_player_stop()
946 player->state = UNIPERIF_STATE_STOPPED; in uni_player_stop()
951 int uni_player_resume(struct uniperif *player) in uni_player_resume() argument
956 if (player->clk_sel) { in uni_player_resume()
957 ret = regmap_field_write(player->clk_sel, 1); in uni_player_resume()
959 dev_err(player->dev, in uni_player_resume()
966 SET_UNIPERIF_CONFIG_BACK_STALL_REQ_DISABLE(player); in uni_player_resume()
967 SET_UNIPERIF_CTRL_ROUNDING_OFF(player); in uni_player_resume()
968 SET_UNIPERIF_CTRL_SPDIF_LAT_OFF(player); in uni_player_resume()
969 SET_UNIPERIF_CONFIG_IDLE_MOD_DISABLE(player); in uni_player_resume()
979 struct uniperif *player = priv->dai_data.uni; in uni_player_trigger() local
983 return uni_player_start(player); in uni_player_trigger()
985 return uni_player_stop(player); in uni_player_trigger()
987 return uni_player_resume(player); in uni_player_trigger()
997 struct uniperif *player = priv->dai_data.uni; in uni_player_shutdown() local
1000 spin_lock_irqsave(&player->irq_lock, flags); in uni_player_shutdown()
1001 if (player->state != UNIPERIF_STATE_STOPPED) in uni_player_shutdown()
1003 uni_player_stop(player); in uni_player_shutdown()
1005 player->substream = NULL; in uni_player_shutdown()
1006 spin_unlock_irqrestore(&player->irq_lock, flags); in uni_player_shutdown()
1010 struct uniperif *player) in uni_player_parse_dt_audio_glue() argument
1017 8 + player->id, in uni_player_parse_dt_audio_glue()
1018 8 + player->id), in uni_player_parse_dt_audio_glue()
1030 player->clk_sel = regmap_field_alloc(regmap, regfield[0]); in uni_player_parse_dt_audio_glue()
1031 player->valid_sel = regmap_field_alloc(regmap, regfield[1]); in uni_player_parse_dt_audio_glue()
1048 struct uniperif *player) in uni_player_init() argument
1052 player->dev = &pdev->dev; in uni_player_init()
1053 player->state = UNIPERIF_STATE_STOPPED; in uni_player_init()
1054 player->dai_ops = &uni_player_dai_ops; in uni_player_init()
1057 ret = uni_player_parse_dt_audio_glue(pdev, player); in uni_player_init()
1060 dev_err(player->dev, "Failed to parse DeviceTree\n"); in uni_player_init()
1065 if (player->ver >= SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) in uni_player_init()
1066 player->underflow_enabled = 1; in uni_player_init()
1068 if (UNIPERIF_TYPE_IS_TDM(player)) in uni_player_init()
1069 player->hw = &uni_tdm_hw; in uni_player_init()
1071 player->hw = &uni_player_pcm_hw; in uni_player_init()
1074 player->clk = of_clk_get(pdev->dev.of_node, 0); in uni_player_init()
1075 if (IS_ERR(player->clk)) { in uni_player_init()
1076 dev_err(player->dev, "Failed to get clock\n"); in uni_player_init()
1077 return PTR_ERR(player->clk); in uni_player_init()
1081 if (player->clk_sel) { in uni_player_init()
1082 ret = regmap_field_write(player->clk_sel, 1); in uni_player_init()
1084 dev_err(player->dev, in uni_player_init()
1092 if (player->valid_sel && in uni_player_init()
1093 (player->id == UNIPERIF_PLAYER_I2S_OUT)) { in uni_player_init()
1094 ret = regmap_field_write(player->valid_sel, player->id); in uni_player_init()
1096 dev_err(player->dev, in uni_player_init()
1102 ret = devm_request_irq(&pdev->dev, player->irq, in uni_player_init()
1104 dev_name(&pdev->dev), player); in uni_player_init()
1106 dev_err(player->dev, "unable to request IRQ %d\n", player->irq); in uni_player_init()
1110 mutex_init(&player->ctrl_lock); in uni_player_init()
1111 spin_lock_init(&player->irq_lock); in uni_player_init()
1114 SET_UNIPERIF_CONFIG_BACK_STALL_REQ_DISABLE(player); in uni_player_init()
1115 SET_UNIPERIF_CTRL_ROUNDING_OFF(player); in uni_player_init()
1116 SET_UNIPERIF_CTRL_SPDIF_LAT_OFF(player); in uni_player_init()
1117 SET_UNIPERIF_CONFIG_IDLE_MOD_DISABLE(player); in uni_player_init()
1119 if (UNIPERIF_TYPE_IS_IEC958(player)) { in uni_player_init()
1123 player->stream_settings.iec958.status[0] = 0x00; in uni_player_init()
1125 player->stream_settings.iec958.status[1] = in uni_player_init()
1128 player->stream_settings.iec958.status[2] = in uni_player_init()
1131 player->stream_settings.iec958.status[3] = in uni_player_init()
1134 player->stream_settings.iec958.status[4] = in uni_player_init()
1138 player->num_ctrls = ARRAY_SIZE(snd_sti_iec_ctl); in uni_player_init()
1139 player->snd_ctrls = snd_sti_iec_ctl[0]; in uni_player_init()
1141 player->num_ctrls = ARRAY_SIZE(snd_sti_pcm_ctl); in uni_player_init()
1142 player->snd_ctrls = snd_sti_pcm_ctl[0]; in uni_player_init()