xref: /openbmc/linux/sound/soc/amd/acp/acp-mach.h (revision aa74c44b)
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.
5  *
6  * Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved.
7  *
8  * Author: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
9  */
10 #ifndef __ACP_MACH_H
11 #define __ACP_MACH_H
12 
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>
20 #include <linux/gpio.h>
21 #include <linux/gpio/consumer.h>
22 
23 #define EN_SPKR_GPIO_GB                0x11F
24 #define EN_SPKR_GPIO_NK                0x146
25 #define EN_SPKR_GPIO_NONE      -EINVAL
26 
27 enum be_id {
28 	HEADSET_BE_ID = 0,
29 	AMP_BE_ID,
30 	DMIC_BE_ID,
31 };
32 
33 enum cpu_endpoints {
34 	NONE = 0,
35 	I2S_SP,
36 	I2S_BT,
37 	DMIC,
38 };
39 
40 enum codec_endpoints {
41 	DUMMY = 0,
42 	RT5682,
43 	RT1019,
44 	MAX98360A,
45 	RT5682S,
46 };
47 
48 struct acp_card_drvdata {
49 	unsigned int hs_cpu_id;
50 	unsigned int amp_cpu_id;
51 	unsigned int dmic_cpu_id;
52 	unsigned int hs_codec_id;
53 	unsigned int amp_codec_id;
54 	unsigned int dmic_codec_id;
55 	unsigned int dai_fmt;
56 	struct clk *wclk;
57 	struct clk *bclk;
58 	unsigned int gpio_spkr_en;
59 };
60 
61 int acp_sofdsp_dai_links_create(struct snd_soc_card *card);
62 int acp_legacy_dai_links_create(struct snd_soc_card *card);
63 int event_spkr_handler(struct snd_soc_dapm_widget *w,
64 			struct snd_kcontrol *k, int event);
65 #endif
66