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