linux/sound/soc/codecs/rk817_codec.c

// SPDX-License-Identifier: GPL-2.0
//
// rk817 ALSA SoC Audio driver
//
// Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved.

#include <linux/clk.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/mfd/rk808.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <sound/core.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>

struct rk817_codec_priv {};

/*
 * This sets the codec up with the values defined in the default implementation including the APLL
 * from the Rockchip vendor kernel. I do not know if these values are universal despite differing
 * from the default values defined above and taken from the datasheet, or implementation specific.
 * I don't have another implementation to compare from the Rockchip sources. Hard-coding for now.
 * Additionally, I do not know according to the documentation the units accepted for the clock
 * values, so for the moment those are left unvalidated.
 */

static int rk817_init(struct snd_soc_component *component)
{}

static int rk817_set_component_pll(struct snd_soc_component *component,
		int pll_id, int source, unsigned int freq_in,
		unsigned int freq_out)
{}

/*
 * DDAC/DADC L/R volume setting
 * 0db~-95db, 0.375db/step, for example:
 * 0x00: 0dB
 * 0xff: -95dB
 */

static const DECLARE_TLV_DB_MINMAX(rk817_vol_tlv, -9500, 0);

/*
 * PGA GAIN L/R volume setting
 * 27db~-18db, 3db/step, for example:
 * 0x0: -18dB
 * 0xf: 27dB
 */

static const DECLARE_TLV_DB_MINMAX(rk817_gain_tlv, -1800, 2700);

static const struct snd_kcontrol_new rk817_volume_controls[] =;

/* Since the speaker output and L headphone pin are internally the same, make audio path mutually
 * exclusive with a mux.
 */

static const char *dac_mux_text[] =;

static SOC_ENUM_SINGLE_VIRT_DECL(dac_enum, dac_mux_text);

static const struct snd_kcontrol_new dac_mux =;

static const struct snd_soc_dapm_widget rk817_dapm_widgets[] =;

static const struct snd_soc_dapm_route rk817_dapm_routes[] =;

static int rk817_set_dai_sysclk(struct snd_soc_dai *codec_dai,
				int clk_id, unsigned int freq, int dir)
{}

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

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

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

#define RK817_PLAYBACK_RATES

#define RK817_CAPTURE_RATES

#define RK817_FORMATS

static const struct snd_soc_dai_ops rk817_dai_ops =;

static struct snd_soc_dai_driver rk817_dai[] =;

static int rk817_probe(struct snd_soc_component *component)
{}

static void rk817_remove(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver soc_codec_dev_rk817 =;

static void rk817_codec_parse_dt_property(struct device *dev,
					 struct rk817_codec_priv *rk817)
{}

static int rk817_platform_probe(struct platform_device *pdev)
{}

static void rk817_platform_remove(struct platform_device *pdev)
{}

static struct platform_driver rk817_codec_driver =;

module_platform_driver();

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