Lines Matching +full:multi +full:-

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson SA 2012
7 * for ST-Ericsson.
19 #include <linux/mfd/dbx500-prcmu.h>
20 #include <linux/platform_data/asoc-ux500-msp.h>
23 #include <sound/soc-dai.h>
33 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in setup_pcm_multichan()
34 struct msp_multichannel_config *multi = in setup_pcm_multichan() local
35 &msp_config->multichannel_config; in setup_pcm_multichan()
37 if (drvdata->slots > 1) { in setup_pcm_multichan()
38 msp_config->multichannel_configured = 1; in setup_pcm_multichan()
40 multi->tx_multichannel_enable = true; in setup_pcm_multichan()
41 multi->rx_multichannel_enable = true; in setup_pcm_multichan()
42 multi->rx_comparison_enable_mode = MSP_COMPARISON_DISABLED; in setup_pcm_multichan()
44 multi->tx_channel_0_enable = drvdata->tx_mask; in setup_pcm_multichan()
45 multi->tx_channel_1_enable = 0; in setup_pcm_multichan()
46 multi->tx_channel_2_enable = 0; in setup_pcm_multichan()
47 multi->tx_channel_3_enable = 0; in setup_pcm_multichan()
49 multi->rx_channel_0_enable = drvdata->rx_mask; in setup_pcm_multichan()
50 multi->rx_channel_1_enable = 0; in setup_pcm_multichan()
51 multi->rx_channel_2_enable = 0; in setup_pcm_multichan()
52 multi->rx_channel_3_enable = 0; in setup_pcm_multichan()
54 dev_dbg(dai->dev, in setup_pcm_multichan()
56 __func__, drvdata->slots, multi->tx_channel_0_enable, in setup_pcm_multichan()
57 multi->rx_channel_0_enable); in setup_pcm_multichan()
66 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in setup_frameper()
68 switch (drvdata->slots) { in setup_frameper()
72 prot_desc->frame_period = in setup_frameper()
77 prot_desc->frame_period = in setup_frameper()
82 prot_desc->frame_period = in setup_frameper()
87 prot_desc->frame_period = in setup_frameper()
92 dev_err(dai->dev, in setup_frameper()
93 "%s: Error: Unsupported sample-rate (freq = %d)!\n", in setup_frameper()
95 return -EINVAL; in setup_frameper()
100 prot_desc->frame_period = FRAME_PER_2_SLOTS; in setup_frameper()
104 prot_desc->frame_period = FRAME_PER_8_SLOTS; in setup_frameper()
108 prot_desc->frame_period = FRAME_PER_16_SLOTS; in setup_frameper()
111 dev_err(dai->dev, in setup_frameper()
112 "%s: Error: Unsupported slot-count (slots = %d)!\n", in setup_frameper()
113 __func__, drvdata->slots); in setup_frameper()
114 return -EINVAL; in setup_frameper()
117 prot_desc->clocks_per_frame = in setup_frameper()
118 prot_desc->frame_period+1; in setup_frameper()
120 dev_dbg(dai->dev, "%s: Clocks per frame: %u\n", in setup_frameper()
122 prot_desc->clocks_per_frame); in setup_frameper()
130 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in setup_pcm_framing()
134 prot_desc->frame_width = 0; in setup_pcm_framing()
136 switch (drvdata->slots) { in setup_pcm_framing()
153 dev_err(dai->dev, in setup_pcm_framing()
154 "%s: Error: Unsupported slot-count (slots = %d)!\n", in setup_pcm_framing()
155 __func__, drvdata->slots); in setup_pcm_framing()
156 return -EINVAL; in setup_pcm_framing()
159 prot_desc->tx_frame_len_1 = frame_length; in setup_pcm_framing()
160 prot_desc->rx_frame_len_1 = frame_length; in setup_pcm_framing()
161 prot_desc->tx_frame_len_2 = frame_length; in setup_pcm_framing()
162 prot_desc->rx_frame_len_2 = frame_length; in setup_pcm_framing()
164 prot_desc->tx_elem_len_1 = MSP_ELEM_LEN_16; in setup_pcm_framing()
165 prot_desc->rx_elem_len_1 = MSP_ELEM_LEN_16; in setup_pcm_framing()
166 prot_desc->tx_elem_len_2 = MSP_ELEM_LEN_16; in setup_pcm_framing()
167 prot_desc->rx_elem_len_2 = MSP_ELEM_LEN_16; in setup_pcm_framing()
181 msp_config->tx_fsync_pol ^= 1 << TFSPOL_SHIFT; in setup_clocking()
182 msp_config->rx_fsync_pol ^= 1 << RFSPOL_SHIFT; in setup_clocking()
187 dev_err(dai->dev, in setup_clocking()
191 return -EINVAL; in setup_clocking()
196 dev_dbg(dai->dev, "%s: Codec is master.\n", __func__); in setup_clocking()
198 msp_config->iodelay = 0x20; in setup_clocking()
199 msp_config->rx_fsync_sel = 0; in setup_clocking()
200 msp_config->tx_fsync_sel = 1 << TFSSEL_SHIFT; in setup_clocking()
201 msp_config->tx_clk_sel = 0; in setup_clocking()
202 msp_config->rx_clk_sel = 0; in setup_clocking()
203 msp_config->srg_clk_sel = 0x2 << SCKSEL_SHIFT; in setup_clocking()
208 dev_dbg(dai->dev, "%s: Codec is slave.\n", __func__); in setup_clocking()
210 msp_config->tx_clk_sel = TX_CLK_SEL_SRG; in setup_clocking()
211 msp_config->tx_fsync_sel = TX_SYNC_SRG_PROG; in setup_clocking()
212 msp_config->rx_clk_sel = RX_CLK_SEL_SRG; in setup_clocking()
213 msp_config->rx_fsync_sel = RX_SYNC_SRG; in setup_clocking()
214 msp_config->srg_clk_sel = 1 << SCKSEL_SHIFT; in setup_clocking()
219 dev_err(dai->dev, "%s: Error: Unsupported master (fmt = 0x%x)!\n", in setup_clocking()
222 return -EINVAL; in setup_clocking()
232 prot_desc->rx_phase_mode = MSP_SINGLE_PHASE; in setup_pcm_protdesc()
233 prot_desc->tx_phase_mode = MSP_SINGLE_PHASE; in setup_pcm_protdesc()
234 prot_desc->rx_phase2_start_mode = MSP_PHASE2_START_MODE_IMEDIATE; in setup_pcm_protdesc()
235 prot_desc->tx_phase2_start_mode = MSP_PHASE2_START_MODE_IMEDIATE; in setup_pcm_protdesc()
236 prot_desc->rx_byte_order = MSP_BTF_MS_BIT_FIRST; in setup_pcm_protdesc()
237 prot_desc->tx_byte_order = MSP_BTF_MS_BIT_FIRST; in setup_pcm_protdesc()
238 prot_desc->tx_fsync_pol = MSP_FSYNC_POL(MSP_FSYNC_POL_ACT_HI); in setup_pcm_protdesc()
239 prot_desc->rx_fsync_pol = MSP_FSYNC_POL_ACT_HI << RFSPOL_SHIFT; in setup_pcm_protdesc()
242 dev_dbg(dai->dev, "%s: DSP_A.\n", __func__); in setup_pcm_protdesc()
243 prot_desc->rx_clk_pol = MSP_RISING_EDGE; in setup_pcm_protdesc()
244 prot_desc->tx_clk_pol = MSP_FALLING_EDGE; in setup_pcm_protdesc()
246 prot_desc->rx_data_delay = MSP_DELAY_1; in setup_pcm_protdesc()
247 prot_desc->tx_data_delay = MSP_DELAY_1; in setup_pcm_protdesc()
249 dev_dbg(dai->dev, "%s: DSP_B.\n", __func__); in setup_pcm_protdesc()
250 prot_desc->rx_clk_pol = MSP_FALLING_EDGE; in setup_pcm_protdesc()
251 prot_desc->tx_clk_pol = MSP_RISING_EDGE; in setup_pcm_protdesc()
253 prot_desc->rx_data_delay = MSP_DELAY_0; in setup_pcm_protdesc()
254 prot_desc->tx_data_delay = MSP_DELAY_0; in setup_pcm_protdesc()
257 prot_desc->rx_half_word_swap = MSP_SWAP_NONE; in setup_pcm_protdesc()
258 prot_desc->tx_half_word_swap = MSP_SWAP_NONE; in setup_pcm_protdesc()
259 prot_desc->compression_mode = MSP_COMPRESS_MODE_LINEAR; in setup_pcm_protdesc()
260 prot_desc->expansion_mode = MSP_EXPAND_MODE_LINEAR; in setup_pcm_protdesc()
261 prot_desc->frame_sync_ignore = MSP_FSYNC_IGNORE; in setup_pcm_protdesc()
268 prot_desc->rx_phase_mode = MSP_DUAL_PHASE; in setup_i2s_protdesc()
269 prot_desc->tx_phase_mode = MSP_DUAL_PHASE; in setup_i2s_protdesc()
270 prot_desc->rx_phase2_start_mode = MSP_PHASE2_START_MODE_FSYNC; in setup_i2s_protdesc()
271 prot_desc->tx_phase2_start_mode = MSP_PHASE2_START_MODE_FSYNC; in setup_i2s_protdesc()
272 prot_desc->rx_byte_order = MSP_BTF_MS_BIT_FIRST; in setup_i2s_protdesc()
273 prot_desc->tx_byte_order = MSP_BTF_MS_BIT_FIRST; in setup_i2s_protdesc()
274 prot_desc->tx_fsync_pol = MSP_FSYNC_POL(MSP_FSYNC_POL_ACT_LO); in setup_i2s_protdesc()
275 prot_desc->rx_fsync_pol = MSP_FSYNC_POL_ACT_LO << RFSPOL_SHIFT; in setup_i2s_protdesc()
277 prot_desc->rx_frame_len_1 = MSP_FRAME_LEN_1; in setup_i2s_protdesc()
278 prot_desc->rx_frame_len_2 = MSP_FRAME_LEN_1; in setup_i2s_protdesc()
279 prot_desc->tx_frame_len_1 = MSP_FRAME_LEN_1; in setup_i2s_protdesc()
280 prot_desc->tx_frame_len_2 = MSP_FRAME_LEN_1; in setup_i2s_protdesc()
281 prot_desc->rx_elem_len_1 = MSP_ELEM_LEN_16; in setup_i2s_protdesc()
282 prot_desc->rx_elem_len_2 = MSP_ELEM_LEN_16; in setup_i2s_protdesc()
283 prot_desc->tx_elem_len_1 = MSP_ELEM_LEN_16; in setup_i2s_protdesc()
284 prot_desc->tx_elem_len_2 = MSP_ELEM_LEN_16; in setup_i2s_protdesc()
286 prot_desc->rx_clk_pol = MSP_RISING_EDGE; in setup_i2s_protdesc()
287 prot_desc->tx_clk_pol = MSP_FALLING_EDGE; in setup_i2s_protdesc()
289 prot_desc->rx_data_delay = MSP_DELAY_0; in setup_i2s_protdesc()
290 prot_desc->tx_data_delay = MSP_DELAY_0; in setup_i2s_protdesc()
292 prot_desc->tx_half_word_swap = MSP_SWAP_NONE; in setup_i2s_protdesc()
293 prot_desc->rx_half_word_swap = MSP_SWAP_NONE; in setup_i2s_protdesc()
294 prot_desc->compression_mode = MSP_COMPRESS_MODE_LINEAR; in setup_i2s_protdesc()
295 prot_desc->expansion_mode = MSP_EXPAND_MODE_LINEAR; in setup_i2s_protdesc()
296 prot_desc->frame_sync_ignore = MSP_FSYNC_IGNORE; in setup_i2s_protdesc()
305 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in setup_msp_config()
306 struct msp_protdesc *prot_desc = &msp_config->protdesc; in setup_msp_config()
307 struct snd_pcm_runtime *runtime = substream->runtime; in setup_msp_config()
308 unsigned int fmt = drvdata->fmt; in setup_msp_config()
313 msp_config->f_inputclk = drvdata->master_clk; in setup_msp_config()
315 msp_config->tx_fifo_config = TX_FIFO_ENABLE; in setup_msp_config()
316 msp_config->rx_fifo_config = RX_FIFO_ENABLE; in setup_msp_config()
317 msp_config->def_elem_len = 1; in setup_msp_config()
318 msp_config->direction = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? in setup_msp_config()
320 msp_config->data_size = MSP_DATA_BITS_32; in setup_msp_config()
321 msp_config->frame_freq = runtime->rate; in setup_msp_config()
323 dev_dbg(dai->dev, "%s: f_inputclk = %u, frame_freq = %u.\n", in setup_msp_config()
324 __func__, msp_config->f_inputclk, msp_config->frame_freq); in setup_msp_config()
326 prot_desc->clocks_per_frame = 1; in setup_msp_config()
328 dev_dbg(dai->dev, "%s: rate: %u, channels: %d.\n", __func__, in setup_msp_config()
329 runtime->rate, runtime->channels); in setup_msp_config()
333 dev_dbg(dai->dev, "%s: SND_SOC_DAIFMT_I2S.\n", __func__); in setup_msp_config()
335 msp_config->default_protdesc = 1; in setup_msp_config()
336 msp_config->protocol = MSP_I2S_PROTOCOL; in setup_msp_config()
340 dev_dbg(dai->dev, "%s: SND_SOC_DAIFMT_I2S.\n", __func__); in setup_msp_config()
342 msp_config->data_size = MSP_DATA_BITS_16; in setup_msp_config()
343 msp_config->protocol = MSP_I2S_PROTOCOL; in setup_msp_config()
355 dev_dbg(dai->dev, "%s: PCM format.\n", __func__); in setup_msp_config()
357 msp_config->data_size = MSP_DATA_BITS_16; in setup_msp_config()
358 msp_config->protocol = MSP_PCM_PROTOCOL; in setup_msp_config()
368 ret = setup_pcm_framing(dai, runtime->rate, prot_desc); in setup_msp_config()
375 dev_err(dai->dev, "%s: Error: Unsupported format (%d)!\n", in setup_msp_config()
377 return -EINVAL; in setup_msp_config()
387 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_startup()
389 dev_dbg(dai->dev, "%s: MSP %d (%s): Enter.\n", __func__, dai->id, in ux500_msp_dai_startup()
393 ret = regulator_enable(drvdata->reg_vape); in ux500_msp_dai_startup()
395 dev_err(drvdata->msp->dev, in ux500_msp_dai_startup()
401 dev_dbg(dai->dev, "%s: Enabling MSP-clocks.\n", __func__); in ux500_msp_dai_startup()
402 ret = clk_prepare_enable(drvdata->pclk); in ux500_msp_dai_startup()
404 dev_err(drvdata->msp->dev, in ux500_msp_dai_startup()
409 ret = clk_prepare_enable(drvdata->clk); in ux500_msp_dai_startup()
411 dev_err(drvdata->msp->dev, in ux500_msp_dai_startup()
418 clk_disable_unprepare(drvdata->pclk); in ux500_msp_dai_startup()
420 regulator_disable(drvdata->reg_vape); in ux500_msp_dai_startup()
428 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_shutdown()
429 bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); in ux500_msp_dai_shutdown()
431 dev_dbg(dai->dev, "%s: MSP %d (%s): Enter.\n", __func__, dai->id, in ux500_msp_dai_shutdown()
434 if (drvdata->vape_opp_constraint == 1) { in ux500_msp_dai_shutdown()
437 drvdata->vape_opp_constraint = 0; in ux500_msp_dai_shutdown()
440 if (ux500_msp_i2s_close(drvdata->msp, in ux500_msp_dai_shutdown()
442 dev_err(dai->dev, in ux500_msp_dai_shutdown()
444 __func__, dai->id, snd_pcm_stream_str(substream)); in ux500_msp_dai_shutdown()
448 clk_disable_unprepare(drvdata->clk); in ux500_msp_dai_shutdown()
449 clk_disable_unprepare(drvdata->pclk); in ux500_msp_dai_shutdown()
452 ret = regulator_disable(drvdata->reg_vape); in ux500_msp_dai_shutdown()
454 dev_err(dai->dev, in ux500_msp_dai_shutdown()
463 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_prepare()
464 struct snd_pcm_runtime *runtime = substream->runtime; in ux500_msp_dai_prepare()
467 dev_dbg(dai->dev, "%s: MSP %d (%s): Enter (rate = %d).\n", __func__, in ux500_msp_dai_prepare()
468 dai->id, snd_pcm_stream_str(substream), runtime->rate); in ux500_msp_dai_prepare()
472 ret = ux500_msp_i2s_open(drvdata->msp, &msp_config); in ux500_msp_dai_prepare()
474 dev_err(dai->dev, "%s: Error: msp_setup failed (ret = %d)!\n", in ux500_msp_dai_prepare()
479 /* Set OPP-level */ in ux500_msp_dai_prepare()
480 if ((drvdata->fmt & SND_SOC_DAIFMT_MASTER_MASK) && in ux500_msp_dai_prepare()
481 (drvdata->msp->f_bitclk > 19200000)) { in ux500_msp_dai_prepare()
482 /* If the bit-clock is higher than 19.2MHz, Vape should be in ux500_msp_dai_prepare()
483 * run in 100% OPP. Only when bit-clock is used (MSP master) in ux500_msp_dai_prepare()
486 "ux500-msp-i2s", 100); in ux500_msp_dai_prepare()
487 drvdata->vape_opp_constraint = 1; in ux500_msp_dai_prepare()
490 "ux500-msp-i2s", 50); in ux500_msp_dai_prepare()
491 drvdata->vape_opp_constraint = 0; in ux500_msp_dai_prepare()
502 struct snd_pcm_runtime *runtime = substream->runtime; in ux500_msp_dai_hw_params()
503 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_hw_params()
505 dev_dbg(dai->dev, "%s: MSP %d (%s): Enter.\n", in ux500_msp_dai_hw_params()
506 __func__, dai->id, snd_pcm_stream_str(substream)); in ux500_msp_dai_hw_params()
508 switch (drvdata->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { in ux500_msp_dai_hw_params()
517 mask = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? in ux500_msp_dai_hw_params()
518 drvdata->tx_mask : in ux500_msp_dai_hw_params()
519 drvdata->rx_mask; in ux500_msp_dai_hw_params()
522 dev_dbg(dai->dev, "TDM-slots active: %d", slots_active); in ux500_msp_dai_hw_params()
530 dev_err(dai->dev, in ux500_msp_dai_hw_params()
532 __func__, drvdata->fmt); in ux500_msp_dai_hw_params()
533 return -EINVAL; in ux500_msp_dai_hw_params()
542 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_set_dai_fmt()
544 dev_dbg(dai->dev, "%s: MSP %d: Enter.\n", __func__, dai->id); in ux500_msp_dai_set_dai_fmt()
557 dev_err(dai->dev, in ux500_msp_dai_set_dai_fmt()
559 __func__, drvdata->fmt); in ux500_msp_dai_set_dai_fmt()
560 return -EINVAL; in ux500_msp_dai_set_dai_fmt()
570 dev_err(dai->dev, in ux500_msp_dai_set_dai_fmt()
572 __func__, drvdata->fmt); in ux500_msp_dai_set_dai_fmt()
573 return -EINVAL; in ux500_msp_dai_set_dai_fmt()
576 drvdata->fmt = fmt; in ux500_msp_dai_set_dai_fmt()
585 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_set_tdm_slot()
602 dev_err(dai->dev, "%s: Error: Unsupported slot-count (%d)!\n", in ux500_msp_dai_set_tdm_slot()
604 return -EINVAL; in ux500_msp_dai_set_tdm_slot()
606 drvdata->slots = slots; in ux500_msp_dai_set_tdm_slot()
609 dev_err(dai->dev, "%s: Error: Unsupported slot-width (%d)!\n", in ux500_msp_dai_set_tdm_slot()
611 return -EINVAL; in ux500_msp_dai_set_tdm_slot()
613 drvdata->slot_width = slot_width; in ux500_msp_dai_set_tdm_slot()
615 drvdata->tx_mask = tx_mask & cap; in ux500_msp_dai_set_tdm_slot()
616 drvdata->rx_mask = rx_mask & cap; in ux500_msp_dai_set_tdm_slot()
624 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_set_dai_sysclk()
626 dev_dbg(dai->dev, "%s: MSP %d: Enter. clk-id: %d, freq: %u.\n", in ux500_msp_dai_set_dai_sysclk()
627 __func__, dai->id, clk_id, freq); in ux500_msp_dai_set_dai_sysclk()
631 drvdata->master_clk = freq; in ux500_msp_dai_set_dai_sysclk()
635 dev_err(dai->dev, "%s: MSP %d: Invalid clk-id (%d)!\n", in ux500_msp_dai_set_dai_sysclk()
636 __func__, dai->id, clk_id); in ux500_msp_dai_set_dai_sysclk()
637 return -EINVAL; in ux500_msp_dai_set_dai_sysclk()
647 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_trigger()
649 dev_dbg(dai->dev, "%s: MSP %d (%s): Enter (msp->id = %d, cmd = %d).\n", in ux500_msp_dai_trigger()
650 __func__, dai->id, snd_pcm_stream_str(substream), in ux500_msp_dai_trigger()
651 (int)drvdata->msp->id, cmd); in ux500_msp_dai_trigger()
653 ret = ux500_msp_i2s_trigger(drvdata->msp, cmd, substream->stream); in ux500_msp_dai_trigger()
660 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_of_probe()
664 playback_dma_data = devm_kzalloc(dai->dev, in ux500_msp_dai_of_probe()
668 return -ENOMEM; in ux500_msp_dai_of_probe()
670 capture_dma_data = devm_kzalloc(dai->dev, in ux500_msp_dai_of_probe()
674 return -ENOMEM; in ux500_msp_dai_of_probe()
676 playback_dma_data->addr = drvdata->msp->playback_dma_data.tx_rx_addr; in ux500_msp_dai_of_probe()
677 capture_dma_data->addr = drvdata->msp->capture_dma_data.tx_rx_addr; in ux500_msp_dai_of_probe()
679 playback_dma_data->maxburst = 4; in ux500_msp_dai_of_probe()
680 capture_dma_data->maxburst = 4; in ux500_msp_dai_of_probe()
689 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); in ux500_msp_dai_probe()
690 struct msp_i2s_platform_data *pdata = dai->dev->platform_data; in ux500_msp_dai_probe()
698 drvdata->msp->playback_dma_data.data_size = drvdata->slot_width; in ux500_msp_dai_probe()
699 drvdata->msp->capture_dma_data.data_size = drvdata->slot_width; in ux500_msp_dai_probe()
702 &drvdata->msp->playback_dma_data, in ux500_msp_dai_probe()
703 &drvdata->msp->capture_dma_data); in ux500_msp_dai_probe()
734 .name = "ux500-msp",
741 struct msp_i2s_platform_data *pdata = pdev->dev.platform_data; in ux500_msp_drv_probe()
742 struct device_node *np = pdev->dev.of_node; in ux500_msp_drv_probe()
746 dev_err(&pdev->dev, "No platform data or Device Tree found\n"); in ux500_msp_drv_probe()
747 return -ENODEV; in ux500_msp_drv_probe()
750 drvdata = devm_kzalloc(&pdev->dev, in ux500_msp_drv_probe()
754 return -ENOMEM; in ux500_msp_drv_probe()
756 drvdata->fmt = 0; in ux500_msp_drv_probe()
757 drvdata->slots = 1; in ux500_msp_drv_probe()
758 drvdata->tx_mask = 0x01; in ux500_msp_drv_probe()
759 drvdata->rx_mask = 0x01; in ux500_msp_drv_probe()
760 drvdata->slot_width = 16; in ux500_msp_drv_probe()
761 drvdata->master_clk = MSP_INPUT_FREQ_APB; in ux500_msp_drv_probe()
763 drvdata->reg_vape = devm_regulator_get(&pdev->dev, "v-ape"); in ux500_msp_drv_probe()
764 if (IS_ERR(drvdata->reg_vape)) { in ux500_msp_drv_probe()
765 ret = (int)PTR_ERR(drvdata->reg_vape); in ux500_msp_drv_probe()
766 dev_err(&pdev->dev, in ux500_msp_drv_probe()
771 prcmu_qos_add_requirement(PRCMU_QOS_APE_OPP, (char *)pdev->name, 50); in ux500_msp_drv_probe()
773 drvdata->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); in ux500_msp_drv_probe()
774 if (IS_ERR(drvdata->pclk)) { in ux500_msp_drv_probe()
775 ret = (int)PTR_ERR(drvdata->pclk); in ux500_msp_drv_probe()
776 dev_err(&pdev->dev, in ux500_msp_drv_probe()
782 drvdata->clk = devm_clk_get(&pdev->dev, NULL); in ux500_msp_drv_probe()
783 if (IS_ERR(drvdata->clk)) { in ux500_msp_drv_probe()
784 ret = (int)PTR_ERR(drvdata->clk); in ux500_msp_drv_probe()
785 dev_err(&pdev->dev, in ux500_msp_drv_probe()
791 ret = ux500_msp_i2s_init_msp(pdev, &drvdata->msp, in ux500_msp_drv_probe()
792 pdev->dev.platform_data); in ux500_msp_drv_probe()
793 if (!drvdata->msp) { in ux500_msp_drv_probe()
794 dev_err(&pdev->dev, in ux500_msp_drv_probe()
795 "%s: ERROR: Failed to init MSP-struct (%d)!", in ux500_msp_drv_probe()
799 dev_set_drvdata(&pdev->dev, drvdata); in ux500_msp_drv_probe()
801 ret = snd_soc_register_component(&pdev->dev, &ux500_msp_component, in ux500_msp_drv_probe()
804 dev_err(&pdev->dev, "Error: %s: Failed to register MSP%d!\n", in ux500_msp_drv_probe()
805 __func__, drvdata->msp->id); in ux500_msp_drv_probe()
811 dev_err(&pdev->dev, in ux500_msp_drv_probe()
820 snd_soc_unregister_component(&pdev->dev); in ux500_msp_drv_probe()
826 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(&pdev->dev); in ux500_msp_drv_remove()
830 snd_soc_unregister_component(&pdev->dev); in ux500_msp_drv_remove()
834 ux500_msp_i2s_cleanup_msp(pdev, drvdata->msp); in ux500_msp_drv_remove()
840 { .compatible = "stericsson,ux500-msp-i2s", },
847 .name = "ux500-msp-i2s",