u-boot/include/audio_codec.h
Simon Glass 401d1c4f5d common: Drop asm/global_data.h from common header
Move this out of the common header and include it only where needed.  In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly.   Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-02-02 15:33:42 -05:00

51 lines
1.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2018 Google LLC
* Written by Simon Glass <sjg@chromium.org>
*/
#ifndef __AUDIO_CODEC_H__
#define __AUDIO_CODEC_H__
struct udevice;
/*
* An audio codec turns digital data into sound with various parameters to
* control its operation.
*/
/* Operations for sound */
struct audio_codec_ops {
/**
* set_params() - Set audio codec parameters
*
* @dev: Sound device
* @inteface: Interface number to use on codec
* @rate: Sampling rate in Hz
* @mclk_freq: Codec clock frequency in Hz
* @bits_per_sample: Must be 16 or 24
* @channels: Number of channels to use (1=mono, 2=stereo)
* @return 0 if OK, -ve on error
*/
int (*set_params)(struct udevice *dev, int interface, int rate,
int mclk_freq, int bits_per_sample, uint channels);
};
#define audio_codec_get_ops(dev) ((struct audio_codec_ops *)(dev)->driver->ops)
/**
* audio_codec_set_params() - Set audio codec parameters
*
* @dev: Sound device
* @inteface: Interface number to use on codec
* @rate: Sampling rate in Hz
* @mclk_freq: Codec clock frequency in Hz
* @bits_per_sample: Must be 16 or 24
* @channels: Number of channels to use (1=mono, 2=stereo)
* @return 0 if OK, -ve on error
*/
int audio_codec_set_params(struct udevice *dev, int interface, int rate,
int mclk_freq, int bits_per_sample, uint channels);
#endif /* __AUDIO_CODEC_H__ */