18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR MIT)
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * Copyright (c) 2018 Baylibre SAS.
48c2ecf20Sopenharmony_ci * Author: Jerome Brunet <jbrunet@baylibre.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef _MESON_AXG_TDM_FORMATTER_H
88c2ecf20Sopenharmony_ci#define _MESON_AXG_TDM_FORMATTER_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include "axg-tdm.h"
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cistruct platform_device;
138c2ecf20Sopenharmony_cistruct regmap;
148c2ecf20Sopenharmony_cistruct snd_soc_dapm_widget;
158c2ecf20Sopenharmony_cistruct snd_kcontrol;
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistruct axg_tdm_formatter_hw {
188c2ecf20Sopenharmony_ci	unsigned int skew_offset;
198c2ecf20Sopenharmony_ci};
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistruct axg_tdm_formatter_ops {
228c2ecf20Sopenharmony_ci	struct axg_tdm_stream *(*get_stream)(struct snd_soc_dapm_widget *w);
238c2ecf20Sopenharmony_ci	void (*enable)(struct regmap *map);
248c2ecf20Sopenharmony_ci	void (*disable)(struct regmap *map);
258c2ecf20Sopenharmony_ci	int (*prepare)(struct regmap *map,
268c2ecf20Sopenharmony_ci		       const struct axg_tdm_formatter_hw *quirks,
278c2ecf20Sopenharmony_ci		       struct axg_tdm_stream *ts);
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistruct axg_tdm_formatter_driver {
318c2ecf20Sopenharmony_ci	const struct snd_soc_component_driver *component_drv;
328c2ecf20Sopenharmony_ci	const struct regmap_config *regmap_cfg;
338c2ecf20Sopenharmony_ci	const struct axg_tdm_formatter_ops *ops;
348c2ecf20Sopenharmony_ci	const struct axg_tdm_formatter_hw *quirks;
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciint axg_tdm_formatter_set_channel_masks(struct regmap *map,
388c2ecf20Sopenharmony_ci					struct axg_tdm_stream *ts,
398c2ecf20Sopenharmony_ci					unsigned int offset);
408c2ecf20Sopenharmony_ciint axg_tdm_formatter_event(struct snd_soc_dapm_widget *w,
418c2ecf20Sopenharmony_ci			    struct snd_kcontrol *control,
428c2ecf20Sopenharmony_ci			    int event);
438c2ecf20Sopenharmony_ciint axg_tdm_formatter_probe(struct platform_device *pdev);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#endif /* _MESON_AXG_TDM_FORMATTER_H */
46