162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2020 The Linux Foundation. All rights reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * lpass_hdmi.h - Definitions for the QTi LPASS HDMI
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __LPASS_HDMI_H__
962306a36Sopenharmony_ci#define __LPASS_HDMI_H__
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/regmap.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define LPASS_HDMITX_LEGACY_DISABLE		0x0
1462306a36Sopenharmony_ci#define LPASS_HDMITX_LEGACY_ENABLE		0x1
1562306a36Sopenharmony_ci#define LPASS_DP_AUDIO_BITWIDTH16		0x0
1662306a36Sopenharmony_ci#define LPASS_DP_AUDIO_BITWIDTH24		0xb
1762306a36Sopenharmony_ci#define LPASS_DATA_FORMAT_SHIFT			0x1
1862306a36Sopenharmony_ci#define LPASS_FREQ_BIT_SHIFT			24
1962306a36Sopenharmony_ci#define LPASS_DATA_FORMAT_LINEAR		0x0
2062306a36Sopenharmony_ci#define LPASS_DATA_FORMAT_NON_LINEAR	0x1
2162306a36Sopenharmony_ci#define LPASS_SAMPLING_FREQ32			0x3
2262306a36Sopenharmony_ci#define LPASS_SAMPLING_FREQ44			0x0
2362306a36Sopenharmony_ci#define LPASS_SAMPLING_FREQ48			0x2
2462306a36Sopenharmony_ci#define LPASS_TX_CTL_RESET				0x1
2562306a36Sopenharmony_ci#define LPASS_TX_CTL_CLEAR				0x0
2662306a36Sopenharmony_ci#define LPASS_SSTREAM_ENABLE			1
2762306a36Sopenharmony_ci#define LPASS_SSTREAM_DISABLE			0
2862306a36Sopenharmony_ci#define LPASS_LAYOUT_SP_DEFAULT			0xf
2962306a36Sopenharmony_ci#define LPASS_SSTREAM_DEFAULT_ENABLE	1
3062306a36Sopenharmony_ci#define LPASS_SSTREAM_DEFAULT_DISABLE	0
3162306a36Sopenharmony_ci#define LPASS_MUTE_ENABLE				1
3262306a36Sopenharmony_ci#define LPASS_MUTE_DISABLE				0
3362306a36Sopenharmony_ci#define LPASS_META_DEFAULT_VAL			0
3462306a36Sopenharmony_ci#define HW_MODE							1
3562306a36Sopenharmony_ci#define SW_MODE							0
3662306a36Sopenharmony_ci#define LEGACY_LPASS_LPAIF				1
3762306a36Sopenharmony_ci#define LEGACY_LPASS_HDMI				0
3862306a36Sopenharmony_ci#define REPLACE_VBIT					0x1
3962306a36Sopenharmony_ci#define LINEAR_PCM_DATA					0x0
4062306a36Sopenharmony_ci#define NON_LINEAR_PCM_DATA				0x1
4162306a36Sopenharmony_ci#define HDMITX_PARITY_CALC_EN			0x1
4262306a36Sopenharmony_ci#define HDMITX_PARITY_CALC_DIS			0x0
4362306a36Sopenharmony_ci#define LPASS_DATA_FORMAT_MASK			GENMASK(1, 1)
4462306a36Sopenharmony_ci#define LPASS_WORDLENGTH_MASK			GENMASK(3, 0)
4562306a36Sopenharmony_ci#define LPASS_FREQ_BIT_MASK				GENMASK(27, 24)
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define LPASS_HDMI_TX_CTL_ADDR(v)		(v->hdmi_tx_ctl_addr)
4862306a36Sopenharmony_ci#define LPASS_HDMI_TX_LEGACY_ADDR(v)	(v->hdmi_legacy_addr)
4962306a36Sopenharmony_ci#define LPASS_HDMI_TX_VBIT_CTL_ADDR(v)	(v->hdmi_vbit_addr)
5062306a36Sopenharmony_ci#define LPASS_HDMI_TX_PARITY_ADDR(v)	(v->hdmi_parity_addr)
5162306a36Sopenharmony_ci#define LPASS_HDMI_TX_DP_ADDR(v)		(v->hdmi_DP_addr)
5262306a36Sopenharmony_ci#define LPASS_HDMI_TX_SSTREAM_ADDR(v)	(v->hdmi_sstream_addr)
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#define LPASS_HDMI_TX_CH_LSB_ADDR(v, port) \
5562306a36Sopenharmony_ci		(v->hdmi_ch_lsb_addr + v->ch_stride * (port))
5662306a36Sopenharmony_ci#define LPASS_HDMI_TX_CH_MSB_ADDR(v, port) \
5762306a36Sopenharmony_ci		(v->hdmi_ch_msb_addr + v->ch_stride * (port))
5862306a36Sopenharmony_ci#define LPASS_HDMI_TX_DMA_ADDR(v, port) \
5962306a36Sopenharmony_ci		(v->hdmi_dmactl_addr + v->hdmi_dma_stride * (port))
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_cistruct lpass_sstream_ctl {
6262306a36Sopenharmony_ci	struct regmap_field *sstream_en;
6362306a36Sopenharmony_ci	struct regmap_field *dma_sel;
6462306a36Sopenharmony_ci	struct regmap_field *auto_bbit_en;
6562306a36Sopenharmony_ci	struct regmap_field *layout;
6662306a36Sopenharmony_ci	struct regmap_field *layout_sp;
6762306a36Sopenharmony_ci	struct regmap_field *set_sp_on_en;
6862306a36Sopenharmony_ci	struct regmap_field *dp_audio;
6962306a36Sopenharmony_ci	struct regmap_field *dp_staffing_en;
7062306a36Sopenharmony_ci	struct regmap_field *dp_sp_b_hw_en;
7162306a36Sopenharmony_ci};
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_cistruct lpass_dp_metadata_ctl {
7462306a36Sopenharmony_ci	struct regmap_field *mute;
7562306a36Sopenharmony_ci	struct regmap_field *as_sdp_cc;
7662306a36Sopenharmony_ci	struct regmap_field *as_sdp_ct;
7762306a36Sopenharmony_ci	struct regmap_field *aif_db4;
7862306a36Sopenharmony_ci	struct regmap_field *frequency;
7962306a36Sopenharmony_ci	struct regmap_field *mst_index;
8062306a36Sopenharmony_ci	struct regmap_field *dptx_index;
8162306a36Sopenharmony_ci};
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_cistruct lpass_hdmi_tx_ctl {
8462306a36Sopenharmony_ci	struct regmap_field *soft_reset;
8562306a36Sopenharmony_ci	struct regmap_field *force_reset;
8662306a36Sopenharmony_ci};
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_cistruct lpass_hdmitx_dmactl {
8962306a36Sopenharmony_ci	struct regmap_field *use_hw_chs;
9062306a36Sopenharmony_ci	struct regmap_field *use_hw_usr;
9162306a36Sopenharmony_ci	struct regmap_field *hw_chs_sel;
9262306a36Sopenharmony_ci	struct regmap_field *hw_usr_sel;
9362306a36Sopenharmony_ci};
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_cistruct lpass_vbit_ctrl {
9662306a36Sopenharmony_ci		struct regmap_field *replace_vbit;
9762306a36Sopenharmony_ci		struct regmap_field *vbit_stream;
9862306a36Sopenharmony_ci};
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ciextern const struct snd_soc_dai_ops asoc_qcom_lpass_hdmi_dai_ops;
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci#endif /* __LPASS_HDMI_H__ */
103