Lines Matching +full:modem +full:- +full:init
1 // SPDX-License-Identifier: GPL-2.0-only
3 * ams-delta.c -- SoC audio for Amstrad E3 (Delta) videophone
19 #include <asm/mach-types.h>
21 #include <linux/platform_data/asoc-ti-mcbsp.h>
23 #include "omap-mcbsp.h"
63 * Controls, functional after the modem line discipline is activated.
70 /* Selection <-> pin translation */
104 struct snd_soc_dapm_context *dapm = &card->dapm; in ams_delta_set_audio_mode()
105 struct soc_enum *control = (struct soc_enum *)kcontrol->private_value; in ams_delta_set_audio_mode()
110 if (!cx20442_codec->card->pop_time) in ams_delta_set_audio_mode()
111 return -EUNATCH; in ams_delta_set_audio_mode()
113 if (ucontrol->value.enumerated.item[0] >= control->items) in ams_delta_set_audio_mode()
114 return -EINVAL; in ams_delta_set_audio_mode()
119 pins = ams_delta_audio_mode_pins[ucontrol->value.enumerated.item[0]]; in ams_delta_set_audio_mode()
177 struct snd_soc_dapm_context *dapm = &card->dapm; in ams_delta_get_audio_mode()
199 return -EINVAL; in ams_delta_get_audio_mode()
201 ucontrol->value.enumerated.item[0] = mode; in ams_delta_get_audio_mode()
225 /* After we are able to control the codec over the modem,
252 * Modem line discipline, required for making above controls functional.
256 /* To actually apply any modem controlled configuration changes to the codec,
257 * we must connect codec DAI pins to the modem for a moment. Be careful not
274 /* Reconnect the codec DAI back from the modem to the CPU DAI in cx81801_timeout()
286 return -ENODEV; in cx81801_open()
292 tty->disc_data = cx20442_codec; in cx81801_open()
297 tty->disc_data = NULL; in cx81801_open()
305 struct snd_soc_component *component = tty->disc_data; in cx81801_close()
306 struct snd_soc_dapm_context *dapm = &component->card->dapm; in cx81801_close()
343 struct snd_soc_component *component = tty->disc_data; in cx81801_receive()
350 if (!component->card->pop_time) { in cx81801_receive()
351 /* First modem response, complete setup procedure */ in cx81801_receive()
363 dev_warn(component->dev, in cx81801_receive()
372 for (c = &cp[count - 1]; c >= cp; c--) { in cx81801_receive()
375 /* Complete modem response received, apply config to codec */ in cx81801_receive()
383 /* Apply config pulse by connecting the codec to the modem in cx81801_receive()
413 * over the modem port.
419 /* Digital mute implemented using modem/CPU multiplexer.
449 return ams_delta_mute(NULL, 0, substream->stream); in ams_delta_startup()
454 ams_delta_mute(NULL, 1, substream->stream); in ams_delta_shutdown()
465 struct snd_soc_card *card = rtd->card; in ams_delta_cx20442_init()
466 struct snd_soc_dapm_context *dapm = &card->dapm; in ams_delta_cx20442_init()
471 cx20442_codec = asoc_rtd_to_codec(rtd, 0)->component; in ams_delta_cx20442_init()
473 /* Add hook switch - can be used to control the codec from userspace in ams_delta_cx20442_init()
478 dev_warn(card->dev, in ams_delta_cx20442_init()
482 ret = snd_soc_jack_add_gpiods(card->dev, &ams_delta_hook_switch, in ams_delta_cx20442_init()
486 dev_warn(card->dev, in ams_delta_cx20442_init()
491 gpiod_modem_codec = devm_gpiod_get(card->dev, "modem_codec", in ams_delta_cx20442_init()
494 dev_warn(card->dev, "Failed to obtain modem_codec GPIO\n"); in ams_delta_cx20442_init()
499 if (!codec_dai->driver->ops) { in ams_delta_cx20442_init()
500 codec_dai->driver->ops = &ams_delta_dai_ops; in ams_delta_cx20442_init()
506 /* Register optional line discipline for over the modem control */ in ams_delta_cx20442_init()
509 dev_warn(card->dev, in ams_delta_cx20442_init()
524 /* DAI glue - connects codec <--> CPU */
526 DAILINK_COMP_ARRAY(COMP_CPU("omap-mcbsp.1")),
527 DAILINK_COMP_ARRAY(COMP_CODEC("cx20442-codec", "cx20442-voice")),
528 DAILINK_COMP_ARRAY(COMP_PLATFORM("omap-mcbsp.1")));
533 .init = ams_delta_cx20442_init,
555 /* Module init/exit */
561 card->dev = &pdev->dev; in ams_delta_probe()
563 handset_mute = devm_gpiod_get(card->dev, "handset_mute", in ams_delta_probe()
568 handsfree_mute = devm_gpiod_get(card->dev, "handsfree_mute", in ams_delta_probe()
575 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); in ams_delta_probe()
576 card->dev = NULL; in ams_delta_probe()
587 dev_warn(&pdev->dev, in ams_delta_remove()
591 card->dev = NULL; in ams_delta_remove()
595 #define DRV_NAME "ams-delta-audio"