linux/sound/soc/codecs/wm8988.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * wm8988.c -- WM8988 ALSA SoC audio driver
 *
 * Copyright 2009 Wolfson Microelectronics plc
 * Copyright 2005 Openedhand Ltd.
 *
 * Author: Mark Brown <[email protected]>
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include <sound/soc.h>
#include <sound/initval.h>

#include "wm8988.h"

/*
 * wm8988 register cache
 * We can't read the WM8988 register space when we
 * are using 2 wire for device control, so we cache them instead.
 */
static const struct reg_default wm8988_reg_defaults[] =;

static bool wm8988_writeable(struct device *dev, unsigned int reg)
{}

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

#define wm8988_reset(c)

/*
 * WM8988 Controls
 */

static const char *bass_boost_txt[] =;
static SOC_ENUM_SINGLE_DECL(bass_boost,
			    WM8988_BASS, 7, bass_boost_txt);

static const char *bass_filter_txt[] =;
static SOC_ENUM_SINGLE_DECL(bass_filter,
			    WM8988_BASS, 6, bass_filter_txt);

static const char *treble_txt[] =;
static SOC_ENUM_SINGLE_DECL(treble,
			    WM8988_TREBLE, 6, treble_txt);

static const char *stereo_3d_lc_txt[] =;
static SOC_ENUM_SINGLE_DECL(stereo_3d_lc,
			    WM8988_3D, 5, stereo_3d_lc_txt);

static const char *stereo_3d_uc_txt[] =;
static SOC_ENUM_SINGLE_DECL(stereo_3d_uc,
			    WM8988_3D, 6, stereo_3d_uc_txt);

static const char *stereo_3d_func_txt[] =;
static SOC_ENUM_SINGLE_DECL(stereo_3d_func,
			    WM8988_3D, 7, stereo_3d_func_txt);

static const char *alc_func_txt[] =;
static SOC_ENUM_SINGLE_DECL(alc_func,
			    WM8988_ALC1, 7, alc_func_txt);

static const char *ng_type_txt[] =;
static SOC_ENUM_SINGLE_DECL(ng_type,
			    WM8988_NGATE, 1, ng_type_txt);

static const char *deemph_txt[] =;
static SOC_ENUM_SINGLE_DECL(deemph,
			    WM8988_ADCDAC, 1, deemph_txt);

static const char *adcpol_txt[] =;
static SOC_ENUM_SINGLE_DECL(adcpol,
			    WM8988_ADCDAC, 5, adcpol_txt);

static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0);
static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0);

static const struct snd_kcontrol_new wm8988_snd_controls[] =;

/*
 * DAPM Controls
 */

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

static const char *wm8988_line_texts[] =;

static const unsigned int wm8988_line_values[] =;

static const struct soc_enum wm8988_lline_enum =;
static const struct snd_kcontrol_new wm8988_left_line_controls =;

static const struct soc_enum wm8988_rline_enum =;
static const struct snd_kcontrol_new wm8988_right_line_controls =;

/* Left Mixer */
static const struct snd_kcontrol_new wm8988_left_mixer_controls[] =;

/* Right Mixer */
static const struct snd_kcontrol_new wm8988_right_mixer_controls[] =;

static const char *wm8988_pga_sel[] =;
static const unsigned int wm8988_pga_val[] =;

/* Left PGA Mux */
static const struct soc_enum wm8988_lpga_enum =;
static const struct snd_kcontrol_new wm8988_left_pga_controls =;

/* Right PGA Mux */
static const struct soc_enum wm8988_rpga_enum =;
static const struct snd_kcontrol_new wm8988_right_pga_controls =;

/* Differential Mux */
static const char *wm8988_diff_sel[] =;
static SOC_ENUM_SINGLE_DECL(diffmux,
			    WM8988_ADCIN, 8, wm8988_diff_sel);
static const struct snd_kcontrol_new wm8988_diffmux_controls =;

/* Mono ADC Mux */
static const char *wm8988_mono_mux[] =;
static SOC_ENUM_SINGLE_DECL(monomux,
			    WM8988_ADCIN, 6, wm8988_mono_mux);
static const struct snd_kcontrol_new wm8988_monomux_controls =;

static const struct snd_soc_dapm_widget wm8988_dapm_widgets[] =;

static const struct snd_soc_dapm_route wm8988_dapm_routes[] =;

struct _coeff_div {};

/* codec hifi mclk clock divider coefficients */
static const struct _coeff_div coeff_div[] =;

static inline int get_coeff(int mclk, int rate)
{}

/* The set of rates we can generate from the above for each SYSCLK */

static const unsigned int rates_12288[] =;

static const struct snd_pcm_hw_constraint_list constraints_12288 =;

static const unsigned int rates_112896[] =;

static const struct snd_pcm_hw_constraint_list constraints_112896 =;

static const unsigned int rates_12[] =;

static const struct snd_pcm_hw_constraint_list constraints_12 =;

/*
 * Note that this should be called from init rather than from hw_params.
 */
static int wm8988_set_dai_sysclk(struct snd_soc_dai *codec_dai,
		int clk_id, unsigned int freq, int dir)
{}

static int wm8988_set_dai_fmt(struct snd_soc_dai *codec_dai,
		unsigned int fmt)
{}

static int wm8988_pcm_startup(struct snd_pcm_substream *substream,
			      struct snd_soc_dai *dai)
{}

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

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

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

#define WM8988_RATES

#define WM8988_FORMATS

static const struct snd_soc_dai_ops wm8988_ops =;

static struct snd_soc_dai_driver wm8988_dai =;

static int wm8988_probe(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_dev_wm8988 =;

static const struct regmap_config wm8988_regmap =;

#if defined(CONFIG_SPI_MASTER)
static int wm8988_spi_probe(struct spi_device *spi)
{}

static struct spi_driver wm8988_spi_driver =;
#endif /* CONFIG_SPI_MASTER */

#if IS_ENABLED(CONFIG_I2C)
static int wm8988_i2c_probe(struct i2c_client *i2c)
{}

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

static struct i2c_driver wm8988_i2c_driver =;
#endif

static int __init wm8988_modinit(void)
{}
module_init();

static void __exit wm8988_exit(void)
{}
module_exit(wm8988_exit);


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