sh_fsi.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. /* flags format
  14. * 0xABCDEEFF
  15. *
  16. * A: channel size for TDM (input)
  17. * B: channel size for TDM (ooutput)
  18. * C: inversion
  19. * D: mode
  20. * E: input format
  21. * F: output format
  22. */
  23. #include <linux/clk.h>
  24. #include <sound/soc.h>
  25. /* TDM channel */
  26. #define SH_FSI_SET_CH_I(x) ((x & 0xF) << 28)
  27. #define SH_FSI_SET_CH_O(x) ((x & 0xF) << 24)
  28. #define SH_FSI_CH_IMASK 0xF0000000
  29. #define SH_FSI_CH_OMASK 0x0F000000
  30. #define SH_FSI_GET_CH_I(x) ((x & SH_FSI_CH_IMASK) >> 28)
  31. #define SH_FSI_GET_CH_O(x) ((x & SH_FSI_CH_OMASK) >> 24)
  32. /* clock inversion */
  33. #define SH_FSI_INVERSION_MASK 0x00F00000
  34. #define SH_FSI_LRM_INV (1 << 20)
  35. #define SH_FSI_BRM_INV (1 << 21)
  36. #define SH_FSI_LRS_INV (1 << 22)
  37. #define SH_FSI_BRS_INV (1 << 23)
  38. /* mode */
  39. #define SH_FSI_MODE_MASK 0x000F0000
  40. #define SH_FSI_IN_SLAVE_MODE (1 << 16) /* default master mode */
  41. #define SH_FSI_OUT_SLAVE_MODE (1 << 17) /* default master mode */
  42. /* DI format */
  43. #define SH_FSI_FMT_MASK 0x000000FF
  44. #define SH_FSI_IFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 8)
  45. #define SH_FSI_OFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 0)
  46. #define SH_FSI_GET_IFMT(x) ((x >> 8) & SH_FSI_FMT_MASK)
  47. #define SH_FSI_GET_OFMT(x) ((x >> 0) & SH_FSI_FMT_MASK)
  48. #define SH_FSI_FMT_MONO (1 << 0)
  49. #define SH_FSI_FMT_MONO_DELAY (1 << 1)
  50. #define SH_FSI_FMT_PCM (1 << 2)
  51. #define SH_FSI_FMT_I2S (1 << 3)
  52. #define SH_FSI_FMT_TDM (1 << 4)
  53. #define SH_FSI_FMT_TDM_DELAY (1 << 5)
  54. #define SH_FSI_IFMT_TDM_CH(x) \
  55. (SH_FSI_IFMT(TDM) | SH_FSI_SET_CH_I(x))
  56. #define SH_FSI_IFMT_TDM_DELAY_CH(x) \
  57. (SH_FSI_IFMT(TDM_DELAY) | SH_FSI_SET_CH_I(x))
  58. #define SH_FSI_OFMT_TDM_CH(x) \
  59. (SH_FSI_OFMT(TDM) | SH_FSI_SET_CH_O(x))
  60. #define SH_FSI_OFMT_TDM_DELAY_CH(x) \
  61. (SH_FSI_OFMT(TDM_DELAY) | SH_FSI_SET_CH_O(x))
  62. struct sh_fsi_platform_info {
  63. unsigned long porta_flags;
  64. unsigned long portb_flags;
  65. };
  66. extern struct snd_soc_dai fsi_soc_dai[2];
  67. extern struct snd_soc_platform fsi_soc_platform;
  68. #endif /* __SOUND_FSI_H */