sound.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics
  3. * R. Chandrasekar < rcsekar@samsung.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __SOUND_H__
  8. #define __SOUND_H__
  9. /* sound codec enum */
  10. enum en_sound_codec {
  11. CODEC_WM_8994,
  12. CODEC_WM_8995,
  13. CODEC_MAX_98095,
  14. CODEC_MAX
  15. };
  16. /* sound codec enum */
  17. enum sound_compat {
  18. AUDIO_COMPAT_SPI,
  19. AUDIO_COMPAT_I2C,
  20. };
  21. /* Codec information structure to store the info from device tree */
  22. struct sound_codec_info {
  23. int i2c_bus;
  24. int i2c_dev_addr;
  25. enum en_sound_codec codec_type;
  26. };
  27. /*
  28. * Generates square wave sound data for 1 second
  29. *
  30. * @param data data buffer pointer
  31. * @param size size of the buffer
  32. * @param freq frequency of the wave
  33. */
  34. void sound_create_square_wave(unsigned short *data, int size, uint32_t freq);
  35. /*
  36. * Initialises audio sub system
  37. * @param blob Pointer of device tree node or NULL if none.
  38. * @return int value 0 for success, -1 for error
  39. */
  40. int sound_init(const void *blob);
  41. /*
  42. * plays the pcm data buffer in pcm_data.h through i2s1 to make the
  43. * sine wave sound
  44. *
  45. * @return int 0 for success, -1 for error
  46. */
  47. int sound_play(uint32_t msec, uint32_t frequency);
  48. #endif /* __SOUND__H__ */