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

// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2020, Maxim Integrated

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/sdw.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include <linux/of.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h>
#include <linux/soundwire/sdw_registers.h>
#include "max98373.h"
#include "max98373-sdw.h"

static const u32 max98373_sdw_cache_reg[] =;

static struct reg_default max98373_reg[] =;

static bool max98373_readable_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case MAX98373_R21FF_REV_ID:
	case MAX98373_R2010_IRQ_CTRL:
	/* SoundWire Control Port Registers */
	case MAX98373_R0040_SCP_INIT_STAT_1 ... MAX98373_R0070_SCP_FRAME_CTLR:
	/* Soundwire Data Port 1 Registers */
	case MAX98373_R0100_DP1_INIT_STAT ... MAX98373_R0137_DP1_BLOCK_CTRL3:
	/* Soundwire Data Port 3 Registers */
	case MAX98373_R0300_DP3_INIT_STAT ... MAX98373_R0337_DP3_BLOCK_CTRL3:
	case MAX98373_R2000_SW_RESET ... MAX98373_R200C_INT_EN3:
	case MAX98373_R2014_THERM_WARN_THRESH
		... MAX98373_R2018_THERM_FOLDBACK_EN:
	case MAX98373_R201E_PIN_DRIVE_STRENGTH
		... MAX98373_R2036_SOUNDWIRE_CTRL:
	case MAX98373_R203D_AMP_DIG_VOL_CTRL ... MAX98373_R2043_AMP_EN:
	case MAX98373_R2046_IV_SENSE_ADC_DSP_CFG
		... MAX98373_R2047_IV_SENSE_ADC_EN:
	case MAX98373_R2051_MEAS_ADC_SAMPLING_RATE
		... MAX98373_R2056_MEAS_ADC_PVDD_CH_EN:
	case MAX98373_R2090_BDE_LVL_HOLD ... MAX98373_R2092_BDE_CLIPPER_MODE:
	case MAX98373_R2097_BDE_L1_THRESH
		... MAX98373_R209B_BDE_THRESH_HYST:
	case MAX98373_R20A8_BDE_L1_CFG_1 ... MAX98373_R20B3_BDE_L4_CFG_3:
	case MAX98373_R20B5_BDE_EN ... MAX98373_R20B6_BDE_CUR_STATE_READBACK:
	case MAX98373_R20D1_DHT_CFG ... MAX98373_R20D4_DHT_EN:
	case MAX98373_R20E0_LIMITER_THRESH_CFG ... MAX98373_R20E2_LIMITER_EN:
	case MAX98373_R20FE_DEVICE_AUTO_RESTART_CFG
		... MAX98373_R20FF_GLOBAL_SHDN:
		return true;
	default:
		return false;
	}
};

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

static const struct regmap_config max98373_sdw_regmap =;

/* Power management functions and structure */
static __maybe_unused int max98373_suspend(struct device *dev)
{}

#define MAX98373_PROBE_TIMEOUT

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

static const struct dev_pm_ops max98373_pm =;

static int max98373_read_prop(struct sdw_slave *slave)
{}

static int max98373_io_init(struct sdw_slave *slave)
{}

static int max98373_clock_calculate(struct sdw_slave *slave,
				    unsigned int clk_freq)
{}

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

#define MAX98373_RATES
#define MAX98373_FORMATS

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

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

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

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

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

static const struct snd_soc_dai_ops max98373_dai_sdw_ops =;

static struct snd_soc_dai_driver max98373_sdw_dai[] =;

static int max98373_init(struct sdw_slave *slave, struct regmap *regmap)
{}

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

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

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

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

static int max98373_sdw_remove(struct sdw_slave *slave)
{}

#if defined(CONFIG_OF)
static const struct of_device_id max98373_of_match[] =;
MODULE_DEVICE_TABLE(of, max98373_of_match);
#endif

#ifdef CONFIG_ACPI
static const struct acpi_device_id max98373_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, max98373_acpi_match);
#endif

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

static struct sdw_driver max98373_sdw_driver =;

module_sdw_driver();

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