linux/sound/soc/codecs/tlv320dac33.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * ALSA SoC Texas Instruments TLV320DAC33 codec driver
 *
 * Author: Peter Ujfalusi <[email protected]>
 *
 * Copyright:   (C) 2009 Nokia Corporation
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/gpio.h>
#include <linux/regulator/consumer.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/tlv320dac33-plat.h>
#include "tlv320dac33.h"

/*
 * The internal FIFO is 24576 bytes long
 * It can be configured to hold 16bit or 24bit samples
 * In 16bit configuration the FIFO can hold 6144 stereo samples
 * In 24bit configuration the FIFO can hold 4096 stereo samples
 */
#define DAC33_FIFO_SIZE_16BIT
#define DAC33_FIFO_SIZE_24BIT
#define DAC33_MODE7_MARGIN

#define BURST_BASEFREQ_HZ

#define SAMPLES_TO_US(rate, samples)

#define US_TO_SAMPLES(rate, us)

#define UTHR_FROM_PERIOD_SIZE(samples, playrate, burstrate)

static void dac33_calculate_times(struct snd_pcm_substream *substream,
				  struct snd_soc_component *component);
static int dac33_prepare_chip(struct snd_pcm_substream *substream,
			      struct snd_soc_component *component);

enum dac33_state {};

enum dac33_fifo_modes {};

#define DAC33_NUM_SUPPLIES
static const char *dac33_supply_names[DAC33_NUM_SUPPLIES] =;

struct tlv320dac33_priv {};

static const u8 dac33_reg[DAC33_CACHEREGNUM] =;

/* Register read and write */
static inline unsigned int dac33_read_reg_cache(struct snd_soc_component *component,
						unsigned reg)
{}

static inline void dac33_write_reg_cache(struct snd_soc_component *component,
					 u8 reg, u8 value)
{}

static int dac33_read(struct snd_soc_component *component, unsigned int reg,
		      u8 *value)
{}

static int dac33_write(struct snd_soc_component *component, unsigned int reg,
		       unsigned int value)
{}

static int dac33_write_locked(struct snd_soc_component *component, unsigned int reg,
			      unsigned int value)
{}

#define DAC33_I2C_ADDR_AUTOINC
static int dac33_write16(struct snd_soc_component *component, unsigned int reg,
		       unsigned int value)
{}

static void dac33_init_chip(struct snd_soc_component *component)
{}

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

static inline void dac33_soft_power(struct snd_soc_component *component, int power)
{}

static inline void dac33_disable_digital(struct snd_soc_component *component)
{}

static int dac33_hard_power(struct snd_soc_component *component, int power)
{}

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

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

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

/* Codec operation modes */
static const char *dac33_fifo_mode_texts[] =;

static SOC_ENUM_SINGLE_EXT_DECL(dac33_fifo_mode_enum, dac33_fifo_mode_texts);

/* L/R Line Output Gain */
static const char *lr_lineout_gain_texts[] =;

static SOC_ENUM_SINGLE_DECL(l_lineout_gain_enum,
			    DAC33_LDAC_PWR_CTRL, 0,
			    lr_lineout_gain_texts);

static SOC_ENUM_SINGLE_DECL(r_lineout_gain_enum,
			    DAC33_RDAC_PWR_CTRL, 0,
			    lr_lineout_gain_texts);

/*
 * DACL/R digital volume control:
 * from 0 dB to -63.5 in 0.5 dB steps
 * Need to be inverted later on:
 * 0x00 == 0 dB
 * 0x7f == -63.5 dB
 */
static DECLARE_TLV_DB_SCALE(dac_digivol_tlv, -6350, 50, 0);

static const struct snd_kcontrol_new dac33_snd_controls[] =;

static const struct snd_kcontrol_new dac33_mode_snd_controls[] =;

/* Analog bypass */
static const struct snd_kcontrol_new dac33_dapm_abypassl_control =;

static const struct snd_kcontrol_new dac33_dapm_abypassr_control =;

/* LOP L/R invert selection */
static const char *dac33_lr_lom_texts[] =;

static SOC_ENUM_SINGLE_DECL(dac33_left_lom_enum,
			    DAC33_OUT_AMP_CTRL, 3,
			    dac33_lr_lom_texts);

static const struct snd_kcontrol_new dac33_dapm_left_lom_control =;

static SOC_ENUM_SINGLE_DECL(dac33_right_lom_enum,
			    DAC33_OUT_AMP_CTRL, 2,
			    dac33_lr_lom_texts);

static const struct snd_kcontrol_new dac33_dapm_right_lom_control =;

static const struct snd_soc_dapm_widget dac33_dapm_widgets[] =;

static const struct snd_soc_dapm_route audio_map[] =;

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

static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
{}

static inline void dac33_playback_handler(struct tlv320dac33_priv *dac33)
{}

static void dac33_work(struct work_struct *work)
{}

static irqreturn_t dac33_interrupt_handler(int irq, void *dev)
{}

static void dac33_oscwait(struct snd_soc_component *component)
{}

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

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

#define CALC_BURST_RATE(bclkdiv, bclk_per_sample)
static int dac33_hw_params(struct snd_pcm_substream *substream,
			   struct snd_pcm_hw_params *params,
			   struct snd_soc_dai *dai)
{}

#define CALC_OSCSET(rate, refclk)
#define CALC_RATIOSET(rate, refclk)

/*
 * tlv320dac33 is strict on the sequence of the register writes, if the register
 * writes happens in different order, than dac33 might end up in unknown state.
 * Use the known, working sequence of register writes to initialize the dac33.
 */
static int dac33_prepare_chip(struct snd_pcm_substream *substream,
			      struct snd_soc_component *component)
{}

static void dac33_calculate_times(struct snd_pcm_substream *substream,
				  struct snd_soc_component *component)
{}

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

static snd_pcm_sframes_t dac33_dai_delay(
			struct snd_pcm_substream *substream,
			struct snd_soc_dai *dai)
{}

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

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

static int dac33_soc_probe(struct snd_soc_component *component)
{}

static void dac33_soc_remove(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_dev_tlv320dac33 =;

#define DAC33_RATES
#define DAC33_FORMATS

static const struct snd_soc_dai_ops dac33_dai_ops =;

static struct snd_soc_dai_driver dac33_dai =;

static int dac33_i2c_probe(struct i2c_client *client)
{}

static void dac33_i2c_remove(struct i2c_client *client)
{}

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

static struct i2c_driver tlv320dac33_i2c_driver =;

module_i2c_driver();

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