linux/sound/soc/codecs/rtq9128.c

// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright (c) 2023 Richtek Technology Corp.
//
// Author: ChiYuan Huang <[email protected]>
//

#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>

#define RTQ9128_REG_SDI_SEL
#define RTQ9128_REG_SDO_SEL
#define RTQ9128_REG_I2S_OPT
#define RTQ9128_REG_MISC
#define RTQ9128_REG_STATE_CTRL
#define RTQ9128_REG_PLLTRI_GEN1
#define RTQ9128_REG_PLLTRI_GEN2
#define RTQ9128_REG_PWM_SS_OPT
#define RTQ9128_REG_DSP_EN
#define RTQ9128_REG_TDM_TX_CH1
#define RTQ9128_REG_TDM_RX_CH1
#define RTQ9128_REG_MS_VOL
#define RTQ9128_REG_CH1_VOL
#define RTQ9128_REG_CH2_VOL
#define RTQ9128_REG_CH3_VOL
#define RTQ9128_REG_CH4_VOL
#define RTQ9128_REG_PROT_OPT
#define RTQ9128_REG_EFUSE_DATA
#define RTQ9128_REG_VENDOR_ID

#define RTQ9128_CHSTAT_VAL_MASK
#define RTQ9128_DOLEN_MASK
#define RTQ9128_TDMSRCIN_MASK
#define RTQ9128_AUDBIT_MASK
#define RTQ9128_AUDFMT_MASK
#define RTQ9128_MSMUTE_MASK
#define RTQ9128_DIE_CHECK_MASK
#define RTQ9128_VENDOR_ID_MASK

#define RTQ9128_SOFT_RESET_VAL
#define RTQ9128_VENDOR_ID_VAL
#define RTQ9128_ALLCH_HIZ_VAL
#define RTQ9128_ALLCH_ULQM_VAL
#define RTQ9128_TKA470B_VAL
#define RTQ9128_RTQ9128DH_VAL
#define RTQ9128_RTQ9128DL_VAL

struct rtq9128_data {};

struct rtq9128_init_reg {};

static int rtq9128_get_reg_size(unsigned int reg)
{}

static int rtq9128_i2c_write(void *context, const void *data, size_t count)
{}

static int rtq9128_i2c_read(void *context, const void *reg_buf, size_t reg_size, void *val_buf,
			    size_t val_size)
{}

static const struct regmap_bus rtq9128_regmap_bus =;

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

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

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

static const struct regmap_config rtq9128_regmap_config =;

static const DECLARE_TLV_DB_SCALE(dig_tlv, -10375, 25, 0);

static const DECLARE_TLV_DB_RANGE(spkgain_tlv,
	0, 3, TLV_DB_SCALE_ITEM(-600, 600, 0),
	4, 5, TLV_DB_SCALE_ITEM(1500, 300, 0),
);

static const char * const source_select_text[] =;
static const char * const pwmfreq_select_text[] =;
static const char * const phase_select_text[] =;
static const char * const dvdduv_select_text[] =;

static const struct soc_enum rtq9128_ch1_si_enum =;
static const struct soc_enum rtq9128_ch2_si_enum =;
static const struct soc_enum rtq9128_ch3_si_enum =;
static const struct soc_enum rtq9128_ch4_si_enum =;
static const struct soc_enum rtq9128_pwm_freq_enum =;
static const struct soc_enum rtq9128_out2_phase_enum =;
static const struct soc_enum rtq9128_out3_phase_enum =;
static const struct soc_enum rtq9128_out4_phase_enum =;

/*
 * In general usage, DVDD could be 1P8V, 3P0V or 3P3V.
 * This DVDD undervoltage protection is to prevent from the abnormal power
 * lose case while the amplifier is operating. Due to the different DVDD
 * application, treat this threshold as a user choosable option.
 */
static const struct soc_enum rtq9128_dvdduv_select_enum =;

static const struct snd_kcontrol_new rtq9128_snd_ctrls[] =;

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

static const struct snd_soc_dapm_widget rtq9128_dapm_widgets[] =;

static const struct snd_soc_dapm_route rtq9128_dapm_routes[] =;

static const struct rtq9128_init_reg rtq9128_tka470b_tables[] =;

static const struct rtq9128_init_reg rtq9128_dh_tables[] =;

static const struct rtq9128_init_reg rtq9128_dl_tables[] =;

static int rtq9128_component_probe(struct snd_soc_component *comp)
{}

static const struct snd_soc_component_driver rtq9128_comp_driver =;

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

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

static int rtq9128_dai_hw_params(struct snd_pcm_substream *stream, struct snd_pcm_hw_params *param,
				 struct snd_soc_dai *dai)
{}

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

static const struct snd_soc_dai_ops rtq9128_dai_ops =;

#define RTQ9128_FMTS_MASK

static struct snd_soc_dai_driver rtq9128_dai =;

static int rtq9128_probe(struct i2c_client *i2c)
{}

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

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

static const struct dev_pm_ops __maybe_unused rtq9128_pm_ops =;

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

static struct i2c_driver rtq9128_driver =;
module_i2c_driver();

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