• Home
  • Raw
  • Download

Lines Matching +full:ac100 +full:- +full:codec

1 // SPDX-License-Identifier: GPL-2.0-only
3 * tegra_rt5677.c - Tegra machine ASoC driver for boards using RT5677 codec.
9 * Copyright (C) 2010-2012 - NVIDIA, Inc.
10 * Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
31 #define DRV_NAME "tegra-snd-rt5677"
46 struct snd_soc_card *card = rtd->card; in tegra_rt5677_asoc_hw_params()
53 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk); in tegra_rt5677_asoc_hw_params()
55 dev_err(card->dev, "Can't configure clocks\n"); in tegra_rt5677_asoc_hw_params()
62 dev_err(card->dev, "codec_dai clock not set\n"); in tegra_rt5677_asoc_hw_params()
72 struct snd_soc_dapm_context *dapm = w->dapm; in tegra_rt5677_event_hp()
73 struct snd_soc_card *card = dapm->card; in tegra_rt5677_event_hp()
76 if (!gpio_is_valid(machine->gpio_hp_en)) in tegra_rt5677_event_hp()
79 gpio_set_value_cansleep(machine->gpio_hp_en, in tegra_rt5677_event_hp()
133 struct tegra_rt5677 *machine = snd_soc_card_get_drvdata(rtd->card); in tegra_rt5677_asoc_init()
135 snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE, in tegra_rt5677_asoc_init()
139 if (gpio_is_valid(machine->gpio_hp_det)) { in tegra_rt5677_asoc_init()
140 tegra_rt5677_hp_jack_gpio.gpio = machine->gpio_hp_det; in tegra_rt5677_asoc_init()
146 snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE, in tegra_rt5677_asoc_init()
150 if (gpio_is_valid(machine->gpio_mic_present)) { in tegra_rt5677_asoc_init()
151 tegra_rt5677_mic_jack_gpio.gpio = machine->gpio_mic_present; in tegra_rt5677_asoc_init()
156 snd_soc_dapm_force_enable_pin(&rtd->card->dapm, "MICBIAS1"); in tegra_rt5677_asoc_init()
163 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "rt5677-aif1")),
177 .name = "tegra-rt5677",
191 struct device_node *np = pdev->dev.of_node; in tegra_rt5677_probe()
196 machine = devm_kzalloc(&pdev->dev, in tegra_rt5677_probe()
199 return -ENOMEM; in tegra_rt5677_probe()
201 card->dev = &pdev->dev; in tegra_rt5677_probe()
204 machine->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0); in tegra_rt5677_probe()
205 if (machine->gpio_hp_det == -EPROBE_DEFER) in tegra_rt5677_probe()
206 return -EPROBE_DEFER; in tegra_rt5677_probe()
208 machine->gpio_mic_present = of_get_named_gpio(np, in tegra_rt5677_probe()
209 "nvidia,mic-present-gpios", 0); in tegra_rt5677_probe()
210 if (machine->gpio_mic_present == -EPROBE_DEFER) in tegra_rt5677_probe()
211 return -EPROBE_DEFER; in tegra_rt5677_probe()
213 machine->gpio_hp_en = of_get_named_gpio(np, "nvidia,hp-en-gpios", 0); in tegra_rt5677_probe()
214 if (machine->gpio_hp_en == -EPROBE_DEFER) in tegra_rt5677_probe()
215 return -EPROBE_DEFER; in tegra_rt5677_probe()
216 if (gpio_is_valid(machine->gpio_hp_en)) { in tegra_rt5677_probe()
217 ret = devm_gpio_request_one(&pdev->dev, machine->gpio_hp_en, in tegra_rt5677_probe()
220 dev_err(card->dev, "cannot get hp_en gpio\n"); in tegra_rt5677_probe()
225 machine->gpio_dmic_clk_en = of_get_named_gpio(np, in tegra_rt5677_probe()
226 "nvidia,dmic-clk-en-gpios", 0); in tegra_rt5677_probe()
227 if (machine->gpio_dmic_clk_en == -EPROBE_DEFER) in tegra_rt5677_probe()
228 return -EPROBE_DEFER; in tegra_rt5677_probe()
229 if (gpio_is_valid(machine->gpio_dmic_clk_en)) { in tegra_rt5677_probe()
230 ret = devm_gpio_request_one(&pdev->dev, in tegra_rt5677_probe()
231 machine->gpio_dmic_clk_en, in tegra_rt5677_probe()
234 dev_err(card->dev, "cannot get dmic_clk_en gpio\n"); in tegra_rt5677_probe()
243 ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); in tegra_rt5677_probe()
247 tegra_rt5677_dai.codecs->of_node = of_parse_phandle(np, in tegra_rt5677_probe()
248 "nvidia,audio-codec", 0); in tegra_rt5677_probe()
249 if (!tegra_rt5677_dai.codecs->of_node) { in tegra_rt5677_probe()
250 dev_err(&pdev->dev, in tegra_rt5677_probe()
251 "Property 'nvidia,audio-codec' missing or invalid\n"); in tegra_rt5677_probe()
252 ret = -EINVAL; in tegra_rt5677_probe()
256 tegra_rt5677_dai.cpus->of_node = of_parse_phandle(np, in tegra_rt5677_probe()
257 "nvidia,i2s-controller", 0); in tegra_rt5677_probe()
258 if (!tegra_rt5677_dai.cpus->of_node) { in tegra_rt5677_probe()
259 dev_err(&pdev->dev, in tegra_rt5677_probe()
260 "Property 'nvidia,i2s-controller' missing or invalid\n"); in tegra_rt5677_probe()
261 ret = -EINVAL; in tegra_rt5677_probe()
264 tegra_rt5677_dai.platforms->of_node = tegra_rt5677_dai.cpus->of_node; in tegra_rt5677_probe()
266 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); in tegra_rt5677_probe()
272 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", in tegra_rt5677_probe()
280 of_node_put(tegra_rt5677_dai.cpus->of_node); in tegra_rt5677_probe()
281 tegra_rt5677_dai.cpus->of_node = NULL; in tegra_rt5677_probe()
282 tegra_rt5677_dai.platforms->of_node = NULL; in tegra_rt5677_probe()
284 of_node_put(tegra_rt5677_dai.codecs->of_node); in tegra_rt5677_probe()
285 tegra_rt5677_dai.codecs->of_node = NULL; in tegra_rt5677_probe()
296 tegra_rt5677_dai.platforms->of_node = NULL; in tegra_rt5677_remove()
297 of_node_put(tegra_rt5677_dai.codecs->of_node); in tegra_rt5677_remove()
298 tegra_rt5677_dai.codecs->of_node = NULL; in tegra_rt5677_remove()
299 of_node_put(tegra_rt5677_dai.cpus->of_node); in tegra_rt5677_remove()
300 tegra_rt5677_dai.cpus->of_node = NULL; in tegra_rt5677_remove()
306 { .compatible = "nvidia,tegra-audio-rt5677", },