linux/sound/soc/codecs/tas2552.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * tas2552.c - ALSA SoC Texas Instruments TAS2552 Mono Audio Amplifier
 *
 * Copyright (C) 2014 - 2024 Texas Instruments Incorporated -
 *	https://www.ti.com
 *
 * Author: Dan Murphy <[email protected]>
 */

#include <linux/module.h>
#include <linux/errno.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/slab.h>

#include <linux/gpio/consumer.h>
#include <linux/regulator/consumer.h>

#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h>
#include <sound/tas2552-plat.h>
#include <dt-bindings/sound/tas2552.h>

#include "tas2552.h"

static const struct reg_default tas2552_reg_defs[] =;

#define TAS2552_NUM_SUPPLIES
static const char *tas2552_supply_names[TAS2552_NUM_SUPPLIES] =;

struct tas2552_data {};

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

/* Input mux controls */
static const char * const tas2552_input_texts[] =;
static SOC_ENUM_SINGLE_DECL(tas2552_input_mux_enum, TAS2552_CFG_3, 7,
			    tas2552_input_texts);

static const struct snd_kcontrol_new tas2552_input_mux_control =;

static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] =;

static const struct snd_soc_dapm_route tas2552_audio_map[] =;

#ifdef CONFIG_PM
static void tas2552_sw_shutdown(struct tas2552_data *tas2552, int sw_shutdown)
{}
#endif

static int tas2552_setup_pll(struct snd_soc_component *component,
			     struct snd_pcm_hw_params *params)
{}

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

#define TAS2552_DAI_FMT_MASK
static int tas2552_prepare(struct snd_pcm_substream *substream,
			   struct snd_soc_dai *dai)
{}

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

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

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

static int tas2552_mute(struct snd_soc_dai *dai, int mute, int direction)
{}

#ifdef CONFIG_PM
static int tas2552_runtime_suspend(struct device *dev)
{}

static int tas2552_runtime_resume(struct device *dev)
{}
#endif

static const struct dev_pm_ops tas2552_pm =;

static const struct snd_soc_dai_ops tas2552_speaker_dai_ops =;

/* Formats supported by TAS2552 driver. */
#define TAS2552_FORMATS

/* TAS2552 dai structure. */
static struct snd_soc_dai_driver tas2552_dai[] =;

/*
 * DAC digital volumes. From -7 to 24 dB in 1 dB steps
 */
static DECLARE_TLV_DB_SCALE(dac_tlv, -700, 100, 0);

static const char * const tas2552_din_source_select[] =;
static SOC_ENUM_SINGLE_DECL(tas2552_din_source_enum,
			    TAS2552_CFG_3, 3,
			    tas2552_din_source_select);

static const struct snd_kcontrol_new tas2552_snd_controls[] =;

static int tas2552_component_probe(struct snd_soc_component *component)
{}

static void tas2552_component_remove(struct snd_soc_component *component)
{
	struct tas2552_data *tas2552 = snd_soc_component_get_drvdata(component);

	pm_runtime_put(component->dev);

	gpiod_set_value(tas2552->enable_gpio, 0);
};

#ifdef CONFIG_PM
static int tas2552_suspend(struct snd_soc_component *component)
{}

static int tas2552_resume(struct snd_soc_component *component)
{}
#else
#define tas2552_suspend
#define tas2552_resume
#endif

static const struct snd_soc_component_driver soc_component_dev_tas2552 =;

static const struct regmap_config tas2552_regmap_config =;

static int tas2552_probe(struct i2c_client *client)
{}

static void tas2552_i2c_remove(struct i2c_client *client)
{}

static const struct i2c_device_id tas2552_id[] =;
MODULE_DEVICE_TABLE(i2c, tas2552_id);

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

static struct i2c_driver tas2552_i2c_driver =;

module_i2c_driver();

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