linux/sound/soc/codecs/ssm3515.c

// SPDX-License-Identifier: GPL-2.0-only OR MIT
//
// Analog Devices' SSM3515 audio amp driver
//
// Copyright (C) The Asahi Linux Contributors

#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>

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


#define SSM3515_PWR
#define SSM3515_PWR_APWDN_EN
#define SSM3515_PWR_BSNS_PWDN
#define SSM3515_PWR_S_RST
#define SSM3515_PWR_SPWDN

#define SSM3515_GEC
#define SSM3515_GEC_EDGE
#define SSM3515_GEC_EDGE_SHIFT
#define SSM3515_GEC_ANA_GAIN

#define SSM3515_DAC
#define SSM3515_DAC_HV
#define SSM3515_DAC_MUTE
#define SSM3515_DAC_HPF
#define SSM3515_DAC_LPM
#define SSM3515_DAC_FS

#define SSM3515_DAC_VOL

#define SSM3515_SAI1
#define SSM3515_SAI1_DAC_POL
#define SSM3515_SAI1_BCLK_POL
#define SSM3515_SAI1_TDM_BCLKS
#define SSM3515_SAI1_FSYNC_MODE
#define SSM3515_SAI1_SDATA_FMT
#define SSM3515_SAI1_SAI_MODE

#define SSM3515_SAI2
#define SSM3515_SAI2_DATA_WIDTH
#define SSM3515_SAI2_AUTO_SLOT
#define SSM3515_SAI2_TDM_SLOT

#define SSM3515_VBAT_OUT

#define SSM3515_STATUS
#define SSM3515_STATUS_UVLO_REG
#define SSM3515_STATUS_LIM_EG
#define SSM3515_STATUS_CLIP
#define SSM3515_STATUS_AMP_OC
#define SSM3515_STATUS_OTF
#define SSM3515_STATUS_OTW
#define SSM3515_STATUS_BAT_WARN

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

static const struct reg_default ssm3515_reg_defaults[] =;

static const struct regmap_config ssm3515_i2c_regmap =;

struct ssm3515_data {};

// The specced range is -71.25...24.00 dB with step size of 0.375 dB,
// and a mute item below that. This is represented by -71.62...24.00 dB
// with the mute item mapped onto the low end.
static DECLARE_TLV_DB_MINMAX_MUTE(ssm3515_dac_volume, -7162, 2400);

static const char * const ssm3515_ana_gain_text[] =;

static SOC_ENUM_SINGLE_DECL(ssm3515_ana_gain_enum, SSM3515_GEC,
			    __bf_shf(SSM3515_GEC_ANA_GAIN),
			    ssm3515_ana_gain_text);

static const struct snd_kcontrol_new ssm3515_snd_controls[] =;

static void ssm3515_read_faults(struct snd_soc_component *component)
{}

static int ssm3515_probe(struct snd_soc_component *component)
{}

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

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

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

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

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

static const struct snd_soc_dai_ops ssm3515_dai_ops =;

static struct snd_soc_dai_driver ssm3515_dai_driver =;

static const struct snd_soc_dapm_widget ssm3515_dapm_widgets[] =;

static const struct snd_soc_dapm_route ssm3515_dapm_routes[] =;

static const struct snd_soc_component_driver ssm3515_asoc_component =;

static int ssm3515_i2c_probe(struct i2c_client *client)
{}

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

static struct i2c_driver ssm3515_i2c_driver =;
module_i2c_driver();

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