linux/sound/soc/codecs/cs43130.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * cs43130.c  --  CS43130 ALSA Soc Audio driver
 *
 * Copyright 2017 Cirrus Logic, Inc.
 *
 * Authors: Li Xu <[email protected]>
 */
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/property.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/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <linux/regulator/consumer.h>
#include <linux/pm_runtime.h>
#include <linux/completion.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <sound/jack.h>

#include "cs43130.h"
#include "cirrus_legacy.h"

static const struct reg_default cs43130_reg_defaults[] =;

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

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

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

struct cs43130_pll_params {};

static const struct cs43130_pll_params pll_ratio_table[] =;

static const struct cs43130_pll_params *cs43130_get_pll_table(
		unsigned int freq_in, unsigned int freq_out)
{}

static int cs43130_pll_config(struct snd_soc_component *component)
{}

static int cs43130_set_pll(struct snd_soc_component *component, int pll_id, int source,
			   unsigned int freq_in, unsigned int freq_out)
{}

static int cs43130_wait_for_completion(struct cs43130_private *cs43130, struct completion *to_poll,
					int time)
{}

static int cs43130_change_clksrc(struct snd_soc_component *component,
				 enum cs43130_mclk_src_sel src)
{}

static const struct cs43130_bitwidth_map cs43130_bitwidth_table[] =;

static const struct cs43130_bitwidth_map *cs43130_get_bitwidth_table(
				unsigned int bitwidth)
{}

static int cs43130_set_bitwidth(int dai_id, unsigned int bitwidth_dai,
			  struct regmap *regmap)
{}

static const struct cs43130_rate_map cs43130_rate_table[] =;

static const struct cs43130_rate_map *cs43130_get_rate_table(int fs)
{}

static const struct cs43130_clk_gen *cs43130_get_clk_gen(int mclk_int, int fs,
		const struct cs43130_clk_gen *clk_gen_table, int len_clk_gen_table)
{}

static int cs43130_set_sp_fmt(int dai_id, unsigned int bitwidth_sclk,
			      struct snd_pcm_hw_params *params,
			      struct cs43130_private *cs43130)
{}

static int cs43130_pcm_dsd_mix(bool en, struct regmap *regmap)
{}

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

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

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

static const DECLARE_TLV_DB_SCALE(pcm_vol_tlv, -12750, 50, 1);

static const char * const pcm_ch_text[] =;

static const struct reg_sequence pcm_ch_en_seq[] =;

static const struct reg_sequence pcm_ch_dis_seq[] =;

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

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

static SOC_ENUM_SINGLE_DECL(pcm_ch_enum, CS43130_PCM_PATH_CTL_2, 0,
			    pcm_ch_text);

static const char * const pcm_spd_texts[] =;

static SOC_ENUM_SINGLE_DECL(pcm_spd_enum, CS43130_PCM_FILT_OPT, 7,
			    pcm_spd_texts);

static const char * const dsd_texts[] =;

static const unsigned int dsd_values[] =;

static SOC_VALUE_ENUM_SINGLE_DECL(dsd_enum, CS43130_DSD_INT_CFG, 0, 0x03,
				  dsd_texts, dsd_values);

static const struct snd_kcontrol_new cs43130_snd_controls[] =;

static const struct reg_sequence pcm_seq[] =;

static const struct reg_sequence dsd_seq[] =;

static const struct reg_sequence pop_free_seq[] =;

static const struct reg_sequence pop_free_seq2[] =;

static const struct reg_sequence mute_seq[] =;

static const struct reg_sequence unmute_seq[] =;

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

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

static const struct reg_sequence dac_postpmu_seq[] =;

static const struct reg_sequence dac_postpmd_seq[] =;

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

static const struct reg_sequence hpin_prepmd_seq[] =;

static const struct reg_sequence hpin_postpmu_seq[] =;

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

static const char * const bypass_mux_text[] =;
static SOC_ENUM_SINGLE_DECL(bypass_enum, SND_SOC_NOPM, 0, bypass_mux_text);
static const struct snd_kcontrol_new bypass_ctrl =;

static const struct snd_soc_dapm_widget digital_hp_widgets[] =;

static const struct snd_soc_dapm_widget analog_hp_widgets[] =;

static struct snd_soc_dapm_widget all_hp_widgets[
			ARRAY_SIZE(digital_hp_widgets) +
			ARRAY_SIZE(analog_hp_widgets)];

static const struct snd_soc_dapm_route digital_hp_routes[] =;

static const struct snd_soc_dapm_route analog_hp_routes[] =;

static struct snd_soc_dapm_route all_hp_routes[
			ARRAY_SIZE(digital_hp_routes) +
			ARRAY_SIZE(analog_hp_routes)];

static const unsigned int cs43130_asp_src_rates[] =;

static const struct snd_pcm_hw_constraint_list cs43130_asp_constraints =;

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

static const unsigned int cs43130_dop_src_rates[] =;

static const struct snd_pcm_hw_constraint_list cs43130_dop_constraints =;

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

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

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

static int cs43130_set_sysclk(struct snd_soc_dai *codec_dai,
				  int clk_id, unsigned int freq, int dir)
{}

static const struct snd_soc_dai_ops cs43130_pcm_ops =;

static const struct snd_soc_dai_ops cs43130_dop_ops =;

static const struct snd_soc_dai_ops cs43130_dsd_ops =;

static struct snd_soc_dai_driver cs43130_dai[] =;

static int cs43130_component_set_sysclk(struct snd_soc_component *component,
				    int clk_id, int source, unsigned int freq,
				    int dir)
{}

static inline u16 cs43130_get_ac_reg_val(u16 ac_freq)
{}

static int cs43130_show_dc(struct device *dev, char *buf, u8 ch)
{}

static ssize_t hpload_dc_l_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t hpload_dc_r_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static const u16 cs43130_ac_freq[CS43130_AC_FREQ] =;

static int cs43130_show_ac(struct device *dev, char *buf, u8 ch)
{}

static ssize_t hpload_ac_l_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t hpload_ac_r_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR_RO(hpload_dc_l);
static DEVICE_ATTR_RO(hpload_dc_r);
static DEVICE_ATTR_RO(hpload_ac_l);
static DEVICE_ATTR_RO(hpload_ac_r);

static struct attribute *hpload_attrs[] =;
ATTRIBUTE_GROUPS();

static struct reg_sequence hp_en_cal_seq[] =;

static struct reg_sequence hp_en_cal_seq2[] =;

static struct reg_sequence hp_dis_cal_seq[] =;

static struct reg_sequence hp_dis_cal_seq2[] =;

static struct reg_sequence hp_dc_ch_l_seq[] =;

static struct reg_sequence hp_dc_ch_l_seq2[] =;

static struct reg_sequence hp_dc_ch_r_seq[] =;

static struct reg_sequence hp_dc_ch_r_seq2[] =;

static struct reg_sequence hp_ac_ch_l_seq[] =;

static struct reg_sequence hp_ac_ch_l_seq2[] =;

static struct reg_sequence hp_ac_ch_r_seq[] =;

static struct reg_sequence hp_ac_ch_r_seq2[] =;

static struct reg_sequence hp_cln_seq[] =;

struct reg_sequences {};

static struct reg_sequences hpload_seq1[] =;

static struct reg_sequences hpload_seq2[] =;

static int cs43130_update_hpload(unsigned int msk, int ac_idx,
				 struct cs43130_private *cs43130)
{}

static int cs43130_hpload_proc(struct cs43130_private *cs43130,
			       struct reg_sequence *seq, int seq_size,
			       unsigned int rslt_msk, int ac_idx)
{}

static const struct reg_sequence hv_seq[][2] =;

static int cs43130_set_hv(struct regmap *regmap, u16 hpload_dc,
			  const u16 *dc_threshold)
{}

static void cs43130_imp_meas(struct work_struct *wk)
{}

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

static int cs43130_probe(struct snd_soc_component *component)
{}

static struct snd_soc_component_driver soc_component_dev_cs43130 =;

static const struct regmap_config cs43130_regmap =;

static const u16 cs43130_dc_threshold[CS43130_DC_THRESHOLD] =;

static int cs43130_handle_device_data(struct cs43130_private *cs43130)
{}

static int cs43130_i2c_probe(struct i2c_client *client)
{}

static void cs43130_i2c_remove(struct i2c_client *client)
{}

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

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

static const struct dev_pm_ops cs43130_runtime_pm =;

#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id cs43130_of_match[] =;

MODULE_DEVICE_TABLE(of, cs43130_of_match);
#endif

#if IS_ENABLED(CONFIG_ACPI)
static const struct acpi_device_id cs43130_acpi_match[] =;

MODULE_DEVICE_TABLE(acpi, cs43130_acpi_match);
#endif


static const struct i2c_device_id cs43130_i2c_id[] =;

MODULE_DEVICE_TABLE(i2c, cs43130_i2c_id);

static struct i2c_driver cs43130_i2c_driver =;

module_i2c_driver();

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