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__
13 * An audio codec turns digital data into sound with various parameters to
14 * control its operation.
17 /* Operations for sound */
18 struct audio_codec_ops {
20 * set_params() - Set audio codec parameters
23 * @inteface: Interface number to use on codec
24 * @rate: Sampling rate in Hz
25 * @mclk_freq: Codec clock frequency in Hz
26 * @bits_per_sample: Must be 16 or 24
27 * @channels: Number of channels to use (1=mono, 2=stereo)
28 * @return 0 if OK, -ve on error
30 int (*set_params)(struct udevice *dev, int interface, int rate,
31 int mclk_freq, int bits_per_sample, uint channels);
34 #define audio_codec_get_ops(dev) ((struct audio_codec_ops *)(dev)->driver->ops)
37 * audio_codec_set_params() - Set audio codec parameters
40 * @inteface: Interface number to use on codec
41 * @rate: Sampling rate in Hz
42 * @mclk_freq: Codec clock frequency in Hz
43 * @bits_per_sample: Must be 16 or 24
44 * @channels: Number of channels to use (1=mono, 2=stereo)
45 * Return: 0 if OK, -ve on error
47 int audio_codec_set_params(struct udevice *dev, int interface, int rate,
48 int mclk_freq, int bits_per_sample, uint channels);
50 #endif /* __AUDIO_CODEC_H__ */