linux/sound/soc/codecs/rt711-sdca.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * rt711-sdca.h -- RT711 SDCA ALSA SoC audio driver header
 *
 * Copyright(c) 2021 Realtek Semiconductor Corp.
 */

#ifndef __RT711_SDCA_H__
#define __RT711_SDCA_H__

#include <linux/pm.h>
#include <linux/regmap.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h>
#include <sound/soc.h>
#include <linux/workqueue.h>

struct  rt711_sdca_priv {};

/* NID */
#define RT711_AUDIO_FUNCTION_GROUP
#define RT711_DAC_OUT2
#define RT711_ADC_IN1
#define RT711_ADC_IN2
#define RT711_DMIC1
#define RT711_DMIC2
#define RT711_MIC2
#define RT711_LINE1
#define RT711_LINE2
#define RT711_BEEP
#define RT711_VENDOR_REG
#define RT711_HP_OUT
#define RT711_MIXER_IN1
#define RT711_MIXER_IN2
#define RT711_INLINE_CMD
#define RT711_VENDOR_CALI
#define RT711_VENDOR_IMS_DRE
#define RT711_VENDOR_VAD
#define RT711_VENDOR_ANALOG_CTL
#define RT711_VENDOR_HDA_CTL

/* Index (NID:20h) */
#define RT711_JD_PRODUCT_NUM
#define RT711_DMIC_CTL1
#define RT711_JD_CTL1
#define RT711_JD_CTL2
#define RT711_CC_DET1
#define RT711_PARA_VERB_CTL
#define RT711_COMBO_JACK_AUTO_CTL1
#define RT711_COMBO_JACK_AUTO_CTL2
#define RT711_COMBO_JACK_AUTO_CTL3
#define RT711_INLINE_CMD_CTL
#define RT711_DIGITAL_MISC_CTRL4
#define RT711_JD_CTRL6
#define RT711_VREFOUT_CTL
#define RT711_GPIO_TEST_MODE_CTL2
#define RT711_FSM_CTL
#define RT711_IRQ_FLAG_TABLE1
#define RT711_IRQ_FLAG_TABLE2
#define RT711_IRQ_FLAG_TABLE3
#define RT711_HP_FSM_CTL
#define RT711_TX_RX_MUX_CTL
#define RT711_FILTER_SRC_SEL
#define RT711_ADC27_VOL_SET

/* Index (NID:58h) */
#define RT711_DAC_DC_CALI_CTL1
#define RT711_DAC_DC_CALI_CTL2

/* Index (NID:5bh) */
#define RT711_IMS_DIGITAL_CTL1
#define RT711_HP_IMS_RESULT_L
#define RT711_HP_IMS_RESULT_R

/* Index (NID:5eh) */
#define RT711_VAD_SRAM_CTL1

/* Index (NID:5fh) */
#define RT711_MISC_POWER_CTL0
#define RT711_MISC_POWER_CTL4

/* Index (NID:61h) */
#define RT711_HDA_LEGACY_MUX_CTL1
#define RT711_HDA_LEGACY_UNSOLICITED_CTL
#define RT711_HDA_LEGACY_CONFIG_CTL
#define RT711_HDA_LEGACY_RESET_CTL
#define RT711_HDA_LEGACY_GPIO_CTL
#define RT711_ADC08_09_PDE_CTL
#define RT711_GE_MODE_RELATED_CTL
#define RT711_PUSH_BTN_INT_CTL0
#define RT711_PUSH_BTN_INT_CTL1
#define RT711_PUSH_BTN_INT_CTL2
#define RT711_PUSH_BTN_INT_CTL6
#define RT711_PUSH_BTN_INT_CTL7
#define RT711_PUSH_BTN_INT_CTL9

/* DAC DC offset calibration control-1 (0x00)(NID:20h) */
#define RT711_DAC_DC_CALI_TRIGGER
#define RT711_DAC_DC_CALI_CLK_EN
#define RT711_DAC_DC_FORCE_CALI_RST

/* jack detect control 1 (0x08)(NID:20h) */
#define RT711_JD2_DIGITAL_MODE_SEL

/* jack detect control 2 (0x09)(NID:20h) */
#define RT711_JD2_2PORT_200K_DECODE_HP
#define RT711_JD2_2PORT_100K_DECODE_MASK
#define RT711_JD2_2PORT_100K_DECODE_HP
#define RT711_HP_JD_SEL_JD1
#define RT711_HP_JD_SEL_JD2

/* CC DET1 (0x11)(NID:20h) */
#define RT711_HP_JD_FINAL_RESULT_CTL_JD12
#define RT711_HP_JD_FINAL_RESULT_CTL_CCDET
#define RT711_POW_CC1_AGPI
#define RT711_POW_CC1_AGPI_ON
#define RT711_POW_CC1_AGPI_OFF

/* Parameter & Verb control (0x1a)(NID:20h) */
#define RT711_HIDDEN_REG_SW_RESET

/* combo jack auto switch control 2 (0x46)(NID:20h) */
#define RT711_COMBOJACK_AUTO_DET_STATUS
#define RT711_COMBOJACK_AUTO_DET_TRS
#define RT711_COMBOJACK_AUTO_DET_CTIA
#define RT711_COMBOJACK_AUTO_DET_OMTP

/* FSM control (0x6f)(NID:20h) */
#define RT711_CALI_CTL
#define RT711_COMBOJACK_CTL
#define RT711_IMS_CTL
#define RT711_DEPOP_CTL
#define RT711_FSM_IMP_EN

/* Impedance Sense Digital Control 1 (0x00)(NID:5bh) */
#define RT711_TRIGGER_IMS
#define RT711_IMS_EN

#define RT711_EAPD_HIGH
#define RT711_EAPD_LOW
#define RT711_MUTE_SFT
/* set input/output mapping to payload[14][15] separately */
#define RT711_DIR_IN_SFT
#define RT711_DIR_OUT_SFT

/* RC Calibration register */
#define RT711_RC_CAL_STATUS

/* Buffer address for HID */
#define RT711_BUF_ADDR_HID1
#define RT711_BUF_ADDR_HID2

/* RT711 SDCA Control - function number */
#define FUNC_NUM_JACK_CODEC
#define FUNC_NUM_MIC_ARRAY
#define FUNC_NUM_HID

/* RT711 SDCA entity */
#define RT711_SDCA_ENT_HID01
#define RT711_SDCA_ENT_GE49
#define RT711_SDCA_ENT_USER_FU05
#define RT711_SDCA_ENT_USER_FU0F
#define RT711_SDCA_ENT_USER_FU1E
#define RT711_SDCA_ENT_PLATFORM_FU15
#define RT711_SDCA_ENT_PLATFORM_FU44
#define RT711_SDCA_ENT_PDE28
#define RT711_SDCA_ENT_PDE29
#define RT711_SDCA_ENT_PDE2A
#define RT711_SDCA_ENT_CS01
#define RT711_SDCA_ENT_CS11
#define RT711_SDCA_ENT_CS1F
#define RT711_SDCA_ENT_OT1
#define RT711_SDCA_ENT_LINE1
#define RT711_SDCA_ENT_LINE2
#define RT711_SDCA_ENT_PDELINE2
#define RT711_SDCA_ENT_USER_FU9

/* RT711 SDCA control */
#define RT711_SDCA_CTL_SAMPLE_FREQ_INDEX
#define RT711_SDCA_CTL_FU_CH_GAIN
#define RT711_SDCA_CTL_FU_MUTE
#define RT711_SDCA_CTL_FU_VOLUME
#define RT711_SDCA_CTL_HIDTX_CURRENT_OWNER
#define RT711_SDCA_CTL_HIDTX_SET_OWNER_TO_DEVICE
#define RT711_SDCA_CTL_HIDTX_MESSAGE_OFFSET
#define RT711_SDCA_CTL_HIDTX_MESSAGE_LENGTH
#define RT711_SDCA_CTL_SELECTED_MODE
#define RT711_SDCA_CTL_DETECTED_MODE
#define RT711_SDCA_CTL_REQ_POWER_STATE
#define RT711_SDCA_CTL_VENDOR_DEF

/* RT711 SDCA channel */
#define CH_L
#define CH_R

/* sample frequency index */
#define RT711_SDCA_RATE_44100HZ
#define RT711_SDCA_RATE_48000HZ
#define RT711_SDCA_RATE_96000HZ
#define RT711_SDCA_RATE_192000HZ

enum {};

enum rt711_sdca_jd_src {};

enum rt711_sdca_ver {};

int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave);
int rt711_sdca_init(struct device *dev, struct regmap *regmap,
	       struct regmap *mbq_regmap, struct sdw_slave *slave);

int rt711_sdca_jack_detect(struct rt711_sdca_priv *rt711, bool *hp, bool *mic);
#endif /* __RT711_SDCA_H__ */