#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/pm_runtime.h>
#include <linux/printk.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include "wcd-mbhc-v2.h"
#define HS_DETECT_PLUG_TIME_MS …
#define MBHC_BUTTON_PRESS_THRESHOLD_MIN …
#define GND_MIC_SWAP_THRESHOLD …
#define GND_MIC_USBC_SWAP_THRESHOLD …
#define WCD_FAKE_REMOVAL_MIN_PERIOD_MS …
#define HPHL_CROSS_CONN_THRESHOLD …
#define HS_VREF_MIN_VAL …
#define FAKE_REM_RETRY_ATTEMPTS …
#define WCD_MBHC_ADC_HS_THRESHOLD_MV …
#define WCD_MBHC_ADC_HPH_THRESHOLD_MV …
#define WCD_MBHC_ADC_MICBIAS_MV …
#define WCD_MBHC_FAKE_INS_RETRY …
#define WCD_MBHC_JACK_MASK …
#define WCD_MBHC_JACK_BUTTON_MASK …
enum wcd_mbhc_adc_mux_ctl { … };
struct wcd_mbhc { … };
static inline int wcd_mbhc_write_field(const struct wcd_mbhc *mbhc,
int field, int val)
{ … }
static inline int wcd_mbhc_read_field(const struct wcd_mbhc *mbhc, int field)
{ … }
static void wcd_program_hs_vref(struct wcd_mbhc *mbhc)
{ … }
static void wcd_program_btn_threshold(const struct wcd_mbhc *mbhc, bool micbias)
{ … }
static void wcd_mbhc_curr_micbias_control(const struct wcd_mbhc *mbhc,
const enum wcd_mbhc_cs_mb_en_flag cs_mb_en)
{ … }
int wcd_mbhc_event_notify(struct wcd_mbhc *mbhc, unsigned long event)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wcd_cancel_btn_work(struct wcd_mbhc *mbhc)
{ … }
static void wcd_micbias_disable(struct wcd_mbhc *mbhc)
{ … }
static void wcd_mbhc_report_plug_removal(struct wcd_mbhc *mbhc,
enum snd_jack_types jack_type)
{ … }
static void wcd_mbhc_compute_impedance(struct wcd_mbhc *mbhc)
{ … }
static void wcd_mbhc_report_plug_insertion(struct wcd_mbhc *mbhc,
enum snd_jack_types jack_type)
{ … }
static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
enum snd_jack_types jack_type)
{ … }
static void wcd_cancel_hs_detect_plug(struct wcd_mbhc *mbhc,
struct work_struct *work)
{ … }
static void wcd_mbhc_cancel_pending_work(struct wcd_mbhc *mbhc)
{ … }
static void wcd_mbhc_elec_hs_report_unplug(struct wcd_mbhc *mbhc)
{ … }
static void wcd_mbhc_find_plug_and_report(struct wcd_mbhc *mbhc,
enum wcd_mbhc_plug_type plug_type)
{ … }
static void wcd_schedule_hs_detect_plug(struct wcd_mbhc *mbhc,
struct work_struct *work)
{ … }
static void wcd_mbhc_adc_detect_plug_type(struct wcd_mbhc *mbhc)
{ … }
static void mbhc_plug_detect_fn(struct work_struct *work)
{ … }
static irqreturn_t wcd_mbhc_mech_plug_detect_irq(int irq, void *data)
{ … }
int wcd_mbhc_typec_report_unplug(struct wcd_mbhc *mbhc)
{ … }
EXPORT_SYMBOL_GPL(…);
int wcd_mbhc_typec_report_plug(struct wcd_mbhc *mbhc)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wcd_mbhc_get_button_mask(struct wcd_mbhc *mbhc)
{ … }
static void wcd_btn_long_press_fn(struct work_struct *work)
{ … }
static irqreturn_t wcd_mbhc_btn_press_handler(int irq, void *data)
{ … }
static irqreturn_t wcd_mbhc_btn_release_handler(int irq, void *data)
{ … }
static irqreturn_t wcd_mbhc_hph_ocp_irq(struct wcd_mbhc *mbhc, bool hphr)
{ … }
static irqreturn_t wcd_mbhc_hphl_ocp_irq(int irq, void *data)
{ … }
static irqreturn_t wcd_mbhc_hphr_ocp_irq(int irq, void *data)
{ … }
static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc)
{ … }
static int wcd_mbhc_get_micbias(struct wcd_mbhc *mbhc)
{ … }
static int wcd_get_voltage_from_adc(u8 val, int micbias)
{ … }
static int wcd_measure_adc_continuous(struct wcd_mbhc *mbhc)
{ … }
static int wcd_measure_adc_once(struct wcd_mbhc *mbhc, int mux_ctl)
{ … }
static int wcd_check_cross_conn(struct wcd_mbhc *mbhc)
{ … }
static int wcd_mbhc_adc_get_hs_thres(struct wcd_mbhc *mbhc)
{ … }
static int wcd_mbhc_adc_get_hph_thres(struct wcd_mbhc *mbhc)
{ … }
static void wcd_mbhc_adc_update_fsm_source(struct wcd_mbhc *mbhc,
enum wcd_mbhc_plug_type plug_type)
{ … }
static void wcd_mbhc_bcs_enable(struct wcd_mbhc *mbhc, int plug_type, bool enable)
{ … }
static int wcd_mbhc_get_plug_from_adc(struct wcd_mbhc *mbhc, int adc_result)
{ … }
static int wcd_mbhc_get_spl_hs_thres(struct wcd_mbhc *mbhc)
{ … }
static bool wcd_mbhc_check_for_spl_headset(struct wcd_mbhc *mbhc)
{ … }
static void wcd_correct_swch_plug(struct work_struct *work)
{ … }
static irqreturn_t wcd_mbhc_adc_hs_rem_irq(int irq, void *data)
{ … }
static irqreturn_t wcd_mbhc_adc_hs_ins_irq(int irq, void *data)
{ … }
int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, uint32_t *zl, uint32_t *zr)
{ … }
EXPORT_SYMBOL(…);
void wcd_mbhc_set_hph_type(struct wcd_mbhc *mbhc, int hph_type)
{ … }
EXPORT_SYMBOL(…);
int wcd_mbhc_get_hph_type(struct wcd_mbhc *mbhc)
{ … }
EXPORT_SYMBOL(…);
int wcd_mbhc_start(struct wcd_mbhc *mbhc, struct wcd_mbhc_config *cfg,
struct snd_soc_jack *jack)
{ … }
EXPORT_SYMBOL(…);
void wcd_mbhc_stop(struct wcd_mbhc *mbhc)
{ … }
EXPORT_SYMBOL(…);
int wcd_dt_parse_mbhc_data(struct device *dev, struct wcd_mbhc_config *cfg)
{ … }
EXPORT_SYMBOL(…);
struct wcd_mbhc *wcd_mbhc_init(struct snd_soc_component *component,
const struct wcd_mbhc_cb *mbhc_cb,
const struct wcd_mbhc_intr *intr_ids,
const struct wcd_mbhc_field *fields,
bool impedance_det_en)
{ … }
EXPORT_SYMBOL(…);
void wcd_mbhc_deinit(struct wcd_mbhc *mbhc)
{ … }
EXPORT_SYMBOL(…);
static int __init mbhc_init(void)
{ … }
static void __exit mbhc_exit(void)
{ … }
module_init(…) …;
module_exit(mbhc_exit);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;