summaryrefslogtreecommitdiff
path: root/sound/soc/meson/gx-interface.h
blob: 2a6207e393e816e90ef62fedffd5051ca042fd5e (plain) (blame)
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
/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
/*
 * Copyright (c) 2026 Baylibre SAS.
 * Author: Valerio Setti <vsetti@baylibre.com>
 */

#ifndef _MESON_GX_INTERFACE_H
#define _MESON_GX_INTERFACE_H

#include <linux/clk.h>
#include <linux/regmap.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-dai.h>

struct gx_iface {
	struct clk *mclk;
	unsigned long mclk_rate;

	/* format is common to all the DAIs of the iface */
	unsigned int fmt;
};

struct gx_stream {
	struct gx_iface *iface;
	struct list_head formatter_list;
	struct mutex lock;
	unsigned int channels;
	unsigned int width;
	unsigned int physical_width;
	bool ready;

	/* For continuous clock tracking */
	bool clk_enabled;
};

struct gx_stream *gx_stream_alloc(struct gx_iface *iface);
void gx_stream_free(struct gx_stream *ts);
int gx_stream_start(struct gx_stream *ts);
void gx_stream_stop(struct gx_stream *ts);

#endif /* _MESON_GX_INTERFACE_H */