Lines Matching +full:modeswitch +full:- +full:delay +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-only
3 * dmic.c -- SoC audio for Generic Digital MICs
8 #include <linux/delay.h>
17 #include <sound/soc-dapm.h>
29 /* Delay after DMIC mode switch */
36 struct snd_soc_component *component = dai->component; in dmic_daiops_trigger()
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()
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",
97 dmic = devm_kzalloc(component->dev, sizeof(*dmic), GFP_KERNEL); in dmic_component_probe()
99 return -ENOMEM; in dmic_component_probe()
101 dmic->gpio_en = devm_gpiod_get_optional(component->dev, in dmic_component_probe()
103 if (IS_ERR(dmic->gpio_en)) in dmic_component_probe()
104 return PTR_ERR(dmic->gpio_en); in dmic_component_probe()
106 device_property_read_u32(component->dev, "wakeup-delay-ms", in dmic_component_probe()
107 &dmic->wakeup_delay); in dmic_component_probe()
108 device_property_read_u32(component->dev, "modeswitch-delay-ms", in dmic_component_probe()
109 &dmic->modeswitch_delay); in dmic_component_probe()
111 dmic->wakeup_delay = wakeup_delay; in dmic_component_probe()
113 dmic->modeswitch_delay = modeswitch_delay; in dmic_component_probe()
115 if (dmic->modeswitch_delay > MAX_MODESWITCH_DELAY) in dmic_component_probe()
116 dmic->modeswitch_delay = MAX_MODESWITCH_DELAY; in dmic_component_probe()
151 if (pdev->dev.of_node) { in dmic_dev_probe()
152 err = of_property_read_u32(pdev->dev.of_node, "num-channels", &chans); in dmic_dev_probe()
153 if (err && (err != -EINVAL)) in dmic_dev_probe()
158 return -EINVAL; in dmic_dev_probe()
160 dai_drv = devm_kzalloc(&pdev->dev, sizeof(*dai_drv), GFP_KERNEL); in dmic_dev_probe()
162 return -ENOMEM; in dmic_dev_probe()
165 dai_drv->capture.channels_max = chans; in dmic_dev_probe()
169 return devm_snd_soc_register_component(&pdev->dev, in dmic_dev_probe()
173 MODULE_ALIAS("platform:dmic-codec");
176 {.compatible = "dmic-codec"},
183 .name = "dmic-codec",