linux/sound/soc/codecs/ak4642.c

// SPDX-License-Identifier: GPL-2.0
//
// ak4642.c  --  AK4642/AK4643 ALSA Soc Audio driver
//
// Copyright (C) 2009 Renesas Solutions Corp.
// Kuninori Morimoto <[email protected]>
//
// Based on wm8731.c by Richard Purdie
// Based on ak4535.c by Richard Purdie
// Based on wm8753.c by Liam Girdwood

/* ** CAUTION **
 *
 * This is very simple driver.
 * It can use headphone output / stereo input only
 *
 * AK4642 is tested.
 * AK4643 is tested.
 * AK4648 is tested.
 */

#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>

#define PW_MGMT1
#define PW_MGMT2
#define SG_SL1
#define SG_SL2
#define MD_CTL1
#define MD_CTL2
#define TIMER
#define ALC_CTL1
#define ALC_CTL2
#define L_IVC
#define L_DVC
#define ALC_CTL3
#define R_IVC
#define R_DVC
#define MD_CTL3
#define MD_CTL4
#define PW_MGMT3
#define DF_S
#define FIL3_0
#define FIL3_1
#define FIL3_2
#define FIL3_3
#define EQ_0
#define EQ_1
#define EQ_2
#define EQ_3
#define EQ_4
#define EQ_5
#define FIL1_0
#define FIL1_1
#define FIL1_2
#define FIL1_3
#define PW_MGMT4
#define MD_CTL5
#define LO_MS
#define HP_MS
#define SPK_MS
#define EQ_FBEQAB
#define EQ_FBEQCD
#define EQ_FBEQE

/* PW_MGMT1*/
#define PMVCM
#define PMMIN
#define PMDAC
#define PMADL

/* PW_MGMT2 */
#define HPMTN
#define PMHPL
#define PMHPR
#define MS
#define MCKO
#define PMPLL

#define PMHP_MASK
#define PMHP

/* PW_MGMT3 */
#define PMADR

/* SG_SL1 */
#define MINS
#define DACL
#define PMMP
#define MGAIN0

/* SG_SL2 */
#define LOPS

/* TIMER */
#define ZTM(param)
#define WTM(param)

/* ALC_CTL1 */
#define ALC
#define LMTH0

/* MD_CTL1 */
#define PLL3
#define PLL2
#define PLL1
#define PLL0
#define PLL_MASK

#define BCKO_MASK
#define BCKO_64

#define DIF_MASK
#define DSP
#define RIGHT_J
#define LEFT_J
#define I2S

/* MD_CTL2 */
#define FSs(val)
#define PSs(val)

/* MD_CTL3 */
#define BST1

/* MD_CTL4 */
#define DACH

struct ak4642_drvdata {};

struct ak4642_priv {};

/*
 * Playback Volume (table 39)
 *
 * max : 0x00 : +12.0 dB
 *       ( 0.5 dB step )
 * min : 0xFE : -115.0 dB
 * mute: 0xFF
 */
static const DECLARE_TLV_DB_SCALE(out_tlv, -11550, 50, 1);

static const struct snd_kcontrol_new ak4642_snd_controls[] =;

static const struct snd_kcontrol_new ak4642_headphone_control =;

static const struct snd_kcontrol_new ak4642_lout_mixer_controls[] =;

/* event handlers */
static int ak4642_lout_event(struct snd_soc_dapm_widget *w,
			     struct snd_kcontrol *kcontrol, int event)
{}

static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] =;

static const struct snd_soc_dapm_route ak4642_intercon[] =;

/*
 * ak4642 register cache
 */
static const struct reg_default ak4643_reg[] =;

/* The default settings for 0x0 ~ 0x1f registers are the same for ak4642
   and ak4643. So we reuse the ak4643 reg_default for ak4642.
   The valid registers for ak4642 are 0x0 ~ 0x1f which is a subset of ak4643,
   so define NUM_AK4642_REG_DEFAULTS for ak4642.
*/
#define ak4642_reg
#define NUM_AK4642_REG_DEFAULTS

static const struct reg_default ak4648_reg[] =;

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

static void ak4642_dai_shutdown(struct snd_pcm_substream *substream,
			       struct snd_soc_dai *dai)
{}

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

static int ak4642_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{}

static int ak4642_set_mcko(struct snd_soc_component *component,
			   u32 frequency)
{}

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

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

static const struct snd_soc_dai_ops ak4642_dai_ops =;

static struct snd_soc_dai_driver ak4642_dai =;

static int ak4642_suspend(struct snd_soc_component *component)
{}

static int ak4642_resume(struct snd_soc_component *component)
{}
static int ak4642_probe(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_dev_ak4642 =;

static const struct regmap_config ak4642_regmap =;

static const struct regmap_config ak4643_regmap =;

static const struct regmap_config ak4648_regmap =;

static const struct ak4642_drvdata ak4642_drvdata =;

static const struct ak4642_drvdata ak4643_drvdata =;

static const struct ak4642_drvdata ak4648_drvdata =;

#ifdef CONFIG_COMMON_CLK
static struct clk *ak4642_of_parse_mcko(struct device *dev)
{}
#else
#define ak4642_of_parse_mcko
#endif

static int ak4642_i2c_probe(struct i2c_client *i2c)
{}

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

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

static struct i2c_driver ak4642_i2c_driver =;

module_i2c_driver();

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