blob: 155e1b40e28a1c91e9a6f8b228b46a12ff3c30c0 [file] [log] [blame]
Rajeshwari Shinde511ed5f2012-10-25 19:49:22 +00001/*
2 * Copyright (C) 2012 Samsung Electronics
3 * R. Chandrasekar < rcsekar@samsung.com>
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Rajeshwari Shinde511ed5f2012-10-25 19:49:22 +00006 */
7
8#ifndef __SOUND_H__
9#define __SOUND_H__
10
11/* sound codec enum */
12enum en_sound_codec {
13 CODEC_WM_8994,
14 CODEC_WM_8995,
Rajeshwari Shinde14d2dfc2013-02-14 19:46:13 +000015 CODEC_MAX_98095,
Rajeshwari Shinde511ed5f2012-10-25 19:49:22 +000016 CODEC_MAX
17};
18
19/* sound codec enum */
20enum sound_compat {
21 AUDIO_COMPAT_SPI,
22 AUDIO_COMPAT_I2C,
23};
24
25/* Codec information structure to store the info from device tree */
26struct sound_codec_info {
27 int i2c_bus;
28 int i2c_dev_addr;
29 enum en_sound_codec codec_type;
30};
31
32/*
Simon Glassa77bf702014-02-27 13:26:20 -070033 * Generates square wave sound data for 1 second
34 *
35 * @param data data buffer pointer
36 * @param size size of the buffer
37 * @param freq frequency of the wave
38 */
39void sound_create_square_wave(unsigned short *data, int size, uint32_t freq);
40
41/*
Rajeshwari Shinde511ed5f2012-10-25 19:49:22 +000042 * Initialises audio sub system
Rajeshwari Shindef4823102012-12-26 20:03:17 +000043 * @param blob Pointer of device tree node or NULL if none.
Rajeshwari Shinde511ed5f2012-10-25 19:49:22 +000044 * @return int value 0 for success, -1 for error
45 */
Rajeshwari Shindef4823102012-12-26 20:03:17 +000046int sound_init(const void *blob);
Rajeshwari Shinde511ed5f2012-10-25 19:49:22 +000047
48/*
49 * plays the pcm data buffer in pcm_data.h through i2s1 to make the
50 * sine wave sound
51 *
52 * @return int 0 for success, -1 for error
53 */
54int sound_play(uint32_t msec, uint32_t frequency);
55
56#endif /* __SOUND__H__ */