linux/sound/soc/codecs/rt1320-sdw.c

// SPDX-License-Identifier: GPL-2.0-only
//
// rt1320-sdw.c -- rt1320 SDCA ALSA SoC amplifier audio driver
//
// Copyright(c) 2024 Realtek Semiconductor Corp.
//
//
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/pm_runtime.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/dmi.h>
#include <linux/firmware.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <sound/sdw.h>
#include "rt1320-sdw.h"

/*
 * The 'blind writes' is an SDCA term to deal with platform-specific initialization.
 * It might include vendor-specific or SDCA control registers.
 */
static const struct reg_sequence rt1320_blind_write[] =;

/*
 * The 'patch code' is written to the patch code area.
 * The patch code area is used for SDCA register expansion flexibility.
 */
static const struct reg_sequence rt1320_patch_code_write[] =;

static const struct reg_default rt1320_reg_defaults[] =;

static const struct reg_default rt1320_mbq_defaults[] =;

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

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

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

static const struct regmap_config rt1320_sdw_regmap =;

static const struct regmap_config rt1320_mbq_regmap =;

static int rt1320_read_prop(struct sdw_slave *slave)
{}

static int rt1320_io_init(struct device *dev, struct sdw_slave *slave)
{}

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

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

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

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

static const char * const rt1320_rx_data_ch_select[] =;

static SOC_ENUM_SINGLE_DECL(rt1320_rx_data_ch_enum,
	SDW_SDCA_CTL(FUNC_NUM_AMP, RT1320_SDCA_ENT_PPU21, RT1320_SDCA_CTL_POSTURE_NUMBER, 0), 0,
	rt1320_rx_data_ch_select);

static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -6525, 75, 0);

static const struct snd_kcontrol_new rt1320_snd_controls[] =;

static const struct snd_kcontrol_new rt1320_spk_l_dac =;
static const struct snd_kcontrol_new rt1320_spk_r_dac =;

static const struct snd_soc_dapm_widget rt1320_dapm_widgets[] =;

static const struct snd_soc_dapm_route rt1320_dapm_routes[] =;

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

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

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

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

/*
 * slave_ops: callbacks for get_clock_stop_mode, clock_stop and
 * port_prep are not defined for now
 */
static const struct sdw_slave_ops rt1320_slave_ops =;

static int rt1320_sdw_component_probe(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_component_sdw_rt1320 =;

static const struct snd_soc_dai_ops rt1320_aif_dai_ops =;

#define RT1320_STEREO_RATES
#define RT1320_FORMATS

static struct snd_soc_dai_driver rt1320_sdw_dai[] =;

static int rt1320_sdw_init(struct device *dev, struct regmap *regmap,
				struct regmap *mbq_regmap, struct sdw_slave *slave)
{}

static int rt1320_sdw_probe(struct sdw_slave *slave,
				const struct sdw_device_id *id)
{}

static int rt1320_sdw_remove(struct sdw_slave *slave)
{}

/*
 * Version A/B will use the class id 0
 * The newer version than A/B will use the class id 1, so add it in advance
 */
static const struct sdw_device_id rt1320_id[] =;
MODULE_DEVICE_TABLE(sdw, rt1320_id);

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

#define RT1320_PROBE_TIMEOUT

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

static const struct dev_pm_ops rt1320_pm =;

static struct sdw_driver rt1320_sdw_driver =;
module_sdw_driver();

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