linux/sound/soc/codecs/cs42l56.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * cs42l56.c -- CS42L56 ALSA SoC audio driver
 *
 * Copyright 2014 CirrusLogic, Inc.
 *
 * Author: Brian Austin <[email protected]>
 */

#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/input.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/of.h>
#include <linux/of_gpio.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 <sound/cs42l56.h>
#include "cs42l56.h"

#define CS42L56_NUM_SUPPLIES
static const char *const cs42l56_supply_names[CS42L56_NUM_SUPPLIES] =;

struct  cs42l56_private {};

static const struct reg_default cs42l56_reg_defaults[] =;

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

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

static DECLARE_TLV_DB_SCALE(beep_tlv, -5000, 200, 0);
static DECLARE_TLV_DB_SCALE(hl_tlv, -6000, 50, 0);
static DECLARE_TLV_DB_SCALE(adv_tlv, -10200, 50, 0);
static DECLARE_TLV_DB_SCALE(adc_tlv, -9600, 100, 0);
static DECLARE_TLV_DB_SCALE(tone_tlv, -1050, 150, 0);
static DECLARE_TLV_DB_SCALE(preamp_tlv, 0, 1000, 0);
static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0);

static const DECLARE_TLV_DB_RANGE(ngnb_tlv,
	0, 1, TLV_DB_SCALE_ITEM(-8200, 600, 0),
	2, 5, TLV_DB_SCALE_ITEM(-7600, 300, 0)
);
static const DECLARE_TLV_DB_RANGE(ngb_tlv,
	0, 2, TLV_DB_SCALE_ITEM(-6400, 600, 0),
	3, 7, TLV_DB_SCALE_ITEM(-4600, 300, 0)
);
static const DECLARE_TLV_DB_RANGE(alc_tlv,
	0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0),
	3, 7, TLV_DB_SCALE_ITEM(-1200, 300, 0)
);

static const char * const beep_config_text[] =;

static const struct soc_enum beep_config_enum =;

static const char * const beep_pitch_text[] =;

static const struct soc_enum beep_pitch_enum =;

static const char * const beep_ontime_text[] =;

static const struct soc_enum beep_ontime_enum =;

static const char * const beep_offtime_text[] =;

static const struct soc_enum beep_offtime_enum =;

static const char * const beep_treble_text[] =;

static const struct soc_enum beep_treble_enum =;

static const char * const beep_bass_text[] =;

static const struct soc_enum beep_bass_enum =;

static const char * const pgaa_mux_text[] =;

static const struct soc_enum pgaa_mux_enum =;

static const struct snd_kcontrol_new pgaa_mux =;

static const char * const pgab_mux_text[] =;

static const struct soc_enum pgab_mux_enum =;

static const struct snd_kcontrol_new pgab_mux =;

static const char * const adca_mux_text[] =;

static const struct soc_enum adca_mux_enum =;

static const struct snd_kcontrol_new adca_mux =;

static const char * const adcb_mux_text[] =;

static const struct soc_enum adcb_mux_enum =;

static const struct snd_kcontrol_new adcb_mux =;

static const char * const left_swap_text[] =;

static const char * const right_swap_text[] =;

static const unsigned int swap_values[] =;

static const struct soc_enum adca_swap_enum =;
static const struct snd_kcontrol_new adca_swap_mux =;

static const struct soc_enum pcma_swap_enum =;
static const struct snd_kcontrol_new pcma_swap_mux =;

static const struct soc_enum adcb_swap_enum =;
static const struct snd_kcontrol_new adcb_swap_mux =;

static const struct soc_enum pcmb_swap_enum =;
static const struct snd_kcontrol_new pcmb_swap_mux =;

static const struct snd_kcontrol_new hpa_switch =;

static const struct snd_kcontrol_new hpb_switch =;

static const struct snd_kcontrol_new loa_switch =;

static const struct snd_kcontrol_new lob_switch =;

static const char * const hploa_input_text[] =;

static const struct soc_enum lineouta_input_enum =;

static const struct snd_kcontrol_new lineouta_input =;

static const struct soc_enum hpa_input_enum =;

static const struct snd_kcontrol_new hpa_input =;

static const char * const hplob_input_text[] =;

static const struct soc_enum lineoutb_input_enum =;

static const struct snd_kcontrol_new lineoutb_input =;

static const struct soc_enum hpb_input_enum =;

static const struct snd_kcontrol_new hpb_input =;

static const char * const dig_mux_text[] =;

static const struct soc_enum dig_mux_enum =;

static const struct snd_kcontrol_new dig_mux =;

static const char * const hpf_freq_text[] =;

static const struct soc_enum hpfa_freq_enum =;

static const struct soc_enum hpfb_freq_enum =;

static const char * const ng_delay_text[] =;

static const struct soc_enum ng_delay_enum =;

static const struct snd_kcontrol_new cs42l56_snd_controls[] =;

static const struct snd_soc_dapm_widget cs42l56_dapm_widgets[] =;

static const struct snd_soc_dapm_route cs42l56_audio_map[] =;

struct cs42l56_clk_para {};

static const struct cs42l56_clk_para clk_ratio_table[] =;

static int cs42l56_get_mclk_ratio(int mclk, int rate)
{}

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

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

static int cs42l56_mute(struct snd_soc_dai *dai, int mute, int direction)
{}

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

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

#define CS42L56_RATES

#define CS42L56_FORMATS


static const struct snd_soc_dai_ops cs42l56_ops =;

static struct snd_soc_dai_driver cs42l56_dai =;

static int beep_freq[] =;

static void cs42l56_beep_work(struct work_struct *work)
{}

/* For usability define a way of injecting beep events for the device -
 * many systems will not have a keyboard.
 */
static int cs42l56_beep_event(struct input_dev *dev, unsigned int type,
			     unsigned int code, int hz)
{}

static ssize_t beep_store(struct device *dev, struct device_attribute *attr,
			  const char *buf, size_t count)
{}

static DEVICE_ATTR_WO(beep);

static void cs42l56_init_beep(struct snd_soc_component *component)
{}

static void cs42l56_free_beep(struct snd_soc_component *component)
{}

static int cs42l56_probe(struct snd_soc_component *component)
{}

static void cs42l56_remove(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_dev_cs42l56 =;

static const struct regmap_config cs42l56_regmap =;

static int cs42l56_handle_of_data(struct i2c_client *i2c_client,
				    struct cs42l56_platform_data *pdata)
{}

static int cs42l56_i2c_probe(struct i2c_client *i2c_client)
{}

static void cs42l56_i2c_remove(struct i2c_client *client)
{}

static const struct of_device_id cs42l56_of_match[] =;
MODULE_DEVICE_TABLE(of, cs42l56_of_match);


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

static struct i2c_driver cs42l56_i2c_driver =;

module_i2c_driver();

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