linux/sound/soc/codecs/cs53l30.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * cs53l30.c  --  CS53l30 ALSA Soc Audio driver
 *
 * Copyright 2015 Cirrus Logic, Inc.
 *
 * Authors: Paul Handrigan <[email protected]>,
 *          Tim Howe <[email protected]>
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/gpio/consumer.h>
#include <linux/regulator/consumer.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>

#include "cs53l30.h"
#include "cirrus_legacy.h"

#define CS53L30_NUM_SUPPLIES
static const char *const cs53l30_supply_names[CS53L30_NUM_SUPPLIES] =;

struct cs53l30_private {};

static const struct reg_default cs53l30_reg_defaults[] =;

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

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

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

static DECLARE_TLV_DB_SCALE(adc_boost_tlv, 0, 2000, 0);
static DECLARE_TLV_DB_SCALE(adc_ng_boost_tlv, 0, 3000, 0);
static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0);
static DECLARE_TLV_DB_SCALE(dig_tlv, -9600, 100, 1);
static DECLARE_TLV_DB_SCALE(pga_preamp_tlv, 0, 10000, 0);

static const char * const input1_sel_text[] =;

static unsigned int const input1_sel_values[] =;

static const char * const input2_sel_text[] =;

static unsigned int const input2_sel_values[] =;

static const char * const input1_route_sel_text[] =;

static const struct soc_enum input1_route_sel_enum =;

static SOC_VALUE_ENUM_SINGLE_DECL(input1_sel_enum, CS53L30_ADCDMIC1_CTL1, 0,
				  CS53L30_ADCDMICx_PDN_MASK, input1_sel_text,
				  input1_sel_values);

static const struct snd_kcontrol_new input1_route_sel_mux =;

static const char * const input2_route_sel_text[] =;

/* Note: CS53L30_ADCDMIC1_CTL1 CH_TYPE controls inputs 1 and 2 */
static const struct soc_enum input2_route_sel_enum =;

static SOC_VALUE_ENUM_SINGLE_DECL(input2_sel_enum, CS53L30_ADCDMIC2_CTL1, 0,
				  CS53L30_ADCDMICx_PDN_MASK, input2_sel_text,
				  input2_sel_values);

static const struct snd_kcontrol_new input2_route_sel_mux =;

/*
 * TB = 6144*(MCLK(int) scaling factor)/MCLK(internal)
 * TB - Time base
 * NOTE: If MCLK_INT_SCALE = 0, then TB=1
 */
static const char * const cs53l30_ng_delay_text[] =;

static const struct soc_enum adc1_ng_delay_enum =;

static const struct soc_enum adc2_ng_delay_enum =;

/* The noise gate threshold selected will depend on NG Boost */
static const char * const cs53l30_ng_thres_text[] =;

static const struct soc_enum adc1_ng_thres_enum =;

static const struct soc_enum adc2_ng_thres_enum =;

/* Corner frequencies are with an Fs of 48kHz. */
static const char * const hpf_corner_freq_text[] =;

static const struct soc_enum adc1_hpf_enum =;

static const struct soc_enum adc2_hpf_enum =;

static const struct snd_kcontrol_new cs53l30_snd_controls[] =;

static const struct snd_soc_dapm_widget cs53l30_dapm_widgets[] =;

static const struct snd_soc_dapm_route cs53l30_dapm_routes[] =;

static const struct snd_soc_dapm_route cs53l30_dapm_routes_sdout1[] =;

static const struct snd_soc_dapm_route cs53l30_dapm_routes_sdout2[] =;

struct cs53l30_mclk_div {};

static const struct cs53l30_mclk_div cs53l30_mclk_coeffs[] =;

struct cs53l30_mclkx_div {};

static const struct cs53l30_mclkx_div cs53l30_mclkx_coeffs[] =;

static int cs53l30_get_mclkx_coeff(int mclkx)
{}

static int cs53l30_get_mclk_coeff(int mclk_rate, int srate)
{}

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

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

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

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

static int cs53l30_set_tristate(struct snd_soc_dai *dai, int tristate)
{}

static unsigned int const cs53l30_src_rates[] =;

static const struct snd_pcm_hw_constraint_list src_constraints =;

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

/*
 * Note: CS53L30 counts the slot number per byte while ASoC counts the slot
 * number per slot_width. So there is a difference between the slots of ASoC
 * and the slots of CS53L30.
 */
static int cs53l30_set_dai_tdm_slot(struct snd_soc_dai *dai,
				    unsigned int tx_mask, unsigned int rx_mask,
				    int slots, int slot_width)
{}

static int cs53l30_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{}

/* SNDRV_PCM_RATE_KNOT -> 12000, 24000 Hz, limit with constraint list */
#define CS53L30_RATES

#define CS53L30_FORMATS

static const struct snd_soc_dai_ops cs53l30_ops =;

static struct snd_soc_dai_driver cs53l30_dai =;

static int cs53l30_component_probe(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver cs53l30_driver =;

static const struct regmap_config cs53l30_regmap =;

static int cs53l30_i2c_probe(struct i2c_client *client)
{}

static void cs53l30_i2c_remove(struct i2c_client *client)
{}

#ifdef CONFIG_PM
static int cs53l30_runtime_suspend(struct device *dev)
{}

static int cs53l30_runtime_resume(struct device *dev)
{}
#endif

static const struct dev_pm_ops cs53l30_runtime_pm =;

static const struct of_device_id cs53l30_of_match[] =;

MODULE_DEVICE_TABLE(of, cs53l30_of_match);

static const struct i2c_device_id cs53l30_id[] =;

MODULE_DEVICE_TABLE(i2c, cs53l30_id);

static struct i2c_driver cs53l30_i2c_driver =;

module_i2c_driver();

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