linux/sound/soc/ti/ams-delta.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * ams-delta.c  --  SoC audio for Amstrad E3 (Delta) videophone
 *
 * Copyright (C) 2009 Janusz Krzysztofik <[email protected]>
 *
 * Initially based on sound/soc/omap/osk5912.x
 * Copyright (C) 2008 Mistral Solutions
 */

#include <linux/gpio/consumer.h>
#include <linux/spinlock.h>
#include <linux/tty.h>
#include <linux/module.h>

#include <sound/soc.h>
#include <sound/jack.h>

#include <linux/platform_data/asoc-ti-mcbsp.h>

#include "omap-mcbsp.h"
#include "../codecs/cx20442.h"

static struct gpio_desc *handset_mute;
static struct gpio_desc *handsfree_mute;

static int ams_delta_event_handset(struct snd_soc_dapm_widget *w,
				   struct snd_kcontrol *k, int event)
{}

static int ams_delta_event_handsfree(struct snd_soc_dapm_widget *w,
				     struct snd_kcontrol *k, int event)
{}

/* Board specific DAPM widgets */
static const struct snd_soc_dapm_widget ams_delta_dapm_widgets[] =;

/* How they are connected to codec pins */
static const struct snd_soc_dapm_route ams_delta_audio_map[] =;

/*
 * Controls, functional after the modem line discipline is activated.
 */

/* Virtual switch: audio input/output constellations */
static const char *ams_delta_audio_mode[] =;

/* Selection <-> pin translation */
#define AMS_DELTA_MOUTHPIECE
#define AMS_DELTA_EARPIECE
#define AMS_DELTA_MICROPHONE
#define AMS_DELTA_SPEAKER
#define AMS_DELTA_AGC

#define AMS_DELTA_MIXED
#define AMS_DELTA_HANDSET
#define AMS_DELTA_HANDSFREE
#define AMS_DELTA_SPEAKERPHONE

static const unsigned short ams_delta_audio_mode_pins[] =;

static unsigned short ams_delta_audio_agc;

/*
 * Used for passing a codec structure pointer
 * from the board initialization code to the tty line discipline.
 */
static struct snd_soc_component *cx20442_codec;

static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{}

static int ams_delta_get_audio_mode(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{}

static SOC_ENUM_SINGLE_EXT_DECL(ams_delta_audio_enum,
				      ams_delta_audio_mode);

static const struct snd_kcontrol_new ams_delta_audio_controls[] =;

/* Hook switch */
static struct snd_soc_jack ams_delta_hook_switch;
static struct snd_soc_jack_gpio ams_delta_hook_switch_gpios[] =;

/* After we are able to control the codec over the modem,
 * the hook switch can be used for dynamic DAPM reconfiguration. */
static struct snd_soc_jack_pin ams_delta_hook_switch_pins[] =;


/*
 * Modem line discipline, required for making above controls functional.
 * Activated from userspace with ldattach, possibly invoked from udev rule.
 */

/* To actually apply any modem controlled configuration changes to the codec,
 * we must connect codec DAI pins to the modem for a moment.  Be careful not
 * to interfere with our digital mute function that shares the same hardware. */
static struct timer_list cx81801_timer;
static bool cx81801_cmd_pending;
static bool ams_delta_muted;
static DEFINE_SPINLOCK(ams_delta_lock);
static struct gpio_desc *gpiod_modem_codec;

static void cx81801_timeout(struct timer_list *unused)
{}

/* Line discipline .open() */
static int cx81801_open(struct tty_struct *tty)
{}

/* Line discipline .close() */
static void cx81801_close(struct tty_struct *tty)
{}

/* Line discipline .hangup() */
static void cx81801_hangup(struct tty_struct *tty)
{}

/* Line discipline .receive_buf() */
static void cx81801_receive(struct tty_struct *tty, const u8 *cp, const u8 *fp,
			    size_t count)
{}

/* Line discipline .write_wakeup() */
static void cx81801_wakeup(struct tty_struct *tty)
{}

static struct tty_ldisc_ops cx81801_ops =;


/*
 * Even if not very useful, the sound card can still work without any of the
 * above functionality activated.  You can still control its audio input/output
 * constellation and speakerphone gain from userspace by issuing AT commands
 * over the modem port.
 */

static struct snd_soc_ops ams_delta_ops;


/* Digital mute implemented using modem/CPU multiplexer.
 * Shares hardware with codec config pulse generation */
static bool ams_delta_muted =;

static int ams_delta_mute(struct snd_soc_dai *dai, int mute, int direction)
{}

/* Our codec DAI probably doesn't have its own .ops structure */
static const struct snd_soc_dai_ops ams_delta_dai_ops =;

/* Will be used if the codec ever has its own digital_mute function */
static int ams_delta_startup(struct snd_pcm_substream *substream)
{}

static void ams_delta_shutdown(struct snd_pcm_substream *substream)
{}


/*
 * Card initialization
 */

static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
{}

/* DAI glue - connects codec <--> CPU */
SND_SOC_DAILINK_DEFS();

static struct snd_soc_dai_link ams_delta_dai_link =;

/* Audio card driver */
static struct snd_soc_card ams_delta_audio_card =;

/* Module init/exit */
static int ams_delta_probe(struct platform_device *pdev)
{}

static void ams_delta_remove(struct platform_device *pdev)
{}

#define DRV_NAME

static struct platform_driver ams_delta_driver =;

module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS();