simple_card_utils.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #include <sound/soc.h>
  13. struct asoc_simple_dai {
  14. const char *name;
  15. unsigned int sysclk;
  16. int sysclk_dir;
  17. int sysclk_id;
  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. int asoc_simple_card_parse_daifmt(struct device *dev,
  25. struct device_node *node,
  26. struct device_node *codec,
  27. char *prefix,
  28. unsigned int *retfmt);
  29. __printf(3, 4)
  30. int asoc_simple_card_set_dailink_name(struct device *dev,
  31. struct snd_soc_dai_link *dai_link,
  32. const char *fmt, ...);
  33. int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
  34. char *prefix);
  35. #define asoc_simple_card_parse_clk_cpu(node, dai_link, simple_dai) \
  36. asoc_simple_card_parse_clk(node, dai_link->cpu_of_node, simple_dai)
  37. #define asoc_simple_card_parse_clk_codec(node, dai_link, simple_dai) \
  38. asoc_simple_card_parse_clk(node, dai_link->codec_of_node, simple_dai)
  39. int asoc_simple_card_parse_clk(struct device_node *node,
  40. struct device_node *dai_of_node,
  41. struct asoc_simple_dai *simple_dai);
  42. #define asoc_simple_card_parse_cpu(node, dai_link, \
  43. list_name, cells_name, is_single_link) \
  44. asoc_simple_card_parse_dai(node, &dai_link->cpu_of_node, \
  45. &dai_link->cpu_dai_name, list_name, cells_name, is_single_link)
  46. #define asoc_simple_card_parse_codec(node, dai_link, list_name, cells_name) \
  47. asoc_simple_card_parse_dai(node, &dai_link->codec_of_node, \
  48. &dai_link->codec_dai_name, list_name, cells_name, NULL)
  49. #define asoc_simple_card_parse_platform(node, dai_link, list_name, cells_name) \
  50. asoc_simple_card_parse_dai(node, &dai_link->platform_of_node, \
  51. NULL, list_name, cells_name, NULL)
  52. int asoc_simple_card_parse_dai(struct device_node *node,
  53. struct device_node **endpoint_np,
  54. const char **dai_name,
  55. const char *list_name,
  56. const char *cells_name,
  57. int *is_single_links);
  58. int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
  59. struct asoc_simple_dai *simple_dai);
  60. int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
  61. void asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
  62. int is_single_links);
  63. int asoc_simple_card_clean_reference(struct snd_soc_card *card);
  64. #endif /* __SIMPLE_CARD_CORE_H */