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.
17 #include <sound/soc-dapm.h>
24 #include "../codecs/ab8500-codec.h"
61 /* Private data for machine-part MOP500<->AB8500 */
88 if (IS_ERR(drvdata->clk_ptr_intclk)) { in mop500_ab8500_set_mclk()
91 return -EIO; in mop500_ab8500_set_mclk()
94 switch (drvdata->mclk_sel) { in mop500_ab8500_set_mclk()
96 clk_ptr = drvdata->clk_ptr_sysclk; in mop500_ab8500_set_mclk()
99 clk_ptr = drvdata->clk_ptr_ulpclk; in mop500_ab8500_set_mclk()
102 return -EINVAL; in mop500_ab8500_set_mclk()
107 get_mclk_str(drvdata->mclk_sel)); in mop500_ab8500_set_mclk()
108 return -EIO; in mop500_ab8500_set_mclk()
111 status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr); in mop500_ab8500_set_mclk()
115 __func__, get_mclk_str(drvdata->mclk_sel), status); in mop500_ab8500_set_mclk()
119 __func__, get_mclk_str(drvdata->mclk_sel)); in mop500_ab8500_set_mclk()
125 * Control-events
135 ucontrol->value.enumerated.item[0] = drvdata->mclk_sel; in mclk_input_control_get()
146 unsigned int val = ucontrol->value.enumerated.item[0]; in mclk_input_control_put()
149 return -EINVAL; in mclk_input_control_put()
150 if (drvdata->mclk_sel == val) in mclk_input_control_put()
153 drvdata->mclk_sel = val; in mclk_input_control_put()
179 SOC_DAPM_PIN_SWITCH("DMic 1"),
180 SOC_DAPM_PIN_SWITCH("DMic 2"),
181 SOC_DAPM_PIN_SWITCH("DMic 3"),
182 SOC_DAPM_PIN_SWITCH("DMic 4"),
183 SOC_DAPM_PIN_SWITCH("DMic 5"),
184 SOC_DAPM_PIN_SWITCH("DMic 6"),
193 /* Set audio-clock source */ in mop500_ab8500_startup()
194 return mop500_ab8500_set_mclk(rtd->card->dev, in mop500_ab8500_startup()
195 snd_soc_card_get_drvdata(rtd->card)); in mop500_ab8500_startup()
201 struct device *dev = rtd->card->dev; in mop500_ab8500_shutdown()
206 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in mop500_ab8500_shutdown()
218 struct device *dev = rtd->card->dev; in mop500_ab8500_hw_params()
226 dev_dbg(dev, "%s: substream->pcm->name = %s\n" in mop500_ab8500_hw_params()
227 "substream->pcm->id = %s.\n" in mop500_ab8500_hw_params()
228 "substream->name = %s.\n" in mop500_ab8500_hw_params()
229 "substream->number = %d.\n", in mop500_ab8500_hw_params()
231 substream->pcm->name, in mop500_ab8500_hw_params()
232 substream->pcm->id, in mop500_ab8500_hw_params()
233 substream->name, in mop500_ab8500_hw_params()
234 substream->number); in mop500_ab8500_hw_params()
242 return -EBUSY; in mop500_ab8500_hw_params()
248 __set_bit(cpu_dai->id, &mop500_ab8500_usage); in mop500_ab8500_hw_params()
263 return -EINVAL; in mop500_ab8500_hw_params()
266 /* Setup codec depending on driver-mode */ in mop500_ab8500_hw_params()
271 dev_dbg(dev, "%s: Driver-mode: %s.\n", __func__, in mop500_ab8500_hw_params()
292 /* Setup TDM-slots */ in mop500_ab8500_hw_params()
294 is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); in mop500_ab8500_hw_params()
312 return -EINVAL; in mop500_ab8500_hw_params()
320 dev_dbg(dev, "%s: CPU-DAI TDM: TX=0x%04X RX=0x%04x\n", __func__, in mop500_ab8500_hw_params()
327 dev_dbg(dev, "%s: CODEC-DAI TDM: TX=0x%04X RX=0x%04x\n", __func__, in mop500_ab8500_hw_params()
343 __clear_bit(cpu_dai->id, &mop500_ab8500_usage); in mop500_ab8500_hw_free()
360 struct snd_soc_dapm_context *dapm = &rtd->card->dapm; in mop500_ab8500_machine_init()
361 struct device *dev = rtd->card->dev; in mop500_ab8500_machine_init()
367 /* Create driver private-data struct */ in mop500_ab8500_machine_init()
372 return -ENOMEM; in mop500_ab8500_machine_init()
374 snd_soc_card_set_drvdata(rtd->card, drvdata); in mop500_ab8500_machine_init()
378 drvdata->clk_ptr_sysclk = clk_get(dev, "sysclk"); in mop500_ab8500_machine_init()
379 if (IS_ERR(drvdata->clk_ptr_sysclk)) in mop500_ab8500_machine_init()
382 drvdata->clk_ptr_ulpclk = clk_get(dev, "ulpclk"); in mop500_ab8500_machine_init()
383 if (IS_ERR(drvdata->clk_ptr_ulpclk)) in mop500_ab8500_machine_init()
386 drvdata->clk_ptr_intclk = clk_get(dev, "intclk"); in mop500_ab8500_machine_init()
387 if (IS_ERR(drvdata->clk_ptr_intclk)) in mop500_ab8500_machine_init()
392 drvdata->mclk_sel = MCLK_ULPCLK; in mop500_ab8500_machine_init()
398 drvdata->mclk_sel = MCLK_ULPCLK; in mop500_ab8500_machine_init()
401 ret = snd_soc_add_card_controls(rtd->card, mop500_ab8500_ctrls, in mop500_ab8500_machine_init()
404 pr_err("%s: Failed to add machine-controls (%d)!\n", in mop500_ab8500_machine_init()
420 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 1"); in mop500_ab8500_machine_init()
421 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 2"); in mop500_ab8500_machine_init()
422 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 3"); in mop500_ab8500_machine_init()
423 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 4"); in mop500_ab8500_machine_init()
424 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 5"); in mop500_ab8500_machine_init()
425 ret |= snd_soc_dapm_disable_pin(dapm, "DMic 6"); in mop500_ab8500_machine_init()
434 clk_put(drvdata->clk_ptr_sysclk); in mop500_ab8500_remove()
435 clk_put(drvdata->clk_ptr_ulpclk); in mop500_ab8500_remove()
436 clk_put(drvdata->clk_ptr_intclk); in mop500_ab8500_remove()