linux/sound/soc/codecs/pcm3168a.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * PCM3168A codec driver
 *
 * Copyright (C) 2015 Imagination Technologies Ltd.
 *
 * Author: Damien Horsley <[email protected]>
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>

#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>

#include "pcm3168a.h"

#define PCM3168A_FORMATS

#define PCM3168A_FMT_I2S
#define PCM3168A_FMT_LEFT_J
#define PCM3168A_FMT_RIGHT_J
#define PCM3168A_FMT_RIGHT_J_16
#define PCM3168A_FMT_DSP_A
#define PCM3168A_FMT_DSP_B
#define PCM3168A_FMT_I2S_TDM
#define PCM3168A_FMT_LEFT_J_TDM

static const char *const pcm3168a_supply_names[] =;

#define PCM3168A_DAI_DAC
#define PCM3168A_DAI_ADC

/* ADC/DAC side parameters */
struct pcm3168a_io_params {};

struct pcm3168a_priv {};

static const char *const pcm3168a_roll_off[] =;

static SOC_ENUM_SINGLE_DECL(pcm3168a_d1_roll_off, PCM3168A_DAC_OP_FLT,
		PCM3168A_DAC_FLT_SHIFT, pcm3168a_roll_off);
static SOC_ENUM_SINGLE_DECL(pcm3168a_d2_roll_off, PCM3168A_DAC_OP_FLT,
		PCM3168A_DAC_FLT_SHIFT + 1, pcm3168a_roll_off);
static SOC_ENUM_SINGLE_DECL(pcm3168a_d3_roll_off, PCM3168A_DAC_OP_FLT,
		PCM3168A_DAC_FLT_SHIFT + 2, pcm3168a_roll_off);
static SOC_ENUM_SINGLE_DECL(pcm3168a_d4_roll_off, PCM3168A_DAC_OP_FLT,
		PCM3168A_DAC_FLT_SHIFT + 3, pcm3168a_roll_off);

static const char *const pcm3168a_volume_type[] =;

static SOC_ENUM_SINGLE_DECL(pcm3168a_dac_volume_type, PCM3168A_DAC_ATT_DEMP_ZF,
		PCM3168A_DAC_ATMDDA_SHIFT, pcm3168a_volume_type);

static const char *const pcm3168a_att_speed_mult[] =;

static SOC_ENUM_SINGLE_DECL(pcm3168a_dac_att_mult, PCM3168A_DAC_ATT_DEMP_ZF,
		PCM3168A_DAC_ATSPDA_SHIFT, pcm3168a_att_speed_mult);

static const char *const pcm3168a_demp[] =;

static SOC_ENUM_SINGLE_DECL(pcm3168a_dac_demp, PCM3168A_DAC_ATT_DEMP_ZF,
		PCM3168A_DAC_DEMP_SHIFT, pcm3168a_demp);

static const char *const pcm3168a_zf_func[] =;

static SOC_ENUM_SINGLE_DECL(pcm3168a_dac_zf_func, PCM3168A_DAC_ATT_DEMP_ZF,
		PCM3168A_DAC_AZRO_SHIFT, pcm3168a_zf_func);

static const char *const pcm3168a_pol[] =;

static SOC_ENUM_SINGLE_DECL(pcm3168a_dac_zf_pol, PCM3168A_DAC_ATT_DEMP_ZF,
		PCM3168A_DAC_ATSPDA_SHIFT, pcm3168a_pol);

static const char *const pcm3168a_con[] =;

static SOC_ENUM_DOUBLE_DECL(pcm3168a_adc1_con, PCM3168A_ADC_SEAD,
				0, 1, pcm3168a_con);
static SOC_ENUM_DOUBLE_DECL(pcm3168a_adc2_con, PCM3168A_ADC_SEAD,
				2, 3, pcm3168a_con);
static SOC_ENUM_DOUBLE_DECL(pcm3168a_adc3_con, PCM3168A_ADC_SEAD,
				4, 5, pcm3168a_con);

static SOC_ENUM_SINGLE_DECL(pcm3168a_adc_volume_type, PCM3168A_ADC_ATT_OVF,
		PCM3168A_ADC_ATMDAD_SHIFT, pcm3168a_volume_type);

static SOC_ENUM_SINGLE_DECL(pcm3168a_adc_att_mult, PCM3168A_ADC_ATT_OVF,
		PCM3168A_ADC_ATSPAD_SHIFT, pcm3168a_att_speed_mult);

static SOC_ENUM_SINGLE_DECL(pcm3168a_adc_ov_pol, PCM3168A_ADC_ATT_OVF,
		PCM3168A_ADC_OVFP_SHIFT, pcm3168a_pol);

/* -100db to 0db, register values 0-54 cause mute */
static const DECLARE_TLV_DB_SCALE(pcm3168a_dac_tlv, -10050, 50, 1);

/* -100db to 20db, register values 0-14 cause mute */
static const DECLARE_TLV_DB_SCALE(pcm3168a_adc_tlv, -10050, 50, 1);

static const struct snd_kcontrol_new pcm3168a_snd_controls[] =;

static const struct snd_soc_dapm_widget pcm3168a_dapm_widgets[] =;

static const struct snd_soc_dapm_route pcm3168a_dapm_routes[] =;

static unsigned int pcm3168a_scki_ratios[] =;

#define PCM3168A_NUM_SCKI_RATIOS_DAC
#define PCM3168A_NUM_SCKI_RATIOS_ADC

#define PCM3168A_MAX_SYSCLK

static int pcm3168a_reset(struct pcm3168a_priv *pcm3168a)
{}

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

static int pcm3168a_set_dai_sysclk(struct snd_soc_dai *dai,
				  int clk_id, unsigned int freq, int dir)
{}

static void pcm3168a_update_fixup_pcm_stream(struct snd_soc_dai *dai)
{}

static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai, unsigned int format)
{}

static int pcm3168a_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
				 unsigned int rx_mask, int slots,
				 int slot_width)
{}

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

static const u64 pcm3168a_dai_formats[] =;

static const struct snd_soc_dai_ops pcm3168a_dai_ops =;

static struct snd_soc_dai_driver pcm3168a_dais[] =;

static const struct reg_default pcm3168a_reg_default[] =;

static bool pcm3168a_readable_register(struct device *dev, unsigned int reg)
{}

static bool pcm3168a_volatile_register(struct device *dev, unsigned int reg)
{}

static bool pcm3168a_writeable_register(struct device *dev, unsigned int reg)
{}

const struct regmap_config pcm3168a_regmap =;
EXPORT_SYMBOL_GPL();

static const struct snd_soc_component_driver pcm3168a_driver =;

int pcm3168a_probe(struct device *dev, struct regmap *regmap)
{}
EXPORT_SYMBOL_GPL();

static void pcm3168a_disable(struct device *dev)
{}

void pcm3168a_remove(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_PM
static int pcm3168a_rt_resume(struct device *dev)
{}

static int pcm3168a_rt_suspend(struct device *dev)
{}
#endif

const struct dev_pm_ops pcm3168a_pm_ops =;
EXPORT_SYMBOL_GPL();

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