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 <linux/platform_data/asoc-ti-mcbsp.h>
21 #include "omap-mcbsp.h"
61 * Controls, functional after the modem line discipline is activated.
68 /* Selection <-> pin translation */
102 struct snd_soc_dapm_context *dapm = &card->dapm; in ams_delta_set_audio_mode()
103 struct soc_enum *control = (struct soc_enum *)kcontrol->private_value; in ams_delta_set_audio_mode()
108 if (!cx20442_codec->card->pop_time) in ams_delta_set_audio_mode()
109 return -EUNATCH; in ams_delta_set_audio_mode()
111 if (ucontrol->value.enumerated.item[0] >= control->items) in ams_delta_set_audio_mode()
112 return -EINVAL; in ams_delta_set_audio_mode()
117 pins = ams_delta_audio_mode_pins[ucontrol->value.enumerated.item[0]]; in ams_delta_set_audio_mode()
175 struct snd_soc_dapm_context *dapm = &card->dapm; in ams_delta_get_audio_mode()
197 return -EINVAL; in ams_delta_get_audio_mode()
199 ucontrol->value.enumerated.item[0] = mode; in ams_delta_get_audio_mode()
223 /* After we are able to control the codec over the modem,
250 * Modem line discipline, required for making above controls functional.
254 /* To actually apply any modem controlled configuration changes to the codec,
255 * we must connect codec DAI pins to the modem for a moment. Be careful not
272 /* Reconnect the codec DAI back from the modem to the CPU DAI in cx81801_timeout()
284 return -ENODEV; in cx81801_open()
290 tty->disc_data = cx20442_codec; in cx81801_open()
295 tty->disc_data = NULL; in cx81801_open()
303 struct snd_soc_component *component = tty->disc_data; in cx81801_close()
316 dapm = &component->card->dapm; in cx81801_close()
342 struct snd_soc_component *component = tty->disc_data; in cx81801_receive()
349 if (!component->card->pop_time) { in cx81801_receive()
350 /* First modem response, complete setup procedure */ in cx81801_receive()
362 dev_warn(component->dev, in cx81801_receive()
371 for (c = &cp[count - 1]; c >= cp; c--) { in cx81801_receive()
374 /* Complete modem response received, apply config to codec */ in cx81801_receive()
382 /* Apply config pulse by connecting the codec to the modem in cx81801_receive()
412 * over the modem port.
418 /* Digital mute implemented using modem/CPU multiplexer.
448 return ams_delta_mute(NULL, 0, substream->stream); in ams_delta_startup()
453 ams_delta_mute(NULL, 1, substream->stream); in ams_delta_shutdown()
464 struct snd_soc_card *card = rtd->card; in ams_delta_cx20442_init()
465 struct snd_soc_dapm_context *dapm = &card->dapm; in ams_delta_cx20442_init()
470 cx20442_codec = snd_soc_rtd_to_codec(rtd, 0)->component; in ams_delta_cx20442_init()
472 /* Add hook switch - can be used to control the codec from userspace in ams_delta_cx20442_init()
477 dev_warn(card->dev, in ams_delta_cx20442_init()
481 ret = snd_soc_jack_add_gpiods(card->dev, &ams_delta_hook_switch, in ams_delta_cx20442_init()
485 dev_warn(card->dev, in ams_delta_cx20442_init()
490 gpiod_modem_codec = devm_gpiod_get(card->dev, "modem_codec", in ams_delta_cx20442_init()
493 dev_warn(card->dev, "Failed to obtain modem_codec GPIO\n"); in ams_delta_cx20442_init()
498 if (!codec_dai->driver->ops) { in ams_delta_cx20442_init()
499 codec_dai->driver->ops = &ams_delta_dai_ops; in ams_delta_cx20442_init()
505 /* Register optional line discipline for over the modem control */ in ams_delta_cx20442_init()
508 dev_warn(card->dev, in ams_delta_cx20442_init()
523 /* DAI glue - connects codec <--> CPU */
525 DAILINK_COMP_ARRAY(COMP_CPU("omap-mcbsp.1")),
526 DAILINK_COMP_ARRAY(COMP_CODEC("cx20442-codec", "cx20442-voice")),
527 DAILINK_COMP_ARRAY(COMP_PLATFORM("omap-mcbsp.1")));
532 .init = ams_delta_cx20442_init,
554 /* Module init/exit */
560 card->dev = &pdev->dev; in ams_delta_probe()
562 handset_mute = devm_gpiod_get(card->dev, "handset_mute", in ams_delta_probe()
567 handsfree_mute = devm_gpiod_get(card->dev, "handsfree_mute", in ams_delta_probe()
574 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); in ams_delta_probe()
575 card->dev = NULL; in ams_delta_probe()
588 card->dev = NULL; in ams_delta_remove()
591 #define DRV_NAME "ams-delta-audio"