Lines Matching +full:dmic +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson SA 2012
7 * for ST-Ericsson.
19 #include <sound/soc-dapm.h>
26 #include "../codecs/ab8500-codec.h"
63 /* Private data for machine-part MOP500<->AB8500 */
90 if (IS_ERR(drvdata->clk_ptr_intclk)) { in mop500_ab8500_set_mclk()
93 return -EIO; in mop500_ab8500_set_mclk()
96 switch (drvdata->mclk_sel) { in mop500_ab8500_set_mclk()
98 clk_ptr = drvdata->clk_ptr_sysclk; in mop500_ab8500_set_mclk()
101 clk_ptr = drvdata->clk_ptr_ulpclk; in mop500_ab8500_set_mclk()
104 return -EINVAL; in mop500_ab8500_set_mclk()
109 get_mclk_str(drvdata->mclk_sel)); in mop500_ab8500_set_mclk()
110 return -EIO; in mop500_ab8500_set_mclk()
113 status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr); in mop500_ab8500_set_mclk()
117 __func__, get_mclk_str(drvdata->mclk_sel), status); in mop500_ab8500_set_mclk()
121 __func__, get_mclk_str(drvdata->mclk_sel)); in mop500_ab8500_set_mclk()
127 * Control-events
137 ucontrol->value.enumerated.item[0] = drvdata->mclk_sel; in mclk_input_control_get()
148 unsigned int val = ucontrol->value.enumerated.item[0]; in mclk_input_control_put()
151 return -EINVAL; in mclk_input_control_put()
152 if (drvdata->mclk_sel == val) in mclk_input_control_put()
155 drvdata->mclk_sel = val; in mclk_input_control_put()
181 SOC_DAPM_PIN_SWITCH("DMic 1"),
182 SOC_DAPM_PIN_SWITCH("DMic 2"),
183 SOC_DAPM_PIN_SWITCH("DMic 3"),
184 SOC_DAPM_PIN_SWITCH("DMic 4"),
185 SOC_DAPM_PIN_SWITCH("DMic 5"),
186 SOC_DAPM_PIN_SWITCH("DMic 6"),
195 /* Set audio-clock source */ in mop500_ab8500_startup()
196 return mop500_ab8500_set_mclk(rtd->card->dev, in mop500_ab8500_startup()
197 snd_soc_card_get_drvdata(rtd->card)); in mop500_ab8500_startup()
203 struct device *dev = rtd->card->dev; in mop500_ab8500_shutdown()
208 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in mop500_ab8500_shutdown()
220 struct device *dev = rtd->card->dev; in mop500_ab8500_hw_params()
228 dev_dbg(dev, "%s: substream->pcm->name = %s\n" in mop500_ab8500_hw_params()
229 "substream->pcm->id = %s.\n" in mop500_ab8500_hw_params()
230 "substream->name = %s.\n" in mop500_ab8500_hw_params()
231 "substream->number = %d.\n", in mop500_ab8500_hw_params()
233 substream->pcm->name, in mop500_ab8500_hw_params()
234 substream->pcm->id, in mop500_ab8500_hw_params()
235 substream->name, in mop500_ab8500_hw_params()
236 substream->number); in mop500_ab8500_hw_params()
244 return -EBUSY; in mop500_ab8500_hw_params()
250 __set_bit(cpu_dai->id, &mop500_ab8500_usage); in mop500_ab8500_hw_params()
265 return -EINVAL; in mop500_ab8500_hw_params()
268 /* Setup codec depending on driver-mode */ in mop500_ab8500_hw_params()
273 dev_dbg(dev, "%s: Driver-mode: %s.\n", __func__, in mop500_ab8500_hw_params()
294 /* Setup TDM-slots */ in mop500_ab8500_hw_params()
296 is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); in mop500_ab8500_hw_params()
314 return -EINVAL; in mop500_ab8500_hw_params()
322 dev_dbg(dev, "%s: CPU-DAI TDM: TX=0x%04X RX=0x%04x\n", __func__, in mop500_ab8500_hw_params()
329 dev_dbg(dev, "%s: CODEC-DAI TDM: TX=0x%04X RX=0x%04x\n", __func__, in mop500_ab8500_hw_params()
345 __clear_bit(cpu_dai->id, &mop500_ab8500_usage); in mop500_ab8500_hw_free()
362 struct snd_soc_dapm_context *dapm = &rtd->card->dapm; in mop500_ab8500_machine_init()
363 struct device *dev = rtd->card->dev; in mop500_ab8500_machine_init()
369 /* Create driver private-data struct */ in mop500_ab8500_machine_init()
374 return -ENOMEM; in mop500_ab8500_machine_init()
376 snd_soc_card_set_drvdata(rtd->card, drvdata); in mop500_ab8500_machine_init()
380 drvdata->clk_ptr_sysclk = clk_get(dev, "sysclk"); in mop500_ab8500_machine_init()
381 if (IS_ERR(drvdata->clk_ptr_sysclk)) in mop500_ab8500_machine_init()
384 drvdata->clk_ptr_ulpclk = clk_get(dev, "ulpclk"); in mop500_ab8500_machine_init()
385 if (IS_ERR(drvdata->clk_ptr_ulpclk)) in mop500_ab8500_machine_init()
388 drvdata->clk_ptr_intclk = clk_get(dev, "intclk"); in mop500_ab8500_machine_init()
389 if (IS_ERR(drvdata->clk_ptr_intclk)) in mop500_ab8500_machine_init()
394 drvdata->mclk_sel = MCLK_ULPCLK; in mop500_ab8500_machine_init()
400 drvdata->mclk_sel = MCLK_ULPCLK; in mop500_ab8500_machine_init()
403 ret = snd_soc_add_card_controls(rtd->card, mop500_ab8500_ctrls, in mop500_ab8500_machine_init()
406 pr_err("%s: Failed to add machine-controls (%d)!\n", in mop500_ab8500_machine_init()
422 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 1"); in mop500_ab8500_machine_init()
423 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 2"); in mop500_ab8500_machine_init()
424 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 3"); in mop500_ab8500_machine_init()
425 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 4"); in mop500_ab8500_machine_init()
426 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 5"); in mop500_ab8500_machine_init()
427 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 6"); in mop500_ab8500_machine_init()
436 if (drvdata->clk_ptr_sysclk != NULL) in mop500_ab8500_remove()
437 clk_put(drvdata->clk_ptr_sysclk); in mop500_ab8500_remove()
438 if (drvdata->clk_ptr_ulpclk != NULL) in mop500_ab8500_remove()
439 clk_put(drvdata->clk_ptr_ulpclk); in mop500_ab8500_remove()
440 if (drvdata->clk_ptr_intclk != NULL) in mop500_ab8500_remove()
441 clk_put(drvdata->clk_ptr_intclk); in mop500_ab8500_remove()