Kuninori Morimoto | abd3147 | 2016-05-31 09:00:14 +0000 | [diff] [blame] | 1 | /* |
| 2 | * simple_card_core.h |
| 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 | */ |
| 10 | #ifndef __SIMPLE_CARD_CORE_H |
| 11 | #define __SIMPLE_CARD_CORE_H |
| 12 | |
| 13 | #include <sound/soc.h> |
| 14 | |
Kuninori Morimoto | cecdef3 | 2016-06-30 06:02:46 +0000 | [diff] [blame] | 15 | struct 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 Morimoto | abd3147 | 2016-05-31 09:00:14 +0000 | [diff] [blame] | 25 | int 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 Iooss | e5668ca | 2016-08-23 10:51:22 +0200 | [diff] [blame] | 30 | __printf(3, 4) |
Kuninori Morimoto | 1db3312 | 2016-07-11 23:57:14 +0000 | [diff] [blame] | 31 | int asoc_simple_card_set_dailink_name(struct device *dev, |
| 32 | struct snd_soc_dai_link *dai_link, |
| 33 | const char *fmt, ...); |
Kuninori Morimoto | fc55c9b | 2016-07-11 23:59:16 +0000 | [diff] [blame] | 34 | int asoc_simple_card_parse_card_name(struct snd_soc_card *card, |
| 35 | char *prefix); |
Kuninori Morimoto | abd3147 | 2016-05-31 09:00:14 +0000 | [diff] [blame] | 36 | |
Kuninori Morimoto | bb6fc62 | 2016-08-08 05:59:56 +0000 | [diff] [blame] | 37 | #define asoc_simple_card_parse_clk_cpu(node, dai_link, simple_dai) \ |
| 38 | asoc_simple_card_parse_clk(node, dai_link->cpu_of_node, simple_dai) |
| 39 | #define asoc_simple_card_parse_clk_codec(node, dai_link, simple_dai) \ |
| 40 | asoc_simple_card_parse_clk(node, dai_link->codec_of_node, simple_dai) |
| 41 | int asoc_simple_card_parse_clk(struct device_node *node, |
| 42 | struct device_node *dai_of_node, |
| 43 | struct asoc_simple_dai *simple_dai); |
| 44 | |
Kuninori Morimoto | ae30a69 | 2016-08-08 06:01:43 +0000 | [diff] [blame] | 45 | #define asoc_simple_card_parse_cpu(node, dai_link, \ |
| 46 | list_name, cells_name, is_single_link) \ |
| 47 | asoc_simple_card_parse_dai(node, &dai_link->cpu_of_node, \ |
| 48 | &dai_link->cpu_dai_name, list_name, cells_name, is_single_link) |
| 49 | #define asoc_simple_card_parse_codec(node, dai_link, list_name, cells_name) \ |
| 50 | asoc_simple_card_parse_dai(node, &dai_link->codec_of_node, \ |
| 51 | &dai_link->codec_dai_name, list_name, cells_name, NULL) |
| 52 | #define asoc_simple_card_parse_platform(node, dai_link, list_name, cells_name) \ |
| 53 | asoc_simple_card_parse_dai(node, &dai_link->platform_of_node, \ |
| 54 | NULL, list_name, cells_name, NULL) |
| 55 | int asoc_simple_card_parse_dai(struct device_node *node, |
| 56 | struct device_node **endpoint_np, |
| 57 | const char **dai_name, |
| 58 | const char *list_name, |
| 59 | const char *cells_name, |
| 60 | int *is_single_links); |
| 61 | |
Kuninori Morimoto | 21ba62f | 2016-08-09 05:48:30 +0000 | [diff] [blame] | 62 | int asoc_simple_card_init_dai(struct snd_soc_dai *dai, |
| 63 | struct asoc_simple_dai *simple_dai); |
Kuninori Morimoto | c262c9a | 2016-08-09 05:49:41 +0000 | [diff] [blame] | 64 | |
| 65 | int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link); |
Kuninori Morimoto | 983cebd | 2016-08-10 02:20:19 +0000 | [diff] [blame] | 66 | void asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link, |
| 67 | int is_single_links); |
Kuninori Morimoto | c262c9a | 2016-08-09 05:49:41 +0000 | [diff] [blame] | 68 | |
Kuninori Morimoto | 0f4e071 | 2016-08-10 02:21:25 +0000 | [diff] [blame] | 69 | int asoc_simple_card_clean_reference(struct snd_soc_card *card); |
| 70 | |
Kuninori Morimoto | abd3147 | 2016-05-31 09:00:14 +0000 | [diff] [blame] | 71 | #endif /* __SIMPLE_CARD_CORE_H */ |