linux/sound/soc/codecs/wm9713.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * wm9713.c  --  ALSA Soc WM9713 codec support
 *
 * Copyright 2006-10 Wolfson Microelectronics PLC.
 * Author: Liam Girdwood <[email protected]>
 *
 *  Features:-
 *
 *   o Support for AC97 Codec, Voice DAC and Aux DAC
 *   o Support for DAPM
 */

#include <linux/init.h>
#include <linux/slab.h>
#include <linux/mfd/wm97xx.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/regmap.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/ac97/codec.h>
#include <sound/ac97/compat.h>
#include <sound/initval.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include <sound/soc.h>

#include "wm9713.h"

#define WM9713_VENDOR_ID
#define WM9713_VENDOR_ID_MASK

struct wm9713_priv {};

#define HPL_MIXER
#define HPR_MIXER

static const char *wm9713_mic_mixer[] =;
static const char *wm9713_rec_mux[] =;
static const char *wm9713_rec_src[] =;
static const char *wm9713_rec_gain[] =;
static const char *wm9713_alc_select[] =;
static const char *wm9713_mono_pga[] =;
static const char *wm9713_spk_pga[] =;
static const char *wm9713_hp_pga[] =;
static const char *wm9713_out3_pga[] =;
static const char *wm9713_out4_pga[] =;
static const char *wm9713_dac_inv[] =;
static const char *wm9713_bass[] =;
static const char *wm9713_ng_type[] =;
static const char *wm9713_mic_select[] =;
static const char *wm9713_micb_select[] =;

static const struct soc_enum wm9713_enum[] =;

static const DECLARE_TLV_DB_SCALE(out_tlv, -4650, 150, 0);
static const DECLARE_TLV_DB_SCALE(main_tlv, -3450, 150, 0);
static const DECLARE_TLV_DB_SCALE(misc_tlv, -1500, 300, 0);
static const  DECLARE_TLV_DB_RANGE(mic_tlv,
	0, 2, TLV_DB_SCALE_ITEM(1200, 600, 0),
	3, 3, TLV_DB_SCALE_ITEM(3000, 0, 0)
);

static const struct snd_kcontrol_new wm9713_snd_ac97_controls[] =;

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

static const unsigned int wm9713_mixer_mute_regs[] =;

/* We have to create a fake left and right HP mixers because
 * the codec only has a single control that is shared by both channels.
 * This makes it impossible to determine the audio path using the current
 * register map, thus we add a new (virtual) register to help determine the
 * audio route within the device.
 */
static int wm9713_hp_mixer_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

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

#define WM9713_HP_MIXER_CTRL(xname, xmixer, xshift)

/* Left Headphone Mixers */
static const struct snd_kcontrol_new wm9713_hpl_mixer_controls[] =;

/* Right Headphone Mixers */
static const struct snd_kcontrol_new wm9713_hpr_mixer_controls[] =;

/* headphone capture mux */
static const struct snd_kcontrol_new wm9713_hp_rec_mux_controls =;

/* headphone mic mux */
static const struct snd_kcontrol_new wm9713_hp_mic_mux_controls =;

/* Speaker Mixer */
static const struct snd_kcontrol_new wm9713_speaker_mixer_controls[] =;

/* Mono Mixer */
static const struct snd_kcontrol_new wm9713_mono_mixer_controls[] =;

/* mono mic mux */
static const struct snd_kcontrol_new wm9713_mono_mic_mux_controls =;

/* mono output mux */
static const struct snd_kcontrol_new wm9713_mono_mux_controls =;

/* speaker left output mux */
static const struct snd_kcontrol_new wm9713_hp_spkl_mux_controls =;

/* speaker right output mux */
static const struct snd_kcontrol_new wm9713_hp_spkr_mux_controls =;

/* headphone left output mux */
static const struct snd_kcontrol_new wm9713_hpl_out_mux_controls =;

/* headphone right output mux */
static const struct snd_kcontrol_new wm9713_hpr_out_mux_controls =;

/* Out3 mux */
static const struct snd_kcontrol_new wm9713_out3_mux_controls =;

/* Out4 mux */
static const struct snd_kcontrol_new wm9713_out4_mux_controls =;

/* DAC inv mux 1 */
static const struct snd_kcontrol_new wm9713_dac_inv1_mux_controls =;

/* DAC inv mux 2 */
static const struct snd_kcontrol_new wm9713_dac_inv2_mux_controls =;

/* Capture source left */
static const struct snd_kcontrol_new wm9713_rec_srcl_mux_controls =;

/* Capture source right */
static const struct snd_kcontrol_new wm9713_rec_srcr_mux_controls =;

/* mic source */
static const struct snd_kcontrol_new wm9713_mic_sel_mux_controls =;

/* mic source B virtual control */
static const struct snd_kcontrol_new wm9713_micb_sel_mux_controls =;

static const struct snd_soc_dapm_widget wm9713_dapm_widgets[] =;

static const struct snd_soc_dapm_route wm9713_audio_map[] =;

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

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

static const struct reg_default wm9713_reg_defaults[] =;

static const struct regmap_config wm9713_regmap_config =;

/* 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 snd_soc_component *component,
	struct _pll_div *pll_div, unsigned int source)
{}

/*
 * Please note that changing the PLL input frequency may require
 * resynchronisation with the AC97 controller.
 */
static int wm9713_set_pll(struct snd_soc_component *component,
	int pll_id, unsigned int freq_in, unsigned int freq_out)
{}

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

/*
 * Tristate the PCM DAI lines, tristate can be disabled by calling
 * wm9713_set_dai_fmt()
 */
static int wm9713_set_dai_tristate(struct snd_soc_dai *codec_dai,
	int tristate)
{}

/*
 * Configure WM9713 clock dividers.
 * Voice DAC needs 256 FS
 */
static int wm9713_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
		int div_id, int div)
{}

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

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

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

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

#define WM9713_RATES

#define WM9713_PCM_RATES

#define WM9713_PCM_FORMATS

static const struct snd_soc_dai_ops wm9713_dai_ops_hifi =;

static const struct snd_soc_dai_ops wm9713_dai_ops_aux =;

static const struct snd_soc_dai_ops wm9713_dai_ops_voice =;

static struct snd_soc_dai_driver wm9713_dai[] =;

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

static int wm9713_soc_suspend(struct snd_soc_component *component)
{}

static int wm9713_soc_resume(struct snd_soc_component *component)
{}

static int wm9713_soc_probe(struct snd_soc_component *component)
{}

static void wm9713_soc_remove(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_dev_wm9713 =;

static int wm9713_probe(struct platform_device *pdev)
{}

static struct platform_driver wm9713_codec_driver =;

module_platform_driver();

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