sound/soc/codecs/wcd-mbhc-v2.h

Source file repositories/reference/linux-study-clean/sound/soc/codecs/wcd-mbhc-v2.h

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/wcd-mbhc-v2.h
Extension
.h
Size
8671 bytes
Lines
344
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct wcd_mbhc_config {
	int btn_high[WCD_MBHC_DEF_BUTTONS];
	int btn_low[WCD_MBHC_DEF_BUTTONS];
	int v_hs_max;
	int num_btn;
	bool mono_stero_detection;
	bool typec_analog_mux;
	bool (*swap_gnd_mic)(struct snd_soc_component *component);
	bool hs_ext_micbias;
	bool gnd_det_en;
	uint32_t linein_th;
	bool moisture_en;
	int mbhc_micbias;
	int anc_micbias;
	bool moisture_duty_cycle_en;
	bool hphl_swh; /*track HPHL switch NC / NO */
	bool gnd_swh; /*track GND switch NC / NO */
	u32 hs_thr;
	u32 hph_thr;
	u32 micb_mv;
	u32 moist_vref;
	u32 moist_iref;
	u32 moist_rref;
};

struct wcd_mbhc_intr {
	int mbhc_sw_intr;
	int mbhc_btn_press_intr;
	int mbhc_btn_release_intr;
	int mbhc_hs_ins_intr;
	int mbhc_hs_rem_intr;
	int hph_left_ocp;
	int hph_right_ocp;
};

struct wcd_mbhc_field {
	u16 reg;
	u8 mask;
};

struct wcd_mbhc;

struct wcd_mbhc_cb {
	void (*update_cross_conn_thr)(struct snd_soc_component *component);
	void (*get_micbias_val)(struct snd_soc_component *component, int *mb);
	void (*bcs_enable)(struct snd_soc_component *component, bool bcs_enable);
	void (*compute_impedance)(struct snd_soc_component *component,
				  uint32_t *zl, uint32_t *zr);
	void (*set_micbias_value)(struct snd_soc_component *component);
	void (*set_auto_zeroing)(struct snd_soc_component *component,
			bool enable);
	void (*clk_setup)(struct snd_soc_component *component, bool enable);
	bool (*micbias_enable_status)(struct snd_soc_component *component, int micb_num);
	void (*mbhc_bias)(struct snd_soc_component *component, bool enable);
	void (*set_btn_thr)(struct snd_soc_component *component,
			    int *btn_low, int *btn_high,
			    int num_btn, bool is_micbias);
	void (*hph_pull_up_control)(struct snd_soc_component *component,
				    enum mbhc_hs_pullup_iref);
	int (*mbhc_micbias_control)(struct snd_soc_component *component,
			int micb_num, int req);
	void (*mbhc_micb_ramp_control)(struct snd_soc_component *component,
			bool enable);
	bool (*extn_use_mb)(struct snd_soc_component *component);
	int (*mbhc_micb_ctrl_thr_mic)(struct snd_soc_component *component,
			int micb_num, bool req_en);
	void (*mbhc_gnd_det_ctrl)(struct snd_soc_component *component,
			bool enable);
	void (*hph_pull_down_ctrl)(struct snd_soc_component *component,
			bool enable);
	void (*mbhc_moisture_config)(struct snd_soc_component *component);
	void (*update_anc_state)(struct snd_soc_component *component,
			bool enable, int anc_num);
	void (*hph_pull_up_control_v2)(struct snd_soc_component *component,
			int pull_up_cur);
	bool (*mbhc_get_moisture_status)(struct snd_soc_component *component);
	void (*mbhc_moisture_polling_ctrl)(struct snd_soc_component *component, bool enable);
	void (*mbhc_moisture_detect_en)(struct snd_soc_component *component, bool enable);
};

#if IS_ENABLED(CONFIG_SND_SOC_WCD_MBHC)
int wcd_dt_parse_mbhc_data(struct device *dev, struct wcd_mbhc_config *cfg);
int wcd_mbhc_start(struct wcd_mbhc *mbhc, struct wcd_mbhc_config *mbhc_cfg,
		   struct snd_soc_jack *jack);
void wcd_mbhc_stop(struct wcd_mbhc *mbhc);
void wcd_mbhc_set_hph_type(struct wcd_mbhc *mbhc, int hph_type);
int wcd_mbhc_get_hph_type(struct wcd_mbhc *mbhc);
int wcd_mbhc_typec_report_plug(struct wcd_mbhc *mbhc);
int wcd_mbhc_typec_report_unplug(struct wcd_mbhc *mbhc);
struct wcd_mbhc *wcd_mbhc_init(struct snd_soc_component *component,

Annotation

Implementation Notes