xref: /openbmc/linux/sound/soc/qcom/lpass-hdmi.h (revision bbb774d9)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2020 The Linux Foundation. All rights reserved.
4  *
5  * lpass_hdmi.h - Definitions for the QTi LPASS HDMI
6  */
7 
8 #ifndef __LPASS_HDMI_H__
9 #define __LPASS_HDMI_H__
10 
11 #include <linux/regmap.h>
12 
13 #define LPASS_HDMITX_LEGACY_DISABLE		0x0
14 #define LPASS_HDMITX_LEGACY_ENABLE		0x1
15 #define LPASS_DP_AUDIO_BITWIDTH16		0x0
16 #define LPASS_DP_AUDIO_BITWIDTH24		0xb
17 #define LPASS_DATA_FORMAT_SHIFT			0x1
18 #define LPASS_FREQ_BIT_SHIFT			24
19 #define LPASS_DATA_FORMAT_LINEAR		0x0
20 #define LPASS_DATA_FORMAT_NON_LINEAR	0x1
21 #define LPASS_SAMPLING_FREQ32			0x3
22 #define LPASS_SAMPLING_FREQ44			0x0
23 #define LPASS_SAMPLING_FREQ48			0x2
24 #define LPASS_TX_CTL_RESET				0x1
25 #define LPASS_TX_CTL_CLEAR				0x0
26 #define LPASS_SSTREAM_ENABLE			1
27 #define LPASS_SSTREAM_DISABLE			0
28 #define LPASS_LAYOUT_SP_DEFAULT			0xf
29 #define LPASS_SSTREAM_DEFAULT_ENABLE	1
30 #define LPASS_SSTREAM_DEFAULT_DISABLE	0
31 #define LPASS_MUTE_ENABLE				1
32 #define LPASS_MUTE_DISABLE				0
33 #define LPASS_META_DEFAULT_VAL			0
34 #define HW_MODE							1
35 #define SW_MODE							0
36 #define LEGACY_LPASS_LPAIF				1
37 #define LEGACY_LPASS_HDMI				0
38 #define REPLACE_VBIT					0x1
39 #define LINEAR_PCM_DATA					0x0
40 #define NON_LINEAR_PCM_DATA				0x1
41 #define HDMITX_PARITY_CALC_EN			0x1
42 #define HDMITX_PARITY_CALC_DIS			0x0
43 #define LPASS_DATA_FORMAT_MASK			GENMASK(1, 1)
44 #define LPASS_WORDLENGTH_MASK			GENMASK(3, 0)
45 #define LPASS_FREQ_BIT_MASK				GENMASK(27, 24)
46 
47 #define LPASS_HDMI_TX_CTL_ADDR(v)		(v->hdmi_tx_ctl_addr)
48 #define LPASS_HDMI_TX_LEGACY_ADDR(v)	(v->hdmi_legacy_addr)
49 #define LPASS_HDMI_TX_VBIT_CTL_ADDR(v)	(v->hdmi_vbit_addr)
50 #define LPASS_HDMI_TX_PARITY_ADDR(v)	(v->hdmi_parity_addr)
51 #define LPASS_HDMI_TX_DP_ADDR(v)		(v->hdmi_DP_addr)
52 #define LPASS_HDMI_TX_SSTREAM_ADDR(v)	(v->hdmi_sstream_addr)
53 
54 #define LPASS_HDMI_TX_CH_LSB_ADDR(v, port) \
55 		(v->hdmi_ch_lsb_addr + v->ch_stride * (port))
56 #define LPASS_HDMI_TX_CH_MSB_ADDR(v, port) \
57 		(v->hdmi_ch_msb_addr + v->ch_stride * (port))
58 #define LPASS_HDMI_TX_DMA_ADDR(v, port) \
59 		(v->hdmi_dmactl_addr + v->hdmi_dma_stride * (port))
60 
61 struct lpass_sstream_ctl {
62 	struct regmap_field *sstream_en;
63 	struct regmap_field *dma_sel;
64 	struct regmap_field *auto_bbit_en;
65 	struct regmap_field *layout;
66 	struct regmap_field *layout_sp;
67 	struct regmap_field *set_sp_on_en;
68 	struct regmap_field *dp_audio;
69 	struct regmap_field *dp_staffing_en;
70 	struct regmap_field *dp_sp_b_hw_en;
71 };
72 
73 struct lpass_dp_metadata_ctl {
74 	struct regmap_field *mute;
75 	struct regmap_field *as_sdp_cc;
76 	struct regmap_field *as_sdp_ct;
77 	struct regmap_field *aif_db4;
78 	struct regmap_field *frequency;
79 	struct regmap_field *mst_index;
80 	struct regmap_field *dptx_index;
81 };
82 
83 struct lpass_hdmi_tx_ctl {
84 	struct regmap_field *soft_reset;
85 	struct regmap_field *force_reset;
86 };
87 
88 struct lpass_hdmitx_dmactl {
89 	struct regmap_field *use_hw_chs;
90 	struct regmap_field *use_hw_usr;
91 	struct regmap_field *hw_chs_sel;
92 	struct regmap_field *hw_usr_sel;
93 };
94 
95 struct lpass_vbit_ctrl {
96 		struct regmap_field *replace_vbit;
97 		struct regmap_field *vbit_stream;
98 };
99 
100 extern const struct snd_soc_dai_ops asoc_qcom_lpass_hdmi_dai_ops;
101 
102 #endif /* __LPASS_HDMI_H__ */
103