linux/sound/soc/codecs/wm8996.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * wm8996.c - WM8996 audio codec interface
 *
 * Copyright 2011-2 Wolfson Microelectronics PLC.
 * Author: Mark Brown <[email protected]>
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/gcd.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <trace/events/asoc.h>

#include <sound/wm8996.h>
#include "wm8996.h"

#define WM8996_AIFS

#define HPOUT1L
#define HPOUT1R
#define HPOUT2L
#define HPOUT2R

#define WM8996_NUM_SUPPLIES
static const char *wm8996_supply_names[WM8996_NUM_SUPPLIES] =;

struct wm8996_priv {};

/* We can't use the same notifier block for more than one supply and
 * there's no way I can see to get from a callback to the caller
 * except container_of().
 */
#define WM8996_REGULATOR_EVENT(n)

WM8996_REGULATOR_EVENT()
WM8996_REGULATOR_EVENT()
WM8996_REGULATOR_EVENT()

static const struct reg_default wm8996_reg[] =;

static const DECLARE_TLV_DB_SCALE(inpga_tlv, 0, 100, 0);
static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -3600, 150, 0);
static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1);
static const DECLARE_TLV_DB_SCALE(out_digital_tlv, -1200, 150, 0);
static const DECLARE_TLV_DB_SCALE(out_tlv, -900, 75, 0);
static const DECLARE_TLV_DB_SCALE(spk_tlv, -900, 150, 0);
static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static const DECLARE_TLV_DB_SCALE(threedstereo_tlv, -1600, 183, 1);

static const char *sidetone_hpf_text[] =;

static SOC_ENUM_SINGLE_DECL(sidetone_hpf,
			    WM8996_SIDETONE, 7, sidetone_hpf_text);

static const char *hpf_mode_text[] =;

static SOC_ENUM_SINGLE_DECL(dsp1tx_hpf_mode,
			    WM8996_DSP1_TX_FILTERS, 3, hpf_mode_text);

static SOC_ENUM_SINGLE_DECL(dsp2tx_hpf_mode,
			    WM8996_DSP2_TX_FILTERS, 3, hpf_mode_text);

static const char *hpf_cutoff_text[] =;

static SOC_ENUM_SINGLE_DECL(dsp1tx_hpf_cutoff,
			    WM8996_DSP1_TX_FILTERS, 0, hpf_cutoff_text);

static SOC_ENUM_SINGLE_DECL(dsp2tx_hpf_cutoff,
			    WM8996_DSP2_TX_FILTERS, 0, hpf_cutoff_text);

static void wm8996_set_retune_mobile(struct snd_soc_component *component, int block)
{}

/* Icky as hell but saves code duplication */
static int wm8996_get_retune_mobile_block(const char *name)
{}

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

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

static const struct snd_kcontrol_new wm8996_snd_controls[] =;

static const struct snd_kcontrol_new wm8996_eq_controls[] =;

static void wm8996_bg_enable(struct snd_soc_component *component)
{}

static void wm8996_bg_disable(struct snd_soc_component *component)
{}

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

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

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

static void wait_for_dc_servo(struct snd_soc_component *component, u16 mask)
{}

static void wm8996_seq_notifier(struct snd_soc_component *component,
				enum snd_soc_dapm_type event, int subseq)
{}

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

static const char *sidetone_text[] =;

static SOC_ENUM_SINGLE_DECL(left_sidetone_enum,
			    WM8996_SIDETONE, 0, sidetone_text);

static const struct snd_kcontrol_new left_sidetone =;

static SOC_ENUM_SINGLE_DECL(right_sidetone_enum,
			    WM8996_SIDETONE, 1, sidetone_text);

static const struct snd_kcontrol_new right_sidetone =;

static const char *spk_text[] =;

static SOC_ENUM_SINGLE_DECL(spkl_enum,
			    WM8996_LEFT_PDM_SPEAKER, 0, spk_text);

static const struct snd_kcontrol_new spkl_mux =;

static SOC_ENUM_SINGLE_DECL(spkr_enum,
			    WM8996_RIGHT_PDM_SPEAKER, 0, spk_text);

static const struct snd_kcontrol_new spkr_mux =;

static const char *dsp1rx_text[] =;

static SOC_ENUM_SINGLE_DECL(dsp1rx_enum,
			    WM8996_POWER_MANAGEMENT_8, 0, dsp1rx_text);

static const struct snd_kcontrol_new dsp1rx =;

static const char *dsp2rx_text[] =;

static SOC_ENUM_SINGLE_DECL(dsp2rx_enum,
			    WM8996_POWER_MANAGEMENT_8, 4, dsp2rx_text);

static const struct snd_kcontrol_new dsp2rx =;

static const char *aif2tx_text[] =;

static SOC_ENUM_SINGLE_DECL(aif2tx_enum,
			    WM8996_POWER_MANAGEMENT_8, 6, aif2tx_text);

static const struct snd_kcontrol_new aif2tx =;

static const char *inmux_text[] =;

static SOC_ENUM_SINGLE_DECL(in1_enum,
			    WM8996_POWER_MANAGEMENT_7, 0, inmux_text);

static const struct snd_kcontrol_new in1_mux =;

static SOC_ENUM_SINGLE_DECL(in2_enum,
			    WM8996_POWER_MANAGEMENT_7, 4, inmux_text);

static const struct snd_kcontrol_new in2_mux =;

static const struct snd_kcontrol_new dac2r_mix[] =;

static const struct snd_kcontrol_new dac2l_mix[] =;

static const struct snd_kcontrol_new dac1r_mix[] =;

static const struct snd_kcontrol_new dac1l_mix[] =;

static const struct snd_kcontrol_new dsp1txl[] =;

static const struct snd_kcontrol_new dsp1txr[] =;

static const struct snd_kcontrol_new dsp2txl[] =;

static const struct snd_kcontrol_new dsp2txr[] =;


static const struct snd_soc_dapm_widget wm8996_dapm_widgets[] =;

static const struct snd_soc_dapm_route wm8996_dapm_routes[] =;

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

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

static const int bclk_divs[] =;

static void wm8996_update_bclk(struct snd_soc_component *component)
{}

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

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

static const int dsp_divs[] =;

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

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

struct _fll_div {};

static struct {} fll_fratios[] =;

static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
		       unsigned int Fout)
{}

static int wm8996_set_fll(struct snd_soc_component *component, int fll_id, int source,
			  unsigned int Fref, unsigned int Fout)
{}

#ifdef CONFIG_GPIOLIB
static void wm8996_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{}

static int wm8996_gpio_direction_out(struct gpio_chip *chip,
				     unsigned offset, int value)
{}

static int wm8996_gpio_get(struct gpio_chip *chip, unsigned offset)
{}

static int wm8996_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
{}

static const struct gpio_chip wm8996_template_chip =;

static void wm8996_init_gpio(struct wm8996_priv *wm8996)
{}

static void wm8996_free_gpio(struct wm8996_priv *wm8996)
{}
#else
static void wm8996_init_gpio(struct wm8996_priv *wm8996)
{
}

static void wm8996_free_gpio(struct wm8996_priv *wm8996)
{
}
#endif

/**
 * wm8996_detect - Enable default WM8996 jack detection
 * @component: ASoC component
 * @jack: jack pointer
 * @polarity_cb: polarity callback
 *
 * The WM8996 has advanced accessory detection support for headsets.
 * This function provides a default implementation which integrates
 * the majority of this functionality with minimal user configuration.
 *
 * This will detect headset, headphone and short circuit button and
 * will also detect inverted microphone ground connections and update
 * the polarity of the connections.
 */
int wm8996_detect(struct snd_soc_component *component, struct snd_soc_jack *jack,
		  wm8996_polarity_fn polarity_cb)
{}
EXPORT_SYMBOL_GPL();

static void wm8996_hpdet_irq(struct snd_soc_component *component)
{}

static void wm8996_hpdet_start(struct snd_soc_component *component)
{}

static void wm8996_report_headphone(struct snd_soc_component *component)
{}

static void wm8996_micd(struct snd_soc_component *component)
{}

static irqreturn_t wm8996_irq(int irq, void *data)
{}

static irqreturn_t wm8996_edge_irq(int irq, void *data)
{}

static void wm8996_retune_mobile_pdata(struct snd_soc_component *component)
{}

static const struct regmap_config wm8996_regmap =;

static int wm8996_probe(struct snd_soc_component *component)
{}

static void wm8996_remove(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_dev_wm8996 =;

#define WM8996_RATES
#define WM8996_FORMATS

static const struct snd_soc_dai_ops wm8996_dai_ops =;

static struct snd_soc_dai_driver wm8996_dai[] =;

static int wm8996_i2c_probe(struct i2c_client *i2c)
{}

static void wm8996_i2c_remove(struct i2c_client *client)
{}

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

static struct i2c_driver wm8996_i2c_driver =;

module_i2c_driver();

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