linux/sound/soc/codecs/rt711.h

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

#ifndef __RT711_H__
#define __RT711_H__

extern const struct dev_pm_ops rt711_runtime_pm;

struct  rt711_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

/* Index (NID:20h) */
#define RT711_DAC_DC_CALI_CTL1
#define RT711_JD_CTL1
#define RT711_JD_CTL2
#define RT711_JD_CTL4
#define RT711_CC_DET1
#define RT711_PARA_VERB_CTL
#define RT711_COMBO_JACK_AUTO_CTL1
#define RT711_COMBO_JACK_AUTO_CTL2
#define RT711_INLINE_CMD_CTL
#define RT711_DIGITAL_MISC_CTRL4
#define RT711_VREFOUT_CTL
#define RT711_FSM_CTL
#define RT711_IRQ_FLAG_TABLE1
#define RT711_IRQ_FLAG_TABLE2
#define RT711_IRQ_FLAG_TABLE3
#define RT711_TX_RX_MUX_CTL

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

/* Verb */
#define RT711_VERB_SET_CONNECT_SEL
#define RT711_VERB_SET_EAPD_BTLENABLE
#define RT711_VERB_GET_CONNECT_SEL
#define RT711_VERB_SET_POWER_STATE
#define RT711_VERB_SET_CHANNEL_STREAMID
#define RT711_VERB_SET_PIN_WIDGET_CONTROL
#define RT711_VERB_SET_UNSOLICITED_ENABLE
#define RT711_SET_AMP_GAIN_MUTE_H
#define RT711_SET_AMP_GAIN_MUTE_L
#define RT711_VERB_GET_POWER_STATE
#define RT711_VERB_GET_CHANNEL_STREAMID
#define RT711_VERB_GET_PIN_SENSE
#define RT711_FUNC_RESET

#define RT711_READ_HDA_3
#define RT711_READ_HDA_2
#define RT711_READ_HDA_1
#define RT711_READ_HDA_0
#define RT711_PRIV_INDEX_W_H
#define RT711_PRIV_INDEX_W_L
#define RT711_PRIV_DATA_W_H
#define RT711_PRIV_DATA_W_L
#define RT711_PRIV_INDEX_R_H
#define RT711_PRIV_INDEX_R_L
#define RT711_PRIV_DATA_R_H
#define RT711_PRIV_DATA_R_L
#define RT711_DAC_FORMAT_H
#define RT711_DAC_FORMAT_L
#define RT711_ADC1_FORMAT_H
#define RT711_ADC1_FORMAT_L
#define RT711_ADC2_FORMAT_H
#define RT711_ADC2_FORMAT_L

#define RT711_SET_AUDIO_POWER_STATE
#define RT711_GET_AUDIO_POWER_STATE
#define RT711_SET_PIN_DMIC1
#define RT711_SET_PIN_DMIC2
#define RT711_SET_PIN_HP
#define RT711_SET_PIN_MIC2
#define RT711_SET_PIN_LINE1
#define RT711_SET_PIN_LINE2
#define RT711_SET_MIC2_UNSOLICITED_ENABLE
#define RT711_SET_HP_UNSOLICITED_ENABLE
#define RT711_SET_INLINE_UNSOLICITED_ENABLE
#define RT711_SET_STREAMID_DAC2
#define RT711_SET_STREAMID_ADC1
#define RT711_SET_STREAMID_ADC2
#define RT711_GET_STREAMID_DAC2
#define RT711_GET_STREAMID_ADC1
#define RT711_GET_STREAMID_ADC2
#define RT711_SET_GAIN_DAC2_L
#define RT711_SET_GAIN_DAC2_H
#define RT711_SET_GAIN_ADC1_L
#define RT711_SET_GAIN_ADC1_H
#define RT711_SET_GAIN_ADC2_L
#define RT711_SET_GAIN_ADC2_H
#define RT711_SET_GAIN_AMIC_L
#define RT711_SET_GAIN_AMIC_H
#define RT711_SET_GAIN_DMIC1_L
#define RT711_SET_GAIN_DMIC1_H
#define RT711_SET_GAIN_DMIC2_L
#define RT711_SET_GAIN_DMIC2_H
#define RT711_SET_GAIN_HP_L
#define RT711_SET_GAIN_HP_H

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

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

/* jack detect control 2 (0x09)(NID:20h) */
#define RT711_JD2_2PORT_200K_DECODE_HP
#define RT711_JD2_2PORT_100K_DECODE
#define RT711_JD2_2PORT_100K_DECODE_HP
#define RT711_HP_JD_SEL_JD1
#define RT711_HP_JD_SEL_JD2
#define RT711_JD2_1PORT_TYPE_DECODE
#define RT711_JD2_1PORT_JD_LINE2
#define RT711_JD2_1PORT_JD_HP
#define RT711_JD2_1PORT_JD_LINE1
#define RT711_JD1_2PORT_TYPE_100K_DECODE
#define RT711_JD1_2PORT_JD_RESERVED
#define RT711_JD1_2PORT_JD_LINE1

/* jack detect control 4 (0x0b)(NID:20h) */
#define RT711_JD2_PAD_PULL_UP_MASK
#define RT711_JD2_PAD_NOT_PULL_UP
#define RT711_JD2_PAD_PULL_UP
#define RT711_JD2_MODE_SEL_MASK
#define RT711_JD2_MODE0_2PORT
#define RT711_JD2_MODE1_3P3V_1PORT
#define RT711_JD2_MODE2_1P8V_1PORT

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

/* 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

/* 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

enum {};

enum rt711_jd_src {};

int rt711_io_init(struct device *dev, struct sdw_slave *slave);
int rt711_init(struct device *dev, struct regmap *sdw_regmap,
	       struct regmap *regmap, struct sdw_slave *slave);

int rt711_jack_detect(struct rt711_priv *rt711, bool *hp, bool *mic);
int rt711_clock_config(struct device *dev);
#endif /* __RT711_H__ */