dm: sound: Drop codec_type
[platform/kernel/u-boot.git] / include / sound.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2012 Samsung Electronics
4  * R. Chandrasekar < rcsekar@samsung.com>
5  */
6
7 #ifndef __SOUND_H__
8 #define __SOUND_H__
9
10 /* sound codec enum */
11 enum sound_compat {
12         AUDIO_COMPAT_SPI,
13         AUDIO_COMPAT_I2C,
14 };
15
16 /* Codec information structure to store the info from device tree */
17 struct sound_codec_info {
18         int i2c_bus;
19         int i2c_dev_addr;
20 };
21
22 /*
23  * Generates square wave sound data for 1 second
24  *
25  * @param sample_rate   Sample rate in Hz
26  * @param data          data buffer pointer
27  * @param size          size of the buffer
28  * @param freq          frequency of the wave
29  */
30 void sound_create_square_wave(uint sample_rate, unsigned short *data, int size,
31                               uint freq);
32
33 /*
34  * Initialises audio sub system
35  * @param blob  Pointer of device tree node or NULL if none.
36  * @return      int value 0 for success, -1 for error
37  */
38 int sound_init(const void *blob);
39
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
48 #endif  /* __SOUND__H__ */