162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * HD-audio codec verbs
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef __SOUND_HDA_VERBS_H
762306a36Sopenharmony_ci#define __SOUND_HDA_VERBS_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/*
1062306a36Sopenharmony_ci * nodes
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci#define	AC_NODE_ROOT		0x00
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/*
1562306a36Sopenharmony_ci * function group types
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_cienum {
1862306a36Sopenharmony_ci	AC_GRP_AUDIO_FUNCTION = 0x01,
1962306a36Sopenharmony_ci	AC_GRP_MODEM_FUNCTION = 0x02,
2062306a36Sopenharmony_ci};
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/*
2362306a36Sopenharmony_ci * widget types
2462306a36Sopenharmony_ci */
2562306a36Sopenharmony_cienum {
2662306a36Sopenharmony_ci	AC_WID_AUD_OUT,		/* Audio Out */
2762306a36Sopenharmony_ci	AC_WID_AUD_IN,		/* Audio In */
2862306a36Sopenharmony_ci	AC_WID_AUD_MIX,		/* Audio Mixer */
2962306a36Sopenharmony_ci	AC_WID_AUD_SEL,		/* Audio Selector */
3062306a36Sopenharmony_ci	AC_WID_PIN,		/* Pin Complex */
3162306a36Sopenharmony_ci	AC_WID_POWER,		/* Power */
3262306a36Sopenharmony_ci	AC_WID_VOL_KNB,		/* Volume Knob */
3362306a36Sopenharmony_ci	AC_WID_BEEP,		/* Beep Generator */
3462306a36Sopenharmony_ci	AC_WID_VENDOR = 0x0f	/* Vendor specific */
3562306a36Sopenharmony_ci};
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/*
3862306a36Sopenharmony_ci * GET verbs
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci#define AC_VERB_GET_STREAM_FORMAT		0x0a00
4162306a36Sopenharmony_ci#define AC_VERB_GET_AMP_GAIN_MUTE		0x0b00
4262306a36Sopenharmony_ci#define AC_VERB_GET_PROC_COEF			0x0c00
4362306a36Sopenharmony_ci#define AC_VERB_GET_COEF_INDEX			0x0d00
4462306a36Sopenharmony_ci#define AC_VERB_PARAMETERS			0x0f00
4562306a36Sopenharmony_ci#define AC_VERB_GET_CONNECT_SEL			0x0f01
4662306a36Sopenharmony_ci#define AC_VERB_GET_CONNECT_LIST		0x0f02
4762306a36Sopenharmony_ci#define AC_VERB_GET_PROC_STATE			0x0f03
4862306a36Sopenharmony_ci#define AC_VERB_GET_SDI_SELECT			0x0f04
4962306a36Sopenharmony_ci#define AC_VERB_GET_POWER_STATE			0x0f05
5062306a36Sopenharmony_ci#define AC_VERB_GET_CONV			0x0f06
5162306a36Sopenharmony_ci#define AC_VERB_GET_PIN_WIDGET_CONTROL		0x0f07
5262306a36Sopenharmony_ci#define AC_VERB_GET_UNSOLICITED_RESPONSE	0x0f08
5362306a36Sopenharmony_ci#define AC_VERB_GET_PIN_SENSE			0x0f09
5462306a36Sopenharmony_ci#define AC_VERB_GET_BEEP_CONTROL		0x0f0a
5562306a36Sopenharmony_ci#define AC_VERB_GET_EAPD_BTLENABLE		0x0f0c
5662306a36Sopenharmony_ci#define AC_VERB_GET_DIGI_CONVERT_1		0x0f0d
5762306a36Sopenharmony_ci#define AC_VERB_GET_DIGI_CONVERT_2		0x0f0e /* unused */
5862306a36Sopenharmony_ci#define AC_VERB_GET_VOLUME_KNOB_CONTROL		0x0f0f
5962306a36Sopenharmony_ci/* f10-f1a: GPIO */
6062306a36Sopenharmony_ci#define AC_VERB_GET_GPIO_DATA			0x0f15
6162306a36Sopenharmony_ci#define AC_VERB_GET_GPIO_MASK			0x0f16
6262306a36Sopenharmony_ci#define AC_VERB_GET_GPIO_DIRECTION		0x0f17
6362306a36Sopenharmony_ci#define AC_VERB_GET_GPIO_WAKE_MASK		0x0f18
6462306a36Sopenharmony_ci#define AC_VERB_GET_GPIO_UNSOLICITED_RSP_MASK	0x0f19
6562306a36Sopenharmony_ci#define AC_VERB_GET_GPIO_STICKY_MASK		0x0f1a
6662306a36Sopenharmony_ci#define AC_VERB_GET_CONFIG_DEFAULT		0x0f1c
6762306a36Sopenharmony_ci/* f20: AFG/MFG */
6862306a36Sopenharmony_ci#define AC_VERB_GET_SUBSYSTEM_ID		0x0f20
6962306a36Sopenharmony_ci#define AC_VERB_GET_STRIPE_CONTROL		0x0f24
7062306a36Sopenharmony_ci#define AC_VERB_GET_CVT_CHAN_COUNT		0x0f2d
7162306a36Sopenharmony_ci#define AC_VERB_GET_HDMI_DIP_SIZE		0x0f2e
7262306a36Sopenharmony_ci#define AC_VERB_GET_HDMI_ELDD			0x0f2f
7362306a36Sopenharmony_ci#define AC_VERB_GET_HDMI_DIP_INDEX		0x0f30
7462306a36Sopenharmony_ci#define AC_VERB_GET_HDMI_DIP_DATA		0x0f31
7562306a36Sopenharmony_ci#define AC_VERB_GET_HDMI_DIP_XMIT		0x0f32
7662306a36Sopenharmony_ci#define AC_VERB_GET_HDMI_CP_CTRL		0x0f33
7762306a36Sopenharmony_ci#define AC_VERB_GET_HDMI_CHAN_SLOT		0x0f34
7862306a36Sopenharmony_ci#define AC_VERB_GET_DEVICE_SEL			0xf35
7962306a36Sopenharmony_ci#define AC_VERB_GET_DEVICE_LIST			0xf36
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci/*
8262306a36Sopenharmony_ci * SET verbs
8362306a36Sopenharmony_ci */
8462306a36Sopenharmony_ci#define AC_VERB_SET_STREAM_FORMAT		0x200
8562306a36Sopenharmony_ci#define AC_VERB_SET_AMP_GAIN_MUTE		0x300
8662306a36Sopenharmony_ci#define AC_VERB_SET_PROC_COEF			0x400
8762306a36Sopenharmony_ci#define AC_VERB_SET_COEF_INDEX			0x500
8862306a36Sopenharmony_ci#define AC_VERB_SET_CONNECT_SEL			0x701
8962306a36Sopenharmony_ci#define AC_VERB_SET_PROC_STATE			0x703
9062306a36Sopenharmony_ci#define AC_VERB_SET_SDI_SELECT			0x704
9162306a36Sopenharmony_ci#define AC_VERB_SET_POWER_STATE			0x705
9262306a36Sopenharmony_ci#define AC_VERB_SET_CHANNEL_STREAMID		0x706
9362306a36Sopenharmony_ci#define AC_VERB_SET_PIN_WIDGET_CONTROL		0x707
9462306a36Sopenharmony_ci#define AC_VERB_SET_UNSOLICITED_ENABLE		0x708
9562306a36Sopenharmony_ci#define AC_VERB_SET_PIN_SENSE			0x709
9662306a36Sopenharmony_ci#define AC_VERB_SET_BEEP_CONTROL		0x70a
9762306a36Sopenharmony_ci#define AC_VERB_SET_EAPD_BTLENABLE		0x70c
9862306a36Sopenharmony_ci#define AC_VERB_SET_DIGI_CONVERT_1		0x70d
9962306a36Sopenharmony_ci#define AC_VERB_SET_DIGI_CONVERT_2		0x70e
10062306a36Sopenharmony_ci#define AC_VERB_SET_DIGI_CONVERT_3		0x73e
10162306a36Sopenharmony_ci#define AC_VERB_SET_VOLUME_KNOB_CONTROL		0x70f
10262306a36Sopenharmony_ci#define AC_VERB_SET_GPIO_DATA			0x715
10362306a36Sopenharmony_ci#define AC_VERB_SET_GPIO_MASK			0x716
10462306a36Sopenharmony_ci#define AC_VERB_SET_GPIO_DIRECTION		0x717
10562306a36Sopenharmony_ci#define AC_VERB_SET_GPIO_WAKE_MASK		0x718
10662306a36Sopenharmony_ci#define AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK	0x719
10762306a36Sopenharmony_ci#define AC_VERB_SET_GPIO_STICKY_MASK		0x71a
10862306a36Sopenharmony_ci#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_0	0x71c
10962306a36Sopenharmony_ci#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_1	0x71d
11062306a36Sopenharmony_ci#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_2	0x71e
11162306a36Sopenharmony_ci#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_3	0x71f
11262306a36Sopenharmony_ci#define AC_VERB_SET_EAPD				0x788
11362306a36Sopenharmony_ci#define AC_VERB_SET_CODEC_RESET			0x7ff
11462306a36Sopenharmony_ci#define AC_VERB_SET_STRIPE_CONTROL		0x724
11562306a36Sopenharmony_ci#define AC_VERB_SET_CVT_CHAN_COUNT		0x72d
11662306a36Sopenharmony_ci#define AC_VERB_SET_HDMI_DIP_INDEX		0x730
11762306a36Sopenharmony_ci#define AC_VERB_SET_HDMI_DIP_DATA		0x731
11862306a36Sopenharmony_ci#define AC_VERB_SET_HDMI_DIP_XMIT		0x732
11962306a36Sopenharmony_ci#define AC_VERB_SET_HDMI_CP_CTRL		0x733
12062306a36Sopenharmony_ci#define AC_VERB_SET_HDMI_CHAN_SLOT		0x734
12162306a36Sopenharmony_ci#define AC_VERB_SET_DEVICE_SEL			0x735
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci/*
12462306a36Sopenharmony_ci * Parameter IDs
12562306a36Sopenharmony_ci */
12662306a36Sopenharmony_ci#define AC_PAR_VENDOR_ID		0x00
12762306a36Sopenharmony_ci#define AC_PAR_SUBSYSTEM_ID		0x01
12862306a36Sopenharmony_ci#define AC_PAR_REV_ID			0x02
12962306a36Sopenharmony_ci#define AC_PAR_NODE_COUNT		0x04
13062306a36Sopenharmony_ci#define AC_PAR_FUNCTION_TYPE		0x05
13162306a36Sopenharmony_ci#define AC_PAR_AUDIO_FG_CAP		0x08
13262306a36Sopenharmony_ci#define AC_PAR_AUDIO_WIDGET_CAP		0x09
13362306a36Sopenharmony_ci#define AC_PAR_PCM			0x0a
13462306a36Sopenharmony_ci#define AC_PAR_STREAM			0x0b
13562306a36Sopenharmony_ci#define AC_PAR_PIN_CAP			0x0c
13662306a36Sopenharmony_ci#define AC_PAR_AMP_IN_CAP		0x0d
13762306a36Sopenharmony_ci#define AC_PAR_CONNLIST_LEN		0x0e
13862306a36Sopenharmony_ci#define AC_PAR_POWER_STATE		0x0f
13962306a36Sopenharmony_ci#define AC_PAR_PROC_CAP			0x10
14062306a36Sopenharmony_ci#define AC_PAR_GPIO_CAP			0x11
14162306a36Sopenharmony_ci#define AC_PAR_AMP_OUT_CAP		0x12
14262306a36Sopenharmony_ci#define AC_PAR_VOL_KNB_CAP		0x13
14362306a36Sopenharmony_ci#define AC_PAR_DEVLIST_LEN		0x15
14462306a36Sopenharmony_ci#define AC_PAR_HDMI_LPCM_CAP		0x20
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci/*
14762306a36Sopenharmony_ci * AC_VERB_PARAMETERS results (32bit)
14862306a36Sopenharmony_ci */
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci/* Function Group Type */
15162306a36Sopenharmony_ci#define AC_FGT_TYPE			(0xff<<0)
15262306a36Sopenharmony_ci#define AC_FGT_TYPE_SHIFT		0
15362306a36Sopenharmony_ci#define AC_FGT_UNSOL_CAP		(1<<8)
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci/* Audio Function Group Capabilities */
15662306a36Sopenharmony_ci#define AC_AFG_OUT_DELAY		(0xf<<0)
15762306a36Sopenharmony_ci#define AC_AFG_IN_DELAY			(0xf<<8)
15862306a36Sopenharmony_ci#define AC_AFG_BEEP_GEN			(1<<16)
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/* Audio Widget Capabilities */
16162306a36Sopenharmony_ci#define AC_WCAP_STEREO			(1<<0)	/* stereo I/O */
16262306a36Sopenharmony_ci#define AC_WCAP_IN_AMP			(1<<1)	/* AMP-in present */
16362306a36Sopenharmony_ci#define AC_WCAP_OUT_AMP			(1<<2)	/* AMP-out present */
16462306a36Sopenharmony_ci#define AC_WCAP_AMP_OVRD		(1<<3)	/* AMP-parameter override */
16562306a36Sopenharmony_ci#define AC_WCAP_FORMAT_OVRD		(1<<4)	/* format override */
16662306a36Sopenharmony_ci#define AC_WCAP_STRIPE			(1<<5)	/* stripe */
16762306a36Sopenharmony_ci#define AC_WCAP_PROC_WID		(1<<6)	/* Proc Widget */
16862306a36Sopenharmony_ci#define AC_WCAP_UNSOL_CAP		(1<<7)	/* Unsol capable */
16962306a36Sopenharmony_ci#define AC_WCAP_CONN_LIST		(1<<8)	/* connection list */
17062306a36Sopenharmony_ci#define AC_WCAP_DIGITAL			(1<<9)	/* digital I/O */
17162306a36Sopenharmony_ci#define AC_WCAP_POWER			(1<<10)	/* power control */
17262306a36Sopenharmony_ci#define AC_WCAP_LR_SWAP			(1<<11)	/* L/R swap */
17362306a36Sopenharmony_ci#define AC_WCAP_CP_CAPS			(1<<12) /* content protection */
17462306a36Sopenharmony_ci#define AC_WCAP_CHAN_CNT_EXT		(7<<13)	/* channel count ext */
17562306a36Sopenharmony_ci#define AC_WCAP_DELAY			(0xf<<16)
17662306a36Sopenharmony_ci#define AC_WCAP_DELAY_SHIFT		16
17762306a36Sopenharmony_ci#define AC_WCAP_TYPE			(0xf<<20)
17862306a36Sopenharmony_ci#define AC_WCAP_TYPE_SHIFT		20
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci/* supported PCM rates and bits */
18162306a36Sopenharmony_ci#define AC_SUPPCM_RATES			(0xfff << 0)
18262306a36Sopenharmony_ci#define AC_SUPPCM_BITS_8		(1<<16)
18362306a36Sopenharmony_ci#define AC_SUPPCM_BITS_16		(1<<17)
18462306a36Sopenharmony_ci#define AC_SUPPCM_BITS_20		(1<<18)
18562306a36Sopenharmony_ci#define AC_SUPPCM_BITS_24		(1<<19)
18662306a36Sopenharmony_ci#define AC_SUPPCM_BITS_32		(1<<20)
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci/* supported PCM stream format */
18962306a36Sopenharmony_ci#define AC_SUPFMT_PCM			(1<<0)
19062306a36Sopenharmony_ci#define AC_SUPFMT_FLOAT32		(1<<1)
19162306a36Sopenharmony_ci#define AC_SUPFMT_AC3			(1<<2)
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci/* GP I/O count */
19462306a36Sopenharmony_ci#define AC_GPIO_IO_COUNT		(0xff<<0)
19562306a36Sopenharmony_ci#define AC_GPIO_O_COUNT			(0xff<<8)
19662306a36Sopenharmony_ci#define AC_GPIO_O_COUNT_SHIFT		8
19762306a36Sopenharmony_ci#define AC_GPIO_I_COUNT			(0xff<<16)
19862306a36Sopenharmony_ci#define AC_GPIO_I_COUNT_SHIFT		16
19962306a36Sopenharmony_ci#define AC_GPIO_UNSOLICITED		(1<<30)
20062306a36Sopenharmony_ci#define AC_GPIO_WAKE			(1<<31)
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci/* Converter stream, channel */
20362306a36Sopenharmony_ci#define AC_CONV_CHANNEL			(0xf<<0)
20462306a36Sopenharmony_ci#define AC_CONV_STREAM			(0xf<<4)
20562306a36Sopenharmony_ci#define AC_CONV_STREAM_SHIFT		4
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci/* Input converter SDI select */
20862306a36Sopenharmony_ci#define AC_SDI_SELECT			(0xf<<0)
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci/* stream format id */
21162306a36Sopenharmony_ci#define AC_FMT_CHAN_SHIFT		0
21262306a36Sopenharmony_ci#define AC_FMT_CHAN_MASK		(0x0f << 0)
21362306a36Sopenharmony_ci#define AC_FMT_BITS_SHIFT		4
21462306a36Sopenharmony_ci#define AC_FMT_BITS_MASK		(7 << 4)
21562306a36Sopenharmony_ci#define AC_FMT_BITS_8			(0 << 4)
21662306a36Sopenharmony_ci#define AC_FMT_BITS_16			(1 << 4)
21762306a36Sopenharmony_ci#define AC_FMT_BITS_20			(2 << 4)
21862306a36Sopenharmony_ci#define AC_FMT_BITS_24			(3 << 4)
21962306a36Sopenharmony_ci#define AC_FMT_BITS_32			(4 << 4)
22062306a36Sopenharmony_ci#define AC_FMT_DIV_SHIFT		8
22162306a36Sopenharmony_ci#define AC_FMT_DIV_MASK			(7 << 8)
22262306a36Sopenharmony_ci#define AC_FMT_MULT_SHIFT		11
22362306a36Sopenharmony_ci#define AC_FMT_MULT_MASK		(7 << 11)
22462306a36Sopenharmony_ci#define AC_FMT_BASE_SHIFT		14
22562306a36Sopenharmony_ci#define AC_FMT_BASE_48K			(0 << 14)
22662306a36Sopenharmony_ci#define AC_FMT_BASE_44K			(1 << 14)
22762306a36Sopenharmony_ci#define AC_FMT_TYPE_SHIFT		15
22862306a36Sopenharmony_ci#define AC_FMT_TYPE_PCM			(0 << 15)
22962306a36Sopenharmony_ci#define AC_FMT_TYPE_NON_PCM		(1 << 15)
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci/* Unsolicited response control */
23262306a36Sopenharmony_ci#define AC_UNSOL_TAG			(0x3f<<0)
23362306a36Sopenharmony_ci#define AC_UNSOL_ENABLED		(1<<7)
23462306a36Sopenharmony_ci#define AC_USRSP_EN			AC_UNSOL_ENABLED
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci/* Unsolicited responses */
23762306a36Sopenharmony_ci#define AC_UNSOL_RES_TAG		(0x3f<<26)
23862306a36Sopenharmony_ci#define AC_UNSOL_RES_TAG_SHIFT		26
23962306a36Sopenharmony_ci#define AC_UNSOL_RES_SUBTAG		(0x1f<<21)
24062306a36Sopenharmony_ci#define AC_UNSOL_RES_SUBTAG_SHIFT	21
24162306a36Sopenharmony_ci#define AC_UNSOL_RES_DE			(0x3f<<15)  /* Device Entry
24262306a36Sopenharmony_ci						     * (for DP1.2 MST)
24362306a36Sopenharmony_ci						     */
24462306a36Sopenharmony_ci#define AC_UNSOL_RES_DE_SHIFT		15
24562306a36Sopenharmony_ci#define AC_UNSOL_RES_IA			(1<<2)	/* Inactive (for DP1.2 MST) */
24662306a36Sopenharmony_ci#define AC_UNSOL_RES_ELDV		(1<<1)	/* ELD Data valid (for HDMI) */
24762306a36Sopenharmony_ci#define AC_UNSOL_RES_PD			(1<<0)	/* pinsense detect */
24862306a36Sopenharmony_ci#define AC_UNSOL_RES_CP_STATE		(1<<1)	/* content protection */
24962306a36Sopenharmony_ci#define AC_UNSOL_RES_CP_READY		(1<<0)	/* content protection */
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci/* Pin widget capabilies */
25262306a36Sopenharmony_ci#define AC_PINCAP_IMP_SENSE		(1<<0)	/* impedance sense capable */
25362306a36Sopenharmony_ci#define AC_PINCAP_TRIG_REQ		(1<<1)	/* trigger required */
25462306a36Sopenharmony_ci#define AC_PINCAP_PRES_DETECT		(1<<2)	/* presence detect capable */
25562306a36Sopenharmony_ci#define AC_PINCAP_HP_DRV		(1<<3)	/* headphone drive capable */
25662306a36Sopenharmony_ci#define AC_PINCAP_OUT			(1<<4)	/* output capable */
25762306a36Sopenharmony_ci#define AC_PINCAP_IN			(1<<5)	/* input capable */
25862306a36Sopenharmony_ci#define AC_PINCAP_BALANCE		(1<<6)	/* balanced I/O capable */
25962306a36Sopenharmony_ci/* Note: This LR_SWAP pincap is defined in the Realtek ALC883 specification,
26062306a36Sopenharmony_ci *       but is marked reserved in the Intel HDA specification.
26162306a36Sopenharmony_ci */
26262306a36Sopenharmony_ci#define AC_PINCAP_LR_SWAP		(1<<7)	/* L/R swap */
26362306a36Sopenharmony_ci/* Note: The same bit as LR_SWAP is newly defined as HDMI capability
26462306a36Sopenharmony_ci *       in HD-audio specification
26562306a36Sopenharmony_ci */
26662306a36Sopenharmony_ci#define AC_PINCAP_HDMI			(1<<7)	/* HDMI pin */
26762306a36Sopenharmony_ci#define AC_PINCAP_DP			(1<<24)	/* DisplayPort pin, can
26862306a36Sopenharmony_ci						 * coexist with AC_PINCAP_HDMI
26962306a36Sopenharmony_ci						 */
27062306a36Sopenharmony_ci#define AC_PINCAP_VREF			(0x37<<8)
27162306a36Sopenharmony_ci#define AC_PINCAP_VREF_SHIFT		8
27262306a36Sopenharmony_ci#define AC_PINCAP_EAPD			(1<<16)	/* EAPD capable */
27362306a36Sopenharmony_ci#define AC_PINCAP_HBR			(1<<27)	/* High Bit Rate */
27462306a36Sopenharmony_ci/* Vref status (used in pin cap) */
27562306a36Sopenharmony_ci#define AC_PINCAP_VREF_HIZ		(1<<0)	/* Hi-Z */
27662306a36Sopenharmony_ci#define AC_PINCAP_VREF_50		(1<<1)	/* 50% */
27762306a36Sopenharmony_ci#define AC_PINCAP_VREF_GRD		(1<<2)	/* ground */
27862306a36Sopenharmony_ci#define AC_PINCAP_VREF_80		(1<<4)	/* 80% */
27962306a36Sopenharmony_ci#define AC_PINCAP_VREF_100		(1<<5)	/* 100% */
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci/* Amplifier capabilities */
28262306a36Sopenharmony_ci#define AC_AMPCAP_OFFSET		(0x7f<<0)  /* 0dB offset */
28362306a36Sopenharmony_ci#define AC_AMPCAP_OFFSET_SHIFT		0
28462306a36Sopenharmony_ci#define AC_AMPCAP_NUM_STEPS		(0x7f<<8)  /* number of steps */
28562306a36Sopenharmony_ci#define AC_AMPCAP_NUM_STEPS_SHIFT	8
28662306a36Sopenharmony_ci#define AC_AMPCAP_STEP_SIZE		(0x7f<<16) /* step size 0-32dB
28762306a36Sopenharmony_ci						    * in 0.25dB
28862306a36Sopenharmony_ci						    */
28962306a36Sopenharmony_ci#define AC_AMPCAP_STEP_SIZE_SHIFT	16
29062306a36Sopenharmony_ci#define AC_AMPCAP_MUTE			(1<<31)    /* mute capable */
29162306a36Sopenharmony_ci#define AC_AMPCAP_MUTE_SHIFT		31
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci/* driver-specific amp-caps: using bits 24-30 */
29462306a36Sopenharmony_ci#define AC_AMPCAP_MIN_MUTE		(1 << 30) /* min-volume = mute */
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci/* Connection list */
29762306a36Sopenharmony_ci#define AC_CLIST_LENGTH			(0x7f<<0)
29862306a36Sopenharmony_ci#define AC_CLIST_LONG			(1<<7)
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci/* Supported power status */
30162306a36Sopenharmony_ci#define AC_PWRST_D0SUP			(1<<0)
30262306a36Sopenharmony_ci#define AC_PWRST_D1SUP			(1<<1)
30362306a36Sopenharmony_ci#define AC_PWRST_D2SUP			(1<<2)
30462306a36Sopenharmony_ci#define AC_PWRST_D3SUP			(1<<3)
30562306a36Sopenharmony_ci#define AC_PWRST_D3COLDSUP		(1<<4)
30662306a36Sopenharmony_ci#define AC_PWRST_S3D3COLDSUP		(1<<29)
30762306a36Sopenharmony_ci#define AC_PWRST_CLKSTOP		(1<<30)
30862306a36Sopenharmony_ci#define AC_PWRST_EPSS			(1U<<31)
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci/* Power state values */
31162306a36Sopenharmony_ci#define AC_PWRST_SETTING		(0xf<<0)
31262306a36Sopenharmony_ci#define AC_PWRST_ACTUAL			(0xf<<4)
31362306a36Sopenharmony_ci#define AC_PWRST_ACTUAL_SHIFT		4
31462306a36Sopenharmony_ci#define AC_PWRST_D0			0x00
31562306a36Sopenharmony_ci#define AC_PWRST_D1			0x01
31662306a36Sopenharmony_ci#define AC_PWRST_D2			0x02
31762306a36Sopenharmony_ci#define AC_PWRST_D3			0x03
31862306a36Sopenharmony_ci#define AC_PWRST_ERROR                  (1<<8)
31962306a36Sopenharmony_ci#define AC_PWRST_CLK_STOP_OK            (1<<9)
32062306a36Sopenharmony_ci#define AC_PWRST_SETTING_RESET          (1<<10)
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci/* Processing capabilies */
32362306a36Sopenharmony_ci#define AC_PCAP_BENIGN			(1<<0)
32462306a36Sopenharmony_ci#define AC_PCAP_NUM_COEF		(0xff<<8)
32562306a36Sopenharmony_ci#define AC_PCAP_NUM_COEF_SHIFT		8
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci/* Volume knobs capabilities */
32862306a36Sopenharmony_ci#define AC_KNBCAP_NUM_STEPS		(0x7f<<0)
32962306a36Sopenharmony_ci#define AC_KNBCAP_DELTA			(1<<7)
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci/* HDMI LPCM capabilities */
33262306a36Sopenharmony_ci#define AC_LPCMCAP_48K_CP_CHNS		(0x0f<<0) /* max channels w/ CP-on */
33362306a36Sopenharmony_ci#define AC_LPCMCAP_48K_NO_CHNS		(0x0f<<4) /* max channels w/o CP-on */
33462306a36Sopenharmony_ci#define AC_LPCMCAP_48K_20BIT		(1<<8)	/* 20b bitrate supported */
33562306a36Sopenharmony_ci#define AC_LPCMCAP_48K_24BIT		(1<<9)	/* 24b bitrate supported */
33662306a36Sopenharmony_ci#define AC_LPCMCAP_96K_CP_CHNS		(0x0f<<10) /* max channels w/ CP-on */
33762306a36Sopenharmony_ci#define AC_LPCMCAP_96K_NO_CHNS		(0x0f<<14) /* max channels w/o CP-on */
33862306a36Sopenharmony_ci#define AC_LPCMCAP_96K_20BIT		(1<<18)	/* 20b bitrate supported */
33962306a36Sopenharmony_ci#define AC_LPCMCAP_96K_24BIT		(1<<19)	/* 24b bitrate supported */
34062306a36Sopenharmony_ci#define AC_LPCMCAP_192K_CP_CHNS		(0x0f<<20) /* max channels w/ CP-on */
34162306a36Sopenharmony_ci#define AC_LPCMCAP_192K_NO_CHNS		(0x0f<<24) /* max channels w/o CP-on */
34262306a36Sopenharmony_ci#define AC_LPCMCAP_192K_20BIT		(1<<28)	/* 20b bitrate supported */
34362306a36Sopenharmony_ci#define AC_LPCMCAP_192K_24BIT		(1<<29)	/* 24b bitrate supported */
34462306a36Sopenharmony_ci#define AC_LPCMCAP_44K			(1<<30)	/* 44.1kHz support */
34562306a36Sopenharmony_ci#define AC_LPCMCAP_44K_MS		(1<<31)	/* 44.1kHz-multiplies support */
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci/* Display pin's device list length */
34862306a36Sopenharmony_ci#define AC_DEV_LIST_LEN_MASK		0x3f
34962306a36Sopenharmony_ci#define AC_MAX_DEV_LIST_LEN		64
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_ci/*
35262306a36Sopenharmony_ci * Control Parameters
35362306a36Sopenharmony_ci */
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ci/* Amp gain/mute */
35662306a36Sopenharmony_ci#define AC_AMP_MUTE			(1<<7)
35762306a36Sopenharmony_ci#define AC_AMP_GAIN			(0x7f)
35862306a36Sopenharmony_ci#define AC_AMP_GET_INDEX		(0xf<<0)
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci#define AC_AMP_GET_LEFT			(1<<13)
36162306a36Sopenharmony_ci#define AC_AMP_GET_RIGHT		(0<<13)
36262306a36Sopenharmony_ci#define AC_AMP_GET_OUTPUT		(1<<15)
36362306a36Sopenharmony_ci#define AC_AMP_GET_INPUT		(0<<15)
36462306a36Sopenharmony_ci
36562306a36Sopenharmony_ci#define AC_AMP_SET_INDEX		(0xf<<8)
36662306a36Sopenharmony_ci#define AC_AMP_SET_INDEX_SHIFT		8
36762306a36Sopenharmony_ci#define AC_AMP_SET_RIGHT		(1<<12)
36862306a36Sopenharmony_ci#define AC_AMP_SET_LEFT			(1<<13)
36962306a36Sopenharmony_ci#define AC_AMP_SET_INPUT		(1<<14)
37062306a36Sopenharmony_ci#define AC_AMP_SET_OUTPUT		(1<<15)
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_ci/* DIGITAL1 bits */
37362306a36Sopenharmony_ci#define AC_DIG1_ENABLE			(1<<0)
37462306a36Sopenharmony_ci#define AC_DIG1_V			(1<<1)
37562306a36Sopenharmony_ci#define AC_DIG1_VCFG			(1<<2)
37662306a36Sopenharmony_ci#define AC_DIG1_EMPHASIS		(1<<3)
37762306a36Sopenharmony_ci#define AC_DIG1_COPYRIGHT		(1<<4)
37862306a36Sopenharmony_ci#define AC_DIG1_NONAUDIO		(1<<5)
37962306a36Sopenharmony_ci#define AC_DIG1_PROFESSIONAL		(1<<6)
38062306a36Sopenharmony_ci#define AC_DIG1_LEVEL			(1<<7)
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_ci/* DIGITAL2 bits */
38362306a36Sopenharmony_ci#define AC_DIG2_CC			(0x7f<<0)
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci/* DIGITAL3 bits */
38662306a36Sopenharmony_ci#define AC_DIG3_ICT			(0xf<<0)
38762306a36Sopenharmony_ci#define AC_DIG3_KAE			(1<<7)
38862306a36Sopenharmony_ci
38962306a36Sopenharmony_ci/* Pin widget control - 8bit */
39062306a36Sopenharmony_ci#define AC_PINCTL_EPT			(0x3<<0)
39162306a36Sopenharmony_ci#define AC_PINCTL_EPT_NATIVE		0
39262306a36Sopenharmony_ci#define AC_PINCTL_EPT_HBR		3
39362306a36Sopenharmony_ci#define AC_PINCTL_VREFEN		(0x7<<0)
39462306a36Sopenharmony_ci#define AC_PINCTL_VREF_HIZ		0	/* Hi-Z */
39562306a36Sopenharmony_ci#define AC_PINCTL_VREF_50		1	/* 50% */
39662306a36Sopenharmony_ci#define AC_PINCTL_VREF_GRD		2	/* ground */
39762306a36Sopenharmony_ci#define AC_PINCTL_VREF_80		4	/* 80% */
39862306a36Sopenharmony_ci#define AC_PINCTL_VREF_100		5	/* 100% */
39962306a36Sopenharmony_ci#define AC_PINCTL_IN_EN			(1<<5)
40062306a36Sopenharmony_ci#define AC_PINCTL_OUT_EN		(1<<6)
40162306a36Sopenharmony_ci#define AC_PINCTL_HP_EN			(1<<7)
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ci/* Pin sense - 32bit */
40462306a36Sopenharmony_ci#define AC_PINSENSE_IMPEDANCE_MASK	(0x7fffffff)
40562306a36Sopenharmony_ci#define AC_PINSENSE_PRESENCE		(1<<31)
40662306a36Sopenharmony_ci#define AC_PINSENSE_ELDV		(1<<30)	/* ELD valid (HDMI) */
40762306a36Sopenharmony_ci
40862306a36Sopenharmony_ci/* EAPD/BTL enable - 32bit */
40962306a36Sopenharmony_ci#define AC_EAPDBTL_BALANCED		(1<<0)
41062306a36Sopenharmony_ci#define AC_EAPDBTL_EAPD			(1<<1)
41162306a36Sopenharmony_ci#define AC_EAPDBTL_LR_SWAP		(1<<2)
41262306a36Sopenharmony_ci
41362306a36Sopenharmony_ci/* HDMI ELD data */
41462306a36Sopenharmony_ci#define AC_ELDD_ELD_VALID		(1<<31)
41562306a36Sopenharmony_ci#define AC_ELDD_ELD_DATA		0xff
41662306a36Sopenharmony_ci
41762306a36Sopenharmony_ci/* HDMI DIP size */
41862306a36Sopenharmony_ci#define AC_DIPSIZE_ELD_BUF		(1<<3) /* ELD buf size of packet size */
41962306a36Sopenharmony_ci#define AC_DIPSIZE_PACK_IDX		(0x07<<0) /* packet index */
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ci/* HDMI DIP index */
42262306a36Sopenharmony_ci#define AC_DIPIDX_PACK_IDX		(0x07<<5) /* packet idnex */
42362306a36Sopenharmony_ci#define AC_DIPIDX_BYTE_IDX		(0x1f<<0) /* byte index */
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci/* HDMI DIP xmit (transmit) control */
42662306a36Sopenharmony_ci#define AC_DIPXMIT_MASK			(0x3<<6)
42762306a36Sopenharmony_ci#define AC_DIPXMIT_DISABLE		(0x0<<6) /* disable xmit */
42862306a36Sopenharmony_ci#define AC_DIPXMIT_ONCE			(0x2<<6) /* xmit once then disable */
42962306a36Sopenharmony_ci#define AC_DIPXMIT_BEST			(0x3<<6) /* best effort */
43062306a36Sopenharmony_ci
43162306a36Sopenharmony_ci/* HDMI content protection (CP) control */
43262306a36Sopenharmony_ci#define AC_CPCTRL_CES			(1<<9) /* current encryption state */
43362306a36Sopenharmony_ci#define AC_CPCTRL_READY			(1<<8) /* ready bit */
43462306a36Sopenharmony_ci#define AC_CPCTRL_SUBTAG		(0x1f<<3) /* subtag for unsol-resp */
43562306a36Sopenharmony_ci#define AC_CPCTRL_STATE			(3<<0) /* current CP request state */
43662306a36Sopenharmony_ci
43762306a36Sopenharmony_ci/* Converter channel <-> HDMI slot mapping */
43862306a36Sopenharmony_ci#define AC_CVTMAP_HDMI_SLOT		(0xf<<0) /* HDMI slot number */
43962306a36Sopenharmony_ci#define AC_CVTMAP_CHAN			(0xf<<4) /* converter channel number */
44062306a36Sopenharmony_ci
44162306a36Sopenharmony_ci/* configuration default - 32bit */
44262306a36Sopenharmony_ci#define AC_DEFCFG_SEQUENCE		(0xf<<0)
44362306a36Sopenharmony_ci#define AC_DEFCFG_DEF_ASSOC		(0xf<<4)
44462306a36Sopenharmony_ci#define AC_DEFCFG_ASSOC_SHIFT		4
44562306a36Sopenharmony_ci#define AC_DEFCFG_MISC			(0xf<<8)
44662306a36Sopenharmony_ci#define AC_DEFCFG_MISC_SHIFT		8
44762306a36Sopenharmony_ci#define AC_DEFCFG_MISC_NO_PRESENCE	(1<<0)
44862306a36Sopenharmony_ci#define AC_DEFCFG_COLOR			(0xf<<12)
44962306a36Sopenharmony_ci#define AC_DEFCFG_COLOR_SHIFT		12
45062306a36Sopenharmony_ci#define AC_DEFCFG_CONN_TYPE		(0xf<<16)
45162306a36Sopenharmony_ci#define AC_DEFCFG_CONN_TYPE_SHIFT	16
45262306a36Sopenharmony_ci#define AC_DEFCFG_DEVICE		(0xf<<20)
45362306a36Sopenharmony_ci#define AC_DEFCFG_DEVICE_SHIFT		20
45462306a36Sopenharmony_ci#define AC_DEFCFG_LOCATION		(0x3f<<24)
45562306a36Sopenharmony_ci#define AC_DEFCFG_LOCATION_SHIFT	24
45662306a36Sopenharmony_ci#define AC_DEFCFG_PORT_CONN		(0x3<<30)
45762306a36Sopenharmony_ci#define AC_DEFCFG_PORT_CONN_SHIFT	30
45862306a36Sopenharmony_ci
45962306a36Sopenharmony_ci/* Display pin's device list entry */
46062306a36Sopenharmony_ci#define AC_DE_PD			(1<<0)
46162306a36Sopenharmony_ci#define AC_DE_ELDV			(1<<1)
46262306a36Sopenharmony_ci#define AC_DE_IA			(1<<2)
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_ci/* device types (0x0-0xf) */
46562306a36Sopenharmony_cienum {
46662306a36Sopenharmony_ci	AC_JACK_LINE_OUT,
46762306a36Sopenharmony_ci	AC_JACK_SPEAKER,
46862306a36Sopenharmony_ci	AC_JACK_HP_OUT,
46962306a36Sopenharmony_ci	AC_JACK_CD,
47062306a36Sopenharmony_ci	AC_JACK_SPDIF_OUT,
47162306a36Sopenharmony_ci	AC_JACK_DIG_OTHER_OUT,
47262306a36Sopenharmony_ci	AC_JACK_MODEM_LINE_SIDE,
47362306a36Sopenharmony_ci	AC_JACK_MODEM_HAND_SIDE,
47462306a36Sopenharmony_ci	AC_JACK_LINE_IN,
47562306a36Sopenharmony_ci	AC_JACK_AUX,
47662306a36Sopenharmony_ci	AC_JACK_MIC_IN,
47762306a36Sopenharmony_ci	AC_JACK_TELEPHONY,
47862306a36Sopenharmony_ci	AC_JACK_SPDIF_IN,
47962306a36Sopenharmony_ci	AC_JACK_DIG_OTHER_IN,
48062306a36Sopenharmony_ci	AC_JACK_OTHER = 0xf,
48162306a36Sopenharmony_ci};
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci/* jack connection types (0x0-0xf) */
48462306a36Sopenharmony_cienum {
48562306a36Sopenharmony_ci	AC_JACK_CONN_UNKNOWN,
48662306a36Sopenharmony_ci	AC_JACK_CONN_1_8,
48762306a36Sopenharmony_ci	AC_JACK_CONN_1_4,
48862306a36Sopenharmony_ci	AC_JACK_CONN_ATAPI,
48962306a36Sopenharmony_ci	AC_JACK_CONN_RCA,
49062306a36Sopenharmony_ci	AC_JACK_CONN_OPTICAL,
49162306a36Sopenharmony_ci	AC_JACK_CONN_OTHER_DIGITAL,
49262306a36Sopenharmony_ci	AC_JACK_CONN_OTHER_ANALOG,
49362306a36Sopenharmony_ci	AC_JACK_CONN_DIN,
49462306a36Sopenharmony_ci	AC_JACK_CONN_XLR,
49562306a36Sopenharmony_ci	AC_JACK_CONN_RJ11,
49662306a36Sopenharmony_ci	AC_JACK_CONN_COMB,
49762306a36Sopenharmony_ci	AC_JACK_CONN_OTHER = 0xf,
49862306a36Sopenharmony_ci};
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_ci/* jack colors (0x0-0xf) */
50162306a36Sopenharmony_cienum {
50262306a36Sopenharmony_ci	AC_JACK_COLOR_UNKNOWN,
50362306a36Sopenharmony_ci	AC_JACK_COLOR_BLACK,
50462306a36Sopenharmony_ci	AC_JACK_COLOR_GREY,
50562306a36Sopenharmony_ci	AC_JACK_COLOR_BLUE,
50662306a36Sopenharmony_ci	AC_JACK_COLOR_GREEN,
50762306a36Sopenharmony_ci	AC_JACK_COLOR_RED,
50862306a36Sopenharmony_ci	AC_JACK_COLOR_ORANGE,
50962306a36Sopenharmony_ci	AC_JACK_COLOR_YELLOW,
51062306a36Sopenharmony_ci	AC_JACK_COLOR_PURPLE,
51162306a36Sopenharmony_ci	AC_JACK_COLOR_PINK,
51262306a36Sopenharmony_ci	AC_JACK_COLOR_WHITE = 0xe,
51362306a36Sopenharmony_ci	AC_JACK_COLOR_OTHER,
51462306a36Sopenharmony_ci};
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_ci/* Jack location (0x0-0x3f) */
51762306a36Sopenharmony_ci/* common case */
51862306a36Sopenharmony_cienum {
51962306a36Sopenharmony_ci	AC_JACK_LOC_NONE,
52062306a36Sopenharmony_ci	AC_JACK_LOC_REAR,
52162306a36Sopenharmony_ci	AC_JACK_LOC_FRONT,
52262306a36Sopenharmony_ci	AC_JACK_LOC_LEFT,
52362306a36Sopenharmony_ci	AC_JACK_LOC_RIGHT,
52462306a36Sopenharmony_ci	AC_JACK_LOC_TOP,
52562306a36Sopenharmony_ci	AC_JACK_LOC_BOTTOM,
52662306a36Sopenharmony_ci};
52762306a36Sopenharmony_ci/* bits 4-5 */
52862306a36Sopenharmony_cienum {
52962306a36Sopenharmony_ci	AC_JACK_LOC_EXTERNAL = 0x00,
53062306a36Sopenharmony_ci	AC_JACK_LOC_INTERNAL = 0x10,
53162306a36Sopenharmony_ci	AC_JACK_LOC_SEPARATE = 0x20,
53262306a36Sopenharmony_ci	AC_JACK_LOC_OTHER    = 0x30,
53362306a36Sopenharmony_ci};
53462306a36Sopenharmony_cienum {
53562306a36Sopenharmony_ci	/* external on primary chasis */
53662306a36Sopenharmony_ci	AC_JACK_LOC_REAR_PANEL = 0x07,
53762306a36Sopenharmony_ci	AC_JACK_LOC_DRIVE_BAY,
53862306a36Sopenharmony_ci	/* internal */
53962306a36Sopenharmony_ci	AC_JACK_LOC_RISER = 0x17,
54062306a36Sopenharmony_ci	AC_JACK_LOC_HDMI,
54162306a36Sopenharmony_ci	AC_JACK_LOC_ATAPI,
54262306a36Sopenharmony_ci	/* others */
54362306a36Sopenharmony_ci	AC_JACK_LOC_MOBILE_IN = 0x37,
54462306a36Sopenharmony_ci	AC_JACK_LOC_MOBILE_OUT,
54562306a36Sopenharmony_ci};
54662306a36Sopenharmony_ci
54762306a36Sopenharmony_ci/* Port connectivity (0-3) */
54862306a36Sopenharmony_cienum {
54962306a36Sopenharmony_ci	AC_JACK_PORT_COMPLEX,
55062306a36Sopenharmony_ci	AC_JACK_PORT_NONE,
55162306a36Sopenharmony_ci	AC_JACK_PORT_FIXED,
55262306a36Sopenharmony_ci	AC_JACK_PORT_BOTH,
55362306a36Sopenharmony_ci};
55462306a36Sopenharmony_ci
55562306a36Sopenharmony_ci/* max. codec address */
55662306a36Sopenharmony_ci#define HDA_MAX_CODEC_ADDRESS	0x0f
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_ci#endif /* __SOUND_HDA_VERBS_H */
559