sh_fsi.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef __SOUND_FSI_H
  2. #define __SOUND_FSI_H
  3. /*
  4. * Fifo-attached Serial Interface (FSI) support for SH7724
  5. *
  6. * Copyright (C) 2009 Renesas Solutions Corp.
  7. * Kuninori Morimoto <morimoto.kuninori@renesas.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #define FSI_PORT_A 0
  14. #define FSI_PORT_B 1
  15. #include <linux/clk.h>
  16. #include <sound/soc.h>
  17. /*
  18. * flags format
  19. *
  20. * 0x00000CBA
  21. *
  22. * A: inversion
  23. * B: format mode
  24. * C: chip specific
  25. * D: clock selecter if master mode
  26. */
  27. /* A: clock inversion */
  28. #define SH_FSI_INVERSION_MASK 0x0000000F
  29. #define SH_FSI_LRM_INV (1 << 0)
  30. #define SH_FSI_BRM_INV (1 << 1)
  31. #define SH_FSI_LRS_INV (1 << 2)
  32. #define SH_FSI_BRS_INV (1 << 3)
  33. /* B: format mode */
  34. #define SH_FSI_FMT_MASK 0x000000F0
  35. #define SH_FSI_FMT_DAI (0 << 4)
  36. #define SH_FSI_FMT_SPDIF (1 << 4)
  37. /* C: chip specific */
  38. #define SH_FSI_OPTION_MASK 0x00000F00
  39. #define SH_FSI_ENABLE_STREAM_MODE (1 << 8) /* for 16bit data */
  40. /* D: clock selecter if master mode */
  41. #define SH_FSI_CLK_MASK 0x0000F000
  42. #define SH_FSI_CLK_EXTERNAL (0 << 12)
  43. #define SH_FSI_CLK_CPG (1 << 12) /* FSIxCK + FSI-DIV */
  44. /*
  45. * set_rate return value
  46. *
  47. * see ACKMD/BPFMD on
  48. * ACK_MD (FSI2)
  49. * CKG1 (FSI)
  50. *
  51. * err : return value < 0
  52. * no change : return value == 0
  53. * change xMD : return value > 0
  54. *
  55. * 0x-00000AB
  56. *
  57. * A: ACKMD value
  58. * B: BPFMD value
  59. */
  60. #define SH_FSI_ACKMD_MASK (0xF << 0)
  61. #define SH_FSI_ACKMD_512 (1 << 0)
  62. #define SH_FSI_ACKMD_256 (2 << 0)
  63. #define SH_FSI_ACKMD_128 (3 << 0)
  64. #define SH_FSI_ACKMD_64 (4 << 0)
  65. #define SH_FSI_ACKMD_32 (5 << 0)
  66. #define SH_FSI_BPFMD_MASK (0xF << 4)
  67. #define SH_FSI_BPFMD_512 (1 << 4)
  68. #define SH_FSI_BPFMD_256 (2 << 4)
  69. #define SH_FSI_BPFMD_128 (3 << 4)
  70. #define SH_FSI_BPFMD_64 (4 << 4)
  71. #define SH_FSI_BPFMD_32 (5 << 4)
  72. #define SH_FSI_BPFMD_16 (6 << 4)
  73. struct sh_fsi_port_info {
  74. unsigned long flags;
  75. int tx_id;
  76. int rx_id;
  77. int (*set_rate)(struct device *dev, int rate, int enable);
  78. };
  79. struct sh_fsi_platform_info {
  80. struct sh_fsi_port_info port_a;
  81. struct sh_fsi_port_info port_b;
  82. };
  83. #endif /* __SOUND_FSI_H */