eac.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * arch/arm/plat-omap/include/mach2/eac.h
  3. *
  4. * Defines for Enhanced Audio Controller
  5. *
  6. * Contact: Jarkko Nikula <jarkko.nikula@nokia.com>
  7. *
  8. * Copyright (C) 2006 Nokia Corporation
  9. * Copyright (C) 2004 Texas Instruments, Inc.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * version 2 as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  23. * 02110-1301 USA
  24. *
  25. */
  26. #ifndef __ASM_ARM_ARCH_OMAP2_EAC_H
  27. #define __ASM_ARM_ARCH_OMAP2_EAC_H
  28. #include <mach/io.h>
  29. #include <mach/hardware.h>
  30. #include <asm/irq.h>
  31. #include <sound/core.h>
  32. /* master codec clock source */
  33. #define EAC_MCLK_EXT_MASK 0x100
  34. enum eac_mclk_src {
  35. EAC_MCLK_INT_11290000, /* internal 96 MHz / 8.5 = 11.29 Mhz */
  36. EAC_MCLK_EXT_11289600 = EAC_MCLK_EXT_MASK,
  37. EAC_MCLK_EXT_12288000,
  38. EAC_MCLK_EXT_2x11289600,
  39. EAC_MCLK_EXT_2x12288000,
  40. };
  41. /* codec port interface mode */
  42. enum eac_codec_mode {
  43. EAC_CODEC_PCM,
  44. EAC_CODEC_AC97,
  45. EAC_CODEC_I2S_MASTER, /* codec port, I.e. EAC is the master */
  46. EAC_CODEC_I2S_SLAVE,
  47. };
  48. /* configuration structure for I2S mode */
  49. struct eac_i2s_conf {
  50. /* if enabled, then first data slot (left channel) is signaled as
  51. * positive level of frame sync EAC.AC_FS */
  52. unsigned polarity_changed_mode:1;
  53. /* if enabled, then serial data starts one clock cycle after the
  54. * of EAC.AC_FS for first audio slot */
  55. unsigned sync_delay_enable:1;
  56. };
  57. /* configuration structure for EAC codec port */
  58. struct eac_codec {
  59. enum eac_mclk_src mclk_src;
  60. enum eac_codec_mode codec_mode;
  61. union {
  62. struct eac_i2s_conf i2s;
  63. } codec_conf;
  64. int default_rate; /* audio sampling rate */
  65. int (* set_power)(void *private_data, int dac, int adc);
  66. int (* register_controls)(void *private_data,
  67. struct snd_card *card);
  68. const char *short_name;
  69. void *private_data;
  70. };
  71. /* structure for passing platform dependent data to the EAC driver */
  72. struct eac_platform_data {
  73. int (* init)(struct device *eac_dev);
  74. void (* cleanup)(struct device *eac_dev);
  75. /* these callbacks are used to configure & control external MCLK
  76. * source. NULL if not used */
  77. int (* enable_ext_clocks)(struct device *eac_dev);
  78. void (* disable_ext_clocks)(struct device *eac_dev);
  79. };
  80. extern void omap_init_eac(struct eac_platform_data *pdata);
  81. extern int eac_register_codec(struct device *eac_dev, struct eac_codec *codec);
  82. extern void eac_unregister_codec(struct device *eac_dev);
  83. extern int eac_set_mode(struct device *eac_dev, int play, int rec);
  84. #endif /* __ASM_ARM_ARCH_OMAP2_EAC_H */