1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright 2018 Google LLC
4 * Written by Simon Glass <sjg@chromium.org>
7 #ifndef __AUDIO_CODEC_H__
8 #define __AUDIO_CODEC_H__
11 * An audio codec turns digital data into sound with various parameters to
12 * control its operation.
15 /* Operations for sound */
16 struct audio_codec_ops {
18 * set_params() - Set audio codec parameters
21 * @inteface: Interface number to use on codec
22 * @rate: Sampling rate in Hz
23 * @mclk_freq: Codec clock frequency in Hz
24 * @bits_per_sample: Must be 16 or 24
25 * @channels: Number of channels to use (1=mono, 2=stereo)
26 * @return 0 if OK, -ve on error
28 int (*set_params)(struct udevice *dev, int interface, int rate,
29 int mclk_freq, int bits_per_sample, uint channels);
32 #define audio_codec_get_ops(dev) ((struct audio_codec_ops *)(dev)->driver->ops)
35 * audio_codec_set_params() - Set audio codec parameters
38 * @inteface: Interface number to use on codec
39 * @rate: Sampling rate in Hz
40 * @mclk_freq: Codec clock frequency in Hz
41 * @bits_per_sample: Must be 16 or 24
42 * @channels: Number of channels to use (1=mono, 2=stereo)
43 * @return 0 if OK, -ve on error
45 int audio_codec_set_params(struct udevice *dev, int interface, int rate,
46 int mclk_freq, int bits_per_sample, uint channels);
48 #endif /* __AUDIO_CODEC_H__ */