Lines Matching +full:in2 +full:-
1 // SPDX-License-Identifier: GPL-2.0
3 // TSE-850 audio - ASoC driver for the Axentia TSE-850 with a PCM5142 codec
10 // IN1 +---o +------------+ o---+ OUT1
14 // +--o +--. |
17 // | .---. |
18 // DAC +----------->|Sum|---+
19 // | '---' |
23 // IN2 +---o--+------------+--o---+ OUT2
33 // 'loop2' relays are active, short-cutting the TSE-850 from channel 2.
34 // IN1, IN2, OUT1 and OUT2 are TSE-850 connectors and DAC is the PCB name
62 struct snd_soc_card *card = dapm->card; in tse850_get_mux1()
65 ucontrol->value.enumerated.item[0] = tse850->loop1_cache; in tse850_get_mux1()
74 struct snd_soc_card *card = dapm->card; in tse850_put_mux1()
76 struct soc_enum *e = (struct soc_enum *)kctrl->private_value; in tse850_put_mux1()
77 unsigned int val = ucontrol->value.enumerated.item[0]; in tse850_put_mux1()
79 if (val >= e->items) in tse850_put_mux1()
80 return -EINVAL; in tse850_put_mux1()
82 gpiod_set_value_cansleep(tse850->loop1, val); in tse850_put_mux1()
83 tse850->loop1_cache = val; in tse850_put_mux1()
92 struct snd_soc_card *card = dapm->card; in tse850_get_mux2()
95 ucontrol->value.enumerated.item[0] = tse850->loop2_cache; in tse850_get_mux2()
104 struct snd_soc_card *card = dapm->card; in tse850_put_mux2()
106 struct soc_enum *e = (struct soc_enum *)kctrl->private_value; in tse850_put_mux2()
107 unsigned int val = ucontrol->value.enumerated.item[0]; in tse850_put_mux2()
109 if (val >= e->items) in tse850_put_mux2()
110 return -EINVAL; in tse850_put_mux2()
112 gpiod_set_value_cansleep(tse850->loop2, val); in tse850_put_mux2()
113 tse850->loop2_cache = val; in tse850_put_mux2()
122 struct snd_soc_card *card = dapm->card; in tse850_get_mix()
125 ucontrol->value.enumerated.item[0] = tse850->add_cache; in tse850_get_mix()
134 struct snd_soc_card *card = dapm->card; in tse850_put_mix()
136 int connect = !!ucontrol->value.integer.value[0]; in tse850_put_mix()
138 if (tse850->add_cache == connect) in tse850_put_mix()
145 gpiod_set_value_cansleep(tse850->add, connect); in tse850_put_mix()
146 tse850->add_cache = connect; in tse850_put_mix()
156 struct snd_soc_card *card = dapm->card; in tse850_get_ana()
160 ret = regulator_get_voltage(tse850->ana); in tse850_get_ana()
166 * -11.5V to "Low" (enum 0) in tse850_get_ana()
167 * 11.5V-12.5V to "12V" (enum 1) in tse850_get_ana()
168 * 12.5V-13.5V to "13V" (enum 2) in tse850_get_ana()
170 * 18.5V-19.5V to "19V" (enum 8) in tse850_get_ana()
171 * 19.5V- to "20V" (enum 9) in tse850_get_ana()
177 ret -= 11000000; in tse850_get_ana()
180 ucontrol->value.enumerated.item[0] = ret; in tse850_get_ana()
189 struct snd_soc_card *card = dapm->card; in tse850_put_ana()
191 struct soc_enum *e = (struct soc_enum *)kctrl->private_value; in tse850_put_ana()
192 unsigned int uV = ucontrol->value.enumerated.item[0]; in tse850_put_ana()
195 if (uV >= e->items) in tse850_put_ana()
196 return -EINVAL; in tse850_put_ana()
212 ret = regulator_set_voltage(tse850->ana, uV, uV); in tse850_put_ana()
256 SND_SOC_DAPM_LINE("IN2", NULL),
267 * These connections are not entirely correct, since both IN1 and IN2
282 { "MUX2", "Loop", "IN2" },
289 { "MIX", "IN Switch", "IN2" },
297 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "pcm512x-hifi")),
301 .name = "TSE-850",
302 .stream_name = "TSE-850-PCM",
310 .name = "TSE-850-ASoC",
323 struct device_node *np = pdev->dev.of_node; in tse850_dt_init()
328 dev_err(&pdev->dev, "only device tree supported\n"); in tse850_dt_init()
329 return -EINVAL; in tse850_dt_init()
332 cpu_np = of_parse_phandle(np, "axentia,cpu-dai", 0); in tse850_dt_init()
334 dev_err(&pdev->dev, "failed to get cpu dai\n"); in tse850_dt_init()
335 return -EINVAL; in tse850_dt_init()
337 dailink->cpus->of_node = cpu_np; in tse850_dt_init()
338 dailink->platforms->of_node = cpu_np; in tse850_dt_init()
341 codec_np = of_parse_phandle(np, "axentia,audio-codec", 0); in tse850_dt_init()
343 dev_err(&pdev->dev, "failed to get codec info\n"); in tse850_dt_init()
344 return -EINVAL; in tse850_dt_init()
346 dailink->codecs->of_node = codec_np; in tse850_dt_init()
355 struct device *dev = card->dev = &pdev->dev; in tse850_probe()
361 return -ENOMEM; in tse850_probe()
371 tse850->add = devm_gpiod_get(dev, "axentia,add", GPIOD_OUT_HIGH); in tse850_probe()
372 if (IS_ERR(tse850->add)) in tse850_probe()
373 return dev_err_probe(dev, PTR_ERR(tse850->add), in tse850_probe()
375 tse850->add_cache = 1; in tse850_probe()
377 tse850->loop1 = devm_gpiod_get(dev, "axentia,loop1", GPIOD_OUT_HIGH); in tse850_probe()
378 if (IS_ERR(tse850->loop1)) in tse850_probe()
379 return dev_err_probe(dev, PTR_ERR(tse850->loop1), in tse850_probe()
381 tse850->loop1_cache = 1; in tse850_probe()
383 tse850->loop2 = devm_gpiod_get(dev, "axentia,loop2", GPIOD_OUT_HIGH); in tse850_probe()
384 if (IS_ERR(tse850->loop2)) in tse850_probe()
385 return dev_err_probe(dev, PTR_ERR(tse850->loop2), in tse850_probe()
387 tse850->loop2_cache = 1; in tse850_probe()
389 tse850->ana = devm_regulator_get(dev, "axentia,ana"); in tse850_probe()
390 if (IS_ERR(tse850->ana)) in tse850_probe()
391 return dev_err_probe(dev, PTR_ERR(tse850->ana), in tse850_probe()
394 ret = regulator_enable(tse850->ana); in tse850_probe()
409 regulator_disable(tse850->ana); in tse850_probe()
419 regulator_disable(tse850->ana); in tse850_remove()
423 { .compatible = "axentia,tse850-pcm5142", },
430 .name = "axentia-tse850-pcm5142",
441 MODULE_DESCRIPTION("ALSA SoC driver for TSE-850 with PCM5142 codec");