linux/sound/soc/codecs/ak4375.c

// SPDX-License-Identifier: GPL-2.0-or-later

/*
 * Based on code by Hu Jin
 * Copyright (C) 2014 Asahi Kasei Microdevices Corporation
 */

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

/* Registers and fields */
#define AK4375_00_POWER_MANAGEMENT1
#define PMPLL
#define AK4375_01_POWER_MANAGEMENT2
#define PMCP1
#define PMCP2
#define PMLDO1P
#define PMLDO1N
#define PMLDO
#define AK4375_02_POWER_MANAGEMENT3
#define AK4375_03_POWER_MANAGEMENT4
#define AK4375_04_OUTPUT_MODE_SETTING
#define AK4375_05_CLOCK_MODE_SELECT
#define FS_MASK
#define FS_8KHZ
#define FS_11_025KHZ
#define FS_16KHZ
#define FS_22_05KHZ
#define FS_32KHZ
#define FS_44_1KHZ
#define FS_48KHZ
#define FS_88_2KHZ
#define FS_96KHZ
#define FS_176_4KHZ
#define FS_192KHZ
#define CM_MASK
#define CM_0
#define CM_1
#define CM_2
#define CM_3
#define AK4375_06_DIGITAL_FILTER_SELECT
#define DADFSEL
#define DASL
#define DASD
#define AK4375_07_DAC_MONO_MIXING
#define DACMUTE_MASK
#define AK4375_08_JITTER_CLEANER_SETTING1
#define AK4375_09_JITTER_CLEANER_SETTING2
#define AK4375_0A_JITTER_CLEANER_SETTING3
#define SELDAIN
#define XCKSEL
#define XCKCPSEL
#define AK4375_0B_LCH_OUTPUT_VOLUME
#define AK4375_0C_RCH_OUTPUT_VOLUME
#define AK4375_0D_HP_VOLUME_CONTROL
#define AK4375_0E_PLL_CLK_SOURCE_SELECT
#define PLS
#define AK4375_0F_PLL_REF_CLK_DIVIDER1
#define AK4375_10_PLL_REF_CLK_DIVIDER2
#define AK4375_11_PLL_FB_CLK_DIVIDER1
#define AK4375_12_PLL_FB_CLK_DIVIDER2
#define AK4375_13_SRC_CLK_SOURCE
#define SRCCKS
#define DIV
#define AK4375_14_DAC_CLK_DIVIDER
#define AK4375_15_AUDIO_IF_FORMAT
#define DEVICEID_MASK
#define AK4375_24_MODE_CONTROL

#define AK4375_PLL_FREQ_OUT_112896000
#define AK4375_PLL_FREQ_OUT_122880000

#define DEVICEID_AK4375
#define DEVICEID_AK4375A
#define DEVICEID_AK4376A
#define DEVICEID_AK4377
#define DEVICEID_AK4331

static const char * const supply_names[] =;

struct ak4375_drvdata {};

struct ak4375_priv {};

static const struct reg_default ak4375_reg_defaults[] =;

/*
 * Output Digital volume control:
 * from -12.5 to 3 dB in 0.5 dB steps (mute instead of -12.5 dB)
 */
static DECLARE_TLV_DB_SCALE(dac_tlv, -1250, 50, 0);

/*
 * HP-Amp Analog volume control:
 * from -4.2 to 6 dB in 2 dB steps (mute instead of -4.2 dB)
 */
static DECLARE_TLV_DB_SCALE(hpg_tlv, -4200, 20, 0);

static const char * const ak4375_ovolcn_select_texts[]	=;
static const char * const ak4375_mdac_select_texts[]	=;
static const char * const ak4375_cpmode_select_texts[]	=;

/*
 * DASD, DASL bits Digital Filter Setting
 * 0, 0 : Sharp Roll-Off Filter
 * 0, 1 : Slow Roll-Off Filter
 * 1, 0 : Short delay Sharp Roll-Off Filter
 * 1, 1 : Short delay Slow Roll-Off Filter
 */
static const char * const ak4375_digfil_select_texts[] =;

static const struct soc_enum ak4375_ovolcn_enum =;
static const struct soc_enum ak4375_mdacl_enum =;
static const struct soc_enum ak4375_mdacr_enum =;
static const struct soc_enum ak4375_cpmode_enum =;
static const struct soc_enum ak4375_digfil_enum =;

static const struct snd_kcontrol_new ak4375_snd_controls[] =;

static const struct snd_kcontrol_new ak4375_hpl_mixer_controls[] =;

static const struct snd_kcontrol_new ak4375_hpr_mixer_controls[] =;

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

static const struct snd_soc_dapm_widget ak4375_dapm_widgets[] =;

static const struct snd_soc_dapm_route ak4375_intercon[] =;

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

static int ak4375_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source,
			      unsigned int freq_in, unsigned int freq_out)
{}

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

#define AK4375_RATES

#define AK4375_FORMATS

static const struct snd_soc_dai_ops ak4375_dai_ops =;

static struct snd_soc_dai_driver ak4375_dai =;

static void ak4375_power_off(struct ak4375_priv *ak4375)
{}

static int ak4375_power_on(struct ak4375_priv *ak4375)
{}

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

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

static const struct snd_soc_component_driver soc_codec_dev_ak4375 =;

static const struct regmap_config ak4375_regmap =;

static const struct ak4375_drvdata ak4375_drvdata =;

static const struct dev_pm_ops ak4375_pm =;

static int ak4375_i2c_probe(struct i2c_client *i2c)
{}

static void ak4375_i2c_remove(struct i2c_client *i2c)
{}

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

static struct i2c_driver ak4375_i2c_driver =;
module_i2c_driver();

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