xref: /freebsd/sys/dev/sound/fdt/audio_dai_if.m (revision a03411e84728e9b267056fd31c7d1d9d1dc1b01e)
1#-
2# Copyright (c) 2019 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7# 1. Redistributions of source code must retain the above copyright
8#    notice, this list of conditions and the following disclaimer.
9# 2. Redistributions in binary form must reproduce the above copyright
10#    notice, this list of conditions and the following disclaimer in the
11#    documentation and/or other materials provided with the distribution.
12#
13# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23# SUCH DAMAGE.
24#
25#
26
27CODE {
28	#include <sys/param.h>
29	#include <sys/bus.h>
30	#include <dev/sound/pcm/sound.h>
31}
32
33INTERFACE audio_dai;
34
35# set DAI format for communications between CPU/codec nodes
36METHOD int init {
37	device_t	dev;
38	uint32_t	format;
39}
40
41# Initialize DAI and set up interrrupt handler
42METHOD int setup_intr {
43	device_t	dev;
44	driver_intr_t	intr_handler;
45	void		*intr_arg;
46}
47
48# Setup mixers for codec node
49METHOD int setup_mixer {
50	device_t	dev;
51	device_t	ausocdev;
52}
53
54# setup clock speed
55METHOD int set_sysclk {
56	device_t	dev;
57	uint32_t	rate;
58	int		dai_dir;
59}
60
61METHOD int trigger {
62	device_t	dev;
63	int		go;
64	int		pcm_dir;
65}
66
67METHOD struct pcmchan_caps* get_caps {
68	device_t	dev;
69}
70
71METHOD uint32_t get_ptr {
72	device_t	dev;
73	int		pcm_dir;
74}
75
76# Set PCM channel format
77METHOD uint32_t set_chanformat {
78	device_t	dev;
79	uint32_t	format;
80}
81
82# Set PCM channel sampling rate
83METHOD uint32_t set_chanspeed {
84	device_t	dev;
85	uint32_t	speed;
86}
87
88# call DAI interrupt handler
89# returns 1 if call to chn_intr required, 0 otherwise
90METHOD int intr {
91	device_t	dev;
92	struct snd_dbuf	*play_buf;
93	struct snd_dbuf	*rec_buf;
94}
95