linux/sound/soc/codecs/mc13783.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright 2008 Juergen Beisert, [email protected]
 * Copyright 2009 Sascha Hauer, [email protected]
 * Copyright 2012 Philippe Retornaz, [email protected]
 *
 * Initial development of this code was funded by
 * Phytec Messtechnik GmbH, https://www.phytec.de
 */
#include <linux/module.h>
#include <linux/device.h>
#include <linux/of.h>
#include <linux/mfd/mc13xxx.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/soc-dapm.h>
#include <linux/regmap.h>

#include "mc13783.h"

#define AUDIO_RX0_ALSPEN
#define AUDIO_RX0_ALSPSEL
#define AUDIO_RX0_ADDCDC
#define AUDIO_RX0_ADDSTDC
#define AUDIO_RX0_ADDRXIN

#define AUDIO_RX1_PGARXEN
#define AUDIO_RX1_PGASTEN
#define AUDIO_RX1_ARXINEN

#define AUDIO_TX_AMC1REN
#define AUDIO_TX_AMC1LEN
#define AUDIO_TX_AMC2EN
#define AUDIO_TX_ATXINEN
#define AUDIO_TX_RXINREC

#define SSI_NETWORK_CDCTXRXSLOT(x)
#define SSI_NETWORK_CDCTXSECSLOT(x)
#define SSI_NETWORK_CDCRXSECSLOT(x)
#define SSI_NETWORK_CDCRXSECGAIN(x)
#define SSI_NETWORK_CDCSUMGAIN(x)
#define SSI_NETWORK_CDCFSDLY(x)
#define SSI_NETWORK_DAC_SLOTS_8
#define SSI_NETWORK_DAC_SLOTS_4
#define SSI_NETWORK_DAC_SLOTS_2
#define SSI_NETWORK_DAC_SLOT_MASK
#define SSI_NETWORK_DAC_RXSLOT_0_1
#define SSI_NETWORK_DAC_RXSLOT_2_3
#define SSI_NETWORK_DAC_RXSLOT_4_5
#define SSI_NETWORK_DAC_RXSLOT_6_7
#define SSI_NETWORK_DAC_RXSLOT_MASK
#define SSI_NETWORK_STDCRXSECSLOT(x)
#define SSI_NETWORK_STDCRXSECGAIN(x)
#define SSI_NETWORK_STDCSUMGAIN

/*
 * MC13783_AUDIO_CODEC and MC13783_AUDIO_DAC mostly share the same
 * register layout
 */
#define AUDIO_SSI_SEL
#define AUDIO_CLK_SEL
#define AUDIO_CSM
#define AUDIO_BCL_INV
#define AUDIO_CFS_INV
#define AUDIO_CFS(x)
#define AUDIO_CLK(x)
#define AUDIO_C_EN
#define AUDIO_C_CLK_EN
#define AUDIO_C_RESET

#define AUDIO_CODEC_CDCFS8K16K
#define AUDIO_DAC_CFS_DLY_B

struct mc13783_priv {};

/* Mapping between sample rates and register value */
static unsigned int mc13783_rates[] =;

static int mc13783_pcm_hw_params_dac(struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *params,
				struct snd_soc_dai *dai)
{}

static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *params,
				struct snd_soc_dai *dai)
{}

static int mc13783_pcm_hw_params_sync(struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *params,
				struct snd_soc_dai *dai)
{}

static int mc13783_set_fmt(struct snd_soc_dai *dai, unsigned int fmt,
			unsigned int reg)
{}

static int mc13783_set_fmt_async(struct snd_soc_dai *dai, unsigned int fmt)
{}

static int mc13783_set_fmt_sync(struct snd_soc_dai *dai, unsigned int fmt)
{}

static int mc13783_sysclk[] =;

static int mc13783_set_sysclk(struct snd_soc_dai *dai,
				  int clk_id, unsigned int freq, int dir,
				  unsigned int reg)
{}

static int mc13783_set_sysclk_dac(struct snd_soc_dai *dai,
				  int clk_id, unsigned int freq, int dir)
{}

static int mc13783_set_sysclk_codec(struct snd_soc_dai *dai,
				  int clk_id, unsigned int freq, int dir)
{}

static int mc13783_set_sysclk_sync(struct snd_soc_dai *dai,
				  int clk_id, unsigned int freq, int dir)
{}

static int mc13783_set_tdm_slot_dac(struct snd_soc_dai *dai,
	unsigned int tx_mask, unsigned int rx_mask, int slots,
	int slot_width)
{}

static int mc13783_set_tdm_slot_codec(struct snd_soc_dai *dai,
	unsigned int tx_mask, unsigned int rx_mask, int slots,
	int slot_width)
{}

static int mc13783_set_tdm_slot_sync(struct snd_soc_dai *dai,
	unsigned int tx_mask, unsigned int rx_mask, int slots,
	int slot_width)
{}

static const struct snd_kcontrol_new mc1l_amp_ctl =;

static const struct snd_kcontrol_new mc1r_amp_ctl =;

static const struct snd_kcontrol_new mc2_amp_ctl =;

static const struct snd_kcontrol_new atx_amp_ctl =;


/* Virtual mux. The chip does the input selection automatically
 * as soon as we enable one input. */
static const char * const adcl_enum_text[] =;

static SOC_ENUM_SINGLE_VIRT_DECL(adcl_enum, adcl_enum_text);

static const struct snd_kcontrol_new left_input_mux =;

static const char * const adcr_enum_text[] =;

static SOC_ENUM_SINGLE_VIRT_DECL(adcr_enum, adcr_enum_text);

static const struct snd_kcontrol_new right_input_mux =;

static const struct snd_kcontrol_new samp_ctl =;

static const char * const speaker_amp_source_text[] =;
static SOC_ENUM_SINGLE_DECL(speaker_amp_source, MC13783_AUDIO_RX0, 4,
			    speaker_amp_source_text);
static const struct snd_kcontrol_new speaker_amp_source_mux =;

static const char * const headset_amp_source_text[] =;

static SOC_ENUM_SINGLE_DECL(headset_amp_source, MC13783_AUDIO_RX0, 11,
			    headset_amp_source_text);
static const struct snd_kcontrol_new headset_amp_source_mux =;

static const struct snd_kcontrol_new cdcout_ctl =;

static const struct snd_kcontrol_new adc_bypass_ctl =;

static const struct snd_kcontrol_new lamp_ctl =;

static const struct snd_kcontrol_new hlamp_ctl =;

static const struct snd_kcontrol_new hramp_ctl =;

static const struct snd_kcontrol_new llamp_ctl =;

static const struct snd_kcontrol_new lramp_ctl =;

static const struct snd_soc_dapm_widget mc13783_dapm_widgets[] =;

static struct snd_soc_dapm_route mc13783_routes[] =;

static const char * const mc13783_3d_mixer[] =;

static SOC_ENUM_SINGLE_DECL(mc13783_enum_3d_mixer,
			    MC13783_AUDIO_RX1, 16,
			    mc13783_3d_mixer);

static struct snd_kcontrol_new mc13783_control_list[] =;

static int mc13783_probe(struct snd_soc_component *component)
{}

static void mc13783_remove(struct snd_soc_component *component)
{}

#define MC13783_RATES_RECORD

#define MC13783_FORMATS

static const struct snd_soc_dai_ops mc13783_ops_dac =;

static const struct snd_soc_dai_ops mc13783_ops_codec =;

/*
 * The mc13783 has two SSI ports, both of them can be routed either
 * to the voice codec or the stereo DAC. When two different SSI ports
 * are used for the voice codec and the stereo DAC we can do different
 * formats and sysclock settings for playback and capture
 * (mc13783-hifi-playback and mc13783-hifi-capture). Using the same port
 * forces us to use symmetric rates (mc13783-hifi).
 */
static struct snd_soc_dai_driver mc13783_dai_async[] =;

static const struct snd_soc_dai_ops mc13783_ops_sync =;

static struct snd_soc_dai_driver mc13783_dai_sync[] =;

static const struct snd_soc_component_driver soc_component_dev_mc13783 =;

static int __init mc13783_codec_probe(struct platform_device *pdev)
{}

static struct platform_driver mc13783_codec_driver =;
module_platform_driver_probe();

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