linux/sound/soc/codecs/nau8810.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * nau8810.c  --  NAU8810 ALSA Soc Audio driver
 *
 * Copyright 2016 Nuvoton Technology Corp.
 *
 * Author: David Lin <[email protected]>
 *
 * Based on WM8974.c
 */

#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 "nau8810.h"

#define NAU_PLL_FREQ_MAX
#define NAU_PLL_FREQ_MIN
#define NAU_PLL_REF_MAX
#define NAU_PLL_REF_MIN
#define NAU_PLL_OPTOP_MIN


static const int nau8810_mclk_scaler[] =;

static const struct reg_default nau8810_reg_defaults[] =;

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

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

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

/* The EQ parameters get function is to get the 5 band equalizer control.
 * The regmap raw read can't work here because regmap doesn't provide
 * value format for value width of 9 bits. Therefore, the driver reads data
 * from cache and makes value format according to the endianness of
 * bytes type control element.
 */
static int nau8810_eq_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

/* The EQ parameters put function is to make configuration of 5 band equalizer
 * control. These configuration includes central frequency, equalizer gain,
 * cut-off frequency, bandwidth control, and equalizer path.
 * The regmap raw write can't work here because regmap doesn't provide
 * register and value format for register with address 7 bits and value 9 bits.
 * Therefore, the driver makes value format according to the endianness of
 * bytes type control element and writes data to codec.
 */
static int nau8810_eq_put(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{}

static const char * const nau8810_companding[] =;

static const struct soc_enum nau8810_companding_adc_enum =;

static const struct soc_enum nau8810_companding_dac_enum =;

static const char * const nau8810_deemp[] =;

static const struct soc_enum nau8810_deemp_enum =;

static const char * const nau8810_eqmode[] =;

static const struct soc_enum nau8810_eqmode_enum =;

static const char * const nau8810_alc[] =;

static const struct soc_enum nau8810_alc_enum =;

static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1);
static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1200, 75, 0);
static const DECLARE_TLV_DB_SCALE(spk_tlv, -5700, 100, 0);

static const struct snd_kcontrol_new nau8810_snd_controls[] =;

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

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

/* PGA Mute */
static const struct snd_kcontrol_new nau8810_pgaboost_mixer_controls[] =;

/* Input PGA */
static const struct snd_kcontrol_new nau8810_inpga[] =;

/* Loopback Switch */
static const struct snd_kcontrol_new nau8810_loopback =;

static int check_mclk_select_pll(struct snd_soc_dapm_widget *source,
			 struct snd_soc_dapm_widget *sink)
{}

static int check_mic_enabled(struct snd_soc_dapm_widget *source,
	struct snd_soc_dapm_widget *sink)
{}

static const struct snd_soc_dapm_widget nau8810_dapm_widgets[] =;

static const struct snd_soc_dapm_route nau8810_dapm_routes[] =;

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

static int nau8810_calc_pll(unsigned int pll_in,
	unsigned int fs, struct nau8810_pll *pll_param)
{}

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

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

static int nau8810_mclk_clkdiv(struct nau8810 *nau8810, int rate)
{}

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

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


#define NAU8810_RATES

#define NAU8810_FORMATS

static const struct snd_soc_dai_ops nau8810_ops =;

static struct snd_soc_dai_driver nau8810_dai =;

static const struct regmap_config nau8810_regmap_config =;

static const struct snd_soc_component_driver nau8810_component_driver =;

static int nau8810_i2c_probe(struct i2c_client *i2c)
{}

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

#ifdef CONFIG_OF
static const struct of_device_id nau8810_of_match[] =;
MODULE_DEVICE_TABLE(of, nau8810_of_match);
#endif

static struct i2c_driver nau8810_i2c_driver =;

module_i2c_driver();

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