linux/sound/soc/codecs/cx2072x.c

// SPDX-License-Identifier: GPL-2.0
//
// ALSA SoC CX20721/CX20723 codec driver
//
// Copyright:	(C) 2017 Conexant Systems, Inc.
// Author:	Simon Ho, <[email protected]>
//
// TODO: add support for TDM mode.
//

#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include "cx2072x.h"

#define PLL_OUT_HZ_48
#define BITS_PER_SLOT

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

/*
 * DAC/ADC Volume
 *
 * max : 74 : 0 dB
 *	 ( in 1 dB  step )
 * min : 0 : -74 dB
 */
static const DECLARE_TLV_DB_SCALE(adc_tlv, -7400, 100, 0);
static const DECLARE_TLV_DB_SCALE(dac_tlv, -7400, 100, 0);
static const DECLARE_TLV_DB_SCALE(boost_tlv, 0, 1200, 0);

static const DECLARE_TLV_DB_RANGE(hpf_tlv,
	0, 0, TLV_DB_SCALE_ITEM(120, 0, 0),
	1, 63, TLV_DB_SCALE_ITEM(30, 30, 0)
);

/* Lookup table for PRE_DIV */
static const struct {} mclk_pre_div[] =;

/*
 * cx2072x register cache.
 */
static const struct reg_default cx2072x_reg_defaults[] =;

/*
 * register initialization
 */
static const struct reg_sequence cx2072x_reg_init[] =;

static unsigned int cx2072x_register_size(unsigned int reg)
{}

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

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

static int cx2072x_reg_raw_write(struct i2c_client *client,
				 unsigned int reg,
				 const void *val, size_t val_count)
{}

static int cx2072x_reg_write(void *context, unsigned int reg,
			     unsigned int value)
{}

static int cx2072x_reg_read(void *context, unsigned int reg,
			    unsigned int *value)
{}

/* get suggested pre_div valuce from mclk frequency */
static unsigned int get_div_from_mclk(unsigned int mclk)
{}

static int cx2072x_config_pll(struct cx2072x_priv *cx2072x)
{}

static int cx2072x_config_i2spcm(struct cx2072x_priv *cx2072x)
{}

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

static const struct snd_kcontrol_new cx2072x_snd_controls[] =;

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

static int cx2072x_set_dai_bclk_ratio(struct snd_soc_dai *dai,
				      unsigned int ratio)
{}

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

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

static const struct snd_kcontrol_new portaouten_ctl =;

static const struct snd_kcontrol_new porteouten_ctl =;

static const struct snd_kcontrol_new portgouten_ctl =;

static const struct snd_kcontrol_new portmouten_ctl =;

static const struct snd_kcontrol_new portbinen_ctl =;

static const struct snd_kcontrol_new portcinen_ctl =;

static const struct snd_kcontrol_new portdinen_ctl =;

static const struct snd_kcontrol_new porteinen_ctl =;

static const struct snd_kcontrol_new i2sadc1l_ctl =;

static const struct snd_kcontrol_new i2sadc1r_ctl =;

static const struct snd_kcontrol_new i2sadc2l_ctl =;

static const struct snd_kcontrol_new i2sadc2r_ctl =;

static const struct snd_kcontrol_new i2sdac1l_ctl =;

static const struct snd_kcontrol_new i2sdac1r_ctl =;

static const struct snd_kcontrol_new i2sdac2l_ctl =;

static const struct snd_kcontrol_new i2sdac2r_ctl =;

static const char * const dac_enum_text[] =;

static const struct soc_enum porta_dac_enum =;

static const struct snd_kcontrol_new porta_mux =;

static const struct soc_enum portg_dac_enum =;

static const struct snd_kcontrol_new portg_mux =;

static const struct soc_enum porte_dac_enum =;

static const struct snd_kcontrol_new porte_mux =;

static const struct soc_enum portm_dac_enum =;

static const struct snd_kcontrol_new portm_mux =;

static const char * const adc1in_sel_text[] =;

static const struct soc_enum adc1in_sel_enum =;

static const struct snd_kcontrol_new adc1_mux =;

static const char * const adc2in_sel_text[] =;

static const struct soc_enum adc2in_sel_enum =;

static const struct snd_kcontrol_new adc2_mux =;

static const struct snd_kcontrol_new wid15_mix[] =;

#define CX2072X_DAPM_SUPPLY_S(wname, wsubseq, wreg, wshift, wmask,  won_val, \
	woff_val, wevent, wflags)

#define CX2072X_DAPM_SWITCH(wname,  wreg, wshift, wmask,  won_val, woff_val, \
	wevent, wflags)

#define CX2072X_DAPM_SWITCH(wname,  wreg, wshift, wmask,  won_val, woff_val, \
	wevent, wflags)

#define CX2072X_DAPM_REG_E(wid, wname, wreg, wshift, wmask, won_val, woff_val, \
				wevent, wflags)

static const struct snd_soc_dapm_widget cx2072x_dapm_widgets[] =;

static const struct snd_soc_dapm_route cx2072x_intercon[] =;

static int cx2072x_set_bias_level(struct snd_soc_component *codec,
				  enum snd_soc_bias_level level)
{}

/*
 * FIXME: the whole jack detection code below is pretty platform-specific;
 * it has lots of implicit assumptions about the pins, etc.
 * However, since we have no other code and reference, take this hard-coded
 * setup for now.  Once when we have different platform implementations,
 * this needs to be rewritten in a more generic form, or moving into the
 * platform data.
 */
static void cx2072x_enable_jack_detect(struct snd_soc_component *codec)
{}

static void cx2072x_disable_jack_detect(struct snd_soc_component *codec)
{}

static int cx2072x_jack_status_check(void *data)
{}

static const struct snd_soc_jack_gpio cx2072x_jack_gpio =;

static int cx2072x_set_jack(struct snd_soc_component *codec,
			    struct snd_soc_jack *jack, void *data)
{}

static int cx2072x_probe(struct snd_soc_component *codec)
{}

static const struct snd_soc_component_driver soc_codec_driver_cx2072x =;

/*
 * DAI ops
 */
static const struct snd_soc_dai_ops cx2072x_dai_ops =;

static int cx2072x_dsp_dai_probe(struct snd_soc_dai *dai)
{}

static const struct snd_soc_dai_ops cx2072x_dai_ops2 =;

#define CX2072X_FORMATS

static struct snd_soc_dai_driver soc_codec_cx2072x_dai[] =;

static const struct regmap_config cx2072x_regmap =;

static int __maybe_unused cx2072x_runtime_suspend(struct device *dev)
{}

static int __maybe_unused cx2072x_runtime_resume(struct device *dev)
{}

static int cx2072x_i2c_probe(struct i2c_client *i2c)
{}

static void cx2072x_i2c_remove(struct i2c_client *i2c)
{}

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

#ifdef CONFIG_ACPI
static struct acpi_device_id cx2072x_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, cx2072x_acpi_match);
#endif

static const struct dev_pm_ops cx2072x_runtime_pm =;

static struct i2c_driver cx2072x_i2c_driver =;

module_i2c_driver();

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