blob: 9ef98e955cb2744450e75006b432a2043aa13593 [file] [log] [blame]
Jerome Brunet1a11d882018-07-17 17:42:58 +02001/* 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
12struct platform_device;
13struct regmap;
14struct snd_soc_dapm_widget;
15struct snd_kcontrol;
16
Jerome Brunetf01bc672019-04-04 13:17:32 +020017struct axg_tdm_formatter_hw {
18 unsigned int skew_offset;
19 bool invert_sclk;
20};
21
Jerome Brunet1a11d882018-07-17 17:42:58 +020022struct axg_tdm_formatter_ops {
23 struct axg_tdm_stream *(*get_stream)(struct snd_soc_dapm_widget *w);
24 void (*enable)(struct regmap *map);
25 void (*disable)(struct regmap *map);
Jerome Brunetf01bc672019-04-04 13:17:32 +020026 int (*prepare)(struct regmap *map,
27 const struct axg_tdm_formatter_hw *quirks,
28 struct axg_tdm_stream *ts);
Jerome Brunet1a11d882018-07-17 17:42:58 +020029};
30
31struct axg_tdm_formatter_driver {
32 const struct snd_soc_component_driver *component_drv;
33 const struct regmap_config *regmap_cfg;
34 const struct axg_tdm_formatter_ops *ops;
Jerome Brunetf01bc672019-04-04 13:17:32 +020035 const struct axg_tdm_formatter_hw *quirks;
Jerome Brunet1a11d882018-07-17 17:42:58 +020036};
37
38int axg_tdm_formatter_set_channel_masks(struct regmap *map,
39 struct axg_tdm_stream *ts,
40 unsigned int offset);
41int axg_tdm_formatter_event(struct snd_soc_dapm_widget *w,
42 struct snd_kcontrol *control,
43 int event);
44int axg_tdm_formatter_probe(struct platform_device *pdev);
45
46#endif /* _MESON_AXG_TDM_FORMATTER_H */