Lines Matching +full:dmic +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
3 * dmic.c -- SoC audio for Generic Digital MICs
17 #include <sound/soc-dapm.h>
26 struct dmic { struct
29 /* Delay after DMIC mode switch */
36 struct snd_soc_component *component = dai->component; in dmic_daiops_trigger()
37 struct dmic *dmic = snd_soc_component_get_drvdata(component); in dmic_daiops_trigger() argument
41 if (dmic->modeswitch_delay) in dmic_daiops_trigger()
42 mdelay(dmic->modeswitch_delay); in dmic_daiops_trigger()
56 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in dmic_aif_event()
57 struct dmic *dmic = snd_soc_component_get_drvdata(component); in dmic_aif_event() local
61 if (dmic->gpio_en) in dmic_aif_event()
62 gpiod_set_value_cansleep(dmic->gpio_en, 1); in dmic_aif_event()
64 if (dmic->wakeup_delay) in dmic_aif_event()
65 msleep(dmic->wakeup_delay); in dmic_aif_event()
68 if (dmic->gpio_en) in dmic_aif_event()
69 gpiod_set_value_cansleep(dmic->gpio_en, 0); in dmic_aif_event()
77 .name = "dmic-hifi",
92 struct dmic *dmic; in dmic_component_probe() local
94 dmic = devm_kzalloc(component->dev, sizeof(*dmic), GFP_KERNEL); in dmic_component_probe()
95 if (!dmic) in dmic_component_probe()
96 return -ENOMEM; in dmic_component_probe()
98 dmic->gpio_en = devm_gpiod_get_optional(component->dev, in dmic_component_probe()
100 if (IS_ERR(dmic->gpio_en)) in dmic_component_probe()
101 return PTR_ERR(dmic->gpio_en); in dmic_component_probe()
103 device_property_read_u32(component->dev, "wakeup-delay-ms", in dmic_component_probe()
104 &dmic->wakeup_delay); in dmic_component_probe()
105 device_property_read_u32(component->dev, "modeswitch-delay-ms", in dmic_component_probe()
106 &dmic->modeswitch_delay); in dmic_component_probe()
108 dmic->wakeup_delay = wakeup_delay; in dmic_component_probe()
110 dmic->modeswitch_delay = modeswitch_delay; in dmic_component_probe()
112 if (dmic->modeswitch_delay > MAX_MODESWITCH_DELAY) in dmic_component_probe()
113 dmic->modeswitch_delay = MAX_MODESWITCH_DELAY; in dmic_component_probe()
115 snd_soc_component_set_drvdata(component, dmic); in dmic_component_probe()
121 SND_SOC_DAPM_AIF_OUT_E("DMIC AIF", "Capture", 0,
124 SND_SOC_DAPM_INPUT("DMic"),
128 {"DMIC AIF", NULL, "DMic"},
149 if (pdev->dev.of_node) { in dmic_dev_probe()
150 err = of_property_read_u32(pdev->dev.of_node, "num-channels", &chans); in dmic_dev_probe()
151 if (err && (err != -EINVAL)) in dmic_dev_probe()
156 return -EINVAL; in dmic_dev_probe()
158 dai_drv = devm_kzalloc(&pdev->dev, sizeof(*dai_drv), GFP_KERNEL); in dmic_dev_probe()
160 return -ENOMEM; in dmic_dev_probe()
163 dai_drv->capture.channels_max = chans; in dmic_dev_probe()
167 return devm_snd_soc_register_component(&pdev->dev, in dmic_dev_probe()
171 MODULE_ALIAS("platform:dmic-codec");
174 {.compatible = "dmic-codec"},
181 .name = "dmic-codec",
189 MODULE_DESCRIPTION("Generic DMIC driver");