sound.h 1.2 KB

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