linux/sound/soc/codecs/wm8990.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * wm8990.c  --  WM8990 ALSA Soc Audio driver
 *
 * Copyright 2008 Wolfson Microelectronics PLC.
 * Author: Liam Girdwood <[email protected]>
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/slab.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 <asm/div64.h>

#include "wm8990.h"

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

#define wm8990_reset(c)

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

static const DECLARE_TLV_DB_SCALE(out_mix_tlv, 0, -2100, 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 wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

#define SOC_WM899X_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert,\
	tlv_array)


static const char *wm8990_digital_sidetone[] =;

static SOC_ENUM_SINGLE_DECL(wm8990_left_digital_sidetone_enum,
			    WM8990_DIGITAL_SIDE_TONE,
			    WM8990_ADC_TO_DACL_SHIFT,
			    wm8990_digital_sidetone);

static SOC_ENUM_SINGLE_DECL(wm8990_right_digital_sidetone_enum,
			    WM8990_DIGITAL_SIDE_TONE,
			    WM8990_ADC_TO_DACR_SHIFT,
			    wm8990_digital_sidetone);

static const char *wm8990_adcmode[] =;

static SOC_ENUM_SINGLE_DECL(wm8990_right_adcmode_enum,
			    WM8990_ADC_CTRL,
			    WM8990_ADC_HPF_CUT_SHIFT,
			    wm8990_adcmode);

static const struct snd_kcontrol_new wm8990_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 wm8990_dapm_lin12_pga_controls[] =;

static const struct snd_kcontrol_new wm8990_dapm_lin34_pga_controls[] =;

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

static const struct snd_kcontrol_new wm8990_dapm_rin34_pga_controls[] =;

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

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

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

static SOC_ENUM_SINGLE_DECL(wm8990_ainlmux_enum,
			    WM8990_INPUT_MIXER1, WM8990_AINLMODE_SHIFT,
			    wm8990_ainlmux);

static const struct snd_kcontrol_new wm8990_dapm_ainlmux_controls =;

/* DIFFINL */

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

static SOC_ENUM_SINGLE_DECL(wm8990_ainrmux_enum,
			    WM8990_INPUT_MIXER1, WM8990_AINRMODE_SHIFT,
			    wm8990_ainrmux);

static const struct snd_kcontrol_new wm8990_dapm_ainrmux_controls =;

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

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

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

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

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

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

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

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

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

static const struct snd_soc_dapm_widget wm8990_dapm_widgets[] =;

static const struct snd_soc_dapm_route wm8990_dapm_routes[] =;

/* PLL divisors */
struct _pll_div {};

/* The size in bits of the pll divide multiplied by 10
 * to allow rounding later */
#define FIXED_PLL_SIZE

static void pll_factors(struct _pll_div *pll_div, unsigned int target,
	unsigned int source)
{}

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

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

/*
 * Set's ADC and Voice DAC format.
 */
static int wm8990_set_dai_fmt(struct snd_soc_dai *codec_dai,
		unsigned int fmt)
{}

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

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

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

static int wm8990_set_bias_level(struct snd_soc_component *component,
	enum snd_soc_bias_level level)
{}

#define WM8990_RATES

#define WM8990_FORMATS

/*
 * The WM8990 supports 2 different and mutually exclusive DAI
 * configurations.
 *
 * 1. ADC/DAC on Primary Interface
 * 2. ADC on Primary Interface/DAC on secondary
 */
static const struct snd_soc_dai_ops wm8990_dai_ops =;

static struct snd_soc_dai_driver wm8990_dai =;

/*
 * initialise the WM8990 driver
 * register the mixer and dsp interfaces with the kernel
 */
static int wm8990_probe(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_dev_wm8990 =;

static int wm8990_i2c_probe(struct i2c_client *i2c)
{}

static const struct i2c_device_id wm8990_i2c_id[] =;
MODULE_DEVICE_TABLE(i2c, wm8990_i2c_id);

static struct i2c_driver wm8990_i2c_driver =;

module_i2c_driver();

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