linux/sound/soc/codecs/cs35l56.c

// SPDX-License-Identifier: GPL-2.0-only
//
// Driver for Cirrus Logic CS35L56 smart amp
//
// Copyright (C) 2023 Cirrus Logic, Inc. and
//                    Cirrus Logic International Semiconductor Ltd.

#include <linux/acpi.h>
#include <linux/array_size.h>
#include <linux/completion.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/math.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/soundwire/sdw.h>
#include <linux/types.h>
#include <linux/workqueue.h>
#include <sound/cs-amp-lib.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h>

#include "wm_adsp.h"
#include "cs35l56.h"

static int cs35l56_dsp_event(struct snd_soc_dapm_widget *w,
			     struct snd_kcontrol *kcontrol, int event);

static void cs35l56_wait_dsp_ready(struct cs35l56_private *cs35l56)
{}

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

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

static DECLARE_TLV_DB_SCALE(vol_tlv, -10000, 25, 0);

static const struct snd_kcontrol_new cs35l56_controls[] =;

static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx1_enum,
				  CS35L56_ASP1TX1_INPUT,
				  0, CS35L56_ASP_TXn_SRC_MASK,
				  cs35l56_tx_input_texts,
				  cs35l56_tx_input_values);

static const struct snd_kcontrol_new asp1_tx1_mux =;

static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx2_enum,
				  CS35L56_ASP1TX2_INPUT,
				  0, CS35L56_ASP_TXn_SRC_MASK,
				  cs35l56_tx_input_texts,
				  cs35l56_tx_input_values);

static const struct snd_kcontrol_new asp1_tx2_mux =;

static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx3_enum,
				  CS35L56_ASP1TX3_INPUT,
				  0, CS35L56_ASP_TXn_SRC_MASK,
				  cs35l56_tx_input_texts,
				  cs35l56_tx_input_values);

static const struct snd_kcontrol_new asp1_tx3_mux =;

static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx4_enum,
				  CS35L56_ASP1TX4_INPUT,
				  0, CS35L56_ASP_TXn_SRC_MASK,
				  cs35l56_tx_input_texts,
				  cs35l56_tx_input_values);

static const struct snd_kcontrol_new asp1_tx4_mux =;

static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx1_enum,
				CS35L56_SWIRE_DP3_CH1_INPUT,
				0, CS35L56_SWIRETXn_SRC_MASK,
				cs35l56_tx_input_texts,
				cs35l56_tx_input_values);

static const struct snd_kcontrol_new sdw1_tx1_mux =;

static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx2_enum,
				CS35L56_SWIRE_DP3_CH2_INPUT,
				0, CS35L56_SWIRETXn_SRC_MASK,
				cs35l56_tx_input_texts,
				cs35l56_tx_input_values);

static const struct snd_kcontrol_new sdw1_tx2_mux =;

static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx3_enum,
				CS35L56_SWIRE_DP3_CH3_INPUT,
				0, CS35L56_SWIRETXn_SRC_MASK,
				cs35l56_tx_input_texts,
				cs35l56_tx_input_values);

static const struct snd_kcontrol_new sdw1_tx3_mux =;

static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx4_enum,
				CS35L56_SWIRE_DP3_CH4_INPUT,
				0, CS35L56_SWIRETXn_SRC_MASK,
				cs35l56_tx_input_texts,
				cs35l56_tx_input_values);

static const struct snd_kcontrol_new sdw1_tx4_mux =;

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

static const struct snd_soc_dapm_widget cs35l56_dapm_widgets[] =;

#define CS35L56_SRC_ROUTE(name)

static const struct snd_soc_dapm_route cs35l56_audio_map[] =;

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

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

static unsigned int cs35l56_make_tdm_config_word(unsigned int reg_val, unsigned long mask)
{}

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

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

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

static const struct snd_soc_dai_ops cs35l56_ops =;

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

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

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

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

static int cs35l56_sdw_dai_set_stream(struct snd_soc_dai *dai,
				      void *sdw_stream, int direction)
{}

static const struct snd_soc_dai_ops cs35l56_sdw_dai_ops =;

static struct snd_soc_dai_driver cs35l56_dai[] =;

static int cs35l56_write_cal(struct cs35l56_private *cs35l56)
{}

static void cs35l56_reinit_patch(struct cs35l56_private *cs35l56)
{}

static void cs35l56_patch(struct cs35l56_private *cs35l56, bool firmware_missing)
{}

static void cs35l56_dsp_work(struct work_struct *work)
{}

static int cs35l56_component_probe(struct snd_soc_component *component)
{}

static void cs35l56_component_remove(struct snd_soc_component *component)
{}

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

static const struct snd_soc_component_driver soc_component_dev_cs35l56 =;

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

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

int cs35l56_system_suspend(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

int cs35l56_system_suspend_late(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

int cs35l56_system_suspend_no_irq(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

int cs35l56_system_resume_no_irq(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

int cs35l56_system_resume_early(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

int cs35l56_system_resume(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

static int cs35l56_control_add_nop(struct wm_adsp *dsp, struct cs_dsp_coeff_ctl *cs_ctl)
{}

static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)
{}

static int cs35l56_get_firmware_uid(struct cs35l56_private *cs35l56)
{}

/*
 * Some SoundWire laptops have a spk-id-gpios property but it points to
 * the wrong ACPI Device node so can't be used to get the GPIO. Try to
 * find the SDCA node containing the GpioIo resource and add a GPIO
 * mapping to it.
 */
static const struct acpi_gpio_params cs35l56_af01_first_gpio =;
static const struct acpi_gpio_mapping cs35l56_af01_spkid_gpios_mapping[] =;

static void cs35l56_acpi_dev_release_driver_gpios(void *adev)
{}

static int cs35l56_try_get_broken_sdca_spkid_gpio(struct cs35l56_private *cs35l56)
{}

int cs35l56_common_probe(struct cs35l56_private *cs35l56)
{}
EXPORT_SYMBOL_NS_GPL();

int cs35l56_init(struct cs35l56_private *cs35l56)
{}
EXPORT_SYMBOL_NS_GPL();

void cs35l56_remove(struct cs35l56_private *cs35l56)
{}
EXPORT_SYMBOL_NS_GPL();

#if IS_ENABLED(CONFIG_SND_SOC_CS35L56_I2C) || IS_ENABLED(CONFIG_SND_SOC_CS35L56_SPI)
EXPORT_NS_GPL_DEV_PM_OPS(cs35l56_pm_ops_i2c_spi, SND_SOC_CS35L56_CORE) =;
#endif

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