blob: af58d236297554dc2ad87bcd9b6424fc59676d7a [file] [log] [blame]
Kuninori Morimotoabd31472016-05-31 09:00:14 +00001/*
Kuninori Morimoto29a43aa2016-12-02 05:27:30 +00002 * simple_card_utils.h
Kuninori Morimotoabd31472016-05-31 09:00:14 +00003 *
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 */
Kuninori Morimoto29a43aa2016-12-02 05:27:30 +000010#ifndef __SIMPLE_CARD_UTILS_H
11#define __SIMPLE_CARD_UTILS_H
Kuninori Morimotoabd31472016-05-31 09:00:14 +000012
13#include <sound/soc.h>
14
Kuninori Morimotocecdef32016-06-30 06:02:46 +000015struct 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
Kuninori Morimotoabd31472016-05-31 09:00:14 +000025int asoc_simple_card_parse_daifmt(struct device *dev,
26 struct device_node *node,
27 struct device_node *codec,
28 char *prefix,
29 unsigned int *retfmt);
Nicolas Ioosse5668ca2016-08-23 10:51:22 +020030__printf(3, 4)
Kuninori Morimoto1db33122016-07-11 23:57:14 +000031int asoc_simple_card_set_dailink_name(struct device *dev,
32 struct snd_soc_dai_link *dai_link,
33 const char *fmt, ...);
Kuninori Morimotofc55c9b2016-07-11 23:59:16 +000034int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
35 char *prefix);
Kuninori Morimotoabd31472016-05-31 09:00:14 +000036
Kuninori Morimotoe984fd62017-01-23 07:29:42 +000037#define asoc_simple_card_parse_clk_cpu(dev, node, dai_link, simple_dai) \
38 asoc_simple_card_parse_clk(dev, node, dai_link->cpu_of_node, simple_dai)
39#define asoc_simple_card_parse_clk_codec(dev, node, dai_link, simple_dai) \
40 asoc_simple_card_parse_clk(dev, node, dai_link->codec_of_node, simple_dai)
41int asoc_simple_card_parse_clk(struct device *dev,
42 struct device_node *node,
Kuninori Morimotobb6fc622016-08-08 05:59:56 +000043 struct device_node *dai_of_node,
44 struct asoc_simple_dai *simple_dai);
45
Kuninori Morimotoae30a692016-08-08 06:01:43 +000046#define asoc_simple_card_parse_cpu(node, dai_link, \
47 list_name, cells_name, is_single_link) \
48 asoc_simple_card_parse_dai(node, &dai_link->cpu_of_node, \
49 &dai_link->cpu_dai_name, list_name, cells_name, is_single_link)
50#define asoc_simple_card_parse_codec(node, dai_link, list_name, cells_name) \
51 asoc_simple_card_parse_dai(node, &dai_link->codec_of_node, \
52 &dai_link->codec_dai_name, list_name, cells_name, NULL)
53#define asoc_simple_card_parse_platform(node, dai_link, list_name, cells_name) \
54 asoc_simple_card_parse_dai(node, &dai_link->platform_of_node, \
55 NULL, list_name, cells_name, NULL)
56int asoc_simple_card_parse_dai(struct device_node *node,
57 struct device_node **endpoint_np,
58 const char **dai_name,
59 const char *list_name,
60 const char *cells_name,
61 int *is_single_links);
62
Kuninori Morimoto21ba62f2016-08-09 05:48:30 +000063int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
64 struct asoc_simple_dai *simple_dai);
Kuninori Morimotoc262c9a2016-08-09 05:49:41 +000065
66int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
Kuninori Morimoto983cebd2016-08-10 02:20:19 +000067void asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
68 int is_single_links);
Kuninori Morimotoc262c9a2016-08-09 05:49:41 +000069
Kuninori Morimoto0f4e0712016-08-10 02:21:25 +000070int asoc_simple_card_clean_reference(struct snd_soc_card *card);
71
Kuninori Morimoto29a43aa2016-12-02 05:27:30 +000072#endif /* __SIMPLE_CARD_UTILS_H */