Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
90de551
Documentation
LICENSES
arch
block
certs
crypto
drivers
fs
include
acpi
asm-generic
clocksource
crypto
drm
dt-bindings
keys
kunit
kvm
linux
math-emu
media
memory
misc
net
pcmcia
ras
rdma
rv
scsi
soc
sound
ac97
sof
ac97_codec.h
aci.h
acp63_chip_offset_byte.h
ad1816a.h
ad1843.h
adau1373.h
ak4113.h
ak4114.h
ak4117.h
ak4531_codec.h
ak4641.h
ak4xxx-adda.h
alc5623.h
asequencer.h
asound.h
asoundef.h
compress_driver.h
control.h
core.h
cs35l33.h
cs35l34.h
cs35l35.h
cs35l36.h
cs35l41.h
cs35l56.h
cs4231-regs.h
cs4271.h
cs42l42.h
cs42l52.h
cs42l56.h
cs42l73.h
cs8403.h
cs8427.h
da7213.h
da7218.h
da7219-aad.h
da7219.h
da9055.h
designware_i2s.h
dmaengine_pcm.h
emu10k1.h
emu10k1_synth.h
emu8000.h
emu8000_reg.h
emux_legacy.h
emux_synth.h
es1688.h
graph_card.h
gus.h
hda-mlink.h
hda_chmap.h
hda_codec.h
hda_component.h
hda_hwdep.h
hda_i915.h
hda_register.h
hda_regmap.h
hda_verbs.h
hdaudio.h
hdaudio_ext.h
hdmi-codec.h
hwdep.h
i2c.h
info.h
initval.h
intel-dsp-config.h
intel-nhlt.h
jack.h
l3.h
madera-pdata.h
max9768.h
max98088.h
max98090.h
max98095.h
memalloc.h
minors.h
mixer_oss.h
mpu401.h
omap-hdmi-audio.h
opl3.h
opl4.h
pcm-indirect.h
pcm.h
pcm_drm_eld.h
pcm_iec958.h
pcm_oss.h
pcm_params.h
pt2258.h
pxa2xx-lib.h
rawmidi.h
rt1015.h
rt286.h
rt298.h
rt5514.h
rt5659.h
rt5660.h
rt5663.h
rt5665.h
rt5668.h
rt5682.h
rt5682s.h
sb.h
sb16_csp.h
sdw.h
seq_device.h
seq_kernel.h
seq_midi_emul.h
seq_midi_event.h
seq_oss.h
seq_oss_legacy.h
seq_virmidi.h
sh_dac_audio.h
sh_fsi.h
simple_card.h
simple_card_utils.h
snd_wavefront.h
soc-acpi-intel-match.h
soc-acpi.h
soc-card.h
soc-component.h
soc-dai.h
soc-dapm.h
soc-dpcm.h
soc-jack.h
soc-link.h
soc-topology.h
soc.h
sof.h
soundfont.h
spear_dma.h
spear_spdif.h
sta32x.h
sta350.h
tas2552-plat.h
tas2781-dsp.h
tas2781-tlv.h
tas2781.h
tas5086.h
tea6330t.h
timer.h
tlv.h
tlv320aic32x4.h
tlv320dac33-plat.h
tpa6130a2-plat.h
uda134x.h
uda1380.h
ump.h
ump_convert.h
ump_msg.h
util_mem.h
vx_core.h
wavefront.h
wm0010.h
wm1250-ev1.h
wm2000.h
wm2200.h
wm5100.h
wm8903.h
wm8904.h
wm8955.h
wm8960.h
wm8962.h
wm8993.h
wm8996.h
wm9081.h
wm9090.h
wss.h
target
trace
uapi
ufs
vdso
video
xen
init
io_uring
ipc
kernel
lib
mm
net
rust
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
include
/
sound
/
simple_card_utils.h
Copy path
Blame
Blame
Latest commit
History
History
276 lines (239 loc) · 8.57 KB
Breadcrumbs
linux
/
include
/
sound
/
simple_card_utils.h
Top
File metadata and controls
Code
Blame
276 lines (239 loc) · 8.57 KB
Raw
/* SPDX-License-Identifier: GPL-2.0 * * simple_card_utils.h * * Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> */ #ifndef __SIMPLE_CARD_UTILS_H #define __SIMPLE_CARD_UTILS_H #include <linux/clk.h> #include <sound/soc.h> #define asoc_simple_init_hp(card, sjack, prefix) \ asoc_simple_init_jack(card, sjack, 1, prefix, NULL) #define asoc_simple_init_mic(card, sjack, prefix) \ asoc_simple_init_jack(card, sjack, 0, prefix, NULL) struct asoc_simple_tdm_width_map { u8 sample_bits; u8 slot_count; u16 slot_width; }; struct asoc_simple_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 asoc_simple_tdm_width_map *tdm_width_map; int n_tdm_widths; }; struct asoc_simple_data { u32 convert_rate; u32 convert_channels; const char *convert_sample_format; }; struct asoc_simple_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 asoc_simple_priv { struct snd_soc_card snd_card; struct simple_dai_props { struct asoc_simple_dai *cpu_dai; struct asoc_simple_dai *codec_dai; struct asoc_simple_data adata; struct snd_soc_codec_conf *codec_conf; struct prop_nums num; unsigned int mclk_fs; } *dai_props; struct asoc_simple_jack hp_jack; struct asoc_simple_jack mic_jack; struct snd_soc_jack *aux_jacks; struct snd_soc_dai_link *dai_link; struct asoc_simple_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) #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 asoc_simple_parse_daifmt(struct device *dev, struct device_node *node, struct device_node *codec, char *prefix, unsigned int *retfmt); int asoc_simple_parse_tdm_width_map(struct device *dev, struct device_node *np, struct asoc_simple_dai *dai); __printf(3, 4) int asoc_simple_set_dailink_name(struct device *dev, struct snd_soc_dai_link *dai_link, const char *fmt, ...); int asoc_simple_parse_card_name(struct snd_soc_card *card, char *prefix); int asoc_simple_parse_clk(struct device *dev, struct device_node *node, struct asoc_simple_dai *simple_dai, struct snd_soc_dai_link_component *dlc); int asoc_simple_startup(struct snd_pcm_substream *substream); void asoc_simple_shutdown(struct snd_pcm_substream *substream); int asoc_simple_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); int asoc_simple_dai_init(struct snd_soc_pcm_runtime *rtd); int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params); #define asoc_simple_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 asoc_simple_canonicalize_platform(struct snd_soc_dai_link_component *platforms, struct snd_soc_dai_link_component *cpus); void asoc_simple_canonicalize_cpu(struct snd_soc_dai_link_component *cpus, int is_single_links); void asoc_simple_clean_reference(struct snd_soc_card *card); void asoc_simple_parse_convert(struct device_node *np, char *prefix, struct asoc_simple_data *data); bool asoc_simple_is_convert_required(const struct asoc_simple_data *data); int asoc_simple_parse_routing(struct snd_soc_card *card, char *prefix); int asoc_simple_parse_widgets(struct snd_soc_card *card, char *prefix); int asoc_simple_parse_pin_switches(struct snd_soc_card *card, char *prefix); int asoc_simple_init_jack(struct snd_soc_card *card, struct asoc_simple_jack *sjack, int is_hp, char *prefix, char *pin); int asoc_simple_init_aux_jacks(struct asoc_simple_priv *priv, char *prefix); int asoc_simple_init_priv(struct asoc_simple_priv *priv, struct link_info *li); int asoc_simple_remove(struct platform_device *pdev); int asoc_graph_card_probe(struct snd_soc_card *card); int asoc_graph_is_ports0(struct device_node *port); int asoc_graph_parse_dai(struct device *dev, struct device_node *ep, struct snd_soc_dai_link_component *dlc, int *is_single_link); #ifdef DEBUG static inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv, char *name, struct asoc_simple_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 asoc_simple_debug_info(struct asoc_simple_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 asoc_simple_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) asoc_simple_debug_dai(priv, "cpu", dai); dev_dbg(dev, "codec num = %d\n", link->num_codecs); for_each_prop_dai_codec(props, j, dai) asoc_simple_debug_dai(priv, "codec", dai); if (link->name) dev_dbg(dev, "dai name = %s\n", link->name); if (link->dai_fmt) dev_dbg(dev, "dai format = %04x\n", link->dai_fmt); 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 asoc_simple_debug_info(priv) #endif /* DEBUG */ #endif /* __SIMPLE_CARD_UTILS_H */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
You can’t perform that action at this time.