linux/sound/soc/codecs/wsa881x.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2015-2017, The Linux Foundation.
// Copyright (c) 2019, Linaro Limited

#include <linux/bitops.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/pm_runtime.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_registers.h>
#include <linux/soundwire/sdw_type.h>
#include <sound/soc.h>
#include <sound/tlv.h>

#define WSA881X_DIGITAL_BASE
#define WSA881X_ANALOG_BASE

/* Digital register address space */
#define WSA881X_CHIP_ID0
#define WSA881X_CHIP_ID1
#define WSA881X_CHIP_ID2
#define WSA881X_CHIP_ID3
#define WSA881X_BUS_ID
#define WSA881X_CDC_RST_CTL
#define WSA881X_CDC_TOP_CLK_CTL
#define WSA881X_CDC_ANA_CLK_CTL
#define WSA881X_CDC_DIG_CLK_CTL
#define WSA881X_CLOCK_CONFIG
#define WSA881X_ANA_CTL
#define WSA881X_SWR_RESET_EN
#define WSA881X_RESET_CTL
#define WSA881X_TADC_VALUE_CTL
#define WSA881X_TEMP_DETECT_CTL
#define WSA881X_TEMP_MSB
#define WSA881X_TEMP_LSB
#define WSA881X_TEMP_CONFIG0
#define WSA881X_TEMP_CONFIG1
#define WSA881X_CDC_CLIP_CTL
#define WSA881X_SDM_PDM9_LSB
#define WSA881X_SDM_PDM9_MSB
#define WSA881X_CDC_RX_CTL
#define WSA881X_DEM_BYPASS_DATA0
#define WSA881X_DEM_BYPASS_DATA1
#define WSA881X_DEM_BYPASS_DATA2
#define WSA881X_DEM_BYPASS_DATA3
#define WSA881X_OTP_CTRL0
#define WSA881X_OTP_CTRL1
#define WSA881X_HDRIVE_CTL_GROUP1
#define WSA881X_INTR_MODE
#define WSA881X_INTR_MASK
#define WSA881X_INTR_STATUS
#define WSA881X_INTR_CLEAR
#define WSA881X_INTR_LEVEL
#define WSA881X_INTR_SET
#define WSA881X_INTR_TEST
#define WSA881X_PDM_TEST_MODE
#define WSA881X_ATE_TEST_MODE
#define WSA881X_PIN_CTL_MODE
#define WSA881X_PIN_CTL_OE
#define WSA881X_PIN_WDATA_IOPAD
#define WSA881X_PIN_STATUS
#define WSA881X_DIG_DEBUG_MODE
#define WSA881X_DIG_DEBUG_SEL
#define WSA881X_DIG_DEBUG_EN
#define WSA881X_SWR_HM_TEST1
#define WSA881X_SWR_HM_TEST2
#define WSA881X_TEMP_DETECT_DBG_CTL
#define WSA881X_TEMP_DEBUG_MSB
#define WSA881X_TEMP_DEBUG_LSB
#define WSA881X_SAMPLE_EDGE_SEL
#define WSA881X_IOPAD_CTL
#define WSA881X_SPARE_0
#define WSA881X_SPARE_1
#define WSA881X_SPARE_2
#define WSA881X_OTP_REG_0
#define WSA881X_OTP_REG_1
#define WSA881X_OTP_REG_2
#define WSA881X_OTP_REG_3
#define WSA881X_OTP_REG_4
#define WSA881X_OTP_REG_5
#define WSA881X_OTP_REG_6
#define WSA881X_OTP_REG_7
#define WSA881X_OTP_REG_8
#define WSA881X_OTP_REG_9
#define WSA881X_OTP_REG_10
#define WSA881X_OTP_REG_11
#define WSA881X_OTP_REG_12
#define WSA881X_OTP_REG_13
#define WSA881X_OTP_REG_14
#define WSA881X_OTP_REG_15
#define WSA881X_OTP_REG_16
#define WSA881X_OTP_REG_17
#define WSA881X_OTP_REG_18
#define WSA881X_OTP_REG_19
#define WSA881X_OTP_REG_20
#define WSA881X_OTP_REG_21
#define WSA881X_OTP_REG_22
#define WSA881X_OTP_REG_23
#define WSA881X_OTP_REG_24
#define WSA881X_OTP_REG_25
#define WSA881X_OTP_REG_26
#define WSA881X_OTP_REG_27
#define WSA881X_OTP_REG_28
#define WSA881X_OTP_REG_29
#define WSA881X_OTP_REG_30
#define WSA881X_OTP_REG_31
#define WSA881X_OTP_REG_63

/* Analog Register address space */
#define WSA881X_BIAS_REF_CTRL
#define WSA881X_BIAS_TEST
#define WSA881X_BIAS_BIAS
#define WSA881X_TEMP_OP
#define WSA881X_TEMP_IREF_CTRL
#define WSA881X_TEMP_ISENS_CTRL
#define WSA881X_TEMP_CLK_CTRL
#define WSA881X_TEMP_TEST
#define WSA881X_TEMP_BIAS
#define WSA881X_TEMP_ADC_CTRL
#define WSA881X_TEMP_DOUT_MSB
#define WSA881X_TEMP_DOUT_LSB
#define WSA881X_ADC_EN_MODU_V
#define WSA881X_ADC_EN_MODU_I
#define WSA881X_ADC_EN_DET_TEST_V
#define WSA881X_ADC_EN_DET_TEST_I
#define WSA881X_ADC_SEL_IBIAS
#define WSA881X_ADC_EN_SEL_IBAIS
#define WSA881X_SPKR_DRV_EN
#define WSA881X_SPKR_DRV_GAIN
#define WSA881X_PA_GAIN_SEL_MASK
#define WSA881X_PA_GAIN_SEL_REG
#define WSA881X_PA_GAIN_SEL_DRE
#define WSA881X_SPKR_PAG_GAIN_MASK
#define WSA881X_SPKR_DAC_CTL
#define WSA881X_SPKR_DRV_DBG
#define WSA881X_SPKR_PWRSTG_DBG
#define WSA881X_SPKR_OCP_CTL
#define WSA881X_SPKR_OCP_MASK
#define WSA881X_SPKR_OCP_EN
#define WSA881X_SPKR_OCP_HOLD
#define WSA881X_SPKR_CLIP_CTL
#define WSA881X_SPKR_BBM_CTL
#define WSA881X_SPKR_MISC_CTL1
#define WSA881X_SPKR_MISC_CTL2
#define WSA881X_SPKR_BIAS_INT
#define WSA881X_SPKR_PA_INT
#define WSA881X_SPKR_BIAS_CAL
#define WSA881X_SPKR_BIAS_PSRR
#define WSA881X_SPKR_STATUS1
#define WSA881X_SPKR_STATUS2
#define WSA881X_BOOST_EN_CTL
#define WSA881X_BOOST_EN_MASK
#define WSA881X_BOOST_EN
#define WSA881X_BOOST_CURRENT_LIMIT
#define WSA881X_BOOST_PS_CTL
#define WSA881X_BOOST_PRESET_OUT1
#define WSA881X_BOOST_PRESET_OUT2
#define WSA881X_BOOST_FORCE_OUT
#define WSA881X_BOOST_LDO_PROG
#define WSA881X_BOOST_SLOPE_COMP_ISENSE_FB
#define WSA881X_BOOST_RON_CTL
#define WSA881X_BOOST_LOOP_STABILITY
#define WSA881X_BOOST_ZX_CTL
#define WSA881X_BOOST_START_CTL
#define WSA881X_BOOST_MISC1_CTL
#define WSA881X_BOOST_MISC2_CTL
#define WSA881X_BOOST_MISC3_CTL
#define WSA881X_BOOST_ATEST_CTL
#define WSA881X_SPKR_PROT_FE_GAIN
#define WSA881X_SPKR_PROT_FE_CM_LDO_SET
#define WSA881X_SPKR_PROT_FE_ISENSE_BIAS_SET1
#define WSA881X_SPKR_PROT_FE_ISENSE_BIAS_SET2
#define WSA881X_SPKR_PROT_ATEST1
#define WSA881X_SPKR_PROT_ATEST2
#define WSA881X_SPKR_PROT_FE_VSENSE_VCM
#define WSA881X_SPKR_PROT_FE_VSENSE_BIAS_SET1
#define WSA881X_BONGO_RESRV_REG1
#define WSA881X_BONGO_RESRV_REG2
#define WSA881X_SPKR_PROT_SAR
#define WSA881X_SPKR_STATUS3

#define SWRS_SCP_FRAME_CTRL_BANK(m)
#define SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(m)
#define SWR_SLV_MAX_REG_ADDR
#define SWR_SLV_START_REG_ADDR
#define SWR_SLV_MAX_BUF_LEN
#define BYTES_PER_LINE
#define SWR_SLV_RD_BUF_LEN
#define SWR_SLV_WR_BUF_LEN
#define SWR_SLV_MAX_DEVICES
#define WSA881X_MAX_SWR_PORTS
#define WSA881X_VERSION_ENTRY_SIZE
#define WSA881X_OCP_CTL_TIMER_SEC
#define WSA881X_OCP_CTL_TEMP_CELSIUS
#define WSA881X_OCP_CTL_POLL_TIMER_SEC
#define WSA881X_PROBE_TIMEOUT

#define WSA881X_PA_GAIN_TLV(xname, reg, shift, max, invert, tlv_array)

static struct reg_default wsa881x_defaults[] =;

static const struct reg_sequence wsa881x_pre_pmu_pa_2_0[] =;

static const struct reg_sequence wsa881x_vi_txfe_en_2_0[] =;

/* Default register reset values for WSA881x rev 2.0 */
static struct reg_sequence wsa881x_rev_2_0[] =;

enum wsa_port_ids {};

/* 4 ports */
static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] =;

static const struct sdw_port_config wsa881x_pconfig[WSA881X_MAX_SWR_PORTS] =;

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

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

static const struct regmap_config wsa881x_regmap_config =;

enum {};

/*
 * Private data Structure for wsa881x. All parameters related to
 * WSA881X codec needs to be defined here.
 */
struct wsa881x_priv {};

static void wsa881x_init(struct wsa881x_priv *wsa881x)
{}

static int wsa881x_component_probe(struct snd_soc_component *comp)
{}

static int wsa881x_put_pa_gain(struct snd_kcontrol *kc,
			       struct snd_ctl_elem_value *ucontrol)
{}

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

static int wsa881x_boost_ctrl(struct snd_soc_component *comp, bool enable)
{}

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

static const char * const smart_boost_lvl_text[] =;

static const struct soc_enum smart_boost_lvl_enum =;

static const DECLARE_TLV_DB_SCALE(pa_gain, 0, 150, 0);

static const struct snd_kcontrol_new wsa881x_snd_controls[] =;

static const struct snd_soc_dapm_route wsa881x_audio_map[] =;

static int wsa881x_visense_txfe_ctrl(struct snd_soc_component *comp,
				     bool enable)
{}

static int wsa881x_visense_adc_ctrl(struct snd_soc_component *comp,
				    bool enable)
{}

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

static const struct snd_soc_dapm_widget wsa881x_dapm_widgets[] =;

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

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

static int wsa881x_set_sdw_stream(struct snd_soc_dai *dai,
				  void *stream, int direction)
{}

static int wsa881x_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
{}

static const struct snd_soc_dai_ops wsa881x_dai_ops =;

static struct snd_soc_dai_driver wsa881x_dais[] =;

static const struct snd_soc_component_driver wsa881x_component_drv =;

static int wsa881x_update_status(struct sdw_slave *slave,
				 enum sdw_slave_status status)
{}

static int wsa881x_port_prep(struct sdw_slave *slave,
			     struct sdw_prepare_ch *prepare_ch,
			     enum sdw_port_prep_ops state)
{}

static int wsa881x_bus_config(struct sdw_slave *slave,
			      struct sdw_bus_params *params)
{}

static const struct sdw_slave_ops wsa881x_slave_ops =;

static int wsa881x_probe(struct sdw_slave *pdev,
			 const struct sdw_device_id *id)
{}

static int __maybe_unused wsa881x_runtime_suspend(struct device *dev)
{}

static int __maybe_unused wsa881x_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops wsa881x_pm_ops =;

static const struct sdw_device_id wsa881x_slave_id[] =;
MODULE_DEVICE_TABLE(sdw, wsa881x_slave_id);

static struct sdw_driver wsa881x_codec_driver =;
module_sdw_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();