Lines Matching +full:pin +full:- +full:count

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"
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()
105 int pin, changed = 0; in ams_delta_set_audio_mode() local
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()
120 pin = !!(pins & (1 << AMS_DELTA_MOUTHPIECE)); in ams_delta_set_audio_mode()
122 if (pin != snd_soc_dapm_get_pin_status(dapm, "Mouthpiece")) { in ams_delta_set_audio_mode()
124 if (pin) in ams_delta_set_audio_mode()
129 pin = !!(pins & (1 << AMS_DELTA_EARPIECE)); in ams_delta_set_audio_mode()
130 if (pin != snd_soc_dapm_get_pin_status(dapm, "Earpiece")) { in ams_delta_set_audio_mode()
132 if (pin) in ams_delta_set_audio_mode()
137 pin = !!(pins & (1 << AMS_DELTA_MICROPHONE)); in ams_delta_set_audio_mode()
138 if (pin != snd_soc_dapm_get_pin_status(dapm, "Microphone")) { in ams_delta_set_audio_mode()
140 if (pin) in ams_delta_set_audio_mode()
145 pin = !!(pins & (1 << AMS_DELTA_SPEAKER)); in ams_delta_set_audio_mode()
146 if (pin != snd_soc_dapm_get_pin_status(dapm, "Speaker")) { in ams_delta_set_audio_mode()
148 if (pin) in ams_delta_set_audio_mode()
153 pin = !!(pins & (1 << AMS_DELTA_AGC)); in ams_delta_set_audio_mode()
154 if (pin != ams_delta_audio_agc) { in ams_delta_set_audio_mode()
155 ams_delta_audio_agc = pin; in ams_delta_set_audio_mode()
157 if (pin) 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()
228 .pin = "Mouthpiece",
232 .pin = "Earpiece",
237 .pin = "Microphone",
242 .pin = "Speaker",
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()
340 size_t count) in cx81801_receive() argument
342 struct snd_soc_component *component = tty->disc_data; in cx81801_receive()
349 if (!component->card->pop_time) { in cx81801_receive()
355 v253_ops.receive_buf(tty, cp, fp, count); in cx81801_receive()
362 dev_warn(component->dev, in cx81801_receive()
369 v253_ops.receive_buf(tty, cp, fp, count); in cx81801_receive()
371 for (c = &cp[count - 1]; c >= cp; c--) { in cx81801_receive()
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()
508 dev_warn(card->dev, in ams_delta_cx20442_init()
514 /* Set up initial pin constellation */ 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")));
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"