Revert "unicode: Don't special case ignorable code points"
[linux.git] / sound / soc / amd / acp / acp-mach.h
blobf94c30c20f20b6bfd7b00a0ec34ffb4de8996766
1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /*
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
6 * Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved.
8 * Author: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
9 */
10 #ifndef __ACP_MACH_H
11 #define __ACP_MACH_H
13 #include <sound/core.h>
14 #include <sound/jack.h>
15 #include <sound/pcm_params.h>
16 #include <sound/soc-dapm.h>
17 #include <linux/input.h>
18 #include <linux/module.h>
19 #include <sound/soc.h>
21 #include "acp_common.h"
23 #define TDM_CHANNELS 8
25 #define ACP_OPS(priv, cb) ((priv)->ops.cb)
27 #define acp_get_drvdata(card) ((struct acp_card_drvdata *)(card)->drvdata)
29 enum be_id {
30 HEADSET_BE_ID = 0,
31 AMP_BE_ID,
32 DMIC_BE_ID,
33 BT_BE_ID,
36 enum cpu_endpoints {
37 NONE = 0,
38 I2S_HS,
39 I2S_SP,
40 I2S_BT,
41 DMIC,
44 enum codec_endpoints {
45 DUMMY = 0,
46 RT5682,
47 RT1019,
48 MAX98360A,
49 RT5682S,
50 NAU8825,
51 NAU8821,
52 MAX98388,
53 ES83XX,
56 struct acp_mach_ops {
57 int (*probe)(struct snd_soc_card *card);
58 int (*configure_link)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
59 int (*configure_widgets)(struct snd_soc_card *card);
60 int (*suspend_pre)(struct snd_soc_card *card);
61 int (*resume_post)(struct snd_soc_card *card);
64 struct acp_card_drvdata {
65 unsigned int hs_cpu_id;
66 unsigned int amp_cpu_id;
67 unsigned int bt_cpu_id;
68 unsigned int dmic_cpu_id;
69 unsigned int hs_codec_id;
70 unsigned int amp_codec_id;
71 unsigned int bt_codec_id;
72 unsigned int dmic_codec_id;
73 unsigned int dai_fmt;
74 unsigned int acp_rev;
75 struct clk *wclk;
76 struct clk *bclk;
77 struct acp_mach_ops ops;
78 struct snd_soc_acpi_mach *acpi_mach;
79 void *mach_priv;
80 bool soc_mclk;
81 bool tdm_mode;
84 int acp_sofdsp_dai_links_create(struct snd_soc_card *card);
85 int acp_legacy_dai_links_create(struct snd_soc_card *card);
86 extern const struct dmi_system_id acp_quirk_table[];
88 static inline int acp_ops_probe(struct snd_soc_card *card)
90 int ret = 1;
91 struct acp_card_drvdata *priv = acp_get_drvdata(card);
93 if (ACP_OPS(priv, probe))
94 ret = ACP_OPS(priv, probe)(card);
95 return ret;
98 static inline int acp_ops_configure_link(struct snd_soc_card *card,
99 struct snd_soc_dai_link *dai_link)
101 int ret = 1;
102 struct acp_card_drvdata *priv = acp_get_drvdata(card);
104 if (ACP_OPS(priv, configure_link))
105 ret = ACP_OPS(priv, configure_link)(card, dai_link);
106 return ret;
109 static inline int acp_ops_configure_widgets(struct snd_soc_card *card)
111 int ret = 1;
112 struct acp_card_drvdata *priv = acp_get_drvdata(card);
114 if (ACP_OPS(priv, configure_widgets))
115 ret = ACP_OPS(priv, configure_widgets)(card);
116 return ret;
119 static inline int acp_ops_suspend_pre(struct snd_soc_card *card)
121 int ret = 1;
122 struct acp_card_drvdata *priv = acp_get_drvdata(card);
124 if (ACP_OPS(priv, suspend_pre))
125 ret = ACP_OPS(priv, suspend_pre)(card);
126 return ret;
129 static inline int acp_ops_resume_post(struct snd_soc_card *card)
131 int ret = 1;
132 struct acp_card_drvdata *priv = acp_get_drvdata(card);
134 if (ACP_OPS(priv, resume_post))
135 ret = ACP_OPS(priv, resume_post)(card);
136 return ret;
139 #endif