^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2020 BayLibre, SAS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Jerome Brunet <jbrunet@baylibre.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef _MESON_SND_CARD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define _MESON_SND_CARD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct device_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct platform_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct snd_soc_card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct snd_pcm_substream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct snd_pcm_hw_params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define DT_PREFIX "amlogic,"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct meson_card_match_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) int (*add_link)(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct device_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) int *index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct meson_card {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) const struct meson_card_match_data *match_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct snd_soc_card card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void **link_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned int meson_card_parse_daifmt(struct device_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct device_node *cpu_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int meson_card_i2s_set_sysclk(struct snd_pcm_substream *substream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct snd_pcm_hw_params *params,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) unsigned int mclk_fs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int meson_card_reallocate_links(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) unsigned int num_links);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int meson_card_parse_dai(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct device_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct device_node **dai_of_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) const char **dai_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) int meson_card_set_be_link(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct snd_soc_dai_link *link,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct device_node *node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int meson_card_set_fe_link(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct snd_soc_dai_link *link,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct device_node *node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) bool is_playback);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int meson_card_probe(struct platform_device *pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) int meson_card_remove(struct platform_device *pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #endif /* _MESON_SND_CARD_H */