linux/sound/soc/codecs/rk3308_codec.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Rockchip RK3308 internal audio codec driver
 *
 * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved.
 * Copyright (c) 2024, Vivax-Metrotech Ltd
 */

#include <linux/clk.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/reset.h>
#include <linux/util_macros.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>

#include "rk3308_codec.h"

#define ADC_LR_GROUP_MAX

#define GRF_CHIP_ID

enum {};

struct rk3308_codec_priv {};

static struct clk_bulk_data rk3308_codec_clocks[] =;

static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_alc_gain_tlv,   -1800, 150, 0);
static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpout_gain_tlv, -3900, 150, 0);
static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpmix_gain_tlv,  -600, 600, 0);

static const DECLARE_TLV_DB_RANGE(rk3308_codec_dac_lineout_gain_tlv,
	0, 0, TLV_DB_SCALE_ITEM(-600, 0, 0),
	1, 1, TLV_DB_SCALE_ITEM(-300, 0, 0),
	2, 2, TLV_DB_SCALE_ITEM(-150, 0, 0),
	3, 3, TLV_DB_SCALE_ITEM(0,    0, 0),
);

static const char * const rk3308_codec_hpf_cutoff_text[] =;

static SOC_ENUM_SINGLE_DECL(rk3308_codec_hpf_cutoff_enum12, RK3308_ADC_DIG_CON04(0), 0,
			    rk3308_codec_hpf_cutoff_text);
static SOC_ENUM_SINGLE_DECL(rk3308_codec_hpf_cutoff_enum34, RK3308_ADC_DIG_CON04(1), 0,
			    rk3308_codec_hpf_cutoff_text);
static SOC_ENUM_SINGLE_DECL(rk3308_codec_hpf_cutoff_enum56, RK3308_ADC_DIG_CON04(2), 0,
			    rk3308_codec_hpf_cutoff_text);
static SOC_ENUM_SINGLE_DECL(rk3308_codec_hpf_cutoff_enum78, RK3308_ADC_DIG_CON04(3), 0,
			    rk3308_codec_hpf_cutoff_text);

static const struct snd_kcontrol_new rk3308_codec_controls[] =;

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

static const struct snd_soc_dapm_widget rk3308_codec_dapm_widgets[] =;

static const struct snd_soc_dapm_route rk3308_codec_dapm_routes[] =;

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

static int rk3308_codec_dac_dig_config(struct rk3308_codec_priv *rk3308,
				       struct snd_pcm_hw_params *params)
{}

static int rk3308_codec_adc_dig_config(struct rk3308_codec_priv *rk3308,
				       struct snd_pcm_hw_params *params)
{}

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

static const struct snd_soc_dai_ops rk3308_codec_dai_ops =;

static struct snd_soc_dai_driver rk3308_codec_dai_driver =;

static void rk3308_codec_reset(struct snd_soc_component *component)
{}

/*
 * Initialize register whose default after HW reset is problematic or which
 * are never modified.
 */
static int rk3308_codec_initialize(struct rk3308_codec_priv *rk3308)
{}

static int rk3308_codec_probe(struct snd_soc_component *component)
{}

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

static const struct snd_soc_component_driver rk3308_codec_component_driver =;

static const struct regmap_config rk3308_codec_regmap_config =;

static int rk3308_codec_get_version(struct rk3308_codec_priv *rk3308)
{}

static int rk3308_codec_set_micbias_level(struct rk3308_codec_priv *rk3308)
{}

static int rk3308_codec_platform_probe(struct platform_device *pdev)
{}

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

static struct platform_driver rk3308_codec_driver =;
module_platform_driver();

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