linux/sound/soc/codecs/ak4641.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * ak4641.c  --  AK4641 ALSA Soc Audio driver
 *
 * Copyright (C) 2008 Harald Welte <[email protected]>
 * Copyright (C) 2011 Dmitry Artamonow <[email protected]>
 *
 * Based on ak4535.c by Richard Purdie
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/pm.h>
#include <linux/i2c.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/initval.h>
#include <sound/tlv.h>
#include <sound/ak4641.h>

/* AK4641 register space */
#define AK4641_PM1
#define AK4641_PM2
#define AK4641_SIG1
#define AK4641_SIG2
#define AK4641_MODE1
#define AK4641_MODE2
#define AK4641_DAC
#define AK4641_MIC
#define AK4641_TIMER
#define AK4641_ALC1
#define AK4641_ALC2
#define AK4641_PGA
#define AK4641_LATT
#define AK4641_RATT
#define AK4641_VOL
#define AK4641_STATUS
#define AK4641_EQLO
#define AK4641_EQMID
#define AK4641_EQHI
#define AK4641_BTIF

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

/*
 * ak4641 register cache
 */
static const struct reg_default ak4641_reg_defaults[] =;

static const int deemph_settings[] =;

static int ak4641_set_deemph(struct snd_soc_component *component)
{}

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

static int ak4641_get_deemph(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
	struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component);

	ucontrol->value.integer.value[0] = ak4641->deemph;
	return 0;
};

static const char *ak4641_mono_out[] =;
static const char *ak4641_hp_out[] =;
static const char *ak4641_mic_select[] =;
static const char *ak4641_mic_or_dac[] =;


static const DECLARE_TLV_DB_SCALE(mono_gain_tlv, -1700, 2300, 0);
static const DECLARE_TLV_DB_SCALE(mic_boost_tlv, 0, 2000, 0);
static const DECLARE_TLV_DB_SCALE(eq_tlv, -1050, 150, 0);
static const DECLARE_TLV_DB_SCALE(master_tlv, -12750, 50, 0);
static const DECLARE_TLV_DB_SCALE(mic_stereo_sidetone_tlv, -2700, 300, 0);
static const DECLARE_TLV_DB_SCALE(mic_mono_sidetone_tlv, -400, 400, 0);
static const DECLARE_TLV_DB_SCALE(capture_tlv, -800, 50, 0);
static const DECLARE_TLV_DB_SCALE(alc_tlv, -800, 50, 0);
static const DECLARE_TLV_DB_SCALE(aux_in_tlv, -2100, 300, 0);


static SOC_ENUM_SINGLE_DECL(ak4641_mono_out_enum,
			    AK4641_SIG1, 6, ak4641_mono_out);
static SOC_ENUM_SINGLE_DECL(ak4641_hp_out_enum,
			    AK4641_MODE2, 2, ak4641_hp_out);
static SOC_ENUM_SINGLE_DECL(ak4641_mic_select_enum,
			    AK4641_MIC, 1, ak4641_mic_select);
static SOC_ENUM_SINGLE_DECL(ak4641_mic_or_dac_enum,
			    AK4641_BTIF, 4, ak4641_mic_or_dac);

static const struct snd_kcontrol_new ak4641_snd_controls[] =;

/* Mono 1 Mixer */
static const struct snd_kcontrol_new ak4641_mono1_mixer_controls[] =;

/* Stereo Mixer */
static const struct snd_kcontrol_new ak4641_stereo_mixer_controls[] =;

/* Input Mixer */
static const struct snd_kcontrol_new ak4641_input_mixer_controls[] =;

/* Mic mux */
static const struct snd_kcontrol_new ak4641_mic_mux_control =;

/* Input mux */
static const struct snd_kcontrol_new ak4641_input_mux_control =;

/* mono 2 switch */
static const struct snd_kcontrol_new ak4641_mono2_control =;

/* ak4641 dapm widgets */
static const struct snd_soc_dapm_widget ak4641_dapm_widgets[] =;

static const struct snd_soc_dapm_route ak4641_audio_map[] =;

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

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

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

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

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

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

#define AK4641_RATES
#define AK4641_RATES_BT
#define AK4641_FORMATS

static const struct snd_soc_dai_ops ak4641_i2s_dai_ops =;

static const struct snd_soc_dai_ops ak4641_pcm_dai_ops =;

static struct snd_soc_dai_driver ak4641_dai[] =;

static const struct snd_soc_component_driver soc_component_dev_ak4641 =;

static const struct regmap_config ak4641_regmap =;

static int ak4641_i2c_probe(struct i2c_client *i2c)
{}

static void ak4641_i2c_remove(struct i2c_client *i2c)
{}

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

static struct i2c_driver ak4641_i2c_driver =;

module_i2c_driver();

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