linux/sound/soc/codecs/alc5623.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * alc5623.c  --  alc562[123] ALSA Soc Audio driver
 *
 * Copyright 2008 Realtek Microelectronics
 * Author: flove <[email protected]> Ethan <[email protected]>
 *
 * Copyright 2010 Arnaud Patard <[email protected]>
 *
 * Based on WM8753.c
 */

#include <linux/module.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 <linux/of.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/alc5623.h>

#include "alc5623.h"

static int caps_charge =;
module_param(caps_charge, int, 0);
MODULE_PARM_DESC();

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

static inline int alc5623_reset(struct snd_soc_component *component)
{}

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

/*
 * ALC5623 Controls
 */

static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0);
static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0);
static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0);
static const DECLARE_TLV_DB_RANGE(boost_tlv,
	0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
	1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
	2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0)
);
static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0);

static const struct snd_kcontrol_new alc5621_vol_snd_controls[] =;

static const struct snd_kcontrol_new alc5622_vol_snd_controls[] =;

static const struct snd_kcontrol_new alc5623_vol_snd_controls[] =;

static const struct snd_kcontrol_new alc5623_snd_controls[] =;

/*
 * DAPM Controls
 */
static const struct snd_kcontrol_new alc5623_hp_mixer_controls[] =;

static const struct snd_kcontrol_new alc5623_hpl_mixer_controls[] =;

static const struct snd_kcontrol_new alc5623_hpr_mixer_controls[] =;

static const struct snd_kcontrol_new alc5623_mono_mixer_controls[] =;

static const struct snd_kcontrol_new alc5623_speaker_mixer_controls[] =;

/* Left Record Mixer */
static const struct snd_kcontrol_new alc5623_captureL_mixer_controls[] =;

/* Right Record Mixer */
static const struct snd_kcontrol_new alc5623_captureR_mixer_controls[] =;

static const char *alc5623_spk_n_sour_sel[] =;
static const char *alc5623_hpl_out_input_sel[] =;
static const char *alc5623_hpr_out_input_sel[] =;
static const char *alc5623_spkout_input_sel[] =;
static const char *alc5623_aux_out_input_sel[] =;

/* auxout output mux */
static SOC_ENUM_SINGLE_DECL(alc5623_aux_out_input_enum,
			    ALC5623_OUTPUT_MIXER_CTRL, 6,
			    alc5623_aux_out_input_sel);
static const struct snd_kcontrol_new alc5623_auxout_mux_controls =;

/* speaker output mux */
static SOC_ENUM_SINGLE_DECL(alc5623_spkout_input_enum,
			    ALC5623_OUTPUT_MIXER_CTRL, 10,
			    alc5623_spkout_input_sel);
static const struct snd_kcontrol_new alc5623_spkout_mux_controls =;

/* headphone left output mux */
static SOC_ENUM_SINGLE_DECL(alc5623_hpl_out_input_enum,
			    ALC5623_OUTPUT_MIXER_CTRL, 9,
			    alc5623_hpl_out_input_sel);
static const struct snd_kcontrol_new alc5623_hpl_out_mux_controls =;

/* headphone right output mux */
static SOC_ENUM_SINGLE_DECL(alc5623_hpr_out_input_enum,
			    ALC5623_OUTPUT_MIXER_CTRL, 8,
			    alc5623_hpr_out_input_sel);
static const struct snd_kcontrol_new alc5623_hpr_out_mux_controls =;

/* speaker output N select */
static SOC_ENUM_SINGLE_DECL(alc5623_spk_n_sour_enum,
			    ALC5623_OUTPUT_MIXER_CTRL, 14,
			    alc5623_spk_n_sour_sel);
static const struct snd_kcontrol_new alc5623_spkoutn_mux_controls =;

static const struct snd_soc_dapm_widget alc5623_dapm_widgets[] =;

static const char *alc5623_amp_names[] =;
static SOC_ENUM_SINGLE_DECL(alc5623_amp_enum,
			    ALC5623_OUTPUT_MIXER_CTRL, 13,
			    alc5623_amp_names);
static const struct snd_kcontrol_new alc5623_amp_mux_controls =;

static const struct snd_soc_dapm_widget alc5623_dapm_amp_widgets[] =;

static const struct snd_soc_dapm_route intercon[] =;

static const struct snd_soc_dapm_route intercon_spk[] =;

static const struct snd_soc_dapm_route intercon_amp_spk[] =;

/* PLL divisors */
struct _pll_div {};

/* Note : pll code from original alc5623 driver. Not sure of how good it is */
/* useful only for master mode */
static const struct _pll_div codec_master_pll_div[] =;

static const struct _pll_div codec_slave_pll_div[] =;

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

struct _coeff_div {};

/* codec hifi mclk (after PLL) clock divider coefficients */
/* values inspired from column BCLK=32Fs of Appendix A table */
static const struct _coeff_div coeff_div[] =;

static int get_coeff(struct snd_soc_component *component, int rate)
{}

/*
 * Clock after PLL and dividers
 */
static int alc5623_set_dai_sysclk(struct snd_soc_dai *codec_dai,
		int clk_id, unsigned int freq, int dir)
{}

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

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

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

#define ALC5623_ADD2_POWER_EN

#define ALC5623_ADD3_POWER_EN

#define ALC5623_ADD1_POWER_EN

#define ALC5623_ADD1_POWER_EN_5622

static void enable_power_depop(struct snd_soc_component *component)
{}

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

#define ALC5623_FORMATS

static const struct snd_soc_dai_ops alc5623_dai_ops =;

static struct snd_soc_dai_driver alc5623_dai =;

static int alc5623_suspend(struct snd_soc_component *component)
{}

static int alc5623_resume(struct snd_soc_component *component)
{}

static int alc5623_probe(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_device_alc5623 =;

static const struct regmap_config alc5623_regmap =;

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

/*
 * ALC5623 2 wire address is determined by A1 pin
 * state during powerup.
 *    low  = 0x1a
 *    high = 0x1b
 */
static int alc5623_i2c_probe(struct i2c_client *client)
{}

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

/*  i2c codec control layer */
static struct i2c_driver alc5623_i2c_driver =;

module_i2c_driver();

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