File: audio_codec.h

package info (click to toggle)
u-boot 2025.01-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 330,740 kB
  • sloc: ansic: 2,627,855; python: 60,773; sh: 41,641; asm: 21,854; makefile: 15,048; perl: 12,447; cs: 6,763; cpp: 1,868; yacc: 1,100; lex: 747; awk: 57; tcl: 32; sed: 24
file content (52 lines) | stat: -rw-r--r-- 1,429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* 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__

#include <linux/types.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__ */