xref: /linux/sound/soc/meson/axg-tdm-formatter.h (revision e9f0878c4b2004ac19581274c1ae4c61ae3ca70e)
1 /* SPDX-License-Identifier: (GPL-2.0 OR MIT)
2  *
3  * Copyright (c) 2018 Baylibre SAS.
4  * Author: Jerome Brunet <jbrunet@baylibre.com>
5  */
6 
7 #ifndef _MESON_AXG_TDM_FORMATTER_H
8 #define _MESON_AXG_TDM_FORMATTER_H
9 
10 #include "axg-tdm.h"
11 
12 struct platform_device;
13 struct regmap;
14 struct snd_soc_dapm_widget;
15 struct snd_kcontrol;
16 
17 struct axg_tdm_formatter_ops {
18 	struct axg_tdm_stream *(*get_stream)(struct snd_soc_dapm_widget *w);
19 	void (*enable)(struct regmap *map);
20 	void (*disable)(struct regmap *map);
21 	int (*prepare)(struct regmap *map, struct axg_tdm_stream *ts);
22 };
23 
24 struct axg_tdm_formatter_driver {
25 	const struct snd_soc_component_driver *component_drv;
26 	const struct regmap_config *regmap_cfg;
27 	const struct axg_tdm_formatter_ops *ops;
28 	bool invert_sclk;
29 };
30 
31 int axg_tdm_formatter_set_channel_masks(struct regmap *map,
32 					struct axg_tdm_stream *ts,
33 					unsigned int offset);
34 int axg_tdm_formatter_event(struct snd_soc_dapm_widget *w,
35 			    struct snd_kcontrol *control,
36 			    int event);
37 int axg_tdm_formatter_probe(struct platform_device *pdev);
38 
39 #endif /* _MESON_AXG_TDM_FORMATTER_H */
40