linux/sound/soc/codecs/wm8985.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * wm8985.c  --  WM8985 / WM8758 ALSA SoC Audio driver
 *
 * Copyright 2010 Wolfson Microelectronics plc
 * Author: Dimitris Papastamos <[email protected]>
 *
 * WM8758 support:
 * Copyright: 2016 Barix AG
 * Author: Petr Kulhavy <[email protected]>
 *
 * TODO:
 *  o Add OUT3/OUT4 mixer controls.
 */

#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/regmap.h>
#include <linux/regulator/consumer.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/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>

#include "wm8985.h"

#define WM8985_NUM_SUPPLIES
static const char *wm8985_supply_names[WM8985_NUM_SUPPLIES] =;

enum wm8985_type {};

static const struct reg_default wm8985_reg_defaults[] =;

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

/*
 * latch bit 8 of these registers to ensure instant
 * volume updates
 */
static const int volume_update_regs[] =;

struct wm8985_priv {};

static const struct {} fs_ratios[] =;

static const int srates[] =;

static const int bclk_divs[] =;

static int eqmode_get(struct snd_kcontrol *kcontrol,
		      struct snd_ctl_elem_value *ucontrol);
static int eqmode_put(struct snd_kcontrol *kcontrol,
		      struct snd_ctl_elem_value *ucontrol);

static const DECLARE_TLV_DB_SCALE(dac_tlv, -12700, 50, 1);
static const DECLARE_TLV_DB_SCALE(adc_tlv, -12700, 50, 1);
static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0);
static const DECLARE_TLV_DB_SCALE(lim_thresh_tlv, -600, 100, 0);
static const DECLARE_TLV_DB_SCALE(lim_boost_tlv, 0, 100, 0);
static const DECLARE_TLV_DB_SCALE(alc_min_tlv, -1200, 600, 0);
static const DECLARE_TLV_DB_SCALE(alc_max_tlv, -675, 600, 0);
static const DECLARE_TLV_DB_SCALE(alc_tar_tlv, -2250, 150, 0);
static const DECLARE_TLV_DB_SCALE(pga_vol_tlv, -1200, 75, 0);
static const DECLARE_TLV_DB_SCALE(boost_tlv, -1200, 300, 1);
static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static const DECLARE_TLV_DB_SCALE(aux_tlv, -1500, 300, 0);
static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0);
static const DECLARE_TLV_DB_SCALE(pga_boost_tlv, 0, 2000, 0);

static const char *alc_sel_text[] =;
static SOC_ENUM_SINGLE_DECL(alc_sel, WM8985_ALC_CONTROL_1, 7, alc_sel_text);

static const char *alc_mode_text[] =;
static SOC_ENUM_SINGLE_DECL(alc_mode, WM8985_ALC_CONTROL_3, 8, alc_mode_text);

static const char *filter_mode_text[] =;
static SOC_ENUM_SINGLE_DECL(filter_mode, WM8985_ADC_CONTROL, 7,
			    filter_mode_text);

static const char *eq_bw_text[] =;
static const char *eqmode_text[] =;
static SOC_ENUM_SINGLE_EXT_DECL(eqmode, eqmode_text);

static const char *eq1_cutoff_text[] =;
static SOC_ENUM_SINGLE_DECL(eq1_cutoff, WM8985_EQ1_LOW_SHELF, 5,
			    eq1_cutoff_text);
static const char *eq2_cutoff_text[] =;
static SOC_ENUM_SINGLE_DECL(eq2_bw, WM8985_EQ2_PEAK_1, 8, eq_bw_text);
static SOC_ENUM_SINGLE_DECL(eq2_cutoff, WM8985_EQ2_PEAK_1, 5, eq2_cutoff_text);
static const char *eq3_cutoff_text[] =;
static SOC_ENUM_SINGLE_DECL(eq3_bw, WM8985_EQ3_PEAK_2, 8, eq_bw_text);
static SOC_ENUM_SINGLE_DECL(eq3_cutoff, WM8985_EQ3_PEAK_2, 5,
			    eq3_cutoff_text);
static const char *eq4_cutoff_text[] =;
static SOC_ENUM_SINGLE_DECL(eq4_bw, WM8985_EQ4_PEAK_3, 8, eq_bw_text);
static SOC_ENUM_SINGLE_DECL(eq4_cutoff, WM8985_EQ4_PEAK_3, 5, eq4_cutoff_text);
static const char *eq5_cutoff_text[] =;
static SOC_ENUM_SINGLE_DECL(eq5_cutoff, WM8985_EQ5_HIGH_SHELF, 5,
				  eq5_cutoff_text);

static const char *speaker_mode_text[] =;
static SOC_ENUM_SINGLE_DECL(speaker_mode, 0x17, 8, speaker_mode_text);

static const char *depth_3d_text[] =;
static SOC_ENUM_SINGLE_DECL(depth_3d, WM8985_3D_CONTROL, 0, depth_3d_text);

static const struct snd_kcontrol_new wm8985_common_snd_controls[] =;

static const struct snd_kcontrol_new wm8985_specific_snd_controls[] =;

static const struct snd_kcontrol_new left_out_mixer[] =;

static const struct snd_kcontrol_new right_out_mixer[] =;

static const struct snd_kcontrol_new left_input_mixer[] =;

static const struct snd_kcontrol_new right_input_mixer[] =;

static const struct snd_kcontrol_new left_boost_mixer[] =;

static const struct snd_kcontrol_new right_boost_mixer[] =;

static const struct snd_soc_dapm_widget wm8985_common_dapm_widgets[] =;

static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] =;

static const struct snd_soc_dapm_widget wm8758_dapm_widgets[] =;

static const struct snd_soc_dapm_route wm8985_common_dapm_routes[] =;
static const struct snd_soc_dapm_route wm8985_aux_dapm_routes[] =;

static int wm8985_add_widgets(struct snd_soc_component *component)
{}

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

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

static int wm8985_reset(struct snd_soc_component *component)
{}

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

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

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

struct pll_div {};

#define FIXED_PLL_SIZE
static int pll_factors(struct pll_div *pll_div, unsigned int target,
		       unsigned int source)
{}

static int wm8985_set_pll(struct snd_soc_dai *dai, int pll_id,
			  int source, unsigned int freq_in,
			  unsigned int freq_out)
{}

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

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

static int wm8985_probe(struct snd_soc_component *component)
{}

static const struct snd_soc_dai_ops wm8985_dai_ops =;

#define WM8985_FORMATS

static struct snd_soc_dai_driver wm8985_dai =;

static const struct snd_soc_component_driver soc_component_dev_wm8985 =;

static const struct regmap_config wm8985_regmap =;

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

static struct spi_driver wm8985_spi_driver =;
#endif

#if IS_ENABLED(CONFIG_I2C)
static const struct i2c_device_id wm8985_i2c_id[];

static int wm8985_i2c_probe(struct i2c_client *i2c)
{}

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

static struct i2c_driver wm8985_i2c_driver =;
#endif

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

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

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