linux/sound/soc/codecs/wm8400.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * wm8400.c  --  WM8400 ALSA Soc Audio driver
 *
 * Copyright 2008-11 Wolfson Microelectronics PLC.
 * Author: Mark Brown <[email protected]>
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/mfd/wm8400-audio.h>
#include <linux/mfd/wm8400-private.h>
#include <linux/mfd/core.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>

#include "wm8400.h"

static struct regulator_bulk_data power[] =;

/* codec private data */
struct wm8400_priv {};

static void wm8400_component_reset(struct snd_soc_component *component)
{}

static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1650, 3000, 0);

static const DECLARE_TLV_DB_SCALE(out_mix_tlv, -2100, 0, 0);

static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -7300, 600, 0);

static const DECLARE_TLV_DB_SCALE(out_dac_tlv, -7163, 0, 0);

static const DECLARE_TLV_DB_SCALE(in_adc_tlv, -7163, 1763, 0);

static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);

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

#define WM8400_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert, tlv_array)


static const char *wm8400_digital_sidetone[] =;

static SOC_ENUM_SINGLE_DECL(wm8400_left_digital_sidetone_enum,
			    WM8400_DIGITAL_SIDE_TONE,
			    WM8400_ADC_TO_DACL_SHIFT,
			    wm8400_digital_sidetone);

static SOC_ENUM_SINGLE_DECL(wm8400_right_digital_sidetone_enum,
			    WM8400_DIGITAL_SIDE_TONE,
			    WM8400_ADC_TO_DACR_SHIFT,
			    wm8400_digital_sidetone);

static const char *wm8400_adcmode[] =;

static SOC_ENUM_SINGLE_DECL(wm8400_right_adcmode_enum,
			    WM8400_ADC_CTRL,
			    WM8400_ADC_HPF_CUT_SHIFT,
			    wm8400_adcmode);

static const struct snd_kcontrol_new wm8400_snd_controls[] =;

/*
 * _DAPM_ Controls
 */

static int outmixer_event (struct snd_soc_dapm_widget *w,
	struct snd_kcontrol * kcontrol, int event)
{}

/* INMIX dB values */
static const DECLARE_TLV_DB_SCALE(in_mix_tlv, -1200, 600, 0);

/* Left In PGA Connections */
static const struct snd_kcontrol_new wm8400_dapm_lin12_pga_controls[] =;

static const struct snd_kcontrol_new wm8400_dapm_lin34_pga_controls[] =;

/* Right In PGA Connections */
static const struct snd_kcontrol_new wm8400_dapm_rin12_pga_controls[] =;

static const struct snd_kcontrol_new wm8400_dapm_rin34_pga_controls[] =;

/* INMIXL */
static const struct snd_kcontrol_new wm8400_dapm_inmixl_controls[] =;

/* INMIXR */
static const struct snd_kcontrol_new wm8400_dapm_inmixr_controls[] =;

/* AINLMUX */
static const char *wm8400_ainlmux[] =;

static SOC_ENUM_SINGLE_DECL(wm8400_ainlmux_enum,
			    WM8400_INPUT_MIXER1,
			    WM8400_AINLMODE_SHIFT,
			    wm8400_ainlmux);

static const struct snd_kcontrol_new wm8400_dapm_ainlmux_controls =;

/* DIFFINL */

/* AINRMUX */
static const char *wm8400_ainrmux[] =;

static SOC_ENUM_SINGLE_DECL(wm8400_ainrmux_enum,
			    WM8400_INPUT_MIXER1,
			    WM8400_AINRMODE_SHIFT,
			    wm8400_ainrmux);

static const struct snd_kcontrol_new wm8400_dapm_ainrmux_controls =;

/* LOMIX */
static const struct snd_kcontrol_new wm8400_dapm_lomix_controls[] =;

/* ROMIX */
static const struct snd_kcontrol_new wm8400_dapm_romix_controls[] =;

/* LONMIX */
static const struct snd_kcontrol_new wm8400_dapm_lonmix_controls[] =;

/* LOPMIX */
static const struct snd_kcontrol_new wm8400_dapm_lopmix_controls[] =;

/* RONMIX */
static const struct snd_kcontrol_new wm8400_dapm_ronmix_controls[] =;

/* ROPMIX */
static const struct snd_kcontrol_new wm8400_dapm_ropmix_controls[] =;

/* OUT3MIX */
static const struct snd_kcontrol_new wm8400_dapm_out3mix_controls[] =;

/* OUT4MIX */
static const struct snd_kcontrol_new wm8400_dapm_out4mix_controls[] =;

/* SPKMIX */
static const struct snd_kcontrol_new wm8400_dapm_spkmix_controls[] =;

static const struct snd_soc_dapm_widget wm8400_dapm_widgets[] =;

static const struct snd_soc_dapm_route wm8400_dapm_routes[] =;

/*
 * Clock after FLL and dividers
 */
static int wm8400_set_dai_sysclk(struct snd_soc_dai *codec_dai,
		int clk_id, unsigned int freq, int dir)
{}

struct fll_factors {};

#define FIXED_FLL_SIZE

static int fll_factors(struct wm8400_priv *wm8400, struct fll_factors *factors,
		       unsigned int Fref, unsigned int Fout)
{}

static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
			      int source, unsigned int freq_in,
			      unsigned int freq_out)
{}

/*
 * Sets ADC and Voice DAC format.
 */
static int wm8400_set_dai_fmt(struct snd_soc_dai *codec_dai,
		unsigned int fmt)
{}

static int wm8400_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
		int div_id, int div)
{}

/*
 * Set PCM DAI bit size and sample rate.
 */
static int wm8400_hw_params(struct snd_pcm_substream *substream,
	struct snd_pcm_hw_params *params,
	struct snd_soc_dai *dai)
{}

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

/* TODO: set bias for best performance at standby */
static int wm8400_set_bias_level(struct snd_soc_component *component,
				 enum snd_soc_bias_level level)
{}

#define WM8400_RATES

#define WM8400_FORMATS

static const struct snd_soc_dai_ops wm8400_dai_ops =;

/*
 * The WM8400 supports 2 different and mutually exclusive DAI
 * configurations.
 *
 * 1. ADC/DAC on Primary Interface
 * 2. ADC on Primary Interface/DAC on secondary
 */
static struct snd_soc_dai_driver wm8400_dai =;

static int wm8400_component_probe(struct snd_soc_component *component)
{}

static void  wm8400_component_remove(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_dev_wm8400 =;

static int wm8400_probe(struct platform_device *pdev)
{}

static struct platform_driver wm8400_codec_driver =;

module_platform_driver();

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