]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/sound/simple_card_utils.h
x86/cpu: Make alternative_msr_write work for 32-bit code
[mirror_ubuntu-artful-kernel.git] / include / sound / simple_card_utils.h
CommitLineData
abd3147e 1/*
29a43aa9 2 * simple_card_utils.h
abd3147e
KM
3 *
4 * Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
29a43aa9
KM
10#ifndef __SIMPLE_CARD_UTILS_H
11#define __SIMPLE_CARD_UTILS_H
abd3147e
KM
12
13#include <sound/soc.h>
14
cecdef36
KM
15struct asoc_simple_dai {
16 const char *name;
17 unsigned int sysclk;
18 int slots;
19 int slot_width;
20 unsigned int tx_slot_mask;
21 unsigned int rx_slot_mask;
22 struct clk *clk;
23};
24
13bb1cc0
KM
25struct asoc_simple_card_data {
26 u32 convert_rate;
27 u32 convert_channels;
28};
29
abd3147e
KM
30int asoc_simple_card_parse_daifmt(struct device *dev,
31 struct device_node *node,
32 struct device_node *codec,
33 char *prefix,
34 unsigned int *retfmt);
e5668cae 35__printf(3, 4)
1db3312e
KM
36int asoc_simple_card_set_dailink_name(struct device *dev,
37 struct snd_soc_dai_link *dai_link,
38 const char *fmt, ...);
fc55c9b5
KM
39int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
40 char *prefix);
abd3147e 41
e984fd61 42#define asoc_simple_card_parse_clk_cpu(dev, node, dai_link, simple_dai) \
8e166382
KM
43 asoc_simple_card_parse_clk(dev, node, dai_link->cpu_of_node, simple_dai, \
44 dai_link->cpu_dai_name)
e984fd61 45#define asoc_simple_card_parse_clk_codec(dev, node, dai_link, simple_dai) \
8e166382
KM
46 asoc_simple_card_parse_clk(dev, node, dai_link->codec_of_node, simple_dai,\
47 dai_link->codec_dai_name)
e984fd61
KM
48int asoc_simple_card_parse_clk(struct device *dev,
49 struct device_node *node,
bb6fc620 50 struct device_node *dai_of_node,
8e166382
KM
51 struct asoc_simple_dai *simple_dai,
52 const char *name);
891caea4
KM
53int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai);
54void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai);
bb6fc620 55
ae30a694
KM
56#define asoc_simple_card_parse_cpu(node, dai_link, \
57 list_name, cells_name, is_single_link) \
58 asoc_simple_card_parse_dai(node, &dai_link->cpu_of_node, \
59 &dai_link->cpu_dai_name, list_name, cells_name, is_single_link)
60#define asoc_simple_card_parse_codec(node, dai_link, list_name, cells_name) \
61 asoc_simple_card_parse_dai(node, &dai_link->codec_of_node, \
62 &dai_link->codec_dai_name, list_name, cells_name, NULL)
63#define asoc_simple_card_parse_platform(node, dai_link, list_name, cells_name) \
64 asoc_simple_card_parse_dai(node, &dai_link->platform_of_node, \
65 NULL, list_name, cells_name, NULL)
66int asoc_simple_card_parse_dai(struct device_node *node,
67 struct device_node **endpoint_np,
68 const char **dai_name,
69 const char *list_name,
70 const char *cells_name,
71 int *is_single_links);
72
1689333f
KM
73#define asoc_simple_card_parse_graph_cpu(ep, dai_link) \
74 asoc_simple_card_parse_graph_dai(ep, &dai_link->cpu_of_node, \
75 &dai_link->cpu_dai_name)
76#define asoc_simple_card_parse_graph_codec(ep, dai_link) \
77 asoc_simple_card_parse_graph_dai(ep, &dai_link->codec_of_node, \
78 &dai_link->codec_dai_name)
79int asoc_simple_card_parse_graph_dai(struct device_node *ep,
80 struct device_node **endpoint_np,
81 const char **dai_name);
82
e68ba207
KM
83#define asoc_simple_card_of_parse_tdm(np, dai) \
84 snd_soc_of_parse_tdm_slot(np, &(dai)->tx_slot_mask, \
85 &(dai)->rx_slot_mask, \
86 &(dai)->slots, \
87 &(dai)->slot_width);
88
21ba62f8
KM
89int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
90 struct asoc_simple_dai *simple_dai);
c262c9ab
KM
91
92int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
983cebd6
KM
93void asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
94 int is_single_links);
c262c9ab 95
0f4e0711
KM
96int asoc_simple_card_clean_reference(struct snd_soc_card *card);
97
13bb1cc0
KM
98void asoc_simple_card_convert_fixup(struct asoc_simple_card_data *data,
99 struct snd_pcm_hw_params *params);
100void asoc_simple_card_parse_convert(struct device *dev, char *prefix,
101 struct asoc_simple_card_data *data);
102
3296d078
KM
103int asoc_simple_card_of_parse_routing(struct snd_soc_card *card,
104 char *prefix,
105 int optional);
b31f11d0
KM
106int asoc_simple_card_of_parse_widgets(struct snd_soc_card *card,
107 char *prefix);
3296d078 108
29a43aa9 109#endif /* __SIMPLE_CARD_UTILS_H */