linux/sound/soc/codecs/cs42l51.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * cs42l51.c
 *
 * ASoC Driver for Cirrus Logic CS42L51 codecs
 *
 * Copyright (c) 2010 Arnaud Patard <[email protected]>
 *
 * Based on cs4270.c - Copyright (c) Freescale Semiconductor
 *
 * For now:
 *  - Only I2C is support. Not SPI
 *  - master mode *NOT* supported
 */

#include <linux/clk.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include <sound/initval.h>
#include <sound/pcm_params.h>
#include <sound/pcm.h>
#include <linux/gpio/consumer.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>

#include "cs42l51.h"

enum master_slave_mode {};

static const char * const cs42l51_supply_names[] =;

struct cs42l51_private {};

#define CS42L51_FORMATS

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

#define CHAN_MIX_NORMAL
#define CHAN_MIX_BOTH
#define CHAN_MIX_SWAP

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

static const DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -5150, 50, 0);
static const DECLARE_TLV_DB_SCALE(tone_tlv, -1050, 150, 0);

static const DECLARE_TLV_DB_SCALE(aout_tlv, -10200, 50, 0);

static const DECLARE_TLV_DB_SCALE(boost_tlv, 1600, 1600, 0);
static const DECLARE_TLV_DB_SCALE(adc_boost_tlv, 2000, 2000, 0);
static const char *chan_mix[] =;

static const DECLARE_TLV_DB_SCALE(pga_tlv, -300, 50, 0);
static const DECLARE_TLV_DB_SCALE(adc_att_tlv, -9600, 100, 0);

static SOC_ENUM_SINGLE_EXT_DECL(cs42l51_chan_mix, chan_mix);

static const struct snd_kcontrol_new cs42l51_snd_controls[] =;

/*
 * to power down, one must:
 * 1.) Enable the PDN bit
 * 2.) enable power-down for the select channels
 * 3.) disable the PDN bit.
 */
static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w,
		struct snd_kcontrol *kcontrol, int event)
{}

static const char *cs42l51_dac_names[] =;
static SOC_ENUM_SINGLE_DECL(cs42l51_dac_mux_enum,
			    CS42L51_DAC_CTL, 6, cs42l51_dac_names);
static const struct snd_kcontrol_new cs42l51_dac_mux_controls =;

static const char *cs42l51_adcl_names[] =;
static SOC_ENUM_SINGLE_DECL(cs42l51_adcl_mux_enum,
			    CS42L51_ADC_INPUT, 4, cs42l51_adcl_names);
static const struct snd_kcontrol_new cs42l51_adcl_mux_controls =;

static const char *cs42l51_adcr_names[] =;
static SOC_ENUM_SINGLE_DECL(cs42l51_adcr_mux_enum,
			    CS42L51_ADC_INPUT, 6, cs42l51_adcr_names);
static const struct snd_kcontrol_new cs42l51_adcr_mux_controls =;

static const struct snd_soc_dapm_widget cs42l51_dapm_widgets[] =;

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

static const struct snd_soc_dapm_widget cs42l51_dapm_mclk_widgets[] =;

static const struct snd_soc_dapm_route cs42l51_routes[] =;

static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai,
		unsigned int format)
{}

struct cs42l51_ratios {};

static struct cs42l51_ratios slave_ratios[] =;

static struct cs42l51_ratios slave_auto_ratios[] =;

/*
 * Master mode mclk/fs ratios.
 * Recommended configurations are SSM for 4-50khz and DSM for 50-100kHz ranges
 * The table below provides support of following ratios:
 * 128: SSM (%128) with div2 disabled
 * 256: SSM (%128) with div2 enabled
 * In both cases, if sampling rate is above 50kHz, SSM is overridden
 * with DSM (%128) configuration
 */
static struct cs42l51_ratios master_ratios[] =;

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

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

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

static int cs42l51_of_xlate_dai_id(struct snd_soc_component *component,
				   struct device_node *endpoint)
{}

static const struct snd_soc_dai_ops cs42l51_dai_ops =;

static struct snd_soc_dai_driver cs42l51_dai =;

static int cs42l51_component_probe(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_device_cs42l51 =;

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

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

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

const struct regmap_config cs42l51_regmap =;
EXPORT_SYMBOL_GPL();

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

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

int __maybe_unused cs42l51_suspend(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

int __maybe_unused cs42l51_resume(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

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