__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
/* SPDX-License-Identifier: GPL-2.0
 *
 * simple_card_utils.h
 *
 * Copyright (c) 2016 Kuninori Morimoto <[email protected]>
 */

#ifndef __SIMPLE_CARD_UTILS_H
#define __SIMPLE_CARD_UTILS_H

#include <linux/clk.h>
#include <sound/soc.h>

#define simple_util_init_hp(card, sjack, prefix)		\
	simple_util_init_jack(card, sjack, 1, prefix, NULL)
#define simple_util_init_mic(card, sjack, prefix)		\
	simple_util_init_jack(card, sjack, 0, prefix, NULL)

struct simple_util_tdm_width_map {
	u8 sample_bits;
	u8 slot_count;
	u16 slot_width;
};

struct simple_util_dai {
	const char *name;
	unsigned int sysclk;
	int clk_direction;
	int slots;
	int slot_width;
	unsigned int tx_slot_mask;
	unsigned int rx_slot_mask;
	struct clk *clk;
	bool clk_fixed;
	struct simple_util_tdm_width_map *tdm_width_map;
	int n_tdm_widths;
};

struct simple_util_data {
	u32 convert_rate;
	u32 convert_channels;
	const char *convert_sample_format;
};

struct simple_util_jack {
	struct snd_soc_jack jack;
	struct snd_soc_jack_pin pin;
	struct snd_soc_jack_gpio gpio;
};

struct prop_nums {
	int cpus;
	int codecs;
	int platforms;
};

struct simple_util_priv {
	struct snd_soc_card snd_card;
	struct simple_dai_props {
		struct simple_util_dai *cpu_dai;
		struct simple_util_dai *codec_dai;
		struct simple_util_data adata;
		struct snd_soc_codec_conf *codec_conf;
		struct prop_nums num;
		unsigned int mclk_fs;
	} *dai_props;
	struct simple_util_jack hp_jack;
	struct simple_util_jack mic_jack;
	struct snd_soc_jack *aux_jacks;
	struct snd_soc_dai_link *dai_link;
	struct simple_util_dai *dais;
	struct snd_soc_dai_link_component *dlcs;
	struct snd_soc_codec_conf *codec_conf;
	struct gpio_desc *pa_gpio;
	const struct snd_soc_ops *ops;
	unsigned int dpcm_selectable:1;
	unsigned int force_dpcm:1;
};
#define simple_priv_to_card(priv)	(&(priv)->snd_card)
#define simple_priv_to_props(priv, i)	((priv)->dai_props + (i))
#define simple_priv_to_dev(priv)	(simple_priv_to_card(priv)->dev)
#define simple_priv_to_link(priv, i)	(simple_priv_to_card(priv)->dai_link + (i))

#define simple_props_to_dlc_cpu(props, i)	((props)->cpus + i)
#define simple_props_to_dlc_codec(props, i)	((props)->codecs + i)
#define simple_props_to_dlc_platform(props, i)	((props)->platforms + i)

#define simple_props_to_dai_cpu(props, i)	((props)->cpu_dai + i)
#define simple_props_to_dai_codec(props, i)	((props)->codec_dai + i)
#define simple_props_to_codec_conf(props, i)	((props)->codec_conf + i)

/* has the same effect as simple_priv_to_props(). Preferred over
 * simple_priv_to_props() when dealing with PCM runtime data as
 * the ID stored in rtd->id may not be a valid array index.
 */
#define runtime_simple_priv_to_props(priv, rtd)				\
	((priv)->dai_props + ((rtd)->dai_link - (priv)->dai_link))

#define for_each_prop_dlc_cpus(props, i, cpu)				\
	for ((i) = 0;							\
	     ((i) < (props)->num.cpus) &&				\
		     ((cpu) = simple_props_to_dlc_cpu(props, i));	\
	     (i)++)
#define for_each_prop_dlc_codecs(props, i, codec)			\
	for ((i) = 0;							\
	     ((i) < (props)->num.codecs) &&				\
		     ((codec) = simple_props_to_dlc_codec(props, i));	\
	     (i)++)
#define for_each_prop_dlc_platforms(props, i, platform)			\
	for ((i) = 0;							\
	     ((i) < (props)->num.platforms) &&				\
		     ((platform) = simple_props_to_dlc_platform(props, i)); \
	     (i)++)
#define for_each_prop_codec_conf(props, i, conf)			\
	for ((i) = 0;							\
	     ((i) < (props)->num.codecs) &&				\
		     (props)->codec_conf &&				\
		     ((conf) = simple_props_to_codec_conf(props, i));	\
	     (i)++)

#define for_each_prop_dai_cpu(props, i, cpu)				\
	for ((i) = 0;							\
	     ((i) < (props)->num.cpus) &&				\
		     ((cpu) = simple_props_to_dai_cpu(props, i));	\
	     (i)++)
#define for_each_prop_dai_codec(props, i, codec)			\
	for ((i) = 0;							\
	     ((i) < (props)->num.codecs) &&				\
		     ((codec) = simple_props_to_dai_codec(props, i));	\
	     (i)++)

#define SNDRV_MAX_LINKS 512

struct link_info {
	int link; /* number of link */
	int cpu;  /* turn for CPU / Codec */
	struct prop_nums num[SNDRV_MAX_LINKS];
};

int simple_util_parse_daifmt(struct device *dev,
			     struct device_node *node,
			     struct device_node *codec,
			     char *prefix,
			     unsigned int *retfmt);
int simple_util_parse_tdm_width_map(struct device *dev, struct device_node *np,
				    struct simple_util_dai *dai);

__printf(3, 4)
int simple_util_set_dailink_name(struct device *dev,
				 struct snd_soc_dai_link *dai_link,
				 const char *fmt, ...);
int simple_util_parse_card_name(struct snd_soc_card *card,
				char *prefix);

int simple_util_parse_clk(struct device *dev,
			  struct device_node *node,
			  struct simple_util_dai *simple_dai,
			  struct snd_soc_dai_link_component *dlc);
int simple_util_startup(struct snd_pcm_substream *substream);
void simple_util_shutdown(struct snd_pcm_substream *substream);
int simple_util_hw_params(struct snd_pcm_substream *substream,
			  struct snd_pcm_hw_params *params);
int simple_util_dai_init(struct snd_soc_pcm_runtime *rtd);
int simple_util_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
				   struct snd_pcm_hw_params *params);

#define simple_util_parse_tdm(np, dai)				\
	snd_soc_of_parse_tdm_slot(np,	&(dai)->tx_slot_mask,	\
					&(dai)->rx_slot_mask,	\
					&(dai)->slots,		\
					&(dai)->slot_width);

void simple_util_canonicalize_platform(struct snd_soc_dai_link_component *platforms,
				       struct snd_soc_dai_link_component *cpus);
void simple_util_canonicalize_cpu(struct snd_soc_dai_link_component *cpus,
				  int is_single_links);

void simple_util_clean_reference(struct snd_soc_card *card);

void simple_util_parse_convert(struct device_node *np, char *prefix,
			       struct simple_util_data *data);
bool simple_util_is_convert_required(const struct simple_util_data *data);

int simple_util_get_sample_fmt(struct simple_util_data *data);

int simple_util_parse_routing(struct snd_soc_card *card,
				      char *prefix);
int simple_util_parse_widgets(struct snd_soc_card *card,
				      char *prefix);
int simple_util_parse_pin_switches(struct snd_soc_card *card,
				   char *prefix);

int simple_util_init_jack(struct snd_soc_card *card,
			       struct simple_util_jack *sjack,
			       int is_hp, char *prefix, char *pin);
int simple_util_init_aux_jacks(struct simple_util_priv *priv,
				char *prefix);
int simple_util_init_priv(struct simple_util_priv *priv,
			       struct link_info *li);
void simple_util_remove(struct platform_device *pdev);

int graph_util_card_probe(struct snd_soc_card *card);
int graph_util_is_ports0(struct device_node *port);
int graph_util_parse_dai(struct device *dev, struct device_node *ep,
			 struct snd_soc_dai_link_component *dlc, int *is_single_link);

void graph_util_parse_link_direction(struct device_node *np,
				    bool *is_playback_only, bool *is_capture_only);
void graph_util_parse_trigger_order(struct simple_util_priv *priv,
				    struct device_node *np,
				    enum snd_soc_trigger_order *trigger_start,
				    enum snd_soc_trigger_order *trigger_stop);

#ifdef DEBUG
static inline void simple_util_debug_dai(struct simple_util_priv *priv,
					 char *name,
					 struct simple_util_dai *dai)
{
	struct device *dev = simple_priv_to_dev(priv);

	/* dai might be NULL */
	if (!dai)
		return;

	if (dai->name)
		dev_dbg(dev, "%s dai name = %s\n",
			name, dai->name);

	if (dai->slots)
		dev_dbg(dev, "%s slots = %d\n", name, dai->slots);
	if (dai->slot_width)
		dev_dbg(dev, "%s slot width = %d\n", name, dai->slot_width);
	if (dai->tx_slot_mask)
		dev_dbg(dev, "%s tx slot mask = %d\n", name, dai->tx_slot_mask);
	if (dai->rx_slot_mask)
		dev_dbg(dev, "%s rx slot mask = %d\n", name, dai->rx_slot_mask);
	if (dai->clk)
		dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk));
	if (dai->sysclk)
		dev_dbg(dev, "%s sysclk = %dHz\n",
			name, dai->sysclk);
	if (dai->clk || dai->sysclk)
		dev_dbg(dev, "%s direction = %s\n",
			name, dai->clk_direction ? "OUT" : "IN");
}

static inline void simple_util_debug_info(struct simple_util_priv *priv)
{
	struct snd_soc_card *card = simple_priv_to_card(priv);
	struct device *dev = simple_priv_to_dev(priv);

	int i;

	if (card->name)
		dev_dbg(dev, "Card Name: %s\n", card->name);

	for (i = 0; i < card->num_links; i++) {
		struct simple_dai_props *props = simple_priv_to_props(priv, i);
		struct snd_soc_dai_link *link = simple_priv_to_link(priv, i);
		struct simple_util_dai *dai;
		struct snd_soc_codec_conf *cnf;
		int j;

		dev_dbg(dev, "DAI%d\n", i);

		dev_dbg(dev, "cpu num = %d\n", link->num_cpus);
		for_each_prop_dai_cpu(props, j, dai)
			simple_util_debug_dai(priv, "cpu", dai);
		dev_dbg(dev, "codec num = %d\n", link->num_codecs);
		for_each_prop_dai_codec(props, j, dai)
			simple_util_debug_dai(priv, "codec", dai);

		if (link->name)
			dev_dbg(dev, "link name = %s\n", link->name);
		if (link->dai_fmt)
			dev_dbg(dev, "link format = %04x\n", link->dai_fmt);
		if (link->playback_only)
			dev_dbg(dev, "link has playback_only");
		if (link->capture_only)
			dev_dbg(dev, "link has capture_only");
		if (props->adata.convert_rate)
			dev_dbg(dev, "convert_rate = %d\n", props->adata.convert_rate);
		if (props->adata.convert_channels)
			dev_dbg(dev, "convert_channels = %d\n", props->adata.convert_channels);
		for_each_prop_codec_conf(props, j, cnf)
			if (cnf->name_prefix)
				dev_dbg(dev, "name prefix = %s\n", cnf->name_prefix);
		if (props->mclk_fs)
			dev_dbg(dev, "mclk-fs = %d\n", props->mclk_fs);
	}
}
#else
#define  simple_util_debug_info(priv)
#endif /* DEBUG */

#endif /* __SIMPLE_CARD_UTILS_H */

Filemanager

Name Type Size Permission Actions
ac97 Folder 0755
sof Folder 0755
ac97_codec.h File 15.8 KB 0644
aci.h File 2.42 KB 0644
acp63_chip_offset_byte.h File 29.75 KB 0644
ad1816a.h File 4.73 KB 0644
ad1843.h File 1.48 KB 0644
ak4113.h File 10.22 KB 0644
ak4114.h File 9.54 KB 0644
ak4117.h File 8.34 KB 0644
ak4531_codec.h File 2.56 KB 0644
ak4641.h File 476 B 0644
ak4xxx-adda.h File 2.66 KB 0644
alc5623.h File 536 B 0644
asequencer.h File 3.06 KB 0644
asound.h File 590 B 0644
asoundef.h File 16.27 KB 0644
compress_driver.h File 9.49 KB 0644
control.h File 10.56 KB 0644
core.h File 14.07 KB 0644
cs-amp-lib.h File 1.69 KB 0644
cs35l33.h File 888 B 0644
cs35l34.h File 741 B 0644
cs35l35.h File 2.21 KB 0644
cs35l36.h File 772 B 0644
cs35l41.h File 34.33 KB 0644
cs35l56.h File 11.72 KB 0644
cs4231-regs.h File 7.6 KB 0644
cs4271.h File 906 B 0644
cs42l42.h File 34.47 KB 0644
cs42l43.h File 385 B 0644
cs42l52.h File 592 B 0644
cs42l56.h File 1.02 KB 0644
cs42l73.h File 361 B 0644
cs8403.h File 7.95 KB 0644
cs8427.h File 9.72 KB 0644
da7213.h File 1.01 KB 0644
da7218.h File 2.41 KB 0644
da7219-aad.h File 2.37 KB 0644
da7219.h File 998 B 0644
da9055.h File 707 B 0644
designware_i2s.h File 1.66 KB 0644
dmaengine_pcm.h File 6.78 KB 0644
emu10k1.h File 94.74 KB 0644
emu10k1_synth.h File 693 B 0644
emu8000.h File 3.25 KB 0644
emu8000_reg.h File 9.54 KB 0644
emux_legacy.h File 4.7 KB 0644
emux_synth.h File 6.78 KB 0644
es1688.h File 2.88 KB 0644
graph_card.h File 1.04 KB 0644
gus.h File 19.65 KB 0644
hda-mlink.h File 6.32 KB 0644
hda_chmap.h File 2.6 KB 0644
hda_codec.h File 17.49 KB 0644
hda_component.h File 2.04 KB 0644
hda_hwdep.h File 736 B 0644
hda_i915.h File 589 B 0644
hda_register.h File 11.98 KB 0644
hda_regmap.h File 6.77 KB 0644
hda_verbs.h File 16.88 KB 0644
hdaudio.h File 24.57 KB 0644
hdaudio_ext.h File 4.84 KB 0644
hdmi-codec.h File 3.01 KB 0644
hwdep.h File 1.88 KB 0644
i2c.h File 2.79 KB 0644
info.h File 7.75 KB 0644
initval.h File 2.43 KB 0644
intel-dsp-config.h File 896 B 0644
intel-nhlt.h File 4.01 KB 0644
jack.h File 3.1 KB 0644
madera-pdata.h File 1.95 KB 0644
max9768.h File 544 B 0644
max98088.h File 1.05 KB 0644
max98090.h File 534 B 0644
max98095.h File 1.33 KB 0644
memalloc.h File 3.62 KB 0644
minors.h File 3.65 KB 0644
mixer_oss.h File 1.73 KB 0644
mpu401.h File 3.81 KB 0644
omap-hdmi-audio.h File 971 B 0644
opl3.h File 11.62 KB 0644
opl4.h File 459 B 0644
pcm-indirect.h File 5.18 KB 0644
pcm.h File 53.57 KB 0644
pcm_drm_eld.h File 183 B 0644
pcm_iec958.h File 597 B 0644
pcm_oss.h File 2.01 KB 0644
pcm_params.h File 8.72 KB 0644
pt2258.h File 513 B 0644
pxa2xx-lib.h File 2.25 KB 0644
rawmidi.h File 6.37 KB 0644
rt1015.h File 283 B 0644
rt1318.h File 303 B 0644
rt286.h File 314 B 0644
rt298.h File 373 B 0644
rt5514.h File 399 B 0644
rt5659.h File 880 B 0644
rt5660.h File 578 B 0644
rt5663.h File 476 B 0644
rt5665.h File 723 B 0644
rt5668.h File 607 B 0644
rt5682.h File 862 B 0644
rt5682s.h File 1.01 KB 0644
sb.h File 10.43 KB 0644
sb16_csp.h File 2.05 KB 0644
sdca.h File 1.66 KB 0644
sdca_function.h File 3.05 KB 0644
sdw.h File 1.63 KB 0644
seq_device.h File 2.16 KB 0644
seq_kernel.h File 3.51 KB 0644
seq_midi_emul.h File 6.6 KB 0644
seq_midi_event.h File 1.32 KB 0644
seq_oss.h File 2.21 KB 0644
seq_oss_legacy.h File 360 B 0644
seq_virmidi.h File 2.07 KB 0644
sh_dac_audio.h File 441 B 0644
sh_fsi.h File 693 B 0644
simple_card.h File 524 B 0644
simple_card_utils.h File 9.38 KB 0644
snd_wavefront.h File 5.49 KB 0644
soc-acpi-intel-match.h File 2.61 KB 0644
soc-acpi-intel-ssp-common.h File 1.88 KB 0644
soc-acpi.h File 8.46 KB 0644
soc-card.h File 3.45 KB 0644
soc-component.h File 20.23 KB 0644
soc-dai.h File 20.72 KB 0644
soc-dapm.h File 33.46 KB 0644
soc-dpcm.h File 4.82 KB 0644
soc-jack.h File 3.68 KB 0644
soc-link.h File 1.14 KB 0644
soc-topology.h File 5.75 KB 0644
soc.h File 54.82 KB 0644
soc_sdw_utils.h File 9.05 KB 0644
sof.h File 4.58 KB 0644
soundfont.h File 3.86 KB 0644
spear_dma.h File 350 B 0644
spear_spdif.h File 345 B 0644
sta32x.h File 1015 B 0644
sta350.h File 1.44 KB 0644
tas2552-plat.h File 283 B 0644
tas2563-tlv.h File 11.37 KB 0644
tas2781-dsp.h File 4.85 KB 0644
tas2781-tlv.h File 594 B 0644
tas2781.h File 7.98 KB 0644
tas5086.h File 210 B 0644
tea6330t.h File 468 B 0644
timer.h File 4.99 KB 0644
tlv.h File 1.59 KB 0644
tlv320aic32x4.h File 1.29 KB 0644
tlv320dac33-plat.h File 574 B 0644
tpa6130a2-plat.h File 291 B 0644
uda1380.h File 335 B 0644
ump.h File 8.24 KB 0644
ump_convert.h File 1.25 KB 0644
ump_msg.h File 13.81 KB 0644
util_mem.h File 1.58 KB 0644
vx_core.h File 14.68 KB 0644
wavefront.h File 16.32 KB 0644
wm0010.h File 321 B 0644
wm2000.h File 479 B 0644
wm2200.h File 1.21 KB 0644
wm5100.h File 935 B 0644
wm8903.h File 15.02 KB 0644
wm8904.h File 7.22 KB 0644
wm8955.h File 442 B 0644
wm8960.h File 888 B 0644
wm8962.h File 1.65 KB 0644
wm8993.h File 1.05 KB 0644
wm8996.h File 1.19 KB 0644
wm9081.h File 515 B 0644
wm9090.h File 634 B 0644
wss.h File 7.76 KB 0644
Filemanager