xref: /linux/sound/soc/meson/gx-interface.h (revision e5c91aac491def6ab3f90c4cc246e3fcb0f8f058)
1 /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
2 /*
3  * Copyright (c) 2026 Baylibre SAS.
4  * Author: Valerio Setti <vsetti@baylibre.com>
5  */
6 
7 #ifndef _MESON_GX_INTERFACE_H
8 #define _MESON_GX_INTERFACE_H
9 
10 #include <linux/clk.h>
11 #include <linux/regmap.h>
12 #include <sound/pcm.h>
13 #include <sound/soc.h>
14 #include <sound/soc-dai.h>
15 
16 struct gx_iface {
17 	struct clk *mclk;
18 	unsigned long mclk_rate;
19 
20 	/* format is common to all the DAIs of the iface */
21 	unsigned int fmt;
22 };
23 
24 struct gx_stream {
25 	struct gx_iface *iface;
26 	struct list_head formatter_list;
27 	struct mutex lock;
28 	unsigned int channels;
29 	unsigned int width;
30 	unsigned int physical_width;
31 	bool ready;
32 
33 	/* For continuous clock tracking */
34 	bool clk_enabled;
35 };
36 
37 struct gx_stream *gx_stream_alloc(struct gx_iface *iface);
38 void gx_stream_free(struct gx_stream *ts);
39 int gx_stream_start(struct gx_stream *ts);
40 void gx_stream_stop(struct gx_stream *ts);
41 
42 #endif /* _MESON_GX_INTERFACE_H */
43