linux/sound/soc/meson/axg-tdm-formatter.h
Jerome Brunet 1a11d88f49
ASoC: meson: add tdm formatter base driver
Add Amlogic's axg TDM core driver. On this SoC, tdm is bit more
complex than usual, mainly because the different TDM input decoders can
be attached to any of TDM pad interface, including the output pads.

For the this, TDM on this SoC is modeled like this:
- TDM interface provides the DAIs the codecs will be attached to.
  The main responsibility of this driver is to manage the pad format
  and the TDM clock rates.
- TDM Formatters: These are the entities which are actually dealing with
  the TDM signal. TDMOUT produce a TDM signal from the audio sample
  provided by FRDDR using the clocks provided the TDM interface. TDMIN
  feeds TODDR with audio sample using the clocks and TDM signal provided
  by the TDM Interface.
- TDM Streams: This provides the link between 1 DAI stream of the TDM
  interface and one (or more) TDM formatters.

This driver provides the TDM formatter and TDM stream operations.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-20 17:38:27 +01:00

40 lines
1.1 KiB
C

/* SPDX-License-Identifier: (GPL-2.0 OR MIT)
*
* Copyright (c) 2018 Baylibre SAS.
* Author: Jerome Brunet <jbrunet@baylibre.com>
*/
#ifndef _MESON_AXG_TDM_FORMATTER_H
#define _MESON_AXG_TDM_FORMATTER_H
#include "axg-tdm.h"
struct platform_device;
struct regmap;
struct snd_soc_dapm_widget;
struct snd_kcontrol;
struct axg_tdm_formatter_ops {
struct axg_tdm_stream *(*get_stream)(struct snd_soc_dapm_widget *w);
void (*enable)(struct regmap *map);
void (*disable)(struct regmap *map);
int (*prepare)(struct regmap *map, struct axg_tdm_stream *ts);
};
struct axg_tdm_formatter_driver {
const struct snd_soc_component_driver *component_drv;
const struct regmap_config *regmap_cfg;
const struct axg_tdm_formatter_ops *ops;
bool invert_sclk;
};
int axg_tdm_formatter_set_channel_masks(struct regmap *map,
struct axg_tdm_stream *ts,
unsigned int offset);
int axg_tdm_formatter_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *control,
int event);
int axg_tdm_formatter_probe(struct platform_device *pdev);
#endif /* _MESON_AXG_TDM_FORMATTER_H */